Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Morton numbers and expand LogicalLocation functionality #900

Merged
merged 72 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
79b4508
Start on in one AMR
lroberts36 May 23, 2023
d9f6597
Fix MPI bug
lroberts36 May 23, 2023
1f0bc22
Make things work w/o MPI
lroberts36 May 24, 2023
8c77f58
small
lroberts36 May 24, 2023
782b015
update changelog
lroberts36 May 24, 2023
a54d9c7
Make AMR helper functions free to alleviate compilation issues on GPU
lroberts36 May 24, 2023
7a76e07
Fix MPI compilation error
lroberts36 May 24, 2023
6192546
Actually compile with MPI...
lroberts36 May 24, 2023
3c30a58
Fix indexing bug
lroberts36 May 24, 2023
0e9eebb
Remove unused vars
lroberts36 May 24, 2023
06152ac
Fix indexing bug
lroberts36 May 24, 2023
9bcae8e
Make things work for tensor variables
lroberts36 May 24, 2023
2451619
Merge branch 'develop' into lroberts36/in-one-zero-memory-amr
lroberts36 May 30, 2023
f868405
CellVariable to Variable
lroberts36 May 31, 2023
32ef90a
Merge branch 'develop' into lroberts36/in-one-zero-memory-amr
pgrete Jun 8, 2023
2cb3ccc
Respond to Philipp's comments
lroberts36 Jun 8, 2023
14f4ff5
Maybe fix compiler issues
lroberts36 Jun 8, 2023
d32bf95
Second half of fix
lroberts36 Jun 8, 2023
ff85612
Merge branch 'develop' into lroberts36/in-one-zero-memory-amr
pgrete Jun 12, 2023
876c1e1
Add fence back
lroberts36 Jun 12, 2023
7b62eae
Update copyright dates
lroberts36 Jun 12, 2023
a04710c
Merge branch 'develop' into lroberts36/in-one-zero-memory-amr
lroberts36 Jun 20, 2023
23e808c
Pass dealloc count when sending same to same
lroberts36 Jun 14, 2023
240cf74
Almost working, but differs on step 301 after remesh
lroberts36 Jun 15, 2023
eef12dc
Add deletion check
lroberts36 Jun 15, 2023
b0cef73
Fix a bunch of bugs with a couple changes
lroberts36 Jun 15, 2023
b93935f
Format, lint, changelog
lroberts36 Jun 15, 2023
ec6470d
Remove debugging MPI Barrier
lroberts36 Jun 15, 2023
1c20c86
Add maximum number of iterations for deletion check
lroberts36 Jun 19, 2023
5de8950
Remove commented lines and clean up
lroberts36 Jun 19, 2023
5989af3
Fix MPI AMR bug related to not passing dereference count when nothing…
lroberts36 Jun 20, 2023
3d7072a
format and lint
lroberts36 Jun 20, 2023
f914b65
Merge branch 'develop' into lroberts36/in-one-zero-memory-amr
lroberts36 Jun 20, 2023
5688eb2
Always apply fine boundary conditions
lroberts36 Jun 21, 2023
d184f06
Start on adding morton numbers
lroberts36 Jun 27, 2023
8080ad2
Make stuff private
lroberts36 Jun 27, 2023
58c795b
format and lint
lroberts36 Jun 27, 2023
d88a2aa
Add real comparison operators
lroberts36 Jun 27, 2023
515a25b
Split out morton number
lroberts36 Jun 27, 2023
2b36ffb
Fix bug when shift is larger than bit size
lroberts36 Jun 27, 2023
7ee9cc1
Add some more functionality to logical location
lroberts36 Jun 27, 2023
1de9aef
Start on unit test
lroberts36 Jun 27, 2023
9a9aedd
Actually compare Morton numbers
lroberts36 Jun 27, 2023
03c5031
Add neighbor check, untested
lroberts36 Jun 27, 2023
6cf2a44
Fix TE neighbor finding and add tests
lroberts36 Jun 28, 2023
7cf36fe
Update copyrights
lroberts36 Jun 28, 2023
b8f67bb
Merge branch 'develop' into lroberts36/add-morton-numbers
lroberts36 Jun 28, 2023
f869aa8
Add logical location to NeighborBlock
lroberts36 Jun 28, 2023
3e5f172
Merge branch 'develop' into lroberts36/add-morton-numbers
lroberts36 Jun 28, 2023
1ffc2a7
Merge branch 'develop' into lroberts36/in-one-zero-memory-amr
lroberts36 Jun 28, 2023
0080d57
add interleave constant test and fix bug
lroberts36 Jun 28, 2023
a420a73
Add bit interleave test
lroberts36 Jun 28, 2023
9980aca
update changelog
lroberts36 Jun 28, 2023
8ff2823
Explicitly start at zero
lroberts36 Jun 28, 2023
be7daad
Add routines for calculating ownership and tests
lroberts36 Jun 29, 2023
28224e1
Remove comments
lroberts36 Jun 29, 2023
6c86239
Add another ownership test
lroberts36 Jun 29, 2023
90c4020
Format and lint
lroberts36 Jun 29, 2023
45a0a6e
switch to bits
lroberts36 Jul 5, 2023
72ab478
Separate logical location header
lroberts36 Jul 5, 2023
c113d20
Switch to class
lroberts36 Jul 5, 2023
ca7c60e
reserve
lroberts36 Jul 5, 2023
82a6fce
Merge branch 'lroberts36/in-one-zero-memory-amr' into lroberts36/add-…
lroberts36 Jul 6, 2023
5a18111
format and lint
lroberts36 Jul 6, 2023
7790c11
Fix errors hidden by MPI ifdef
lroberts36 Jul 6, 2023
fced172
Merge branch 'develop' into lroberts36/add-morton-numbers
lroberts36 Jul 6, 2023
48fbc31
Merge branch 'develop' into lroberts36/add-morton-numbers
lroberts36 Jul 7, 2023
00c34e6
Format and lint
lroberts36 Jul 7, 2023
a94f3fb
Add possible neighbors on periodic boundaries
lroberts36 Jul 12, 2023
c03d26e
Explicitly deal with periodic vs non-periodic directions
lroberts36 Jul 13, 2023
242e50d
Act on Philipp's comments
lroberts36 Jul 18, 2023
42a99d8
Fix linter error
lroberts36 Jul 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Current develop

