WrappingUnnormalizedProvider.java

  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.forces.gravity.potential;

  18. import org.orekit.forces.gravity.potential.RawSphericalHarmonicsProvider.RawSphericalHarmonics;
  19. import org.orekit.time.AbsoluteDate;

  20. /** Wrapper providing un-normalized coefficients.
  21.  * <p>
  22.  * The caller <em>must</em> ensure by itself that the raw provider already
  23.  * stores (and provides) un-normalized coefficients.
  24.  * </p>
  25.  * @author Luc Maisonobe
  26.  * @since 6.0
  27.  */
  28. class WrappingUnnormalizedProvider implements UnnormalizedSphericalHarmonicsProvider {

  29.     /** Raw provider to which everything is delegated. */
  30.     private final RawSphericalHarmonicsProvider rawProvider;

  31.     /** Simple constructor.
  32.      * @param rawProvider raw provider to which everything is delegated
  33.      */
  34.     WrappingUnnormalizedProvider(final RawSphericalHarmonicsProvider rawProvider) {
  35.         this.rawProvider = rawProvider;
  36.     }

  37.     /** {@inheritDoc} */
  38.     @Override
  39.     public int getMaxDegree() {
  40.         return rawProvider.getMaxDegree();
  41.     }

  42.     /** {@inheritDoc} */
  43.     @Override
  44.     public int getMaxOrder() {
  45.         return rawProvider.getMaxOrder();
  46.     }

  47.     /** {@inheritDoc} */
  48.     @Override
  49.     public double getMu() {
  50.         return rawProvider.getMu();
  51.     }

  52.     /** {@inheritDoc} */
  53.     @Override
  54.     public double getAe() {
  55.         return rawProvider.getAe();
  56.     }

  57.     /** {@inheritDoc} */
  58.     @Override
  59.     public AbsoluteDate getReferenceDate() {
  60.         return rawProvider.getReferenceDate();
  61.     }

  62.     /** {@inheritDoc} */
  63.     @Override
  64.     public double getOffset(final AbsoluteDate date) {
  65.         return rawProvider.getOffset(date);
  66.     }

  67.     /** {@inheritDoc} */
  68.     @Override
  69.     public TideSystem getTideSystem() {
  70.         return rawProvider.getTideSystem();
  71.     }

  72.     @Override
  73.     public UnnormalizedSphericalHarmonics onDate(final AbsoluteDate date) {
  74.         final RawSphericalHarmonics raw = rawProvider.onDate(date);
  75.         return new UnnormalizedSphericalHarmonics() {

  76.             /** {@inheritDoc} */
  77.             @Override
  78.             public AbsoluteDate getDate() {
  79.                 return date;
  80.             }

  81.             /** {@inheritDoc} */
  82.             @Override
  83.             public double getUnnormalizedCnm(final int n, final int m) {
  84.                 // no conversion is done here
  85.                 return raw.getRawCnm(n, m);
  86.             }

  87.             /** {@inheritDoc} */
  88.             @Override
  89.             public double getUnnormalizedSnm(final int n, final int m) {
  90.                 // no conversion is done here
  91.                 return raw.getRawSnm(n, m);
  92.             }

  93.         };
  94.     }
  95. }