1   /* Copyright 2002-2023 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 terms that do not depend on far planets and some other elements.
22   * @author Luc Maisonobe
23   */
24  class NoFarPlanetsTerm extends SeriesTerm {
25  
26      /** Coefficient for mean anomaly of the Moon. */
27      private final int cL;
28  
29      /** Coefficient for L - Ω where L is the mean longitude of the Moon. */
30      private final int cF;
31  
32      /** Coefficient for mean elongation of the Moon from the Sun. */
33      private final int cD;
34  
35      /** Coefficient for mean longitude of the ascending node of the Moon. */
36      private final int cOmega;
37  
38      /** Coefficient for mean Mercury longitude. */
39      private final int cMe;
40  
41      /** Coefficient for mean Venus longitude. */
42      private final int cVe;
43  
44      /** Coefficient for mean Earth longitude. */
45      private final int cE;
46  
47      /** Coefficient for mean Mars longitude. */
48      private final int cMa;
49  
50      /** Coefficient for mean Jupiter longitude. */
51      private final int cJu;
52  
53      /** Coefficient for mean Saturn longitude. */
54      private final int cSa;
55  
56      /** Build a planetary term for nutation series.
57       * @param cL coefficient for mean anomaly of the Moon
58       * @param cF coefficient for L - Ω where L is the mean longitude of the Moon
59       * @param cD coefficient for mean elongation of the Moon from the Sun
60       * @param cOmega coefficient for mean longitude of the ascending node of the Moon
61       * @param cMe coefficient for mean Mercury longitude
62       * @param cVe coefficient for mean Venus longitude
63       * @param cE coefficient for mean Earth longitude
64       * @param cMa coefficient for mean Mars longitude
65       * @param cJu coefficient for mean Jupiter longitude
66       * @param cSa coefficient for mean Saturn longitude
67       */
68      NoFarPlanetsTerm(final int cL, final int cF, final int cD, final int cOmega,
69                       final int cMe, final int cVe, final int cE, final int cMa,
70                       final int cJu, final int cSa) {
71          this.cL     = cL;
72          this.cF     = cF;
73          this.cD     = cD;
74          this.cOmega = cOmega;
75          this.cMe    = cMe;
76          this.cVe    = cVe;
77          this.cE     = cE;
78          this.cMa    = cMa;
79          this.cJu    = cJu;
80          this.cSa    = cSa;
81      }
82  
83      /** {@inheritDoc} */
84      protected double argument(final BodiesElements elements) {
85          return cL * elements.getL() + cF * elements.getF() +
86                 cD * elements.getD() + cOmega * elements.getOmega() +
87                 cMe * elements.getLMe() + cVe * elements.getLVe() + cE  * elements.getLE() +
88                 cMa * elements.getLMa() + cJu * elements.getLJu() + cSa * elements.getLSa();
89      }
90  
91      /** {@inheritDoc} */
92      protected double argumentDerivative(final BodiesElements elements) {
93          return cL * elements.getLDot() + cF * elements.getFDot() +
94                 cD * elements.getDDot() + cOmega * elements.getOmegaDot() +
95                 cMe * elements.getLMeDot() + cVe * elements.getLVeDot() + cE  * elements.getLEDot() +
96                 cMa * elements.getLMaDot() + cJu * elements.getLJuDot() + cSa * elements.getLSaDot();
97      }
98  
99      /** {@inheritDoc} */
100     protected <T extends CalculusFieldElement<T>> T argument(final FieldBodiesElements<T> elements) {
101         return elements.getL().multiply(cL).
102                add(elements.getF().multiply(cF)).
103                add(elements.getD().multiply(cD)).
104                add(elements.getOmega().multiply(cOmega)).
105                add(elements.getLMe().multiply(cMe)).
106                add(elements.getLVe().multiply(cVe)).
107                add(elements.getLE().multiply(cE)).
108                add(elements.getLMa().multiply(cMa)).
109                add(elements.getLJu().multiply(cJu)).
110                add(elements.getLSa().multiply(cSa));
111     }
112 
113     /** {@inheritDoc} */
114     protected <T extends CalculusFieldElement<T>> T argumentDerivative(final FieldBodiesElements<T> elements) {
115         return elements.getLDot().multiply(cL).
116                add(elements.getFDot().multiply(cF)).
117                add(elements.getDDot().multiply(cD)).
118                add(elements.getOmegaDot().multiply(cOmega)).
119                add(elements.getLMeDot().multiply(cMe)).
120                add(elements.getLVeDot().multiply(cVe)).
121                add(elements.getLEDot().multiply(cE)).
122                add(elements.getLMaDot().multiply(cMa)).
123                add(elements.getLJuDot().multiply(cJu)).
124                add(elements.getLSaDot().multiply(cSa));
125     }
126 
127 }