From f71e436287062825279823f7845866b7e7150ce7 Mon Sep 17 00:00:00 2001 From: allen Date: Wed, 12 Jul 2000 11:46:07 +0000 Subject: Need this for 1D and 2D slices git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@137 ebee0441-1374-4afa-a3b5-247f3ba15b9a --- src/ChooseOutput.c | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 src/ChooseOutput.c (limited to 'src') diff --git a/src/ChooseOutput.c b/src/ChooseOutput.c new file mode 100644 index 0000000..a1b4955 --- /dev/null +++ b/src/ChooseOutput.c @@ -0,0 +1,144 @@ +/*@@ + @file ChooseOutput.c + @author Gabrielle Allen + @date July 6 2000 + @desc + Choose what data to write for different IO methods in IOHDF5 + @enddesc + + @history + @hauthor + @hdesc + @version $Header$ +@@*/ + +#include "cctk.h" +#include "cctk_Arguments.h" +#include "cctk_Parameters.h" +#include "CactusBase/IOUtil/src/ioGH.h" +#include "ioFlexGH.h" + +static char *rcsid = "$Header$"; +CCTK_FILEVERSION(CactusPUGHIO_IOHDF5_ChooseOutput_c) + + +/*@@ + @routine IOFlexIO_Choose2D + @author Gabrielle Allen + @date July 6 2000 + @desc + Use parameters to choose the 2D planes through the output data. + @enddesc + + @history + @hauthor + @hdesc + @version $Header$ +@@*/ + +void IOFlexIO_Choose2D(CCTK_ARGUMENTS) +{ + DECLARE_CCTK_PARAMETERS + + int i; + int maxdim; + flexioGH *myGH; /* FlexIO extension handle */ + CCTK_INT *origin_index; /* Specify output planes by indices */ + CCTK_REAL *origin_phys; /* Specify output planes by coordinates */ + cGroup groupinfo; /* variable's group info */ + + myGH = (flexioGH *) cctkGH->extensions + [CCTK_GHExtensionHandle ("IOFlexIO")]; + + /* Set up lines to be output */ + maxdim = CCTK_MaxDim(); + origin_phys = (CCTK_REAL *)calloc(maxdim*sizeof(CCTK_REAL )); + origin_index = (CCTK_INT *)calloc(maxdim*sizeof(CCTK_INT )); + + /* Set parameters using + 1. Indices from IOFlexIO + 2. Indices from IOUtil + 3. Coords from IOFlexIO + 4. Coords from IOUtil + */ + + if (CCTK_ParameterQueryTimesSet("out2D_yzplane_xi","IOFlexIO")>0) + { + origin_index[0] = out2D_yzplane_xi; + } + else if (CCTK_ParameterQueryTimesSet("out_yzplane_xi","IOUtil")>0) + { + origin_index[0] = out_yzplane_xi; + } + else + { + origin_index[0] = -1; + if (CCTK_ParameterQueryTimesSet("out2D_yzplane_x","IOFlexIO")>0) + { + origin_phys[0] = out2D_yzplane_x; + } + else + { + origin_phys[0] = out_yzplane_x; + } + } + + if (CCTK_ParameterQueryTimesSet("out2D_xzplane_yi","IOFlexIO")>0) + { + origin_index[1] = out2D_xzplane_yi; + } + else if (CCTK_ParameterQueryTimesSet("out_xzplane_yi","IOUtil")>0) + { + origin_index[1] = out_xzplane_yi; + } + else + { + origin_index[1] = -1; + if (CCTK_ParameterQueryTimesSet("out2D_xzplane_y","IOFlexIO")>0) + { + origin_phys[1] = out2D_xzplane_y; + } + else + { + origin_phys[1] = out_xzplane_y; + } + } + + if (CCTK_ParameterQueryTimesSet("out2D_xyplane_zi","IOFlexIO")>0) + { + origin_index[2] = out2D_xyplane_zi; + } + else if (CCTK_ParameterQueryTimesSet("out_xyplane_zi","IOUtil")>0) + { + origin_index[2] = out_xyplane_zi; + } + else + { + origin_index[2] = -1; + if (CCTK_ParameterQueryTimesSet("out2D_xyplane_z","IOFlexIO")>0) + { + origin_phys[2] = out2D_xyplane_z; + } + else + { + origin_phys[2] = out_xyplane_z; + } + } + + if (myGH) + { + for (i=1;i<=CCTK_MaxDim();i++) + { + IOUtil_2DPlanes (cctkGH, i, origin_index, + origin_phys, myGH->sp2xyz[i-1]); + } + } + else + { + CCTK_WARN(1,"IOFlexIO_Choose2D: FlexIO GH extension not found"); + } + + return; +} + + -- cgit v1.2.3