Skip to content

Commit b2d1843

Browse files
committed
Use a better check if the domain is complete
1 parent f734334 commit b2d1843

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/Base/BoxArray.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,15 @@ void init_BoxArray(py::module &m) {
129129
//! \brief Apply surroundingNodes(Box,int) to each Box in
130130
//! BoxArray. See the documentation of Box for details.
131131
BoxArray& surroundingNodes (int dir);
132+
*/
132133

133134
//! Apply Box::enclosedCells() to each Box in the BoxArray.
134-
BoxArray& enclosedCells ();
135-
136-
//! Apply Box::enclosedCells(int) to each Box in the BoxArray.
137-
BoxArray& enclosedCells (int dir);
135+
.def("enclosed_cells",
136+
py::overload_cast<>(&BoxArray::enclosedCells))
137+
.def("enclosed_cells",
138+
py::overload_cast<int>(&BoxArray::enclosedCells))
138139

140+
/*
139141
//! Apply Box::convert(IndexType) to each Box in the BoxArray.
140142
BoxArray& convert (IndexType typ);
141143

src/amrex/extensions/MultiFab.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,10 @@ def __getitem__(self, index, with_internal_ghosts=False):
536536
# including internal ghost cells, and the second time without. The second time is needed
537537
# to ensure that in places where ghost cells overlap with valid cells, that the data
538538
# from the valid cells is used.
539-
# This check is whether the domain is complete is approximate (since it doesn't
540-
# account for cases where boxes overlap each other).
541-
domain_complete = self.box_array().numPts >= self.box_array().minimal_box().numPts()
539+
# The domain is complete if the number of cells in the box array is the same as
540+
# the number of cells in the minimal box.
541+
cell_centered_box_array = self.box_array().enclosed_cells()
542+
domain_complete = cell_centered_box_array.numPts == cell_centered_box_array.minimal_box().numPts()
542543

543544
if domain_complete or with_internal_ghosts:
544545
result_global = None

0 commit comments

Comments
 (0)