aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetMask
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2009-09-03 16:19:15 -0500
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 16:42:31 +0000
commit11c4d98017cbb86d08e15fd1b549180184b58a26 (patch)
tree2546a154c6f7bc0bec87de7316125ae7d1453569 /Carpet/CarpetMask
parentf520477b1c14e02f1495cfa8d3e09f4e21ab34d0 (diff)
Import Carpet
Ignore-this: 309b4dd613f4af2b84aa5d6743fdb6b3
Diffstat (limited to 'Carpet/CarpetMask')
-rw-r--r--Carpet/CarpetMask/README7
-rw-r--r--Carpet/CarpetMask/configuration.ccl5
-rw-r--r--Carpet/CarpetMask/schedule.ccl6
-rw-r--r--Carpet/CarpetMask/src/mask_excluded.cc39
-rw-r--r--Carpet/CarpetMask/src/mask_surface.cc33
-rw-r--r--Carpet/CarpetMask/src/mask_surface.hh2
6 files changed, 71 insertions, 21 deletions
diff --git a/Carpet/CarpetMask/README b/Carpet/CarpetMask/README
index 9c2fde769..a54ac4dbb 100644
--- a/Carpet/CarpetMask/README
+++ b/Carpet/CarpetMask/README
@@ -1,9 +1,10 @@
Cactus Code Thorn CarpetMask
-Thorn Author(s) : Erik Schnetter <schnetter@cct.lsu.edu>
-Thorn Maintainer(s) : Erik Schnetter <schnetter@cct.lsu.edu>
+Author(s) : Erik Schnetter <schnetter@cct.lsu.edu>
+Maintainer(s): Erik Schnetter <schnetter@cct.lsu.edu>
+Licence : GPLv2+
--------------------------------------------------------------------------
-Purpose of the thorn:
+1. Purpose
Remove unwanted regions from Carpet's reduction operations. This can
be used e.g. to excise the interior of horizons.
diff --git a/Carpet/CarpetMask/configuration.ccl b/Carpet/CarpetMask/configuration.ccl
new file mode 100644
index 000000000..505f2b2b9
--- /dev/null
+++ b/Carpet/CarpetMask/configuration.ccl
@@ -0,0 +1,5 @@
+# Configuration definitions for thorn CarpetMask
+
+REQUIRES LoopControl
+
+REQUIRES THORNS: LoopControl
diff --git a/Carpet/CarpetMask/schedule.ccl b/Carpet/CarpetMask/schedule.ccl
index a7b972557..1b136ff9a 100644
--- a/Carpet/CarpetMask/schedule.ccl
+++ b/Carpet/CarpetMask/schedule.ccl
@@ -1,5 +1,11 @@
# Schedule definitions for thorn CarpetMask
+SCHEDULE CarpetSurfaceParamCheck AT paramcheck
+{
+ LANG: C
+ OPTIONS: global
+} "Check parameters"
+
# TODO: Schedule this only if there is an excluded centre which is active
SCHEDULE GROUP MaskBase_SetupMask AT poststep AFTER SphericalSurface_HasBeenSet
{
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);
}