From bd2b68f99e0b702a0e62bf535de86f2fceb34964 Mon Sep 17 00:00:00 2001 From: schnetter Date: Sat, 19 Jun 2004 10:32:37 +0000 Subject: 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 --- schedule.ccl | 5 +++ src/Check.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/SymBase.h | 5 ++- src/make.code.defn | 2 +- 4 files changed, 127 insertions(+), 2 deletions(-) create mode 100644 src/Check.c 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= 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 = -- cgit v1.2.3