• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java StepInterpolator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;
  }

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:25,代码来源:ContinuousOutputModel.java


示例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;
  }
}
 
开发者ID:biocompibens,项目名称:SME,代码行数:26,代码来源:ContinuousOutputModel.java


示例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;

}
 
开发者ID:biocompibens,项目名称:SME,代码行数:20,代码来源:EventState.java


示例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);
  }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:26,代码来源:DormandPrince54IntegratorTest.java


示例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);
  }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:19,代码来源:ThreeEighthesIntegratorTest.java


示例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);
  }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:19,代码来源:ClassicalRungeKuttaIntegratorTest.java


示例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);
  }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:26,代码来源:DormandPrince853IntegratorTest.java


示例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);
  }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:26,代码来源:GraggBulirschStoerIntegratorTest.java


示例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);
  }
}
 
开发者ID:Quanticol,项目名称:CARMA,代码行数:19,代码来源:GillIntegratorTest.java


示例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);
			}
		});
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:21,代码来源:Solver.java


示例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);
  }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:24,代码来源:GraggBulirschStoerIntegratorTest.java


示例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));
  }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:24,代码来源:DormandPrince54IntegratorTest.java



注:本文中的org.apache.commons.math3.ode.sampling.StepInterpolator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RythmEngine类代码示例发布时间:2022-05-22
下一篇:
Java ScriptEngineService类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap