View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  /*
19   * This is not the original file distributed by the Apache Software Foundation
20   * It has been modified by the Hipparchus project
21   */
22  
23  package org.hipparchus.migration.ode;
24  
25  import org.hipparchus.exception.MathIllegalArgumentException;
26  import org.hipparchus.exception.MathIllegalStateException;
27  import org.hipparchus.ode.SecondaryODE;
28  
29  /**
30   * This interface allows users to add secondary differential equations to a primary
31   * set of differential equations.
32   * <p>
33   * In some cases users may need to integrate some problem-specific equations along
34   * with a primary set of differential equations. One example is optimal control where
35   * adjoined parameters linked to the minimized hamiltonian must be integrated.
36   * </p>
37   * <p>
38   * This interface allows users to add such equations to a primary set of {@link
39   * FirstOrderDifferentialEquations first order differential equations}
40   * thanks to the {@link
41   * org.hipparchus.ode.ExpandableODE#addSecondaryEquations(SecondaryODE)}
42   * method.
43   * </p>
44   * @see org.hipparchus.ode.ExpandableODE
45   * @deprecated as of 1.0, replaced with {@link SecondaryODE}
46   */
47  @Deprecated
48  public interface SecondaryEquations extends SecondaryODE {
49  
50      /** Compute the derivatives related to the secondary state parameters.
51       * <p>
52       * The default implementation calls {@link #computeDerivatives(double, double[],
53       * double[], double[], double[])}.
54       * </p>
55       * @param t current value of the independent <I>time</I> variable
56       * @param primary array containing the current value of the primary state vector
57       * @param primaryDot array containing the derivative of the primary state vector
58       * @param secondary array containing the current value of the secondary state vector
59       * @return derivative of the secondary state vector
60       * @exception MathIllegalStateException if the number of functions evaluations is exceeded
61       * @exception MathIllegalArgumentException if arrays dimensions do not match equations settings
62       */
63      @Override
64      default double[] computeDerivatives(final double t, final double[] primary, final double[] primaryDot,
65                                          final double[] secondary)
66          throws MathIllegalArgumentException, MathIllegalStateException {
67          final double[] secondaryDot = new double[secondary.length];
68          computeDerivatives(t, primary, primaryDot, secondary, secondaryDot);
69          return secondaryDot;
70      }
71  
72      /** Compute the derivatives related to the secondary state parameters.
73       * @param t current value of the independent <I>time</I> variable
74       * @param primary array containing the current value of the primary state vector
75       * @param primaryDot array containing the derivative of the primary state vector
76       * @param secondary array containing the current value of the secondary state vector
77       * @param secondaryDot placeholder array where to put the derivative of the secondary state vector
78       * @exception MathIllegalStateException if the number of functions evaluations is exceeded
79       * @exception MathIllegalArgumentException if arrays dimensions do not match equations settings
80       */
81      void computeDerivatives(double t, double[] primary, double[] primaryDot,
82                              double[] secondary, double[] secondaryDot)
83          throws MathIllegalArgumentException, MathIllegalStateException;
84  
85  }