diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2009-09-03 16:19:15 -0500 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2011-12-14 16:42:31 +0000 |
commit | 11c4d98017cbb86d08e15fd1b549180184b58a26 (patch) | |
tree | 2546a154c6f7bc0bec87de7316125ae7d1453569 /Carpet/CarpetMask/src | |
parent | f520477b1c14e02f1495cfa8d3e09f4e21ab34d0 (diff) |
Import Carpet
Ignore-this: 309b4dd613f4af2b84aa5d6743fdb6b3
Diffstat (limited to 'Carpet/CarpetMask/src')
-rw-r--r-- | Carpet/CarpetMask/src/mask_excluded.cc | 39 | ||||
-rw-r--r-- | Carpet/CarpetMask/src/mask_surface.cc | 33 | ||||
-rw-r--r-- | Carpet/CarpetMask/src/mask_surface.hh | 2 |
3 files changed, 56 insertions, 18 deletions
diff --git a/Carpet/CarpetMask/src/mask_excluded.cc b/Carpet/CarpetMask/src/mask_excluded.cc index e842caf31..e179bc268 100644 --- a/Carpet/CarpetMask/src/mask_excluded.cc +++ b/Carpet/CarpetMask/src/mask_excluded.cc @@ -4,6 +4,8 @@ #include <cctk_Arguments.h> #include <cctk_Parameters.h> +#include <loopcontrol.h> + #include "mask_excluded.hh" @@ -46,25 +48,26 @@ namespace CarpetMask { bool const exterior = exclude_exterior[n]; - for (int k = 0; k < cctk_lsh[2]; ++ k) { - for (int j = 0; j < cctk_lsh[1]; ++ j) { - for (int i = 0; i < cctk_lsh[0]; ++ i) { - int const ind = CCTK_GFINDEX3D (cctkGH, i, j, k); - - CCTK_REAL const dx2 = pow (x[ind] - x0, 2); - CCTK_REAL const dy2 = pow (y[ind] - y0, 2); - CCTK_REAL const dz2 = pow (z[ind] - z0, 2); - - if (exterior ? - dx2 + dy2 + dz2 >= r2 : - dx2 + dy2 + dz2 <= r2) - { - weight[ind] = 0.0; - } - - } +#pragma omp parallel + LC_LOOP3(CarpetExcludedSetup, + i,j,k, + 0,0,0, cctk_lsh[0],cctk_lsh[1],cctk_lsh[2], + cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + { + int const ind = CCTK_GFINDEX3D (cctkGH, i, j, k); + + CCTK_REAL const dx2 = pow (x[ind] - x0, 2); + CCTK_REAL const dy2 = pow (y[ind] - y0, 2); + CCTK_REAL const dz2 = pow (z[ind] - z0, 2); + + if (exterior ? + dx2 + dy2 + dz2 >= r2 : + dx2 + dy2 + dz2 <= r2) + { + weight[ind] = 0.0; } - } + + } LC_ENDLOOP3(CarpetExcludedSetup); } // if r>=0 } // for n diff --git a/Carpet/CarpetMask/src/mask_surface.cc b/Carpet/CarpetMask/src/mask_surface.cc index e1a02079f..d23dc5461 100644 --- a/Carpet/CarpetMask/src/mask_surface.cc +++ b/Carpet/CarpetMask/src/mask_surface.cc @@ -23,6 +23,33 @@ namespace CarpetMask { /** + * Check parameters. + */ + + void + CarpetSurfaceParamCheck (CCTK_ARGUMENTS) + { + DECLARE_CCTK_ARGUMENTS; + DECLARE_CCTK_PARAMETERS; + + for (int n = 0; n < num_excluded; ++ n) { + + int const sn = excluded_surface[n]; + if (sn >= 0) { + + if (not (sn < nsurfaces)) { + CCTK_VParamWarn (CCTK_THORNSTRING, + "Mask %d depends on spherical surface %d, but there are only %d spherical surfaces", + n, sn, int(nsurfaces)); + } + + } // if sn >= 0 + } // for n + } + + + + /** * Set the weight in the excluded regions to zero. */ @@ -52,6 +79,11 @@ namespace CarpetMask { int const sn = excluded_surface[n]; if (sn >= 0) { + if (not (sn < nsurfaces)) { + CCTK_VWarn (CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING, + "Mask %d depends on spherical surface %d, but there are only %d spherical surfaces", + n, sn, int(nsurfaces)); + } assert (sn < nsurfaces); if (sf_active[sn]) { @@ -81,6 +113,7 @@ namespace CarpetMask { } } +#pragma omp parallel for for (int k = 0; k < cctk_lsh[2]; ++ k) { for (int j = 0; j < cctk_lsh[1]; ++ j) { for (int i = 0; i < cctk_lsh[0]; ++ i) { diff --git a/Carpet/CarpetMask/src/mask_surface.hh b/Carpet/CarpetMask/src/mask_surface.hh index a3e1f19d0..63e46d35b 100644 --- a/Carpet/CarpetMask/src/mask_surface.hh +++ b/Carpet/CarpetMask/src/mask_surface.hh @@ -5,6 +5,8 @@ namespace CarpetMask { extern "C" { void + CarpetSurfaceParamCheck (CCTK_ARGUMENTS); + void CarpetSurfaceSetup (CCTK_ARGUMENTS); } |