AbstractJacobiansMapper.java

  1. /* Copyright 2002-2021 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.integration;

  18. import org.orekit.propagation.SpacecraftState;
  19. import org.orekit.propagation.analytical.tle.TLEJacobiansMapper;
  20. import org.orekit.propagation.numerical.JacobiansMapper;
  21. import org.orekit.propagation.semianalytical.dsst.DSSTJacobiansMapper;
  22. import org.orekit.utils.ParameterDriversList;

  23. /** Base class for jacobian mapper.
  24.  * @author Bryan Cazabonne
  25.  * @since 10.0
  26.  */
  27. public abstract class AbstractJacobiansMapper {

  28.     /** State dimension, fixed to 6.
  29.      * @since 9.0
  30.      */
  31.     public static final int STATE_DIMENSION = 6;

  32.     /** Name. */
  33.     private String name;

  34.     /** Selected parameters for Jacobian computation. */
  35.     private final ParameterDriversList parameters;

  36.     /** Simple constructor.
  37.      * @param name name of the Jacobians
  38.      * @param parameters selected parameters for Jacobian computation
  39.      */
  40.     protected AbstractJacobiansMapper(final String name, final ParameterDriversList parameters) {
  41.         this.name = name;
  42.         this.parameters = parameters;
  43.     }

  44.     /** Get the name of the partial Jacobians.
  45.      * @return name of the Jacobians
  46.      */
  47.     public String getName() {
  48.         return name;
  49.     }

  50.     /** Get the number of parameters.
  51.      * @return number of parameters
  52.      */
  53.     public int getParameters() {
  54.         return parameters.getNbParams();
  55.     }

  56.     /** Compute the length of the one-dimensional additional state array needed.
  57.      * @return length of the one-dimensional additional state array
  58.      */
  59.     public int getAdditionalStateDimension() {
  60.         return STATE_DIMENSION * (STATE_DIMENSION + parameters.getNbParams());
  61.     }

  62.     /** Compute the derivatives needed by analytical orbit determination methods.
  63.      * <p>
  64.      * Analytical derivatives are used to calculate state transition matrix of
  65.      * analytical orbit propagators and short period derivatives of DSST orbit
  66.      * propagator. In other word, this method does nothing for the numerical propagator.
  67.      *
  68.      * @param s spacecraft state with respect to which calculate derivatives
  69.      */
  70.     public void analyticalDerivatives(final SpacecraftState s) {
  71.         // noting by default
  72.     }

  73.     /** Set the Jacobian with respect to state into a one-dimensional additional state array.
  74.      * @param state spacecraft state
  75.      * @param dY1dY0 Jacobian of current state at time t₁
  76.      * with respect to state at some previous time t₀
  77.      * @param dY1dP Jacobian of current state at time t₁
  78.      * with respect to parameters (may be null if there are no parameters)
  79.      * @param p placeholder where to put the one-dimensional additional state
  80.      * @see #getStateJacobian(SpacecraftState, double[][])
  81.      */
  82.     public abstract void setInitialJacobians(SpacecraftState state, double[][] dY1dY0, double[][] dY1dP, double[] p);

  83.     /** Get the Jacobian with respect to state from a one-dimensional additional state array.
  84.      * <p>
  85.      * This method extract the data from the {@code state} and put it in the
  86.      * {@code dYdY0} array.
  87.      * <p>
  88.      * For {@link JacobiansMapper} and {@link TLEJacobiansMapper}, the method provides
  89.      * the Jacobian with respect to Cartesian elements.
  90.      * For {@link DSSTJacobiansMapper} the method provides the Jacobian with respect to
  91.      * Equinoctial elements.
  92.      * @param state spacecraft state
  93.      * @param dYdY0 placeholder where to put the Jacobian with respect to state
  94.      * @see #getParametersJacobian(SpacecraftState, double[][])
  95.      */
  96.     public abstract void getStateJacobian(SpacecraftState state,  double[][] dYdY0);

  97.     /** Get the Jacobian with respect to parameters from a one-dimensional additional state array.
  98.      * <p>
  99.      * This method extract the data from the {@code state} and put it in the
  100.      * {@code dYdP} array.
  101.      * </p>
  102.      * <p>
  103.      * If no parameters have been set in the constructor, the method returns immediately and
  104.      * does not reference {@code dYdP} which can safely be null in this case.
  105.      * </p>
  106.      * @param state spacecraft state
  107.      * @param dYdP placeholder where to put the Jacobian with respect to parameters
  108.      * @see #getStateJacobian(SpacecraftState, double[][])
  109.      */
  110.     public abstract void getParametersJacobian(SpacecraftState state, double[][] dYdP);

  111. }