diff options
author | tradke <tradke@10716dce-81a3-4424-a2c8-48026a0d3035> | 2000-06-19 09:37:39 +0000 |
---|---|---|
committer | tradke <tradke@10716dce-81a3-4424-a2c8-48026a0d3035> | 2000-06-19 09:37:39 +0000 |
commit | 66edcfad13a9079c5a0e270714b77c5d8147100c (patch) | |
tree | b2794aa2d0d4dc69bc07158daf1a49dc324acf6f | |
parent | db8ea0873a7579eb1e08b697733d63695bbe82a9 (diff) |
Use the size info from PUGH's pGExtras structure instead of the cGH
to make 1D line hyperslabs working for CCTK_ARRAY vars as well.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHSlab/trunk@25 10716dce-81a3-4424-a2c8-48026a0d3035
-rw-r--r-- | src/CollectData1D.c | 6 | ||||
-rw-r--r-- | src/GetLocalLine.c | 23 |
2 files changed, 18 insertions, 11 deletions
diff --git a/src/CollectData1D.c b/src/CollectData1D.c index 9645fea..3b1ba78 100644 --- a/src/CollectData1D.c +++ b/src/CollectData1D.c @@ -25,7 +25,7 @@ } /* local function prototypes */ -int GetLocalLine(cGH *GH, +int GetLocalLine(cGH *GH, pGExtras *extras, int vardim, const int *S_l, const int *u_l, int ds, int len_l, int *locstart, int *locend, int *nlocpoints); #ifdef CCTK_MPI @@ -43,6 +43,8 @@ static int CollectLocalData1D(cGH *GH, int vindex, int vtimelvl, cGroup groupinfo; int locstart [3], locend [3]; void *vdata = CCTK_VarDataPtrI (GH, vtimelvl, vindex); + pGExtras *extras = ((pGA *) PUGH_pGH (GH)->variables [vindex][vtimelvl])->extras; + CCTK_GroupData (CCTK_GroupIndexFromVarI (vindex), &groupinfo); @@ -53,7 +55,7 @@ static int CollectLocalData1D(cGH *GH, int vindex, int vtimelvl, return (-1); } - ierr = GetLocalLine(GH, 3, origin, directions, downsample, length, + ierr = GetLocalLine(GH, extras, 3, origin, directions, downsample, length, locstart, locend, hsize); if (ierr < 0) { diff --git a/src/GetLocalLine.c b/src/GetLocalLine.c index 19c6008..b44daf2 100644 --- a/src/GetLocalLine.c +++ b/src/GetLocalLine.c @@ -3,6 +3,7 @@ #include <math.h> #include "cctk.h" +#include "CactusPUGH/PUGH/src/include/pugh.h" #define MAX_DIM 3 #define MAX_FACE 6 @@ -11,7 +12,7 @@ #define ABS(a) ((a)<0 ? -(a) : (a)) #define SIGN(a) ((a)<0.0 ? (-1.0) : (1.0)) -#define LIN_INDEX3D(GH,P) ((P[0])+ (GH)->cctk_gsh[0]*((P[1]) + (GH)->cctk_gsh[1]*(P[2]))) +#define LIN_INDEX3D(extras,P) ((P[0])+ (extras)->nsize[0]*((P[1]) + (extras)->nsize[1]*(P[2]))) #define MIN(a,b) ((a)<(b) ? (a) : (b)) #define MAX(a,b) ((a)>(b) ? (a) : (b)) @@ -49,7 +50,7 @@ int IsPointOnProc_REAL(int dim, int *gownership, CCTK_REAL *pnt) return(retval); } -int GetLocalLine(cGH *GH, +int GetLocalLine(cGH *GH, pGExtras *extras, int vardim, const int *S_l, const int *u_l, int ds, int len_l, int *locstart, int *locend, int *nlocpoints) { @@ -74,6 +75,8 @@ int GetLocalLine(cGH *GH, CCTK_REAL rtmp1; int idim, iface, linsec; + int myproc; + #ifdef LINE_DEBUG @@ -94,16 +97,18 @@ int GetLocalLine(cGH *GH, n_s[0][5],n_s[1][5],n_s[2][5]); #endif + myproc = CCTK_MyProc (GH); + for (idim=0;idim<vardim;idim++) { /* GLOBAL OWNERSHIP: lower/upperbnd are INCLUSIVE */ - gownership[2*idim] = GH->cctk_lbnd[idim]; + gownership[2*idim] = extras->lb[myproc][idim]; if (GH->cctk_bbox[2*idim]==0) - gownership[2*idim] += GH->cctk_nghostzones[idim]; + gownership[2*idim] += extras->nghostzones[idim]; - gownership[2*idim+1]= GH->cctk_ubnd[idim]; + gownership[2*idim+1]= extras->ub[myproc][idim]; if (GH->cctk_bbox[2*idim+1]==0) - gownership[2*idim+1]-= (GH->cctk_nghostzones[idim]); + gownership[2*idim+1]-= (extras->nghostzones[idim]); } @@ -172,7 +177,7 @@ int GetLocalLine(cGH *GH, printf(" ... YES ... valid first\n"); #endif lmd[0] = 0; - linsec = LIN_INDEX3D(GH,S_l); + linsec = LIN_INDEX3D(extras,S_l); } else { @@ -212,14 +217,14 @@ int GetLocalLine(cGH *GH, printf(" valid first \n"); #endif lmd[0] = lmd_s[iface]; - linsec = LIN_INDEX3D(GH,t_pnt1); + linsec = LIN_INDEX3D(extras,t_pnt1); } /* CASE2: we already have intersec. check for duplicates: eg. a diagonal through the n-space, with one exception: make sure that we allow the endpoint to be located on the startpoint if lmd == 0 (which is the case if we start at the last point of a proc) */ - else if (linsec==LIN_INDEX3D(GH,t_pnt1) && lmd_s[iface]>EPS) + else if (linsec==LIN_INDEX3D(extras,t_pnt1) && lmd_s[iface]>EPS) { #ifdef LINE_DEBUG printf(" but duplicate, skip \n"); |