From 232b81cc03dbdb548dffcf1f9b6e92659e2bd441 Mon Sep 17 00:00:00 2001 From: eschnett Date: Wed, 24 Nov 2010 02:58:40 +0000 Subject: Add CCTK_VECTGFINDEX3D and friends Add functions CCTK_VectGF1D, CCTK_VectGF2D etc. and the corresponding macros CCTK_VECTGFINDEX1D etc. that allow indexing into vector grid variables. Vector grid variables require an additional index, namely the vector index; these functions simplify using them. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4654 17b73243-c579-4c4c-a9d2-2d5706c11dac --- src/main/DebugDefines.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/main') diff --git a/src/main/DebugDefines.c b/src/main/DebugDefines.c index 43383489..76f70b2f 100644 --- a/src/main/DebugDefines.c +++ b/src/main/DebugDefines.c @@ -66,3 +66,24 @@ 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))); } + +int CCTK_VectGFIndex1D (const cGH *GH, int i, int n) +{ + return (i + GH->cctk_lsh[0]*n); +} + +int CCTK_VectGFIndex2D (const cGH *GH, int i, int j, int n) +{ + return (i + GH->cctk_lsh[0]*(j + GH->cctk_lsh[1]*n)); +} + +int CCTK_VectGFIndex3D (const cGH *GH, int i, int j, int k, int n) +{ + return (i + GH->cctk_lsh[0]*(j + GH->cctk_lsh[1]*(k + GH->cctk_lsh[2]*n))); +} + +int CCTK_VectGFIndex4D (const cGH *GH, int i, int j, int k, int l, int n) +{ + return (i + GH->cctk_lsh[0]*(j + GH->cctk_lsh[1]*(k + GH->cctk_lsh[2]* + (l + GH->cctk_lsh[3]*n)))); +} -- cgit v1.2.3