本文整理汇总了Java中org.apache.commons.math3.ode.sampling.StepInterpolator类的典型用法代码示例。如果您正苦于以下问题:Java StepInterpolator类的具体用法?Java StepInterpolator怎么用?Java StepInterpolator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StepInterpolator类属于org.apache.commons.math3.ode.sampling包,在下文中一共展示了StepInterpolator类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入依赖的package包/类
/** Handle the last accepted step.
* A copy of the information provided by the last step is stored in
* the instance for later use.
* @param interpolator interpolator for the last accepted step.
* @param isLast true if the step is the last one
* @exception MaxCountExceededException if the number of functions evaluations is exceeded
* during step finalization
*/
public void handleStep(final StepInterpolator interpolator, final boolean isLast)
throws MaxCountExceededException {
if (steps.size() == 0) {
initialTime = interpolator.getPreviousTime();
forward = interpolator.isForward();
}
steps.add(interpolator.copy());
if (isLast) {
finalTime = interpolator.getCurrentTime();
index = steps.size() - 1;
}
}
示例2: locatePoint
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入依赖的package包/类
/** Compare a step interval and a double.
* @param time point to locate
* @param interval step interval
* @return -1 if the double is before the interval, 0 if it is in
* the interval, and +1 if it is after the interval, according to
* the interval direction
*/
private int locatePoint(final double time, final StepInterpolator interval) {
if (forward) {
if (time < interval.getPreviousTime()) {
return -1;
} else if (time > interval.getCurrentTime()) {
return +1;
} else {
return 0;
}
}
if (time > interval.getPreviousTime()) {
return -1;
} else if (time < interval.getCurrentTime()) {
return +1;
} else {
return 0;
}
}
示例3: getCompleteState
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入依赖的package包/类
/** Get the complete state (primary and secondary).
* @param interpolator interpolator to use
* @return complete state
*/
private double[] getCompleteState(final StepInterpolator interpolator) {
final double[] complete = new double[expandable.getTotalDimension()];
expandable.getPrimaryMapper().insertEquationData(interpolator.getInterpolatedState(),
complete);
int index = 0;
for (EquationsMapper secondary : expandable.getSecondaryMappers()) {
secondary.insertEquationData(interpolator.getInterpolatedSecondaryState(index++),
complete);
}
return complete;
}
示例4: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入依赖的package包/类
public void handleStep(StepInterpolator interpolator, boolean isLast)
throws MaxCountExceededException {
++nbSteps;
for (int a = 1; a < 10; ++a) {
double prev = interpolator.getPreviousTime();
double curr = interpolator.getCurrentTime();
double interp = ((10 - a) * prev + a * curr) / 10;
interpolator.setInterpolatedTime(interp);
double[] interpolatedY = interpolator.getInterpolatedState ();
double[] theoreticalY = pb.computeTheoreticalState(interpolator.getInterpolatedTime());
double dx = interpolatedY[0] - theoreticalY[0];
double dy = interpolatedY[1] - theoreticalY[1];
double error = dx * dx + dy * dy;
if (error > maxError) {
maxError = error;
}
}
if (isLast) {
Assert.assertTrue(maxError < 7.0e-10);
Assert.assertTrue(nbSteps < 400);
}
}
示例5: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入依赖的package包/类
public void handleStep(StepInterpolator interpolator, boolean isLast)
throws MaxCountExceededException {
double[] interpolatedY = interpolator.getInterpolatedState();
double[] theoreticalY = pb.computeTheoreticalState(interpolator.getCurrentTime());
double dx = interpolatedY[0] - theoreticalY[0];
double dy = interpolatedY[1] - theoreticalY[1];
double error = dx * dx + dy * dy;
if (error > maxError) {
maxError = error;
}
if (isLast) {
// even with more than 1000 evaluations per period,
// RK4 is not able to integrate such an eccentric
// orbit with a good accuracy
Assert.assertTrue(maxError > 0.005);
}
}
示例6: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入依赖的package包/类
public void handleStep(StepInterpolator interpolator, boolean isLast)
throws MaxCountExceededException {
double[] interpolatedY = interpolator.getInterpolatedState ();
double[] theoreticalY = pb.computeTheoreticalState(interpolator.getCurrentTime());
double dx = interpolatedY[0] - theoreticalY[0];
double dy = interpolatedY[1] - theoreticalY[1];
double error = dx * dx + dy * dy;
if (error > maxError) {
maxError = error;
}
if (isLast) {
// even with more than 1000 evaluations per period,
// RK4 is not able to integrate such an eccentric
// orbit with a good accuracy
Assert.assertTrue(maxError > 0.005);
}
}
示例7: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入依赖的package包/类
public void handleStep(StepInterpolator interpolator, boolean isLast)
throws MaxCountExceededException {
++nbSteps;
for (int a = 1; a < 10; ++a) {
double prev = interpolator.getPreviousTime();
double curr = interpolator.getCurrentTime();
double interp = ((10 - a) * prev + a * curr) / 10;
interpolator.setInterpolatedTime(interp);
double[] interpolatedY = interpolator.getInterpolatedState ();
double[] theoreticalY = pb.computeTheoreticalState(interpolator.getInterpolatedTime());
double dx = interpolatedY[0] - theoreticalY[0];
double dy = interpolatedY[1] - theoreticalY[1];
double error = dx * dx + dy * dy;
if (error > maxError) {
maxError = error;
}
}
if (isLast) {
Assert.assertTrue(maxError < 2.4e-10);
Assert.assertTrue(nbSteps < 150);
}
}
示例8: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入依赖的package包/类
public void handleStep(StepInterpolator interpolator, boolean isLast)
throws MaxCountExceededException {
++nbSteps;
for (int a = 1; a < 100; ++a) {
double prev = interpolator.getPreviousTime();
double curr = interpolator.getCurrentTime();
double interp = ((100 - a) * prev + a * curr) / 100;
interpolator.setInterpolatedTime(interp);
double[] interpolatedY = interpolator.getInterpolatedState ();
double[] theoreticalY = pb.computeTheoreticalState(interpolator.getInterpolatedTime());
double dx = interpolatedY[0] - theoreticalY[0];
double dy = interpolatedY[1] - theoreticalY[1];
double error = dx * dx + dy * dy;
if (error > maxError) {
maxError = error;
}
}
if (isLast) {
Assert.assertTrue(maxError < 2.7e-6);
Assert.assertTrue(nbSteps < 80);
}
}
示例9: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入依赖的package包/类
public void handleStep(StepInterpolator interpolator, boolean isLast)
throws MaxCountExceededException {
double[] interpolatedY = interpolator.getInterpolatedState();
double[] theoreticalY = pb.computeTheoreticalState(interpolator.getCurrentTime());
double dx = interpolatedY[0] - theoreticalY[0];
double dy = interpolatedY[1] - theoreticalY[1];
double error = dx * dx + dy * dy;
if (error > maxError) {
maxError = error;
}
if (isLast) {
// even with more than 1000 evaluations per period,
// RK4 is not able to integrate such an eccentric
// orbit with a good accuracy
Assert.assertTrue(maxError > 0.001);
}
}
示例10: Solver
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入依赖的package包/类
Solver(final double step, final FirstOrderIntegrator integrator,
final GamaMap<String, IList<Double>> integrated_val) {
this.step = step;
this.integrator = integrator;
if (integrated_val != null)
integrator.addStepHandler(new StepHandler() {
@Override
public void init(final double t0, final double[] y0, final double t) {
}
@Override
public void handleStep(final StepInterpolator interpolator, final boolean isLast) {
final double time = interpolator.getCurrentTime();
final double[] y = interpolator.getInterpolatedState();
count++;
storeValues(time, y, integrated_val);
}
});
}
示例11: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入依赖的package包/类
public void handleStep(StepInterpolator interpolator,
boolean isLast) {
double step = FastMath.abs(interpolator.getCurrentTime()
- interpolator.getPreviousTime());
if (firstTime) {
minStep = FastMath.abs(step);
maxStep = minStep;
firstTime = false;
} else {
if (step < minStep) {
minStep = step;
}
if (step > maxStep) {
maxStep = step;
}
}
if (isLast) {
Assert.assertTrue(minStep < 8.2e-3);
Assert.assertTrue(maxStep > 1.5);
}
}
示例12: handleStep
import org.apache.commons.math3.ode.sampling.StepInterpolator; //导入依赖的package包/类
public void handleStep(StepInterpolator interpolator,
boolean isLast) {
double step = FastMath.abs(interpolator.getCurrentTime()
- interpolator.getPreviousTime());
if (firstTime) {
minStep = FastMath.abs(step);
maxStep = minStep;
firstTime = false;
} else {
if (step < minStep) {
minStep = step;
}
if (step > maxStep) {
maxStep = step;
}
}
if (isLast) {
Assert.assertTrue(minStep < (1.0 / 450.0));
Assert.assertTrue(maxStep > (1.0 / 4.2));
}
}