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
|
/* $Header$ */
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "cctk.h"
#include "cctk_Parameters.h"
#include "Hyperslab.h"
#if 0
int Hyperslab_GetHyperslab (const cGH *GH,
int target_proc,
int vindex,
int vtimelvl,
int hdim,
const int global_startpoint [/*vdim*/],
const int directions [/*vdim*/],
const int lengths [/*hdim*/],
const int downsample_ [/*hdim*/],
void **hdata,
int hsize [/*hdim*/]);
#endif
int Hyperslab_FillHyperslab (const cGH *cctkGH,
int target_proc,
int vindex,
int vtimelevel,
int hdim,
const int global_startpoint [/*vdim*/],
const int directions [/*vdim*/],
const int lengths [/*hdim*/],
const int downsample [/*hdim*/],
int nhdata,
void *hdata,
int hsize [/*hdim*/])
{
void *myhdata;
int mynhdata;
int vtype;
int vtypesize;
int d;
int ierr;
myhdata = 0;
ierr = Hyperslab_GetHyperslab
(cctkGH, target_proc, vindex, vtimelevel, hdim,
global_startpoint, directions, lengths, downsample,
&myhdata, hsize);
if (myhdata) {
mynhdata = 1;
for (d=0; d<hdim; ++d) mynhdata *= hsize[d];
if (mynhdata > nhdata) {
CCTK_WARN (1, "Not enough space in hdata array");
mynhdata = nhdata;
}
assert (hdata);
vtype = CCTK_VarTypeI(vindex);
assert (vtype>=0);
vtypesize = CCTK_VarTypeSize(vtype);
assert (vtypesize>0);
memcpy (hdata, myhdata, mynhdata * vtypesize);
free (myhdata);
}
return ierr;
}
void CCTK_FCALL CCTK_FNAME(Hyperslab_FillHyperslab)
(int *ierr,
const cGH *cctkGH,
const int *target_proc,
const int *vindex,
const int *vtimelevel,
const int *hdim,
const int global_startpoint [/*vdim*/],
const int directions [/*vdim*/],
const int lengths [/*hdim*/],
const int downsample [/*hdim*/],
const int *nhdata,
void *hdata,
int hsize [/*hdim*/])
{
*ierr = Hyperslab_FillHyperslab
(cctkGH, *target_proc, *vindex, *vtimelevel, *hdim,
global_startpoint, directions, lengths, downsample,
*nhdata, hdata, hsize);
}
|