diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2001-07-03 12:42:51 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2001-07-03 12:42:51 +0000 |
commit | b209f83c9b33fc2aafcbcc0abc5d0e485c4a6546 (patch) | |
tree | 68e46acbe877c901b24cc36bdfedcf240324f786 /src/main/DebugDefines.c | |
parent | f7484d9e9f40ceff0292fe4eb3c3ef3bf7a6a0fa (diff) |
Added new source file DebugDefines.c which provides some debugging support
routines for Cactus. So far it defines all the CCTK_GFINDEX?D() routines for
debug configurations.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@2265 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/DebugDefines.c')
-rw-r--r-- | src/main/DebugDefines.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/src/main/DebugDefines.c b/src/main/DebugDefines.c new file mode 100644 index 00000000..3ac0bca4 --- /dev/null +++ b/src/main/DebugDefines.c @@ -0,0 +1,75 @@ +/*@@ + @file DebugDefines.c + @date Tue 2 Jul 2001 + @author Thomas Radke + @desc + Routines to provide some debugging support for the Cactus code. + @enddesc + @version $Id$ + @@*/ + +#include "cctk_Config.h" +#include "cctk_Flesh.h" + +static const char *rcsid = "$Header$"; + +CCTK_FILEVERSION(main_DebugDefines_c) + + +/******************************************************************** + ********************* External Routines ********************** + ********************************************************************/ +#ifdef CCTK_DEBUG +int CCTK_GFINDEX1D (const cGH *GH, int i); +int CCTK_GFINDEX2D (const cGH *GH, int i, int j); +int CCTK_GFINDEX3D (const cGH *GH, int i, int j, int k); +int CCTK_GFINDEX4D (const cGH *GH, int i, int j, int k, int l); + + + /*@@ + @routine CCTK_GFINDEX?D + @date Tue 2 Jul 2001 + @author Thomas Radke + @desc + Compute the linear index of a grid function element + from its spatial indices + @enddesc + + @var GH + @vdesc pointer to CCTK grid hierarchy extension + @vtype const cGH * + @vio in + @endvar + @var i, j, k, l + @vdesc spatial indices + @vtype int + @vio in + @endvar + + @returntype int + @returndesc + the linear index for the given spatial indices + @endreturndesc +@@*/ +int CCTK_GFINDEX1D (const cGH *GH, int i) +{ + GH = GH; + return (i); +} + +int CCTK_GFINDEX2D (const cGH *GH, int i, int j) +{ + return (i + GH->cctk_lsh[0]*j); +} + +int CCTK_GFINDEX3D (const cGH *GH, int i, int j, int k) +{ + return (i + GH->cctk_lsh[0]*(j + GH->cctk_lsh[1]*k)); +} + +int CCTK_GFINDEX4D (const cGH *GH, int i, int j, int k, int l) +{ + return (i + GH->cctk_lsh[0]*(j + GH->cctk_lsh[1]*(k + GH->cctk_lsh[2] * l))); +} + +#endif /* CCTK_DEBUG */ |