FieldPropagator.java

  1. /* Copyright 2002-2022 CS GROUP
  2.  * Licensed to CS GROUP (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.propagation;

  18. import java.util.Collection;
  19. import java.util.List;

  20. import org.hipparchus.CalculusFieldElement;
  21. import org.orekit.attitudes.AttitudeProvider;
  22. import org.orekit.frames.Frame;
  23. import org.orekit.propagation.events.FieldEventDetector;
  24. import org.orekit.propagation.sampling.FieldOrekitFixedStepHandler;
  25. import org.orekit.propagation.sampling.FieldOrekitStepHandler;
  26. import org.orekit.propagation.sampling.FieldStepHandlerMultiplexer;
  27. import org.orekit.time.FieldAbsoluteDate;
  28. import org.orekit.utils.FieldPVCoordinatesProvider;

  29. /** This interface provides a way to propagate an orbit at any time.
  30.  *
  31.  * <p>This interface is the top-level abstraction for orbit propagation.
  32.  * It only allows propagation to a predefined date.
  33.  * It is implemented by analytical models which have no time limit,
  34.  * by orbit readers based on external data files, by numerical integrators
  35.  * using rich force models and by continuous models built after numerical
  36.  * integration has been completed and dense output data as been
  37.  * gathered.</p>
  38.  * @param <T> the type of the field elements

  39.  * @author Luc Maisonobe
  40.  * @author V&eacute;ronique Pommier-Maurussane
  41.  *
  42.  */

  43. public interface FieldPropagator<T extends CalculusFieldElement<T>> extends FieldPVCoordinatesProvider<T> {

  44.     /** Default mass. */
  45.     double DEFAULT_MASS = 1000.0;

  46.     /** Get the multiplexer holding all step handlers.
  47.      * @return multiplexer holding all step handlers
  48.      * @since 11.0
  49.      */
  50.     FieldStepHandlerMultiplexer<T> getMultiplexer();

  51.     /** Remove all step handlers.
  52.      * <p>This convenience method is equivalent to call {@code getMultiplexer().clear()}</p>
  53.      * @see #getMultiplexer()
  54.      * @see FieldStepHandlerMultiplexer#clear()
  55.      * @since 11.0
  56.      */
  57.     default void clearStepHandlers() {
  58.         getMultiplexer().clear();
  59.     }

  60.     /** Set a single handler for fixed stepsizes.
  61.      * <p>This convenience method is equivalent to call {@code getMultiplexer().clear()}
  62.      * followed by {@code getMultiplexer().add(h, handler)}</p>
  63.      * @param h fixed stepsize (s)
  64.      * @param handler handler called at the end of each finalized step
  65.      * @see #getMultiplexer()
  66.      * @see FieldStepHandlerMultiplexer#add(CalculusFieldElement, FieldOrekitFixedStepHandler)
  67.      * @since 11.0
  68.      */
  69.     default void setStepHandler(final T h, final FieldOrekitFixedStepHandler<T> handler) {
  70.         getMultiplexer().clear();
  71.         getMultiplexer().add(h, handler);
  72.     }

  73.     /** Set a single handler for variable stepsizes.
  74.      * <p>This convenience method is equivalent to call {@code getMultiplexer().clear()}
  75.      * followed by {@code getMultiplexer().add(handler)}</p>
  76.      * @param handler handler called at the end of each finalized step
  77.      * @see #getMultiplexer()
  78.      * @see FieldStepHandlerMultiplexer#add(FieldOrekitStepHandler)
  79.      * @since 11.0
  80.      */
  81.     default void setStepHandler(final FieldOrekitStepHandler<T> handler) {
  82.         getMultiplexer().clear();
  83.         getMultiplexer().add(handler);
  84.     }

  85.     /**
  86.      * Set up an ephemeris generator that will monitor the propagation for building
  87.      * an ephemeris from it once completed.
  88.      *
  89.      * <p>
  90.      * This generator can be used when the user needs fast random access to the orbit
  91.      * state at any time between the initial and target times. A typical example is the
  92.      * implementation of search and iterative algorithms that may navigate forward and
  93.      * backward inside the propagation range before finding their result even if the
  94.      * propagator used is integration-based and only goes from one initial time to one
  95.      * target time.
  96.      * </p>
  97.      * <p>
  98.      * Beware that when used with integration-based propagators, the generator will
  99.      * store <strong>all</strong> intermediate results. It is therefore memory intensive
  100.      * for long integration-based ranges and high precision/short time steps. When
  101.      * used with analytical propagators, the generator only stores start/stop time
  102.      * and a reference to the analytical propagator itself to call it back as needed,
  103.      * so it is less memory intensive.
  104.      * </p>
  105.      * <p>
  106.      * The returned ephemeris generator will be initially empty, it will be filled
  107.      * with propagation data when a subsequent call to either {@link #propagate(FieldAbsoluteDate)
  108.      * propagate(target)} or {@link #propagate(FieldAbsoluteDate, FieldAbsoluteDate)
  109.      * propagate(start, target)} is called. The proper way to use this method is
  110.      * therefore to do:
  111.      * </p>
  112.      * <pre>
  113.      *   FieldEphemerisGenerator&lt;T&gt; generator = propagator.getEphemerisGenerator();
  114.      *   propagator.propagate(target);
  115.      *   FieldBoundedPropagator&lt;T&gt; ephemeris = generator.getGeneratedEphemeris();
  116.      * </pre>
  117.      * @return ephemeris generator
  118.      */
  119.     FieldEphemerisGenerator<T> getEphemerisGenerator();

  120.     /** Get the propagator initial state.
  121.      * @return initial state
  122.      */
  123.     FieldSpacecraftState<T> getInitialState();

  124.     /** Reset the propagator initial state.
  125.      * @param state new initial state to consider
  126.      */
  127.     void resetInitialState(FieldSpacecraftState<T> state);

  128.     /** Add a set of user-specified state parameters to be computed along with the orbit propagation.
  129.      * @param additionalStateProvider provider for additional state
  130.      */
  131.     void addAdditionalStateProvider(FieldAdditionalStateProvider<T> additionalStateProvider);

  132.     /** Get an unmodifiable list of providers for additional state.
  133.      * @return providers for the additional states
  134.      */
  135.     List<FieldAdditionalStateProvider<T>> getAdditionalStateProviders();

  136.     /** Check if an additional state is managed.
  137.      * <p>
  138.      * Managed states are states for which the propagators know how to compute
  139.      * its evolution. They correspond to additional states for which an
  140.      * {@link FieldAdditionalStateProvider additional state provider} has been registered
  141.      * by calling the {@link #addAdditionalStateProvider(FieldAdditionalStateProvider)
  142.      * addAdditionalStateProvider} method. If the propagator is an {@link
  143.      * org.orekit.propagation.integration.FieldAbstractIntegratedPropagator integrator-based
  144.      * propagator}, the states for which a set of {@link
  145.      * org.orekit.propagation.integration.FieldAdditionalEquations additional equations} has
  146.      * been registered by calling the {@link
  147.      * org.orekit.propagation.integration.FieldAbstractIntegratedPropagator#addAdditionalEquations(
  148.      * org.orekit.propagation.integration.FieldAdditionalEquations) addAdditionalEquations}
  149.      * method are also counted as managed additional states.
  150.      * </p>
  151.      * <p>
  152.      * Additional states that are present in the {@link #getInitialState() initial state}
  153.      * but have no evolution method registered are <em>not</em> considered as managed states.
  154.      * These unmanaged additional states are not lost during propagation, though. Their
  155.      * value are piecewise constant between state resets that may change them if some
  156.      * event handler {@link
  157.      * org.orekit.propagation.events.handlers.FieldEventHandler#resetState(FieldEventDetector,
  158.      * FieldSpacecraftState) resetState} method is called at an event occurrence and happens
  159.      * to change the unmanaged additional state.
  160.      * </p>
  161.      * @param name name of the additional state
  162.      * @return true if the additional state is managed
  163.      */
  164.     boolean isAdditionalStateManaged(String name);

  165.     /** Get all the names of all managed states.
  166.      * @return names of all managed states
  167.      */
  168.     String[] getManagedAdditionalStates();

  169.     /** Add an event detector.
  170.      * @param detector event detector to add
  171.      * @see #clearEventsDetectors()
  172.      * @see #getEventsDetectors()
  173.      * @param <D> class type for the generic version
  174.      */
  175.     <D extends FieldEventDetector<T>> void addEventDetector(D detector);

  176.     /** Get all the events detectors that have been added.
  177.      * @return an unmodifiable collection of the added detectors
  178.      * @see #addEventDetector(FieldEventDetector)
  179.      * @see #clearEventsDetectors()
  180.      */
  181.     Collection<FieldEventDetector<T>> getEventsDetectors();

  182.     /** Remove all events detectors.
  183.      * @see #addEventDetector(FieldEventDetector)
  184.      * @see #getEventsDetectors()
  185.      */
  186.     void clearEventsDetectors();

  187.     /** Get attitude provider.
  188.      * @return attitude provider
  189.      */
  190.     AttitudeProvider getAttitudeProvider();

  191.     /** Set attitude provider.
  192.      * @param attitudeProvider attitude provider
  193.      */
  194.     void setAttitudeProvider(AttitudeProvider attitudeProvider);

  195.     /** Get the frame in which the orbit is propagated.
  196.      * <p>
  197.      * The propagation frame is the definition frame of the initial
  198.      * state, so this method should be called after this state has
  199.      * been set, otherwise it may return null.
  200.      * </p>
  201.      * @return frame in which the orbit is propagated
  202.      * @see #resetInitialState(FieldSpacecraftState)
  203.      */
  204.     Frame getFrame();

  205.     /** Propagate towards a target date.
  206.      * <p>Simple propagators use only the target date as the specification for
  207.      * computing the propagated state. More feature rich propagators can consider
  208.      * other information and provide different operating modes or G-stop
  209.      * facilities to stop at pinpointed events occurrences. In these cases, the
  210.      * target date is only a hint, not a mandatory objective.</p>
  211.      * @param target target date towards which orbit state should be propagated
  212.      * @return propagated state
  213.      */
  214.     FieldSpacecraftState<T> propagate(FieldAbsoluteDate<T> target);

  215.     /** Propagate from a start date towards a target date.
  216.      * <p>Those propagators use a start date and a target date to
  217.      * compute the propagated state. For propagators using event detection mechanism,
  218.      * if the provided start date is different from the initial state date, a first,
  219.      * simple propagation is performed, without processing any event computation.
  220.      * Then complete propagation is performed from start date to target date.</p>
  221.      * @param start start date from which orbit state should be propagated
  222.      * @param target target date to which orbit state should be propagated
  223.      * @return propagated state
  224.      */
  225.     FieldSpacecraftState<T> propagate(FieldAbsoluteDate<T> start, FieldAbsoluteDate<T> target);

  226. }