From a2e55d6e2cb462c51f16efeac1a737f86477e18d Mon Sep 17 00:00:00 2001 From: rideout Date: Mon, 19 May 2003 14:06:10 +0000 Subject: Check to see that no grid variable has more than 15 dimensions. The restriction comes from specifying a set of faces using a single signed 32 bit integer. It may be possible to use two more bits, which would provide an extra dimension, but this seems unnecessary at the moment. Note that (as pointed out by Erik Schnetter, on the flesh mailing list) we are assuming that the integer is at least 32 bits, which is not guaranteed by C. Might this pose a problem? Should we restrict ourselves to (16-1)/2 = 7 dimensions? git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/Boundary/trunk@235 6a38eb6e-646e-4a02-a296-d141613ad6c4 --- schedule.ccl | 5 ++++ src/Check.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/make.code.defn | 3 ++- 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 src/Check.c diff --git a/schedule.ccl b/schedule.ccl index 9e5d248..9afb8e6 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -1,6 +1,11 @@ # Schedule definitions for thorn Boundary # $Header$ +schedule Boundary_Check at CCTK_PARAMCHECK +{ + lang: C +} "Check dimension of grid variables" + schedule Boundary_RegisterBCs at CCTK_BASEGRID { lang: C diff --git a/src/Check.c b/src/Check.c new file mode 100644 index 0000000..c2e921c --- /dev/null +++ b/src/Check.c @@ -0,0 +1,79 @@ + /*@@ + @file Check.c + @date 19 May 2003 + @author David Rideout + @desc + Check that the dimension of any grid variables is not greater than + what the faces specification can handle (currently 15). + @enddesc + @history + @hdate + @hauthor + @hdesc + @endhistory + @version $Header$ + @@*/ + +#include "cctk.h" +#include "cctk_Arguments.h" + +/* the rcs ID and its dummy function to use it */ +static const char *rcsid = "$Header$"; +CCTK_FILEVERSION(CactusBase_Boundary_Check_c); + +/* Maximum dimension for grid variables to be selected for BC. + Restriction is representation of set of faces in a 32 bit signed integer. */ +#define MAX_DIM 15 + +/******************************************************************** + ******************** Prototypes ******************************* + ********************************************************************/ + +int Boundary_Check(CCTK_ARGUMENTS); + +/******************************************************************** + ******************** Scheduled Routines *********************** + ********************************************************************/ + +/*@@ + @routine Boundary_Check + @date 19 May 2003 + @author David Rideout + @desc + Check that the dimension of any grid variables is not greater than + what the faces specification can handle (currently 15). + @enddesc + @calls + @history + Note that in future versions of Cactus this will require the GH + passed through CCTK_ARGUMENTS. + @endhistory + @var CCTK_ARGUMENTS + @vdesc standard Cactus argument list + @vtype various + @vio in + @endvar + @returntype int + @returndesc + 0 success + -1 cactus executable contains variable group with too many + dimensions + @endreturndesc +@@*/ + +int Boundary_Check(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_ARGUMENTS; + int retval; + + retval = 0; + if (CCTK_MaxDim() > 15) + { + CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING, + "Executable contains variable group with more than 15 " + "dimensions. Thorn Boundary will not function properly for " + "these variable groups."); + retval = -1; + } + return retval; +} diff --git a/src/make.code.defn b/src/make.code.defn index 46bffe0..7ac414f 100644 --- a/src/make.code.defn +++ b/src/make.code.defn @@ -10,4 +10,5 @@ SRCS = ScalarBoundary.c\ RobinBoundary.c\ NoneBoundary.c\ Boundary.c\ - Register.c + Register.c\ + Check.c -- cgit v1.2.3