diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-02-08 21:27:07 -0600 |
---|---|---|
committer | Ian Hinder <hinder@paulaner.gravity.psu.edu> | 2008-02-19 19:27:44 -0500 |
commit | bf440b2ee1d16cd5694c8af7e96cf3cffba8188a (patch) | |
tree | a1c57272d7f0c97e2b8d8bb5a60859ee5578b3f5 /Auxiliary | |
parent | e7ca7d282d89c3ddbea142b474152d75125e8a7c (diff) |
Implement functionality to loop over all boundary points, including ghost
points, and without synchronising afterwards.
Diffstat (limited to 'Auxiliary')
-rw-r--r-- | Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c | 89 | ||||
-rw-r--r-- | Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h | 1 |
2 files changed, 90 insertions, 0 deletions
diff --git a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c index 4e6a9d5..7979133 100644 --- a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c +++ b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.c @@ -199,6 +199,93 @@ void GenericFD_LoopOverBoundary(cGH *cctkGH, Kranc_Calculation calc) dir[1] = dir2; dir[2] = dir3; + here_is_physbnd = 1; + + for (d = 0; d < 3; d++) + { + switch(dir[d]) + { + case -1: + bmin[d] = 0; + bmax[d] = imin[d]; + here_is_physbnd = here_is_physbnd && is_physbnd[2*d+0]; + break; + case 0: + bmin[d] = imin[d]; + bmax[d] = imax[d]; + break; + case +1: + bmin[d] = imax[d]; + bmax[d] = cctk_lsh[d]; + here_is_physbnd = here_is_physbnd && is_physbnd[2*d+1]; + break; + } + + /* Choose a basis */ + normal[d] = dir[d]; + tangentA[d] = dir[(d+1)%3]; + tangentB[d] = dir[(d+2)%3]; + } + + if (here_is_physbnd) + { +#if 0 + CCTK_REAL normal_norm = 0.0; + for (d = 0; d < 3; d++) + { + normal_norm += pow(normal[d], 2); + } + normal_norm = sqrt(normal_norm); + for (d = 0; d < 3; d++) + { + normal[d] /= normal_norm; + } +#endif + + calc(cctkGH, old_dir, old_face, normal, tangentA, tangentB, bmin, bmax, 0, NULL); + } + + } + } + } + + return; +} + + +void GenericFD_LoopOverBoundaryWithGhosts(cGH *cctkGH, Kranc_Calculation calc) +{ + DECLARE_CCTK_ARGUMENTS + + CCTK_INT dir1, dir2, dir3; + CCTK_INT dir[3]; + CCTK_REAL normal[3]; + CCTK_REAL tangentA[3]; + CCTK_REAL tangentB[3]; + CCTK_INT bmin[3]; + CCTK_INT bmax[3]; + CCTK_INT here_is_physbnd; + CCTK_INT d; + + CCTK_INT is_symbnd[6], is_physbnd[6], is_ipbnd[6]; + CCTK_INT imin[3], imax[3]; + int old_dir = 0; + int old_face = 0; + + GenericFD_GetBoundaryInfo(cctkGH, cctk_lsh, cctk_bbox, cctk_nghostzones, + imin, imax, is_symbnd, is_physbnd, is_ipbnd); + + /* Loop over all faces */ + for (dir3 = -1; dir3 <= +1; dir3++) + { + for (dir2 = -1; dir2 <= +1; dir2++) + { + for (dir1 = -1; dir1 <= +1; dir1++) + { + dir[0] = dir1; + dir[1] = dir2; + dir[2] = dir3; + here_is_physbnd = 0; for (d = 0; d < 3; d++) @@ -252,6 +339,7 @@ void GenericFD_LoopOverBoundary(cGH *cctkGH, Kranc_Calculation calc) return; } + void GenericFD_LoopOverInterior(cGH *cctkGH, Kranc_Calculation calc) { DECLARE_CCTK_ARGUMENTS @@ -273,6 +361,7 @@ void GenericFD_LoopOverInterior(cGH *cctkGH, Kranc_Calculation calc) return; } + void GenericFD_PenaltyPrim2Char(cGH *cctkGH, CCTK_INT const dir, CCTK_INT const face, CCTK_REAL const * restrict const base, diff --git a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h index 2bd3aa9..501f725 100644 --- a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h +++ b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h @@ -735,6 +735,7 @@ typedef void(*Kranc_Calculation)(cGH *cctkGH, CCTK_INT dir, CCTK_INT face, void GenericFD_LoopOverEverything(cGH *cctkGH, Kranc_Calculation calc); void GenericFD_LoopOverBoundary(cGH *cctkGH, Kranc_Calculation calc); +void GenericFD_LoopOverBoundaryWithGhosts(cGH *cctkGH, Kranc_Calculation calc); void GenericFD_LoopOverInterior(cGH *cctkGH, Kranc_Calculation calc); #endif |