diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-02-27 02:42:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-02-27 02:42:00 +0000 |
commit | dd05b144a6a78f456639d800113dc726d44c8d50 (patch) | |
tree | 71d2af08afae3db50199bbb45f16aff81d276dc0 /Carpet/CarpetMask | |
parent | 444ace15e045a4bde50c14cd3bc040f68b283fb9 (diff) |
CarpetMask: Add explicit conversions to CCTK_REAL
Add explicit conversions to CCTK_REAL.
Add braces to clarify code.
darcs-hash:20080227024235-dae7b-8d9f43b5859c6c9ed75e0218b46646ea5aeae0ff.gz
Diffstat (limited to 'Carpet/CarpetMask')
-rw-r--r-- | Carpet/CarpetMask/src/mask_surface.cc | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/Carpet/CarpetMask/src/mask_surface.cc b/Carpet/CarpetMask/src/mask_surface.cc index 1d4a746d0..e1a02079f 100644 --- a/Carpet/CarpetMask/src/mask_surface.cc +++ b/Carpet/CarpetMask/src/mask_surface.cc @@ -97,23 +97,31 @@ namespace CarpetMask { weight[ind] = 0.0; } else { 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; - + acos (min (CCTK_REAL (+1.0), + max (CCTK_REAL (-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 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; + fmod (atan2 (dy, dx) + CCTK_REAL (2 * M_PI), + CCTK_REAL (2 * M_PI)); + if (symmetric_x[sn] or symmetric_y[sn]) { + if (symmetric_x[sn] and symmetric_y[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); |