MappingFunction.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.models.earth;

  18. import java.io.Serializable;
  19. import java.util.List;

  20. import org.hipparchus.Field;
  21. import org.hipparchus.RealFieldElement;
  22. import org.hipparchus.util.MathArrays;
  23. import org.orekit.time.AbsoluteDate;
  24. import org.orekit.time.FieldAbsoluteDate;
  25. import org.orekit.utils.ParameterDriver;

  26. /** Interface for mapping functions used in the tropospheric delay computation.
  27.  * @author Bryan Cazabonne
  28.  */
  29. public interface MappingFunction extends Serializable {

  30.     /** This method allows the computation of the hydrostatic and
  31.      * wet mapping functions. The resulting element is an array having the following form:
  32.      * <ul>
  33.      * <li>double[0] = m<sub>h</sub>(e) → hydrostatic mapping function
  34.      * <li>double[1] = m<sub>w</sub>(e) → wet mapping function
  35.      * </ul>
  36.      * @param elevation the elevation of the satellite, in radians.
  37.      * @param height the height of the station in m above sea level.
  38.      * @param parameters tropospheric model parameters.
  39.      * @param date current date
  40.      * @return a two components array containing the hydrostatic and wet mapping functions.
  41.      */
  42.     double[] mappingFactors(double elevation, double height, double[] parameters, AbsoluteDate date);

  43.     /** This method allows the computation of the hydrostatic and
  44.      * wet mapping functions. The resulting element is an array having the following form:
  45.      * <ul>
  46.      * <li>T[0] = m<sub>h</sub>(e) → hydrostatic mapping function
  47.      * <li>T[1] = m<sub>w</sub>(e) → wet mapping function
  48.      * </ul>
  49.      * @param elevation the elevation of the satellite, in radians.
  50.      * @param height the height of the station in m above sea level.
  51.      * @param parameters tropospheric model parameters.
  52.      * @param date current date
  53.      * @param <T> type of the elements
  54.      * @return a two components array containing the hydrostatic and wet mapping functions.
  55.      */
  56.     <T extends RealFieldElement<T>> T[] mappingFactors(T elevation, T height, T[] parameters, FieldAbsoluteDate<T> date);

  57.     /** Get the drivers for tropospheric model parameters.
  58.      * @return drivers for tropospheric model parameters
  59.      */
  60.     List<ParameterDriver> getParametersDrivers();

  61.     /** Get tropospheric model parameters.
  62.      * @return tropospheric model parameters
  63.      */
  64.     default double[] getParameters() {
  65.         final List<ParameterDriver> drivers = getParametersDrivers();
  66.         final double[] parameters = new double[drivers.size()];
  67.         for (int i = 0; i < drivers.size(); ++i) {
  68.             parameters[i] = drivers.get(i).getValue();
  69.         }
  70.         return parameters;
  71.     }

  72.     /** Get tropospheric model parameters.
  73.      * @param field field to which the elements belong
  74.      * @param <T> type of the elements
  75.      * @return tropospheric model parameters
  76.      */
  77.     default <T extends RealFieldElement<T>> T[] getParameters(final Field<T> field) {
  78.         final List<ParameterDriver> drivers = getParametersDrivers();
  79.         final T[] parameters = MathArrays.buildArray(field, drivers.size());
  80.         for (int i = 0; i < drivers.size(); ++i) {
  81.             parameters[i] = field.getZero().add(drivers.get(i).getValue());
  82.         }
  83.         return parameters;
  84.     }
  85. }