1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
#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 CollectLocalDataND
@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 *dirsize,int *totsize)
{
int *locstart, *locend, nlocpoints;
int ipnt[MAX_DIM], gridpnt[MAX_DIM];
int vtype,vtypesize;
int idim, idir, lincount;
int ierr;
void *data = CCTK_VarDataPtrI (GH, vtimelvl, vindex);
if (vdim > MAX_DIM)
return (-1);
vtype = CCTK_VarTypeI(vindex);
vtypesize = CCTK_VarTypeSize(vtype);
locstart = (int*)malloc(vdim*sizeof(int));
locend = (int*)malloc(vdim*sizeof(int));
ierr = GetLocalSlab(GH, vdim, sdim,
S_s, linedir, ds, len,
locstart, locend, dirsize, &totsize);
if (ierr<0)
{
CCTK_WARN (1, "GetLocalSlab() failed");
return (ierr);
}
/* Transform from global to local index coordinate */
for(idim=0;idim<vdim;idim++)
{
locstart[idim]-=GH->cctk_lbnd[idim];
locend[idim] -=GH->cctk_lbnd[idim];
}
*loc_dptr= malloc(nlocpoints * vtypesize);
lincount=0;
/* zero out index array so that unused dimensions are 0 */
memset (gridpnt, 0, sizeof (gridpnt));
memset (ipnt , 0, sizeof (ipnt));
/* CCTK_VARIABLE_INT */
if (vtype == CCTK_VARIABLE_REAL)
{
CCTK_INT *int_dptr = (CCTK_REAL *) *loc_dptr;
for (ipnt[0]=0; ipnt[0]<dirsize[0] && (0 < sdim); ipnt[0]++)
for (ipnt[1]=0; ipnt[1]<dirsize[1] && (1 < sdim); ipnt[1]++)
for (ipnt[2]=0; ipnt[2]<dirsize[2] && (2 < sdim); ipnt[2]++)
{
gridpnt[idim] = locstart[idim];
for (idim=0;idim<vdim;idim++)
for (idir = 0; idir < sdim; idir ++)
gridpnt[idim] += ipnt[idir] * u_l[idir][idim];
}
int_dptr[lincount++]=((CCTK_INT *) data)
[CCTK_GFINDEX3D(GH,gridpnt[0],gridpnt[1],gridpnt[2])];
}
}
}
|