aboutsummaryrefslogtreecommitdiff
path: root/src/Hyperslab.c
diff options
context:
space:
mode:
authortradke <tradke@10716dce-81a3-4424-a2c8-48026a0d3035>2001-12-16 21:43:06 +0000
committertradke <tradke@10716dce-81a3-4424-a2c8-48026a0d3035>2001-12-16 21:43:06 +0000
commiteb2632292604d7f6db805c304c1c3fde72babb86 (patch)
tree51fe457ce25d03ab11adc584b5cb05a367fbed00 /src/Hyperslab.c
parent8d9f7d78e25eeec24403601d5f98b8b66c6601ba (diff)
Removed old hyperslabbing code for diagonals which was working only for
cubic grids. The new code (which is already available via the new hyperslab API) can do diagonals from non-cubic variables also (but still only for non-staggered 3D variables). git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGHSlab/trunk@67 10716dce-81a3-4424-a2c8-48026a0d3035
Diffstat (limited to 'src/Hyperslab.c')
-rw-r--r--src/Hyperslab.c99
1 files changed, 49 insertions, 50 deletions
diff --git a/src/Hyperslab.c b/src/Hyperslab.c
index 9c482e6..dd5f840 100644
--- a/src/Hyperslab.c
+++ b/src/Hyperslab.c
@@ -131,16 +131,6 @@ CCTK_FILEVERSION(CactusPUGH_PUGHSlab_Hyperslab_c)
}
-/*** local function prototypes ***/
-/* Gerd's routine to get 1D lines from a 3D array */
-int Hyperslab_CollectData1D (const cGH *GH, int vindex, int vtimelvl,
- const int *origin,
- const int *directions,
- int downsampling,
- int length,
- void **hdata,
- int *hsize,
- int proc);
/* routine to check parameters passed to the Hyperslab routines */
static const char *checkParameters (const cGH *GH, int vindex, int vtimelvl,
int hdim,
@@ -746,46 +736,6 @@ int Hyperslab_GetHyperslab (const cGH *GH,
#endif
- /* do some plausibility checks */
- errormsg = checkParameters (GH, vindex, vtimelvl, hdim,
- global_origin, directions, extents,
- downsample_, hdata, hsize);
-
- /* FIXME: hack for getting diagonals from 3D variables
- This is calling Gerd's CollectData1D() routine which can
- extract non-axis-parallel lines too but is fixed to 3D data. */
- if (errormsg && ! strcmp (errormsg, "Given normal vector isn't axis-parallel"))
- {
- int length;
-
-
- /* get the info on the variable to extract a hyperslab from */
- CCTK_GroupData (CCTK_GroupIndexFromVarI (vindex), &vinfo);
-
- if (hdim != 1 || vinfo.dim != 3)
- {
- CCTK_WARN (1, "Non-axis-parallel hyperslabs are supported as 1D lines "
- "from 3D variables only");
- return (-1);
- }
-
- length = extents[0];
- if (length > 0)
- {
- length--;
- }
- return (Hyperslab_CollectData1D (GH, vindex, vtimelvl, global_origin,
- directions, downsample_[0], length,
- hdata, hsize, target_proc));
- }
-
- /* immediately return in case of errors */
- if (errormsg)
- {
- CCTK_WARN (1, errormsg);
- return (-1);
- }
-
/* get processor information */
myproc = CCTK_MyProc (GH);
nprocs = CCTK_nProcs (GH);
@@ -812,6 +762,55 @@ int Hyperslab_GetHyperslab (const cGH *GH,
/* get the info on the variable to extract a hyperslab from */
CCTK_GroupData (CCTK_GroupIndexFromVarI (vindex), &vinfo);
+ /* do some plausibility checks */
+ errormsg = checkParameters (GH, vindex, vtimelvl, hdim,
+ global_origin, directions, extents,
+ downsample_, hdata, hsize);
+
+ /* FIXME: hack for getting diagonals from 3D variables */
+ if (errormsg && ! strcmp (errormsg, "Given normal vector isn't axis-parallel"))
+ {
+ int mapping;
+
+
+ if (hdim != 1 || vinfo.dim != 3)
+ {
+ CCTK_WARN (1, "Non-axis-parallel hyperslabs are supported as diagonals "
+ "from non-staggered 3D variables only");
+ return (-1);
+ }
+
+ mapping = Hyperslab_DefineGlobalMappingByIndex (GH, vindex, 1, directions,
+ global_origin, extents,
+ downsample_, -1,
+ target_proc, NULL, hsize);
+ if (mapping < 0)
+ {
+ CCTK_WARN (1, "Failed to define hyperslab mapping for 3D diagonal");
+ return (-1);
+ }
+ if (hsize[0] > 0)
+ {
+ *hdata = malloc (hsize[0] * CCTK_VarTypeSize (vinfo.vartype));
+ retval = Hyperslab_Get (GH, mapping, vindex, 0, vinfo.vartype, *hdata);
+ }
+ else
+ {
+ *hdata = NULL;
+ retval = 0;
+ }
+ Hyperslab_FreeMapping (mapping);
+
+ return (retval);
+ }
+
+ /* immediately return in case of errors */
+ if (errormsg)
+ {
+ CCTK_WARN (1, errormsg);
+ return (-1);
+ }
+
/* set the pointers to pass to Hyperslab_GetLocalHyperslab() */
if (nprocs == 1)
{