aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@906471b6-c639-44d1-9ea0-3e3d6879f074>2004-06-19 10:32:37 +0000
committerschnetter <schnetter@906471b6-c639-44d1-9ea0-3e3d6879f074>2004-06-19 10:32:37 +0000
commitbd2b68f99e0b702a0e62bf535de86f2fceb34964 (patch)
treeb647eb5b55cf0f4c4ef2b42a703f2647665186a6
parent127c8822ee6284bdbd05993e3e2589caf61861c8 (diff)
Check that the processor grid layout is consistent with the symmetry
boundary widths. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/SymBase/trunk@13 906471b6-c639-44d1-9ea0-3e3d6879f074
-rw-r--r--schedule.ccl5
-rw-r--r--src/Check.c117
-rw-r--r--src/SymBase.h5
-rw-r--r--src/make.code.defn2
4 files changed, 127 insertions, 2 deletions
diff --git a/schedule.ccl b/schedule.ccl
index 350d1f9..d9b4b93 100644
--- a/schedule.ccl
+++ b/schedule.ccl
@@ -18,3 +18,8 @@ SCHEDULE SymBase_Statistics IN SymBase_Wrapper AFTER SymmetryRegister
{
LANG: C
} "Print symmetry boundary face descriptions"
+
+SCHEDULE SymBase_Check AT CCTK_BASEGRID
+{
+ LANG: C
+} "Check whether the driver set up the grid consistently"
diff --git a/src/Check.c b/src/Check.c
new file mode 100644
index 0000000..cd264af
--- /dev/null
+++ b/src/Check.c
@@ -0,0 +1,117 @@
+/*@@
+ @file Check.c
+ @author Erik Schnetter
+ @date 2004-06-19
+ @desc
+ Check whether the driver set up the grid consistently.
+ @version $Header$
+ @enddesc
+@@*/
+
+#include "util_Table.h"
+
+#include "cctk.h"
+
+#include "SymBase.h"
+
+
+/* the rcs ID and its dummy function to use it */
+static const char *const rcsid = "$Header$";
+CCTK_FILEVERSION (CactusBase_SymBase_Check_c);
+
+
+
+/*@@
+ @routine SymBase_Check
+ @author Erik Schnetter
+ @date 2004-06-19
+ @desc
+ Check whether the driver set up the grid consistently.
+ @enddesc
+ @var CCTK_ARGUMENTS
+ @endvar
+@@*/
+
+void
+SymBase_Check (CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+
+ struct SymBase const *symdata;
+ CCTK_INT sym_table;
+ CCTK_INT symmetry_handle[100];
+ CCTK_INT symmetry_zone_width[100];
+ int ierr;
+ int d;
+
+
+
+ /* Get table entries */
+ symdata = CCTK_GHExtension (cctkGH, "SymBase");
+ if (!symdata)
+ {
+ CCTK_WARN (0, "internal error");
+ }
+
+ sym_table = symdata->sym_table;
+
+ if (2 * cctk_dim > 100)
+ {
+ CCTK_WARN (0, "internal error");
+ }
+ ierr = Util_TableGetIntArray
+ (sym_table, 2 * cctk_dim, symmetry_handle, "symmetry_handle");
+ if (ierr != 2 * cctk_dim)
+ {
+ CCTK_WARN (0, "internal error");
+ }
+ ierr = Util_TableGetIntArray
+ (sym_table, 2 * cctk_dim, symmetry_zone_width, "symmetry_zone_width");
+ if (ierr != 2 * cctk_dim)
+ {
+ CCTK_WARN (0, "internal error");
+ }
+
+
+
+ ierr = 0;
+
+ for (d=0; d<cctk_dim; ++d)
+ {
+
+ /* Check lower boundary */
+ if (symmetry_handle[2*d] >= 0)
+ {
+ if (cctk_bbox[2*d])
+ {
+ if (cctk_lsh[d] - cctk_nghostzones[d] < symmetry_zone_width[2*d])
+ {
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "This processor's domain is too small for the boundary condition at the lower boundary in direction %d", d);
+ ierr = 1;
+ }
+ }
+ }
+
+
+ /* Check upper boundary */
+ if (symmetry_handle[2*d+1] >= 0)
+ {
+ if (cctk_bbox[2*d+1])
+ {
+ if (cctk_lsh[d] - cctk_nghostzones[d] < symmetry_zone_width[2*d+1])
+ {
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "This processor's domain is too small for the boundary condition at the upper boundary in direction %d", d);
+ ierr = 1;
+ }
+ }
+ }
+
+ }
+
+ if (ierr)
+ {
+ CCTK_WARN (0, "The grid setup is inconsistent with the boundary sizes. One or more processors' domains are too small. The grid setup is decided by the driver. Try to make the driver lay out the grids differently.");
+ }
+}
diff --git a/src/SymBase.h b/src/SymBase.h
index b4e118e..6c3e31b 100644
--- a/src/SymBase.h
+++ b/src/SymBase.h
@@ -163,11 +163,14 @@ SymBase_SymmetryInterpolateFaces (CCTK_POINTER_TO_CONST const cctkGH_,
CCTK_POINTER const output_arrays[],
CCTK_INT const faces);
-
/* Statistics.c */
void
SymBase_Statistics (CCTK_ARGUMENTS);
+/* Check.c */
+void
+SymBase_Check (CCTK_ARGUMENTS);
+
#endif /* ! defined SYMBASE_H */
diff --git a/src/make.code.defn b/src/make.code.defn
index 53c838c..9b0f194 100644
--- a/src/make.code.defn
+++ b/src/make.code.defn
@@ -2,7 +2,7 @@
# $Header$
# Source files in this directory
-SRCS = Faces.c Handles.c Interpolation.c Startup.c Statistics.c Table.c
+SRCS = Check.c Faces.c Handles.c Interpolation.c Startup.c Statistics.c Table.c
# Subdirectories containing source files
SUBDIRS =