diff options
Diffstat (limited to 'src/GetHyperslab.c')
-rw-r--r-- | src/GetHyperslab.c | 86 |
1 files changed, 25 insertions, 61 deletions
diff --git a/src/GetHyperslab.c b/src/GetHyperslab.c index adfd7d3..f0ec33c 100644 --- a/src/GetHyperslab.c +++ b/src/GetHyperslab.c @@ -245,13 +245,18 @@ CCTK_INT PUGHSlab_GetList (const cGH *GH, to be collected into a global hyperslab by PUGHlab_GetHyperslab(). IO methods can call this routine as well to collect the local hyperslab data and output it in parallel. - @enddesc + @enddesc @calls PUGHSlab_GetDatatypeConversionFn @var GH @vdesc Pointer to CCTK grid hierarchy - @vtype cGH * + @vtype const cGH * + @vio in + @endvar + @var mapping + @vdesc pointer to the mapping structure for this hyperslab request + @vtype const hslab_mapping_t * @vio in @endvar @var vindex @@ -264,68 +269,14 @@ CCTK_INT PUGHSlab_GetList (const cGH *GH, @vtype int @vio in @endvar - @var hdim - @vdesc dimensionality of the requested hyperslab - @vtype int - @vio in - @endvar @var hdatatype @vdesc CCTK datatype of the requested hyperslab @vtype int @vio in @endvar - @var conversion_fn - @vdesc pointer to a user-supplied data conversion function - @vtype t_hslabConversionFn - @vio in - @endvar - @var global_startpoint - @vdesc global coordinates of the hyperslab origin - @vtype const int[dimensions of vindex] - @vio in - @endvar - @var directions - @vdesc directions which span the hyperslab - @vtype const int[hdim times dimensions of vindex] - @vio in - @endvar - @var extents - @vdesc number of grid points to follow in each hyperslab direction - starting from origin - Negative values are taken as extents up to the grid boundaries. - @vtype const int[hdim] - @vio in - @endvar - @var downsample - @vdesc downsampling values for each hyperslab dimension - @vtype const int[hdim] - @vio in - @endvar @var hdata - @vdesc pointer to store the address of the hyperslab data buffer - @vtype void ** - @vio out - @endvar - @var free_data - @vdesc address of flag which decides whether the returned data needs - to be freed or not - @vtype int * - @vio out - @endvar - @var hsize - @vdesc sizes of the (local) hyperslab data buffer in each dimension - @vtype int[hdim] - @vio out - @endvar - @var hsize_global - @vdesc sizes of the global hyperslab data buffer in each dimension - @vtype int[hdim] - @vio out - @endvar - @var hoffset_global - @vdesc if not NULL, array to save the offsets of the local hyperslab - into the global one for each dimension - @vtype int[hdim] + @vdesc reference to the user-supplied hyperslab data buffer + @vtype void * @vio out @endvar @@*/ @@ -538,7 +489,11 @@ static int GetLocalHyperslab (const cGH *GH, { if (conversion_fn) { - conversion_fn (typed_vdata, typed_hdata, dim0_points, 1, 1); + if (conversion_fn (dim0_points, 1, 1, vinfo.vartype, hdatatype, + typed_vdata, typed_hdata) != dim0_points) + { + CCTK_WARN (1, "datatype conversion routine failed"); + } } else { @@ -549,7 +504,12 @@ static int GetLocalHyperslab (const cGH *GH, { if (conversion_fn) { - conversion_fn (typed_vdata, typed_hdata, dim0_points, mapping->downsample[0], 1); + if (conversion_fn (dim0_points, mapping->downsample[0], 1, + vinfo.vartype, hdatatype, typed_vdata, + typed_hdata) != dim0_points) + { + CCTK_WARN (1, "datatype conversion routine failed"); + } typed_vdata += downsample[0] * dim0_points; } else @@ -622,7 +582,11 @@ static int GetDiagonalFromFrom3D (const cGH *GH, linear_idx = i + j*extras->hyper_volume[1] + k*extras->hyper_volume[2]; if (conversion_fn) { - conversion_fn (vdata + linear_idx*vdata_size, hdata, 1, 1, 1); + if (conversion_fn (1, 1, 1, vdatatype, hdatatype, + vdata + linear_idx*vdata_size, hdata) != 1) + { + CCTK_WARN (1, "datatype conversion routine failed"); + } } else { |