diff options
author | lanfer <lanfer@10716dce-81a3-4424-a2c8-48026a0d3035> | 2000-05-15 09:10:06 +0000 |
---|---|---|
committer | lanfer <lanfer@10716dce-81a3-4424-a2c8-48026a0d3035> | 2000-05-15 09:10:06 +0000 |
commit | 68f608a8e82ed0264ac600cc0703fb25fbfedd43 (patch) | |
tree | 1a925ceaeb69c5ddfac94b8c76dbbaa4ecad2a88 /src | |
parent | 0128ef4e481e74282915200b3d8578926e118ad6 (diff) |
this routine does the same as GetLocalLine, only for slabs along coordinate axis
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHSlab/trunk@20 10716dce-81a3-4424-a2c8-48026a0d3035
Diffstat (limited to 'src')
-rw-r--r-- | src/GetLocalSlab.c | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/src/GetLocalSlab.c b/src/GetLocalSlab.c new file mode 100644 index 0000000..67c559c --- /dev/null +++ b/src/GetLocalSlab.c @@ -0,0 +1,155 @@ + + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + +#include "cctk.h" +#include "cctk_Parameters.h" +#include "cctk_Arguments.h" + +#include "Hyperslab.h" +#include "Hyperslabi.h" +#include "CactusBase/IOUtil/src/ioGH.h" +#include "CactusPUGH/PUGH/src/include/pugh.h" + +#define SLAB_DEBUG + + + /*@@ + @routine GetLocalSlab.c + @date Fri May 12 17:51:30 2000 + @author Gerd Lanfermann + @desc + S_s : starting point of surface + linedir[2]: the two directions that span the surface: 0~x, 1~y, ... + ds[2] : downsampling in each dir, + len[2] : number of (downsampled) point + @enddesc + @calls + @calledby + @history + + @endhistory + +@@*/ + + +int GetLocalSlab(cGH *GH, int vdim, int sdim, + int *S_s, int *linedir, int *ds, int *len, + int *locstart, int *locend, int *dirsize, int *totsize) +{ + + + + int tstart[MAX_DIM]; /* temp start points */ + int tlocstart[MAX_DIM]; + int tlocend[MAX_DIM]; + + int u_l[MAX_DIM][MAX_DIM]; + + int vtype,vtypesize; + int idim, idir; + int ierr; + int phasplane=1; + + /* Initialize the local start/end to BAD values and hope for the best... */ + for (idim=0; idim<vdim; idim++) + { + tstart[idim] = BAD; + locstart[idim] = BAD; + locend[idim] = BAD; + + /* line vectors 1..3 are 000, 000 */ + u_l[0][idim] = 0; + u_l[1][idim] = 0; + u_l[2][idim] = 0; + + /* make sure that all procs above and below the plane, + know that they don't have a plane */ + if ((idim!=linedir[0]) && (idim!=linedir[1])) + if((GH->cctk_lbnd[idim]<S_s[idim]) && + (GH->cctk_ubnd[idim]>S_s[idim])) + { + locstart[idim] = S_s[idim]; + locend[idim] = S_s[idim]; + phasplane = 1; + } + else phasplane = 0; + } + + /* construct line vectors that span the surface: + e.g. linedir[0,1] = 1,2 means YZ surface: + u_l[0][]=(000) -> (010) + u_l[1][]=(000) -> (001) */ + for (idir=0; idir<sdim; idir++) + { + u_l[idir][linedir[idir]]=1; + } + + /* init to 1 (neutral element for multiplication) */ + totsize[0] = 1; + + for (idir=0;idir<2;idir++) + { +#ifdef SLAB_DEBUG + printf(" testing arm %d: S_s (%d) < ubnd (%d) ", + idir, S_s[linedir[idir]], GH->cctk_ubnd[linedir[idir]]); +#endif + if (S_s[linedir[idir]]<GH->cctk_ubnd[linedir[idir]]) + { +#ifdef SLAB_DEBUG + printf(" .... YES \n"); +#endif + /* Initialize startpoints */ + for (idim=0; idim<vdim; idim++) + { + tstart[idim] = GH->cctk_lbnd[idim]+GH->cctk_nghostzones[idim]; + } + tstart[linedir[idir]]=S_s[linedir[idir]]; + ierr = GetLocalLine(GH, vdim, tstart, u_l[idir], ds[idir], len[idir], + tlocstart, tlocend, &dirsize[idir]); + locstart[linedir[idir]]= tlocstart[linedir[idir]]; + locend [linedir[idir]]= tlocend[linedir[idir]]; + + totsize[0] *=dirsize[idir]; + + if (locstart[linedir[idir]]==BAD) phasplane &=0; + } + else + { +#ifdef SLAB_DEBUG + printf(" .... NO \n"); +#endif + phasplane &= 0; + totsize[0] = 0; + } + + } + + if (phasplane) + { +#ifdef SLAB_DEBUG + printf("LOC START: %d %d %d %d %d %d -> %d\n", + locstart[0],locstart[1],locstart[2], + locend[0],locend[1],locend[2], + totsize[0]); +#endif + } + else + { +#ifdef SLAB_DEBUG + printf("proc has no plane\n"); +#endif + } +} + + + + + + /*$printf("LB/UB [%d , %d, %d] - [%d, %d, %d] \n", + GH->cctk_lbnd[0],GH->cctk_lbnd[1],GH->cctk_lbnd[2], + GH->cctk_ubnd[0],GH->cctk_ubnd[1],GH->cctk_ubnd[2]);$*/ + + |