DualSupport
Module containing functions that manage dual numbers used in Jems.jl.
Jems.DualSupport.StarDiffCache
— Typestruct StarDiffCache{SIZE, TNUMBER}
Definition of StarDiffCache, a cache that makes room to store partial derivatives. Parametric in types SIZE
, the size of the array, and TNUMBER
, the type of the number used for calculations.
Jems.DualSupport.StarDiffCache
— Methodfunction StarDiffCache(nvars::Int, ::Type{TNUMBER}) where {TNUMBER}
Instantiates a StarDiffCache object of size nvars+1
, and fills it with zeros.
Jems.DualSupport.CellDualData
— Typestruct CellDualData{NVARSP1, THREENVARSP1, TNUMBER}
Definition of CellDualData, that holds the information needed to construct partial derivatives wrt its own properties as well as its neighbors. Parametric in types NVARSP1
, the number of independent variables plus one, THREENVARSP1
, three times the number of independe variables plus one, and TNUMBER
, the type of the number used for the calculations (usually floats, but can be duals themselves).
Jems.DualSupport.CellDualData
— Methodfunction CellDualData(nvars::Int, ::Type{TNUMBER}; is_ind_var=false, ind_var_i=0)
Instantiates an object of type CellDualData, that holds the information needed to construct partial derivatives wrt its own properties as well as its neighbors. Use is_ind_var=True
and ind_var_i=i
to instantiate a CellDualData of a base independent variable, with ones assigned in the appropriate spots
Base.convert
— Methodfunction Base.convert(::Type{CellDualData{SIZE1, SIZE2, TN1}}, x::TN2) where {SIZE1, SIZE2, TN1<:Number, TN2<:Number}
Convert x
of type TN2
to a CellDualData object of types SIZE1
, SIZE2
and TN1
.
Base.zero
— Methodfunction Base.zero(::Type{CellDualData{SIZE1,SIZE2,TNUMBER}}) where {SIZE1, SIZE2, TNUMBER}
Instantiates a CellDualData with zero entries (the neutral element for duals).
Jems.DualSupport.update_cell_dual_data!
— Methodfunction update_cell_dual_data!(cd::CellDualData{SIZE1, SIZE2, TNUMBER}, dual::TDSC) where {SIZE1, SIZE2, TNUMBER, TDSC}
Updates all data of the CellDualData object to the data of a given dual number.
Jems.DualSupport.update_cell_dual_data_value!
— Methodfunction update_cell_dual_data_value!(cd::CellDualData, value)
Updates all data of the CellDualData object to the given value.
Jems.DualSupport.FaceDualData
— Typestruct FaceDualData{TWONVARSP1, THREENVARSP1, TNUMBER}
Definition of FaceDualData, that holds the information needed to construct partial derivatives wrt its own properties (the face) as well as its neighbors. Parametric in types TWONVARSP1
, two times the number of independent variables plus one, THREENVARSP1
, three times the number of independe variables plus one, and TNUMBER
, the type of the number used for the calculations (usually floats, but can be duals themselves).
Jems.DualSupport.FaceDualData
— Methodfunction CellDualData(nvars::Int, ::Type{TNUMBER}; is_ind_var=false, ind_var_i=0)
Instantiates an object of type FaceDualData, that holds the information needed to construct partial derivatives wrt its own properties as well as its neighbors.