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