Skip to content

Commit

Permalink
Access functions for ilo and ihi in CartGrid
Browse files Browse the repository at this point in the history
  • Loading branch information
itopcuoglu committed Jan 1, 2025
1 parent ee3b2e7 commit 686737e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/CartBlock.C
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,11 @@ void CartBlock::preprocess(CartGrid* cg)
for (int n = 0; n < 3; n++) {
dx[n] = cg->dx[(3 * global_id) + n];
}
dims[0] = cg->ihi[static_cast<ptrdiff_t>(3 * global_id)] -
cg->ilo[static_cast<ptrdiff_t>(3 * global_id)] + 1;
dims[1] = cg->ihi[(3 * global_id) + 1] - cg->ilo[(3 * global_id) + 1] + 1;
dims[2] = cg->ihi[(3 * global_id) + 2] - cg->ilo[(3 * global_id) + 2] + 1;
dims[0] = cg->get_ihi((3 * global_id)) - cg->get_ilo((3 * global_id)) + 1;
dims[1] =
cg->get_ihi((3 * global_id) + 1) - cg->get_ilo((3 * global_id) + 1) + 1;
dims[2] =
cg->get_ihi((3 * global_id) + 2) - cg->get_ilo((3 * global_id) + 2) + 1;
nf = cg->nf;
myid = cg->get_myid();
donor_frac = cg->donor_frac;
Expand Down
6 changes: 4 additions & 2 deletions src/CartGrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class CartGrid
int* proc_id{nullptr};
int* local_id{nullptr};
int myid{0};

public:
int* ilo{nullptr};
int* ihi{nullptr};

public:
int* dims{nullptr};

Check warning on line 53 in src/CartGrid.h

View workflow job for this annotation

GitHub Actions / Lint-clang-tidy

member variable 'dims' has public visibility [misc-non-private-member-variables-in-classes]
int nf{0};

Check warning on line 54 in src/CartGrid.h

View workflow job for this annotation

GitHub Actions / Lint-clang-tidy

member variable 'nf' has public visibility [misc-non-private-member-variables-in-classes]
double* xlo{nullptr};

Check warning on line 55 in src/CartGrid.h

View workflow job for this annotation

GitHub Actions / Lint-clang-tidy

member variable 'xlo' has public visibility [misc-non-private-member-variables-in-classes]
Expand Down Expand Up @@ -77,6 +77,8 @@ class CartGrid
int get_local_id(int index) { return local_id[index]; }
void set_myid(int rank_id) { myid = rank_id; }
int get_myid() { return myid; }

Check warning on line 79 in src/CartGrid.h

View workflow job for this annotation

GitHub Actions / Lint-clang-tidy

method 'get_myid' can be made const [readability-make-member-function-const]
int get_ilo(int index) { return ilo[index]; }
int get_ihi(int index) { return ihi[index]; }
};

#endif /* CARTGRID_H */

0 comments on commit 686737e

Please sign in to comment.