diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-09-25 22:11:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2006-09-25 22:11:00 +0000 |
commit | eca22ed88c8d4350761d9524f62c42a2ed559f1e (patch) | |
tree | 5a074e50bdba2ae681003ea0581f27c9d38cf15d /Carpet | |
parent | bb9bf3fc2de4feb4d8aca097c1e85c747fe9e588 (diff) |
CarpetRegrid2: Support rotating symmetries
darcs-hash:20060925221137-dae7b-d016ec0a27faeda88b8335eb074d3dcf87b3b222.gz
Diffstat (limited to 'Carpet')
-rw-r--r-- | Carpet/CarpetRegrid2/param.ccl | 10 | ||||
-rw-r--r-- | Carpet/CarpetRegrid2/src/paramcheck.cc | 4 | ||||
-rw-r--r-- | Carpet/CarpetRegrid2/src/regrid.cc | 41 |
3 files changed, 55 insertions, 0 deletions
diff --git a/Carpet/CarpetRegrid2/param.ccl b/Carpet/CarpetRegrid2/param.ccl index ac15a7c0c..41414eda2 100644 --- a/Carpet/CarpetRegrid2/param.ccl +++ b/Carpet/CarpetRegrid2/param.ccl @@ -29,6 +29,16 @@ CCTK_INT regrid_every "Regrid every n time steps" STEERABLE=always +BOOLEAN symmetry_rotating90 "Ensure a 90 degree rotating symmetry about the z axis" +{ +} no + +BOOLEAN symmetry_rotating180 "Ensure a 180 degree rotating symmetry about the z axis" +{ +} no + + + ################################################################################ CCTK_INT num_levels_1 "Number of refinement levels for this centre" STEERABLE=always diff --git a/Carpet/CarpetRegrid2/src/paramcheck.cc b/Carpet/CarpetRegrid2/src/paramcheck.cc index 51830038e..fd55929e3 100644 --- a/Carpet/CarpetRegrid2/src/paramcheck.cc +++ b/Carpet/CarpetRegrid2/src/paramcheck.cc @@ -29,6 +29,10 @@ namespace CarpetRegrid2 { { CCTK_PARAMWARN ("The number of requested refinement levels is larger than the maximum number of levels specified by Carpet::max_refinement_levels"); } + + if (symmetry_rotating90) { + CCTK_PARAMWARN ("symmetry_rotating90 is not yet implemented"); + } } } // namespace CarpetRegrid2 diff --git a/Carpet/CarpetRegrid2/src/regrid.cc b/Carpet/CarpetRegrid2/src/regrid.cc index fdadb2880..7210c9b7d 100644 --- a/Carpet/CarpetRegrid2/src/regrid.cc +++ b/Carpet/CarpetRegrid2/src/regrid.cc @@ -394,6 +394,47 @@ namespace CarpetRegrid2 { bb.stride()); clipped |= clipped_bb; + + if (symmetry_rotating90) { + assert (0); // There is also a paramwarn about this + } + + if (symmetry_rotating180) { + // Make the boxes rotating-180 symmetric + if (lower_is_outside_lower[0]) { + ivect const ilo = clipped_bb.lower(); + ivect const iup = clipped_bb.upper(); + ivect const istr = clipped_bb.stride(); + + // Origin + rvect const axis (physical_lower[0], + (physical_lower[1] + physical_upper[1]) / 2, + physical_lower[2]); // z component is unused + ivect const iaxis0 = rpos2ipos (axis, origin, scale, hh, rl); + assert (all (iaxis0 % istr == 0)); + ivect const iaxis1 = rpos2ipos1 (axis, origin, scale, hh, rl); + assert (all (iaxis1 % istr == 0)); + ivect const offset = iaxis1 - iaxis0; + assert (all (offset % istr == 0)); + assert (all (offset >= 0 and offset < 2*istr)); + assert (all ((iaxis0 + iaxis1 - offset) % (2*istr) == 0)); + ivect const iaxis = (iaxis0 + iaxis1 - offset) / 2; + + // Mirror about the y axis, cutting off most of the extent + // in the positive x direction + ivect const new_ilo (ilo[0], + (2*iaxis[1]+offset[1]) - iup[1], + ilo[2]); + ivect const new_iup ((2*iaxis[0]+offset[0]) - ilo[0], + (2*iaxis[1]+offset[1]) - ilo[1], + iup[2]); + ivect const new_istr (istr); + + ibbox const new_bb (new_ilo, new_iup, new_istr); + + clipped |= new_bb; + } + } } regions.at(rl) = clipped; |