Example usage for org.apache.commons.math3.ode.sampling StepNormalizerBounds BOTH

List of usage examples for org.apache.commons.math3.ode.sampling StepNormalizerBounds BOTH

Introduction

In this page you can find the example usage for org.apache.commons.math3.ode.sampling StepNormalizerBounds BOTH.

Prototype

StepNormalizerBounds BOTH

To view the source code for org.apache.commons.math3.ode.sampling StepNormalizerBounds BOTH.

Click Source Link

Document

Include both the first and last points.

Usage

From source file:org.fhcrc.honeycomb.metapop.ode.ConsumptionODE.java

public ConsumptionODE(Population pop, double timestep_length) {
    this.pop = pop;
    this.capacity = pop.getCapacity();
    this.subpops = pop.getSubpopulations();
    this.n_subpops = this.subpops.size();
    this.n_states = n_subpops + 1;
    this.timestep_length = timestep_length;

    init = new double[n_states];

    fixedHandler = new FixedStepHandler() {
        @Override/*from   w  ww.  ja v  a  2  s.  co  m*/
        public void init(double t0, double[] y0, double t) {
            step_idx = 0;
        }

        @Override
        public void handleStep(double t, double[] y, double[] yDot, boolean isLast) {
            resource_array[step_idx++] = y[n_subpops];
        }
    };
    //System.out.println("step size: " + timestep_length/steps);
    normalizer = new StepNormalizer(timestep_length * step_size, fixedHandler, StepNormalizerBounds.BOTH);

    integrator.addStepHandler(normalizer);
}