summaryrefslogtreecommitdiff
path: root/src/main/Parameters.c
Commit message (Collapse)AuthorAge
* added Fortran wrapper for CCTK_ParameterSet()tradke2007-03-12
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4412 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Added two new flesh API functions CCTK_ParameterSetNotifyRegister() andtradke2006-09-28
| | | | | | | | | | | | | CCTK_ParameterSetNotifyUnregister() to register/unregister user callback functions for parameter set nofications. See discussion thread http://www.cactuscode.org/old/pipermail/developers/2006-September/005090.html for details. This closes patch Cactus-2057 "add new flesh functions to register/unregister notify callbacks for parameter set operations". git-svn-id: http://svn.cactuscode.org/flesh/trunk@4375 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fix inconsistent interpretation of CCTK_ParameterQueryTimesSet()'s return value.tradke2006-09-28
| | | | | | | | | | | | | | | | | | | | The discussion on http://www.cactuscode.org/pipermail/developers/2006-August/004990.html brought up the issue of an inconsistent interpretation of CCTK_ParameterQueryTimesSet()'s return value which depends on whether this is a normal run, or one that has been recovered from a checkpoint. The provided patch solves the problem of inconsistent behaviour of CCTK_ParameterQueryTimesSet() by fixing the code in CCTK_ParameterSet() which increments the times_set counter. Now the counter is not incremented for recovered parameters which take the same value as before (effectively assuming this to be a no-op). In addition, non-steerable parameters which are set in the parfile but then recovered to the same value from a checkpoint will have their previous set operation unregistered. In a recovered run, CCTK_ParameterQueryTimesSet() will now return a value larger 0 for the union of - all parameters which have been set in the parfile when the checkpoint was created - all steerable parameters which have been set in the recovery parfile This closes PR Cactus-2056: "fix inconsistent interpretation of CCTK_ParameterQueryTimesSet()'s return value". git-svn-id: http://svn.cactuscode.org/flesh/trunk@4374 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fix a bug in CCTK_ParameterSet() .jthorn2006-04-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The symptoms were that if you (a) set the same parameter twice, *and* (b) the second setting is an invalid value, then current-CVS Cactus core-dumps inside the flesh trying to free() a garbage (uninitialized) pointer. For example, the following par file suffices to trigger the core-dump, using only flesh parameters (*no* thorns activated): # this par file causes a core dump in current-CVS Cactus Cactus::cctk_timer_output = "off" Cactus::cctk_timer_output = "foo" # an illegal value for this parameter Looking at the code, 599 /* check if a parameter is set more than once in a parfile */ 600 if (cctk_parameter_set_mask == PARAMETER_RECOVERY_PRE && 601 param->props->n_set > 0) 602 { 603 if (retval == 0) 604 { 605 new_value = CCTK_ParameterValString (param->props->name, 606 param->props->thorn); 607 retval = strcmp (old_value, new_value) ? -10 : -11; 608 } 609 free (new_value); 610 } Notice that the free() at line 609 may be executed even if new_value was *not* assigned a value at line 605. Alas, new_value is a local variable in this function, and is not explicitly initialized, so it has a garbage value initially... and line 605 is its only assignment in this function. The fix is easy -- just move the free() up to right after line 607, so it's executed if and only if new_value has been assigned. patch was http://www.cactuscode.org/old/pipermail/patches/2006-April/000162.html developers discussion was http://www.cactuscode.org/old/pipermail/developers/2006-April/001758.html http://www.cactuscode.org/old/pipermail/developers/2006-April/001759.html git-svn-id: http://svn.cactuscode.org/flesh/trunk@4285 17b73243-c579-4c4c-a9d2-2d5706c11dac
* When recovering parameters from checkpoint, only warn about attempts to settradke2006-02-03
| | | | | | | | | | a non-steerable parameter if its value in the recovery parfile differs from the one in the checkpoint. This avoids unnecessary warnings when recovering with the same parfile (and IO::recovery = "autoprobe" set). git-svn-id: http://svn.cactuscode.org/flesh/trunk@4249 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Apply patch ↵tradke2005-10-24
| | | | | | | | | | | | | | | | | | | | | http://www.cactuscode.org/old/pipermail/patches/2005-October/000112.html: Check if there is more than one assignment to a parameter in the parfile and will print a warning with line number information in such a case. It checks both for multiple parameter assignments of the same or a different value. Depending on the parameter checking level (as set via the command line option '-parameter-level {strict|normal|relaxed}') the flesh will also abort the run after printing the warning in the following two cases: * the parameter level is "normal" (which is the default) or "strict" and there are multiple assignments of different values * the parameter level is "strict" and there are multiple assignments of the same value git-svn-id: http://svn.cactuscode.org/flesh/trunk@4188 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Untabifying.goodale2005-10-03
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@4163 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Print run time warnings while setting parameters with CCTK_WARNschnetter2005-09-26
| | | | | | | | | | | | | | instead of with fprintf (stderr, ...). Correct critical error in looking at the values of cctk_full_warnings, highlight_warning_messages, and cctk_strong_param_check. Handle the empty regular expression specially in CCTK_RegexMatch, since regcomp may treat it as illegal expression. In Cactus, an empty regular expression matches everything. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4150 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Free the parsed parameter expression with Util_ExpressionFree insteadschnetter2005-07-16
| | | | | | | | of free, because the structure contains pointers that also need to be freed. This fixes a memory leak. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4094 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Convert double value to string by using sprintf with the %.20g insteadschnetter2005-07-16
| | | | | | | | | of the %f modifier: %f can easily produce more than 100 characters (the length of the allocated buffer) for large values, and %f outputs by default only 6 digits of precision. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4093 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Add missing #include <stdio.h> statement.schnetter2004-12-30
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3949 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Give error when trying to treat a non-array parameter as an array parameter.goodale2004-05-03
| | | | | | | Fixes PR Cactus/1607. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3684 17b73243-c579-4c4c-a9d2-2d5706c11dac
* add/clarify comments injthorn2004-01-16
| | | | | | | static int ParameterSetReal (t_param *param, const char *value) git-svn-id: http://svn.cactuscode.org/flesh/trunk@3513 17b73243-c579-4c4c-a9d2-2d5706c11dac
* fix a wrong header comment forjthorn2004-01-16
| | | | | | | static int ParameterSetSimple (t_param *param, const char *value) git-svn-id: http://svn.cactuscode.org/flesh/trunk@3512 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Use Util_StrCmpi() instead of STR_CMP().tradke2003-08-22
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@3381 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Free structure returned by Util_ExpressionParse().tradke2003-07-08
| | | | | | | This closes PR Cactus/1559. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3268 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixed compiler warnings about type casts with missing const qualifiers.tradke2003-03-12
| | | | | | | This closes PR Cactus/1439. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3172 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Bug fix for CCTK_ParameterWalk() which caused an infinite loop when calledtradke2003-02-27
| | | | | | | from HTTPD. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3155 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixed CCTK_ParameterWalk() to also walk through array parameters.tradke2003-02-14
| | | | | | | This closes PR CactusPUGHIO/1382. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3144 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixed wrong number of arguments in calls to CCTK_VWarn().tradke2002-05-29
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@2869 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Give error message if tried to set an array parameter without the [number].goodale2002-05-20
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2836 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Improved format of "unable to set parameter" errors.rideout2002-05-20
| | | | | | | Fixes Cactus/1063. git-svn-id: http://svn.cactuscode.org/flesh/trunk@2835 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Some more error checking checking for valid numbers and traceback ofgoodale2002-05-20
| | | | | | | | | errors when setting accumulator parameters. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2834 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Added array and accumulator parameters.goodale2002-05-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Array parameters are specified by a [number] after the parameter name, where number must be an integer. In your parameter file you can specify them with something like foo::bar[9] = 99 (note it is C numbering, starting at 0). In your source code they appear as arrays, bar() in Fortran, starting at 1, and bar[] in C, starting at 0. Accumulator parameters are parameters whose value is built up from the value of other parameters. The other parameters don't need to be known about by the thorn providing the parameter. The syntax is: base parameters are defined like REAL foo "The foo parameter" accumulator=(<expression>) { (1:500 :: "Anything greater than 1 and less than or equal to 500" } 72 and parameters which modify this one's value would be like REAL foobar "The foo parameter" accumulator-base=foo::bar { 22:65 :: "Sensible number" } 42 <expression> is an arbitrary arithmetical expression involving the old value of the parameter,refered to as 'x', and the parameter which is modifying it, refered to as 'y'. E.g. x+y, x+(1/y) x*y, x+y^2, x/y,... The expression should commute when applied twice, i.e. for expression L(x,y), we should have L(L(a,b),c) = L(L(a,c),b) (This allows people to use x/y as an expression which would end up as a/b/c = a/c/b .) To add a value to an accumulator parameter from another implementation, you need to USE or EXTEND that parameter first. As a more complete example, to provide a parameter which is the sum of the squares of other parameters, you can say REAL squares "Sum of squares" accumulator=(x+y^2) { 0: :: "Any non-negative number" } 0 Then, someone in another thorn can add to your squares by saying USES REAL squares REAL mynumber "My number" accumulator-base=foo::squares { 0 : 45 :: "Some numbers" } 3 Then, when these thorns are activated, the value of foo::squares will be 9 (0 + 3^2). Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2830 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Small fix for CCTK_ParameterSet() to increment the number of times atradke2002-05-04
| | | | | | | | | STEERABLE = RECOVER | ALWAYS parameter has been set during recovery. Now you can tell whether such a parameter was just recovered from a checkpoint file (n_set == 1) or also overwritten again from the parameter file (n_set > 1). git-svn-id: http://svn.cactuscode.org/flesh/trunk@2784 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixed a bug when recovering non-steerable parameters.tradke2002-04-12
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@2709 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Increased the number of precision digits for floating-point values returnedtradke2002-03-28
| | | | | | | by CCTK_ParameterValString(). git-svn-id: http://svn.cactuscode.org/flesh/trunk@2681 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Allow the param_type argument to CCTK_ParameterGet() to be passed in astradke2002-03-19
| | | | | | | a NULL pointer if no such information is wanted. git-svn-id: http://svn.cactuscode.org/flesh/trunk@2649 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Set warning level 2 for warnings about out-of-range parameter values.tradke2002-01-02
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@2554 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Changed warning level to 2 for messages saying that a non-steerable parametertradke2001-12-11
| | | | | | | | is not set from a parameter file during recovery. Closes PR/442. git-svn-id: http://svn.cactuscode.org/flesh/trunk@2492 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixing some unprotected mallocs spotted by Ian Hawke.goodale2001-11-07
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2458 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Fixed semantics for the fortran wrappers CCTK_FortranString() and ↵tradke2001-11-06
| | | | | | CCTK_ParameterValString(). git-svn-id: http://svn.cactuscode.org/flesh/trunk@2457 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Added fortran wrapper for CCTK_ParameterValString().tradke2001-11-02
| | | | | | | | | | | | | | | Use it as call CCTK_ParameterValString (ierror, parameter, thorn, value) with parameter, thorn, value being fortran strings, the last one holding the actual stringified value of the parameter. ierror must be of type CCTK_INT and holds the return code of this wrapper where 0 stands for success, -1 for 'parameter doesn't exist', -2 for 'fortran string buffer is too short to hold the value. git-svn-id: http://svn.cactuscode.org/flesh/trunk@2446 17b73243-c579-4c4c-a9d2-2d5706c11dac
* CCTK_ParameterGet() returns a const pointer now.tradke2001-09-20
| | | | | | | Also fixed some gcc warnings and added some grdoc. git-svn-id: http://svn.cactuscode.org/flesh/trunk@2373 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Making rcsid strings constant - PR 669.goodale2001-05-10
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2159 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Reorganising the parameter checking and adding checking levels whichallen2001-02-24
| | | | | | | | | | | | | | | | | | | | | 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
* Fixed logic error which meant only first range in rangelist ever got checked.goodale2000-12-17
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1964 17b73243-c579-4c4c-a9d2-2d5706c11dac
* GRdoc + coding guideline stuff.goodale2000-10-04
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1851 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Removed unused variable.tradke2000-08-02
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@1797 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Tidying warningsallen2000-07-10
| | | | | | | | | | Added CCTK_ParameterQueryTimesSet which can be used to see if a parameter was set in the parameter file, and so can be used to replace some of the parameter "magic numbers" like -424242 git-svn-id: http://svn.cactuscode.org/flesh/trunk@1716 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Changes to ParameterGet so that a wrong range is now a level one warning ↵allen2000-06-19
| | | | | | | | | | | instead of a level 0 warning. Cactus will still terminate when a parameter in a parameter file has an incorrect range, but the check now takes place outside of ParameterGet. This is to be able to change steerable parameters during a run without accidently crashing the code with a bad parameter value. git-svn-id: http://svn.cactuscode.org/flesh/trunk@1680 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Added CCTKi_SetParameterSetMask() to set the time bins for parameter recovery.tradke2000-04-19
| | | | | | | Check the new parameter set mask flag in CCTK_ParameterSet(). git-svn-id: http://svn.cactuscode.org/flesh/trunk@1586 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Removing warnings from rcsid variables.allen2000-04-17
| | | | | | | Tidied include files a bit, removing a few cctk.h's, so I've introduced a few more warnings to fix git-svn-id: http://svn.cactuscode.org/flesh/trunk@1550 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Changed interface for CCTK_ParameterWalk() to return both a canonical nametradke2000-03-14
| | | | | | | | | | | | | | | | | | | | | | | and a pointer the parameter properties. Replaced calls to CCTK_ParameterList() by CCTK_ParameterWalk() in CommandLine.c. CCTK_ParameterList() is gone now. Inserted a line "Parameters of thorn 'BLA' providing implementation 'LABER':" in the -O output. Should be easily filtered out for automatic postprocessing. Option -o now prints out both "thorn::param" and "impl::param" as full names for global/restricted parameters. #ifdef'd out ParameterPTreeNodeAdd() in Parameters.c to fix a compiler warning (unused static function). Thomas git-svn-id: http://svn.cactuscode.org/flesh/trunk@1470 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Getting closer to file-layout standard.goodale2000-03-07
| | | | | | | Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1435 17b73243-c579-4c4c-a9d2-2d5706c11dac
* CCTK_ParameterWalk() allocates memory for its return value and thus shouldtradke2000-02-21
| | | | | | | have a return type of 'char *' instead of 'const char *'. git-svn-id: http://svn.cactuscode.org/flesh/trunk@1399 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Updating GNU files to glibc 2.1.2.goodale2000-02-15
| | | | | | | | | | | | | | | Tidying up how they are included - now people should include cctk_GNU.h. This will allow us later to check what functions are available and maybe not compile the GNU stuff. NOTE: If you edit the GNU stuff please put a wapping great comment /* CCTK: Changed by <> on <> */ by the change and a note in the README. Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@1380 17b73243-c579-4c4c-a9d2-2d5706c11dac
* New function and structure namesallen2000-02-03
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@1352 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Function renamings:tradke2000-02-01
| | | | | | | | ParameterGet -> CCTK_ParameterGet ParameterValString -> CCTK_ParameterValString git-svn-id: http://svn.cactuscode.org/flesh/trunk@1330 17b73243-c579-4c4c-a9d2-2d5706c11dac
* Untabified.goodale2000-01-27
| | | | git-svn-id: http://svn.cactuscode.org/flesh/trunk@1312 17b73243-c579-4c4c-a9d2-2d5706c11dac