diff options
author | tradke <> | 2004-07-07 15:10:00 +0000 |
---|---|---|
committer | tradke <> | 2004-07-07 15:10:00 +0000 |
commit | cc24a0ac9a409f99882db161f34f8af5c23b1dbf (patch) | |
tree | 767777cbc4438efc3697c5037f0c537eb66a7aa4 /Carpet | |
parent | bdc4694140c2af44b2b574c458bf45729b6eb0b7 (diff) |
Filereader routine uses CCTK_TraverseString() to parse the in3D_vars parameter.
darcs-hash:20040707151013-1d9bf-0cdde1cd7be4e7ebafc1eca6c3b9a58acdd2e5a4.gz
Diffstat (limited to 'Carpet')
-rw-r--r-- | Carpet/CarpetIOHDF5/src/iohdf5.cc | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/Carpet/CarpetIOHDF5/src/iohdf5.cc b/Carpet/CarpetIOHDF5/src/iohdf5.cc index 90bc2fa76..9e39363cd 100644 --- a/Carpet/CarpetIOHDF5/src/iohdf5.cc +++ b/Carpet/CarpetIOHDF5/src/iohdf5.cc @@ -17,7 +17,7 @@ #include "cctk_Parameters.h" extern "C" { - static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/src/iohdf5.cc,v 1.38 2004/07/07 11:01:05 tradke Exp $"; + static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/src/iohdf5.cc,v 1.39 2004/07/07 17:10:13 tradke Exp $"; CCTK_FILEVERSION(Carpet_CarpetIOHDF5_iohdf5_cc); } @@ -1102,17 +1102,36 @@ static int InputVarAs (const cGH* const cctkGH, const char* const varname, int CarpetIOHDF5ReadData (const cGH* const cctkGH) { - DECLARE_CCTK_PARAMETERS; int retval = 0; - for (int vindex=0; vindex<CCTK_NumVars(); ++vindex) { - if (CheckForVariable(in3D_vars, vindex)) { - char* varname = CCTK_FullName(vindex); - retval = InputVarAs (cctkGH, varname, CCTK_VarName(vindex)); - free (varname); - if (retval != 0) return retval; + DECLARE_CCTK_PARAMETERS + + + int numvars = CCTK_NumVars (); + vector<bool> flags (numvars); + + if (CCTK_TraverseString (in3D_vars, SetFlag, &flags, CCTK_GROUP_OR_VAR) < 0) + { + CCTK_VWarn (strict_io_parameter_check ? 0 : 1, + __LINE__, __FILE__, CCTK_THORNSTRING, + "error while parsing parameter 'IOHDF5::in3D_vars'"); + } + + for (int vindex = 0; vindex < numvars; vindex++) + { + if (flags.at (vindex)) + { + char *fullname = CCTK_FullName (vindex); + const char *varname = CCTK_VarName (vindex); + retval = InputVarAs (cctkGH, fullname, varname); + free (fullname); + if (retval) + { + break; + } } } - return retval; + + return (retval); } |