FieldTimeInterpolable.java

  1. /* Copyright 2002-2018 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.time;

  18. import org.hipparchus.RealFieldElement;

  19. import java.util.Collection;
  20. import java.util.stream.Stream;

  21. import org.orekit.errors.OrekitException;

  22. /** This interface represents objects that can be interpolated in time.
  23.  * @param <T> Type of the object.
  24.  * @param <KK> type of the field elements
  25.  * @author Luc Maisonobe
  26.  */
  27. public interface FieldTimeInterpolable <T extends FieldTimeInterpolable<T, KK>, KK extends RealFieldElement<KK>> {

  28.     /** Get an interpolated instance.
  29.      * <p>
  30.      * Note that the state of the current instance may not be used
  31.      * in the interpolation process, only its type and non interpolable
  32.      * fields are used (for example central attraction coefficient or
  33.      * frame when interpolating orbits). The interpolable fields taken
  34.      * into account are taken only from the states of the sample points.
  35.      * So if the state of the instance must be used, the instance should
  36.      * be included in the sample points.
  37.      * </p>
  38.      * <p>
  39.      * Note that this method is designed for small samples only (say up
  40.      * to about 10-20 points) so it can be implemented using polynomial
  41.      * interpolation (typically Hermite interpolation). Using too much
  42.      * points may induce <a
  43.      * href="http://en.wikipedia.org/wiki/Runge%27s_phenomenon">Runge's
  44.      * phenomenon</a> and numerical problems (including NaN appearing).
  45.      * </p>
  46.      * @param date interpolation date
  47.      * @param sample sample points on which interpolation should be done
  48.      * @return a new instance, interpolated at specified date
  49.      * @exception OrekitException if interpolation cannot be performed
  50.      */
  51.     default T interpolate(FieldAbsoluteDate<KK> date, Collection<T> sample)
  52.         throws OrekitException {
  53.         return interpolate(date, sample.stream());
  54.     }

  55.     /** Get an interpolated instance.
  56.      * <p>
  57.      * Note that the state of the current instance may not be used
  58.      * in the interpolation process, only its type and non interpolable
  59.      * fields are used (for example central attraction coefficient or
  60.      * frame when interpolating orbits). The interpolable fields taken
  61.      * into account are taken only from the states of the sample points.
  62.      * So if the state of the instance must be used, the instance should
  63.      * be included in the sample points.
  64.      * </p>
  65.      * <p>
  66.      * Note that this method is designed for small samples only (say up
  67.      * to about 10-20 points) so it can be implemented using polynomial
  68.      * interpolation (typically Hermite interpolation). Using too much
  69.      * points may induce <a
  70.      * href="http://en.wikipedia.org/wiki/Runge%27s_phenomenon">Runge's
  71.      * phenomenon</a> and numerical problems (including NaN appearing).
  72.      * </p>
  73.      * @param date interpolation date
  74.      * @param sample sample points on which interpolation should be done
  75.      * @return a new instance, interpolated at specified date
  76.      * @exception OrekitException if interpolation cannot be performed
  77.      */
  78.     T interpolate(FieldAbsoluteDate<KK> date, Stream<T> sample)
  79.         throws OrekitException;

  80. }