AdditiveDerivation Derived Type

type, public, extends(Derivation) :: AdditiveDerivation

Composite derivation class containing a number of calculation rules applied additively. All derivations must return same length array


Components

Type Visibility Attributes Name Initial
logical, public :: userDefined = .false.

True only if user explicitly sets it to true

type(DerivationContainer), private, allocatable, dimension(:) :: derivs

Derivation whose results to be added

type(IntArray), private, allocatable, dimension(:) :: derivIndices

Subset of indices vector passed to each derivation

integer(kind=ik), private :: numAddedDerivations

Counter for keeping track of added derivations

integer(kind=ik), private :: expectedNumIndices

Expected size of indices array - for errorChecking

real(kind=rk), private :: resultPower

Optional power to which the result is raised = default 1

real(kind=rk), private, allocatable, dimension(:) :: linearCoefficients

Additive linear combination coefficients associated with each derivation. Defaults to ones.


Type-Bound Procedures

procedure, public :: isDefined => isDefinedObject

  • interface

    private pure module function isDefinedObject(this) result(defined)

    Getter for userDefined

    Arguments

    Type IntentOptional Attributes Name
    class(Object), intent(in) :: this

    Return Value logical

procedure, public :: makeDefined => makeDefinedObject

  • interface

    private pure module subroutine makeDefinedObject(this)

    Set userDefined to .true.

    Arguments

    Type IntentOptional Attributes Name
    class(Object), intent(inout) :: this

procedure, public :: makeUndefined => makeUndefinedObject

  • interface

    private pure module subroutine makeUndefinedObject(this)

    Set userDefined to .false.

    Arguments

    Type IntentOptional Attributes Name
    class(Object), intent(inout) :: this

procedure, public :: init => initAdditiveDeriv

  • interface

    private module subroutine initAdditiveDeriv(this, numDerivs, expectedNumIndices, resultPower, linearCoefficients)

    Initialize additive derivation object, allocating the expected number of derivation objects

    Arguments

    Type IntentOptional Attributes Name
    class(AdditiveDerivation), intent(inout) :: this
    integer(kind=ik), intent(in) :: numDerivs
    integer(kind=ik), intent(in) :: expectedNumIndices
    real(kind=rk), intent(in), optional :: resultPower
    real(kind=rk), intent(in), optional, dimension(:) :: linearCoefficients

procedure, public :: addDerivation

  • interface

    private module subroutine addDerivation(this, deriv, activeIndices)

    Adds derivation to additive derivation object

    Arguments

    Type IntentOptional Attributes Name
    class(AdditiveDerivation), intent(inout) :: this
    class(Derivation), intent(in) :: deriv
    integer(kind=ik), intent(in), dimension(:) :: activeIndices

    Entries of indices object passed to calculateAdditive to be passed to added derivation

procedure, public :: calculate => calculateAdditive

  • interface

    private module function calculateAdditive(this, inputArray, indices) result(output)

    Arguments

    Type IntentOptional Attributes Name
    class(AdditiveDerivation), intent(inout) :: this
    type(RealArray), intent(in), dimension(:) :: inputArray
    integer(kind=ik), intent(in), dimension(:) :: indices

    Return Value real(kind=rk), allocatable, dimension(:)