version 0.6.0
Loading...
Searching...
No Matches

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...
 

Detailed Description

Introduction

Basic initializers

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 INITIALIZERs of the NTS files. There a 3 kinds of initializers:

Example

Consider the initialization of a scalar field (e.g. the temperature) in an NTS file:

initial_condition {
constant 1.0;
shape 2.0 {
circle {center (0.0, 0.0); radius 0.5;}
}
}

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.

Implementation details

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]