Skip to content

Commit

Permalink
CarpetX: Remove superfluous enum value symmetry_t::outer_boundary
Browse files Browse the repository at this point in the history
Also correct cctk_bbox near symmetry boundaries.
  • Loading branch information
eschnett committed Jul 26, 2023
1 parent 2604a4b commit 3f93f42
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 24 deletions.
8 changes: 3 additions & 5 deletions CarpetX/src/boundaries.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ BoundaryCondition::BoundaryCondition(
const GHExt::PatchData::LevelData::GroupData &groupdata,
const amrex::Box &box, amrex::FArrayBox &dest)
: groupdata(groupdata), patchdata(ghext->patchdata.at(groupdata.patch)),
geom(patchdata.amrcore->Geom(groupdata.level)),
dest(dest), imin{geom.Domain().smallEnd(0), geom.Domain().smallEnd(1),
geom.Domain().smallEnd(2)},
geom(patchdata.amrcore->Geom(groupdata.level)), dest(dest),
imin{geom.Domain().smallEnd(0), geom.Domain().smallEnd(1),
geom.Domain().smallEnd(2)},
imax{geom.Domain().bigEnd(0) + 1 + !groupdata.indextype[0],
geom.Domain().bigEnd(1) + 1 + !groupdata.indextype[1],
geom.Domain().bigEnd(2) + 1 + !groupdata.indextype[2]},
Expand Down Expand Up @@ -252,8 +252,6 @@ void BoundaryCondition::apply() const {
const boundary_t boundary = groupdata.boundaries[face][dir];
if ((symmetry == symmetry_t::none &&
boundary == boundary_t::none) ||
(symmetry == symmetry_t::outer_boundary &&
boundary == boundary_t::none) ||
symmetry == symmetry_t::interpatch ||
symmetry == symmetry_t::periodic) {
symmetries[dir] = symmetry_t::none;
Expand Down
9 changes: 3 additions & 6 deletions CarpetX/src/boundaries_impl.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ void BoundaryCondition::apply_on_face() const {
const boundary_t boundary_x = groupdata.boundaries[f][0];

if ((symmetry_x == symmetry_t::none && boundary_x == boundary_t::none) ||
(symmetry_x == symmetry_t::outer_boundary &&
boundary_x == boundary_t::none) ||
(boundary_x == boundary_t::none) ||
(symmetry_x == symmetry_t::interpatch &&
boundary_x == boundary_t::none) ||
symmetry_x == symmetry_t::periodic)
Expand Down Expand Up @@ -114,8 +113,7 @@ void BoundaryCondition::apply_on_face_symbcx(
const boundary_t boundary_y = groupdata.boundaries[f][1];

if ((symmetry_y == symmetry_t::none && boundary_y == boundary_t::none) ||
(symmetry_y == symmetry_t::outer_boundary &&
boundary_y == boundary_t::none) ||
(boundary_y == boundary_t::none) ||
(symmetry_y == symmetry_t::interpatch &&
boundary_y == boundary_t::none) ||
symmetry_y == symmetry_t::periodic)
Expand Down Expand Up @@ -160,8 +158,7 @@ void BoundaryCondition::apply_on_face_symbcxy(
const boundary_t boundary_z = groupdata.boundaries[f][2];

if ((symmetry_z == symmetry_t::none && boundary_z == boundary_t::none) ||
(symmetry_z == symmetry_t::outer_boundary &&
boundary_z == boundary_t::none) ||
(boundary_z == boundary_t::none) ||
(symmetry_z == symmetry_t::interpatch &&
boundary_z == boundary_t::none) ||
symmetry_z == symmetry_t::periodic)
Expand Down
14 changes: 6 additions & 8 deletions CarpetX/src/driver.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ std::ostream &operator<<(std::ostream &os, const symmetry_t symmetry) {
switch (symmetry) {
case symmetry_t::none:
return os << "none";
case symmetry_t::outer_boundary:
return os << "outer_boundary";
case symmetry_t::interpatch:
return os << "interpatch";
case symmetry_t::periodic:
Expand Down Expand Up @@ -149,10 +147,10 @@ array<array<symmetry_t, dim>, 2> get_symmetries() {
array<array<symmetry_t, dim>, 2> symmetries;
for (int f = 0; f < 2; ++f)
for (int d = 0; d < dim; ++d)
symmetries[f][d] = is_outer_boundary[f][d] ? symmetry_t::outer_boundary
symmetries[f][d] = is_outer_boundary[f][d] ? symmetry_t::none
: is_periodic[f][d] ? symmetry_t::periodic
: is_reflection[f][d] ? symmetry_t::reflection
: symmetry_t::outer_boundary;
: symmetry_t::none;

return symmetries;
}
Expand All @@ -164,8 +162,9 @@ array<array<boundary_t, dim>, 2> get_default_boundaries() {
array<array<bool, 3>, 2> is_symmetry;
for (int f = 0; f < 2; ++f)
for (int d = 0; d < dim; ++d)
is_symmetry[f][d] = symmetries[f][d] != symmetry_t::none &&
symmetries[f][d] != symmetry_t::outer_boundary;
is_symmetry[f][d] = symmetries[f][d] != symmetry_t::none
// && symmetries[f][d] != symmetry_t::outer_boundary
;

const array<array<bool, 3>, 2> is_dirichlet{{
{{
Expand Down Expand Up @@ -243,8 +242,7 @@ array<array<boundary_t, dim>, 2> get_group_boundaries(const int gi) {
array<array<bool, 3>, 2> is_symmetry;
for (int f = 0; f < 2; ++f)
for (int d = 0; d < dim; ++d)
is_symmetry[f][d] = symmetries[f][d] != symmetry_t::none &&
symmetries[f][d] != symmetry_t::outer_boundary;
is_symmetry[f][d] = symmetries[f][d] != symmetry_t::none;

array<array<boundary_t, dim>, 2> boundaries = get_default_boundaries();

Expand Down
3 changes: 1 addition & 2 deletions CarpetX/src/driver.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@ using rat64 = rational<int64_t>;
// Symmetries are domain properties
enum class symmetry_t {
none,
outer_boundary,
interpatch,
periodic,
reflection,
};
std::ostream &operator<<(std::ostream &os, const symmetry_t symmetry);

// Boundary conditions are group properties. They are valid only for faces where
// the domain symmetry is `outer_boundary`.
// the domain symmetry is `none`.
enum class boundary_t {
none,
symmetry_boundary,
Expand Down
4 changes: 1 addition & 3 deletions CarpetX/src/schedule.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,9 @@ GridDesc::GridDesc(const GHExt::PatchData::LevelData &leveldata,
}

// Boundaries
const auto &symmetries = ghext->patchdata.at(leveldata.patch).symmetries;
for (int d = 0; d < dim; ++d)
for (int f = 0; f < 2; ++f)
bbox[f][d] = vbx[orient(d, f)] == domain[orient(d, f)] &&
symmetries[f][d] != symmetry_t::none;
bbox[f][d] = vbx[orient(d, f)] == domain[orient(d, f)];

// Thread tile box
for (int d = 0; d < dim; ++d) {
Expand Down

0 comments on commit 3f93f42

Please sign in to comment.