GeneralTerm.java

  1. /* Copyright 2002-2013 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. import org.apache.commons.math3.RealFieldElement;

  19. /** Class for general terms.
  20.  * @param <T> the type of the field elements
  21.  * @author Luc Maisonobe
  22.  */
  23. class GeneralTerm<T extends RealFieldElement<T>> extends SeriesTerm<T> {

  24.     /** Coefficient for mean anomaly of the Moon. */
  25.     private final int cL;

  26.     /** Coefficient for mean anomaly of the Sun. */
  27.     private final int cLPrime;

  28.     /** Coefficient for L - &Omega; where L is the mean longitude of the Moon. */
  29.     private final int cF;

  30.     /** Coefficient for mean elongation of the Moon from the Sun. */
  31.     private final int cD;

  32.     /** Coefficient for mean longitude of the ascending node of the Moon. */
  33.     private final int cOmega;

  34.     /** Coefficient for mean Mercury longitude. */
  35.     private final int cMe;

  36.     /** Coefficient for mean Venus longitude. */
  37.     private final int cVe;

  38.     /** Coefficient for mean Earth longitude. */
  39.     private final int cE;

  40.     /** Coefficient for mean Mars longitude. */
  41.     private final int cMa;

  42.     /** Coefficient for mean Jupiter longitude. */
  43.     private final int cJu;

  44.     /** Coefficient for mean Saturn longitude. */
  45.     private final int cSa;

  46.     /** Coefficient for mean Uranus longitude. */
  47.     private final int cUr;

  48.     /** Coefficient for mean Neptune longitude. */
  49.     private final int cNe;

  50.     /** Coefficient for general accumulated precession in longitude. */
  51.     private final int cPa;

  52.     /** Build a general term for nutation series.
  53.      * @param cL coefficient for mean anomaly of the Moon
  54.      * @param cLPrime coefficient for mean anomaly of the Sun
  55.      * @param cF coefficient for L - &Omega; where L is the mean longitude of the Moon
  56.      * @param cD coefficient for mean elongation of the Moon from the Sun
  57.      * @param cOmega coefficient for mean longitude of the ascending node of the Moon
  58.      * @param cMe coefficient for mean Mercury longitude
  59.      * @param cVe coefficient for mean Venus longitude
  60.      * @param cE coefficient for mean Earth longitude
  61.      * @param cMa coefficient for mean Mars longitude
  62.      * @param cJu coefficient for mean Jupiter longitude
  63.      * @param cSa coefficient for mean Saturn longitude
  64.      * @param cUr coefficient for mean Uranus longitude
  65.      * @param cNe coefficient for mean Neptune longitude
  66.      * @param cPa coefficient for general accumulated precession in longitude
  67.      */
  68.     public GeneralTerm(final int cL, final int cLPrime, final int cF, final int cD, final int cOmega,
  69.                        final int cMe, final int cVe, final int cE, final int cMa, final int cJu,
  70.                        final int cSa, final int cUr, final int cNe, final int cPa) {
  71.         this.cL      = cL;
  72.         this.cLPrime = cLPrime;
  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.         this.cUr     = cUr;
  83.         this.cNe     = cNe;
  84.         this.cPa     = cPa;
  85.     }

  86.     /** {@inheritDoc} */
  87.     protected double argument(final BodiesElements elements) {
  88.         return cL * elements.getL() + cLPrime * elements.getLPrime() + cF * elements.getF() +
  89.                cD * elements.getD() + cOmega * elements.getOmega() +
  90.                cMe * elements.getLMe() + cVe * elements.getLVe() + cE  * elements.getLE() +
  91.                cMa * elements.getLMa() + cJu * elements.getLJu() +
  92.                cSa * elements.getLSa() + cUr * elements.getLUr() +
  93.                cNe * elements.getLNe() + cPa * elements.getPa();

  94.     }

  95.     /** {@inheritDoc} */
  96.     protected T argument(final FieldBodiesElements<T> elements) {
  97.         return elements.getL().multiply(cL).
  98.                 add(elements.getLPrime().multiply(cLPrime)).
  99.                 add(elements.getF().multiply(cF)).
  100.                 add(elements.getD().multiply(cD)).
  101.                 add(elements.getOmega().multiply(cOmega)).
  102.                 add(elements.getLMe().multiply(cMe)).
  103.                 add(elements.getLVe().multiply(cVe)).
  104.                 add(elements.getLE().multiply(cE)).
  105.                 add(elements.getLMa().multiply(cMa)).
  106.                 add(elements.getLJu().multiply(cJu)).
  107.                 add(elements.getLSa().multiply(cSa)).
  108.                 add(elements.getLUr().multiply(cUr)).
  109.                 add(elements.getLNe().multiply(cNe)).
  110.                 add(elements.getPa().multiply(cPa));

  111.     }

  112. }