aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetReduce
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2010-12-03 16:19:47 -0500
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 18:25:48 +0000
commit3481b98cb0d357b226255254f98cda8193764614 (patch)
tree8613f246576564d1a11fdeb7a637722b6f34a40f /Carpet/CarpetReduce
parentfd09b304809f68285daa05deb9abfa7cb0a853ae (diff)
CarpetReduce: Remove dependency on LoopControl; use NoMPI
Diffstat (limited to 'Carpet/CarpetReduce')
-rw-r--r--Carpet/CarpetReduce/configuration.ccl7
-rw-r--r--Carpet/CarpetReduce/src/mask_init.c11
-rw-r--r--Carpet/CarpetReduce/src/mask_set.c11
-rw-r--r--Carpet/CarpetReduce/src/reduce.cc31
4 files changed, 32 insertions, 28 deletions
diff --git a/Carpet/CarpetReduce/configuration.ccl b/Carpet/CarpetReduce/configuration.ccl
index f81217393..3f6421b59 100644
--- a/Carpet/CarpetReduce/configuration.ccl
+++ b/Carpet/CarpetReduce/configuration.ccl
@@ -1,5 +1,8 @@
# Configuration definitions for thorn CarpetReduce
-REQUIRES Carpet CarpetLib LoopControl
+REQUIRES Carpet CarpetLib
+OPTIONAL LoopControl
+{
+}
-REQUIRES THORNS: Carpet CarpetLib LoopControl
+REQUIRES THORNS: Carpet CarpetLib
diff --git a/Carpet/CarpetReduce/src/mask_init.c b/Carpet/CarpetReduce/src/mask_init.c
index 806a4b3d0..0bc65c6c5 100644
--- a/Carpet/CarpetReduce/src/mask_init.c
+++ b/Carpet/CarpetReduce/src/mask_init.c
@@ -21,14 +21,11 @@ MaskBase_InitMask (CCTK_ARGUMENTS)
"Initialising weight to 1 on level %d", reflevel);
}
- int const allbits = BMSK(BMSK(cctk_dim)) - 1;
+ unsigned const bits = BMSK(cctk_dim);
+ unsigned const allbits = BMSK(bits) - 1;
#pragma omp parallel
- LC_LOOP3(MaskBase_InitMask_interior,
- i,j,k,
- 0,0,0, cctk_lsh[0],cctk_lsh[1],cctk_lsh[2],
- cctk_lsh[0],cctk_lsh[1],cctk_lsh[2])
- {
+ CCTK_LOOP3_ALL(MaskBase_InitMask, cctkGH, i,j,k) {
int const ind = CCTK_GFINDEX3D (cctkGH, i, j, k);
iweight[ind] = allbits;
- } LC_ENDLOOP3(MaskBase_InitMask_interior);
+ } CCTK_ENDLOOP3_ALL(MaskBase_InitMask);
}
diff --git a/Carpet/CarpetReduce/src/mask_set.c b/Carpet/CarpetReduce/src/mask_set.c
index 2444bda3d..1d4e9a330 100644
--- a/Carpet/CarpetReduce/src/mask_set.c
+++ b/Carpet/CarpetReduce/src/mask_set.c
@@ -20,15 +20,12 @@ MaskBase_SetMask (CCTK_ARGUMENTS)
"Finalise the weight on level %d", reflevel);
}
- CCTK_REAL const factor = 1.0 / BMSK(cctk_dim);
+ unsigned const bits = BMSK(cctk_dim);
+ CCTK_REAL const factor = 1.0 / bits;
#pragma omp parallel
- LC_LOOP3(MaskBase_InitMask_interior,
- i,j,k,
- 0,0,0, cctk_lsh[0],cctk_lsh[1],cctk_lsh[2],
- cctk_lsh[0],cctk_lsh[1],cctk_lsh[2])
- {
+ CCTK_LOOP3_ALL(MaskBase_SetMask, cctkGH, i,j,k) {
int const ind = CCTK_GFINDEX3D (cctkGH, i, j, k);
weight[ind] = factor * BCNT(iweight[ind]);
one[ind] = 1.0;
- } LC_ENDLOOP3(MaskBase_InitMask_interior);
+ } CCTK_ENDLOOP3_ALL(MaskBase_SetMask);
}
diff --git a/Carpet/CarpetReduce/src/reduce.cc b/Carpet/CarpetReduce/src/reduce.cc
index a7efe2c4c..9d977a52c 100644
--- a/Carpet/CarpetReduce/src/reduce.cc
+++ b/Carpet/CarpetReduce/src/reduce.cc
@@ -1,3 +1,7 @@
+#include <cctk.h>
+#include <util_ErrorCodes.h>
+#include <util_Table.h>
+
#include <algorithm>
#include <cassert>
#include <cfloat>
@@ -10,11 +14,11 @@
#include <limits>
#include <vector>
-#include <mpi.h>
-
-#include <cctk.h>
-#include <util_ErrorCodes.h>
-#include <util_Table.h>
+#ifdef CCTK_MPI
+# include <mpi.h>
+#else
+# include "nompi.h"
+#endif
#include <defs.hh>
#include <dist.hh>
@@ -1008,7 +1012,7 @@ namespace CarpetReduce {
if (intype != outtype) {
char const * const intypename = CCTK_VarTypeName (intype);
char const * const outtypename = CCTK_VarTypeName (outtype);
- CCTK_VWarn (2, __LINE__, __FILE__, CCTK_THORNSTRING,
+ CCTK_VWarn (CCTK_WARN_COMPLAIN, __LINE__, __FILE__, CCTK_THORNSTRING,
"The input type must be the same as the output type. Requested were intype=%s, outtype=%s.",
intypename, outtypename);
return -1;
@@ -1125,7 +1129,8 @@ namespace CarpetReduce {
// meta mode
if (is_meta_mode()) {
- CCTK_WARN (0, "Grid variable reductions are not possible in meta mode");
+ CCTK_WARN (CCTK_WARN_ABORT,
+ "Grid variable reductions are not possible in meta mode");
}
bool const reduce_arrays = CCTK_GroupTypeFromVarI(vi) != CCTK_GF;
@@ -1134,7 +1139,8 @@ namespace CarpetReduce {
for (int n=0; n<num_invars; ++n) {
if ((CCTK_GroupTypeFromVarI(invars[n]) != CCTK_GF) != reduce_arrays) {
- CCTK_WARN (0, "Cannot (yet) reduce grid functions and grid arrays/scalars at the same time");
+ CCTK_WARN (CCTK_WARN_ABORT,
+ "Cannot (yet) reduce grid functions and grid arrays/scalars at the same time");
}
}
@@ -1223,7 +1229,7 @@ namespace CarpetReduce {
}
if (not have_warned.AT(vi)) {
char * const fullname = CCTK_FullName(vi);
- CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ CCTK_VWarn (CCTK_WARN_ALERT, __LINE__, __FILE__, CCTK_THORNSTRING,
"Grid function \"%s\" has only %d time levels on refinement level %d; this is not enough for time interpolation",
fullname, max_tl, reflevel);
free (fullname);
@@ -1234,11 +1240,12 @@ namespace CarpetReduce {
need_time_interp = false;
} else {
char * const fullname = CCTK_FullName(vi);
- CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ CCTK_VWarn (CCTK_WARN_ALERT, __LINE__, __FILE__, CCTK_THORNSTRING,
"Grid function \"%s\" has only %d active time levels out of %d maximum time levels on refinement level %d; this is not enough for time interpolation",
fullname, active_tl, max_tl, reflevel);
if (not do_allow_past_timelevels) {
- CCTK_WARN (1, "(Note: access to past time levels is disabled at this point, probably because of the schedule bin from which this code is called.)");
+ CCTK_WARN (CCTK_WARN_ALERT,
+ "(Note: access to past time levels is disabled at this point, probably because of the schedule bin from which this code is called.)");
}
free (fullname);
return 1; // error
@@ -1255,7 +1262,7 @@ namespace CarpetReduce {
int const active_tl = CCTK_ActiveTimeLevelsVI(cgh, vi);
if (active_tl < num_tl) {
char * const fullname = CCTK_FullName(vi);
- CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ CCTK_VWarn (CCTK_WARN_ALERT, __LINE__, __FILE__, CCTK_THORNSTRING,
"Grid function \"%s\" has no active time levels on refinement level %d",
fullname, reflevel);
free (fullname);