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
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "cctk.h"
#include "cctk_Parameters.h"
#include "cctk_Arguments.h"
#include "Hyperslab.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))
#define MAX_DIM 3
int CollectData2D(cGH *GH, int vindex, int vtimelvl, int vdim,
int *S_s, int *u_l1, int *u_l2, int *ds,
int len_l1, int len_l2,
void **dptr, int *dsize)
{
return(0);
}
int CollectLocalData2D(cGH *GH, int vindex, int vtimelvl, int vdim,
int *S_s, int *u_l1, int *u_l2, int *ds,
int len_l1, int len_l2,
void **loc_dptr, int *idx1_dptr, int *idx2_dptr, int *dsize)
{
int tstart[MAX_DIM], end_l1[MAX_DIM], end_l2[MAX_DIM];
int gridpnt[MAX_DIM],tpnt[MAX_DIM];
int l1,l2, lmbd_max, lsh_max;
int ierr;
int locstart2[3],locend2[3],nlocpoints2;
int gindex,vtype,vtypesize;
int idim,lincount, tmp;
void *data = CCTK_VarDataPtrI (GH, vtimelvl, vindex);
int *idx1, *idx2;
CCTK_REAL *real_dptr = (CCTK_REAL *) *loc_dptr;
vtype = CCTK_VarTypeI(vindex);
vtypesize = CCTK_VarTypeSize(vtype);
/* Test for orthogonality */
tmp=0;
for (idim=0;idim<vdim;idim++)
tmp+=u_l1[idim]*u_l2[idim];
if (tmp!=0) printf("Error: not orthogonal\n");
/* Calculate maximal length of one arm */
if (len_l1<0) lmbd_max = 10000;
else lmbd_max = len_l1;
for (idim=0;idim<vdim;idim++)
if (ds[0]!=0)
lmbd_max = MIN(((GH->cctk_gsh[idim]-S_s[idim])/ds[0]),lmbd_max);
/* Get a max. local size,
int gridpnt to zero, so we can loop up to maxdim */
for (idim=0;idim<vdim;idim++)
{
lsh_max = MAX(GH->cctk_lsh[idim], lsh_max);
gridpnt[idim]=0;
}
printf("MAX LAMDA: %d ",lmbd_max);
/* We do not know how many points along the l2 arm, take maximum lsh */
*loc_dptr = malloc(lsh_max*lmbd_max * vtypesize);
idx1 = (int*)malloc(lsh_max*lmbd_max * vtypesize);
idx2 = (int*)malloc(lsh_max*lmbd_max * vtypesize);
idx1_dptr = idx1;
/*$idx2 = idx2_dptr;$*/
for (l1=0;l1<lmbd_max;l1++)
{
for (idim=0;idim<vdim;idim++)
tpnt[idim] = S_s[idim]+l1*u_l1[idim];
GetLocalLine(GH, vdim, tpnt, u_l2, ds[1], len_l2,
locstart2, locend2, &nlocpoints2);
for (l2=0; l2<nlocpoints2; l2++)
{
for (idim=0;idim<vdim;idim++)
gridpnt[idim] = locstart2[idim]+ l2 * u_l2[idim];
/*$real_dptr[lincount] =((CCTK_REAL *) data)
[CCTK_GFINDEX3D(GH,gridpnt[0],gridpnt[1],gridpnt[2])];$*/
idx1_dptr[lincount] = l1;
/*idx2_dptr[lincount] = l2;$*/
lincount++;
}
}
}
|