Restrictied fields visibility in tests.

This commit is contained in:
Luc Maisonobe 2016-01-06 12:39:46 +01:00
parent 87d71e9d46
commit 121c6b6892
5 changed files with 15 additions and 15 deletions

View File

@ -56,16 +56,16 @@ public class TestProblem1
public void doComputeDerivatives(double t, double[] y, double[] yDot) { public void doComputeDerivatives(double t, double[] y, double[] yDot) {
// compute the derivatives // compute the derivatives
for (int i = 0; i < n; ++i) for (int i = 0; i < getDimension(); ++i)
yDot[i] = -y[i]; yDot[i] = -y[i];
} }
@Override @Override
public double[] computeTheoreticalState(double t) { public double[] computeTheoreticalState(double t) {
double c = FastMath.exp (t0 - t); double c = FastMath.exp (getInitialTime() - t);
for (int i = 0; i < n; ++i) { for (int i = 0; i < getDimension(); ++i) {
y[i] = c * y0[i]; y[i] = c * getInitialState()[i];
} }
return y; return y;
} }

View File

@ -57,7 +57,7 @@ public class TestProblem2
public void doComputeDerivatives(double t, double[] y, double[] yDot) { public void doComputeDerivatives(double t, double[] y, double[] yDot) {
// compute the derivatives // compute the derivatives
for (int i = 0; i < n; ++i) for (int i = 0; i < getDimension(); ++i)
yDot[i] = t * (t * t - y[i]); yDot[i] = t * (t * t - y[i]);
} }
@ -66,7 +66,7 @@ public class TestProblem2
public double[] computeTheoreticalState(double t) { public double[] computeTheoreticalState(double t) {
double t2 = t * t; double t2 = t * t;
double c = t2 + 2 * (FastMath.exp (-0.5 * t2) - 1); double c = t2 + 2 * (FastMath.exp (-0.5 * t2) - 1);
for (int i = 0; i < n; ++i) { for (int i = 0; i < getDimension(); ++i) {
y[i] = c; y[i] = c;
} }
return y; return y;

View File

@ -28,7 +28,7 @@ public class TestProblem5 extends TestProblem1 {
* Simple constructor. * Simple constructor.
*/ */
public TestProblem5() { public TestProblem5() {
setFinalConditions(2 * t0 - t1); setFinalConditions(2 * getInitialTime() - getFinalTime());
} }
} }

View File

@ -58,7 +58,7 @@ public class TestProblem6
double t2 = t * t; double t2 = t * t;
double t4 = t2 * t2; double t4 = t2 * t2;
double t5 = t4 * t; double t5 = t4 * t;
for (int i = 0; i < n; ++i) { for (int i = 0; i < getDimension(); ++i) {
yDot[i] = 3 * t5 - y[i]; yDot[i] = 3 * t5 - y[i];
} }
@ -66,7 +66,7 @@ public class TestProblem6
@Override @Override
public double[] computeTheoreticalState(double t) { public double[] computeTheoreticalState(double t) {
for (int i = 0; i < n; ++i) { for (int i = 0; i < getDimension(); ++i) {
y[i] = ((((3 * t - 15) * t + 60) * t - 180) * t + 360) * t - 360; y[i] = ((((3 * t - 15) * t + 60) * t - 180) * t + 360) * t - 360;
} }
return y; return y;

View File

@ -28,22 +28,22 @@ public abstract class TestProblemAbstract
implements FirstOrderDifferentialEquations { implements FirstOrderDifferentialEquations {
/** Dimension of the problem. */ /** Dimension of the problem. */
protected int n; private int n;
/** Number of functions calls. */ /** Number of functions calls. */
protected int calls; private int calls;
/** Initial time */ /** Initial time */
protected double t0; private double t0;
/** Initial state */ /** Initial state */
protected double[] y0; private double[] y0;
/** Final time */ /** Final time */
protected double t1; private double t1;
/** Error scale */ /** Error scale */
protected double[] errorScale; private double[] errorScale;
/** /**
* Simple constructor. * Simple constructor.