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 19 import java.io.Serializable; 20 import java.util.List; 21 22 import org.hipparchus.Field; 23 import org.hipparchus.RealFieldElement; 24 import org.hipparchus.util.MathArrays; 25 import org.orekit.time.AbsoluteDate; 26 import org.orekit.time.FieldAbsoluteDate; 27 import org.orekit.utils.ParameterDriver; 28 29 /** Interface for mapping functions used in the tropospheric delay computation. 30 * @author Bryan Cazabonne 31 */ 32 public interface MappingFunction extends Serializable { 33 34 /** This method allows the computation of the hydrostatic and 35 * wet mapping functions. The resulting element is an array having the following form: 36 * <ul> 37 * <li>double[0] = m<sub>h</sub>(e) → hydrostatic mapping function 38 * <li>double[1] = m<sub>w</sub>(e) → wet mapping function 39 * </ul> 40 * @param elevation the elevation of the satellite, in radians. 41 * @param height the height of the station in m above sea level. 42 * @param parameters tropospheric model parameters. 43 * @param date current date 44 * @return a two components array containing the hydrostatic and wet mapping functions. 45 */ 46 double[] mappingFactors(double elevation, double height, double[] parameters, AbsoluteDate date); 47 48 /** This method allows the computation of the hydrostatic and 49 * wet mapping functions. The resulting element is an array having the following form: 50 * <ul> 51 * <li>T[0] = m<sub>h</sub>(e) → hydrostatic mapping function 52 * <li>T[1] = m<sub>w</sub>(e) → wet mapping function 53 * </ul> 54 * @param elevation the elevation of the satellite, in radians. 55 * @param height the height of the station in m above sea level. 56 * @param parameters tropospheric model parameters. 57 * @param date current date 58 * @param <T> type of the elements 59 * @return a two components array containing the hydrostatic and wet mapping functions. 60 */ 61 <T extends RealFieldElement<T>> T[] mappingFactors(T elevation, T height, T[] parameters, FieldAbsoluteDate<T> date); 62 63 /** Get the drivers for tropospheric model parameters. 64 * @return drivers for tropospheric model parameters 65 */ 66 List<ParameterDriver> getParametersDrivers(); 67 68 /** Get tropospheric model parameters. 69 * @return tropospheric model parameters 70 */ 71 default double[] getParameters() { 72 final List<ParameterDriver> drivers = getParametersDrivers(); 73 final double[] parameters = new double[drivers.size()]; 74 for (int i = 0; i < drivers.size(); ++i) { 75 parameters[i] = drivers.get(i).getValue(); 76 } 77 return parameters; 78 } 79 80 /** Get tropospheric model parameters. 81 * @param field field to which the elements belong 82 * @param <T> type of the elements 83 * @return tropospheric model parameters 84 */ 85 default <T extends RealFieldElement<T>> T[] getParameters(final Field<T> field) { 86 final List<ParameterDriver> drivers = getParametersDrivers(); 87 final T[] parameters = MathArrays.buildArray(field, drivers.size()); 88 for (int i = 0; i < drivers.size(); ++i) { 89 parameters[i] = field.getZero().add(drivers.get(i).getValue()); 90 } 91 return parameters; 92 } 93 }