1   /* Copyright 2002-2024 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.data;
18  
19  import org.hipparchus.CalculusFieldElement;
20  
21  /** Class for planetary only terms.
22   * @author Luc Maisonobe
23   */
24  class PlanetaryTerm extends SeriesTerm {
25  
26      /** Coefficient for mean Mercury longitude. */
27      private final int cMe;
28  
29      /** Coefficient for mean Venus longitude. */
30      private final int cVe;
31  
32      /** Coefficient for mean Earth longitude. */
33      private final int cE;
34  
35      /** Coefficient for mean Mars longitude. */
36      private final int cMa;
37  
38      /** Coefficient for mean Jupiter longitude. */
39      private final int cJu;
40  
41      /** Coefficient for mean Saturn longitude. */
42      private final int cSa;
43  
44      /** Coefficient for mean Uranus longitude. */
45      private final int cUr;
46  
47      /** Coefficient for mean Neptune longitude. */
48      private final int cNe;
49  
50      /** Coefficient for general accumulated precession in longitude. */
51      private final int cPa;
52  
53      /** Build a planetary term for nutation series.
54       * @param cMe coefficient for mean Mercury longitude
55       * @param cVe coefficient for mean Venus longitude
56       * @param cE coefficient for mean Earth longitude
57       * @param cMa coefficient for mean Mars longitude
58       * @param cJu coefficient for mean Jupiter longitude
59       * @param cSa coefficient for mean Saturn longitude
60       * @param cUr coefficient for mean Uranus longitude
61       * @param cNe coefficient for mean Neptune longitude
62       * @param cPa coefficient for general accumulated precession in longitude
63        */
64      PlanetaryTerm(final int cMe, final int cVe, final int cE, final int cMa, final int cJu,
65                    final int cSa, final int cUr, final int cNe, final int cPa) {
66          this.cMe = cMe;
67          this.cVe = cVe;
68          this.cE  = cE;
69          this.cMa = cMa;
70          this.cJu = cJu;
71          this.cSa = cSa;
72          this.cUr = cUr;
73          this.cNe = cNe;
74          this.cPa = cPa;
75      }
76  
77      /** {@inheritDoc} */
78      protected double argument(final BodiesElements elements) {
79          return cMe * elements.getLMe() + cVe * elements.getLVe() + cE  * elements.getLE() +
80                 cMa * elements.getLMa() + cJu * elements.getLJu() +
81                 cSa * elements.getLSa() + cUr * elements.getLUr() +
82                 cNe * elements.getLNe() + cPa * elements.getPa();
83      }
84  
85      /** {@inheritDoc} */
86      protected double argumentDerivative(final BodiesElements elements) {
87          return cMe * elements.getLMeDot() + cVe * elements.getLVeDot() + cE  * elements.getLEDot() +
88                 cMa * elements.getLMaDot() + cJu * elements.getLJuDot() +
89                 cSa * elements.getLSaDot() + cUr * elements.getLUrDot() +
90                 cNe * elements.getLNeDot() + cPa * elements.getPaDot();
91      }
92  
93      /** {@inheritDoc} */
94      protected <T extends CalculusFieldElement<T>> T argument(final FieldBodiesElements<T> elements) {
95          return elements.getLMe().multiply(cMe).
96                 add(elements.getLVe().multiply(cVe)).
97                 add(elements.getLE().multiply(cE)).
98                 add(elements.getLMa().multiply(cMa)).
99                 add(elements.getLJu().multiply(cJu)).
100                add(elements.getLSa().multiply(cSa)).
101                add(elements.getLUr().multiply(cUr)).
102                add(elements.getLNe().multiply(cNe)).
103                add(elements.getPa().multiply(cPa));
104     }
105 
106     /** {@inheritDoc} */
107     protected <T extends CalculusFieldElement<T>> T argumentDerivative(final FieldBodiesElements<T> elements) {
108         return elements.getLMeDot().multiply(cMe).
109                add(elements.getLVeDot().multiply(cVe)).
110                add(elements.getLEDot().multiply(cE)).
111                add(elements.getLMaDot().multiply(cMa)).
112                add(elements.getLJuDot().multiply(cJu)).
113                add(elements.getLSaDot().multiply(cSa)).
114                add(elements.getLUrDot().multiply(cUr)).
115                add(elements.getLNeDot().multiply(cNe)).
116                add(elements.getPaDot().multiply(cPa));
117     }
118 
119 }