From 74c643b89539a86cabec9ba077289bb68fc653ad Mon Sep 17 00:00:00 2001 From: Luc Maisonobe Date: Mon, 28 Dec 2015 13:07:00 +0100 Subject: [PATCH] Renamed interfaces for consistency with other classes. --- .../math3/ode/AbstractFieldIntegrator.java | 2 +- .../commons/math3/ode/FieldExpandableODE.java | 8 ++++---- .../commons/math3/ode/FieldODEState.java | 4 ++-- .../math3/ode/FieldODEStateAndDerivative.java | 4 ++-- .../math3/ode/FieldSecondaryEquations.java | 4 ++-- ...FirstOrderFieldDifferentialEquations.java} | 4 ++-- ...or.java => FirstOrderFieldIntegrator.java} | 4 ++-- .../nonstiff/RungeKuttaFieldIntegrator.java | 4 ++-- .../AbstractFieldStepInterpolator.java | 2 +- .../math3/ode/sampling/FieldStepHandler.java | 2 +- .../ode/sampling/FieldStepInterpolator.java | 2 +- src/site/xdoc/userguide/ode.xml | 4 ++-- .../ode/ContinuousOutputFieldModelTest.java | 14 ++++++------- .../math3/ode/FieldExpandableODETest.java | 20 +++++++++---------- .../math3/ode/TestFieldProblemAbstract.java | 2 +- .../math3/ode/TestFieldProblemHandler.java | 4 ++-- ...EmbeddedRungeKuttaFieldIntegratorTest.java | 20 +++++++++---------- ...AbstractRungeKuttaFieldIntegratorTest.java | 10 +++++----- ...ctRungeKuttaFieldStepInterpolatorTest.java | 10 +++++----- .../math3/ode/nonstiff/StepFieldProblem.java | 4 ++-- .../sampling/StepInterpolatorTestUtils.java | 4 ++-- 21 files changed, 66 insertions(+), 66 deletions(-) rename src/main/java/org/apache/commons/math3/ode/{FieldFirstOrderDifferentialEquations.java => FirstOrderFieldDifferentialEquations.java} (96%) rename src/main/java/org/apache/commons/math3/ode/{FieldFirstOrderIntegrator.java => FirstOrderFieldIntegrator.java} (98%) diff --git a/src/main/java/org/apache/commons/math3/ode/AbstractFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/AbstractFieldIntegrator.java index e848e0f81..d450d1112 100644 --- a/src/main/java/org/apache/commons/math3/ode/AbstractFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/AbstractFieldIntegrator.java @@ -47,7 +47,7 @@ import org.apache.commons.math3.util.IntegerSequence; * @param the type of the field elements * @since 3.6 */ -public abstract class AbstractFieldIntegrator> implements FieldFirstOrderIntegrator { +public abstract class AbstractFieldIntegrator> implements FirstOrderFieldIntegrator { /** Default relative accuracy. */ private static final double DEFAULT_RELATIVE_ACCURACY = 1e-14; 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 3972367aa..79a7cf940 100644 --- a/src/main/java/org/apache/commons/math3/ode/FieldExpandableODE.java +++ b/src/main/java/org/apache/commons/math3/ode/FieldExpandableODE.java @@ -38,11 +38,11 @@ import org.apache.commons.math3.util.MathArrays; *

* We want the integrator to use only the primary set to estimate the * errors and hence the step sizes. It should not use the secondary - * equations in this computation. The {@link FieldFirstOrderIntegrator integrator} will + * equations in this computation. The {@link FirstOrderFieldIntegrator integrator} will * be able to know where the primary set ends and so where the secondary sets begin. *

* - * @see FieldFirstOrderDifferentialEquations + * @see FirstOrderFieldDifferentialEquations * @see FieldSecondaryEquations * * @param the type of the field elements @@ -52,7 +52,7 @@ import org.apache.commons.math3.util.MathArrays; public class FieldExpandableODE> { /** Primary differential equation. */ - private final FieldFirstOrderDifferentialEquations primary; + private final FirstOrderFieldDifferentialEquations primary; /** Components of the expandable ODE. */ private List> components; @@ -63,7 +63,7 @@ public class FieldExpandableODE> { /** Build an expandable set from its primary ODE set. * @param primary the primary set of differential equations to be integrated. */ - public FieldExpandableODE(final FieldFirstOrderDifferentialEquations primary) { + public FieldExpandableODE(final FirstOrderFieldDifferentialEquations primary) { this.primary = primary; this.components = new ArrayList>(); this.mapper = new FieldEquationsMapper(null, primary.getDimension()); diff --git a/src/main/java/org/apache/commons/math3/ode/FieldODEState.java b/src/main/java/org/apache/commons/math3/ode/FieldODEState.java index ab3836ae5..fc42caca0 100644 --- a/src/main/java/org/apache/commons/math3/ode/FieldODEState.java +++ b/src/main/java/org/apache/commons/math3/ode/FieldODEState.java @@ -23,9 +23,9 @@ import org.apache.commons.math3.util.MathArrays; /** Container for time, main and secondary state vectors. - * @see FieldFirstOrderDifferentialEquations + * @see FirstOrderFieldDifferentialEquations * @see FieldSecondaryEquations - * @see FieldFirstOrderIntegrator + * @see FirstOrderFieldIntegrator * @see FieldODEStateAndDerivative * @param the type of the field elements * @since 3.6 diff --git a/src/main/java/org/apache/commons/math3/ode/FieldODEStateAndDerivative.java b/src/main/java/org/apache/commons/math3/ode/FieldODEStateAndDerivative.java index e47518540..d2d3f5bc4 100644 --- a/src/main/java/org/apache/commons/math3/ode/FieldODEStateAndDerivative.java +++ b/src/main/java/org/apache/commons/math3/ode/FieldODEStateAndDerivative.java @@ -21,9 +21,9 @@ import org.apache.commons.math3.RealFieldElement; /** Container for time, main and secondary state vectors as well as their derivatives. - * @see FieldFirstOrderDifferentialEquations + * @see FirstOrderFieldDifferentialEquations * @see FieldSecondaryEquations - * @see FieldFirstOrderIntegrator + * @see FirstOrderFieldIntegrator * @param the type of the field elements * @since 3.6 */ diff --git a/src/main/java/org/apache/commons/math3/ode/FieldSecondaryEquations.java b/src/main/java/org/apache/commons/math3/ode/FieldSecondaryEquations.java index 32e0abee1..8cba080c9 100644 --- a/src/main/java/org/apache/commons/math3/ode/FieldSecondaryEquations.java +++ b/src/main/java/org/apache/commons/math3/ode/FieldSecondaryEquations.java @@ -31,11 +31,11 @@ import org.apache.commons.math3.exception.MaxCountExceededException; *

*

* This interface allows users to add such equations to a primary set of {@link - * FieldFirstOrderDifferentialEquations first order differential equations} + * FirstOrderFieldDifferentialEquations first order differential equations} * thanks to the {@link FieldExpandableODE#addSecondaryEquations(FieldSecondaryEquations)} * method. *

- * @see FieldFirstOrderDifferentialEquations + * @see FirstOrderFieldDifferentialEquations * @see FieldExpandableODE * @param the type of the field elements * @since 3.6 diff --git a/src/main/java/org/apache/commons/math3/ode/FieldFirstOrderDifferentialEquations.java b/src/main/java/org/apache/commons/math3/ode/FirstOrderFieldDifferentialEquations.java similarity index 96% rename from src/main/java/org/apache/commons/math3/ode/FieldFirstOrderDifferentialEquations.java rename to src/main/java/org/apache/commons/math3/ode/FirstOrderFieldDifferentialEquations.java index 887451b19..80706f749 100644 --- a/src/main/java/org/apache/commons/math3/ode/FieldFirstOrderDifferentialEquations.java +++ b/src/main/java/org/apache/commons/math3/ode/FirstOrderFieldDifferentialEquations.java @@ -38,13 +38,13 @@ import org.apache.commons.math3.RealFieldElement; * of this interface, the classes that implement it are allowed to * handle them as they want.

* - * @see FieldFirstOrderIntegrator + * @see FirstOrderFieldIntegrator * * @param the type of the field elements * @since 3.6 */ -public interface FieldFirstOrderDifferentialEquations> { +public interface FirstOrderFieldDifferentialEquations> { /** Get the dimension of the problem. * @return dimension of the problem diff --git a/src/main/java/org/apache/commons/math3/ode/FieldFirstOrderIntegrator.java b/src/main/java/org/apache/commons/math3/ode/FirstOrderFieldIntegrator.java similarity index 98% rename from src/main/java/org/apache/commons/math3/ode/FieldFirstOrderIntegrator.java rename to src/main/java/org/apache/commons/math3/ode/FirstOrderFieldIntegrator.java index ae6d8c077..f3c73d8d7 100644 --- a/src/main/java/org/apache/commons/math3/ode/FieldFirstOrderIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/FirstOrderFieldIntegrator.java @@ -35,12 +35,12 @@ import org.apache.commons.math3.ode.sampling.FieldStepHandler; * be handled should implement the {@link * FirstOrderDifferentialEquations} interface.

* - * @see FieldFirstOrderDifferentialEquations + * @see FirstOrderFieldDifferentialEquations * @param the type of the field elements * @since 3.6 */ -public interface FieldFirstOrderIntegrator> { +public interface FirstOrderFieldIntegrator> { /** Get the name of the method. * @return name of the method diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegrator.java index c69648059..cabb9a045 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/RungeKuttaFieldIntegrator.java @@ -27,7 +27,7 @@ import org.apache.commons.math3.exception.NumberIsTooSmallException; import org.apache.commons.math3.ode.AbstractFieldIntegrator; import org.apache.commons.math3.ode.FieldEquationsMapper; import org.apache.commons.math3.ode.FieldExpandableODE; -import org.apache.commons.math3.ode.FieldFirstOrderDifferentialEquations; +import org.apache.commons.math3.ode.FirstOrderFieldDifferentialEquations; import org.apache.commons.math3.ode.FieldODEState; import org.apache.commons.math3.ode.FieldODEStateAndDerivative; import org.apache.commons.math3.util.MathArrays; @@ -230,7 +230,7 @@ public abstract class RungeKuttaFieldIntegrator> * (can be set to a value smaller than {@code t0} for backward integration) * @return state vector at {@code t} */ - public T[] singleStep(final FieldFirstOrderDifferentialEquations equations, + public T[] singleStep(final FirstOrderFieldDifferentialEquations equations, final T t0, final T[] y0, final T t) { // create some internal working arrays diff --git a/src/main/java/org/apache/commons/math3/ode/sampling/AbstractFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/sampling/AbstractFieldStepInterpolator.java index 370030e8d..e67475288 100644 --- a/src/main/java/org/apache/commons/math3/ode/sampling/AbstractFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math3/ode/sampling/AbstractFieldStepInterpolator.java @@ -30,7 +30,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative; * retrieve the state vector at intermediate times between the * previous and the current grid points (dense output).

* - * @see org.apache.commons.math3.ode.FieldFirstOrderIntegrator + * @see org.apache.commons.math3.ode.FirstOrderFieldIntegrator * @see StepHandler * * @param the type of the field elements diff --git a/src/main/java/org/apache/commons/math3/ode/sampling/FieldStepHandler.java b/src/main/java/org/apache/commons/math3/ode/sampling/FieldStepHandler.java index f46cc065c..c56911bbf 100644 --- a/src/main/java/org/apache/commons/math3/ode/sampling/FieldStepHandler.java +++ b/src/main/java/org/apache/commons/math3/ode/sampling/FieldStepHandler.java @@ -34,7 +34,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative; * last one, store the points in an ephemeris, or forward them to * specialized processing or output methods.

* - * @see org.apache.commons.math3.ode.FieldFirstOrderIntegrator + * @see org.apache.commons.math3.ode.FirstOrderFieldIntegrator * @see FieldStepInterpolator * @param the type of the field elements * @since 3.6 diff --git a/src/main/java/org/apache/commons/math3/ode/sampling/FieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/sampling/FieldStepInterpolator.java index 18eba4510..a005fb152 100644 --- a/src/main/java/org/apache/commons/math3/ode/sampling/FieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math3/ode/sampling/FieldStepInterpolator.java @@ -31,7 +31,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative; * (this feature is often called dense output).

* * @param the type of the field elements - * @see org.apache.commons.math3.ode.FieldFirstOrderIntegrator + * @see org.apache.commons.math3.ode.FirstOrderFieldIntegrator * @see FieldStepHandler * @since 3.6 */ diff --git a/src/site/xdoc/userguide/ode.xml b/src/site/xdoc/userguide/ode.xml index bd2bf8eb5..4a6a3b267 100644 --- a/src/site/xdoc/userguide/ode.xml +++ b/src/site/xdoc/userguide/ode.xml @@ -85,10 +85,10 @@

The user should describe his problem in his own classes which should implement the FirstOrderDifferentialEquations - interface (or FieldFirstOrderDifferentialEquations + interface (or FirstOrderFieldDifferentialEquations interface). Then he should pass it to the integrator he prefers among all the classes that implement the FirstOrderIntegrator - interface (or the FieldFirstOrderIntegrator + interface (or the FirstOrderFieldIntegrator interface). The following example shows how to implement the simple two-dimensional problem using double primitives:

  • y'0(t) = ω × (c1 - y1(t))
  • diff --git a/src/test/java/org/apache/commons/math3/ode/ContinuousOutputFieldModelTest.java b/src/test/java/org/apache/commons/math3/ode/ContinuousOutputFieldModelTest.java index 690959e08..3ab9736d6 100644 --- a/src/test/java/org/apache/commons/math3/ode/ContinuousOutputFieldModelTest.java +++ b/src/test/java/org/apache/commons/math3/ode/ContinuousOutputFieldModelTest.java @@ -43,7 +43,7 @@ public class ContinuousOutputFieldModelTest { TestFieldProblem3 pb = new TestFieldProblem3(field, field.getZero().add(0.9)); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); - FieldFirstOrderIntegrator integ = new DormandPrince54FieldIntegrator(field, minStep, maxStep, 1.0e-8, 1.0e-8); + FirstOrderFieldIntegrator integ = new DormandPrince54FieldIntegrator(field, minStep, maxStep, 1.0e-8, 1.0e-8); integ.addStepHandler(new ContinuousOutputFieldModel()); integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); ContinuousOutputFieldModel cm = (ContinuousOutputFieldModel) integ.getStepHandlers().iterator().next(); @@ -62,7 +62,7 @@ public class ContinuousOutputFieldModelTest { TestFieldProblem3 pb = new TestFieldProblem3(field, field.getZero().add(0.9)); double minStep = 0; double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal(); - FieldFirstOrderIntegrator integ = new DormandPrince54FieldIntegrator(field, minStep, maxStep, 1.0e-8, 1.0e-8); + FirstOrderFieldIntegrator integ = new DormandPrince54FieldIntegrator(field, minStep, maxStep, 1.0e-8, 1.0e-8); ContinuousOutputFieldModel cm = new ContinuousOutputFieldModel(); integ.addStepHandler(cm); integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); @@ -99,8 +99,8 @@ public class ContinuousOutputFieldModelTest { private > void doTestModelsMerging(final Field field) { // theoretical solution: y[0] = cos(t), y[1] = sin(t) - FieldFirstOrderDifferentialEquations problem = - new FieldFirstOrderDifferentialEquations() { + FirstOrderFieldDifferentialEquations problem = + new FirstOrderFieldDifferentialEquations() { public T[] computeDerivatives(T t, T[] y) { T[] yDot = MathArrays.buildArray(field, 2); yDot[0] = y[1].negate(); @@ -116,7 +116,7 @@ public class ContinuousOutputFieldModelTest { // integrate backward from π to 0; ContinuousOutputFieldModel cm1 = new ContinuousOutputFieldModel(); - FieldFirstOrderIntegrator integ1 = + FirstOrderFieldIntegrator integ1 = new DormandPrince853FieldIntegrator(field, 0, 1.0, 1.0e-8, 1.0e-8); integ1.addStepHandler(cm1); T t0 = field.getZero().add(FastMath.PI); @@ -129,7 +129,7 @@ public class ContinuousOutputFieldModelTest { // integrate backward from 2π to π ContinuousOutputFieldModel cm2 = new ContinuousOutputFieldModel(); - FieldFirstOrderIntegrator integ2 = + FirstOrderFieldIntegrator integ2 = new DormandPrince853FieldIntegrator(field, 0, 0.1, 1.0e-12, 1.0e-12); integ2.addStepHandler(cm2); t0 = field.getZero().add(2.0 * FastMath.PI); @@ -199,7 +199,7 @@ public class ContinuousOutputFieldModelTest { } final FieldODEStateAndDerivative s0 = new FieldODEStateAndDerivative(field.getZero().add(t0), fieldY, fieldY); final FieldODEStateAndDerivative s1 = new FieldODEStateAndDerivative(field.getZero().add(t1), fieldY, fieldY); - final FieldEquationsMapper mapper = new FieldExpandableODE(new FieldFirstOrderDifferentialEquations() { + final FieldEquationsMapper mapper = new FieldExpandableODE(new FirstOrderFieldDifferentialEquations() { public int getDimension() { return s0.getStateDimension(); } diff --git a/src/test/java/org/apache/commons/math3/ode/FieldExpandableODETest.java b/src/test/java/org/apache/commons/math3/ode/FieldExpandableODETest.java index 33a011237..bc86f5551 100644 --- a/src/test/java/org/apache/commons/math3/ode/FieldExpandableODETest.java +++ b/src/test/java/org/apache/commons/math3/ode/FieldExpandableODETest.java @@ -23,7 +23,7 @@ import org.apache.commons.math3.RealFieldElement; import org.apache.commons.math3.exception.DimensionMismatchException; import org.apache.commons.math3.exception.MathIllegalArgumentException; import org.apache.commons.math3.ode.FieldExpandableODE; -import org.apache.commons.math3.ode.FieldFirstOrderDifferentialEquations; +import org.apache.commons.math3.ode.FirstOrderFieldDifferentialEquations; import org.apache.commons.math3.ode.FieldODEStateAndDerivative; import org.apache.commons.math3.ode.FieldSecondaryEquations; import org.apache.commons.math3.util.Decimal64Field; @@ -39,7 +39,7 @@ public class FieldExpandableODETest { } private > void doTestOnlyMainEquation(final Field field) { - FieldFirstOrderDifferentialEquations main = new Linear(field, 3, 0); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); FieldExpandableODE equation = new FieldExpandableODE(main); Assert.assertEquals(main.getDimension(), equation.getMapper().getTotalDimension()); Assert.assertEquals(1, equation.getMapper().getNumberOfEquations()); @@ -70,7 +70,7 @@ public class FieldExpandableODETest { private > void doTestMainAndSecondary(final Field field) { - FieldFirstOrderDifferentialEquations main = new Linear(field, 3, 0); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); FieldExpandableODE equation = new FieldExpandableODE(main); FieldSecondaryEquations secondary1 = new Linear(field, 3, main.getDimension()); int i1 = equation.addSecondaryEquations(secondary1); @@ -127,7 +127,7 @@ public class FieldExpandableODETest { private > void doTestMap(final Field field) { - FieldFirstOrderDifferentialEquations main = new Linear(field, 3, 0); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); FieldExpandableODE equation = new FieldExpandableODE(main); FieldSecondaryEquations secondary1 = new Linear(field, 3, main.getDimension()); int i1 = equation.addSecondaryEquations(secondary1); @@ -215,7 +215,7 @@ public class FieldExpandableODETest { private > void doTestExtractDimensionMismatch(final Field field) throws DimensionMismatchException { - FieldFirstOrderDifferentialEquations main = new Linear(field, 3, 0); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); FieldExpandableODE equation = new FieldExpandableODE(main); FieldSecondaryEquations secondary1 = new Linear(field, 3, main.getDimension()); int i1 = equation.addSecondaryEquations(secondary1); @@ -231,7 +231,7 @@ public class FieldExpandableODETest { private > void doTestInsertTooShortComplete(final Field field) throws DimensionMismatchException { - FieldFirstOrderDifferentialEquations main = new Linear(field, 3, 0); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); FieldExpandableODE equation = new FieldExpandableODE(main); FieldSecondaryEquations secondary1 = new Linear(field, 3, main.getDimension()); int i1 = equation.addSecondaryEquations(secondary1); @@ -248,7 +248,7 @@ public class FieldExpandableODETest { private > void doTestInsertWrongEquationData(final Field field) throws DimensionMismatchException { - FieldFirstOrderDifferentialEquations main = new Linear(field, 3, 0); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); FieldExpandableODE equation = new FieldExpandableODE(main); FieldSecondaryEquations secondary1 = new Linear(field, 3, main.getDimension()); int i1 = equation.addSecondaryEquations(secondary1); @@ -265,7 +265,7 @@ public class FieldExpandableODETest { private > void doTestNegativeIndex(final Field field) throws MathIllegalArgumentException { - FieldFirstOrderDifferentialEquations main = new Linear(field, 3, 0); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); FieldExpandableODE equation = new FieldExpandableODE(main); T[] complete = MathArrays.buildArray(field, equation.getMapper().getTotalDimension()); equation.getMapper().extractEquationData(-1, complete); @@ -279,14 +279,14 @@ public class FieldExpandableODETest { private > void doTestTooLargeIndex(final Field field) throws MathIllegalArgumentException { - FieldFirstOrderDifferentialEquations main = new Linear(field, 3, 0); + FirstOrderFieldDifferentialEquations main = new Linear(field, 3, 0); FieldExpandableODE equation = new FieldExpandableODE(main); T[] complete = MathArrays.buildArray(field, equation.getMapper().getTotalDimension()); equation.getMapper().extractEquationData(+1, complete); } private static class Linear> - implements FieldFirstOrderDifferentialEquations, FieldSecondaryEquations { + implements FirstOrderFieldDifferentialEquations, FieldSecondaryEquations { private final Field field; private final int dimension; diff --git a/src/test/java/org/apache/commons/math3/ode/TestFieldProblemAbstract.java b/src/test/java/org/apache/commons/math3/ode/TestFieldProblemAbstract.java index 02ff65f86..2b5b408a6 100644 --- a/src/test/java/org/apache/commons/math3/ode/TestFieldProblemAbstract.java +++ b/src/test/java/org/apache/commons/math3/ode/TestFieldProblemAbstract.java @@ -30,7 +30,7 @@ import org.apache.commons.math3.util.MathArrays; * @param the type of the field elements */ public abstract class TestFieldProblemAbstract> - implements FieldFirstOrderDifferentialEquations { + implements FirstOrderFieldDifferentialEquations { /** Field to which elements belong. */ private Field field; diff --git a/src/test/java/org/apache/commons/math3/ode/TestFieldProblemHandler.java b/src/test/java/org/apache/commons/math3/ode/TestFieldProblemHandler.java index 101f4fa53..844b3a257 100644 --- a/src/test/java/org/apache/commons/math3/ode/TestFieldProblemHandler.java +++ b/src/test/java/org/apache/commons/math3/ode/TestFieldProblemHandler.java @@ -45,7 +45,7 @@ public class TestFieldProblemHandler> private T lastTime; /** ODE solver used. */ - private FieldFirstOrderIntegrator integrator; + private FirstOrderFieldIntegrator integrator; /** Expected start for step. */ private T expectedStepStart; @@ -55,7 +55,7 @@ public class TestFieldProblemHandler> * @param problem problem for which steps should be handled * @param integrator ODE solver used */ - public TestFieldProblemHandler(TestFieldProblemAbstract problem, FieldFirstOrderIntegrator integrator) { + public TestFieldProblemHandler(TestFieldProblemAbstract problem, FirstOrderFieldIntegrator integrator) { this.problem = problem; this.integrator = integrator; maxValueError = problem.getField().getZero(); diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java index 73293b900..6d5c52ac7 100644 --- a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractEmbeddedRungeKuttaFieldIntegratorTest.java @@ -26,8 +26,8 @@ import org.apache.commons.math3.exception.MaxCountExceededException; import org.apache.commons.math3.exception.NoBracketingException; import org.apache.commons.math3.exception.NumberIsTooSmallException; import org.apache.commons.math3.ode.FieldExpandableODE; -import org.apache.commons.math3.ode.FieldFirstOrderDifferentialEquations; -import org.apache.commons.math3.ode.FieldFirstOrderIntegrator; +import org.apache.commons.math3.ode.FirstOrderFieldDifferentialEquations; +import org.apache.commons.math3.ode.FirstOrderFieldIntegrator; import org.apache.commons.math3.ode.FieldODEState; import org.apache.commons.math3.ode.FieldODEStateAndDerivative; import org.apache.commons.math3.ode.TestFieldProblem1; @@ -131,7 +131,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { public abstract void testForwardBackwardExceptions(); protected > void doTestForwardBackwardExceptions(final Field field) { - FieldFirstOrderDifferentialEquations equations = new FieldFirstOrderDifferentialEquations() { + FirstOrderFieldDifferentialEquations equations = new FirstOrderFieldDifferentialEquations() { public int getDimension() { return 1; @@ -188,7 +188,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { double[] vecAbsoluteTolerance = { 1.0e-15, 1.0e-16 }; double[] vecRelativeTolerance = { 1.0e-15, 1.0e-16 }; - FieldFirstOrderIntegrator integ = createIntegrator(field, minStep, maxStep, + FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); @@ -212,7 +212,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { double scalAbsoluteTolerance = FastMath.pow(10.0, i); double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance; - FieldFirstOrderIntegrator integ = createIntegrator(field, minStep, maxStep, + FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); @@ -243,7 +243,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { double scalAbsoluteTolerance = 1.0e-8; double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance; - FieldFirstOrderIntegrator integ = createIntegrator(field, minStep, maxStep, + FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); @@ -275,7 +275,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { double scalAbsoluteTolerance = 1.0e-8; double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance; - FieldFirstOrderIntegrator integ = createIntegrator(field, minStep, maxStep, + FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); @@ -314,7 +314,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { double scalAbsoluteTolerance = 1.0e-8; double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance; - FieldFirstOrderIntegrator integ = createIntegrator(field, minStep, maxStep, + FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, scalAbsoluteTolerance, scalRelativeTolerance); TestFieldProblemHandler handler = new TestFieldProblemHandler(pb, integ); integ.addStepHandler(handler); @@ -422,7 +422,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { double[] vecAbsoluteTolerance = { 1.0e-8, 1.0e-8, 1.0e-10, 1.0e-10 }; double[] vecRelativeTolerance = { 1.0e-10, 1.0e-10, 1.0e-8, 1.0e-8 }; - FieldFirstOrderIntegrator integ = createIntegrator(field, minStep, maxStep, + FirstOrderFieldIntegrator integ = createIntegrator(field, minStep, maxStep, vecAbsoluteTolerance, vecRelativeTolerance); integ.addStepHandler(new KeplerHandler(pb, epsilon)); integ.integrate(new FieldExpandableODE(pb), pb.getInitialState(), pb.getFinalTime()); @@ -511,7 +511,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest { return y.getPartialDerivative(orders); } - private static class SinCos implements FieldFirstOrderDifferentialEquations { + private static class SinCos implements FirstOrderFieldDifferentialEquations { private final DerivativeStructure omega; private DerivativeStructure r; diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java index 37e0992c8..07eee38dc 100644 --- a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java +++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldIntegratorTest.java @@ -28,7 +28,7 @@ import org.apache.commons.math3.exception.MaxCountExceededException; import org.apache.commons.math3.exception.NoBracketingException; import org.apache.commons.math3.exception.NumberIsTooSmallException; import org.apache.commons.math3.ode.FieldExpandableODE; -import org.apache.commons.math3.ode.FieldFirstOrderDifferentialEquations; +import org.apache.commons.math3.ode.FirstOrderFieldDifferentialEquations; import org.apache.commons.math3.ode.FieldODEState; import org.apache.commons.math3.ode.FieldODEStateAndDerivative; import org.apache.commons.math3.ode.TestFieldProblem1; @@ -126,7 +126,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { k[0] = field.getZero().add(1.0e-4); k[1] = field.getZero().add(1.0e-5); k[2] = field.getZero().add(1.0e-6); - FieldFirstOrderDifferentialEquations ode = new FieldFirstOrderDifferentialEquations() { + FirstOrderFieldDifferentialEquations ode = new FirstOrderFieldDifferentialEquations() { public int getDimension() { return k.length; @@ -424,7 +424,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { public void init(FieldODEStateAndDerivative s0, T t) { } }); - integ.integrate(new FieldExpandableODE(new FieldFirstOrderDifferentialEquations() { + integ.integrate(new FieldExpandableODE(new FirstOrderFieldDifferentialEquations() { public void init(T t0, T[] y0, T t) { } public T[] computeDerivatives(T t, T[] y) { @@ -470,7 +470,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { final T[] y0 = MathArrays.buildArray(field, 1); y0[0] = field.getOne(); final T t = field.getZero().add(0.001); - FieldFirstOrderDifferentialEquations equations = new FieldFirstOrderDifferentialEquations() { + FirstOrderFieldDifferentialEquations equations = new FirstOrderFieldDifferentialEquations() { public int getDimension() { return 1; @@ -573,7 +573,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest { return y.getPartialDerivative(orders); } - private static class SinCos implements FieldFirstOrderDifferentialEquations { + private static class SinCos implements FirstOrderFieldDifferentialEquations { private final DerivativeStructure omega; private DerivativeStructure r; diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java index 2391b5577..b5c7ff0b5 100644 --- a/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java +++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/AbstractRungeKuttaFieldStepInterpolatorTest.java @@ -25,7 +25,7 @@ import org.apache.commons.math3.ode.EquationsMapper; import org.apache.commons.math3.ode.ExpandableStatefulODE; import org.apache.commons.math3.ode.FieldEquationsMapper; import org.apache.commons.math3.ode.FieldExpandableODE; -import org.apache.commons.math3.ode.FieldFirstOrderDifferentialEquations; +import org.apache.commons.math3.ode.FirstOrderFieldDifferentialEquations; import org.apache.commons.math3.ode.FieldODEStateAndDerivative; import org.apache.commons.math3.ode.sampling.AbstractFieldStepInterpolator; import org.apache.commons.math3.util.FastMath; @@ -103,7 +103,7 @@ public abstract class AbstractRungeKuttaFieldStepInterpolatorTest { double epsilonSin, double epsilonCos, double epsilonSinDot, double epsilonCosDot) { - FieldFirstOrderDifferentialEquations eqn = new SinCos(field); + FirstOrderFieldDifferentialEquations eqn = new SinCos(field); RungeKuttaFieldStepInterpolator fieldInterpolator = setUpInterpolator(field, eqn, 0.0, new double[] { 0.0, 1.0 }, 0.125); RungeKuttaStepInterpolator regularInterpolator = convertInterpolator(fieldInterpolator, eqn); @@ -142,7 +142,7 @@ public abstract class AbstractRungeKuttaFieldStepInterpolatorTest { private > RungeKuttaFieldStepInterpolator setUpInterpolator(final Field field, - final FieldFirstOrderDifferentialEquations eqn, + final FirstOrderFieldDifferentialEquations eqn, final double t0, final double[] y0, final double t1) { @@ -192,7 +192,7 @@ public abstract class AbstractRungeKuttaFieldStepInterpolatorTest { private > RungeKuttaStepInterpolator convertInterpolator(final RungeKuttaFieldStepInterpolator fieldInterpolator, - final FieldFirstOrderDifferentialEquations eqn) { + final FirstOrderFieldDifferentialEquations eqn) { RungeKuttaStepInterpolator regularInterpolator = null; try { @@ -284,7 +284,7 @@ public abstract class AbstractRungeKuttaFieldStepInterpolatorTest { } - private static class SinCos> implements FieldFirstOrderDifferentialEquations { + private static class SinCos> implements FirstOrderFieldDifferentialEquations { private final Field field; protected SinCos(final Field field) { this.field = field; diff --git a/src/test/java/org/apache/commons/math3/ode/nonstiff/StepFieldProblem.java b/src/test/java/org/apache/commons/math3/ode/nonstiff/StepFieldProblem.java index 666f4bf5e..8943afc81 100644 --- a/src/test/java/org/apache/commons/math3/ode/nonstiff/StepFieldProblem.java +++ b/src/test/java/org/apache/commons/math3/ode/nonstiff/StepFieldProblem.java @@ -19,7 +19,7 @@ package org.apache.commons.math3.ode.nonstiff; import org.apache.commons.math3.Field; import org.apache.commons.math3.RealFieldElement; -import org.apache.commons.math3.ode.FieldFirstOrderDifferentialEquations; +import org.apache.commons.math3.ode.FirstOrderFieldDifferentialEquations; import org.apache.commons.math3.ode.FieldODEState; import org.apache.commons.math3.ode.FieldODEStateAndDerivative; import org.apache.commons.math3.ode.events.Action; @@ -28,7 +28,7 @@ import org.apache.commons.math3.util.MathArrays; public class StepFieldProblem> - implements FieldFirstOrderDifferentialEquations, FieldEventHandler { + implements FirstOrderFieldDifferentialEquations, FieldEventHandler { public StepFieldProblem(Field field, T rateBefore, T rateAfter, T switchTime) { this.field = field; diff --git a/src/test/java/org/apache/commons/math3/ode/sampling/StepInterpolatorTestUtils.java b/src/test/java/org/apache/commons/math3/ode/sampling/StepInterpolatorTestUtils.java index 184f3e0f2..a68adaaa4 100644 --- a/src/test/java/org/apache/commons/math3/ode/sampling/StepInterpolatorTestUtils.java +++ b/src/test/java/org/apache/commons/math3/ode/sampling/StepInterpolatorTestUtils.java @@ -23,7 +23,7 @@ import org.apache.commons.math3.exception.MaxCountExceededException; import org.apache.commons.math3.exception.NoBracketingException; import org.apache.commons.math3.exception.NumberIsTooSmallException; import org.apache.commons.math3.ode.FieldExpandableODE; -import org.apache.commons.math3.ode.FieldFirstOrderIntegrator; +import org.apache.commons.math3.ode.FirstOrderFieldIntegrator; import org.apache.commons.math3.ode.FieldODEStateAndDerivative; import org.apache.commons.math3.ode.FirstOrderIntegrator; import org.apache.commons.math3.ode.TestFieldProblemAbstract; @@ -93,7 +93,7 @@ public class StepInterpolatorTestUtils { } - public static > void checkDerivativesConsistency(final FieldFirstOrderIntegrator integrator, + public static > void checkDerivativesConsistency(final FirstOrderFieldIntegrator integrator, final TestFieldProblemAbstract problem, final double threshold) { integrator.addStepHandler(new FieldStepHandler() {