Define a structure to initialize fields. More...
Topics | |
Scalar initializers | |
Vector initializers | |
Shape initializers | |
Classes | |
interface | type_initializer::scalar_initializer_get_scalar |
Evaluate the initializer at a point to get a scalar value. More... | |
An initializer is a structure that contains a set of instructions to initialize a given field. It is a direct representation in Fortran of the INITIALIZER
s of the NTS files. There a 3 kinds of initializers:
Scalar initializers (SCALAR_INITIALIZER
in NTS files). They contains a set of instructions to initialize scalar fields.
Scalar initializers must inherit an abstract class type_initializer::t_scalar_initializer and they must provide a get_scalar
type-bound procedure. This abstract class is recursive. It contains a pointer to the next scalar initializer.
Vector initializers (VECTOR_INITIALIZER
in NTS files). They contains a set of instructions to initialize vector fields.
Vector initializers must inherit an abstract class type_initializer::t_vector_initializer and they must provide a get_vector
type-bound procedure. This abstract class is recursive. It contains a pointer to the next vector initializer.
Shape initializers (SHAPE_INITIALIZER
in NTS files). They contains a shape to initialize a geometric field.
Shape initializers are of class type_initializer::t_vector_initializer that contains 3 type-bound procedures: is_inside
, get_samples_inside
and get_distance
. As opposed to scalar and vector initializer, this class is not recursive.
Consider the initialization of a scalar field (e.g. the temperature) in an NTS file:
The NTS parser will translate these instructions into the following structure:
┌───────────────────────────────┐ ┌────────────────────────────┐ │ t_scalar_initializer_constant │ │ t_scalar_initializer_shape │ │ → scalar = 1.0 │ │ → scalar = 1.0 │ │ → next ---------------------------→ │ → shape = (circle) │ └───────────────────────────────┘ │ → next (not associated) │ └────────────────────────────┘
The constant 1.0
is translated into an object of class type_initializer::t_scalar_initializer_constant that contains an item scalar
with value equal to 1.0. This object contains a item which corresponds to the next initializer. This initializer is a constant scalar value in a shape. It is described as an object of class type_initializer::t_scalar_initializer_shape.
The scalar and vector initializers are organized as follow. TYPE
denotes either scalar
or vector
.
t_TYPE_initializer ├ t_TYPE_initializer_constant [attributes: TYPE] │ └ t_TYPE_initializer_shape [attributes: TYPE, shape] └ t_TYPE_initializer_instructions [attributes: instruction] └ t_TYPE_initializer_shaped_instructions [attributes: instruction, shape]