1   /* Copyright 2002-2025 CS GROUP
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.propagation.conversion.osc2mean;
18  
19  import org.hipparchus.CalculusFieldElement;
20  import org.orekit.orbits.FieldOrbit;
21  import org.orekit.orbits.Orbit;
22  
23  /**
24   * Interface for theories that convert osculating into mean orbit.
25   *
26   * @author Pascal Parraud
27   * @since 13.0
28   */
29  public interface MeanTheory {
30  
31      /** Gets the name of the theory used for osculating to mean conversion.
32       * @return the actual theory
33       */
34      String getTheoryName();
35  
36      /** Gets reference radius of the central body (m).
37       * @return reference radius of the central body
38       */
39      double getReferenceRadius();
40  
41      /** Pre-treatment of the osculating orbit to be converted.
42       * <p>By default, no pre-treatment is applied to the osculating orbit.</p>
43       * @param osculating the osculating orbit to be treated
44       * @return preprocessed osculating orbit
45       */
46      default Orbit preprocessing(Orbit osculating) {
47          return osculating;
48      }
49  
50      /** Rough initialization of the mean orbit.
51       * <p>By default, the mean orbit is initialized with the osculating orbit.</p>
52       * @param osculating the osculating orbit
53       * @return initial mean orbit
54       */
55      default Orbit initialize(Orbit osculating) {
56          return osculating;
57      }
58  
59      /** Gets osculating orbit from mean orbit.
60       * @param mean mean orbit
61       * @return osculating orbit
62       */
63      Orbit meanToOsculating(Orbit mean);
64  
65      /** Post-treatment of the converted mean orbit.
66       * <p>By default, the mean orbit returned is of the same
67       * type as the osculating orbit to be converted.</p>
68       * @param osculating the osculating orbit to be converted
69       * @param mean the converted mean orbit
70       * @return postprocessed mean orbit
71       */
72      default Orbit postprocessing(Orbit osculating, Orbit mean) {
73          return osculating.getType().convertType(mean);
74      }
75  
76      /** Pre-treatment of the osculating orbit to be converted.
77       * <p>By default, no pre-treatment is applied to the osculating orbit.</p>
78       * @param <T> type of the field elements
79       * @param osculating the osculating orbit to be treated
80       * @return preprocessed osculating orbit
81       */
82      default <T extends CalculusFieldElement<T>> FieldOrbit<T> preprocessing(FieldOrbit<T> osculating) {
83          return osculating;
84      }
85  
86      /** Rough initialization of the mean orbit.
87       * <p>By default, the mean orbit is initialized with the osculating orbit.</p>
88       * @param <T> type of the field elements
89       * @param osculating the osculating orbit
90       * @return initial mean orbit
91       */
92      default <T extends CalculusFieldElement<T>> FieldOrbit<T> initialize(FieldOrbit<T> osculating) {
93          return osculating;
94      }
95  
96      /** Gets osculating orbit from mean orbit.
97       * @param <T> type of the field elements
98       * @param mean mean orbit
99       * @return osculating orbit
100      */
101     <T extends CalculusFieldElement<T>> FieldOrbit<T> meanToOsculating(FieldOrbit<T> mean);
102 
103     /** Post-treatment of the converted mean orbit.
104      * <p>By default, the mean orbit returned is of the same
105      * type as the osculating orbit to be converted.</p>
106      * @param <T> type of the field elements
107      * @param osculating the osculating orbit to be converted
108      * @param mean the converted mean orbit
109      * @return postprocessed mean orbit
110      */
111     default <T extends CalculusFieldElement<T>> FieldOrbit<T> postprocessing(FieldOrbit<T> osculating,
112                                                                              FieldOrbit<T> mean) {
113         return osculating.getType().convertType(mean);
114     }
115 
116 }