From 97a65021c7b9efe570dd0688c871c190be3bb445 Mon Sep 17 00:00:00 2001 From: Luc Maisonobe Date: Sun, 15 Nov 2015 10:41:39 +0100 Subject: [PATCH] Whitespace. --- .../ode/nonstiff/EulerFieldIntegrator.java | 36 ++++---- .../nonstiff/EulerFieldStepInterpolator.java | 91 +++++++++---------- 2 files changed, 62 insertions(+), 65 deletions(-) diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java index ac380fef7..c591e3edd 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldIntegrator.java @@ -51,26 +51,26 @@ import org.apache.commons.math3.RealFieldElement; public class EulerFieldIntegrator> extends RungeKuttaFieldIntegrator { - /** Time steps Butcher array. */ - private static final double[] STATIC_C = { - }; + /** Time steps Butcher array. */ + private static final double[] STATIC_C = { + }; - /** Internal weights Butcher array. */ - private static final double[][] STATIC_A = { - }; + /** Internal weights Butcher array. */ + private static final double[][] STATIC_A = { + }; - /** Propagation weights Butcher array. */ - private static final double[] STATIC_B = { - 1.0 - }; + /** Propagation weights Butcher array. */ + private static final double[] STATIC_B = { + 1.0 + }; - /** Simple constructor. - * Build an Euler integrator with the given step. - * @param field field to which the time and state vector elements belong - * @param step integration step - */ - public EulerFieldIntegrator(final Field field, final T step) { - super(field, "Euler", STATIC_C, STATIC_A, STATIC_B, new EulerFieldStepInterpolator(), step); - } + /** Simple constructor. + * Build an Euler integrator with the given step. + * @param field field to which the time and state vector elements belong + * @param step integration step + */ + public EulerFieldIntegrator(final Field field, final T step) { + super(field, "Euler", STATIC_C, STATIC_A, STATIC_B, new EulerFieldStepInterpolator(), step); + } } diff --git a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java index 777a00f84..1b55db858 100644 --- a/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java +++ b/src/main/java/org/apache/commons/math3/ode/nonstiff/EulerFieldStepInterpolator.java @@ -47,57 +47,54 @@ import org.apache.commons.math3.util.MathArrays; */ class EulerFieldStepInterpolator> - extends RungeKuttaFieldStepInterpolator { + extends RungeKuttaFieldStepInterpolator { - /** Simple constructor. - * This constructor builds an instance that is not usable yet, the - * {@link - * org.apache.commons.math3.ode.sampling.AbstractStepInterpolator#reinitialize} - * method should be called before using the instance in order to - * initialize the internal arrays. This constructor is used only - * in order to delay the initialization in some cases. The {@link - * RungeKuttaIntegrator} class uses the prototyping design pattern - * to create the step interpolators by cloning an uninitialized model - * and later initializing the copy. - */ - EulerFieldStepInterpolator() { - } + /** Simple constructor. + * This constructor builds an instance that is not usable yet, the + * {@link + * org.apache.commons.math3.ode.sampling.AbstractStepInterpolator#reinitialize} + * method should be called before using the instance in order to + * initialize the internal arrays. This constructor is used only + * in order to delay the initialization in some cases. The {@link + * RungeKuttaIntegrator} class uses the prototyping design pattern + * to create the step interpolators by cloning an uninitialized model + * and later initializing the copy. + */ + EulerFieldStepInterpolator() { + } - /** Copy constructor. - * @param interpolator interpolator to copy from. The copy is a deep - * copy: its arrays are separated from the original arrays of the - * instance - */ - EulerFieldStepInterpolator(final EulerFieldStepInterpolator interpolator) { - super(interpolator); - } + /** Copy constructor. + * @param interpolator interpolator to copy from. The copy is a deep + * copy: its arrays are separated from the original arrays of the + * instance + */ + EulerFieldStepInterpolator(final EulerFieldStepInterpolator interpolator) { + super(interpolator); + } - /** {@inheritDoc} */ - @Override - protected EulerFieldStepInterpolator doCopy() { - return new EulerFieldStepInterpolator(this); - } + /** {@inheritDoc} */ + @Override + protected EulerFieldStepInterpolator doCopy() { + return new EulerFieldStepInterpolator(this); + } + /** {@inheritDoc} */ + @Override + protected FieldODEStateAndDerivative computeInterpolatedStateAndDerivatives(final FieldEquationsMapper mapper, + final T time, final T theta, + final T oneMinusThetaH) { + final T[] interpolatedState = MathArrays.buildArray(theta.getField(), previousState.length); + if ((previousState != null) && (theta.getReal() <= 0.5)) { + for (int i = 0; i < previousState.length; ++i) { + interpolatedState[i] = previousState[i].add(theta.multiply(h).multiply(yDotK[0][i])); + } + } else { + for (int i = 0; i < previousState.length; ++i) { + interpolatedState[i] = currentState[i].subtract(oneMinusThetaH.multiply(yDotK[0][i])); + } + } - /** {@inheritDoc} */ - @Override - protected FieldODEStateAndDerivative computeInterpolatedStateAndDerivatives(final FieldEquationsMapper mapper, - final T time, final T theta, - final T oneMinusThetaH) { - final T[] interpolatedState = MathArrays.buildArray(theta.getField(), previousState.length); - if ((previousState != null) && (theta.getReal() <= 0.5)) { - for (int i = 0; i < previousState.length; ++i) { - interpolatedState[i] = previousState[i].add(theta.multiply(h).multiply(yDotK[0][i])); - } - } else { - for (int i = 0; i < previousState.length; ++i) { - interpolatedState[i] = currentState[i].subtract(oneMinusThetaH.multiply(yDotK[0][i])); - } - } - - return new FieldODEStateAndDerivative(time, - interpolatedState, - yDotK[0]); - } + return new FieldODEStateAndDerivative(time, interpolatedState, yDotK[0]); + } }