Stellarator-Tools
combination Module Reference

Defines the base class of the type combination_class. More...

Data Types

interface  combination_class
 Base class representing a combination signal. More...
 

Functions/Subroutines

type(combination_class) function, pointer combination_construct (n_signals, combination_type, wgt_index)
 Construct a combination_class. More...
 
subroutine combination_destruct (this)
 Deconstruct a combination_class object. More...
 
subroutine combination_set_signal (this, signal, a, index)
 Set the object and coefficient for an index. More...
 
subroutine combination_set_weight (this, a_model)
 Sets the weight factors from from the weight index. More...
 
real(rprec) function, dimension(4) combination_get_modeled_signal (this, a_model, sigma, last_value)
 Calculates the modeled signal. More...
 
character(len=data_name_length) function combination_get_type (this)
 Gets a discription of the combination type. More...
 
subroutine combination_get_header (this, header)
 Gets a discription of the model and model sigma array indices. More...
 
subroutine combination_write_auxiliary (this, iou, index, a_model)
 Write out auxiliary signal information to an output file. More...
 

Variables

integer, parameter combination_type_length = 4
 Maximum length of the combination type descritpion string.
 
integer, parameter combination_none = -1
 Type descriptor for combination type no type.
 
integer, parameter combination_sum = 0
 Type descriptor for combination type sum.
 
integer, parameter combination_max = 1
 Type descriptor for combination type max.
 
integer, parameter combination_min = 2
 Type descriptor for combination type min.
 
integer, parameter combination_wavg = 3
 Type descriptor for combination type weighted average.
 

Detailed Description

Defines the base class of the type combination_class.

combination Super Class: signal

Function/Subroutine Documentation

◆ combination_construct()

type (combination_class) function, pointer combination::combination_construct ( integer, intent(in)  n_signals,
character (len=combination_type_length), intent(in)  combination_type,
integer, intent(in)  wgt_index 
)

Construct a combination_class.

Allocates memory and initializes a combination_class object. This just allocates the combination_class::signals and combination_class::a array. The indices of these arrays are set by combination_set_signal

Parameters
[in]n_signalsNumber of signals in this combination.
[in]combination_typeThe method to combine the signals. Possible values are combination_sum, combination_max, @ ref combination_min and combination_wavg
[in]wgt_indexIndex number of the average weighting.
Returns
A pointer to a constructed combination_class object.

◆ combination_destruct()

subroutine combination::combination_destruct ( type (combination_class), intent(inout)  this)

Deconstruct a combination_class object.

Deallocates memory and uninitializes a combination_class object.

Parameters
[in,out]thisA combination_class instance.
Note
The destructors of the signals in the signal array are not called her because the combination signals do not own the memory for those signals.

◆ combination_get_header()

subroutine combination::combination_get_header ( class (combination_class), intent(in)  this,
character (len=data_name_length), dimension(7), intent(inout)  header 
)

Gets a discription of the model and model sigma array indices.

Returns a description of the array indices for use when writting output files.

Parameters
[in,out]

◆ combination_get_modeled_signal()

real (rprec) function, dimension(4) combination::combination_get_modeled_signal ( class (combination_class), intent(inout)  this,
class (model_class), pointer  a_model,
real (rprec), dimension(4), intent(out)  sigma,
real (rprec), dimension(4), intent(in)  last_value 
)

Calculates the modeled signal.

This method combines the signals pointed in the combination_class::signals array.

Parameters
[in,out]thisA combination_class instance.
[in]a_modelA model instance.
[out]sigmaThe modeled sigma.
[in]last_valueLast good value in case the signal did not change.
Returns
The model value.

◆ combination_get_type()

character (len=data_name_length) function combination::combination_get_type ( class (combination_class), intent(in)  this)

Gets a discription of the combination type.

Returns a description of the combination type for use when writting output files.

Parameters
[in]thisA combination_class instance.
Returns
A string describing the combination type.

◆ combination_set_signal()

subroutine combination::combination_set_signal ( class (combination_class), intent(inout)  this,
class (signal_class), pointer  signal,
real (rprec), intent(in)  a,
integer, intent(in)  index 
)

Set the object and coefficient for an index.

Parameters
[in,out]thisA combination_class instance.
[in]signalA signal_class instance.
[in]aA coefficient for the signal
[in]indexThe index to place the combined signal.
Note
Only signals that were created before this combination can be added. Otherwise there it will creat an infinitely recursive loop in combination_get_modeled_signal

◆ combination_set_weight()

subroutine combination::combination_set_weight ( class (combination_class), intent(inout)  this,
class (model_class), intent(in)  a_model 
)

Sets the weight factors from from the weight index.

Only assumed valid when the combination type is weighted average. This also assumes that the average of only two signals.

Parameters
[in,out]thisA combination_class instance.
[in]a_modelA model instance.

◆ combination_write_auxiliary()

subroutine combination::combination_write_auxiliary ( class (combination_class), intent(in)  this,
integer, intent(in)  iou,
integer, intent(in)  index,
class (model_class), intent(in)  a_model 
)

Write out auxiliary signal information to an output file.

Writes out the s_name and coefficient of the combined signals.

Parameters
[in]thisA signal_class instance.
[in]iouA input/output representing the file to write to.
[in]indexA index of a signal.
[in]a_modelThe equilibrium model.