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 luni-solar only terms.
22   * @author Luc Maisonobe
23   */
24  class LuniSolarTerm extends SeriesTerm {
25  
26      /** Coefficient for mean anomaly of the Moon. */
27      private final int cL;
28  
29      /** Coefficient for mean anomaly of the Sun. */
30      private final int cLPrime;
31  
32      /** Coefficient for L - Ω where L is the mean longitude of the Moon. */
33      private final int cF;
34  
35      /** Coefficient for mean elongation of the Moon from the Sun. */
36      private final int cD;
37  
38      /** Coefficient for mean longitude of the ascending node of the Moon. */
39      private final int cOmega;
40  
41      /** Build a luni-solar term for nutation series.
42       * @param cL coefficient for mean anomaly of the Moon
43       * @param cLPrime coefficient for mean anomaly of the Sun
44       * @param cF coefficient for L - Ω where L is the mean longitude of the Moon
45       * @param cD coefficient for mean elongation of the Moon from the Sun
46       * @param cOmega coefficient for mean longitude of the ascending node of the Moon
47       */
48      LuniSolarTerm(final int cL, final int cLPrime, final int cF, final int cD, final int cOmega) {
49          this.cL      = cL;
50          this.cLPrime = cLPrime;
51          this.cF      = cF;
52          this.cD      = cD;
53          this.cOmega  = cOmega;
54      }
55  
56      /** {@inheritDoc} */
57      protected double argument(final BodiesElements elements) {
58          return cL * elements.getL() + cLPrime * elements.getLPrime() + cF * elements.getF() +
59                 cD * elements.getD() + cOmega * elements.getOmega();
60      }
61  
62      /** {@inheritDoc} */
63      protected double argumentDerivative(final BodiesElements elements) {
64          return cL * elements.getLDot() + cLPrime * elements.getLPrimeDot() + cF * elements.getFDot() +
65                 cD * elements.getDDot() + cOmega * elements.getOmegaDot();
66      }
67  
68      /** {@inheritDoc} */
69      protected <T extends CalculusFieldElement<T>> T argument(final FieldBodiesElements<T> elements) {
70          return elements.getL().multiply(cL).
71                 add(elements.getLPrime().multiply(cLPrime)).
72                 add(elements.getF().multiply(cF)).
73                 add(elements.getD().multiply(cD)).
74                 add(elements.getOmega().multiply(cOmega));
75      }
76  
77      /** {@inheritDoc} */
78      protected <T extends CalculusFieldElement<T>> T argumentDerivative(final FieldBodiesElements<T> elements) {
79          return elements.getLDot().multiply(cL).
80                 add(elements.getLPrimeDot().multiply(cLPrime)).
81                 add(elements.getFDot().multiply(cF)).
82                 add(elements.getDDot().multiply(cD)).
83                 add(elements.getOmegaDot().multiply(cOmega));
84      }
85  
86  }