aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlanfer <lanfer@10716dce-81a3-4424-a2c8-48026a0d3035>2000-05-12 16:03:58 +0000
committerlanfer <lanfer@10716dce-81a3-4424-a2c8-48026a0d3035>2000-05-12 16:03:58 +0000
commit8c27e7fcc1f89c17f38812b5f3625df3f67488fe (patch)
tree9681f9a9742c4ba10bce4fd025253c4eb5a1bd15 /src
parent27dec4c0b1c40a77c639071bcedfde881ea4e14a (diff)
clean up
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHSlab/trunk@16 10716dce-81a3-4424-a2c8-48026a0d3035
Diffstat (limited to 'src')
-rw-r--r--src/CollectData2D.c122
1 files changed, 78 insertions, 44 deletions
diff --git a/src/CollectData2D.c b/src/CollectData2D.c
index f616718..a42ae8a 100644
--- a/src/CollectData2D.c
+++ b/src/CollectData2D.c
@@ -17,7 +17,6 @@
#define MAX_DIM 3
#define BAD -42
-#define GZ 1
int CollectData2D(cGH *GH, int vindex, int vtimelvl, int vdim,
@@ -28,21 +27,45 @@ int CollectData2D(cGH *GH, int vindex, int vtimelvl, int vdim,
}
+ /*@@
+ @routine CollectLocalData2D
+ @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 CollectLocalData2D(cGH *GH, int vindex, int vtimelvl, int vdim,
- int *S_s, int dir[2], int ds[2], int len[2],
+ int *S_s, int linedir[2], int ds[2], int len[2],
void **loc_dptr, int *idx1_dptr, int *idx2_dptr, int *dsize)
{
- int tstart[MAX_DIM];
- int ierr;
+ int tstart[MAX_DIM]; /* temp start points */
+ int tlocstart[MAX_DIM];
+ int tlocend[MAX_DIM];
- int *locstart, *locend, nlocpoints, totlocpoints=0;
- int tlocstart[MAX_DIM], tlocend[MAX_DIM];
- int u_l1[MAX_DIM], u_l2[MAX_DIM];
- int vtype,vtypesize;
- int idim;
+ int *locstart, *locend; /* local start/end pnt in glob. index coord */
+ int nlocpoints[2], totlocpoints; /* number of loc. points in each dir, tot. pnts */
+
+ int u_l[2][MAX_DIM]; /* the 2 vectors which span the surface:
+ e.g. 001,100 */
+
+ int vtype,vtypesize;
+ int idim, idir;
+ int ierr;
int phasplane=1;
void *data = CCTK_VarDataPtrI (GH, vtimelvl, vindex);
@@ -54,16 +77,21 @@ int CollectLocalData2D(cGH *GH, int vindex, int vtimelvl, int vdim,
locstart = (int*)malloc(vdim*sizeof(int));
locend = (int*)malloc(vdim*sizeof(int));
+
+ /* 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;
- u_l1[idim] = 0;
- u_l2[idim] = 0;
+ /* line vectors are 000, 000 */
+ u_l[0][idim] = 0;
+ u_l[1][idim] = 0;
- if ((idim!=dir[0]) && (idim!=dir[1]))
+ /* 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]))
{
@@ -74,49 +102,55 @@ int CollectLocalData2D(cGH *GH, int vindex, int vtimelvl, int vdim,
else phasplane = 0;
}
- u_l1[dir[0]]=1;
- u_l2[dir[1]]=1;
-
+ /* construct line vectors that span the surface:
+ e.g. linedir[0,1] = 1,2 means YZ surface: (000,000) -> (010,001) */
+ u_l[0][linedir[0]]=1;
+ u_l[1][linedir[1]]=1;
-
- if (S_s[dir[0]]<GH->cctk_ubnd[dir[0]])
+ /* init to 1 (neutral element for multiplication) */
+ totlocpoints=1;
+
+ for (idir=0;idir<2;idir++)
{
- /* Initialize startpoints */
- for (idim=0; idim<vdim; idim++) {
- tstart[idim] = GH->cctk_lbnd[idim]+GH->cctk_nghostzones[idim];
+
+ if (S_s[linedir[idir]]<GH->cctk_ubnd[linedir[idir]])
+ {
+ /* 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, &nlocpoints[idir]);
+ locstart[linedir[idir]]= tlocstart[linedir[idir]];
+ locend [linedir[idir]]= tlocend[linedir[idir]];
+
+ totlocpoints*=nlocpoints[idir];
+
+ if (locstart[linedir[idir]]==BAD) phasplane &=0;
}
- tstart[dir[0]]=S_s[dir[0]];
- ierr = GetLocalLine(GH, vdim, tstart, u_l1, ds[0], len[0],
- tlocstart, tlocend, &nlocpoints);
- locstart[dir[0]]= tlocstart[dir[0]];
- locend [dir[0]]= tlocend[dir[0]];
- totlocpoints=nlocpoints;
- if (locstart[dir[0]]==BAD) phasplane &=0;
+ else
+ {
+ phasplane &=0;
+ totlocpoints = 0;
+ }
+
}
- else phasplane &=0;
- if (S_s[dir[1]]<GH->cctk_ubnd[dir[1]])
- {
- /* Initialize startpoints */
- for (idim=0; idim<vdim; idim++) {
- tstart[idim] = GH->cctk_lbnd[idim]+GH->cctk_nghostzones[idim];
- }
- tstart[dir[1]]=S_s[dir[1]];
- ierr = GetLocalLine(GH, vdim, tstart, u_l2, ds[1], len[1],
- tlocstart, tlocend, &nlocpoints);
- locstart[dir[1]]= tlocstart[dir[1]];
- locend[dir[1]] = tlocend[dir[1]];
- totlocpoints*=nlocpoints;
- }
- else phasplane &=0;
-
if (phasplane)
printf("LOC START: %d %d %d %d %d %d -> %d\n",
locstart[0],locstart[1],locstart[2],
locend[0],locend[1],locend[2],
totlocpoints);
- else
+ else
+ {
printf("proc has no plane\n");
+ printf("LOC START: %d %d %d %d %d %d -> %d\n",
+ locstart[0],locstart[1],locstart[2],
+ locend[0],locend[1],locend[2],
+ totlocpoints);
+ }
}