aboutsummaryrefslogtreecommitdiff
path: root/Carpet
diff options
context:
space:
mode:
authorschnetter <>2004-04-03 10:40:00 +0000
committerschnetter <>2004-04-03 10:40:00 +0000
commit62817df544536615e5c5a8078ec6726993faf3a1 (patch)
treea0a560281f4f944a39e0e985c53b07e099676acf /Carpet
parent53cd669e1314bf95c588cb1962ea6c65cc7b8223 (diff)
Do not use CCTK_QueryParameterTimesSet to find out whether to use a
Do not use CCTK_QueryParameterTimesSet to find out whether to use a parameter value from this thorn, or from IO. Use special parameter values for that instead, and make these the default. Remove now-unnecessary Get*Parameter functions. darcs-hash:20040403104021-07bb3-88addd2629255577d851436003f854791670ac7a.gz
Diffstat (limited to 'Carpet')
-rw-r--r--Carpet/CarpetIOHDF5/param.ccl27
-rw-r--r--Carpet/CarpetIOHDF5/src/iohdf5.cc13
-rw-r--r--Carpet/CarpetIOHDF5/src/iohdf5.hh6
-rw-r--r--Carpet/CarpetIOHDF5/src/iohdf5utils.cc35
4 files changed, 24 insertions, 57 deletions
diff --git a/Carpet/CarpetIOHDF5/param.ccl b/Carpet/CarpetIOHDF5/param.ccl
index 2c0e5d8e1..9d8aa2480 100644
--- a/Carpet/CarpetIOHDF5/param.ccl
+++ b/Carpet/CarpetIOHDF5/param.ccl
@@ -1,5 +1,5 @@
# Parameter definitions for thorn CarpetIOHDF5
-# $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/param.ccl,v 1.6 2004/03/20 15:43:37 cott Exp $
+# $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/param.ccl,v 1.7 2004/04/03 12:40:21 schnetter Exp $
@@ -34,41 +34,44 @@ BOOLEAN h5verbose "Produce log output" STEERABLE = ALWAYS
-CCTK_STRING out3D_dir "Name of 3D CarpetIOHDF5 output directory, overrides out_dir" STEERABLE = ALWAYS
+CCTK_STRING out3D_dir "Name of 3D CarpetIOHDF5 output directory, overrides IO::out_dir" STEERABLE = ALWAYS
{
- .* :: "A regex which matches everything"
-} "."
+ "^$" :: "Empty: use IO::out_dir"
+ ".+" :: "Not empty: directory name"
+} ""
CCTK_STRING out3D_vars "Variables to output in 3D CarpetIOHDF5 file format" STEERABLE = ALWAYS
{
- .* :: "A regex which matches everything"
+ .* :: "List of group and variable names"
} ""
CCTK_STRING out3D_extension "File extension to use for 3D CarpetIOHDF5 output" STEERABLE = ALWAYS
{
- .* :: "A regex which matches everything"
+ ".*" :: "File extension (including a leading dot, if desired)"
} ".h5"
CCTK_INT out3D_every "How often to do 3D CarpetIOHDF5 output, overrides out_every" STEERABLE = ALWAYS
{
- -1:* :: "Values <= 0 disable 3D output"
-} -1
+ 1:* :: "Output every so many time steps"
+ -1:0 :: "No output"
+ -2 :: "Use IO::out_every"
+} -2
CCTK_STRING in3D_dir "Name of 3D CarpetIOHDF5 input directory" STEERABLE = ALWAYS
{
- .* :: "A regex which matches everything"
-} "."
+ ".*" :: "Directory name"
+} ""
CCTK_STRING in3D_vars "Variables to input in 3D CarpetIOHDF5 file format" STEERABLE = ALWAYS
{
- .* :: "A regex which matches everything"
+ .* :: "List of group and variable names"
} ""
CCTK_STRING in3D_extension "File extension to use for 3D CarpetIOHDF5 input" STEERABLE = ALWAYS
{
- .* :: "A regex which matches everything"
+ ".*" :: "File extension (including a leading dot, if desired)"
} ".h5"
diff --git a/Carpet/CarpetIOHDF5/src/iohdf5.cc b/Carpet/CarpetIOHDF5/src/iohdf5.cc
index 883e40e01..0f851d9d8 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.23 2004/03/26 14:43:55 cott Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/src/iohdf5.cc,v 1.24 2004/04/03 12:40:21 schnetter Exp $";
CCTK_FILEVERSION(Carpet_CarpetIOHDF5_iohdf5_cc);
}
@@ -189,7 +189,7 @@ namespace CarpetIOHDF5 {
assert (iogh);
// Create the output directory
- const char* const myoutdir = GetStringParameter("out3D_dir", out_dir);
+ const char* const myoutdir = out3D_dir;
if (CCTK_MyProc(cctkGH)==0) {
CCTK_CreateDirectory (0755, myoutdir);
}
@@ -534,7 +534,7 @@ namespace CarpetIOHDF5 {
assert (0);
}
- const int myoutevery = GetIntParameter("out3D_every", out_every);
+ const int myoutevery = out3D_every == -2 ? out_every : out3D_every;
if (myoutevery < 0) {
// Nothing should be output at all
@@ -546,7 +546,7 @@ namespace CarpetIOHDF5 {
return 0;
}
- if (! CheckForVariable(cctkGH, GetStringParameter("out3D_vars",""), vindex)) {
+ if (! CheckForVariable(cctkGH, out3D_vars, vindex)) {
// This variable should not be output
return 0;
}
@@ -587,9 +587,10 @@ namespace CarpetIOHDF5 {
int InputGH (const cGH* const cctkGH) {
+ DECLARE_CCTK_PARAMETERS;
int retval = 0;
for (int vindex=0; vindex<CCTK_NumVars(); ++vindex) {
- if (CheckForVariable(cctkGH, GetStringParameter("in3D_vars",""), vindex)) {
+ if (CheckForVariable(cctkGH, in3D_vars, vindex)) {
char* varname = CCTK_FullName(vindex);
retval = InputVarAs (cctkGH, varname, CCTK_VarName(vindex));
free (varname);
@@ -877,7 +878,7 @@ namespace CarpetIOHDF5 {
//cout << "want level " << rl << " reflevel " << reflevel << endl;
// Find the input directory
- const char* myindir = GetStringParameter("in3D_dir", ".");
+ const char* const myindir = in3D_dir;
// Invent a file name
ostringstream filenamebuf;
diff --git a/Carpet/CarpetIOHDF5/src/iohdf5.hh b/Carpet/CarpetIOHDF5/src/iohdf5.hh
index a0a5ca44b..8b2fa6eb0 100644
--- a/Carpet/CarpetIOHDF5/src/iohdf5.hh
+++ b/Carpet/CarpetIOHDF5/src/iohdf5.hh
@@ -1,4 +1,4 @@
-// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/src/iohdf5.hh,v 1.8 2004/03/12 00:13:25 cott Exp $
+// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/src/iohdf5.hh,v 1.9 2004/04/03 12:40:21 schnetter Exp $
#ifndef CARPETIOHDF5_HH
#define CARPETIOHDF5_HH
@@ -157,10 +157,6 @@ namespace CarpetIOHDF5 {
// auxiliary functions defined in iohdf5utils.cc
- const char* GetStringParameter (const char* const parametername,
- const char* const fallback);
- int GetIntParameter (const char* const parametername, int fallback);
-
bool CheckForVariable (const cGH* const cctkGH,
const char* const varlist, const int vindex);
void SetFlag (int index, const char* optstring, void* arg);
diff --git a/Carpet/CarpetIOHDF5/src/iohdf5utils.cc b/Carpet/CarpetIOHDF5/src/iohdf5utils.cc
index 54e2bb1f1..49fecffe1 100644
--- a/Carpet/CarpetIOHDF5/src/iohdf5utils.cc
+++ b/Carpet/CarpetIOHDF5/src/iohdf5utils.cc
@@ -17,7 +17,7 @@
#include "cctk_Parameters.h"
extern "C" {
- static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/src/iohdf5utils.cc,v 1.4 2004/03/11 10:00:16 cott Exp $";
+ static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOHDF5/src/iohdf5utils.cc,v 1.5 2004/04/03 12:40:21 schnetter Exp $";
CCTK_FILEVERSION(Carpet_CarpetIOHDF5_iohdf5utils_cc);
}
@@ -41,39 +41,6 @@ namespace CarpetIOHDF5 {
using namespace std;
using namespace Carpet;
- const char* GetStringParameter (const char* const parametername,
- const char* const fallback)
- {
- if (CCTK_ParameterQueryTimesSet (parametername, CCTK_THORNSTRING) > 0) {
- int ptype;
- const char* const* const ppval = (const char* const*)CCTK_ParameterGet
- (parametername, CCTK_THORNSTRING, &ptype);
- assert (ppval);
- const char* const pval = *ppval;
- assert (ptype == PARAMETER_STRING);
- return pval;
- }
-
- return fallback;
- }
-
-
-
- int GetIntParameter (const char* const parametername, int fallback)
- {
- if (CCTK_ParameterQueryTimesSet (parametername, CCTK_THORNSTRING) > 0) {
- int ptype;
- const int* const ppval = (const int*)CCTK_ParameterGet
- (parametername, CCTK_THORNSTRING, &ptype);
- assert (ppval);
- const int pval = *ppval;
- assert (ptype == PARAMETER_INT);
- return pval;
- }
-
- return fallback;
- }
-
bool CheckForVariable (const cGH* const cctkGH,