1   /* Copyright 2022-2025 Romain Serra
2    * Licensed to CS GROUP (CS) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * CS 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  package org.orekit.control.indirect.adjoint;
18  
19  import org.hipparchus.CalculusFieldElement;
20  import org.orekit.frames.Frame;
21  import org.orekit.time.AbsoluteDate;
22  import org.orekit.time.FieldAbsoluteDate;
23  
24  /**
25   * Interface to define terms in the adjoint equations and Hamiltonian for Cartesian coordinates.
26   * @author Romain Serra
27   * @see CartesianAdjointDerivativesProvider
28   * @see FieldCartesianAdjointDerivativesProvider
29   * @since 12.2
30   */
31  public interface CartesianAdjointEquationTerm {
32  
33      /**
34       * Computes the contribution to the rates of the adjoint variables.
35       *
36       * @param date             date
37       * @param stateVariables   state variables
38       * @param adjointVariables adjoint variables
39       * @param frame            propagation frame
40       * @return contribution to the adjoint derivative vector
41       */
42      double[] getRatesContribution(AbsoluteDate date, double[] stateVariables, double[] adjointVariables, Frame frame);
43  
44      /**
45       * Computes the contribution to the rates of the adjoint variables.
46       *
47       * @param <T>              field type
48       * @param date             date
49       * @param stateVariables   state variables
50       * @param adjointVariables adjoint variables
51       * @param frame            propagation frame
52       * @return contribution to the adjoint derivative vector
53       */
54      <T extends CalculusFieldElement<T>> T[] getFieldRatesContribution(FieldAbsoluteDate<T> date, T[] stateVariables, T[] adjointVariables, Frame frame);
55  
56      /**
57       * Computes the contribution to the Hamiltonian.
58       *
59       * @param date             date
60       * @param stateVariables   state variables
61       * @param adjointVariables adjoint variables
62       * @param frame            propagation frame
63       * @return contribution to the Hamiltonian
64       */
65      double getHamiltonianContribution(AbsoluteDate date, double[] stateVariables, double[] adjointVariables, Frame frame);
66  
67      /**
68       * Computes the contribution to the Hamiltonian.
69       *
70       * @param date             date
71       * @param stateVariables   state variables
72       * @param adjointVariables adjoint variables
73       * @param frame            propagation frame
74       * @param <T> field type
75       * @return contribution to the Hamiltonian
76       */
77      <T extends CalculusFieldElement<T>> T getFieldHamiltonianContribution(FieldAbsoluteDate<T> date,
78                                                                            T[] stateVariables,
79                                                                            T[] adjointVariables, Frame frame);
80  
81  }