FieldPropagator.java

  1. /* Copyright 2002-2025 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.hipparchus.geometry.euclidean.threed.FieldVector3D;
  22. import org.orekit.attitudes.AttitudeProvider;
  23. import org.orekit.frames.Frame;
  24. import org.orekit.propagation.events.FieldEventDetector;
  25. import org.orekit.propagation.sampling.FieldOrekitFixedStepHandler;
  26. import org.orekit.propagation.sampling.FieldOrekitStepHandler;
  27. import org.orekit.propagation.sampling.FieldStepHandlerMultiplexer;
  28. import org.orekit.time.FieldAbsoluteDate;
  29. import org.orekit.utils.FieldPVCoordinatesProvider;
  30. import org.orekit.utils.TimeStampedFieldPVCoordinates;

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

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

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

  46.     /** Default mass. */
  47.     double DEFAULT_MASS = 1000.0;

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

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

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

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

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

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

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

  130.     /** Add a set of user-specified data to be computed along with the orbit propagation.
  131.      * @param additionalDataProvider provider for additional data
  132.      */
  133.     void addAdditionalDataProvider(FieldAdditionalDataProvider<?, T> additionalDataProvider);

  134.     /** Get an unmodifiable list of providers for additional data.
  135.      * @return providers for the additional states
  136.      */
  137.     List<FieldAdditionalDataProvider<?, T>> getAdditionalDataProviders();

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

  167.     /** Get all the names of all managed data.
  168.      * @return names of all managed data
  169.      */
  170.     String[] getManagedAdditionalData();

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

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

  184.     /** Remove all events detectors.
  185.      * @see #addEventDetector(FieldEventDetector)
  186.      * @see #getEventDetectors()
  187.      */
  188.     void clearEventsDetectors();

  189.     /** Get attitude provider.
  190.      * @return attitude provider
  191.      */
  192.     AttitudeProvider getAttitudeProvider();

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

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

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

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

  228.     /** {@inheritDoc} */
  229.     @Override
  230.     default TimeStampedFieldPVCoordinates<T> getPVCoordinates(FieldAbsoluteDate<T> date, Frame frame) {
  231.         return propagate(date).getPVCoordinates(frame);
  232.     }

  233.     /** {@inheritDoc} */
  234.     @Override
  235.     default FieldVector3D<T> getPosition(final FieldAbsoluteDate<T> date, final Frame frame) {
  236.         return propagate(date).getPosition(frame);
  237.     }

  238. }