AbstractJacobiansMapper.java

  1. /* Copyright 2002-2020 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.numerical.NumericalPropagator;
  20. import org.orekit.propagation.semianalytical.dsst.DSSTPropagator;
  21. import org.orekit.utils.ParameterDriversList;

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

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

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

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

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

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

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

  55.     /** Compute the length of the one-dimensional additional state array needed.
  56.      * @return length of the one-dimensional additional state array
  57.      */
  58.     public abstract int getAdditionalStateDimension();

  59.     /** Get the conversion Jacobian between state parameters and parameters used for derivatives.
  60.      * <p>
  61.      * For a {@link DSSTPropagator DSST propagator}, state parameters and parameters used for derivatives are the same,
  62.      * so the Jocabian is simply the identity.
  63.      * </p>
  64.      * <p>
  65.      * For {@link NumericalPropagator Numerical propagator}, parameters used for derivatives are cartesian
  66.      * and they can be different from state parameters because the numerical propagator can accept different type
  67.      * of orbits.
  68.      * </p>
  69.      * @param state spacecraft state
  70.      * @return conversion Jacobian
  71.      */
  72.     protected abstract double[][] getConversionJacobian(SpacecraftState state);

  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.      * @param state spacecraft state
  89.      * @param dYdY0 placeholder where to put the Jacobian with respect to state
  90.      * @see #getParametersJacobian(SpacecraftState, double[][])
  91.      */
  92.     public abstract void getStateJacobian(SpacecraftState state,  double[][] dYdY0);

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

  107. }