/*@@ @file ChooseOutput.c @author Gabrielle Allen @date July 6 2000 @desc Choose what data to write for different IO methods in IOASCII @enddesc @version $Id$ @@*/ #include #include "cctk.h" #include "cctk_Arguments.h" #include "cctk_Parameters.h" #include "CactusBase/IOUtil/src/ioutil_Utils.h" #include "ioASCIIGH.h" /* the rcs ID and its dummy function to use it */ static char *rcsid = "$Header$"; CCTK_FILEVERSION(CactusBase_IOASCII_ChooseOutput_c) /* prototypes of routines defined in this source file */ void IOASCII_Choose1D (cGH *GH); void IOASCII_Choose2D (cGH *GH); /*@@ @routine IOASCII_Choose1D @author Gabrielle Allen @date July 6 2000 @desc Use parameters to choose the 1D slices through the output data. @enddesc @calls CCTK_ParameterQueryTimesSet IOUtil_1DLines @var GH @vdesc Pointer to CCTK grid hierarchy @vtype cGH * @vio in @endvar @@*/ void IOASCII_Choose1D (cGH *GH) { DECLARE_CCTK_PARAMETERS int i; asciiioGH *myGH; /* IOASCII extension handle */ int *origin_index[3]; /* Specify output lines with indices */ CCTK_REAL *origin_phys[3]; /* Specify output lines with coordinates */ myGH = (asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); /* Set up lines to be output */ origin_phys[0] = (CCTK_REAL *) malloc (3*3 * sizeof (CCTK_REAL)); origin_phys[1] = origin_phys[0] + 3; origin_phys[2] = origin_phys[1] + 3; origin_index[0] = (int *) malloc (3*3 * sizeof (int)); origin_index[1] = origin_index[0] + 3; origin_index[2] = origin_index[1] + 3; /* Set parameters using 1. Indices from IOASCII 2. Indices from IOUtil 3. Coords from IOASCII 4. Coords from IOUtil */ /* x-lines */ if (CCTK_ParameterQueryTimesSet ("out1D_xline_yi", "IOASCII") > 0) { origin_index[0][1] = out1D_xline_yi; } else if (CCTK_ParameterQueryTimesSet ("out_xline_yi", "IOUtil") > 0) { origin_index[0][1] = out_xline_yi; } else { origin_index[0][1] = -1; if (CCTK_ParameterQueryTimesSet ("out1D_xline_y", "IOASCII") > 0) { origin_phys[0][1] = out1D_xline_y; } else { origin_phys[0][1] = out_xline_y; } } if (CCTK_ParameterQueryTimesSet ("out1D_xline_zi", "IOASCII") > 0) { origin_index[0][2] = out1D_xline_zi; } else if (CCTK_ParameterQueryTimesSet ("out_xline_zi", "IOUtil") > 0) { origin_index[0][2] = out_xline_zi; } else { origin_index[0][2] = -1; if (CCTK_ParameterQueryTimesSet ("out1D_xline_z", "IOASCII") > 0) { origin_phys[0][2] = out1D_xline_z; } else { origin_phys[0][2] = out_xline_z; } } /* y-lines */ if (CCTK_ParameterQueryTimesSet ("out1D_yline_xi", "IOASCII") > 0) { origin_index[1][0] = out1D_yline_xi; } else if (CCTK_ParameterQueryTimesSet ("out_yline_xi", "IOUtil") > 0) { origin_index[1][0] = out_yline_xi; } else { origin_index[1][0] = -1; if (CCTK_ParameterQueryTimesSet ("out1D_yline_x", "IOASCII") > 0) { origin_phys[1][0] = out1D_yline_x; } else { origin_phys[1][0] = out_yline_x; } } if (CCTK_ParameterQueryTimesSet ("out1D_yline_zi", "IOASCII") > 0) { origin_index[1][2] = out1D_yline_zi; } else if (CCTK_ParameterQueryTimesSet ("out_yline_zi", "IOUtil") > 0) { origin_index[1][2] = out_yline_zi; } else { origin_index[1][2] = -1; if (CCTK_ParameterQueryTimesSet ("out1D_yline_z", "IOASCII") > 0) { origin_phys[1][2] = out1D_yline_z; } else { origin_phys[1][2] = out_yline_z; } } /* z-lines */ if (CCTK_ParameterQueryTimesSet ("out1D_zline_xi", "IOASCII") > 0) { origin_index[2][0] = out1D_zline_xi; } else if (CCTK_ParameterQueryTimesSet ("out_zline_xi", "IOUtil") > 0) { origin_index[2][0] = out_zline_xi; } else { origin_index[2][0] = -1; if (CCTK_ParameterQueryTimesSet ("out1D_zline_x", "IOASCII") > 0) { origin_phys[2][0] = out1D_zline_x; } else { origin_phys[2][0] = out_zline_x; } } if (CCTK_ParameterQueryTimesSet ("out1D_zline_yi", "IOASCII") > 0) { origin_index[2][1] = out1D_zline_yi; } else if (CCTK_ParameterQueryTimesSet ("out_zline_yi", "IOUtil") > 0) { origin_index[2][1] = out_zline_yi; } else { origin_index[2][1] = -1; if (CCTK_ParameterQueryTimesSet ("out1D_zline_y", "IOASCII") > 0) { origin_phys[2][1] = out1D_zline_y; } else { origin_phys[2][1] = out_zline_y; } } for (i = 1; i <= CCTK_MaxDim(); i++) { IOUtil_1DLines (GH, i, origin_index, origin_phys, myGH->spxyz[i-1]); } free (origin_phys[0]); free (origin_index[0]); } /*@@ @routine IOASCII_Choose2D @author Gabrielle Allen @date July 6 2000 @desc Use parameters to choose the 2D slices through the output data. @enddesc @calls CCTK_ParameterQueryTimesSet IOUtil_2DPlanes @var GH @vdesc Pointer to CCTK grid hierarchy @vtype cGH * @vio in @endvar @@*/ void IOASCII_Choose2D (cGH *GH) { DECLARE_CCTK_PARAMETERS int i; asciiioGH *myGH; /* IOASCII extension handle */ int origin_index[3]; /* Specify output planes by indices */ CCTK_REAL origin_phys[3]; /* Specify output planes by coordinates */ myGH = (asciiioGH *) CCTK_GHExtension (GH, "IOASCII"); /* Set parameters using 1. Indices from IOASCII 2. Indices from IOUtil 3. Coords from IOASCII 4. Coords from IOUtil */ if (CCTK_ParameterQueryTimesSet ("out2D_yzplane_xi", "IOASCII") > 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", "IOASCII") > 0) { origin_phys[0] = out2D_yzplane_x; } else { origin_phys[0] = out_yzplane_x; } } if (CCTK_ParameterQueryTimesSet ("out2D_xzplane_yi", "IOASCII") > 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", "IOASCII") > 0) { origin_phys[1] = out2D_xzplane_y; } else { origin_phys[1] = out_xzplane_y; } } if (CCTK_ParameterQueryTimesSet ("out2D_xyplane_zi", "IOASCII") > 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", "IOASCII") > 0) { origin_phys[2] = out2D_xyplane_z; } else { origin_phys[2] = out_xyplane_z; } } for (i = 1; i <= CCTK_MaxDim(); i++) { IOUtil_2DPlanes (GH, i, origin_index, origin_phys, myGH->sp2xyz[i-1]); } }