aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a>2000-05-11 16:49:08 +0000
committertradke <tradke@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a>2000-05-11 16:49:08 +0000
commitbd297c8d4222b96ec836139fde2704da61386519 (patch)
tree0abc49258601b121e5726155e75297d91eb68ee5
parent7531f928423e6847bfd3b266003607df8f6d69eb (diff)
Slice center setup for 2D output is now done in IOUtil
and shared by IOASCII and IOFlexIO. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOUtil/trunk@72 b32723a9-ab3a-4a60-88e2-2e5d99d7c17a
-rw-r--r--src/GHExtension.c129
-rw-r--r--src/ioGH.h3
2 files changed, 129 insertions, 3 deletions
diff --git a/src/GHExtension.c b/src/GHExtension.c
index 2ef7459..44f075b 100644
--- a/src/GHExtension.c
+++ b/src/GHExtension.c
@@ -20,19 +20,70 @@
#include "ioGH.h"
+/* local function prototypes */
+static void SetupSliceCenter (cGH *GH);
+
+
+ /*@@
+ @routine IOUtil_SetupGH
+ @date Tue May 09 2000
+ @author Thomas Radke
+ @desc
+ Allocates the IOUtil GH extension structure.
+ @enddesc
+ @calledby CCTK scheduler at CCTK_INITIALIZE
+ @var config
+ @vdesc flesh configuration structure (unused)
+ @vtype tFleshConfig *
+ @vio in
+ @endvar
+ @var convergence_level
+ @vdesc convergence level (unused)
+ @vtype int
+ @vio in
+ @endvar
+ @var GH
+ @vdesc pointer to grid hierarchy
+ @vtype cGH *
+ @vio in
+ @endvar
+ @history
+
+ @endhistory
+@@*/
void *IOUtil_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH)
{
- /* nothing else to allocate but the extension */
-
return (malloc (sizeof (ioGH)));
}
-int IOUtil_InitGH(cGH *GH)
+
+ /*@@
+ @routine IOUtil_InitGH
+ @date Tue May 09 2000
+ @author Thomas Radke
+ @desc
+ The GH initialization routine for IOUtil.
+ Necessary output dirs are created.
+ For 2D output the slice center is set up.
+ Checkpoint/recovery timers are created if timing information was requested.
+ @enddesc
+ @calledby CCTK scheduler at CCTK_INITIALIZE
+ @var GH
+ @vdesc pointer to grid hierarchy
+ @vtype cGH *
+ @vio in
+ @endvar
+ @history
+
+ @endhistory
+@@*/
+int IOUtil_InitGH (cGH *GH)
{
DECLARE_CCTK_PARAMETERS
int i;
ioGH *myGH;
+
myGH = (ioGH *) GH->extensions [CCTK_GHExtensionHandle ("IO")];
/* Create the checkpoint directory if it is different to outdir */
@@ -106,6 +157,10 @@ int IOUtil_InitGH(cGH *GH)
/* reset the flags array for the file reader */
myGH->do_inVars = NULL;
+ /* set up 2D planes to plot */
+ myGH->sp2xyz = (int *) calloc (GH->cctk_dim, sizeof (int));
+ SetupSliceCenter (GH);
+
return 0;
}
@@ -245,3 +300,71 @@ void ParseVarsForOutput (const char *var_list, char do_output [])
}
}
+
+
+/****************************************************************************/
+/* local routines */
+/****************************************************************************/
+static void SetupSliceCenter (cGH *GH)
+{
+ DECLARE_CCTK_PARAMETERS
+ int dim;
+ int slice_center;
+ ioGH *myGH;
+
+
+ /* Get the handle for IOUtil extensions */
+ myGH = (ioGH *) GH->extensions [CCTK_GHExtensionHandle ("IO")];
+
+ if ( CCTK_Equals (domain, "octant")
+ || CCTK_Equals (domain, "quadrant")
+ || CCTK_Equals (domain, "bitant"))
+ {
+ slice_center = 0;
+ }
+ else
+ {
+ slice_center = 1;
+ }
+
+ if (slice_center)
+ {
+ /* For NONE octant mode: the center for slicings */
+ /* is moved to the center index */
+ /* (unless nx,ny,nz=1) */
+
+ for (dim = 0; dim < GH->cctk_dim; dim++)
+ {
+ myGH->sp2xyz [dim] = (GH->cctk_lsh [dim] == 1) ?
+ 0 : GH->cctk_lsh [dim]/2 - GH->cctk_lbnd [dim];
+ }
+
+ }
+
+ /* for octant mode, the slicing center is the index 1 or zero*/
+ else
+
+ {
+ for (dim = 0; dim < GH->cctk_dim; dim++)
+ {
+ myGH->sp2xyz [dim] = (GH->cctk_lsh [dim] == 1) ?
+ 0 : 1 - GH->cctk_lbnd [dim];
+ }
+ }
+
+ /* In quadrant mode x and y are like full, but z is like octant */
+ if (CCTK_Equals (domain, "quadrant"))
+ {
+ myGH->sp2xyz [2] = (GH->cctk_lsh [2] == 1) ?
+ 0 : GH->cctk_lsh [2]/2 - GH->cctk_lbnd [2];
+ }
+
+ if (CCTK_Equals (domain, "bitant"))
+ {
+ myGH->sp2xyz [0] = (GH->cctk_lsh [0] == 1) ?
+ 0 : myGH->sp2xyz [0]/2 - GH->cctk_lbnd [0];
+
+ myGH->sp2xyz [1] = (GH->cctk_lsh [1] == 1) ?
+ 0 : GH->cctk_lsh [1]/2 - GH->cctk_lbnd [1];
+ }
+}
diff --git a/src/ioGH.h b/src/ioGH.h
index 6c1325d..f694d5f 100644
--- a/src/ioGH.h
+++ b/src/ioGH.h
@@ -40,6 +40,9 @@ typedef struct IOGH {
char *outpfx_3D;
#endif
+ /* for 2D output */
+ int *sp2xyz; /* slice point for 2D planes */
+
/* for 3D output */
int ioproc; /* the IO processor each proc belongs to */
int nioprocs; /* total number of IO processors */