diff --git a/src/main/java/org/apache/commons/math3/ode/FieldFirstOrderIntegrator.java b/src/main/java/org/apache/commons/math3/ode/FieldFirstOrderIntegrator.java new file mode 100644 index 000000000..973b59c8f --- /dev/null +++ b/src/main/java/org/apache/commons/math3/ode/FieldFirstOrderIntegrator.java @@ -0,0 +1,168 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.math3.ode; + +import java.util.Collection; + +import org.apache.commons.math3.RealFieldElement; +import org.apache.commons.math3.exception.DimensionMismatchException; +import org.apache.commons.math3.exception.MaxCountExceededException; +import org.apache.commons.math3.exception.NoBracketingException; +import org.apache.commons.math3.exception.NumberIsTooSmallException; +import org.apache.commons.math3.ode.events.FieldEventHandler; +import org.apache.commons.math3.ode.sampling.FieldStepHandler; + +/** This interface represents a first order integrator for + * differential equations. + + *
The classes which are devoted to solve first order differential + * equations should implement this interface. The problems which can + * be handled should implement the {@link + * FirstOrderDifferentialEquations} interface.
+ * + * @see FieldFirstOrderDifferentialEquations + * @paramThe handler will be called by the integrator for each accepted + * step.
+ * @param handler handler for the accepted steps + * @see #getStepHandlers() + * @see #clearStepHandlers() + */ + void addStepHandler(FieldStepHandlerThis method can be called during integration (typically by + * the object implementing the {@link FirstOrderDifferentialEquations + * differential equations} problem) if the value of the current step that + * is attempted is needed.
+ *The result is undefined if the method is called outside of
+ * calls to integrate
.
This method can be called during integration (typically by + * the object implementing the {@link FirstOrderDifferentialEquations + * differential equations} problem) if the signed value of the current stepsize + * that is tried is needed.
+ *The result is undefined if the method is called outside of
+ * calls to integrate
.
The purpose of this method is to avoid infinite loops which can occur + * for example when stringent error constraints are set or when lots of + * discrete events are triggered, thus leading to many rejected steps.
+ * @param maxEvaluations maximal number of function evaluations (negative + * values are silently converted to maximal integer value, thus representing + * almost unlimited evaluations) + */ + void setMaxEvaluations(int maxEvaluations); + + /** Get the maximal number of functions evaluations. + * @return maximal number of functions evaluations + */ + int getMaxEvaluations(); + + /** Get the number of evaluations of the differential equations function. + *
+ * The number of evaluations corresponds to the last call to the
+ * integrate
method. It is 0 if the method has not been called yet.
+ *
This method solves an Initial Value Problem (IVP).
+ *Since this method stores some internal state variables made + * available in its public interface during integration ({@link + * #getCurrentSignedStepsize()}), it is not thread-safe.
+ * @param equations differential equations to integrate + * @param initialState initial state (time, primary and secondary state vectors) + * @param finalTime target time for the integration + * (can be set to a value smaller than {@code t0} for backward integration) + * @return final state, its time will be the same as {@code finalTime} if + * integration reached its target, but may be different if some {@link + * org.apache.commons.math3.ode.events.FieldEventHandler} stops it at some point. + * @exception DimensionMismatchException if arrays dimension do not match equations settings + * @exception NumberIsTooSmallException if integration step is too small + * @exception MaxCountExceededException if the number of functions evaluations is exceeded + * @exception NoBracketingException if the location of an event cannot be bracketed + */ + FieldODEStateAndDerivative