Node class for the abstract calculation left child/right sibling tree. Each node has a reference to its leftmost child, its sibling to the immediate right, and to its parent.
Each node has a binary mode that is either additive or multiplicative, with multiplicative being the default. This mode is applied to the results of the nodes children, either multiplying or adding them.
Each node also has a constant (defaulting to 1 in multiplicative and 0 in additive mode), which is applied to the node's result.
An optional unary operation can be associated with each node, which is then applied to the node's result after the constant. The unary operation can be parameterized with real, integer, or logical parameters.
Finally, if a node doesn't have a child (it is a leaf), it must have a nonzero index associated with a passed RealArray(:) list of variables, with the associated values then treated as the missing child's result.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
logical, | public | :: | userDefined | = | .false. |
True only if user explicitly sets it to true |
|
type(CalculationNode), | public, | pointer | :: | leftChild | => | null() | |
type(CalculationNode), | public, | pointer | :: | rightSibling | => | null() | |
type(CalculationNode), | public, | pointer | :: | parent | => | null() | |
type(CalculationKernel), | public | :: | kernel | ||||
procedure(realArrayFunctionGenParam), | public, | pointer, nopass | :: | unaryTransform | => | null() |
Optional unary transformation |
Getter for userDefined
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(Object), | intent(in) | :: | this |
Set userDefined to .true.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(Object), | intent(inout) | :: | this |
Set userDefined to .false.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(Object), | intent(inout) | :: | this |
Initialize a child node of this node with given properties
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(CalculationNode), | intent(inout), | target | :: | this | ||
logical, | intent(in), | optional | :: | additiveMode | ||
real(kind=rk), | intent(in), | optional | :: | constant | ||
integer(kind=ik), | intent(in), | optional | :: | leafVarIndex | ||
real(kind=rk), | intent(in), | optional, | dimension(:) | :: | unaryRealParams | |
integer(kind=ik), | intent(in), | optional, | dimension(:) | :: | unaryIntParams | |
logical, | intent(in), | optional, | dimension(:) | :: | unaryLogicalParams | |
character(len=*), | intent(in), | optional | :: | unaryTransformTag |
Calculation node initialization routine
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(CalculationNode), | intent(inout) | :: | this | |||
logical, | intent(in), | optional | :: | additiveMode | ||
real(kind=rk), | intent(in), | optional | :: | constant | ||
integer(kind=ik), | intent(in), | optional | :: | leafVarIndex | ||
real(kind=rk), | intent(in), | optional, | dimension(:) | :: | unaryRealParams | |
integer(kind=ik), | intent(in), | optional, | dimension(:) | :: | unaryIntParams | |
logical, | intent(in), | optional, | dimension(:) | :: | unaryLogicalParams | |
character(len=*), | intent(in), | optional | :: | unaryTransformTag |
Recursively evaluate nodes, using the inputArray variables for leaf values
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(CalculationNode), | intent(in) | :: | this | |||
type(RealArray), | intent(in), | dimension(:) | :: | inputArray |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(CalculationNode), | intent(inout) | :: | this |