[Users] Debugging patch for SetMask_SphericalSurface

Erik Schnetter schnetter at cct.lsu.edu
Mon Aug 2 13:40:59 CDT 2010


Christian

The enclosed patch may help debug SetMask_SphericalSurface.  It checks
a few consistency conditions.

-erik

-- 
Erik Schnetter <schnetter at cct.lsu.edu>   http://www.cct.lsu.edu/~eschnett/



$ svn diff
Index: param.ccl
===================================================================
--- param.ccl	(revision 107)
+++ param.ccl	(working copy)
@@ -2,7 +2,7 @@

 STRING SetMask_MaskName "Full variable name of the mask to be set"
 {
-  ".+" :: "Any full Cactus variable name, GF of type CCTK_BYTE"
+  ".+" :: "Any full Cactus variable name, GF of type CCTK_INT"
 } "HydroBase::hydro_excision_mask"

 #BOOLEAN SetMask_ResetAll "'yes' (default): Overwrite complete mask,
'no': Only set excision points"
Index: src/SetMask.c
===================================================================
--- src/SetMask.c	(revision 107)
+++ src/SetMask.c	(working copy)
@@ -10,9 +10,18 @@
   DECLARE_CCTK_ARGUMENTS;
   DECLARE_CCTK_PARAMETERS;

-  CCTK_INT *mask = (CCTK_INT*) CCTK_VarDataPtr(cctkGH, 0, SetMask_MaskName);
+  int varindex = CCTK_VarIndex(SetMask_MaskName);
+  if (varindex<0)
+    CCTK_WARN(0, "No such variable");
+  int grouptype = CCTK_GroupTypeFromVarI(varindex);
+  if (grouptype!=CCTK_GF)
+    CCTK_WARN(0, "Wrong group type, must be GF");
+  int vartype = CCTK_VarTypeI(varindex);
+  if (vartype!=CCTK_VARIABLE_INT)
+    CCTK_WARN(0, "Wrong variable type, must be CCTK_INT");
+  CCTK_INT *mask = (CCTK_INT*) CCTK_VarDataPtrI(cctkGH, 0, varindex);
   if (!mask)
-    CCTK_WARN(0, "No such variable, or no storage enabled");
+    CCTK_WARN(0, "No storage enabled");

   for (int smi = 0; smi < 10; smi++)
   {


More information about the Users mailing list