### Added (new features/APIs/variables/...)
- [[PR 900]](https://github.com/parthenon-hpc-lab/parthenon/pull/900) Add Morton numbers and expand functionality of LogicalLocation
- [[PR 902]](https://github.com/parthenon-hpc-lab/parthenon/pull/902) Add ability to output NaNs for de-allocated sparse fields
- [[PR 887]](https://github.com/parthenon-hpc-lab/parthenon/pull/887) Add ability to dump more types of params and read them from restarts
- [[PR 884]](https://github.com/parthenon-hpc-lab/parthenon/pull/884) Add constant derivative BC and expose GenericBC
Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ add_library(parthenon

mesh/amr_loadbalance.cpp
mesh/domain.hpp
mesh/logical_location.hpp
mesh/mesh_refinement.cpp
mesh/mesh_refinement.hpp
mesh/mesh.cpp
Expand Down Expand Up @@ -229,6 +230,7 @@ add_library(parthenon
utils/hash.hpp
utils/indexer.hpp
utils/loop_utils.hpp
utils/morton_number.hpp
utils/mpi_types.hpp
utils/multi_pointer.hpp
utils/nan_payload_tag.hpp
Expand Down
2 changes: 1 addition & 1 deletion src/amr_criteria/refinement_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ AmrTag CheckAllRefinement(MeshBlockData<Real> *rc) {
for (auto &amr : desc->amr_criteria) {
// get the recommended change in refinement level from this criteria
AmrTag temp_delta = (*amr)(rc);
if ((temp_delta == AmrTag::refine) && pmb->loc.level >= amr->max_level) {
if ((temp_delta == AmrTag::refine) && pmb->loc.level() >= amr->max_level) {
// don't refine if we're at the max level
temp_delta = AmrTag::same;
}
Expand Down
6 changes: 3 additions & 3 deletions src/bvals/boundary_conditions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ void ComputeProlongationBounds_(const std::shared_ptr<MeshBlock> &pmb,
}
};

getbounds(nb.ni.ox1, pmb->loc.lx1, pmb->c_cellbounds.GetBoundsI(interior), bi);
getbounds(nb.ni.ox2, pmb->loc.lx2, pmb->c_cellbounds.GetBoundsJ(interior), bj);
getbounds(nb.ni.ox3, pmb->loc.lx3, pmb->c_cellbounds.GetBoundsK(interior), bk);
getbounds(nb.ni.ox1, pmb->loc.lx1(), pmb->c_cellbounds.GetBoundsI(interior), bi);
getbounds(nb.ni.ox2, pmb->loc.lx2(), pmb->c_cellbounds.GetBoundsJ(interior), bj);
getbounds(nb.ni.ox3, pmb->loc.lx3(), pmb->c_cellbounds.GetBoundsK(interior), bk);
}

} // namespace boundary_cond_impl
Expand Down
105 changes: 53 additions & 52 deletions src/bvals/bvals_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ NeighborIndexes BoundaryBase::ni[NMAX_NEIGHBORS];
// int ibid, int itargetid, int ifi1=0, int ifi2=0)
// \brief Set neighbor information

void NeighborBlock::SetNeighbor(int irank, int ilevel, int igid, int ilid, int iox1,
int iox2, int iox3, NeighborConnect itype, int ibid,
int itargetid,
void NeighborBlock::SetNeighbor(LogicalLocation inloc, int irank, int ilevel, int igid,
lroberts36 marked this conversation as resolved.
Show resolved Hide resolved
int ilid, int iox1, int iox2, int iox3,
NeighborConnect itype, int ibid, int itargetid,
int ifi1, // =0
int ifi2 // =0
) {
Expand All @@ -69,6 +69,7 @@ void NeighborBlock::SetNeighbor(int irank, int ilevel, int igid, int ilid, int i
ni.fi2 = ifi2;
bufid = ibid;
targetid = itargetid;
loc = inloc;
if (ni.type == NeighborConnect::face) {
if (ni.ox1 == -1)
fid = BoundaryFace::inner_x1;
Expand Down Expand Up @@ -304,12 +305,12 @@ void BoundaryBase::SearchAndSetNeighbors(MeshBlockTree &tree, int *ranklist,
Kokkos::Profiling::pushRegion("SearchAndSetNeighbors");
MeshBlockTree *neibt;
int myox1, myox2 = 0, myox3 = 0, myfx1, myfx2, myfx3;
myfx1 = ((loc.lx1 & 1LL) == 1LL);
myfx2 = ((loc.lx2 & 1LL) == 1LL);
myfx3 = ((loc.lx3 & 1LL) == 1LL);
myox1 = ((loc.lx1 & 1LL) == 1LL) * 2 - 1;
if (block_size_.nx2 > 1) myox2 = ((loc.lx2 & 1LL) == 1LL) * 2 - 1;
if (block_size_.nx3 > 1) myox3 = ((loc.lx3 & 1LL) == 1LL) * 2 - 1;
myfx1 = ((loc.lx1() & 1LL) == 1LL);
myfx2 = ((loc.lx2() & 1LL) == 1LL);
myfx3 = ((loc.lx3() & 1LL) == 1LL);
myox1 = ((loc.lx1() & 1LL) == 1LL) * 2 - 1;
if (block_size_.nx2 > 1) myox2 = ((loc.lx2() & 1LL) == 1LL) * 2 - 1;
if (block_size_.nx3 > 1) myox3 = ((loc.lx3() & 1LL) == 1LL) * 2 - 1;

int nf1 = 1, nf2 = 1;
if (pmy_mesh_->multilevel) {
Expand All @@ -324,7 +325,7 @@ void BoundaryBase::SearchAndSetNeighbors(MeshBlockTree &tree, int *ranklist,
nblevel[k][j][i] = -1;
}
}
nblevel[1][1][1] = loc.level;
nblevel[1][1][1] = loc.level();

// x1 face
for (int n = -1; n <= 1; n += 2) {
Expand All @@ -335,31 +336,31 @@ void BoundaryBase::SearchAndSetNeighbors(MeshBlockTree &tree, int *ranklist,
}
if (neibt->pleaf_ != nullptr) { // neighbor at finer level
int fface = 1 - (n + 1) / 2; // 0 for BoundaryFace::outer_x1, 1 for inner_x1
nblevel[1][1][n + 1] = neibt->loc_.level + 1;
nblevel[1][1][n + 1] = neibt->loc_.level() + 1;
for (int f2 = 0; f2 < nf2; f2++) {
for (int f1 = 0; f1 < nf1; f1++) {
MeshBlockTree *nf = neibt->GetLeaf(fface, f1, f2);
int fid = nf->gid_;
int nlevel = nf->loc_.level;
int nlevel = nf->loc_.level();
int tbid = FindBufferID(-n, 0, 0, 0, 0);
neighbor[nneighbor].SetNeighbor(ranklist[fid], nlevel, fid,
neighbor[nneighbor].SetNeighbor(nf->loc_, ranklist[fid], nlevel, fid,
fid - nslist[ranklist[fid]], n, 0, 0,
NeighborConnect::face, bufid, tbid, f1, f2);
bufid++;
nneighbor++;
}
}
} else { // neighbor at same or coarser level
int nlevel = neibt->loc_.level;
int nlevel = neibt->loc_.level();
int nid = neibt->gid_;
nblevel[1][1][n + 1] = nlevel;
int tbid;
if (nlevel == loc.level) { // neighbor at same level
if (nlevel == loc.level()) { // neighbor at same level
tbid = FindBufferID(-n, 0, 0, 0, 0);
} else { // neighbor at coarser level
tbid = FindBufferID(-n, 0, 0, myfx2, myfx3);
}
neighbor[nneighbor].SetNeighbor(ranklist[nid], nlevel, nid,
neighbor[nneighbor].SetNeighbor(neibt->loc_, ranklist[nid], nlevel, nid,
nid - nslist[ranklist[nid]], n, 0, 0,
NeighborConnect::face, bufid, tbid);
bufid += nf1 * nf2;
Expand All @@ -380,31 +381,31 @@ void BoundaryBase::SearchAndSetNeighbors(MeshBlockTree &tree, int *ranklist,
}
if (neibt->pleaf_ != nullptr) { // neighbor at finer level
int fface = 1 - (n + 1) / 2; // 0 for BoundaryFace::outer_x2, 1 for inner_x2
nblevel[1][n + 1][1] = neibt->loc_.level + 1;
nblevel[1][n + 1][1] = neibt->loc_.level() + 1;
for (int f2 = 0; f2 < nf2; f2++) {
for (int f1 = 0; f1 < nf1; f1++) {
MeshBlockTree *nf = neibt->GetLeaf(f1, fface, f2);
int fid = nf->gid_;
int nlevel = nf->loc_.level;
int nlevel = nf->loc_.level();
int tbid = FindBufferID(0, -n, 0, 0, 0);
neighbor[nneighbor].SetNeighbor(ranklist[fid], nlevel, fid,
neighbor[nneighbor].SetNeighbor(nf->loc_, ranklist[fid], nlevel, fid,
fid - nslist[ranklist[fid]], 0, n, 0,
NeighborConnect::face, bufid, tbid, f1, f2);
bufid++;
nneighbor++;
}
}
} else { // neighbor at same or coarser level
int nlevel = neibt->loc_.level;
int nlevel = neibt->loc_.level();
int nid = neibt->gid_;
nblevel[1][n + 1][1] = nlevel;
int tbid;
if (nlevel == loc.level) { // neighbor at same level
if (nlevel == loc.level()) { // neighbor at same level
tbid = FindBufferID(0, -n, 0, 0, 0);
} else { // neighbor at coarser level
tbid = FindBufferID(0, -n, 0, myfx1, myfx3);
}
neighbor[nneighbor].SetNeighbor(ranklist[nid], nlevel, nid,
neighbor[nneighbor].SetNeighbor(neibt->loc_, ranklist[nid], nlevel, nid,
nid - nslist[ranklist[nid]], 0, n, 0,
NeighborConnect::face, bufid, tbid);
bufid += nf1 * nf2;
Expand All @@ -422,31 +423,31 @@ void BoundaryBase::SearchAndSetNeighbors(MeshBlockTree &tree, int *ranklist,
}
if (neibt->pleaf_ != nullptr) { // neighbor at finer level
int fface = 1 - (n + 1) / 2; // 0 for BoundaryFace::outer_x3, 1 for inner_x3
nblevel[n + 1][1][1] = neibt->loc_.level + 1;
nblevel[n + 1][1][1] = neibt->loc_.level() + 1;
for (int f2 = 0; f2 < nf2; f2++) {
for (int f1 = 0; f1 < nf1; f1++) {
MeshBlockTree *nf = neibt->GetLeaf(f1, f2, fface);
int fid = nf->gid_;
int nlevel = nf->loc_.level;
int nlevel = nf->loc_.level();
int tbid = FindBufferID(0, 0, -n, 0, 0);
neighbor[nneighbor].SetNeighbor(ranklist[fid], nlevel, fid,
neighbor[nneighbor].SetNeighbor(nf->loc_, ranklist[fid], nlevel, fid,
fid - nslist[ranklist[fid]], 0, 0, n,
NeighborConnect::face, bufid, tbid, f1, f2);
bufid++;
nneighbor++;
}
}
} else { // neighbor at same or coarser level
int nlevel = neibt->loc_.level;
int nlevel = neibt->loc_.level();
int nid = neibt->gid_;
nblevel[n + 1][1][1] = nlevel;
int tbid;
if (nlevel == loc.level) { // neighbor at same level
if (nlevel == loc.level()) { // neighbor at same level
tbid = FindBufferID(0, 0, -n, 0, 0);
} else { // neighbor at coarser level
tbid = FindBufferID(0, 0, -n, myfx1, myfx2);
}
neighbor[nneighbor].SetNeighbor(ranklist[nid], nlevel, nid,
neighbor[nneighbor].SetNeighbor(neibt->loc_, ranklist[nid], nlevel, nid,
nid - nslist[ranklist[nid]], 0, 0, n,
NeighborConnect::face, bufid, tbid);
bufid += nf1 * nf2;
Expand All @@ -467,30 +468,30 @@ void BoundaryBase::SearchAndSetNeighbors(MeshBlockTree &tree, int *ranklist,
int ff1 = 1 - (n + 1) / 2; // 0 for BoundaryFace::outer_x1, 1 for inner_x1
int ff2 = 1 - (m + 1) / 2; // 0 for BoundaryFace::outer_x2, 1 for inner_x2

nblevel[1][m + 1][n + 1] = neibt->loc_.level + 1;
nblevel[1][m + 1][n + 1] = neibt->loc_.level() + 1;
for (int f1 = 0; f1 < nf2; f1++) {
MeshBlockTree *nf = neibt->GetLeaf(ff1, ff2, f1);
int fid = nf->gid_;
int nlevel = nf->loc_.level;
int nlevel = nf->loc_.level();
int tbid = FindBufferID(-n, -m, 0, 0, 0);
neighbor[nneighbor].SetNeighbor(ranklist[fid], nlevel, fid,
neighbor[nneighbor].SetNeighbor(nf->loc_, ranklist[fid], nlevel, fid,
fid - nslist[ranklist[fid]], n, m, 0,
NeighborConnect::edge, bufid, tbid, f1, 0);
bufid++;
nneighbor++;
}
} else { // neighbor at same or coarser level
int nlevel = neibt->loc_.level;
int nlevel = neibt->loc_.level();
int nid = neibt->gid_;
nblevel[1][m + 1][n + 1] = nlevel;
int tbid;
if (nlevel == loc.level) { // neighbor at same level
if (nlevel == loc.level()) { // neighbor at same level
tbid = FindBufferID(-n, -m, 0, 0, 0);
} else { // neighbor at coarser level
tbid = FindBufferID(-n, -m, 0, myfx3, 0);
}
if (nlevel >= loc.level || (myox1 == n && myox2 == m)) {
neighbor[nneighbor].SetNeighbor(ranklist[nid], nlevel, nid,
if (nlevel >= loc.level() || (myox1 == n && myox2 == m)) {
neighbor[nneighbor].SetNeighbor(neibt->loc_, ranklist[nid], nlevel, nid,
nid - nslist[ranklist[nid]], n, m, 0,
NeighborConnect::edge, bufid, tbid);
nneighbor++;
Expand All @@ -516,30 +517,30 @@ void BoundaryBase::SearchAndSetNeighbors(MeshBlockTree &tree, int *ranklist,
if (neibt->pleaf_ != nullptr) { // neighbor at finer level
int ff1 = 1 - (n + 1) / 2; // 0 for BoundaryFace::outer_x1, 1 for inner_x1
int ff2 = 1 - (m + 1) / 2; // 0 for BoundaryFace::outer_x3, 1 for inner_x3
nblevel[m + 1][1][n + 1] = neibt->loc_.level + 1;
nblevel[m + 1][1][n + 1] = neibt->loc_.level() + 1;
for (int f1 = 0; f1 < nf1; f1++) {
MeshBlockTree *nf = neibt->GetLeaf(ff1, f1, ff2);
int fid = nf->gid_;
int nlevel = nf->loc_.level;
int nlevel = nf->loc_.level();
int tbid = FindBufferID(-n, 0, -m, 0, 0);
neighbor[nneighbor].SetNeighbor(ranklist[fid], nlevel, fid,
neighbor[nneighbor].SetNeighbor(nf->loc_, ranklist[fid], nlevel, fid,
fid - nslist[ranklist[fid]], n, 0, m,
NeighborConnect::edge, bufid, tbid, f1, 0);
bufid++;
nneighbor++;
}
} else { // neighbor at same or coarser level
int nlevel = neibt->loc_.level;
int nlevel = neibt->loc_.level();
int nid = neibt->gid_;
nblevel[m + 1][1][n + 1] = nlevel;
int tbid;
if (nlevel == loc.level) { // neighbor at same level
if (nlevel == loc.level()) { // neighbor at same level
tbid = FindBufferID(-n, 0, -m, 0, 0);
} else { // neighbor at coarser level
tbid = FindBufferID(-n, 0, -m, myfx2, 0);
}
if (nlevel >= loc.level || (myox1 == n && myox3 == m)) {
neighbor[nneighbor].SetNeighbor(ranklist[nid], nlevel, nid,
if (nlevel >= loc.level() || (myox1 == n && myox3 == m)) {
neighbor[nneighbor].SetNeighbor(neibt->loc_, ranklist[nid], nlevel, nid,
nid - nslist[ranklist[nid]], n, 0, m,
NeighborConnect::edge, bufid, tbid);
nneighbor++;
Expand All @@ -560,30 +561,30 @@ void BoundaryBase::SearchAndSetNeighbors(MeshBlockTree &tree, int *ranklist,
if (neibt->pleaf_ != nullptr) { // neighbor at finer level
int ff1 = 1 - (n + 1) / 2; // 0 for BoundaryFace::outer_x2, 1 for inner_x2
int ff2 = 1 - (m + 1) / 2; // 0 for BoundaryFace::outer_x3, 1 for inner_x3
nblevel[m + 1][n + 1][1] = neibt->loc_.level + 1;
nblevel[m + 1][n + 1][1] = neibt->loc_.level() + 1;
for (int f1 = 0; f1 < nf1; f1++) {
MeshBlockTree *nf = neibt->GetLeaf(f1, ff1, ff2);
int fid = nf->gid_;
int nlevel = nf->loc_.level;
int nlevel = nf->loc_.level();
int tbid = FindBufferID(0, -n, -m, 0, 0);
neighbor[nneighbor].SetNeighbor(ranklist[fid], nlevel, fid,
neighbor[nneighbor].SetNeighbor(nf->loc_, ranklist[fid], nlevel, fid,
fid - nslist[ranklist[fid]], 0, n, m,
NeighborConnect::edge, bufid, tbid, f1, 0);
bufid++;
nneighbor++;
}
} else { // neighbor at same or coarser level
int nlevel = neibt->loc_.level;
int nlevel = neibt->loc_.level();
int nid = neibt->gid_;
nblevel[m + 1][n + 1][1] = nlevel;
int tbid;
if (nlevel == loc.level) { // neighbor at same level
if (nlevel == loc.level()) { // neighbor at same level
tbid = FindBufferID(0, -n, -m, 0, 0);
} else { // neighbor at coarser level
tbid = FindBufferID(0, -n, -m, myfx1, 0);
}
if (nlevel >= loc.level || (myox2 == n && myox3 == m)) {
neighbor[nneighbor].SetNeighbor(ranklist[nid], nlevel, nid,
if (nlevel >= loc.level() || (myox2 == n && myox3 == m)) {
neighbor[nneighbor].SetNeighbor(neibt->loc_, ranklist[nid], nlevel, nid,
nid - nslist[ranklist[nid]], 0, n, m,
NeighborConnect::edge, bufid, tbid);
nneighbor++;
Expand All @@ -608,12 +609,12 @@ void BoundaryBase::SearchAndSetNeighbors(MeshBlockTree &tree, int *ranklist,
int ff3 = 1 - (l + 1) / 2; // 0 for BoundaryFace::outer_x3, 1 for inner_x3
neibt = neibt->GetLeaf(ff1, ff2, ff3);
}
int nlevel = neibt->loc_.level;
int nlevel = neibt->loc_.level();
nblevel[l + 1][m + 1][n + 1] = nlevel;
if (nlevel >= loc.level || (myox1 == n && myox2 == m && myox3 == l)) {
if (nlevel >= loc.level() || (myox1 == n && myox2 == m && myox3 == l)) {
int nid = neibt->gid_;
int tbid = FindBufferID(-n, -m, -l, 0, 0);
neighbor[nneighbor].SetNeighbor(ranklist[nid], nlevel, nid,
neighbor[nneighbor].SetNeighbor(neibt->loc_, ranklist[nid], nlevel, nid,
nid - nslist[ranklist[nid]], n, m, l,
NeighborConnect::corner, bufid, tbid);
nneighbor++;
Expand Down
8 changes: 4 additions & 4 deletions src/bvals/bvals_interfaces.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ struct NeighborBlock { // aggregate and POD type. Inheritance breaks standard-la

int bufid, eid, targetid;
BoundaryFace fid;

void SetNeighbor(int irank, int ilevel, int igid, int ilid, int iox1, int iox2,
int iox3, NeighborConnect itype, int ibid, int itargetid, int ifi1 = 0,
int ifi2 = 0);
LogicalLocation loc;
void SetNeighbor(LogicalLocation inloc, int irank, int ilevel, int igid, int ilid,
int iox1, int iox2, int iox3, NeighborConnect itype, int ibid,
int itargetid, int ifi1 = 0, int ifi2 = 0);
};

//----------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/bvals/bvals_swarm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void BoundarySwarm::Send(BoundaryCommSubset phase) {
void BoundarySwarm::Receive(BoundaryCommSubset phase) {
#ifdef MPI_PARALLEL
std::shared_ptr<MeshBlock> pmb = GetBlockPointer();
int &mylevel = pmb->loc.level;
const int &mylevel = pmb->loc.level();
for (int n = 0; n < pmb->pbval->nneighbor; n++) {
NeighborBlock &nb = pmb->pbval->neighbor[n];
if (nb.snb.rank != Globals::my_rank) {
Expand Down
6 changes: 3 additions & 3 deletions src/bvals/comms/bnd_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Indexer6D CalcSetIndices(const NeighborIndexes &ni, LogicalLocation loc,
// information for going from coarse to fine and the neighbor block
// structure does not contain the logical location of the neighbor
// block
std::array<std::int64_t, 3> logic_loc{loc.lx1, loc.lx2, loc.lx3};
std::array<std::int64_t, 3> logic_loc{loc.lx1(), loc.lx2(), loc.lx3()};
std::array<int, 2> face_offset{ni.fi1, ni.fi2};
std::array<int, 3> s, e;

Expand Down Expand Up @@ -172,7 +172,7 @@ BndInfo BndInfo::GetSendBndInfo(std::shared_ptr<MeshBlock> pmb, const NeighborBl
int Nu = v->GetDim(5);
int Nt = v->GetDim(6);

int mylevel = pmb->loc.level;
int mylevel = pmb->loc.level();
out.coords = pmb->coords;

if (pmb->pmr) out.coarse_coords = pmb->pmr->GetCoarseCoords();
Expand Down Expand Up @@ -236,7 +236,7 @@ BndInfo BndInfo::GetSetBndInfo(std::shared_ptr<MeshBlock> pmb, const NeighborBlo
if (v->IsSet(Metadata::Edge)) elements = {TE::E1, TE::E2, TE::E3};
if (v->IsSet(Metadata::Node)) elements = {TE::NN};

int mylevel = pmb->loc.level;
int mylevel = pmb->loc.level();
out.coords = pmb->coords;
if (pmb->pmr) out.coarse_coords = pmb->pmr->GetCoarseCoords();
out.fine = v->data.Get();
Expand Down
Loading