aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlanfer <lanfer@10716dce-81a3-4424-a2c8-48026a0d3035>2000-05-12 16:39:31 +0000
committerlanfer <lanfer@10716dce-81a3-4424-a2c8-48026a0d3035>2000-05-12 16:39:31 +0000
commit8c504eca6df72472b90711e4d5ab7e8e6006e783 (patch)
treec5dc98234c95cfc45e1e282e08db8fba1bb0f302 /src
parent8c27e7fcc1f89c17f38812b5f3625df3f67488fe (diff)
first take of generalized extraction of N dim volume out of N dim volume
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHSlab/trunk@17 10716dce-81a3-4424-a2c8-48026a0d3035
Diffstat (limited to 'src')
-rw-r--r--src/CollectDataND.c160
1 files changed, 160 insertions, 0 deletions
diff --git a/src/CollectDataND.c b/src/CollectDataND.c
new file mode 100644
index 0000000..0d98886
--- /dev/null
+++ b/src/CollectDataND.c
@@ -0,0 +1,160 @@
+
+
+#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 MIN(a,b) ((a)<(b) ? (a) : (b))
+#define MAX(a,b) ((a)>(b) ? (a) : (b))
+
+int CollectDataND(cGH *GH, int vindex, int vtimelvl, int vdim, int sdim,
+ int *S_s, int *dir, int *ds, int *len,
+ void **dptr, int *dsize)
+{
+ return(0);
+}
+
+
+ /*@@
+ @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 CollectLocalDataND(cGH *GH, int vindex, int vtimelvl, int vdim, int sdim,
+ int *S_s, int *linedir, int *ds, int *len,
+ void **loc_dptr, int *idx1_dptr, int *idx2_dptr, int *dsize)
+{
+
+
+
+ int tstart[MAX_DIM]; /* temp start points */
+ int tlocstart[MAX_DIM];
+ int tlocend[MAX_DIM];
+
+ int *locstart, *locend; /* local start/end pnt in glob. index coord */
+ int nlocpoints[2], totlocpoints; /* number of loc. points in each dir, tot. pnts */
+
+ hs_vector *u_l;
+
+ int vtype,vtypesize;
+ int idim, idir;
+ int ierr;
+ int phasplane=1;
+
+ void *data = CCTK_VarDataPtrI (GH, vtimelvl, vindex);
+ CCTK_REAL *real_dptr = (CCTK_REAL *) *loc_dptr;
+
+ vtype = CCTK_VarTypeI(vindex);
+ vtypesize = CCTK_VarTypeSize(vtype);
+
+ locstart = (int*)malloc(vdim*sizeof(int));
+ locend = (int*)malloc(vdim*sizeof(int));
+ u_l = (hs_vector*)malloc(sdim*sizeof(hs_vector));
+
+ /* 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 are 000, 000 */
+ u_l[0].vec[idim] = 0;
+ u_l[1].vec[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: (000,000) -> (010,001) */
+ u_l[0][linedir[0]]=1;
+ u_l[1][linedir[1]]=1;
+
+ /* init to 1 (neutral element for multiplication) */
+ totlocpoints=1;
+
+ for (idir=0;idir<2;idir++)
+ {
+
+ 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;
+ }
+ else
+ {
+ phasplane &=0;
+ totlocpoints = 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
+ {
+ 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);
+ }
+}
+
+
+
+
+
+ /*$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]);$*/
+
+