aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetMask
diff options
context:
space:
mode:
authorreisswig <schnetter@cct.lsu.edu>2008-02-25 15:52:00 +0000
committerreisswig <schnetter@cct.lsu.edu>2008-02-25 15:52:00 +0000
commit444ace15e045a4bde50c14cd3bc040f68b283fb9 (patch)
tree8dcc8f86d81ad4a6a18f01a07f27293c4937a27f /Carpet/CarpetMask
parentb4598609c3a1d1db541abc683cf3e651a2421a37 (diff)
Make CarpetMask consider symmetry of spherical surfaces
darcs-hash:20080225155220-79e7e-1a3160bf208f8ca7f1130b86f1a09b2a776f3009.gz
Diffstat (limited to 'Carpet/CarpetMask')
-rw-r--r--Carpet/CarpetMask/param.ccl3
-rw-r--r--Carpet/CarpetMask/src/mask_surface.cc21
2 files changed, 18 insertions, 6 deletions
diff --git a/Carpet/CarpetMask/param.ccl b/Carpet/CarpetMask/param.ccl
index f555398c3..8db65e41b 100644
--- a/Carpet/CarpetMask/param.ccl
+++ b/Carpet/CarpetMask/param.ccl
@@ -57,5 +57,8 @@ SHARES: SphericalSurface
USES CCTK_INT nsurfaces
+USES BOOLEAN symmetric_z
+USES BOOLEAN symmetric_y
+USES BOOLEAN symmetric_x
USES CCTK_INT maxntheta
USES CCTK_INT maxnphi
diff --git a/Carpet/CarpetMask/src/mask_surface.cc b/Carpet/CarpetMask/src/mask_surface.cc
index a78a9f9f1..1d4a746d0 100644
--- a/Carpet/CarpetMask/src/mask_surface.cc
+++ b/Carpet/CarpetMask/src/mask_surface.cc
@@ -96,15 +96,24 @@ namespace CarpetMask {
// Always excise the surface origin
weight[ind] = 0.0;
} else {
- CCTK_REAL const theta =
- acos (min (CCTK_REAL (+1.0),
- max (CCTK_REAL (-1.0), dz / rho)));
+ CCTK_REAL theta =
+ acos (min (+1.0, max (-1.0, dz / rho)));
+ if (symmetric_z[sn])
+ if (theta > M_PI/2.0)
+ theta = M_PI - theta;
+
assert (not isnan (theta));
assert (theta >= 0);
assert (theta <= M_PI);
- CCTK_REAL const phi =
- fmod (atan2 (dy, dx) + CCTK_REAL (2 * M_PI),
- CCTK_REAL (2 * M_PI));
+ CCTK_REAL phi =
+ fmod (atan2 (dy, dx) + 2 * M_PI, 2 * M_PI);
+ if (symmetric_x[sn] || symmetric_y[sn])
+ if (symmetric_y[sn] && symmetric_x[sn]) {
+ if (phi > M_PI/2.0)
+ phi = M_PI - phi;
+ } else
+ if (phi > M_PI)
+ phi = 2*M_PI - phi;
assert (not isnan (phi));
assert (phi >= 0);
assert (phi < 2 * M_PI);