aboutsummaryrefslogtreecommitdiff
path: root/src/ChooseOutput.c
diff options
context:
space:
mode:
authortradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2002-05-06 09:16:28 +0000
committertradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2002-05-06 09:16:28 +0000
commitfe88d9e6f770a9d36acc8ffc02655a5c68fa8b7d (patch)
tree50c97ccae5cd94d5b65209ed2be3dd4cbe1783c7 /src/ChooseOutput.c
parent4121f7f8af4cb1b3232319205129d9cef22e53b1 (diff)
Parameter names changes as announced in today's mail to users@cactuscode.org.
You must also update thorn IOUtil now. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@241 ebee0441-1374-4afa-a3b5-247f3ba15b9a
Diffstat (limited to 'src/ChooseOutput.c')
-rw-r--r--src/ChooseOutput.c64
1 files changed, 25 insertions, 39 deletions
diff --git a/src/ChooseOutput.c b/src/ChooseOutput.c
index 896af8c..aa83e01 100644
--- a/src/ChooseOutput.c
+++ b/src/ChooseOutput.c
@@ -29,32 +29,17 @@ CCTK_FILEVERSION(CactusPUGHIO_IOFlexIO_ChooseOutput_c)
3. Coords from IOFlexIO
4. Coords from IOUtil
*/
-#define GET_SLICE(my_param, IOUtil_param, origin_index, origin_phys) \
+#define GET_SLICE(IOFlexIO_param, IOUtil_param, index, coord) \
{ \
- origin_index = -1; \
- if (CCTK_ParameterQueryTimesSet (#my_param "i", "IOFlexIO") > 0) \
- { \
- origin_index = my_param##i; \
- } \
- else if (CCTK_ParameterQueryTimesSet (#IOUtil_param "i", "IOUtil")>0)\
- { \
- origin_index = IOUtil_param##i; \
- } \
- else if (CCTK_ParameterQueryTimesSet (#my_param, "IOFlexIO") > 0) \
- { \
- origin_phys = my_param; \
- } \
- else \
- { \
- origin_phys = IOUtil_param; \
- } \
+ index = IOFlexIO_param##i >= 0 ? IOFlexIO_param##i : IOUtil_param##i;\
+ coord = IOFlexIO_param != -424242 ? IOFlexIO_param : IOUtil_param; \
}
/********************************************************************
******************** External Routines ************************
********************************************************************/
-void IOFlexIO_Choose2D (cGH *GH);
+void IOFlexIO_Choose2D (const cGH *GH);
/*@@
@@ -64,38 +49,39 @@ void IOFlexIO_Choose2D (cGH *GH);
@desc
Use parameters to choose the 2D planes through the output data.
@enddesc
+
+ @calls IOUtil_2DPlanes
+
+ @var GH
+ @vdesc pointer to CCTK grid hierarchy
+ @vtype const cGH *
+ @vio in
+ @endvar
@@*/
-void IOFlexIO_Choose2D (cGH *GH)
+void IOFlexIO_Choose2D (const cGH *GH)
{
- int i;
+ int i, maxdim;
flexioGH *myGH;
int origin_index[3];
CCTK_REAL origin_phys[3];
DECLARE_CCTK_PARAMETERS
- /* get the handle for IOFlexIO extensions */
+ GET_SLICE (out2D_xyplane_z, out_xyplane_z, origin_index[0], origin_phys[0]);
+ GET_SLICE (out2D_xzplane_y, out_xzplane_y, origin_index[1], origin_phys[1]);
+ GET_SLICE (out2D_yzplane_x, out_yzplane_x, origin_index[2], origin_phys[2]);
+
+ maxdim = CCTK_MaxDim ();
myGH = (flexioGH *) CCTK_GHExtension (GH, "IOFlexIO");
- if (myGH == NULL)
- {
- CCTK_WARN (1, "IOFlexIO_Choose2D: IOFlexIO GH extension not found");
- }
- else
+ myGH->sp2xyz = (int **) malloc (3 * sizeof (int *));
+
+ for (i = 0; i < maxdim; i++)
{
- GET_SLICE (out2D_xyplane_z, out_xyplane_z, origin_index[0], origin_phys[0]);
- GET_SLICE (out2D_xzplane_y, out_xzplane_y, origin_index[1], origin_phys[1]);
- GET_SLICE (out2D_yzplane_x, out_yzplane_x, origin_index[2], origin_phys[2]);
+ myGH->sp2xyz[i] = (int *) calloc (i + 1, sizeof (int));
- for (i = 1; i <= CCTK_MaxDim (); i++)
+ if (i > 0 && i < 3)
{
- if (i > 1 && i <= 3)
- {
- IOUtil_2DPlanes (GH, i, origin_index, origin_phys, myGH->sp2xyz[i-1]);
- }
- else
- {
- memset (myGH->sp2xyz[i-1], 0, i * sizeof (myGH->sp2xyz[i-1][0]));
- }
+ IOUtil_2DPlanes (GH, i + 1, origin_index, origin_phys, myGH->sp2xyz[i]);
}
}
}