Abstract
Thorn SampleIO serves as an example for creating your own
I/O thorns. Its code is clearly structured and well documented, and
implements a very simple and light-weight but fully functioning Cactus
I/O method.
Together with the documentation about I/O methods in the Cactus Users’
Guide and the chapter about thorn IOUtil in the Cactus Thorn Guide
you should be able to use this code and modify/extend it according to
your needs.
Thorn SampleIO registers the I/O method SampleIO with the Cactus flesh I/O interface. This method prints the data values of three-dimensional, distributed Cactus grid functions/arrays at a chosen location to screen.
The implemented I/O method makes use of the Cactus Hyperslabbing API to obtain the data values to print.
Parameters to control the SampleIO I/O method are:
SampleIO::out_vars
This parameter denotes the variables to output as a space-separated
list of full variable and/or group names.
SampleIO::point_x, SampleIO::point_y, SampleIO::point_z
The location of the data point to output for all variables is
given in index coordinates (starting from 0) on a three-dimensional
computational grid.
SampleIO::out_every
This parameter sets the frequency for periodic output. A positive
value means to output every so many iterations. A negative value
chooses the value of the general IO::out_every integer parameter
to be taken. A value of zero disables SampleIO periodic output.
The value for out_every is used for all variables by default. This
can be overwritten for individual variables by appending an option
string to the variable name, like in
SampleIO::out_vars = "MyThorn::MyVar[out_every=2]".
All parameters are steerable, ie. they can be changed at runtime.
The code in thorn SampleIO includes the logic to check whether a parameter
has been changed since the last output, and how to re-evaluate the I/O
parameters.
Like any other I/O thorn should do, SampleIO inherits general I/O parameters from thorn IOUtil. Therefore this I/O helper thorn must be included in the ThornList of a Cactus configuration in order to compile thorn SampleIO, and also activated at runtime in the ActiveThorns parameter in your parameter file.
out_every | Scope: private | INT |
Description: How often to do SampleIO output, overrides IO::out_every
| ||
Range | Default: -1 | |
1:* | Every so many iterations
| |
0: | Disable SampleIO output
| |
-1: | Choose the default from IO::out_every
| |
out_vars | Scope: private | STRING |
Description: Variables to output by SampleIO
| ||
Range | Default: (none) | |
.+ | Space-separated list of fully qualified variable/group names
| |
An empty string to output nothing
| ||
point_x | Scope: private | INT |
Description: x-index (starting from 0) locating the array element to output
| ||
Range | Default: (none) | |
0:* | An index between [0, nx)
| |
point_y | Scope: private | INT |
Description: y-index (starting from 0) locating the array element to output
| ||
Range | Default: (none) | |
0:* | An index between [0, ny)
| |
point_z | Scope: private | INT |
Description: z-index (starting from 0) locating the array element to output
| ||
Range | Default: (none) | |
0:* | An index between [0, nz)
| |
io_out_every | Scope: shared from IO | INT |
strict_io_parameter_check | Scope: shared from IO | BOOLEAN |
verbose | Scope: shared from IO | KEYWORD |
Implements:
sampleio
Inherits:
io
This section lists all the variables which are assigned storage by thorn CactusExamples/SampleIO. Storage can either last for the duration of the run (Always means that if this thorn is activated storage will be assigned, Conditional means that if this thorn is activated storage will be assigned for the duration of the run if some condition is met), or can be turned on for the duration of a schedule function.
NONE
CCTK_STARTUP
sampleio_startup
startup routine
After: | ioutil_startup | |
Language: | c | |
Type: | function | |