summaryrefslogtreecommitdiff
path: root/src/main/DebugDefines.c
blob: 3ac0bca47755fb7dd71590e5d37505b03fbf4949 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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 */