PlanetaryTerm.java

  1. /* Copyright 2002-2016 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 planetary only terms.
  20.  * @param <T> the type of the field elements
  21.  * @author Luc Maisonobe
  22.  */
  23. class PlanetaryTerm<T extends RealFieldElement<T>> extends SeriesTerm<T> {

  24.     /** Coefficient for mean Mercury longitude. */
  25.     private final int cMe;

  26.     /** Coefficient for mean Venus longitude. */
  27.     private final int cVe;

  28.     /** Coefficient for mean Earth longitude. */
  29.     private final int cE;

  30.     /** Coefficient for mean Mars longitude. */
  31.     private final int cMa;

  32.     /** Coefficient for mean Jupiter longitude. */
  33.     private final int cJu;

  34.     /** Coefficient for mean Saturn longitude. */
  35.     private final int cSa;

  36.     /** Coefficient for mean Uranus longitude. */
  37.     private final int cUr;

  38.     /** Coefficient for mean Neptune longitude. */
  39.     private final int cNe;

  40.     /** Coefficient for general accumulated precession in longitude. */
  41.     private final int cPa;

  42.     /** Build a planetary term for nutation series.
  43.      * @param cMe coefficient for mean Mercury longitude
  44.      * @param cVe coefficient for mean Venus longitude
  45.      * @param cE coefficient for mean Earth longitude
  46.      * @param cMa coefficient for mean Mars longitude
  47.      * @param cJu coefficient for mean Jupiter longitude
  48.      * @param cSa coefficient for mean Saturn longitude
  49.      * @param cUr coefficient for mean Uranus longitude
  50.      * @param cNe coefficient for mean Neptune longitude
  51.      * @param cPa coefficient for general accumulated precession in longitude
  52.       */
  53.     PlanetaryTerm(final int cMe, final int cVe, final int cE, final int cMa, final int cJu,
  54.                          final int cSa, final int cUr, final int cNe, final int cPa) {
  55.         this.cMe = cMe;
  56.         this.cVe = cVe;
  57.         this.cE  = cE;
  58.         this.cMa = cMa;
  59.         this.cJu = cJu;
  60.         this.cSa = cSa;
  61.         this.cUr = cUr;
  62.         this.cNe = cNe;
  63.         this.cPa = cPa;
  64.     }

  65.     /** {@inheritDoc} */
  66.     protected double argument(final BodiesElements elements) {
  67.         return cMe * elements.getLMe() + cVe * elements.getLVe() + cE  * elements.getLE() +
  68.                cMa * elements.getLMa() + cJu * elements.getLJu() +
  69.                cSa * elements.getLSa() + cUr * elements.getLUr() +
  70.                cNe * elements.getLNe() + cPa * elements.getPa();
  71.     }

  72.     /** {@inheritDoc} */
  73.     protected T argument(final FieldBodiesElements<T> elements) {
  74.         return elements.getLMe().multiply(cMe).
  75.                 add(elements.getLVe().multiply(cVe)).
  76.                 add(elements.getLE().multiply(cE)).
  77.                 add(elements.getLMa().multiply(cMa)).
  78.                 add(elements.getLJu().multiply(cJu)).
  79.                 add(elements.getLSa().multiply(cSa)).
  80.                 add(elements.getLUr().multiply(cUr)).
  81.                 add(elements.getLNe().multiply(cNe)).
  82.                 add(elements.getPa().multiply(cPa));

  83.     }

  84. }