Next: The schedule.ccl File
Up: Configuring your Thorn
Previous: The interface.ccl File
Contents
The param.ccl File
Users control the operation of thorns via parameters given in a file
at runtime. The param.ccl file
is used to specify the parameters used to control an individual thorn, and
to specify the values these parameters are allowed to take. When the code
is run, it reads a parameter file and sets the parameters if they fall
within the allowed values. If a parameter is not assigned in a parameter
file, it is given its default value.
There are three access levels available for parameters:
- Global
- These parameters are seen by all thorns.
- Restricted
- These parameters may be used by other implementations if they so desire.
- Private
- These are only seen by this thorn.
A parameter specification consists of:
- The parameter type (each may have an optional CCTK_ in front)
- REAL
-
- INT
-
- KEYWORD
- A distinct string with only a few known allowed values.
- STRING
- An arbitrary string, which must conform to a given regular expression.
- BOOLEAN
- A boolean type which can take values 1, t, true, yes or
00, f, false, no.
- The parameter name
- An optional size (in square brackets)-if this is present, the
parameter is a ``parameter array'', i.e. it will actually be an array
of parameters, each of which has the same properties, but a different
value. Such arrays appear as normal arrays in C or Fortran, 0-based
in C, and 1-based in Fortran. In the parameter file the value of
each element is specified with square brackets and is 0-based. The
size must be an integer.
- A description of the parameter
- An allowed value block-this consists of a brace-delimited
block of linespart71describing the allowed values of the parameter. Each range may have a
description associated with it by placing a :: on the line, and putting
the description afterwards.
- The default value-this must be one of the allowed values.
For the numeric types INT and REAL, a range consists
of a string of the
form lower-bound:upper-bound:step, where a missing number or an asterisk
`*' denotes anything (i.e. infinite bounds or an infinitesimal step).
For example,
REAL Coeff "Important coefficient"
{
0:3.14 :: "Range has to be from zero to Pi, default is zero"
} 0.0
#No need to define a range for BOOLEAN
BOOLEAN nice "Nice weather?"
{
}"yes"
# A example for a set of keywords and its default (which has to be
# defined in the body)
KEYWORD confused "Are we getting confused?"
{
"yes" :: "absolutely positively"
"perhaps" :: "we are not sure"
"never" :: "never"
} "never"
REAL Length[2] "Length in each direction"
{
0:* :: "Range has to be from zero to infinity, default is one"
} 1.0
defines a REAL parameter, a BOOLEAN parameter, a KEYWORD,
and an array of REAL parameters.
By default, all parameters are private; to change this, an access
specification of the form global: or restricted: (or
private: to change it back) may be placed on a line by itself. This
changes the access level for any parameter defined in the file from that point on.
To access restricted parameters from another implementation, a line
containing shares: <name> declares that all parameters mentioned in
the file, from now until the next access specification, originate in
implementation <name>. (Note that only one implementation can be
specified on each shares: line.) Each of these parameters must be qualified by the initial token USES or EXTENDS, where
- USES
- indicates that the parameters range remains unchanged.
- EXTENDS
- indicates that the parameters range is going to be extended.
In contrast to parameter declarations in other access blocks, the default
value must be omitted--it is impossible to set the default value of any
parameter not originating in this thorn.
For example, the following block adds possible values to the keyword
initial_data originally defined in the implementation einstein,
and uses the REAL parameter speed.
shares:einstein
EXTENDS KEYWORD initial_data
{
"bl_bh" :: "Brill Lindquist black holes"
"misner_bh" :: "Misner black holes"
"schwarzschild" :: "One Schwarzschild black hole"
}
USES CCTK_REAL speed
Note that you must compile at least one thorn which implements einstein.
Next: The schedule.ccl File
Up: Configuring your Thorn
Previous: The interface.ccl File
Contents
|