diff options
Diffstat (limited to 'Examples/Laplace/src/Laplace_relax.cc')
-rw-r--r-- | Examples/Laplace/src/Laplace_relax.cc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Examples/Laplace/src/Laplace_relax.cc b/Examples/Laplace/src/Laplace_relax.cc index db6d9c3..a5cb16c 100644 --- a/Examples/Laplace/src/Laplace_relax.cc +++ b/Examples/Laplace/src/Laplace_relax.cc @@ -17,10 +17,10 @@ /* Define macros used in calculations */ #define INITVALUE (42) -#define QAD(x) (SQR(SQR(x))) -#define INV(x) ((1.0) / (x)) +#define INV(x) ((CCTK_REAL)1.0 / (x)) #define SQR(x) ((x) * (x)) -#define CUB(x) ((x) * (x) * (x)) +#define CUB(x) ((x) * SQR(x)) +#define QAD(x) (SQR(SQR(x))) extern "C" void Laplace_relax_SelectBCs(CCTK_ARGUMENTS) { @@ -40,8 +40,6 @@ static void Laplace_relax_Body(cGH const * restrict const cctkGH, int const dir, DECLARE_CCTK_PARAMETERS; - /* Declare finite differencing variables */ - /* Include user-supplied include files */ /* Initialise finite differencing variables */ @@ -72,10 +70,10 @@ static void Laplace_relax_Body(cGH const * restrict const cctkGH, int const dir, CCTK_REAL const p1o1 = 1; CCTK_REAL const p1o12dx = 0.0833333333333333333333333333333*INV(dx); CCTK_REAL const p1o12dy = 0.0833333333333333333333333333333*INV(dy); - CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx)*INV(dy); + CCTK_REAL const p1o144dxdy = 0.00694444444444444444444444444444*INV(dx*dy); CCTK_REAL const p1o2dx = 0.5*INV(dx); CCTK_REAL const p1o2dy = 0.5*INV(dy); - CCTK_REAL const p1o4dxdy = 0.25*INV(dx)*INV(dy); + CCTK_REAL const p1o4dxdy = 0.25*INV(dx*dy); CCTK_REAL const p1odx2 = INV(SQR(dx)); CCTK_REAL const p1ody2 = INV(SQR(dy)); CCTK_REAL const pm1o12dx2 = -0.0833333333333333333333333333333*INV(SQR(dx)); @@ -91,9 +89,9 @@ static void Laplace_relax_Body(cGH const * restrict const cctkGH, int const dir, /* Loop over the grid points */ #pragma omp parallel - CCTK_LOOP3 (Laplace_relax, + CCTK_LOOP3(Laplace_relax, i,j,k, imin[0],imin[1],imin[2], imax[0],imax[1],imax[2], - cctk_lsh[0],cctk_lsh[1],cctk_lsh[2]) + cctk_ash[0],cctk_ash[1],cctk_ash[2]) { ptrdiff_t const index = di*i + dj*j + dk*k; @@ -131,7 +129,7 @@ static void Laplace_relax_Body(cGH const * restrict const cctkGH, int const dir, /* Copy local copies back to grid functions */ phirhs[index] = phirhsL; } - CCTK_ENDLOOP3 (Laplace_relax); + CCTK_ENDLOOP3(Laplace_relax); } extern "C" void Laplace_relax(CCTK_ARGUMENTS) @@ -150,7 +148,9 @@ extern "C" void Laplace_relax(CCTK_ARGUMENTS) return; } - const char *groups[] = {"Laplace::phi_group","Laplace::phi_grouprhs"}; + const char *const groups[] = { + "Laplace::phi_group", + "Laplace::phi_grouprhs"}; GenericFD_AssertGroupStorage(cctkGH, "Laplace_relax", 2, groups); switch(fdOrder) @@ -164,7 +164,7 @@ extern "C" void Laplace_relax(CCTK_ARGUMENTS) break; } - GenericFD_LoopOverInterior(cctkGH, &Laplace_relax_Body); + GenericFD_LoopOverInterior(cctkGH, Laplace_relax_Body); if (verbose > 1) { |