From b657c2188633f27d03d55bdc3566f3e16cce4475 Mon Sep 17 00:00:00 2001 From: tradke Date: Wed, 6 Nov 2002 19:29:59 +0000 Subject: Declare the hyperslab routines provided by PUGHSlab as function aliases. That is, all function alias names start with "Hyperslab_*". Previously existing PUGHSlab functions by those names were renamed back into "PUGHSlab_*" and should not be called directly. This affects all thorns using the new hyperslab API: CactusBase/IOASCII, CactusPUGHIO/*, CactusIO/IOJpeg, and CactusExamples/SampleIO. Please also update these thorns now. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHSlab/trunk@92 10716dce-81a3-4424-a2c8-48026a0d3035 --- interface.ccl | 46 +++++++++++++++++++++++++++++++++++++++ src/GetHyperslab.c | 42 +++++++++++++++++------------------ src/Hyperslab.c | 14 ++++++------ src/Mapping.c | 64 +++++++++++++++++++++++++++--------------------------- src/PUGHSlab.h | 38 ++++++++++++++++---------------- 5 files changed, 125 insertions(+), 79 deletions(-) diff --git a/interface.ccl b/interface.ccl index df33ae4..a19bd2e 100644 --- a/interface.ccl +++ b/interface.ccl @@ -4,4 +4,50 @@ implements: Hyperslab inherits: Driver +CCTK_INT FUNCTION Hyperslab_Get const CCTK_POINTER cctkGH, \ + CCTK_INT mapping_handle, \ + CCTK_INT proc, \ + CCTK_INT vindex, \ + CCTK_INT timelevel, \ + CCTK_INT hdatatype, \ + CCTK_POINTER hdata +CCTK_INT FUNCTION Hyperslab_GetList const CCTK_POINTER cctkGH, \ + CCTK_INT mapping_handle, \ + CCTK_INT num_arrays, \ + const CCTK_INT *procs, \ + const CCTK_INT *vindices, \ + const CCTK_INT *timelevels, \ + const CCTK_INT *hdatatypes, \ + CCTK_POINTER const *hdata, \ + CCTK_INT *retvals +CCTK_INT FUNCTION Hyperslab_DefineLocalMappingByIndex const CCTK_POINTER cctkGH, \ + CCTK_INT vindex, \ + CCTK_INT hdim, \ + const CCTK_INT *direction, \ + const CCTK_INT *origin, \ + const CCTK_INT *extent, \ + const CCTK_INT *downsample, \ + CCTK_INT table_handle, \ + CCTK_FPOINTER conversion_fn, \ + CCTK_INT *hsize_local, \ + CCTK_INT *hsize_global, \ + CCTK_INT *hoffset_global +CCTK_INT FUNCTION Hyperslab_DefineGlobalMappingByIndex const CCTK_POINTER cctkGH, \ + CCTK_INT vindex, \ + CCTK_INT hdim, \ + const CCTK_INT *direction, \ + const CCTK_INT *origin, \ + const CCTK_INT *extent, \ + const CCTK_INT *downsample, \ + CCTK_INT table_handle, \ + CCTK_FPOINTER conversion_fn, \ + CCTK_INT *hsize +CCTK_INT FUNCTION Hyperslab_FreeMapping CCTK_INT mapping_handle + +PROVIDES FUNCTION Hyperslab_Get WITH PUGHSlab_Get LANGUAGE C +PROVIDES FUNCTION Hyperslab_GetList WITH PUGHSlab_GetList LANGUAGE C +PROVIDES FUNCTION Hyperslab_DefineGlobalMappingByIndex WITH PUGHSlab_DefineGlobalMappingByIndex LANGUAGE C +PROVIDES FUNCTION Hyperslab_DefineLocalMappingByIndex WITH PUGHSlab_DefineLocalMappingByIndex LANGUAGE C +PROVIDES FUNCTION Hyperslab_FreeMapping WITH PUGHSlab_FreeMapping LANGUAGE C + INCLUDES HEADER: PUGHSlab.h in Hyperslab.h diff --git a/src/GetHyperslab.c b/src/GetHyperslab.c index 5af25b6..2ad33d1 100644 --- a/src/GetHyperslab.c +++ b/src/GetHyperslab.c @@ -57,33 +57,32 @@ static void SortIntoUnchunkedHyperslab (const hslab_mapping_t *mapping, #endif -CCTK_INT Hyperslab_Get (const cGH *GH, - CCTK_INT mapping_handle, - CCTK_INT proc, - CCTK_INT vindex, - CCTK_INT timelevel, - CCTK_INT hdatatype, - void *hdata) +CCTK_INT PUGHSlab_Get (const cGH *GH, + CCTK_INT mapping_handle, + CCTK_INT proc, + CCTK_INT vindex, + CCTK_INT timelevel, + CCTK_INT hdatatype, + void *hdata) { CCTK_INT retval; - retval = Hyperslab_GetList (GH, mapping_handle, 1, &proc, &vindex, - &timelevel, - hdatatype<0?NULL:&hdatatype, &hdata, NULL); + retval = PUGHSlab_GetList (GH, mapping_handle, 1, &proc, &vindex, &timelevel, + hdatatype >= 0 ? &hdatatype : NULL, &hdata, NULL); return (retval == 1 ? 0 : -1); } -CCTK_INT Hyperslab_GetList (const cGH *GH, - CCTK_INT mapping_handle, - CCTK_INT num_arrays, - const CCTK_INT *procs /* num_arrays */, - const CCTK_INT *vindices /* num_arrays */, - const CCTK_INT *timelevels /* num_arrays */, - const CCTK_INT *hdatatypes /* num_arrays */, - void *const *hdata /* num_arrays */, - CCTK_INT *retvals /* num_arrays */) +CCTK_INT PUGHSlab_GetList (const cGH *GH, + CCTK_INT mapping_handle, + CCTK_INT num_arrays, + const CCTK_INT *procs /* num_arrays */, + const CCTK_INT *vindices /* num_arrays */, + const CCTK_INT *timelevels /* num_arrays */, + const CCTK_INT *hdatatypes /* num_arrays */, + void *const *hdata /* num_arrays */, + CCTK_INT *retvals /* num_arrays */) { int i, timelevel, hdatatype, hdata_size, retval; CCTK_INT result, *result_ptr; @@ -243,8 +242,7 @@ CCTK_INT Hyperslab_GetList (const cGH *GH, of a domain-decomposed Cactus array variable. This routine delivers the local hyperslab data - to be collected into a global hyperslab - by Hyperslab_GetHyperslab(). + 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 @@ -360,6 +358,8 @@ static int GetLocalHyperslab (const cGH *GH, t_hslabConversionFn conversion_fn; + vdata = NULL; + /* do some plausibility checks */ errormsg = NULL; if (! GH || ! mapping || (mapping->totals > 0 && ! hdata)) diff --git a/src/Hyperslab.c b/src/Hyperslab.c index 040c9ab..6f37f37 100644 --- a/src/Hyperslab.c +++ b/src/Hyperslab.c @@ -792,10 +792,10 @@ int Hyperslab_GetHyperslab (const cGH *GH, my_extents[0] = extents[0]; my_downsample_[0] = downsample_[0]; - mapping = Hyperslab_DefineGlobalMappingByIndex (GH, vindex, 1,my_directions, - my_global_origin,my_extents, - my_downsample_, -1, - NULL, my_hsize); + mapping = PUGHSlab_DefineGlobalMappingByIndex (GH, vindex, 1,my_directions, + my_global_origin,my_extents, + my_downsample_, -1, + NULL, my_hsize); /* convert result back into int */ hsize[0] = my_hsize[0]; @@ -807,15 +807,15 @@ int Hyperslab_GetHyperslab (const cGH *GH, if (hsize[0] > 0) { *hdata = malloc (hsize[0] * CCTK_VarTypeSize (vinfo.vartype)); - retval = Hyperslab_Get (GH, mapping, dst_proc, vindex, 0, - vinfo.vartype, *hdata); + retval = PUGHSlab_Get (GH, mapping, dst_proc, vindex, 0, + vinfo.vartype, *hdata); } else { *hdata = NULL; retval = 0; } - Hyperslab_FreeMapping (mapping); + PUGHSlab_FreeMapping (mapping); return (retval); } diff --git a/src/Mapping.c b/src/Mapping.c index 00badad..e8d3e9c 100644 --- a/src/Mapping.c +++ b/src/Mapping.c @@ -69,18 +69,18 @@ static int IsFullHyperslab (const pGA *GA, const hslab_mapping_t *mapping); -CCTK_INT Hyperslab_DefineLocalMappingByIndex (const cGH *GH, - CCTK_INT vindex, - CCTK_INT hdim, - const CCTK_INT *direction, - const CCTK_INT *origin, - const CCTK_INT *extent, - const CCTK_INT *downsample, - CCTK_INT table_handle, - t_hslabConversionFn function, - CCTK_INT *hsize_local, - CCTK_INT *hsize_global, - CCTK_INT *hoffset_global) +CCTK_INT PUGHSlab_DefineLocalMappingByIndex (const cGH *GH, + CCTK_INT vindex, + CCTK_INT hdim, + const CCTK_INT *direction, + const CCTK_INT *origin, + const CCTK_INT *extent, + const CCTK_INT *downsample, + CCTK_INT table_handle, + t_hslabConversionFn function, + CCTK_INT *hsize_local, + CCTK_INT *hsize_global, + CCTK_INT *hoffset_global) { CCTK_INT retval; @@ -92,16 +92,16 @@ CCTK_INT Hyperslab_DefineLocalMappingByIndex (const cGH *GH, } -CCTK_INT Hyperslab_DefineGlobalMappingByIndex (const cGH *GH, - CCTK_INT vindex, - CCTK_INT hdim, - const CCTK_INT *direction, - const CCTK_INT *origin, - const CCTK_INT *extent, - const CCTK_INT *downsample, - CCTK_INT table_handle, - t_hslabConversionFn function, - CCTK_INT *hsize) +CCTK_INT PUGHSlab_DefineGlobalMappingByIndex (const cGH *GH, + CCTK_INT vindex, + CCTK_INT hdim, + const CCTK_INT *direction, + const CCTK_INT *origin, + const CCTK_INT *extent, + const CCTK_INT *downsample, + CCTK_INT table_handle, + t_hslabConversionFn function, + CCTK_INT *hsize) { CCTK_INT retval; @@ -148,7 +148,7 @@ static CCTK_INT DefineMapping (const cGH *GH, /* PUGHSlab doesn't use table information */ if (table_handle >= 0) { - CCTK_WARN (1, "Hyperslab_DefineGlobalMappingByIndex: table information is " + CCTK_WARN (1, "PUGHlab_DefineGlobalMappingByIndex: table information is " "ignored"); } @@ -234,7 +234,7 @@ static CCTK_INT DefineMapping (const cGH *GH, if (retval) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Hyperslab_DefineGlobalMappingByIndex: %s", error_msg); + "PUGHlab_DefineGlobalMappingByIndex: %s", error_msg); return (retval); } @@ -270,7 +270,7 @@ static CCTK_INT DefineMapping (const cGH *GH, { free (mapping->do_dir); free (mapping->global_hsize); free (mapping); CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Hyperslab_DefineGlobalMappingByIndex: %d-direction vector " + "PUGHlab_DefineGlobalMappingByIndex: %d-direction vector " "is a null vector", dim); return (-7); } @@ -280,7 +280,7 @@ static CCTK_INT DefineMapping (const cGH *GH, { free (mapping->do_dir); free (mapping->global_hsize); free (mapping); CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Hyperslab_DefineGlobalMappingByIndex: %d-direction vector " + "PUGHlab_DefineGlobalMappingByIndex: %d-direction vector " "isn't axis-orthogonal", dim); return (-7); } @@ -291,7 +291,7 @@ static CCTK_INT DefineMapping (const cGH *GH, { free (mapping->do_dir); free (mapping->global_hsize); free (mapping); CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Hyperslab_DefineGlobalMappingByIndex: diagonals can be " + "PUGHlab_DefineGlobalMappingByIndex: diagonals can be " "extracted from non-staggered 3D variables only"); return (-7); } @@ -309,7 +309,7 @@ static CCTK_INT DefineMapping (const cGH *GH, if (mapping->do_dir[vdim] > 1) { free (mapping->do_dir); free (mapping->global_hsize); free (mapping); - CCTK_WARN (1, "Hyperslab_DefineGlobalMappingByIndex: duplicate direction " + CCTK_WARN (1, "PUGHlab_DefineGlobalMappingByIndex: duplicate direction " "vectors given"); return (-8); } @@ -328,7 +328,7 @@ static CCTK_INT DefineMapping (const cGH *GH, { free (mapping->do_dir); free (mapping->global_hsize); free (mapping); CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Hyperslab_DefineGlobalMappingByIndex: extent in " + "PUGHlab_DefineGlobalMappingByIndex: extent in " "%d-direction exceeds grid size", dim); return (-8); } @@ -339,7 +339,7 @@ static CCTK_INT DefineMapping (const cGH *GH, { free (mapping->do_dir); free (mapping->global_hsize); free (mapping); CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Hyperslab_DefineGlobalMappingByIndex: extent in " + "PUGHlab_DefineGlobalMappingByIndex: extent in " "%d-direction exceeds grid size", vdim); return (-8); } @@ -594,7 +594,7 @@ static CCTK_INT DefineMapping (const cGH *GH, pughGH->PUGH_COMM_WORLD)); /* set the displacements/receive counts for the data gather operation - in the following Hyperslab_Get() call; + in the following PUGHlab_Get() call; also sum up the total number of data points of the global hyperslab */ mapping->totals_global = 0; for (i = 0; i < nprocs; i++) @@ -638,7 +638,7 @@ static CCTK_INT DefineMapping (const cGH *GH, } -CCTK_INT Hyperslab_FreeMapping (CCTK_INT mapping_handle) +CCTK_INT PUGHSlab_FreeMapping (CCTK_INT mapping_handle) { hslab_mapping_t *mapping; diff --git a/src/PUGHSlab.h b/src/PUGHSlab.h index edc582f..b1af99a 100644 --- a/src/PUGHSlab.h +++ b/src/PUGHSlab.h @@ -25,23 +25,23 @@ typedef void (*t_hslabConversionFn) (const void *src, CCTK_INT dst_stride); /* function prototypes */ -CCTK_INT Hyperslab_Get (const cGH *GH, - CCTK_INT mapping_handle, - CCTK_INT proc, - CCTK_INT vindex, - CCTK_INT timelevel, - CCTK_INT hdatatype, - void *hdata); -CCTK_INT Hyperslab_GetList (const cGH *GH, - CCTK_INT mapping_handle, - CCTK_INT num_arrays, - const CCTK_INT *procs, /* num_arrays */ - const CCTK_INT *vindices, /* num_arrays */ - const CCTK_INT *timelevels, /* num_arrays */ - const CCTK_INT *hdatatypes, /* num_arrays */ - void *const *hdata, /* num_arrays */ - CCTK_INT *retvals /* num_arrays */); -CCTK_INT Hyperslab_DefineLocalMappingByIndex ( +CCTK_INT PUGHSlab_Get (const cGH *GH, + CCTK_INT mapping_handle, + CCTK_INT proc, + CCTK_INT vindex, + CCTK_INT timelevel, + CCTK_INT hdatatype, + void *hdata); +CCTK_INT PUGHSlab_GetList (const cGH *GH, + CCTK_INT mapping_handle, + CCTK_INT num_arrays, + const CCTK_INT *procs, /* num_arrays */ + const CCTK_INT *vindices, /* num_arrays */ + const CCTK_INT *timelevels, /* num_arrays */ + const CCTK_INT *hdatatypes, /* num_arrays */ + void *const *hdata, /* num_arrays */ + CCTK_INT *retvals /* num_arrays */); +CCTK_INT PUGHSlab_DefineLocalMappingByIndex ( const cGH *GH, CCTK_INT vindex, CCTK_INT hdim, @@ -55,7 +55,7 @@ CCTK_INT Hyperslab_DefineLocalMappingByIndex ( CCTK_INT *hsize_global, /* hdim */ CCTK_INT *hoffset_global /* hdim */); -CCTK_INT Hyperslab_DefineGlobalMappingByIndex ( +CCTK_INT PUGHSlab_DefineGlobalMappingByIndex ( const cGH *GH, CCTK_INT vindex, CCTK_INT hdim, @@ -66,7 +66,7 @@ CCTK_INT Hyperslab_DefineGlobalMappingByIndex ( CCTK_INT table_handle, t_hslabConversionFn conversion_fn, CCTK_INT *hsize /* hdim */); -CCTK_INT Hyperslab_FreeMapping (CCTK_INT mapping_handle); +CCTK_INT PUGHSlab_FreeMapping (CCTK_INT mapping_handle); int Hyperslab_GetLocalHyperslab (const cGH *GH, -- cgit v1.2.3