summaryrefslogtreecommitdiff
path: root/src/include/ParameterBindings.h
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2002-05-20 14:19:21 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2002-05-20 14:19:21 +0000
commit7368cca79049430d99e9b9cfb30e814a15462ebd (patch)
treed9ef0a569ec04d1c3db3e0573eb400f3786dd80b /src/include/ParameterBindings.h
parent3f6c7a77eee5addaa3eca660ad0baedc5e04e5f8 (diff)
Added array and accumulator parameters.
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
Diffstat (limited to 'src/include/ParameterBindings.h')
-rw-r--r--src/include/ParameterBindings.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/include/ParameterBindings.h b/src/include/ParameterBindings.h
index 3720d75f..d0a6d10a 100644
--- a/src/include/ParameterBindings.h
+++ b/src/include/ParameterBindings.h
@@ -17,15 +17,17 @@ extern "C" {
#endif
int CCTKi_ParameterCreate(const char *name, /* The parameter name */
- const char *thorn, /* The thorn */
- const char *type, /* The parameter type */
- const char *scope, /* The scoping block */
- int steerable, /* Is it steerable ? */
- const char *description, /* The description */
- const char *defval, /* The default value */
- void *datapointer, /* The actual data */
- int n_ranges, /* How many allowed ranges it has */
- ...);
+ const char *thorn, /* The thorn */
+ const char *type, /* The parameter type */
+ const char *scope, /* The scoping block */
+ int steerable, /* Is it steerable ? */
+ const char *description, /* The description */
+ const char *defval, /* The default value */
+ void *datapointer, /* The actual data */
+ int array, /* Is it an array, if so what size */
+ const char *accumulator, /* Is it an accumultor parameter */
+ int n_ranges, /* How many allowed ranges it has */
+ ...);
int CCTKi_ParameterAddRange(const char *implementation,
const char *name,
@@ -33,6 +35,11 @@ int CCTKi_ParameterAddRange(const char *implementation,
const char *range,
const char *range_description);
+void CCTKi_ParameterAccumulatorBase(const char *thorn,
+ const char *parameter,
+ const char *importhorn,
+ const char *acc_base);
+
#ifdef __cplusplus
}
#endif