Skip to content

Commit c6350fa

Browse files
committed
made non-stiff interpolators public
1 parent 7d7a670 commit c6350fa

20 files changed

+192
-236
lines changed

hipparchus-ode/src/main/java/org/hipparchus/ode/nonstiff/AdamsFieldStateInterpolator.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* @param <T> the type of the field elements
4343
*/
4444

45-
class AdamsFieldStateInterpolator<T extends CalculusFieldElement<T>> extends AbstractFieldODEStateInterpolator<T> {
45+
public class AdamsFieldStateInterpolator<T extends CalculusFieldElement<T>> extends AbstractFieldODEStateInterpolator<T> {
4646

4747
/** Step size used in the first scaled derivative and Nordsieck vector. */
4848
private T scalingH;
@@ -71,15 +71,14 @@ class AdamsFieldStateInterpolator<T extends CalculusFieldElement<T>> extends Abs
7171
* @param globalCurrentState end of the global step
7272
* @param equationsMapper mapper for ODE equations primary and secondary components
7373
*/
74-
AdamsFieldStateInterpolator(final T stepSize, final FieldODEStateAndDerivative<T> reference,
75-
final T[] scaled, final Array2DRowFieldMatrix<T> nordsieck,
76-
final boolean isForward,
77-
final FieldODEStateAndDerivative<T> globalPreviousState,
78-
final FieldODEStateAndDerivative<T> globalCurrentState,
79-
final FieldEquationsMapper<T> equationsMapper) {
80-
this(stepSize, reference, scaled, nordsieck,
81-
isForward, globalPreviousState, globalCurrentState,
82-
globalPreviousState, globalCurrentState, equationsMapper);
74+
public AdamsFieldStateInterpolator(final T stepSize, final FieldODEStateAndDerivative<T> reference,
75+
final T[] scaled, final Array2DRowFieldMatrix<T> nordsieck,
76+
final boolean isForward,
77+
final FieldODEStateAndDerivative<T> globalPreviousState,
78+
final FieldODEStateAndDerivative<T> globalCurrentState,
79+
final FieldEquationsMapper<T> equationsMapper) {
80+
this(stepSize, reference, scaled, nordsieck, isForward, globalPreviousState, globalCurrentState,
81+
globalPreviousState, globalCurrentState, equationsMapper);
8382
}
8483

8584
/** Simple constructor.
@@ -126,7 +125,7 @@ protected AdamsFieldStateInterpolator<T> create(boolean newForward,
126125
FieldODEStateAndDerivative<T> newSoftPreviousState,
127126
FieldODEStateAndDerivative<T> newSoftCurrentState,
128127
FieldEquationsMapper<T> newMapper) {
129-
return new AdamsFieldStateInterpolator<T>(scalingH, reference, scaled, nordsieck,
128+
return new AdamsFieldStateInterpolator<>(scalingH, reference, scaled, nordsieck,
130129
newForward,
131130
newGlobalPreviousState, newGlobalCurrentState,
132131
newSoftPreviousState, newSoftCurrentState,

hipparchus-ode/src/main/java/org/hipparchus/ode/nonstiff/ClassicalRungeKuttaFieldStateInterpolator.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
* @param <T> the type of the field elements
6060
*/
6161

62-
class ClassicalRungeKuttaFieldStateInterpolator<T extends CalculusFieldElement<T>>
62+
public class ClassicalRungeKuttaFieldStateInterpolator<T extends CalculusFieldElement<T>>
6363
extends RungeKuttaFieldStateInterpolator<T> {
6464

6565
/** Simple constructor.
@@ -72,16 +72,14 @@ class ClassicalRungeKuttaFieldStateInterpolator<T extends CalculusFieldElement<T
7272
* @param softCurrentState end of the restricted step
7373
* @param mapper equations mapper for the all equations
7474
*/
75-
ClassicalRungeKuttaFieldStateInterpolator(final Field<T> field, final boolean forward,
76-
final T[][] yDotK,
77-
final FieldODEStateAndDerivative<T> globalPreviousState,
78-
final FieldODEStateAndDerivative<T> globalCurrentState,
79-
final FieldODEStateAndDerivative<T> softPreviousState,
80-
final FieldODEStateAndDerivative<T> softCurrentState,
81-
final FieldEquationsMapper<T> mapper) {
82-
super(field, forward, yDotK,
83-
globalPreviousState, globalCurrentState, softPreviousState, softCurrentState,
84-
mapper);
75+
public ClassicalRungeKuttaFieldStateInterpolator(final Field<T> field, final boolean forward, final T[][] yDotK,
76+
final FieldODEStateAndDerivative<T> globalPreviousState,
77+
final FieldODEStateAndDerivative<T> globalCurrentState,
78+
final FieldODEStateAndDerivative<T> softPreviousState,
79+
final FieldODEStateAndDerivative<T> softCurrentState,
80+
final FieldEquationsMapper<T> mapper) {
81+
super(field, forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState,
82+
mapper);
8583
}
8684

8785
/** {@inheritDoc} */

hipparchus-ode/src/main/java/org/hipparchus/ode/nonstiff/ClassicalRungeKuttaStateInterpolator.java

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@
5151
* @see ClassicalRungeKuttaIntegrator
5252
*/
5353

54-
class ClassicalRungeKuttaStateInterpolator
55-
extends RungeKuttaStateInterpolator {
54+
public class ClassicalRungeKuttaStateInterpolator extends RungeKuttaStateInterpolator {
5655

5756
/** Serializable version identifier. */
5857
private static final long serialVersionUID = 20160328L;
@@ -66,16 +65,14 @@ class ClassicalRungeKuttaStateInterpolator
6665
* @param softCurrentState end of the restricted step
6766
* @param mapper equations mapper for the all equations
6867
*/
69-
ClassicalRungeKuttaStateInterpolator(final boolean forward,
70-
final double[][] yDotK,
71-
final ODEStateAndDerivative globalPreviousState,
72-
final ODEStateAndDerivative globalCurrentState,
73-
final ODEStateAndDerivative softPreviousState,
74-
final ODEStateAndDerivative softCurrentState,
75-
final EquationsMapper mapper) {
76-
super(forward, yDotK,
77-
globalPreviousState, globalCurrentState, softPreviousState, softCurrentState,
78-
mapper);
68+
public ClassicalRungeKuttaStateInterpolator(final boolean forward,
69+
final double[][] yDotK,
70+
final ODEStateAndDerivative globalPreviousState,
71+
final ODEStateAndDerivative globalCurrentState,
72+
final ODEStateAndDerivative softPreviousState,
73+
final ODEStateAndDerivative softCurrentState,
74+
final EquationsMapper mapper) {
75+
super(forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState, mapper);
7976
}
8077

8178
/** {@inheritDoc} */
@@ -87,9 +84,9 @@ protected ClassicalRungeKuttaStateInterpolator create(final boolean newForward,
8784
final ODEStateAndDerivative newSoftCurrentState,
8885
final EquationsMapper newMapper) {
8986
return new ClassicalRungeKuttaStateInterpolator(newForward, newYDotK,
90-
newGlobalPreviousState, newGlobalCurrentState,
91-
newSoftPreviousState, newSoftCurrentState,
92-
newMapper);
87+
newGlobalPreviousState, newGlobalCurrentState,
88+
newSoftPreviousState, newSoftCurrentState,
89+
newMapper);
9390
}
9491

9592
/** {@inheritDoc} */

hipparchus-ode/src/main/java/org/hipparchus/ode/nonstiff/DormandPrince54FieldStateInterpolator.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* @param <T> the type of the field elements
3737
*/
3838

39-
class DormandPrince54FieldStateInterpolator<T extends CalculusFieldElement<T>>
39+
public class DormandPrince54FieldStateInterpolator<T extends CalculusFieldElement<T>>
4040
extends RungeKuttaFieldStateInterpolator<T> {
4141

4242
/** Last row of the Butcher-array internal weights, element 0. */
@@ -86,16 +86,15 @@ class DormandPrince54FieldStateInterpolator<T extends CalculusFieldElement<T>>
8686
* @param softCurrentState end of the restricted step
8787
* @param mapper equations mapper for the all equations
8888
*/
89-
DormandPrince54FieldStateInterpolator(final Field<T> field, final boolean forward,
90-
final T[][] yDotK,
91-
final FieldODEStateAndDerivative<T> globalPreviousState,
92-
final FieldODEStateAndDerivative<T> globalCurrentState,
93-
final FieldODEStateAndDerivative<T> softPreviousState,
94-
final FieldODEStateAndDerivative<T> softCurrentState,
95-
final FieldEquationsMapper<T> mapper) {
96-
super(field, forward, yDotK,
97-
globalPreviousState, globalCurrentState, softPreviousState, softCurrentState,
98-
mapper);
89+
public DormandPrince54FieldStateInterpolator(final Field<T> field, final boolean forward,
90+
final T[][] yDotK,
91+
final FieldODEStateAndDerivative<T> globalPreviousState,
92+
final FieldODEStateAndDerivative<T> globalCurrentState,
93+
final FieldODEStateAndDerivative<T> softPreviousState,
94+
final FieldODEStateAndDerivative<T> softCurrentState,
95+
final FieldEquationsMapper<T> mapper) {
96+
super(field, forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState,
97+
mapper);
9998
final T one = field.getOne();
10099
a70 = one.newInstance( 35.0 / 384.0);
101100
a72 = one.newInstance( 500.0 / 1113.0);

hipparchus-ode/src/main/java/org/hipparchus/ode/nonstiff/DormandPrince54StateInterpolator.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
*
2929
*/
3030

31-
class DormandPrince54StateInterpolator
32-
extends RungeKuttaStateInterpolator {
31+
public class DormandPrince54StateInterpolator extends RungeKuttaStateInterpolator {
3332

3433
/** Last row of the Butcher-array internal weights, element 0. */
3534
private static final double A70 = 35.0 / 384.0;
@@ -80,16 +79,14 @@ class DormandPrince54StateInterpolator
8079
* @param softCurrentState end of the restricted step
8180
* @param mapper equations mapper for the all equations
8281
*/
83-
DormandPrince54StateInterpolator(final boolean forward,
82+
public DormandPrince54StateInterpolator(final boolean forward,
8483
final double[][] yDotK,
8584
final ODEStateAndDerivative globalPreviousState,
8685
final ODEStateAndDerivative globalCurrentState,
8786
final ODEStateAndDerivative softPreviousState,
8887
final ODEStateAndDerivative softCurrentState,
8988
final EquationsMapper mapper) {
90-
super(forward, yDotK,
91-
globalPreviousState, globalCurrentState, softPreviousState, softCurrentState,
92-
mapper);
89+
super(forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState, mapper);
9390
}
9491

9592
/** {@inheritDoc} */

hipparchus-ode/src/main/java/org/hipparchus/ode/nonstiff/DormandPrince853FieldStateInterpolator.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* @param <T> the type of the field elements
3939
*/
4040

41-
class DormandPrince853FieldStateInterpolator<T extends CalculusFieldElement<T>>
41+
public class DormandPrince853FieldStateInterpolator<T extends CalculusFieldElement<T>>
4242
extends RungeKuttaFieldStateInterpolator<T> {
4343

4444
/** Interpolation weights.
@@ -56,16 +56,15 @@ class DormandPrince853FieldStateInterpolator<T extends CalculusFieldElement<T>>
5656
* @param softCurrentState end of the restricted step
5757
* @param mapper equations mapper for the all equations
5858
*/
59-
DormandPrince853FieldStateInterpolator(final Field<T> field, final boolean forward,
60-
final T[][] yDotK,
61-
final FieldODEStateAndDerivative<T> globalPreviousState,
62-
final FieldODEStateAndDerivative<T> globalCurrentState,
63-
final FieldODEStateAndDerivative<T> softPreviousState,
64-
final FieldODEStateAndDerivative<T> softCurrentState,
65-
final FieldEquationsMapper<T> mapper) {
66-
super(field, forward, yDotK,
67-
globalPreviousState, globalCurrentState, softPreviousState, softCurrentState,
68-
mapper);
59+
public DormandPrince853FieldStateInterpolator(final Field<T> field, final boolean forward,
60+
final T[][] yDotK,
61+
final FieldODEStateAndDerivative<T> globalPreviousState,
62+
final FieldODEStateAndDerivative<T> globalCurrentState,
63+
final FieldODEStateAndDerivative<T> softPreviousState,
64+
final FieldODEStateAndDerivative<T> softCurrentState,
65+
final FieldEquationsMapper<T> mapper) {
66+
super(field, forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState,
67+
mapper);
6968
// interpolation weights
7069
d = MathArrays.buildArray(field, 7, 16);
7170

hipparchus-ode/src/main/java/org/hipparchus/ode/nonstiff/DormandPrince853StateInterpolator.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
*
2929
*/
3030

31-
class DormandPrince853StateInterpolator
32-
extends RungeKuttaStateInterpolator {
31+
public class DormandPrince853StateInterpolator extends RungeKuttaStateInterpolator {
3332

3433
/** Serializable version identifier. */
3534
private static final long serialVersionUID = 20160328L;
@@ -168,16 +167,14 @@ class DormandPrince853StateInterpolator
168167
* @param softCurrentState end of the restricted step
169168
* @param mapper equations mapper for the all equations
170169
*/
171-
DormandPrince853StateInterpolator(final boolean forward,
172-
final double[][] yDotK,
173-
final ODEStateAndDerivative globalPreviousState,
174-
final ODEStateAndDerivative globalCurrentState,
175-
final ODEStateAndDerivative softPreviousState,
176-
final ODEStateAndDerivative softCurrentState,
177-
final EquationsMapper mapper) {
178-
super(forward, yDotK,
179-
globalPreviousState, globalCurrentState, softPreviousState, softCurrentState,
180-
mapper);
170+
public DormandPrince853StateInterpolator(final boolean forward,
171+
final double[][] yDotK,
172+
final ODEStateAndDerivative globalPreviousState,
173+
final ODEStateAndDerivative globalCurrentState,
174+
final ODEStateAndDerivative softPreviousState,
175+
final ODEStateAndDerivative softCurrentState,
176+
final EquationsMapper mapper) {
177+
super(forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState, mapper);
181178
}
182179

183180
/** {@inheritDoc} */

hipparchus-ode/src/main/java/org/hipparchus/ode/nonstiff/EulerFieldStateInterpolator.java

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
* @param <T> the type of the field elements
5050
*/
5151

52-
class EulerFieldStateInterpolator<T extends CalculusFieldElement<T>>
52+
public class EulerFieldStateInterpolator<T extends CalculusFieldElement<T>>
5353
extends RungeKuttaFieldStateInterpolator<T> {
5454

5555
/** Simple constructor.
@@ -62,15 +62,14 @@ class EulerFieldStateInterpolator<T extends CalculusFieldElement<T>>
6262
* @param softCurrentState end of the restricted step
6363
* @param mapper equations mapper for the all equations
6464
*/
65-
EulerFieldStateInterpolator(final Field<T> field, final boolean forward,
66-
final T[][] yDotK,
67-
final FieldODEStateAndDerivative<T> globalPreviousState,
68-
final FieldODEStateAndDerivative<T> globalCurrentState,
69-
final FieldODEStateAndDerivative<T> softPreviousState,
70-
final FieldODEStateAndDerivative<T> softCurrentState,
71-
final FieldEquationsMapper<T> mapper) {
72-
super(field, forward, yDotK,
73-
globalPreviousState, globalCurrentState, softPreviousState, softCurrentState,
65+
public EulerFieldStateInterpolator(final Field<T> field, final boolean forward,
66+
final T[][] yDotK,
67+
final FieldODEStateAndDerivative<T> globalPreviousState,
68+
final FieldODEStateAndDerivative<T> globalCurrentState,
69+
final FieldODEStateAndDerivative<T> softPreviousState,
70+
final FieldODEStateAndDerivative<T> softCurrentState,
71+
final FieldEquationsMapper<T> mapper) {
72+
super(field, forward, yDotK, globalPreviousState, globalCurrentState, softPreviousState, softCurrentState,
7473
mapper);
7574
}
7675

@@ -82,10 +81,8 @@ protected EulerFieldStateInterpolator<T> create(final Field<T> newField, final b
8281
final FieldODEStateAndDerivative<T> newSoftPreviousState,
8382
final FieldODEStateAndDerivative<T> newSoftCurrentState,
8483
final FieldEquationsMapper<T> newMapper) {
85-
return new EulerFieldStateInterpolator<T>(newField, newForward, newYDotK,
86-
newGlobalPreviousState, newGlobalCurrentState,
87-
newSoftPreviousState, newSoftCurrentState,
88-
newMapper);
84+
return new EulerFieldStateInterpolator<>(newField, newForward, newYDotK, newGlobalPreviousState,
85+
newGlobalCurrentState, newSoftPreviousState, newSoftCurrentState, newMapper);
8986
}
9087

9188
/** {@inheritDoc} */
@@ -95,14 +92,12 @@ protected FieldODEStateAndDerivative<T> computeInterpolatedStateAndDerivatives(f
9592
final T time, final T theta,
9693
final T thetaH, final T oneMinusThetaH) {
9794
final T[] interpolatedState;
98-
final T[] interpolatedDerivatives;
9995
if (getGlobalPreviousState() != null && theta.getReal() <= 0.5) {
10096
interpolatedState = previousStateLinearCombination(thetaH);
101-
interpolatedDerivatives = derivativeLinearCombination(time.getField().getOne());
10297
} else {
10398
interpolatedState = currentStateLinearCombination(oneMinusThetaH.negate());
104-
interpolatedDerivatives = derivativeLinearCombination(time.getField().getOne());
10599
}
100+
final T[] interpolatedDerivatives = derivativeLinearCombination(time.getField().getOne());
106101

107102
return mapper.mapStateAndDerivative(time, interpolatedState, interpolatedDerivatives);
108103

0 commit comments

Comments
 (0)