Class FieldEquationsMapper<T extends RealFieldElement<T>>
java.lang.Object
org.apache.commons.math3.ode.FieldEquationsMapper<T>
- Type Parameters:
T- the type of the field elements
- All Implemented Interfaces:
Serializable
public class FieldEquationsMapper<T extends RealFieldElement<T>>
extends Object
implements Serializable
Class mapping the part of a complete state or derivative that pertains
to a set of differential equations.
Instances of this class are guaranteed to be immutable.
- Since:
- 3.6
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longSerializable UID.private final int[]Start indices of the components. -
Constructor Summary
ConstructorsConstructorDescriptionFieldEquationsMapper(FieldEquationsMapper<T> mapper, int dimension) Create a mapper by adding a new equation to another mapper. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcheckIndex(int index) Check equation index.T[]extractEquationData(int index, T[] complete) Extract equation data from a complete state or derivative array.intGet the number of equations mapped.intReturn the dimension of the complete set of equations.voidinsertEquationData(int index, T[] equationData, T[] complete) Insert equation data into a complete state or derivative array.T[]mapDerivative(FieldODEStateAndDerivative<T> state) Map a state derivative to a complete flat array.T[]mapState(FieldODEState<T> state) Map a state to a complete flat array.mapStateAndDerivative(T t, T[] y, T[] yDot) Map flat arrays to a state and derivative.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerializable UID.- See Also:
-
start
private final int[] startStart indices of the components.
-
-
Constructor Details
-
FieldEquationsMapper
FieldEquationsMapper(FieldEquationsMapper<T> mapper, int dimension) Create a mapper by adding a new equation to another mapper.The new equation will have index
mapper.getNumberOfEquations(), or 0 ifmapperis null.- Parameters:
mapper- former mapper, with one equation less (null for first equation)dimension- dimension of the equation state vector
-
-
Method Details
-
getNumberOfEquations
public int getNumberOfEquations()Get the number of equations mapped.- Returns:
- number of equations mapped
-
getTotalDimension
public int getTotalDimension()Return the dimension of the complete set of equations.The complete set of equations correspond to the primary set plus all secondary sets.
- Returns:
- dimension of the complete set of equations
-
mapState
Map a state to a complete flat array.- Parameters:
state- state to map- Returns:
- flat array containing the mapped state, including primary and secondary components
-
mapDerivative
Map a state derivative to a complete flat array.- Parameters:
state- state to map- Returns:
- flat array containing the mapped state derivative, including primary and secondary components
-
mapStateAndDerivative
public FieldODEStateAndDerivative<T> mapStateAndDerivative(T t, T[] y, T[] yDot) throws DimensionMismatchException Map flat arrays to a state and derivative.- Parameters:
t- timey- state array to map, including primary and secondary componentsyDot- state derivative array to map, including primary and secondary components- Returns:
- mapped state
- Throws:
DimensionMismatchException- if an array does not match total dimension
-
extractEquationData
public T[] extractEquationData(int index, T[] complete) throws MathIllegalArgumentException, DimensionMismatchException Extract equation data from a complete state or derivative array.- Parameters:
index- index of the equation, must be between 0 included andgetNumberOfEquations()(excluded)complete- complete state or derivative array from which equation data should be retrieved- Returns:
- equation data
- Throws:
MathIllegalArgumentException- if index is out of rangeDimensionMismatchException- if complete state has not enough elements
-
insertEquationData
public void insertEquationData(int index, T[] equationData, T[] complete) throws DimensionMismatchException Insert equation data into a complete state or derivative array.- Parameters:
index- index of the equation, must be between 0 included andgetNumberOfEquations()(excluded)equationData- equation data to be inserted into the complete arraycomplete- placeholder where to put equation data (only the part corresponding to the equation will be overwritten)- Throws:
DimensionMismatchException- if either array has not enough elements
-
checkIndex
Check equation index.- Parameters:
index- index of the equation, must be between 0 included andgetNumberOfEquations()(excluded)- Throws:
MathIllegalArgumentException- if index is out of range
-