Example usage for org.apache.commons.math3.ode.sampling StepNormalizer StepNormalizer

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

Introduction

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

Prototype

public StepNormalizer(final double h, final FixedStepHandler handler, final StepNormalizerBounds bounds) 

Source Link

Document

Simple constructor.

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 a2 s . com*/
        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);
}