Repository: commons-math Updated Branches: refs/heads/field-ode e55d38c43 -> 0820cd68d
Initialize primary and secondary equations at integration start. Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/0820cd68 Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/0820cd68 Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/0820cd68 Branch: refs/heads/field-ode Commit: 0820cd68d3621754de68e4e964dfdc52383b1162 Parents: e55d38c Author: Luc Maisonobe <l...@apache.org> Authored: Sun Nov 15 10:33:11 2015 +0100 Committer: Luc Maisonobe <l...@apache.org> Committed: Sun Nov 15 10:33:11 2015 +0100 ---------------------------------------------------------------------- .../commons/math3/ode/FieldExpandableODE.java | 24 +++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-math/blob/0820cd68/src/main/java/org/apache/commons/math3/ode/FieldExpandableODE.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/math3/ode/FieldExpandableODE.java b/src/main/java/org/apache/commons/math3/ode/FieldExpandableODE.java index 341b1c7..91dc81e 100644 --- a/src/main/java/org/apache/commons/math3/ode/FieldExpandableODE.java +++ b/src/main/java/org/apache/commons/math3/ode/FieldExpandableODE.java @@ -79,7 +79,7 @@ public class FieldExpandableODE<T extends RealFieldElement<T>> { /** Get the mapper for the set of equations. * @return mapper for the set of equations */ - FieldEquationsMapper<T> getMapper() { + public FieldEquationsMapper<T> getMapper() { return mapper; } @@ -98,6 +98,28 @@ public class FieldExpandableODE<T extends RealFieldElement<T>> { } + /** Initialize equations at the start of an ODE integration. + * @param t0 value of the independent <I>time</I> variable at integration start + * @param y0 array containing the value of the state vector at integration start + * @param finalTime target time for the integration + * @exception MaxCountExceededException if the number of functions evaluations is exceeded + * @exception DimensionMismatchException if arrays dimensions do not match equations settings + */ + public void init(final T t0, final T[] y0, final T finalTime) { + + // initialize primary equations + int index = 0; + final T[] primary0 = mapper.extractEquationData(index, y0); + primary.init(t0, primary0, finalTime); + + // initialize secondary equations + while (++index < mapper.getNumberOfEquations()) { + final T[] secondary0 = mapper.extractEquationData(index, y0); + components.get(index - 1).init(t0, primary0, secondary0, finalTime); + } + + } + /** Get the current time derivative of the complete state vector. * @param t current value of the independent <I>time</I> variable * @param y array containing the current value of the complete state vector