BoundaryBox<NDIM> PhysicalBoundaryUtilities::trimBoundaryCodim1Box(const BoundaryBox<NDIM>& bdry_box, const Patch<NDIM>& patch) { #if !defined(NDEBUG) TBOX_ASSERT(bdry_box.getBoundaryType() == 1); #endif // Trim a boundary box so it does not stick out past the corners of a patch. const Box<NDIM>& b_box = bdry_box.getBox(); const Box<NDIM>& patch_box = patch.getBox(); const unsigned int bdry_normal_axis = bdry_box.getLocationIndex() / 2; Box<NDIM> trimmed_b_box = b_box; for (unsigned int d = 0; d < NDIM; ++d) { if (d != bdry_normal_axis) { trimmed_b_box.lower()[d] = std::max(b_box.lower()[d], patch_box.lower()[d]); trimmed_b_box.upper()[d] = std::min(b_box.upper()[d], patch_box.upper()[d]); } } const BoundaryBox<NDIM> trimmed_bdry_box( trimmed_b_box, bdry_box.getBoundaryType(), bdry_box.getLocationIndex()); return trimmed_bdry_box; } // trimBoundaryCodim1Box
Box<NDIM> PhysicalBoundaryUtilities::makeSideBoundaryCodim1Box(const BoundaryBox<NDIM>& bdry_box) { #if !defined(NDEBUG) TBOX_ASSERT(bdry_box.getBoundaryType() == 1); #endif // Make surface box on boundary. Box<NDIM> side_bdry_box = bdry_box.getBox(); const unsigned int location_index = bdry_box.getLocationIndex(); const unsigned int bdry_normal_axis = location_index / 2; const bool bdry_lower_side = (location_index % 2) == 0; if (bdry_lower_side) { // On the lower side of a patch, the side indices are one higher than // the boundary cell indices in the direction normal to the boundary. side_bdry_box.shift(bdry_normal_axis, 1); } return side_bdry_box; } // makeSideBoundaryCodim1Box