aboutsummaryrefslogtreecommitdiff
path: root/src/GHExtension.c
diff options
context:
space:
mode:
authorallen <allen@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a>2000-07-12 11:01:47 +0000
committerallen <allen@b32723a9-ab3a-4a60-88e2-2e5d99d7c17a>2000-07-12 11:01:47 +0000
commitb6428deb3783eb5972782fdebee58b936fb70fed (patch)
treec967e54fddbe068f74ccd8338b78c6fe6e410598 /src/GHExtension.c
parent3732d0f6f25e10ca5b5a9d823c92836db99d602f (diff)
New routines for calculating where 1D and 2D slices are located for output
from a 3D grid function. See the documentation (in a couple of days!) for full details, or just check out the parameter options. The main difference from before is that the default is to place the lines/slices at the zero value of the coordinate system. For a full grid this is different, from before, since the lines/slices were placed in the center of the grid. (The big benefit of changing it is not only to make it consistent, but to remove all knowledge of those pesky symmetry options from the IO thorns). git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOUtil/trunk@78 b32723a9-ab3a-4a60-88e2-2e5d99d7c17a
Diffstat (limited to 'src/GHExtension.c')
-rw-r--r--src/GHExtension.c106
1 files changed, 26 insertions, 80 deletions
diff --git a/src/GHExtension.c b/src/GHExtension.c
index 178bc44..b32c5a8 100644
--- a/src/GHExtension.c
+++ b/src/GHExtension.c
@@ -21,8 +21,10 @@
#include "ioGH.h"
+static char *rcsid = "$Header$";
+CCTK_FILEVERSION(CactusBase_IOUtil_GHExtension_c)
+
/* local function prototypes */
-static void SetupSliceCenter (cGH *GH);
/*@@
@@ -158,10 +160,6 @@ 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);
-
/* initialize the file advertising listeners database */
myGH->listener_DB = NULL;
@@ -174,7 +172,7 @@ int IOUtil_InitGH (cGH *GH)
===============================================================*/
/*@@
- @routine ParseVarsForOutput
+ @routine IOUtil_ParseVarsForOutput
@date Sat March 6 1999
@author Gabrielle Allen
@desc
@@ -198,7 +196,7 @@ int IOUtil_InitGH (cGH *GH)
@endvar
@@*/
-void ParseVarsForOutput (const char *var_list, char do_output [])
+void IOUtil_ParseVarsForOutput (const char *var_list, char do_output [])
{
char *before=NULL;
char *after=NULL;
@@ -207,7 +205,9 @@ void ParseVarsForOutput (const char *var_list, char do_output [])
/* First initialise every variable to no output */
for (i=0; i<CCTK_NumVars(); i++)
+ {
do_output[i] = 0;
+ }
splitstring = (char *) var_list;
@@ -220,36 +220,47 @@ void ParseVarsForOutput (const char *var_list, char do_output [])
if (CCTK_Equals(before," ")) continue;
- if (strlen(before) > 0) {
+ if (strlen(before) > 0)
+ {
/* Look for any special tokens */
- if (CCTK_Equals(before,"all")) {
+ if (CCTK_Equals(before,"all"))
+ {
int ilab;
for (ilab=0;ilab<CCTK_NumVars();ilab++)
do_output[ilab]=1;
- } else {
+ }
+ else
+ {
/* See if this name is implementation::variable */
varnum = CCTK_VarIndex(before);
- if ( varnum < 0 ) {
+ if ( varnum < 0 )
+ {
/* See if this name is implementation::group */
groupnum = CCTK_GroupIndex(before);
- if (groupnum < 0) {
+ if (groupnum < 0)
+ {
char *msg;
msg = (char *)malloc((100+strlen(before))*sizeof(char));
- sprintf(msg,"Ignoring %s in IO string (invalid token)",before);
+ sprintf(msg,"Ignoring <%s> in IO string (invalid token)",before);
CCTK_WARN(2,msg);
free(msg);
- } else {
+ }
+ else
+ {
/* We have a group so now need all the variables in the group */
first = CCTK_FirstVarIndexI(groupnum);
last = first+CCTK_NumVarsInGroupI(groupnum)-1;
for (index=first;index<=last;index++)
do_output[index] = 1;
}
- } else
+ }
+ else
+ {
do_output[varnum] = 1;
+ }
}
}
if(before)
@@ -513,68 +524,3 @@ void IOUtil_PrintTimings (const char *description,
}
-/****************************************************************************/
-/* 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_gsh [dim] >> 1;
- }
-
- }
-
- /* 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];
- }
-}