Commit dd524273 authored by Bryan Cazabonne's avatar Bryan Cazabonne
Browse files

Moved initialization of matrix harvester in AbstractPropagator.

parent a932005e
......@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Queue;
import org.hipparchus.linear.RealMatrix;
import org.orekit.attitudes.AttitudeProvider;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
......@@ -62,12 +63,16 @@ public abstract class AbstractPropagator implements Propagator {
/** Initial state. */
private SpacecraftState initialState;
/** Harvester for State Transition Matrix and Jacobian matrix. */
private AbstractMatricesHarvester harvester;
/** Build a new instance.
*/
protected AbstractPropagator() {
multiplexer = new StepHandlerMultiplexer();
multiplexer = new StepHandlerMultiplexer();
additionalStateProviders = new ArrayList<>();
unmanagedStates = new HashMap<>();
unmanagedStates = new HashMap<>();
harvester = null;
}
/** Set a start date.
......@@ -137,6 +142,41 @@ public abstract class AbstractPropagator implements Propagator {
return Collections.unmodifiableList(additionalStateProviders);
}
/** {@inheritDoc} */
@Override
public MatricesHarvester setupMatricesComputation(final String stmName, final RealMatrix initialStm,
final DoubleArrayDictionary initialJacobianColumns) {
if (stmName == null) {
throw new OrekitException(OrekitMessages.NULL_ARGUMENT, "stmName");
}
harvester = createHarvester(stmName, initialStm, initialJacobianColumns);
return harvester;
}
/** Create the harvester suitable for propagator.
* @param stmName State Transition Matrix state name
* @param initialStm initial State Transition Matrix ∂Y/∂Y₀,
* if null (which is the most frequent case), assumed to be 6x6 identity
* @param initialJacobianColumns initial columns of the Jacobians matrix with respect to parameters,
* if null or if some selected parameters are missing from the dictionary, the corresponding
* initial column is assumed to be 0
* @return harvester to retrieve computed matrices during and after propagation
* @since 11.1
*/
protected AbstractMatricesHarvester createHarvester(final String stmName, final RealMatrix initialStm,
final DoubleArrayDictionary initialJacobianColumns) {
// FIXME: not implemented as of 11.1
throw new UnsupportedOperationException();
}
/** Get the harvester.
* @return harvester, or null if it was not created
* @since 11.1
*/
protected AbstractMatricesHarvester getHarvester() {
return harvester;
}
/** Update state by adding unmanaged states.
* @param original original state
* @return updated state, with unmanaged states included
......
......@@ -52,6 +52,7 @@ class TLEHarvester extends AbstractAnalyticalMatricesHarvester {
this.propagator = propagator;
}
/** {@inheritDoc} */
@Override
public AbstractAnalyticalGradientConverter getGradientConverter() {
return new TLEGradientConverter(propagator);
......
......@@ -36,6 +36,7 @@ import org.orekit.frames.Frame;
import org.orekit.frames.Frames;
import org.orekit.orbits.CartesianOrbit;
import org.orekit.orbits.Orbit;
import org.orekit.propagation.AbstractMatricesHarvester;
import org.orekit.propagation.MatricesHarvester;
import org.orekit.propagation.SpacecraftState;
import org.orekit.propagation.analytical.AbstractAnalyticalPropagator;
......@@ -172,9 +173,6 @@ public abstract class TLEPropagator extends AbstractAnalyticalPropagator {
// CHECKSTYLE: resume VisibilityModifier check
/** Harvester for State Transition Matrix and Jacobian matrix. */
private TLEHarvester harvester;
/** TLE frame. */
private final Frame teme;
......@@ -214,7 +212,6 @@ public abstract class TLEPropagator extends AbstractAnalyticalPropagator {
this.teme = teme;
this.mass = mass;
this.utc = initialTLE.getUtc();
this.harvester = null;
initializeCommons();
sxpInitialize();
......@@ -595,13 +592,9 @@ public abstract class TLEPropagator extends AbstractAnalyticalPropagator {
/** {@inheritDoc} */
@Override
public MatricesHarvester setupMatricesComputation(final String stmName, final RealMatrix initialStm,
final DoubleArrayDictionary initialJacobianColumns) {
if (stmName == null) {
throw new OrekitException(OrekitMessages.NULL_ARGUMENT, "stmName");
}
harvester = new TLEHarvester(this, stmName, initialStm, initialJacobianColumns);
return harvester;
protected AbstractMatricesHarvester createHarvester(final String stmName, final RealMatrix initialStm,
final DoubleArrayDictionary initialJacobianColumns) {
return new TLEHarvester(this, stmName, initialStm, initialJacobianColumns);
}
/**
......
......@@ -27,7 +27,6 @@ import java.util.Map;
import java.util.Queue;
import org.hipparchus.exception.MathRuntimeException;
import org.hipparchus.linear.RealMatrix;
import org.hipparchus.ode.DenseOutputModel;
import org.hipparchus.ode.ExpandableODE;
import org.hipparchus.ode.ODEIntegrator;
......@@ -49,11 +48,9 @@ import org.orekit.errors.OrekitMessages;
import org.orekit.frames.Frame;
import org.orekit.orbits.OrbitType;
import org.orekit.orbits.PositionAngle;
import org.orekit.propagation.AbstractMatricesHarvester;
import org.orekit.propagation.AbstractPropagator;
import org.orekit.propagation.BoundedPropagator;
import org.orekit.propagation.EphemerisGenerator;
import org.orekit.propagation.MatricesHarvester;
import org.orekit.propagation.PropagationType;
import org.orekit.propagation.SpacecraftState;
import org.orekit.propagation.events.EventDetector;
......@@ -111,9 +108,6 @@ public abstract class AbstractIntegratedPropagator extends AbstractPropagator {
*/
private PropagationType propagationType;
/** Harvester for State Transition Matrix and Jacobian matrix. */
private AbstractMatricesHarvester harvester;
/** Build a new instance.
* @param integrator numerical integrator to use for propagation.
* @param propagationType type of orbit to output (mean or osculating).
......@@ -126,7 +120,6 @@ public abstract class AbstractIntegratedPropagator extends AbstractPropagator {
this.integrator = integrator;
this.propagationType = propagationType;
this.resetAtEnd = true;
this.harvester = null;
}
/** Allow/disallow resetting the initial state at end of propagation.
......@@ -313,37 +306,6 @@ public abstract class AbstractIntegratedPropagator extends AbstractPropagator {
return Collections.unmodifiableList(additionalDerivativesProviders);
}
/** {@inheritDoc} */
@Override
public MatricesHarvester setupMatricesComputation(final String stmName, final RealMatrix initialStm,
final DoubleArrayDictionary initialJacobianColumns) {
if (stmName == null) {
throw new OrekitException(OrekitMessages.NULL_ARGUMENT, "stmName");
}
harvester = createHarvester(stmName, initialStm, initialJacobianColumns);
return harvester;
}
/** Create the harvester suitable for propagator.
* @param stmName State Transition Matrix state name
* @param initialStm initial State Transition Matrix ∂Y/∂Y₀,
* if null (which is the most frequent case), assumed to be 6x6 identity
* @param initialJacobianColumns initial columns of the Jacobians matrix with respect to parameters,
* if null or if some selected parameters are missing from the dictionary, the corresponding
* initial column is assumed to be 0
* @return harvester to retrieve computed matrices during and after propagation
* @since 11.1
*/
protected abstract AbstractMatricesHarvester createHarvester(String stmName, RealMatrix initialStm,
DoubleArrayDictionary initialJacobianColumns);
/** Get the harvester.
* @return harvester, or null if it was not created
*/
protected AbstractMatricesHarvester getHarvester() {
return harvester;
}
/** {@inheritDoc} */
public void addEventDetector(final EventDetector detector) {
detectors.add(detector);
......
......@@ -19,7 +19,6 @@ package org.orekit.propagation.numerical;
import java.util.Arrays;
import org.hipparchus.geometry.euclidean.threed.Vector3D;
import org.hipparchus.linear.RealMatrix;
import org.hipparchus.ode.ODEIntegrator;
import org.hipparchus.ode.nonstiff.ClassicalRungeKuttaIntegrator;
import org.hipparchus.util.FastMath;
......@@ -35,7 +34,6 @@ import org.orekit.orbits.CartesianOrbit;
import org.orekit.orbits.Orbit;
import org.orekit.orbits.OrbitType;
import org.orekit.orbits.PositionAngle;
import org.orekit.propagation.AbstractMatricesHarvester;
import org.orekit.propagation.PropagationType;
import org.orekit.propagation.SpacecraftState;
import org.orekit.propagation.analytical.gnss.data.GLONASSOrbitalElements;
......@@ -46,7 +44,6 @@ import org.orekit.time.AbsoluteDate;
import org.orekit.time.GLONASSDate;
import org.orekit.utils.AbsolutePVCoordinates;
import org.orekit.utils.Constants;
import org.orekit.utils.DoubleArrayDictionary;
import org.orekit.utils.IERSConventions;
import org.orekit.utils.PVCoordinates;
import org.orekit.utils.TimeStampedPVCoordinates;
......@@ -782,12 +779,4 @@ public class GLONASSNumericalPropagator extends AbstractIntegratedPropagator {
}
/** {@inheritDoc} */
@Override
protected AbstractMatricesHarvester createHarvester(final String stmName, final RealMatrix initialStm,
final DoubleArrayDictionary initialJacobianColumns) {
// FIXME: not implemented as of 11.1
throw new UnsupportedOperationException();
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment