Renamed interfaces for consistency with other classes.
This commit is contained in:
parent
264851fcfc
commit
74c643b895
|
@ -47,7 +47,7 @@ import org.apache.commons.math3.util.IntegerSequence;
|
|||
* @param <T> the type of the field elements
|
||||
* @since 3.6
|
||||
*/
|
||||
public abstract class AbstractFieldIntegrator<T extends RealFieldElement<T>> implements FieldFirstOrderIntegrator<T> {
|
||||
public abstract class AbstractFieldIntegrator<T extends RealFieldElement<T>> implements FirstOrderFieldIntegrator<T> {
|
||||
|
||||
/** Default relative accuracy. */
|
||||
private static final double DEFAULT_RELATIVE_ACCURACY = 1e-14;
|
||||
|
|
|
@ -38,11 +38,11 @@ import org.apache.commons.math3.util.MathArrays;
|
|||
* <p>
|
||||
* We want the integrator to use <em>only</em> the primary set to estimate the
|
||||
* errors and hence the step sizes. It should <em>not</em> 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.
|
||||
* </p>
|
||||
*
|
||||
* @see FieldFirstOrderDifferentialEquations
|
||||
* @see FirstOrderFieldDifferentialEquations
|
||||
* @see FieldSecondaryEquations
|
||||
*
|
||||
* @param <T> the type of the field elements
|
||||
|
@ -52,7 +52,7 @@ import org.apache.commons.math3.util.MathArrays;
|
|||
public class FieldExpandableODE<T extends RealFieldElement<T>> {
|
||||
|
||||
/** Primary differential equation. */
|
||||
private final FieldFirstOrderDifferentialEquations<T> primary;
|
||||
private final FirstOrderFieldDifferentialEquations<T> primary;
|
||||
|
||||
/** Components of the expandable ODE. */
|
||||
private List<FieldSecondaryEquations<T>> components;
|
||||
|
@ -63,7 +63,7 @@ public class FieldExpandableODE<T extends RealFieldElement<T>> {
|
|||
/** Build an expandable set from its primary ODE set.
|
||||
* @param primary the primary set of differential equations to be integrated.
|
||||
*/
|
||||
public FieldExpandableODE(final FieldFirstOrderDifferentialEquations<T> primary) {
|
||||
public FieldExpandableODE(final FirstOrderFieldDifferentialEquations<T> primary) {
|
||||
this.primary = primary;
|
||||
this.components = new ArrayList<FieldSecondaryEquations<T>>();
|
||||
this.mapper = new FieldEquationsMapper<T>(null, primary.getDimension());
|
||||
|
|
|
@ -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 <T> the type of the field elements
|
||||
* @since 3.6
|
||||
|
|
|
@ -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 <T> the type of the field elements
|
||||
* @since 3.6
|
||||
*/
|
||||
|
|
|
@ -31,11 +31,11 @@ import org.apache.commons.math3.exception.MaxCountExceededException;
|
|||
* </p>
|
||||
* <p>
|
||||
* 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.
|
||||
* </p>
|
||||
* @see FieldFirstOrderDifferentialEquations
|
||||
* @see FirstOrderFieldDifferentialEquations
|
||||
* @see FieldExpandableODE
|
||||
* @param <T> the type of the field elements
|
||||
* @since 3.6
|
||||
|
|
|
@ -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.</p>
|
||||
*
|
||||
* @see FieldFirstOrderIntegrator
|
||||
* @see FirstOrderFieldIntegrator
|
||||
*
|
||||
* @param <T> the type of the field elements
|
||||
* @since 3.6
|
||||
*/
|
||||
|
||||
public interface FieldFirstOrderDifferentialEquations<T extends RealFieldElement<T>> {
|
||||
public interface FirstOrderFieldDifferentialEquations<T extends RealFieldElement<T>> {
|
||||
|
||||
/** Get the dimension of the problem.
|
||||
* @return dimension of the problem
|
|
@ -35,12 +35,12 @@ import org.apache.commons.math3.ode.sampling.FieldStepHandler;
|
|||
* be handled should implement the {@link
|
||||
* FirstOrderDifferentialEquations} interface.</p>
|
||||
*
|
||||
* @see FieldFirstOrderDifferentialEquations
|
||||
* @see FirstOrderFieldDifferentialEquations
|
||||
* @param <T> the type of the field elements
|
||||
* @since 3.6
|
||||
*/
|
||||
|
||||
public interface FieldFirstOrderIntegrator<T extends RealFieldElement<T>> {
|
||||
public interface FirstOrderFieldIntegrator<T extends RealFieldElement<T>> {
|
||||
|
||||
/** Get the name of the method.
|
||||
* @return name of the method
|
|
@ -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<T extends RealFieldElement<T>>
|
|||
* (can be set to a value smaller than {@code t0} for backward integration)
|
||||
* @return state vector at {@code t}
|
||||
*/
|
||||
public T[] singleStep(final FieldFirstOrderDifferentialEquations<T> equations,
|
||||
public T[] singleStep(final FirstOrderFieldDifferentialEquations<T> equations,
|
||||
final T t0, final T[] y0, final T t) {
|
||||
|
||||
// create some internal working arrays
|
||||
|
|
|
@ -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).</p>
|
||||
*
|
||||
* @see org.apache.commons.math3.ode.FieldFirstOrderIntegrator
|
||||
* @see org.apache.commons.math3.ode.FirstOrderFieldIntegrator
|
||||
* @see StepHandler
|
||||
*
|
||||
* @param <T> the type of the field elements
|
||||
|
|
|
@ -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.</p>
|
||||
*
|
||||
* @see org.apache.commons.math3.ode.FieldFirstOrderIntegrator
|
||||
* @see org.apache.commons.math3.ode.FirstOrderFieldIntegrator
|
||||
* @see FieldStepInterpolator
|
||||
* @param <T> the type of the field elements
|
||||
* @since 3.6
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.apache.commons.math3.ode.FieldODEStateAndDerivative;
|
|||
* (this feature is often called dense output).</p>
|
||||
*
|
||||
* @param <T> 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
|
||||
*/
|
||||
|
|
|
@ -85,10 +85,10 @@
|
|||
<p>
|
||||
The user should describe his problem in his own classes which should implement the
|
||||
<a href="../apidocs/org/apache/commons/math3/ode/FirstOrderDifferentialEquations.html">FirstOrderDifferentialEquations</a>
|
||||
interface (or <a href="../apidocs/org/apache/commons/math3/ode/FieldFirstOrderDifferentialEquations.html">FieldFirstOrderDifferentialEquations</a>
|
||||
interface (or <a href="../apidocs/org/apache/commons/math3/ode/FirstOrderFieldDifferentialEquations.html">FirstOrderFieldDifferentialEquations</a>
|
||||
interface). Then he should pass it to the integrator he prefers among all the classes that implement
|
||||
the <a href="../apidocs/org/apache/commons/math3/ode/FirstOrderIntegrator.html">FirstOrderIntegrator</a>
|
||||
interface (or the <a href="../apidocs/org/apache/commons/math3/ode/FieldFirstOrderIntegrator.html">FieldFirstOrderIntegrator</a>
|
||||
interface (or the <a href="../apidocs/org/apache/commons/math3/ode/FirstOrderFieldIntegrator.html">FirstOrderFieldIntegrator</a>
|
||||
interface). The following example shows how to implement the simple two-dimensional problem using double primitives:
|
||||
<ul>
|
||||
<li>y'<sub>0</sub>(t) = ω × (c<sub>1</sub> - y<sub>1</sub>(t))</li>
|
||||
|
|
|
@ -43,7 +43,7 @@ public class ContinuousOutputFieldModelTest {
|
|||
TestFieldProblem3<T> pb = new TestFieldProblem3<T>(field, field.getZero().add(0.9));
|
||||
double minStep = 0;
|
||||
double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal();
|
||||
FieldFirstOrderIntegrator<T> integ = new DormandPrince54FieldIntegrator<T>(field, minStep, maxStep, 1.0e-8, 1.0e-8);
|
||||
FirstOrderFieldIntegrator<T> integ = new DormandPrince54FieldIntegrator<T>(field, minStep, maxStep, 1.0e-8, 1.0e-8);
|
||||
integ.addStepHandler(new ContinuousOutputFieldModel<T>());
|
||||
integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
|
||||
ContinuousOutputFieldModel<T> cm = (ContinuousOutputFieldModel<T>) integ.getStepHandlers().iterator().next();
|
||||
|
@ -62,7 +62,7 @@ public class ContinuousOutputFieldModelTest {
|
|||
TestFieldProblem3<T> pb = new TestFieldProblem3<T>(field, field.getZero().add(0.9));
|
||||
double minStep = 0;
|
||||
double maxStep = pb.getFinalTime().subtract(pb.getInitialState().getTime()).getReal();
|
||||
FieldFirstOrderIntegrator<T> integ = new DormandPrince54FieldIntegrator<T>(field, minStep, maxStep, 1.0e-8, 1.0e-8);
|
||||
FirstOrderFieldIntegrator<T> integ = new DormandPrince54FieldIntegrator<T>(field, minStep, maxStep, 1.0e-8, 1.0e-8);
|
||||
ContinuousOutputFieldModel<T> cm = new ContinuousOutputFieldModel<T>();
|
||||
integ.addStepHandler(cm);
|
||||
integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
|
||||
|
@ -99,8 +99,8 @@ public class ContinuousOutputFieldModelTest {
|
|||
private <T extends RealFieldElement<T>> void doTestModelsMerging(final Field<T> field) {
|
||||
|
||||
// theoretical solution: y[0] = cos(t), y[1] = sin(t)
|
||||
FieldFirstOrderDifferentialEquations<T> problem =
|
||||
new FieldFirstOrderDifferentialEquations<T>() {
|
||||
FirstOrderFieldDifferentialEquations<T> problem =
|
||||
new FirstOrderFieldDifferentialEquations<T>() {
|
||||
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<T> cm1 = new ContinuousOutputFieldModel<T>();
|
||||
FieldFirstOrderIntegrator<T> integ1 =
|
||||
FirstOrderFieldIntegrator<T> integ1 =
|
||||
new DormandPrince853FieldIntegrator<T>(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<T> cm2 = new ContinuousOutputFieldModel<T>();
|
||||
FieldFirstOrderIntegrator<T> integ2 =
|
||||
FirstOrderFieldIntegrator<T> integ2 =
|
||||
new DormandPrince853FieldIntegrator<T>(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<T> s0 = new FieldODEStateAndDerivative<T>(field.getZero().add(t0), fieldY, fieldY);
|
||||
final FieldODEStateAndDerivative<T> s1 = new FieldODEStateAndDerivative<T>(field.getZero().add(t1), fieldY, fieldY);
|
||||
final FieldEquationsMapper<T> mapper = new FieldExpandableODE<T>(new FieldFirstOrderDifferentialEquations<T>() {
|
||||
final FieldEquationsMapper<T> mapper = new FieldExpandableODE<T>(new FirstOrderFieldDifferentialEquations<T>() {
|
||||
public int getDimension() {
|
||||
return s0.getStateDimension();
|
||||
}
|
||||
|
|
|
@ -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 <T extends RealFieldElement<T>> void doTestOnlyMainEquation(final Field<T> field) {
|
||||
FieldFirstOrderDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main);
|
||||
Assert.assertEquals(main.getDimension(), equation.getMapper().getTotalDimension());
|
||||
Assert.assertEquals(1, equation.getMapper().getNumberOfEquations());
|
||||
|
@ -70,7 +70,7 @@ public class FieldExpandableODETest {
|
|||
|
||||
private <T extends RealFieldElement<T>> void doTestMainAndSecondary(final Field<T> field) {
|
||||
|
||||
FieldFirstOrderDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main);
|
||||
FieldSecondaryEquations<T> secondary1 = new Linear<T>(field, 3, main.getDimension());
|
||||
int i1 = equation.addSecondaryEquations(secondary1);
|
||||
|
@ -127,7 +127,7 @@ public class FieldExpandableODETest {
|
|||
|
||||
private <T extends RealFieldElement<T>> void doTestMap(final Field<T> field) {
|
||||
|
||||
FieldFirstOrderDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main);
|
||||
FieldSecondaryEquations<T> secondary1 = new Linear<T>(field, 3, main.getDimension());
|
||||
int i1 = equation.addSecondaryEquations(secondary1);
|
||||
|
@ -215,7 +215,7 @@ public class FieldExpandableODETest {
|
|||
private <T extends RealFieldElement<T>> void doTestExtractDimensionMismatch(final Field<T> field)
|
||||
throws DimensionMismatchException {
|
||||
|
||||
FieldFirstOrderDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main);
|
||||
FieldSecondaryEquations<T> secondary1 = new Linear<T>(field, 3, main.getDimension());
|
||||
int i1 = equation.addSecondaryEquations(secondary1);
|
||||
|
@ -231,7 +231,7 @@ public class FieldExpandableODETest {
|
|||
private <T extends RealFieldElement<T>> void doTestInsertTooShortComplete(final Field<T> field)
|
||||
throws DimensionMismatchException {
|
||||
|
||||
FieldFirstOrderDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main);
|
||||
FieldSecondaryEquations<T> secondary1 = new Linear<T>(field, 3, main.getDimension());
|
||||
int i1 = equation.addSecondaryEquations(secondary1);
|
||||
|
@ -248,7 +248,7 @@ public class FieldExpandableODETest {
|
|||
private <T extends RealFieldElement<T>> void doTestInsertWrongEquationData(final Field<T> field)
|
||||
throws DimensionMismatchException {
|
||||
|
||||
FieldFirstOrderDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main);
|
||||
FieldSecondaryEquations<T> secondary1 = new Linear<T>(field, 3, main.getDimension());
|
||||
int i1 = equation.addSecondaryEquations(secondary1);
|
||||
|
@ -265,7 +265,7 @@ public class FieldExpandableODETest {
|
|||
private <T extends RealFieldElement<T>> void doTestNegativeIndex(final Field<T> field)
|
||||
throws MathIllegalArgumentException {
|
||||
|
||||
FieldFirstOrderDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main);
|
||||
T[] complete = MathArrays.buildArray(field, equation.getMapper().getTotalDimension());
|
||||
equation.getMapper().extractEquationData(-1, complete);
|
||||
|
@ -279,14 +279,14 @@ public class FieldExpandableODETest {
|
|||
private <T extends RealFieldElement<T>> void doTestTooLargeIndex(final Field<T> field)
|
||||
throws MathIllegalArgumentException {
|
||||
|
||||
FieldFirstOrderDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FirstOrderFieldDifferentialEquations<T> main = new Linear<T>(field, 3, 0);
|
||||
FieldExpandableODE<T> equation = new FieldExpandableODE<T>(main);
|
||||
T[] complete = MathArrays.buildArray(field, equation.getMapper().getTotalDimension());
|
||||
equation.getMapper().extractEquationData(+1, complete);
|
||||
}
|
||||
|
||||
private static class Linear<T extends RealFieldElement<T>>
|
||||
implements FieldFirstOrderDifferentialEquations<T>, FieldSecondaryEquations<T> {
|
||||
implements FirstOrderFieldDifferentialEquations<T>, FieldSecondaryEquations<T> {
|
||||
|
||||
private final Field<T> field;
|
||||
private final int dimension;
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.commons.math3.util.MathArrays;
|
|||
* @param <T> the type of the field elements
|
||||
*/
|
||||
public abstract class TestFieldProblemAbstract<T extends RealFieldElement<T>>
|
||||
implements FieldFirstOrderDifferentialEquations<T> {
|
||||
implements FirstOrderFieldDifferentialEquations<T> {
|
||||
|
||||
/** Field to which elements belong. */
|
||||
private Field<T> field;
|
||||
|
|
|
@ -45,7 +45,7 @@ public class TestFieldProblemHandler<T extends RealFieldElement<T>>
|
|||
private T lastTime;
|
||||
|
||||
/** ODE solver used. */
|
||||
private FieldFirstOrderIntegrator<T> integrator;
|
||||
private FirstOrderFieldIntegrator<T> integrator;
|
||||
|
||||
/** Expected start for step. */
|
||||
private T expectedStepStart;
|
||||
|
@ -55,7 +55,7 @@ public class TestFieldProblemHandler<T extends RealFieldElement<T>>
|
|||
* @param problem problem for which steps should be handled
|
||||
* @param integrator ODE solver used
|
||||
*/
|
||||
public TestFieldProblemHandler(TestFieldProblemAbstract<T> problem, FieldFirstOrderIntegrator<T> integrator) {
|
||||
public TestFieldProblemHandler(TestFieldProblemAbstract<T> problem, FirstOrderFieldIntegrator<T> integrator) {
|
||||
this.problem = problem;
|
||||
this.integrator = integrator;
|
||||
maxValueError = problem.getField().getZero();
|
||||
|
|
|
@ -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 <T extends RealFieldElement<T>> void doTestForwardBackwardExceptions(final Field<T> field) {
|
||||
FieldFirstOrderDifferentialEquations<T> equations = new FieldFirstOrderDifferentialEquations<T>() {
|
||||
FirstOrderFieldDifferentialEquations<T> equations = new FirstOrderFieldDifferentialEquations<T>() {
|
||||
|
||||
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<T> integ = createIntegrator(field, minStep, maxStep,
|
||||
FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
|
||||
vecAbsoluteTolerance, vecRelativeTolerance);
|
||||
TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(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<T> integ = createIntegrator(field, minStep, maxStep,
|
||||
FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
|
||||
scalAbsoluteTolerance, scalRelativeTolerance);
|
||||
TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
|
||||
integ.addStepHandler(handler);
|
||||
|
@ -243,7 +243,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest {
|
|||
double scalAbsoluteTolerance = 1.0e-8;
|
||||
double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
|
||||
|
||||
FieldFirstOrderIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
|
||||
FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
|
||||
scalAbsoluteTolerance, scalRelativeTolerance);
|
||||
TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
|
||||
integ.addStepHandler(handler);
|
||||
|
@ -275,7 +275,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest {
|
|||
double scalAbsoluteTolerance = 1.0e-8;
|
||||
double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
|
||||
|
||||
FieldFirstOrderIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
|
||||
FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
|
||||
scalAbsoluteTolerance, scalRelativeTolerance);
|
||||
TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(pb, integ);
|
||||
integ.addStepHandler(handler);
|
||||
|
@ -314,7 +314,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest {
|
|||
double scalAbsoluteTolerance = 1.0e-8;
|
||||
double scalRelativeTolerance = 0.01 * scalAbsoluteTolerance;
|
||||
|
||||
FieldFirstOrderIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
|
||||
FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
|
||||
scalAbsoluteTolerance, scalRelativeTolerance);
|
||||
TestFieldProblemHandler<T> handler = new TestFieldProblemHandler<T>(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<T> integ = createIntegrator(field, minStep, maxStep,
|
||||
FirstOrderFieldIntegrator<T> integ = createIntegrator(field, minStep, maxStep,
|
||||
vecAbsoluteTolerance, vecRelativeTolerance);
|
||||
integ.addStepHandler(new KeplerHandler<T>(pb, epsilon));
|
||||
integ.integrate(new FieldExpandableODE<T>(pb), pb.getInitialState(), pb.getFinalTime());
|
||||
|
@ -511,7 +511,7 @@ public abstract class AbstractEmbeddedRungeKuttaFieldIntegratorTest {
|
|||
return y.getPartialDerivative(orders);
|
||||
}
|
||||
|
||||
private static class SinCos implements FieldFirstOrderDifferentialEquations<DerivativeStructure> {
|
||||
private static class SinCos implements FirstOrderFieldDifferentialEquations<DerivativeStructure> {
|
||||
|
||||
private final DerivativeStructure omega;
|
||||
private DerivativeStructure r;
|
||||
|
|
|
@ -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<T> ode = new FieldFirstOrderDifferentialEquations<T>() {
|
||||
FirstOrderFieldDifferentialEquations<T> ode = new FirstOrderFieldDifferentialEquations<T>() {
|
||||
|
||||
public int getDimension() {
|
||||
return k.length;
|
||||
|
@ -424,7 +424,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest {
|
|||
public void init(FieldODEStateAndDerivative<T> s0, T t) {
|
||||
}
|
||||
});
|
||||
integ.integrate(new FieldExpandableODE<T>(new FieldFirstOrderDifferentialEquations<T>() {
|
||||
integ.integrate(new FieldExpandableODE<T>(new FirstOrderFieldDifferentialEquations<T>() {
|
||||
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<T> equations = new FieldFirstOrderDifferentialEquations<T>() {
|
||||
FirstOrderFieldDifferentialEquations<T> equations = new FirstOrderFieldDifferentialEquations<T>() {
|
||||
|
||||
public int getDimension() {
|
||||
return 1;
|
||||
|
@ -573,7 +573,7 @@ public abstract class AbstractRungeKuttaFieldIntegratorTest {
|
|||
return y.getPartialDerivative(orders);
|
||||
}
|
||||
|
||||
private static class SinCos implements FieldFirstOrderDifferentialEquations<DerivativeStructure> {
|
||||
private static class SinCos implements FirstOrderFieldDifferentialEquations<DerivativeStructure> {
|
||||
|
||||
private final DerivativeStructure omega;
|
||||
private DerivativeStructure r;
|
||||
|
|
|
@ -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<T> eqn = new SinCos<T>(field);
|
||||
FirstOrderFieldDifferentialEquations<T> eqn = new SinCos<T>(field);
|
||||
RungeKuttaFieldStepInterpolator<T> 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 <T extends RealFieldElement<T>>
|
||||
RungeKuttaFieldStepInterpolator<T> setUpInterpolator(final Field<T> field,
|
||||
final FieldFirstOrderDifferentialEquations<T> eqn,
|
||||
final FirstOrderFieldDifferentialEquations<T> eqn,
|
||||
final double t0, final double[] y0,
|
||||
final double t1) {
|
||||
|
||||
|
@ -192,7 +192,7 @@ public abstract class AbstractRungeKuttaFieldStepInterpolatorTest {
|
|||
|
||||
private <T extends RealFieldElement<T>>
|
||||
RungeKuttaStepInterpolator convertInterpolator(final RungeKuttaFieldStepInterpolator<T> fieldInterpolator,
|
||||
final FieldFirstOrderDifferentialEquations<T> eqn) {
|
||||
final FirstOrderFieldDifferentialEquations<T> eqn) {
|
||||
|
||||
RungeKuttaStepInterpolator regularInterpolator = null;
|
||||
try {
|
||||
|
@ -284,7 +284,7 @@ public abstract class AbstractRungeKuttaFieldStepInterpolatorTest {
|
|||
|
||||
}
|
||||
|
||||
private static class SinCos<T extends RealFieldElement<T>> implements FieldFirstOrderDifferentialEquations<T> {
|
||||
private static class SinCos<T extends RealFieldElement<T>> implements FirstOrderFieldDifferentialEquations<T> {
|
||||
private final Field<T> field;
|
||||
protected SinCos(final Field<T> field) {
|
||||
this.field = field;
|
||||
|
|
|
@ -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<T extends RealFieldElement<T>>
|
||||
implements FieldFirstOrderDifferentialEquations<T>, FieldEventHandler<T> {
|
||||
implements FirstOrderFieldDifferentialEquations<T>, FieldEventHandler<T> {
|
||||
|
||||
public StepFieldProblem(Field<T> field, T rateBefore, T rateAfter, T switchTime) {
|
||||
this.field = field;
|
||||
|
|
|
@ -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 <T extends RealFieldElement<T>> void checkDerivativesConsistency(final FieldFirstOrderIntegrator<T> integrator,
|
||||
public static <T extends RealFieldElement<T>> void checkDerivativesConsistency(final FirstOrderFieldIntegrator<T> integrator,
|
||||
final TestFieldProblemAbstract<T> problem,
|
||||
final double threshold) {
|
||||
integrator.addStepHandler(new FieldStepHandler<T>() {
|
||||
|
|
Loading…
Reference in New Issue