summaryrefslogtreecommitdiff
path: root/src/main/Parameters.c
diff options
context:
space:
mode:
authorallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-02-24 14:36:16 +0000
committerallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-02-24 14:36:16 +0000
commitc2dc3939ef60cfeb2ba7c8efc7fc6d06a4151954 (patch)
treecb7cef12945ce1371237c45f552266b5326173c0 /src/main/Parameters.c
parent167e1d2fdbb38cf7976973bff78543d5397836ea (diff)
Reorganising the parameter checking and adding checking levels which
can be set on the command line. Please see the Running Cactus section of the UsersGuide for more information. The only things you should notice are: 1) Cactus will now error and stop if you try and set a parameter foo::bar for an *active* implementation or thorn foo which has no parameter bar (if foo is not active you only get a warning) 2) Cactus will not stop if you steer a parameter out of its allowed range. Making these changes involved delicate tracing of error codes, so please let us know if you notice anything weird. Gabrielle. git-svn-id: http://svn.cactuscode.org/flesh/trunk@2050 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/main/Parameters.c')
-rw-r--r--src/main/Parameters.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/main/Parameters.c b/src/main/Parameters.c
index e465e064..78452bda 100644
--- a/src/main/Parameters.c
+++ b/src/main/Parameters.c
@@ -441,6 +441,9 @@ int CCTKi_ParameterAddRange(const char *implementation,
@returntype int
@returndesc
negative in case of errors
+ -1 = parameter out of range
+ -2 = parameter not found
+ -3 = trying to steer non steerable parameter
@endreturndesc
@@*/
@@ -459,25 +462,31 @@ int CCTK_ParameterSet(const char *name,
/* before parameter recovery (which is while parsing the parameter file)
all parameters can be set */
- /* after parameter recovery only steerable parameters can be set */
if(cctk_parameter_set_mask == PARAMETER_RECOVERY_POST &&
param->props->steerable != CCTK_STEERABLE_ALWAYS)
{
+
+ /* after parameter recovery only steerable parameters can be set */
+
CCTK_VWarn(1, __LINE__, __FILE__, "Cactus",
- "CCTK_ParameterSet: Cannot set parameter '%s::%s' (non-steerable)",
+ "CCTK_ParameterSet: Cannot set parameter '%s::%s' "
+ "(non-steerable)",
thorn, name);
- retval = -2;
+ retval = -3;
+
}
+ else if(cctk_parameter_set_mask == PARAMETER_RECOVERY_IN
+ && param->props->n_set > 0)
+ {
- /* during parameter recovery STEERABLE_NEVER parameters which were set
+ /* during parameter recovery STEERABLE_NEVER parameters which were set
from the parameter file are overwritten by the checkpoint file */
- if(cctk_parameter_set_mask == PARAMETER_RECOVERY_IN &&
- param->props->n_set > 0)
- {
+
if (param->props->steerable == CCTK_STEERABLE_NEVER)
{
CCTK_VWarn(1, __LINE__, __FILE__, "Cactus",
- "CCTK_ParameterSet: Parameter '%s::%s' is non-steerable and will be "
+ "CCTK_ParameterSet: Parameter '%s::%s' "
+ "is non-steerable and will be "
"overwritten by its value from the checkpoint file",
thorn, name);
}
@@ -485,17 +494,11 @@ int CCTK_ParameterSet(const char *name,
{
retval = 1; /* do not restore the original value */
}
- }
- if (retval == 0)
+ }
+ else
{
retval = ParameterSetSimple(param, value);
- if (retval < 0)
- {
- CCTK_VWarn(0,__LINE__,__FILE__,"Cactus",
- "CCTK_ParameterSet: Error setting parameter %s to %s\n",
- name,value);
- }
/* register another set operation */
param->props->n_set++;
@@ -504,7 +507,7 @@ int CCTK_ParameterSet(const char *name,
}
else
{
- retval = -1;
+ retval = -2;
}
return retval;