Top Description Fields Constructors Methods
org.apache.commons.math3.ode

public Class FieldEquationsMapper<T extends RealFieldElement<T>>

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Type Parameters
<T>
the type of the field elements
Imports
java.io.Serializable, org.apache.commons.math3.RealFieldElement, org.apache.commons.math3.exception.DimensionMismatchException, .MathIllegalArgumentException, org.apache.commons.math3.exception.util.LocalizedFormats, org.apache.commons.math3.util.MathArrays

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
FieldExpandableODE

Field Summary

Modifier and TypeField and Description
private static final long
serialVersionUID

Serializable UID.

private final int[]
start

Start indices of the components.

Constructor Summary

AccessConstructor and Description
pack-priv
FieldEquationsMapper(final FieldEquationsMapper<T>
former mapper, with one equation less (null for first equation)
mapper
,
final int
dimension of the equation state vector
dimension
)

Create a mapper by adding a new equation to another mapper.

Method Summary

Modifier and TypeMethod and Description
private void
checkIndex(final int
index of the equation, must be between 0 included and getNumberOfEquations() (excluded)
index
)

Check equation index.

public T[]

Returns:

equation data
extractEquationData
(final int
index of the equation, must be between 0 included and getNumberOfEquations() (excluded)
index
,
final T[]
complete state or derivative array from which equation data should be retrieved
complete
)

Extract equation data from a complete state or derivative array.

public int

Returns:

number of equations mapped
getNumberOfEquations
()

Get the number of equations mapped.

public int

Returns:

dimension of the complete set of equations
getTotalDimension
()

Return the dimension of the complete set of equations.

public void
insertEquationData(final int
index of the equation, must be between 0 included and getNumberOfEquations() (excluded)
index
,
T[]
equation data to be inserted into the complete array
equationData
,
T[]
placeholder where to put equation data (only the part corresponding to the equation will be overwritten)
complete
)

Insert equation data into a complete state or derivative array.

public T[]

Returns:

flat array containing the mapped state derivative, including primary and secondary components
mapDerivative
(final FieldODEStateAndDerivative<T>
state to map
state
)

Map a state derivative to a complete flat array.

public T[]

Returns:

flat array containing the mapped state, including primary and secondary components
mapState
(final FieldODEState<T>
state to map
state
)

Map a state to a complete flat array.

public FieldODEStateAndDerivative<T>

Returns:

mapped state
mapStateAndDerivative
(final T
time
t
,
final T[]
state array to map, including primary and secondary components
y
,
final T[]
state derivative array to map, including primary and secondary components
yDot
)

Map flat arrays to a state and derivative.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Serializable UID.

startback to summary
private final int[] start

Start indices of the components.

Constructor Detail

FieldEquationsMapperback to summary
pack-priv FieldEquationsMapper(final FieldEquationsMapper<T> mapper, final int dimension)

Create a mapper by adding a new equation to another mapper.

The new equation will have index mapper.getNumberOfEquations(), or 0 if mapper is null.

Parameters
mapper:FieldEquationsMapper<T>

former mapper, with one equation less (null for first equation)

dimension:int

dimension of the equation state vector

Method Detail

checkIndexback to summary
private void checkIndex(final int index) throws MathIllegalArgumentException

Check equation index.

Parameters
index:int

index of the equation, must be between 0 included and getNumberOfEquations() (excluded)

Exceptions
MathIllegalArgumentException:
if index is out of range
extractEquationDataback to summary
public T[] extractEquationData(final int index, final T[] complete) throws MathIllegalArgumentException, DimensionMismatchException

Extract equation data from a complete state or derivative array.

Parameters
index:int

index of the equation, must be between 0 included and getNumberOfEquations() (excluded)

complete:T[]

complete state or derivative array from which equation data should be retrieved

Returns:T[]

equation data

Exceptions
MathIllegalArgumentException:
if index is out of range
DimensionMismatchException:
if complete state has not enough elements
getNumberOfEquationsback to summary
public int getNumberOfEquations()

Get the number of equations mapped.

Returns:int

number of equations mapped

getTotalDimensionback to summary
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:int

dimension of the complete set of equations

insertEquationDataback to summary
public void insertEquationData(final int index, T[] equationData, T[] complete) throws DimensionMismatchException

Insert equation data into a complete state or derivative array.

Parameters
index:int

index of the equation, must be between 0 included and getNumberOfEquations() (excluded)

equationData:T[]

equation data to be inserted into the complete array

complete:T[]

placeholder where to put equation data (only the part corresponding to the equation will be overwritten)

Exceptions
DimensionMismatchException:
if either array has not enough elements
mapDerivativeback to summary
public T[] mapDerivative(final FieldODEStateAndDerivative<T> state)

Map a state derivative to a complete flat array.

Parameters
state:FieldODEStateAndDerivative<T>

state to map

Returns:T[]

flat array containing the mapped state derivative, including primary and secondary components

mapStateback to summary
public T[] mapState(final FieldODEState<T> state)

Map a state to a complete flat array.

Parameters
state:FieldODEState<T>

state to map

Returns:T[]

flat array containing the mapped state, including primary and secondary components

mapStateAndDerivativeback to summary
public FieldODEStateAndDerivative<T> mapStateAndDerivative(final T t, final T[] y, final T[] yDot) throws DimensionMismatchException

Map flat arrays to a state and derivative.

Parameters
t:T

time

y:T[]

state array to map, including primary and secondary components

yDot:T[]

state derivative array to map, including primary and secondary components

Returns:FieldODEStateAndDerivative<T>

mapped state

Exceptions
DimensionMismatchException:
if an array does not match total dimension