diff --git a/java_additions/src/main/java/org/orekit/python/PythonAbstractAnalyticalPropagator.java b/java_additions/src/main/java/org/orekit/python/PythonAbstractAnalyticalPropagator.java new file mode 100644 index 0000000000000000000000000000000000000000..ba9f9a65b46734183ef46dfcb9ea8e68e1072d4a --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAbstractAnalyticalPropagator.java @@ -0,0 +1,70 @@ +package org.orekit.python; + +import org.orekit.attitudes.AttitudeProvider; +import org.orekit.orbits.Orbit; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.analytical.AbstractAnalyticalPropagator; +import org.orekit.time.AbsoluteDate; + +public class PythonAbstractAnalyticalPropagator extends AbstractAnalyticalPropagator { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Build a new instance. + * + * @param attitudeProvider provider for attitude computation + */ + public PythonAbstractAnalyticalPropagator(AttitudeProvider attitudeProvider) { + super(attitudeProvider); + } + + /** + * Get the mass. Extension point for Python. + * + * @param date target date for the orbit + * @return mass mass + */ + @Override + public native double getMass(AbsoluteDate date); + + /** + * Reset an intermediate state. + * Extension point for Python. + * @param state new intermediate state to consider + * @param forward if true, the intermediate state is valid for + */ + @Override + public native void resetIntermediateState(SpacecraftState state, boolean forward); + + /** + * Extrapolate an orbit up to a specific target date. + * Extension point for Python. + * @param date target date for the orbit + * @return extrapolated parameters + */ + @Override + public native Orbit propagateOrbit(AbsoluteDate date); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAbstractCovarianceMatrixProvider.java b/java_additions/src/main/java/org/orekit/python/PythonAbstractCovarianceMatrixProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..08510376fa2e84c59a6aad4aeb93b956e0803435 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAbstractCovarianceMatrixProvider.java @@ -0,0 +1,77 @@ +package org.orekit.python; + +import org.hipparchus.linear.RealMatrix; +import org.orekit.estimation.sequential.AbstractCovarianceMatrixProvider; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.conversion.PropagatorBuilder; + +public class PythonAbstractCovarianceMatrixProvider extends AbstractCovarianceMatrixProvider { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Simple constructor. + * + * @param initialNoiseMatrix initial process noise + */ + public PythonAbstractCovarianceMatrixProvider(RealMatrix initialNoiseMatrix) { + super(initialNoiseMatrix); + } + + /** + * Get the process noise matrix between previous and current states. + * Extension point for Python. + * <p> + * The process noise matrix is a covariance matrix corresponding to the + * parameters managed by the {@link KalmanEstimator Kalman estimator}. + * The number of rows/columns and their order are as follows: + * </p> + * <ul> + * <li>The first 6 components correspond to the 6 orbital parameters + * of the associated propagator. All 6 parameters must always be present, + * regardless of the fact they are estimated or not.</li> + * <li>The following components correspond to the subset of propagation + * parameters of the associated propagator that are estimated.</li> + * <li>The remaining components correspond to the subset of measurements + * parameters that are estimated, considering all measurements, even + * the ones that correspond to spacecrafts not related to the + * associated propagator</li> + * </ul> + * <p> + * In most cases, the process noise for the part corresponding to measurements + * (the final rows and columns) will be set to 0 for the process noise corresponding + * to the evolution between a non-null previous and current state. + * </p> + * + * @param previous previous state + * @param current current state + * @return physical (i.e. non normalized) process noise matrix between + * previous and current states + * @see PropagatorBuilder#getOrbitalParametersDrivers() + * @see PropagatorBuilder#getPropagationParametersDrivers() + */ + @Override + public native RealMatrix getProcessNoiseMatrix(SpacecraftState previous, SpacecraftState current); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAbstractForceModel.java b/java_additions/src/main/java/org/orekit/python/PythonAbstractForceModel.java new file mode 100644 index 0000000000000000000000000000000000000000..268c68eaad14595afc99601c8978ac9db821ed22 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAbstractForceModel.java @@ -0,0 +1,118 @@ +package org.orekit.python; + +import org.hipparchus.Field; +import org.hipparchus.RealFieldElement; +import org.hipparchus.geometry.euclidean.threed.FieldVector3D; +import org.hipparchus.geometry.euclidean.threed.Vector3D; +import org.orekit.forces.AbstractForceModel; +import org.orekit.propagation.FieldSpacecraftState; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.events.EventDetector; +import org.orekit.propagation.events.FieldEventDetector; +import org.orekit.utils.ParameterDriver; + +import java.util.stream.Stream; + +public class PythonAbstractForceModel extends AbstractForceModel { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Check if force models depends on position only. + * Extension point for Python. + * @return true if force model depends on position only, false + * if it depends on velocity, either directly or due to a dependency + * on attitude + * @since 9.0 + */ + @Override + public native boolean dependsOnPositionOnly(); + + /** + * Compute acceleration. + * Extension point for Python. + * @param s current state information: date, kinematics, attitude + * @param parameters values of the force model parameters + * @return acceleration in same frame as state + * @since 9.0 + */ + @Override + public native Vector3D acceleration(SpacecraftState s, double[] parameters); + + /** + * Compute acceleration. Automatically directs to the Python extension point Fieldacceleration + * + * @param s current state information: date, kinematics, attitude + * @param parameters values of the force model parameters + * @return acceleration in same frame as state + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> FieldVector3D<T> acceleration(FieldSpacecraftState<T> s, T[] parameters) { + return this.Fieldacceleration(s,parameters); + } + + /** + * Compute acceleration, Alternative python interface point for the acceleration method. + * Extension point for Python. + * + * @param s current state information: date, kinematics, attitude + * @param parameters values of the force model parameters + * @return acceleration in same frame as state + * @since 9.0 + */ + public native <T extends RealFieldElement<T>> FieldVector3D<T> Fieldacceleration(FieldSpacecraftState<T> s, T[] parameters); + + /** + * Get the discrete events related to the model. + * Extension point for Python. + * + * @return stream of events detectors + */ + @Override + public native Stream<EventDetector> getEventsDetectors(); + + /** + * Get the discrete events related to the model. + * Extension point for Python. + * + * @param field field to which the state belongs + * @return stream of events detectors + */ + @Override + public native <T extends RealFieldElement<T>> Stream<FieldEventDetector<T>> getFieldEventsDetectors(Field<T> field); + + /** + * Get the drivers for force model parameters. + * Extension point for Python. + * + * @return drivers for force model parameters + * @since 8.0 + */ + @Override + public native ParameterDriver[] getParametersDrivers(); + + } \ No newline at end of file diff --git a/java_additions/src/main/java/org/orekit/python/PythonAbstractGaussianContribution.java b/java_additions/src/main/java/org/orekit/python/PythonAbstractGaussianContribution.java new file mode 100644 index 0000000000000000000000000000000000000000..7203300dffa80dcbec8ef96f0d737ce50767361a --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAbstractGaussianContribution.java @@ -0,0 +1,66 @@ +package org.orekit.python; + +import org.orekit.forces.ForceModel; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.events.EventDetector; +import org.orekit.propagation.semianalytical.dsst.forces.AbstractGaussianContribution; + +public class PythonAbstractGaussianContribution extends AbstractGaussianContribution { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + + /** + * Build a new instance. + * + * @param coefficientsKeyPrefix prefix for coefficients keys + * @param threshold tolerance for the choice of the Gauss quadrature order + * @param contribution the {@link ForceModel} to be numerically averaged + */ + public PythonAbstractGaussianContribution(String coefficientsKeyPrefix, double threshold, ForceModel contribution) { + super(coefficientsKeyPrefix, threshold, contribution); + } + + /** + * Compute the limits in L, the true longitude, for integration. + * Extension point for Python. + * + * @param state current state information: date, kinematics, attitude + * @return the integration limits in L + */ + @Override + public native double[] getLLimits(SpacecraftState state); + + /** + * Get the discrete events related to the model. + * Extension point for Python. + * + * @return array of events detectors or null if the model is not + * related to any discrete events + */ + @Override + public native EventDetector[] getEventsDetectors(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAbstractIntegratedPropagator.java b/java_additions/src/main/java/org/orekit/python/PythonAbstractIntegratedPropagator.java new file mode 100644 index 0000000000000000000000000000000000000000..cc59050c2d1c08d3ac34ad35df57bbd710a1bab6 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAbstractIntegratedPropagator.java @@ -0,0 +1,79 @@ +package org.orekit.python; + +import org.hipparchus.ode.ODEIntegrator; +import org.orekit.attitudes.AttitudeProvider; +import org.orekit.frames.Frame; +import org.orekit.orbits.OrbitType; +import org.orekit.orbits.PositionAngle; +import org.orekit.propagation.integration.AbstractIntegratedPropagator; +import org.orekit.propagation.integration.StateMapper; +import org.orekit.time.AbsoluteDate; + +public class PythonAbstractIntegratedPropagator extends AbstractIntegratedPropagator { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Build a new instance. + * + * @param integrator numerical integrator to use for propagation. + * @param meanOrbit output only the mean orbit. + */ + protected PythonAbstractIntegratedPropagator(ODEIntegrator integrator, boolean meanOrbit) { + super(integrator, meanOrbit); + } + + /** + * Create a mapper between raw double components and spacecraft state. + * /** Simple constructor. + * Extension point for Python. + * <p> + * The position parameter type is meaningful only if {@link + * #getOrbitType() propagation orbit type} + * support it. As an example, it is not meaningful for propagation + * in {@link OrbitType#CARTESIAN Cartesian} parameters. + * </p> + * + * @param referenceDate reference date + * @param mu central attraction coefficient (m³/s²) + * @param orbitType orbit type to use for mapping + * @param positionAngleType angle type to use for propagation + * @param attitudeProvider attitude provider + * @param frame inertial frame + * @return new mapper + */ + @Override + public native StateMapper createMapper(AbsoluteDate referenceDate, double mu, OrbitType orbitType, PositionAngle positionAngleType, AttitudeProvider attitudeProvider, Frame frame); + + /** + * Get the differential equations to integrate (for main state only). + * Extension point for Python. + * + * @param integ numerical integrator to use for propagation. + * @return differential equations for main state + */ + @Override + public native MainStateEquations getMainStateEquations(ODEIntegrator integ); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAbstractMeasurement.java b/java_additions/src/main/java/org/orekit/python/PythonAbstractMeasurement.java new file mode 100644 index 0000000000000000000000000000000000000000..22d47c9bcedacd744a67493ea79a8d8672124af6 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAbstractMeasurement.java @@ -0,0 +1,69 @@ +package org.orekit.python; + +import org.orekit.estimation.measurements.*; +import org.orekit.propagation.SpacecraftState; +import org.orekit.time.AbsoluteDate; + +import java.util.List; +import java.util.SortedSet; + +public class PythonAbstractMeasurement<T extends ObservedMeasurement<T>> extends AbstractMeasurement<T> { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** + * Simple constructor for mono-dimensional measurements. + * <p> + * At construction, a measurement is enabled. + * </p> + * + * @param date date of the measurement + * @param observed observed value + * @param sigma theoretical standard deviation + * @param baseWeight base weight + * @param satellites satellites related to this measurement + * @since 9.3 + */ + public PythonAbstractMeasurement(AbsoluteDate date, double observed, double sigma, double baseWeight, List<ObservableSatellite> satellites) { + super(date, observed, sigma, baseWeight, satellites); + } + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Estimate the theoretical value. + * Extension point for Python. + * <p> + * The theoretical value does not have <em>any</em> modifiers applied. + * </p> + * + * @param iteration iteration number + * @param evaluation evaluation number + * @param states orbital states at measurement date + * @return theoretical value + * @see #estimate(int, int, SpacecraftState[]) + */ + @Override + public native EstimatedMeasurement<T> theoreticalEvaluation(int iteration, int evaluation, SpacecraftState[] states); + +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAbstractMeasurementBuilder.java b/java_additions/src/main/java/org/orekit/python/PythonAbstractMeasurementBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..006867b47443ba1f2975c06a6eb5fc4157f54b08 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAbstractMeasurementBuilder.java @@ -0,0 +1,70 @@ +package org.orekit.python; + +import org.hipparchus.random.CorrelatedRandomVectorGenerator; +import org.orekit.estimation.measurements.ObservableSatellite; +import org.orekit.estimation.measurements.ObservedMeasurement; +import org.orekit.estimation.measurements.generation.AbstractMeasurementBuilder; +import org.orekit.propagation.SpacecraftState; + +public class PythonAbstractMeasurementBuilder<T extends ObservedMeasurement<T>> extends AbstractMeasurementBuilder<T> { + /** Part of JCC Python interface to object */ + private long pythonObject; + + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Simple constructor. + * + * @param noiseSource noise source, may be null for generating perfect measurements + * @param sigma theoretical standard deviation + * @param baseWeight base weight + * @param satellites satellites related to this builder + */ + public PythonAbstractMeasurementBuilder(CorrelatedRandomVectorGenerator noiseSource, double sigma, double baseWeight, ObservableSatellite... satellites) { + super(noiseSource, sigma, baseWeight, satellites); + } + + /** + * Simple constructor. + * + * @param noiseSource noise source, may be null for generating perfect measurements + * @param sigma theoretical standard deviation + * @param baseWeight base weight + * @param satellites satellites related to this builder + */ + public PythonAbstractMeasurementBuilder(CorrelatedRandomVectorGenerator noiseSource, double[] sigma, double[] baseWeight, ObservableSatellite... satellites) { + super(noiseSource, sigma, baseWeight, satellites); + } + + + /** + * Generate a single measurement. + * Extension point for Python. + * + * @param states spacecraft states + * @return generated measurement + */ + @Override + public native T build(SpacecraftState[] states); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAbstractParametricAcceleration.java b/java_additions/src/main/java/org/orekit/python/PythonAbstractParametricAcceleration.java new file mode 100644 index 0000000000000000000000000000000000000000..22ba024e1a1fa78168c6196b76d1369085353e23 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAbstractParametricAcceleration.java @@ -0,0 +1,101 @@ +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.hipparchus.geometry.euclidean.threed.Vector3D; +import org.orekit.attitudes.AttitudeProvider; +import org.orekit.forces.AbstractParametricAcceleration; +import org.orekit.propagation.FieldSpacecraftState; +import org.orekit.propagation.Propagator; +import org.orekit.propagation.SpacecraftState; +import org.orekit.utils.ParameterDriver; + +public class PythonAbstractParametricAcceleration extends AbstractParametricAcceleration { + /** + * Simple constructor. + * + * @param direction acceleration direction in overridden spacecraft frame + * @param isInertial if true, direction is defined in the same inertial + * frame used for propagation (i.e. {@link SpacecraftState#getFrame()}), + * otherwise direction is defined in spacecraft frame (i.e. using the + * propagation {@link + * Propagator#setAttitudeProvider(AttitudeProvider) + * attitude law}) + * @param attitudeOverride provider for attitude used to compute acceleration + */ + public PythonAbstractParametricAcceleration(Vector3D direction, boolean isInertial, AttitudeProvider attitudeOverride) { + super(direction, isInertial, attitudeOverride); + } + + /** + * Compute the signed amplitude of the acceleration. + * Extension point for Python. + * <p> + * The acceleration is the direction multiplied by the signed amplitude. So if + * signed amplitude is negative, the acceleratin is towards the opposite of the + * direction specified at construction. + * </p> + * + * @param state current state information: date, kinematics, attitude + * @param parameters values of the force model parameters + * @return norm of the acceleration + */ + @Override + public native double signedAmplitude(SpacecraftState state, double[] parameters); + + /** + * Compute the signed amplitude of the acceleration. + * <p> + * The acceleration is the direction multiplied by the signed amplitude. So if + * signed amplitude is negative, the acceleratin is towards the opposite of the + * direction specified at construction. + * </p> + * + * @param state current state information: date, kinematics, attitude + * @param parameters values of the force model parameters + * @return norm of the acceleration + */ + @Override + protected <T extends RealFieldElement<T>> T signedAmplitude(FieldSpacecraftState<T> state, T[] parameters) { + return this.signedFieldAmplitude(state, parameters); + } + + + + /** + * Compute the signed amplitude of the acceleration. + * Extension point for Python linked to the signedAmplitude method. + * <p> + * The acceleration is the direction multiplied by the signed amplitude. So if + * signed amplitude is negative, the acceleratin is towards the opposite of the + * direction specified at construction. + * </p> + * + * @param state current state information: date, kinematics, attitude + * @param parameters values of the force model parameters + * @return norm of the acceleration + */ + + public native <T extends RealFieldElement<T>> T signedFieldAmplitude(FieldSpacecraftState<T> state, T[] parameters); + + /** + * Check if force models depends on position only. + * Extension point for Python + * + * @return true if force model depends on position only, false + * if it depends on velocity, either directly or due to a dependency + * on attitude + * @since 9.0 + */ + @Override + public native boolean dependsOnPositionOnly(); + + /** + * Get the drivers for force model parameters. + * Extension Point for Python + * + * @return drivers for force model parameters + * @since 8.0 + */ + @Override + public native ParameterDriver[] getParametersDrivers(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAbstractPropagator.java b/java_additions/src/main/java/org/orekit/python/PythonAbstractPropagator.java new file mode 100644 index 0000000000000000000000000000000000000000..0dff0047a227537cfd2482a70a72bfb7cfc65878 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAbstractPropagator.java @@ -0,0 +1,83 @@ +package org.orekit.python; + +import org.orekit.propagation.AbstractPropagator; +import org.orekit.propagation.BoundedPropagator; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.events.EventDetector; +import org.orekit.time.AbsoluteDate; + +import java.util.Collection; + +public class PythonAbstractPropagator extends AbstractPropagator { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * {@inheritDoc} + */ + @Override + public native BoundedPropagator getGeneratedEphemeris(); + + /** + * Extension point for Python. + * {@inheritDoc} + * + * @param detector + */ + @Override + public native <T extends EventDetector> void addEventDetector(T detector); + + /** + * Extension point for Python. + * {@inheritDoc} + */ + @Override + public native Collection<EventDetector> getEventsDetectors(); + + /** + * Extension point for Python. + * {@inheritDoc} + */ + @Override + public native void clearEventsDetectors(); + + /** + * Propagate from a start date towards a target date. + * Extension point for Python. + * + * <p>Those propagators use a start date and a target date to + * compute the propagated state. For propagators using event detection mechanism, + * if the provided start date is different from the initial state date, a first, + * simple propagation is performed, without processing any event computation. + * Then complete propagation is performed from start date to target date.</p> + * + * @param start start date from which orbit state should be propagated + * @param target target date to which orbit state should be propagated + * @return propagated state + */ + @Override + public native SpacecraftState propagate(AbsoluteDate start, AbsoluteDate target); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAbstractPropagatorBuilder.java b/java_additions/src/main/java/org/orekit/python/PythonAbstractPropagatorBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..05f91a2e61d50c59b47d5c4a9a24999af7785736 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAbstractPropagatorBuilder.java @@ -0,0 +1,75 @@ +package org.orekit.python; + +import org.orekit.orbits.Orbit; +import org.orekit.orbits.PositionAngle; +import org.orekit.propagation.Propagator; +import org.orekit.propagation.conversion.AbstractPropagatorBuilder; + +public class PythonAbstractPropagatorBuilder extends AbstractPropagatorBuilder { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Build a new instance. + * <p> + * The template orbit is used as a model to {@link + * #createInitialOrbit() create initial orbit}. It defines the + * inertial frame, the central attraction coefficient, the orbit type, and is also + * used together with the {@code positionScale} to convert from the {@link + * ParameterDriver#setNormalizedValue(double) normalized} parameters used by the + * callers of this builder to the real orbital parameters. + * </p> + * <p> + * By default, all the {@link #getOrbitalParametersDrivers() orbital parameters drivers} + * are selected, which means that if the builder is used for orbit determination or + * propagator conversion, all orbital parameters will be estimated. If only a subset + * of the orbital parameters must be estimated, caller must retrieve the orbital + * parameters by calling {@link #getOrbitalParametersDrivers()} and then call + * {@link ParameterDriver#setSelected(boolean) setSelected(false)}. + * </p> + * + * @param templateOrbit reference orbit from which real orbits will be built + * @param positionAngle position angle type to use + * @param positionScale scaling factor used for orbital parameters normalization + * (typically set to the expected standard deviation of the position) + * @param addDriverForCentralAttraction if true, a {@link ParameterDriver} should + * be set up for central attraction coefficient + * @since 8.0 + */ + public PythonAbstractPropagatorBuilder(Orbit templateOrbit, PositionAngle positionAngle, double positionScale, boolean addDriverForCentralAttraction) { + super(templateOrbit, positionAngle, positionScale, addDriverForCentralAttraction); + } + + /** + * Build a propagator. + * Extension point for Python. + * + * + * @param normalizedParameters normalized values for the selected parameters + * @return an initialized propagator + */ + @Override + public native Propagator buildPropagator(double[] normalizedParameters); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAbstractPropagatorConverter.java b/java_additions/src/main/java/org/orekit/python/PythonAbstractPropagatorConverter.java new file mode 100644 index 0000000000000000000000000000000000000000..3162377d40a3314e9328160099634b356848da56 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAbstractPropagatorConverter.java @@ -0,0 +1,63 @@ +package org.orekit.python; + +import org.hipparchus.analysis.MultivariateVectorFunction; +import org.hipparchus.optim.nonlinear.vector.leastsquares.MultivariateJacobianFunction; +import org.orekit.propagation.conversion.AbstractPropagatorConverter; +import org.orekit.propagation.conversion.PropagatorBuilder; + +public class PythonAbstractPropagatorConverter extends AbstractPropagatorConverter { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Build a new instance. + * + * @param builder propagator builder + * @param threshold absolute convergence threshold for optimization algorithm + * @param maxIterations maximum number of iterations for fitting + */ + public PythonAbstractPropagatorConverter(PropagatorBuilder builder, double threshold, int maxIterations) { + super(builder, threshold, maxIterations); + } + + /** + * Get the function computing position/velocity at sample points. + * Extension point for Python. + * + * @return function computing position/velocity at sample points + */ + @Override + public native MultivariateVectorFunction getObjectiveFunction(); + + /** + * Get the Jacobian of the function computing position/velocity at sample points. + * Extension point for Python. + * + * @return Jacobian of the function computing position/velocity at sample points + */ + @Override + public native MultivariateJacobianFunction getModel(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAbstractScheduler.java b/java_additions/src/main/java/org/orekit/python/PythonAbstractScheduler.java new file mode 100644 index 0000000000000000000000000000000000000000..43e21993f6b797f828aa4664e405309733221179 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAbstractScheduler.java @@ -0,0 +1,57 @@ +package org.orekit.python; + +import org.orekit.estimation.measurements.ObservedMeasurement; +import org.orekit.estimation.measurements.generation.AbstractScheduler; +import org.orekit.estimation.measurements.generation.MeasurementBuilder; +import org.orekit.propagation.sampling.OrekitStepInterpolator; +import org.orekit.time.DatesSelector; + +import java.util.List; +import java.util.SortedSet; + +public class PythonAbstractScheduler<T extends ObservedMeasurement<T>> extends AbstractScheduler<T> { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** + * Simple constructor. + * + * @param builder builder for individual measurements + * @param selector selector for dates + */ + protected PythonAbstractScheduler(MeasurementBuilder<T> builder, DatesSelector selector) { + super(builder, selector); + } + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Generate a sequence of measurements. + * Extension point for Python. + * + * @param interpolators interpolators for spacecraft states + * @return generated measurements + */ + @Override + public native SortedSet<T> generate(List<OrekitStepInterpolator> interpolators); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAdditionalEquations.java b/java_additions/src/main/java/org/orekit/python/PythonAdditionalEquations.java new file mode 100644 index 0000000000000000000000000000000000000000..58101db2a06edf6957944eeca97809af31bff1fb --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAdditionalEquations.java @@ -0,0 +1,120 @@ +/* Copyright 2010-2011 Centre National d'Études Spatiales + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// this file was created by SCC 2018 and is largely a derived work from the +// original java class + + +package org.orekit.python; + +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.integration.AdditionalEquations; +import org.orekit.time.AbsoluteDate; + +/** This interface allows users to add their own differential equations to a numerical propagator. + * + * <p> + * In some cases users may need to integrate some problem-specific equations along with + * classical spacecraft equations of motions. One example is optimal control in low + * thrust where adjoint parameters linked to the minimized Hamiltonian must be integrated. + * Another example is formation flying or rendez-vous which use the Clohessy-Whiltshire + * equations for the relative motion. + * </p> + * <p> + * This interface allows users to add such equations to a {@link + * org.orekit.propagation.numerical.NumericalPropagator numerical propagator}. Users provide the + * equations as an implementation of this interface and register it to the propagator thanks to + * its {@link org.orekit.propagation.numerical.NumericalPropagator#addAdditionalEquations(AdditionalEquations)} + * method. Several such objects can be registered with each numerical propagator, but it is + * recommended to gather in the same object the sets of parameters which equations can interact + * on each others states. + * </p> + * <p> + * The additional parameters are gathered in a simple p array. The additional equations compute + * the pDot array, which is the time-derivative of the p array. Since the additional parameters + * p may also have an influence on the equations of motion themselves that should be accumulated + * to the main state derivatives (for example an equation linked to a complex thrust model may + * induce an acceleration and a mass change), the {@link #computeDerivatives(SpacecraftState, double[]) + * computeDerivatives} method can return a double array that will be + * <em>added</em> to the main state derivatives. This means these equations can be used as an + * additional force model if needed. If the additional parameters have no influence at all on + * the main spacecraft state, a null reference may be returned. + * </p> + * <p> + * This interface is the numerical (read not already integrated) counterpart of + * the {@link org.orekit.propagation.AdditionalStateProvider} interface. + * It allows to append various additional state parameters to any {@link + * org.orekit.propagation.numerical.NumericalPropagator numerical propagator}. + * </p> + * @see AbstractIntegratedPropagator + * @see org.orekit.propagation.AdditionalStateProvider + * @author Luc Maisonobe + */ + + + +public class PythonAdditionalEquations implements AdditionalEquations { + + + static final long serialVersionUID = 1L; + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + + /** Get the name of the additional state. + * Extension point for Python. + * + * @return name of the additional state + */ + public native String getName(); + + /** Extension point for Python. + * {@inheritDoc} */ + @Override + public native void init(final SpacecraftState initialState, final AbsoluteDate target); + + /** + * Extension point for Python. + * + * {@inheritDoc} */ + @Override + public native double[] computeDerivatives(SpacecraftState s, double[] pDot); + +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAdditionalStateProvider.java b/java_additions/src/main/java/org/orekit/python/PythonAdditionalStateProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..5c9de458012a26b8e28bd17f2d68c2fd3d8b70f7 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAdditionalStateProvider.java @@ -0,0 +1,71 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.propagation.AdditionalStateProvider; +import org.orekit.propagation.SpacecraftState; + +public class PythonAdditionalStateProvider implements AdditionalStateProvider { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the name of the additional state. + * Extension point for Python. + * + * @return name of the additional state + */ + @Override + public native String getName(); + + /** + * Get the additional state. + * Extension point for Python. + * + * @param state spacecraft state to which additional state should correspond + * @return additional state corresponding to spacecraft state + */ + @Override + public native double[] getAdditionalState(SpacecraftState state); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAtmosphere.java b/java_additions/src/main/java/org/orekit/python/PythonAtmosphere.java new file mode 100644 index 0000000000000000000000000000000000000000..8d2866ad99c440994dde0a38639b03b9c0cb99b2 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAtmosphere.java @@ -0,0 +1,146 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.hipparchus.geometry.euclidean.threed.FieldVector3D; +import org.hipparchus.geometry.euclidean.threed.Vector3D; +import org.orekit.forces.drag.atmosphere.Atmosphere; +import org.orekit.frames.Frame; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; + +public class PythonAtmosphere implements Atmosphere { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the frame of the central body. + * + * @return frame of the central body. + * @since 6.0 + */ + @Override + public native Frame getFrame(); + + /** + * Get the local density. + * Extension point for Python. + * + * @param date current date + * @param position current position in frame + * @param frame the frame in which is defined the position + * @return local density (kg/m³) + */ + @Override + public native double getDensity(AbsoluteDate date, Vector3D position, Frame frame); + + /** + * Get the local density. + * Redirects to getFieldDensity + * + * @param date current date + * @param position current position in frame + * @param frame the frame in which is defined the position + * @return local density (kg/m³) + */ + @Override + public <T extends RealFieldElement<T>> T getDensity(FieldAbsoluteDate<T> date, FieldVector3D<T> position, Frame frame) { + return this.getFieldDensity(date, position, frame); + } + + + /** + * Get the local density. + * Extension point for Python. + * + * @param date current date + * @param position current position in frame + * @param frame the frame in which is defined the position + * @return local density (kg/m³) + */ + public native <T extends RealFieldElement<T>> T getFieldDensity(FieldAbsoluteDate<T> date, FieldVector3D<T> position, Frame frame); + + + /** + * Get the inertial velocity of atmosphere molecules. + * Extension point for Python. + * + * <p>By default, atmosphere is supposed to have a null + * velocity in the central body frame.</p> + * + * @param date current date + * @param position current position in frame + * @param frame the frame in which is defined the position + * @return velocity (m/s) (defined in the same frame as the position) + */ + @Override + public native Vector3D getVelocity(AbsoluteDate date, Vector3D position, Frame frame); + + /** + * Get the inertial velocity of atmosphere molecules. + * Redirects to getFieldVelocity(...) + * + * @param date current date + * @param position current position in frame + * @param frame the frame in which is defined the position + * @return velocity (m/s) (defined in the same frame as the position) + */ + @Override + public <T extends RealFieldElement<T>> FieldVector3D<T> getVelocity(FieldAbsoluteDate<T> date, FieldVector3D<T> position, Frame frame) { + return this.getFieldVelocity(date, position, frame); + } + + /** + * Get the inertial velocity of atmosphere molecules. + * Extension point for Python. + * + * @param date current date + * @param position current position in frame + * @param frame the frame in which is defined the position + * @return velocity (m/s) (defined in the same frame as the position) + */ + public native <T extends RealFieldElement<T>> FieldVector3D<T> getFieldVelocity(FieldAbsoluteDate<T> date, FieldVector3D<T> position, Frame frame); + +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAtmosphericRefractionModel.java b/java_additions/src/main/java/org/orekit/python/PythonAtmosphericRefractionModel.java new file mode 100644 index 0000000000000000000000000000000000000000..7ae3679587d083d5fef067ba2fe4983d4f656f83 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAtmosphericRefractionModel.java @@ -0,0 +1,61 @@ +/* Copyright 2013 Applied Defense Solutions, Inc. + * Licensed to CS Communication & Systèmes (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.models.AtmosphericRefractionModel; + +public class PythonAtmosphericRefractionModel implements AtmosphericRefractionModel { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Compute the refraction angle from the true (geometrical) elevation. + * Extension point for Python. + * + * @param trueElevation true elevation (rad) + * @return refraction angle (rad) + */ + @Override + public native double getRefraction(double trueElevation); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAttitudeProvider.java b/java_additions/src/main/java/org/orekit/python/PythonAttitudeProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..7a812fd644a9859fab6b0f44557f393d821b5f8b --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAttitudeProvider.java @@ -0,0 +1,100 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2018 and is largely a derived work from the +// original java class + + +package org.orekit.python; + +import java.io.Serializable; + +import org.hipparchus.RealFieldElement; +import org.orekit.attitudes.Attitude; +import org.orekit.attitudes.AttitudeProvider; +import org.orekit.attitudes.FieldAttitude; +import org.orekit.frames.Frame; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.utils.FieldPVCoordinatesProvider; +import org.orekit.utils.PVCoordinatesProvider; + +public class PythonAttitudeProvider implements AttitudeProvider { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Compute the attitude corresponding to an orbital state. + * Extension point for Python for the basic parameter set. + * + * @param pvProv local position-velocity provider around current date + * @param date current date + * @param frame reference frame from which attitude is computed + * @return attitude attitude on the specified date and position-velocity state + */ + @Override + public native Attitude getAttitude(PVCoordinatesProvider pvProv, AbsoluteDate date, Frame frame); + + /** + * Compute the attitude corresponding to an orbital state. + * Redirects to getFieldAttitude(...) for extension + * + * @param pvProv local position-velocity provider around current date + * @param date current date + * @param frame reference frame from which attitude is computed + * @return attitude attitude on the specified date and position-velocity state + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> FieldAttitude<T> getAttitude(FieldPVCoordinatesProvider<T> pvProv, FieldAbsoluteDate<T> date, Frame frame) { + return this.getFieldAttitude(pvProv, date, frame); + } + + /** + * Compute the attitude corresponding to an orbital state. + * Extension point for Python. Connected to getAttitude(...) orekit function. + * + * @param pvProv local position-velocity provider around current date + * @param date current date + * @param frame reference frame from which attitude is computed + * @return attitude attitude on the specified date and position-velocity state + * @since 9.3 + */ + public native <T extends RealFieldElement<T>> FieldAttitude<T> getFieldAttitude(FieldPVCoordinatesProvider<T> pvProv, FieldAbsoluteDate<T> date, Frame frame); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonAttitudeProviderModifier.java b/java_additions/src/main/java/org/orekit/python/PythonAttitudeProviderModifier.java new file mode 100644 index 0000000000000000000000000000000000000000..cf5559c0217bb4bd0989293e94eab3036e0dcc8d --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonAttitudeProviderModifier.java @@ -0,0 +1,109 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.attitudes.Attitude; +import org.orekit.attitudes.AttitudeProvider; +import org.orekit.attitudes.AttitudeProviderModifier; +import org.orekit.attitudes.FieldAttitude; +import org.orekit.frames.Frame; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.utils.FieldPVCoordinatesProvider; +import org.orekit.utils.PVCoordinatesProvider; + +public class PythonAttitudeProviderModifier implements AttitudeProviderModifier { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the underlying attitude provider. + * Extension point for Python. + * + * @return underlying attitude provider + */ + @Override + public AttitudeProvider getUnderlyingAttitudeProvider() { + return null; + } + + /** + * Compute the attitude corresponding to an orbital state. + * Extension point for Python. + * + * @param pvProv local position-velocity provider around current date + * @param date current date + * @param frame reference frame from which attitude is computed + * @return attitude attitude on the specified date and position-velocity state + */ + @Override + public native Attitude getAttitude(PVCoordinatesProvider pvProv, AbsoluteDate date, Frame frame); + + /** + * Compute the attitude corresponding to an orbital state. + * Redirects to getFieldAttitude(...) for Python extension + * + * @param pvProv local position-velocity provider around current date + * @param date current date + * @param frame reference frame from which attitude is computed + * @return attitude attitude on the specified date and position-velocity state + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> FieldAttitude<T> getAttitude(FieldPVCoordinatesProvider<T> pvProv, FieldAbsoluteDate<T> date, Frame frame) { + return this.getFieldAttitude(pvProv, date, frame); + } + + /** + * Compute the attitude corresponding to an orbital state. + * Extension point for Python. Connected to getAttitude(...) + * + * @param pvProv local position-velocity provider around current date + * @param date current date + * @param frame reference frame from which attitude is computed + * @return attitude attitude on the specified date and position-velocity state + * @since 9.3 + */ + public native <T extends RealFieldElement<T>> FieldAttitude<T> getFieldAttitude(FieldPVCoordinatesProvider<T> pvProv, FieldAbsoluteDate<T> date, Frame frame); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonBatchLSObserver.java b/java_additions/src/main/java/org/orekit/python/PythonBatchLSObserver.java new file mode 100644 index 0000000000000000000000000000000000000000..b0b4efdd9889cfb71968857b9030bce3698f721b --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonBatchLSObserver.java @@ -0,0 +1,73 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresProblem; +import org.orekit.estimation.leastsquares.BatchLSObserver; +import org.orekit.estimation.measurements.EstimationsProvider; +import org.orekit.orbits.Orbit; +import org.orekit.utils.ParameterDriversList; + +public class PythonBatchLSObserver implements BatchLSObserver { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Notification callback for the end of each evaluation. + * Extension point for Python. + * + * @param iterationsCount iterations count + * @param evaluationsCount evaluations count + * @param orbits current estimated orbits + * @param estimatedOrbitalParameters estimated orbital parameters + * @param estimatedPropagatorParameters estimated propagator parameters + * @param estimatedMeasurementsParameters estimated measurements parameters + * @param evaluationsProvider provider for measurements evaluations resulting + * from the current estimated orbit (this is an unmodifiable view of the + * current evaluations, its content is changed at each iteration) + * @param lspEvaluation current evaluation of the underlying {@link LeastSquaresProblem + * least squares problem} + */ + @Override + public native void evaluationPerformed(int iterationsCount, int evaluationsCount, Orbit[] orbits, ParameterDriversList estimatedOrbitalParameters, ParameterDriversList estimatedPropagatorParameters, ParameterDriversList estimatedMeasurementsParameters, EstimationsProvider evaluationsProvider, LeastSquaresProblem.Evaluation lspEvaluation); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonBodyShape.java b/java_additions/src/main/java/org/orekit/python/PythonBodyShape.java new file mode 100644 index 0000000000000000000000000000000000000000..c864e88f18d8c211ae7dcc88a87b0fd8372e77c5 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonBodyShape.java @@ -0,0 +1,215 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.hipparchus.geometry.euclidean.threed.FieldLine; +import org.hipparchus.geometry.euclidean.threed.FieldVector3D; +import org.hipparchus.geometry.euclidean.threed.Line; +import org.hipparchus.geometry.euclidean.threed.Vector3D; +import org.orekit.bodies.BodyShape; +import org.orekit.bodies.FieldGeodeticPoint; +import org.orekit.bodies.GeodeticPoint; +import org.orekit.frames.Frame; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.utils.TimeStampedPVCoordinates; + + + +public class PythonBodyShape implements BodyShape { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get body frame related to body shape. + * Extension point for Python. + * + * @return body frame related to body shape + */ + @Override + public native Frame getBodyFrame(); + + /** + * Get the intersection point of a line with the surface of the body. + * Extension point for Python. + * + * <p>A line may have several intersection points with a closed + * surface (we consider the one point case as a degenerated two + * points case). The close parameter is used to select which of + * these points should be returned. The selected point is the one + * that is closest to the close point.</p> + * + * @param line test line (may intersect the body or not) + * @param close point used for intersections selection + * @param frame frame in which line is expressed + * @param date date of the line in given frame + * @return intersection point at altitude zero or null if the line does + * not intersect the surface + */ + @Override + public native GeodeticPoint getIntersectionPoint(Line line, Vector3D close, Frame frame, AbsoluteDate date); + + /** + * Get the intersection point of a line with the surface of the body. + * Extension point for Python. + * + * <p>A line may have several intersection points with a closed + * surface (we consider the one point case as a degenerated two + * points case). The close parameter is used to select which of + * these points should be returned. The selected point is the one + * that is closest to the close point.</p> + * + * @param line test line (may intersect the body or not) + * @param close point used for intersections selection + * @param frame frame in which line is expressed + * @param date date of the line in given frame + * @return intersection point at altitude zero or null if the line does + * not intersect the surface + * @since 9.0 + */ + @Override + public native <T extends RealFieldElement<T>> FieldGeodeticPoint<T> getIntersectionPoint(FieldLine<T> line, FieldVector3D<T> close, Frame frame, FieldAbsoluteDate<T> date); + + /** + * Project a point to the ground. + * Extension point for Python. + * + * @param point point to project + * @param date current date + * @param frame frame in which moving point is expressed + * @return ground point exactly at the local vertical of specified point, + * in the same frame as specified point + * @see #projectToGround(TimeStampedPVCoordinates, Frame) + * @since 7.0 + */ + @Override + public native Vector3D projectToGround(Vector3D point, AbsoluteDate date, Frame frame); + + /** + * Project a moving point to the ground. + * Extension point for Python. + * + * @param pv moving point + * @param frame frame in which moving point is expressed + * @return ground point exactly at the local vertical of specified point, + * in the same frame as specified point + * @see #projectToGround(Vector3D, AbsoluteDate, Frame) + * @since 7.0 + */ + @Override + public native TimeStampedPVCoordinates projectToGround(TimeStampedPVCoordinates pv, Frame frame); + + /** + * Transform a Cartesian point to a surface-relative point. + * Extension point for Python. + * + * @param point Cartesian point + * @param frame frame in which Cartesian point is expressed + * @param date date of the computation (used for frames conversions) + * @return point at the same location but as a surface-relative point + */ + @Override + public native GeodeticPoint transform(Vector3D point, Frame frame, AbsoluteDate date); + + /** + * Transform a Cartesian point to a surface-relative point. + * Redirects to Fieldtransform(...) for Python extension + * + * @param point Cartesian point + * @param frame frame in which Cartesian point is expressed + * @param date date of the computation (used for frames conversions) + * @return point at the same location but as a surface-relative point + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> FieldGeodeticPoint<T> transform(FieldVector3D<T> point, Frame frame, FieldAbsoluteDate<T> date) { + return this.Fieldtransform(point, frame,date); + } + + /** + * Transform a Cartesian point to a surface-relative point. + * Extension point for Python. + * + * @param point Cartesian point + * @param frame frame in which Cartesian point is expressed + * @param date date of the computation (used for frames conversions) + * @return point at the same location but as a surface-relative point + * @since 9.0 + */ + public native <T extends RealFieldElement<T>> FieldGeodeticPoint<T> Fieldtransform(FieldVector3D<T> point, Frame frame, FieldAbsoluteDate<T> date); + + /** + * Transform a surface-relative point to a Cartesian point. + * Extension point for Python. + * + * @param point surface-relative point + * @return point at the same location but as a Cartesian point + */ + @Override + public native Vector3D transform(GeodeticPoint point); + + /** + * Transform a surface-relative point to a Cartesian point. + * Redirects to FieldVector3Dtransfor(...) for Python extension. + * + * @param point surface-relative point + * @return point at the same location but as a Cartesian point + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> FieldVector3D<T> transform(FieldGeodeticPoint<T> point) { + return this.FieldVector3Dtransform(point); + } + + /** + * Transform a surface-relative point to a Cartesian point. + * Extension point for Python. Connects to method transform. + * + * @param point surface-relative point + * @return point at the same location but as a Cartesian point + * @since 9.0 + */ + public native <T extends RealFieldElement<T>> FieldVector3D<T> FieldVector3Dtransform(FieldGeodeticPoint<T> point); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonBoundedPropagator.java b/java_additions/src/main/java/org/orekit/python/PythonBoundedPropagator.java new file mode 100644 index 0000000000000000000000000000000000000000..e1e8296da8a14428970c0085bf8be402abcde45e --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonBoundedPropagator.java @@ -0,0 +1,403 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.attitudes.AttitudeProvider; +import org.orekit.frames.Frame; +import org.orekit.propagation.AdditionalStateProvider; +import org.orekit.propagation.BoundedPropagator; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.events.EventDetector; +import org.orekit.propagation.integration.AbstractIntegratedPropagator; +import org.orekit.propagation.integration.AdditionalEquations; +import org.orekit.propagation.sampling.OrekitFixedStepHandler; +import org.orekit.propagation.sampling.OrekitStepHandler; +import org.orekit.time.AbsoluteDate; +import org.orekit.utils.TimeStampedPVCoordinates; + +import java.util.Collection; +import java.util.List; + +public class PythonBoundedPropagator implements BoundedPropagator { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the first date of the range. + * + * @return the first date of the range + */ + @Override + public native AbsoluteDate getMinDate(); + + /** + * Get the last date of the range. + * + * @return the last date of the range + */ + @Override + public native AbsoluteDate getMaxDate(); + + /** + * Get the current operating mode of the propagator. + * + * @return one of {@link #SLAVE_MODE}, {@link #MASTER_MODE}, + * {@link #EPHEMERIS_GENERATION_MODE} + * @see #setSlaveMode() + * @see #setMasterMode(double, OrekitFixedStepHandler) + * @see #setMasterMode(OrekitStepHandler) + * @see #setEphemerisMode() + */ + @Override + public native int getMode(); + + /** + * Set the propagator to slave mode. + * Extension point for Python. + * + * <p>This mode is used when the user needs only the final orbit at the target time. + * The (slave) propagator computes this result and return it to the calling + * (master) application, without any intermediate feedback. + * <p>This is the default mode.</p> + * + * @see #setMasterMode(double, OrekitFixedStepHandler) + * @see #setMasterMode(OrekitStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #SLAVE_MODE + */ + @Override + public native void setSlaveMode(); + + /** + * Set the propagator to master mode with fixed steps. + * <p>This mode is used when the user needs to have some custom function called at the + * end of each finalized step during integration. The (master) propagator integration + * loop calls the (slave) application callback methods at each finalized step.</p> + * + * @param h fixed stepsize (s) + * @param handler handler called at the end of each finalized step + * @see #setSlaveMode() + * @see #setMasterMode(OrekitStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #MASTER_MODE + */ + @Override + public void setMasterMode(double h, OrekitFixedStepHandler handler) { + setMasterMode_2p(h, handler); + } + + + /** + * Set the propagator to master mode with fixed steps. + * <p>This mode is used when the user needs to have some custom function called at the + * end of each finalized step during integration. The (master) propagator integration + * loop calls the (slave) application callback methods at each finalized step.</p> + * + * @param h fixed stepsize (s) + * @param handler handler called at the end of each finalized step + * @see #setSlaveMode() + * @see #setMasterMode(OrekitStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #MASTER_MODE + */ + public native void setMasterMode_2p(double h, OrekitFixedStepHandler handler); + + /** + * Set the propagator to master mode with variable steps. + * <p>This mode is used when the user needs to have some custom function called at the + * end of each finalized step during integration. The (master) propagator integration + * loop calls the (slave) application callback methods at each finalized step.</p> + * + * @param handler handler called at the end of each finalized step + * @see #setSlaveMode() + * @see #setMasterMode(double, OrekitFixedStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #MASTER_MODE + */ + @Override + public native void setMasterMode(OrekitStepHandler handler); + + /** + * Set the propagator to ephemeris generation mode. + * <p>This mode is used when the user needs random access to the orbit state at any time + * between the initial and target times, and in no sequential order. A typical example is + * the implementation of search and iterative algorithms that may navigate forward and + * backward inside the propagation range before finding their result.</p> + * <p>Beware that since this mode stores <strong>all</strong> intermediate results, + * it may be memory intensive for long integration ranges and high precision/short + * time steps.</p> + * + * @see #getGeneratedEphemeris() + * @see #setSlaveMode() + * @see #setMasterMode(double, OrekitFixedStepHandler) + * @see #setMasterMode(OrekitStepHandler) + * @see #getMode() + * @see #EPHEMERIS_GENERATION_MODE + */ + @Override + public native void setEphemerisMode(); + + /** + * Set the propagator to ephemeris generation mode with the specified handler for each + * integration step. + * + * <p>This mode is used when the user needs random access to the orbit state at any + * time between the initial and target times, as well as access to the steps computed + * by the integrator as in Master Mode. A typical example is the implementation of + * search and iterative algorithms that may navigate forward and backward inside the + * propagation range before finding their result.</p> + * + * <p>Beware that since this mode stores <strong>all</strong> intermediate results, it + * may be memory intensive for long integration ranges and high precision/short time + * steps.</p> + * + * @param handler handler called at the end of each finalized step + * @see #setEphemerisMode() + * @see #getGeneratedEphemeris() + * @see #setSlaveMode() + * @see #setMasterMode(double, OrekitFixedStepHandler) + * @see #setMasterMode(OrekitStepHandler) + * @see #getMode() + * @see #EPHEMERIS_GENERATION_MODE + */ + @Override + public native void setEphemerisMode(OrekitStepHandler handler); + + /** + * Get the ephemeris generated during propagation. + * + * @return generated ephemeris + * @throws IllegalStateException if the propagator was not set in ephemeris + * generation mode before propagation + * @see #setEphemerisMode() + */ + @Override + public native BoundedPropagator getGeneratedEphemeris() throws IllegalStateException; + + /** + * Get the propagator initial state. + * + * @return initial state + */ + @Override + public native SpacecraftState getInitialState(); + + /** + * Reset the propagator initial state. + * + * @param state new initial state to consider + */ + @Override + public native void resetInitialState(SpacecraftState state); + + /** + * Add a set of user-specified state parameters to be computed along with the orbit propagation. + * + * @param additionalStateProvider provider for additional state + */ + @Override + public native void addAdditionalStateProvider(AdditionalStateProvider additionalStateProvider); + + /** + * Get an unmodifiable list of providers for additional state. + * + * @return providers for the additional states + */ + @Override + public native List<AdditionalStateProvider> getAdditionalStateProviders(); + + /** + * Check if an additional state is managed. + * <p> + * Managed states are states for which the propagators know how to compute + * its evolution. They correspond to additional states for which an + * {@link AdditionalStateProvider additional state provider} has been registered + * by calling the {@link #addAdditionalStateProvider(AdditionalStateProvider) + * addAdditionalStateProvider} method. If the propagator is an {@link + * AbstractIntegratedPropagator integrator-based + * propagator}, the states for which a set of {@link + * AdditionalEquations additional equations} has + * been registered by calling the {@link + * AbstractIntegratedPropagator#addAdditionalEquations( + *AdditionalEquations) addAdditionalEquations} + * method are also counted as managed additional states. + * </p> + * <p> + * Additional states that are present in the {@link #getInitialState() initial state} + * but have no evolution method registered are <em>not</em> considered as managed states. + * These unmanaged additional states are not lost during propagation, though. Their + * value will simply be copied unchanged throughout propagation. + * </p> + * + * @param name name of the additional state + * @return true if the additional state is managed + */ + @Override + public native boolean isAdditionalStateManaged(String name); + + /** + * Get all the names of all managed states. + * + * @return names of all managed states + */ + @Override + public native String[] getManagedAdditionalStates(); + + /** + * Add an event detector. + * + * @param detector event detector to add + * @see #clearEventsDetectors() + * @see #getEventsDetectors() + */ + @Override + public native <T extends EventDetector> void addEventDetector(T detector); + + /** + * Get all the events detectors that have been added. + * + * @return an unmodifiable collection of the added detectors + * @see #addEventDetector(EventDetector) + * @see #clearEventsDetectors() + */ + @Override + public native Collection<EventDetector> getEventsDetectors(); + + /** + * Remove all events detectors. + * + * @see #addEventDetector(EventDetector) + * @see #getEventsDetectors() + */ + @Override + public native void clearEventsDetectors(); + + /** + * Get attitude provider. + * + * @return attitude provider + */ + @Override + public native AttitudeProvider getAttitudeProvider(); + + /** + * Set attitude provider. + * + * @param attitudeProvider attitude provider + */ + @Override + public native void setAttitudeProvider(AttitudeProvider attitudeProvider); + + /** + * Get the frame in which the orbit is propagated. + * <p> + * The propagation frame is the definition frame of the initial + * state, so this method should be called after this state has + * been set, otherwise it may return null. + * </p> + * + * @return frame in which the orbit is propagated + * @see #resetInitialState(SpacecraftState) + */ + @Override + public native Frame getFrame(); + + /** + * Propagate towards a target date. + * <p>Simple propagators use only the target date as the specification for + * computing the propagated state. More feature rich propagators can consider + * other information and provide different operating modes or G-stop + * facilities to stop at pinpointed events occurrences. In these cases, the + * target date is only a hint, not a mandatory objective.</p> + * + * @param target target date towards which orbit state should be propagated + * @return propagated state + */ + @Override + public native SpacecraftState propagate(AbsoluteDate target); + + /** + * Propagate from a start date towards a target date. + * <p>Those propagators use a start date and a target date to + * compute the propagated state. For propagators using event detection mechanism, + * if the provided start date is different from the initial state date, a first, + * simple propagation is performed, without processing any event computation. + * Then complete propagation is performed from start date to target date.</p> + * + * @param start start date from which orbit state should be propagated + * @param target target date to which orbit state should be propagated + * @return propagated state + */ + @Override + public SpacecraftState propagate(AbsoluteDate start, AbsoluteDate target) { + return this.propagate_2p(start, target); + } + + /** + * Propagate from a start date towards a target date. + * <p>Those propagators use a start date and a target date to + * compute the propagated state. For propagators using event detection mechanism, + * if the provided start date is different from the initial state date, a first, + * simple propagation is performed, without processing any event computation. + * Then complete propagation is performed from start date to target date.</p> + * + * @param start start date from which orbit state should be propagated + * @param target target date to which orbit state should be propagated + * @return propagated state + */ + public native SpacecraftState propagate_2p(AbsoluteDate start, AbsoluteDate target); + + /** + * Get the {@link PVCoordinates} of the body in the selected frame. + * + * @param date current date + * @param frame the frame where to define the position + * @return time-stamped position/velocity of the body (m and m/s) + */ + @Override + public native TimeStampedPVCoordinates getPVCoordinates(AbsoluteDate date, Frame frame); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonCelestialBody.java b/java_additions/src/main/java/org/orekit/python/PythonCelestialBody.java new file mode 100644 index 0000000000000000000000000000000000000000..10cb6e59ee8f8d11b51492aab630866dd578ad7a --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonCelestialBody.java @@ -0,0 +1,137 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.Field; +import org.hipparchus.RealFieldElement; +import org.orekit.bodies.CelestialBody; +import org.orekit.frames.Frame; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.utils.FieldPVCoordinatesProvider; +import org.orekit.utils.TimeStampedFieldPVCoordinates; +import org.orekit.utils.TimeStampedPVCoordinates; + +public class PythonCelestialBody implements CelestialBody { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get an inertially oriented, body centered frame. + * <p>The frame is always bound to the body center, and its axes have a + * fixed orientation with respect to other inertial frames.</p> + * + * @return an inertially oriented, body centered frame + * @see #getBodyOrientedFrame() + */ + @Override + public native Frame getInertiallyOrientedFrame(); + + /** + * Get a body oriented, body centered frame. + * <p>The frame is always bound to the body center, and its axes have a + * fixed orientation with respect to the celestial body.</p> + * + * @return a body oriented, body centered frame + * @see #getInertiallyOrientedFrame() + */ + @Override + public native Frame getBodyOrientedFrame(); + + /** + * Get the name of the body. + * + * @return name of the body + */ + @Override + public native String getName(); + + /** + * Get the attraction coefficient of the body. + * + * @return attraction coefficient of the body (m³/s²) + */ + @Override + public native double getGM(); + + /** + * Convert to a {@link FieldPVCoordinatesProvider} with a specific type. + * + * @param field field for the argument and value + * @return converted function + */ + @Override + public native <T extends RealFieldElement<T>> FieldPVCoordinatesProvider<T> toFieldPVCoordinatesProvider(Field<T> field); + + /** + * Get the {@link FieldPVCoordinates} of the body in the selected frame. + * + * @param date current date + * @param frame the frame where to define the position + * @return time-stamped position/velocity of the body (m and m/s) + */ + @Override + public <T extends RealFieldElement<T>> TimeStampedFieldPVCoordinates<T> getPVCoordinates(FieldAbsoluteDate<T> date, Frame frame) { + return this.getFieldPVCoordinates(date, frame); + } + + /** + * Get the {@link FieldPVCoordinates} of the body in the selected frame. + * + * @param date current date + * @param frame the frame where to define the position + * @return time-stamped position/velocity of the body (m and m/s) + */ + public native <T extends RealFieldElement<T>> TimeStampedFieldPVCoordinates<T> getFieldPVCoordinates(FieldAbsoluteDate<T> date, Frame frame); + + + /** + * Get the {@link PVCoordinates} of the body in the selected frame. + * + * @param date current date + * @param frame the frame where to define the position + * @return time-stamped position/velocity of the body (m and m/s) + */ + @Override + public native TimeStampedPVCoordinates getPVCoordinates(AbsoluteDate date, Frame frame); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonCelestialBodyLoader.java b/java_additions/src/main/java/org/orekit/python/PythonCelestialBodyLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..ead5234de859e3ad1121178b382bbb066b2a88f5 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonCelestialBodyLoader.java @@ -0,0 +1,60 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.bodies.CelestialBody; +import org.orekit.bodies.CelestialBodyLoader; + +public class PythonCelestialBodyLoader implements CelestialBodyLoader { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Load celestial body. + * + * @param name name of the celestial body + * @return loaded celestial body + */ + @Override + public native CelestialBody loadCelestialBody(String name); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonComparableMeasurement.java b/java_additions/src/main/java/org/orekit/python/PythonComparableMeasurement.java new file mode 100644 index 0000000000000000000000000000000000000000..7498e47de2424e9f9e98646fa32dd564baa52a9a --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonComparableMeasurement.java @@ -0,0 +1,88 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.estimation.measurements.ComparableMeasurement; +import org.orekit.time.AbsoluteDate; + +import java.util.SortedSet; + +public class PythonComparableMeasurement implements ComparableMeasurement { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the observed value. + * <p> + * The observed value is the value that was measured by the instrument. + * </p> + * + * @return observed value (array of size {@link #getDimension()} + */ + @Override + public native double[] getObservedValue(); + + /** + * {@inheritDoc} + * <p> + * Measurements comparison is primarily chronological, but measurements + * with the same date are sorted based on the observed value. Even if they + * have the same value too, they will <em>not</em> be considered equal if they + * correspond to different instances. This allows to store measurements in + * {@link SortedSet SortedSet} without losing any measurements, even + * redundant ones. + * </p> + * + * @param other + */ + @Override + public native int compareTo(ComparableMeasurement other); + + /** + * Get the date. + * + * @return date attached to the object + */ + @Override + public native AbsoluteDate getDate(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonCovarianceMatrixProvider.java b/java_additions/src/main/java/org/orekit/python/PythonCovarianceMatrixProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..152782b5e6eb0800a55b466df0c6d17309c7774b --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonCovarianceMatrixProvider.java @@ -0,0 +1,118 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.linear.RealMatrix; +import org.orekit.estimation.sequential.CovarianceMatrixProvider; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.conversion.PropagatorBuilder; + +public class PythonCovarianceMatrixProvider implements CovarianceMatrixProvider { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the initial covariance matrix. + * <p> + * The initial covariance matrix is a covariance matrix corresponding to the + * parameters managed by the {@link KalmanEstimator Kalman estimator}. + * The number of rows/columns and their order are as follows: + * </p> + * <ul> + * <li>The first 6 components correspond to the 6 orbital parameters + * of the associated propagator. All 6 parameters must always be present, + * regardless of the fact they are estimated or not.</li> + * <li>The following components correspond to the subset of propagation + * parameters of the associated propagator that are estimated.</li> + * <li>The remaining components correspond to the subset of measurements + * parameters that are estimated, considering all measurements, even + * the ones that correspond to spacecrafts not related to the + * associated propagator</li> + * </ul> + * <p> + * In most cases, the initial covariance matrix will be the output matrix + * of a previous run of the Kalman filter. + * </p> + * + * @param initial initial state state + * @return physical (i.e. non normalized) initial covariance matrix + * @see PropagatorBuilder#getOrbitalParametersDrivers() + * @see PropagatorBuilder#getPropagationParametersDrivers() + */ + @Override + public native RealMatrix getInitialCovarianceMatrix(SpacecraftState initial); + + /** + * Get the process noise matrix between previous and current states. + * <p> + * The process noise matrix is a covariance matrix corresponding to the + * parameters managed by the {@link KalmanEstimator Kalman estimator}. + * The number of rows/columns and their order are as follows: + * </p> + * <ul> + * <li>The first 6 components correspond to the 6 orbital parameters + * of the associated propagator. All 6 parameters must always be present, + * regardless of the fact they are estimated or not.</li> + * <li>The following components correspond to the subset of propagation + * parameters of the associated propagator that are estimated.</li> + * <li>The remaining components correspond to the subset of measurements + * parameters that are estimated, considering all measurements, even + * the ones that correspond to spacecrafts not related to the + * associated propagator</li> + * </ul> + * <p> + * In most cases, the process noise for the part corresponding to measurements + * (the final rows and columns) will be set to 0 for the process noise corresponding + * to the evolution between a non-null previous and current state. + * </p> + * + * @param previous previous state + * @param current current state + * @return physical (i.e. non normalized) process noise matrix between + * previous and current states + * @see PropagatorBuilder#getOrbitalParametersDrivers() + * @see PropagatorBuilder#getPropagationParametersDrivers() + */ + @Override + public native RealMatrix getProcessNoiseMatrix(SpacecraftState previous, SpacecraftState current); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonDTM2000InputParameters.java b/java_additions/src/main/java/org/orekit/python/PythonDTM2000InputParameters.java new file mode 100644 index 0000000000000000000000000000000000000000..911932171f7aee9289917a87a529fd7241ce41cf --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonDTM2000InputParameters.java @@ -0,0 +1,105 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.forces.drag.atmosphere.DTM2000InputParameters; +import org.orekit.time.AbsoluteDate; + +public class PythonDTM2000InputParameters implements DTM2000InputParameters { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Gets the available data range minimum date. + * + * @return the minimum date. + */ + @Override + public native AbsoluteDate getMinDate(); + + /** + * Gets the available data range maximum date. + * + * @return the maximum date. + */ + @Override + public native AbsoluteDate getMaxDate(); + + /** + * Get the value of the instantaneous solar flux. + * + * @param date the current date + * @return the instantaneous solar flux + */ + @Override + public native double getInstantFlux(AbsoluteDate date); + + /** + * Get the value of the mean solar flux. + * + * @param date the current date + * @return the mean solar flux + */ + @Override + public native double getMeanFlux(AbsoluteDate date); + + /** + * Get the value of the 3 hours geomagnetic index. + * With a delay of 3 hours at pole to 6 hours at equator using: + * delay=6-abs(lat)*0.033 (lat in deg.) + * + * @param date the current date + * @return the 3H geomagnetic index + */ + @Override + public native double getThreeHourlyKP(AbsoluteDate date); + + /** + * Get the last 24H mean geomagnetic index. + * + * @param date the current date + * @return the 24H geomagnetic index + */ + @Override + public native double get24HoursKp(AbsoluteDate date); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonDataFilter.java b/java_additions/src/main/java/org/orekit/python/PythonDataFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..192ed69ded6b4b8008df58f2b8183a36db9a39ae --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonDataFilter.java @@ -0,0 +1,83 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.data.DataFilter; +import org.orekit.data.NamedData; + +import java.io.IOException; + +public class PythonDataFilter implements DataFilter { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Filter the named data. + * <p> + * Filtering is often based on suffix. For example a gzip compressed + * file will have an original name of the form base.ext.gz when the + * corresponding uncompressed file will have a filtered name base.ext. + * </p> + * <p> + * Beware that as the {@link DataProvidersManager data providers manager} + * will attempt to pile all filters in a stack as long as their implementation + * of this method returns a value different from the {@code original} parameter. + * This implies that the filter, <em>must</em> perform some checks to see if it must + * be applied or not. If for example there is a need for a deciphering filter + * to be applied once to all data, then the filter should for example check + * for a suffix in the {@link NamedData#getName() name} and create a new + * filtered {@link NamedData} instance <em>only</em> if the suffix is present, + * removing the suffix from the filtered instance. Failing to do so and simply + * creating a filtered instance with one deciphering layer without changing the + * name would result in an infinite stack of deciphering filters being built, until + * a stack overflow or memory exhaustion exception occurs. + * </p> + * + * @param original original named data + * @return filtered named data, or {@code original} if this filter + * does not apply to this named data + * @throws IOException if filtered stream cannot be created + */ + @Override + public native NamedData filter(NamedData original) throws IOException; +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonDataLoader.java b/java_additions/src/main/java/org/orekit/python/PythonDataLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..9073350cb69ab4765d09c2618996f988442561bd --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonDataLoader.java @@ -0,0 +1,82 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.data.DataLoader; + +import java.io.IOException; +import java.io.InputStream; +import java.text.ParseException; + +public class PythonDataLoader implements DataLoader { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Check if the loader still accepts new data. + * <p> + * This method is used to speed up data loading by interrupting crawling + * the data sets as soon as a loader has found the data it was waiting for. + * For loaders that can merge data from any number of sources (for example + * JPL ephemerides or Earth Orientation Parameters that are split among + * several files), this method should always return true to make sure no + * data is left over. + * </p> + * + * @return true while the loader still accepts new data + */ + @Override + public native boolean stillAcceptsData(); + + /** + * Load data from a stream. + * + * @param input data input stream + * @param name name of the file (or zip entry) + * @throws IOException if data can't be read + * @throws ParseException if data can't be parsed + * or if some loader specific error occurs + */ + @Override + public native void loadData(InputStream input, String name) throws IOException, ParseException; +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonDataProvider.java b/java_additions/src/main/java/org/orekit/python/PythonDataProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..fba0134fc89252bfe2f5db2010c3db32c15da62d --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonDataProvider.java @@ -0,0 +1,80 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.data.DataLoader; +import org.orekit.data.DataProvider; + +import java.util.regex.Pattern; + +public class PythonDataProvider implements DataProvider { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Feed a data file loader by browsing the data collection. + * <p> + * The method crawls all files referenced in the instance (for example + * all files in a directories tree) and for each file supported by the + * file loader it asks the file loader to load it. + * </p> + * <p> + * If the method completes without exception, then the data loader + * is considered to have been fed successfully and the top level + * {@link DataProvidersManager data providers manager} will return + * immediately without attempting to use the next configured providers. + * </p> + * <p> + * If the method completes abruptly with an exception, then the top level + * {@link DataProvidersManager data providers manager} will try to use + * the next configured providers, in case another one can feed the + * {@link DataLoader data loader}. + * </p> + * + * @param supported pattern for file names supported by the visitor + * @param visitor data file visitor to use + * @return true if some data has been loaded + */ + @Override + public native boolean feed(Pattern supported, DataLoader visitor); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonDatesSelector.java b/java_additions/src/main/java/org/orekit/python/PythonDatesSelector.java new file mode 100644 index 0000000000000000000000000000000000000000..95add5517e309330e190b15a67c66b6a01a5204a --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonDatesSelector.java @@ -0,0 +1,74 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.time.AbsoluteDate; +import org.orekit.time.DatesSelector; + +import java.util.List; + +public class PythonDatesSelector implements DatesSelector { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Select dates within an interval. + * <p> + * The {@code start} and {@code end} date may be either in direct or reverse + * chronological order. The list is produced in the same order as {@code start} + * and {@code end}, i.e. direct chronological order if {@code start} is earlier + * than {@code end} or reverse chronological order if {@code start} is later + * than {@code end}. + * </p> + * <p> + * The ordering (direct or reverse chronological order) should not be changed + * between calls, otherwise unpredictable results may occur. + * </p> + * + * @param start interval start + * @param end interval end + * @return selected dates within this interval + */ + @Override + public native List<AbsoluteDate> selectDates(AbsoluteDate start, AbsoluteDate end); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonDiscreteTroposphericModel.java b/java_additions/src/main/java/org/orekit/python/PythonDiscreteTroposphericModel.java new file mode 100644 index 0000000000000000000000000000000000000000..25898db5f7884ce1f76d761ff8cdb40e2aea9066 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonDiscreteTroposphericModel.java @@ -0,0 +1,238 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +// TODO: Same name of methods! + +package org.orekit.python; + +import org.hipparchus.Field; +import org.hipparchus.RealFieldElement; +import org.orekit.models.earth.DiscreteTroposphericModel; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.utils.ParameterDriver; + +import java.util.List; + +public class PythonDiscreteTroposphericModel implements DiscreteTroposphericModel { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Calculates the tropospheric path delay for the signal path from a ground + * station to a satellite. + * + * @param elevation the elevation of the satellite, in radians + * @param height the height of the station in m above sea level + * @param parameters tropospheric model parameters. + * @param date current date + * @return the path delay due to the troposphere in m + */ + @Override + public native double pathDelay(double elevation, double height, double[] parameters, AbsoluteDate date); + + /** + * Calculates the tropospheric path delay for the signal path from a ground + * station to a satellite. + * + * @param elevation the elevation of the satellite, in radians + * @param height the height of the station in m above sea level + * @param parameters tropospheric model parameters. + * @param date current date + * @return the path delay due to the troposphere in m + */ + @Override + public <T extends RealFieldElement<T>> T pathDelay(T elevation, T height, T[] parameters, FieldAbsoluteDate<T> date) { + return this.pathFieldDelay(elevation, height, parameters, date); + } + + /** + * Calculates the tropospheric path delay for the signal path from a ground + * station to a satellite. + * + * @param elevation the elevation of the satellite, in radians + * @param height the height of the station in m above sea level + * @param parameters tropospheric model parameters. + * @param date current date + * @return the path delay due to the troposphere in m + */ + public native <T extends RealFieldElement<T>> T pathFieldDelay(T elevation, T height, T[] parameters, FieldAbsoluteDate<T> date); + + + /** + * This method allows the computation of the zenith hydrostatic and + * zenith wet delay. The resulting element is an array having the following form: + * <ul> + * <li>double[0] = D<sub>hz</sub> -> zenith hydrostatic delay + * <li>double[1] = D<sub>wz</sub> -> zenith wet delay + * </ul> + * + * @param height the height of the station in m above sea level. + * @param parameters tropospheric model parameters. + * @param date current date + * @return a two components array containing the zenith hydrostatic and wet delays. + */ + @Override + public native double[] computeZenithDelay(double height, double[] parameters, AbsoluteDate date); + + /** + * This method allows the computation of the zenith hydrostatic and + * zenith wet delay. The resulting element is an array having the following form: + * <ul> + * <li>T[0] = D<sub>hz</sub> -> zenith hydrostatic delay + * <li>T[1] = D<sub>wz</sub> -> zenith wet delay + * </ul> + * + * @param height the height of the station in m above sea level. + * @param parameters tropospheric model parameters. + * @param date current date + * @return a two components array containing the zenith hydrostatic and wet delays. + */ + @Override + public <T extends RealFieldElement<T>> T[] computeZenithDelay(T height, T[] parameters, FieldAbsoluteDate<T> date) { + return this.computeFieldZenithDelay(height, parameters, date); + } + + /** + * This method allows the computation of the zenith hydrostatic and + * zenith wet delay. The resulting element is an array having the following form: + * <ul> + * <li>T[0] = D<sub>hz</sub> -> zenith hydrostatic delay + * <li>T[1] = D<sub>wz</sub> -> zenith wet delay + * </ul> + * + * @param height the height of the station in m above sea level. + * @param parameters tropospheric model parameters. + * @param date current date + * @return a two components array containing the zenith hydrostatic and wet delays. + */ + public native <T extends RealFieldElement<T>> T[] computeFieldZenithDelay(T height, T[] parameters, FieldAbsoluteDate<T> date); + + /** + * This method allows the computation of the hydrostatic and + * wet mapping functions. The resulting element is an array having the following form: + * <ul> + * <li>double[0] = m<sub>h</sub>(e) -> hydrostatic mapping function + * <li>double[1] = m<sub>w</sub>(e) -> wet mapping function + * </ul> + * + * @param elevation the elevation of the satellite, in radians. + * @param height the height of the station in m above sea level. + * @param parameters tropospheric model parameters. + * @param date current date + * @return a two components array containing the hydrostatic and wet mapping functions. + */ + @Override + public native double[] mappingFactors(double elevation, double height, double[] parameters, AbsoluteDate date); + + /** + * This method allows the computation of the hydrostatic and + * wet mapping functions. The resulting element is an array having the following form: + * <ul> + * <li>T[0] = m<sub>h</sub>(e) -> hydrostatic mapping function + * <li>T[1] = m<sub>w</sub>(e) -> wet mapping function + * </ul> + * + * @param elevation the elevation of the satellite, in radians. + * @param height the height of the station in m above sea level. + * @param parameters tropospheric model parameters. + * @param date current date + * @return a two components array containing the hydrostatic and wet mapping functions. + */ + @Override + public <T extends RealFieldElement<T>> T[] mappingFactors(T elevation, T height, T[] parameters, FieldAbsoluteDate<T> date) { + return this.mappingFieldFactors(elevation, height, parameters, date); + } + + /** + * This method allows the computation of the hydrostatic and + * wet mapping functions. The resulting element is an array having the following form: + * <ul> + * <li>T[0] = m<sub>h</sub>(e) -> hydrostatic mapping function + * <li>T[1] = m<sub>w</sub>(e) -> wet mapping function + * </ul> + * + * @param elevation the elevation of the satellite, in radians. + * @param height the height of the station in m above sea level. + * @param parameters tropospheric model parameters. + * @param date current date + * @return a two components array containing the hydrostatic and wet mapping functions. + */ + public native <T extends RealFieldElement<T>> T[] mappingFieldFactors(T elevation, T height, T[] parameters, FieldAbsoluteDate<T> date); + + + /** + * Get the drivers for tropospheric model parameters. + * + * @return drivers for tropospheric model parameters + */ + @Override + public native List<ParameterDriver> getParametersDrivers(); + + /** + * Get tropospheric model parameters. + * + * @return tropospheric model parameters + */ + @Override + public native double[] getParameters(); + + /** + * Get tropospheric model parameters. + * + * @param field field to which the elements belong + * @return tropospheric model parameters + */ + @Override + public <T extends RealFieldElement<T>> T[] getParameters(Field<T> field) { + return this.getFieldParameters(field); + } + + /** + * Get tropospheric model parameters. + * + * @param field field to which the elements belong + * @return tropospheric model parameters + */ + public native <T extends RealFieldElement<T>> T[] getFieldParameters(Field<T> field); + +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonDragSensitive.java b/java_additions/src/main/java/org/orekit/python/PythonDragSensitive.java new file mode 100644 index 0000000000000000000000000000000000000000..5c0d2688f2faf2ff97ad8f96d38e42e23220f328 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonDragSensitive.java @@ -0,0 +1,140 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.hipparchus.analysis.differentiation.DerivativeStructure; +import org.hipparchus.geometry.euclidean.threed.FieldRotation; +import org.hipparchus.geometry.euclidean.threed.FieldVector3D; +import org.hipparchus.geometry.euclidean.threed.Rotation; +import org.hipparchus.geometry.euclidean.threed.Vector3D; +import org.orekit.forces.drag.DragSensitive; +import org.orekit.frames.Frame; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.utils.ParameterDriver; + +public class PythonDragSensitive implements DragSensitive { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the drivers for supported parameters. + * + * @return parameters drivers + * @since 8.0 + */ + @Override + public native ParameterDriver[] getDragParametersDrivers(); + + /** + * Compute the acceleration due to drag. + * <p> + * The computation includes all spacecraft specific characteristics + * like shape, area and coefficients. + * </p> + * + * @param date current date + * @param frame inertial reference frame for state (both orbit and attitude) + * @param position position of spacecraft in reference frame + * @param rotation orientation (attitude) of the spacecraft with respect to reference frame + * @param mass current mass + * @param density atmospheric density at spacecraft position + * @param relativeVelocity relative velocity of atmosphere with respect to spacecraft, + * in the same inertial frame as spacecraft orbit (m/s) + * @param parameters values of the force model parameters + * @return spacecraft acceleration in the same inertial frame as spacecraft orbit (m/s²) + */ + @Override + public native Vector3D dragAcceleration(AbsoluteDate date, Frame frame, Vector3D position, Rotation rotation, double mass, double density, Vector3D relativeVelocity, double[] parameters); + + /** + * Compute the acceleration due to drag. + * <p> + * The computation includes all spacecraft specific characteristics + * like shape, area and coefficients. + * </p> + * + * @param date current date + * @param frame inertial reference frame for state (both orbit and attitude) + * @param position position of spacecraft in reference frame + * @param rotation orientation (attitude) of the spacecraft with respect to reference frame + * @param mass current mass + * @param density atmospheric density at spacecraft position + * @param relativeVelocity relative velocity of atmosphere with respect to spacecraft, + * in the same inertial frame as spacecraft orbit (m/s) + * @param parameters values of the force model parameters + * @return spacecraft acceleration in the same inertial frame as spacecraft orbit (m/s²) + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> FieldVector3D<T> dragAcceleration(FieldAbsoluteDate<T> date, Frame frame, FieldVector3D<T> position, FieldRotation<T> rotation, T mass, T density, FieldVector3D<T> relativeVelocity, T[] parameters) { + return this.dragRealFieldElementAcceleration(date,frame, position, rotation, mass, density, relativeVelocity, parameters); + } + + public native <T extends RealFieldElement<T>> FieldVector3D<T> dragRealFieldElementAcceleration(FieldAbsoluteDate<T> date, Frame frame, FieldVector3D<T> position, FieldRotation<T> rotation, T mass, T density, FieldVector3D<T> relativeVelocity, T[] parameters); + + + /** + * Compute acceleration due to drag, with parameters derivatives. + * + * @param date current date + * @param frame inertial reference frame for state (both orbit and attitude) + * @param position position of spacecraft in reference frame + * @param rotation orientation (attitude) of the spacecraft with respect to reference frame + * @param mass current mass + * @param density atmospheric density at spacecraft position + * @param relativeVelocity relative velocity of atmosphere with respect to spacecraft, + * in the same inertial frame as spacecraft orbit (m/s) + * @param parameters values of the force model parameters + * @param paramName name of the parameter with respect to which derivatives are required + * @return spacecraft acceleration in the same inertial frame as spacecraft orbit (m/s²) + */ + @Override + public FieldVector3D<DerivativeStructure> dragAcceleration(AbsoluteDate date, Frame frame, Vector3D position, Rotation rotation, double mass, double density, Vector3D relativeVelocity, double[] parameters, String paramName) { + return this.dragFieldVector3DAcceleration(date,frame,position, rotation, mass, density, relativeVelocity, parameters, paramName); + } + + public native FieldVector3D<DerivativeStructure> dragFieldVector3DAcceleration(AbsoluteDate date, Frame frame, Vector3D position, Rotation rotation, double mass, double density, Vector3D relativeVelocity, double[] parameters, String paramName); + +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonEOPBasedTransformProvider.java b/java_additions/src/main/java/org/orekit/python/PythonEOPBasedTransformProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..8ccc0a2c1c8c303219b566ea00f29d6559a95ade --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonEOPBasedTransformProvider.java @@ -0,0 +1,120 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.frames.EOPBasedTransformProvider; +import org.orekit.frames.EOPHistory; +import org.orekit.frames.FieldTransform; +import org.orekit.frames.Transform; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; + +public class PythonEOPBasedTransformProvider implements EOPBasedTransformProvider { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the EOP history. + * + * @return EOP history + */ + @Override + public EOPHistory getEOPHistory() { + return null; + } + + /** + * Get a version of the provider that does <em>not</em> cache tidal corrections. + * <p> + * This method removes the performance enhancing interpolation features that are + * used by default in EOP-based provider, in order to focus on accuracy. The + * interpolation features are intended to save processing time by avoiding doing + * tidal correction evaluation at each time step and caching some results. This + * method can be used to avoid this (it is automatically called by {@link + * FramesFactory#getNonInterpolatingTransform(Frame, Frame, AbsoluteDate)}, when + * very high accuracy is desired, or for testing purposes. It should be used with + * care, as doing the full computation is <em>really</em> costly. + * </p> + * + * @return version of the provider that does <em>not</em> cache tidal corrections + * @see FramesFactory#getNonInterpolatingTransform(Frame, Frame, AbsoluteDate) + */ + @Override + public EOPBasedTransformProvider getNonInterpolatingProvider() { + return null; + } + + /** + * Get the {@link Transform} corresponding to specified date. + * + * @param date current date + * @return transform at specified date + */ + @Override + public Transform getTransform(AbsoluteDate date) { + return null; + } + + /** + * Get the {@link FieldTransform} corresponding to specified date. + * + * @param date current date + * @return transform at specified date + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> FieldTransform<T> getTransform(FieldAbsoluteDate<T> date) { + return this.getFieldTransform(date); + } + + /** + * Get the {@link FieldTransform} corresponding to specified date. + * + * @param date current date + * @return transform at specified date + * @since 9.0 + */ + + public native <T extends RealFieldElement<T>> FieldTransform<T> getFieldTransform(FieldAbsoluteDate<T> date); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonEOPHistoryLoader.java b/java_additions/src/main/java/org/orekit/python/PythonEOPHistoryLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..0341c629c0f929fa6eded9a1d6d7d7e9286f2cba --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonEOPHistoryLoader.java @@ -0,0 +1,63 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.frames.EOPEntry; +import org.orekit.frames.EOPHistoryLoader; +import org.orekit.utils.IERSConventions; + +import java.util.SortedSet; + +public class PythonEOPHistoryLoader implements EOPHistoryLoader { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Load celestial body. + * + * @param converter converter to use for nutation corrections + * @param history history to fill up + */ + @Override + public native void fillHistory(IERSConventions.NutationCorrectionConverter converter, SortedSet<EOPEntry> history); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonEarthShape.java b/java_additions/src/main/java/org/orekit/python/PythonEarthShape.java new file mode 100644 index 0000000000000000000000000000000000000000..fecce2c9114fb34052c6284086be85a77474bf62 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonEarthShape.java @@ -0,0 +1,224 @@ +/* Contributed in the public domain. + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.hipparchus.geometry.euclidean.threed.FieldLine; +import org.hipparchus.geometry.euclidean.threed.FieldVector3D; +import org.hipparchus.geometry.euclidean.threed.Line; +import org.hipparchus.geometry.euclidean.threed.Vector3D; +import org.orekit.bodies.FieldGeodeticPoint; +import org.orekit.bodies.GeodeticPoint; +import org.orekit.frames.Frame; +import org.orekit.models.earth.EarthShape; +import org.orekit.models.earth.ReferenceEllipsoid; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.utils.TimeStampedPVCoordinates; + +public class PythonEarthShape implements EarthShape { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the underlying ellipsoid model that defines latitude and longitude. If the + * height component of a {@link GeodeticPoint} is not needed, + * then using the ellipsoid will provide the quickest transformation. + * + * @return the reference ellipsoid. May be {@code this}, but never {@code null}. + */ + @Override + public native ReferenceEllipsoid getEllipsoid(); + + /** + * Get body frame related to body shape. + * + * @return body frame related to body shape + */ + @Override + public native Frame getBodyFrame(); + + /** + * Get the intersection point of a line with the surface of the body. + * <p>A line may have several intersection points with a closed + * surface (we consider the one point case as a degenerated two + * points case). The close parameter is used to select which of + * these points should be returned. The selected point is the one + * that is closest to the close point.</p> + * + * @param line test line (may intersect the body or not) + * @param close point used for intersections selection + * @param frame frame in which line is expressed + * @param date date of the line in given frame + * @return intersection point at altitude zero or null if the line does + * not intersect the surface + */ + @Override + public native GeodeticPoint getIntersectionPoint(Line line, Vector3D close, Frame frame, AbsoluteDate date); + + /** + * Get the intersection point of a line with the surface of the body. + * <p>A line may have several intersection points with a closed + * surface (we consider the one point case as a degenerated two + * points case). The close parameter is used to select which of + * these points should be returned. The selected point is the one + * that is closest to the close point.</p> + * + * @param line test line (may intersect the body or not) + * @param close point used for intersections selection + * @param frame frame in which line is expressed + * @param date date of the line in given frame + * @return intersection point at altitude zero or null if the line does + * not intersect the surface + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> FieldGeodeticPoint<T> getIntersectionPoint(FieldLine<T> line, FieldVector3D<T> close, Frame frame, FieldAbsoluteDate<T> date) { + return this.getFieldIntersectionPoint(line, close, frame, date); + } + + public native <T extends RealFieldElement<T>> FieldGeodeticPoint<T> getFieldIntersectionPoint(FieldLine<T> line, FieldVector3D<T> close, Frame frame, FieldAbsoluteDate<T> date); + + /** + * Project a point to the ground. + * + * @param point point to project + * @param date current date + * @param frame frame in which moving point is expressed + * @return ground point exactly at the local vertical of specified point, + * in the same frame as specified point + * @see #projectToGround(TimeStampedPVCoordinates, Frame) + * @since 7.0 + */ + @Override + public native Vector3D projectToGround(Vector3D point, AbsoluteDate date, Frame frame); + + /** + * Project a moving point to the ground. + * + * @param pv moving point + * @param frame frame in which moving point is expressed + * @return ground point exactly at the local vertical of specified point, + * in the same frame as specified point + * @see #projectToGround(Vector3D, AbsoluteDate, Frame) + * @since 7.0 + */ + @Override + public TimeStampedPVCoordinates projectToGround(TimeStampedPVCoordinates pv, Frame frame) { + return this.projectTimeStampedToGround(pv,frame); + } + + public native TimeStampedPVCoordinates projectTimeStampedToGround(TimeStampedPVCoordinates pv, Frame frame); + + /** + * Transform a Cartesian point to a surface-relative point. + * + * @param point Cartesian point + * @param frame frame in which Cartesian point is expressed + * @param date date of the computation (used for frames conversions) + * @return point at the same location but as a surface-relative point + */ + @Override + public native GeodeticPoint transform(Vector3D point, Frame frame, AbsoluteDate date); + + /** + * Transform a Cartesian point to a surface-relative point. + * + * @param point Cartesian point + * @param frame frame in which Cartesian point is expressed + * @param date date of the computation (used for frames conversions) + * @return point at the same location but as a surface-relative point + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> FieldGeodeticPoint<T> transform(FieldVector3D<T> point, Frame frame, FieldAbsoluteDate<T> date) { + return this.transformFV(point,frame, date); + } + + /** + * Transform a surface-relative point to a Cartesian point. + * + * @param point surface-relative point + * @return point at the same location but as a Cartesian point + */ + @Override + public Vector3D transform(GeodeticPoint point) { + return this.transformGP(point); + } + + /** + * Transform a Cartesian point to a surface-relative point. + * + * @param point Cartesian point + * @param frame frame in which Cartesian point is expressed + * @param date date of the computation (used for frames conversions) + * @return point at the same location but as a surface-relative point + * @since 9.0 + */ + + public native <T extends RealFieldElement<T>> FieldGeodeticPoint<T> transformFV(FieldVector3D<T> point, Frame frame, FieldAbsoluteDate<T> date); + + /** + * Transform a surface-relative point to a Cartesian point. + * + * @param point surface-relative point + * @return point at the same location but as a Cartesian point + */ + + public native Vector3D transformGP(GeodeticPoint point); + + /** + * Transform a surface-relative point to a Cartesian point. + * + * @param point surface-relative point + * @return point at the same location but as a Cartesian point + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> FieldVector3D<T> transform(FieldGeodeticPoint<T> point) { + return this.transformFGP(point); + } + + public native <T extends RealFieldElement<T>> FieldVector3D<T> transformFGP(FieldGeodeticPoint<T> point); + +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonEnablingPredicate.java b/java_additions/src/main/java/org/orekit/python/PythonEnablingPredicate.java new file mode 100644 index 0000000000000000000000000000000000000000..e74775ec73901ac4e612b5c83ae5509eddb90528 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonEnablingPredicate.java @@ -0,0 +1,64 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.events.EnablingPredicate; +import org.orekit.propagation.events.EventDetector; + +public class PythonEnablingPredicate<S extends EventDetector> implements EnablingPredicate<S> { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Compute an event enabling function of state. + * + * @param state current state + * @param eventDetector underlying detector + * @param g value of the underlying detector for the current state + * @return true if the event is enabled (i.e. it can be + * triggered), false if it should be ignored + */ + @Override + public native boolean eventIsEnabled(SpacecraftState state, S eventDetector, double g); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonEphemerisFile.java b/java_additions/src/main/java/org/orekit/python/PythonEphemerisFile.java new file mode 100644 index 0000000000000000000000000000000000000000..faaa8bb793c76495f204a92fa35e34a7db8fba24 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonEphemerisFile.java @@ -0,0 +1,61 @@ +/* Contributed in the public domain. + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.files.general.EphemerisFile; + +import java.util.Map; + +public class PythonEphemerisFile implements EphemerisFile { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the loaded ephemeris for each satellite in the file. + * + * @return a map from the satellite's ID to the information about that satellite + * contained in the file. + */ + @Override + public native Map<String, ? extends SatelliteEphemeris> getSatellites(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonEphemerisFileParser.java b/java_additions/src/main/java/org/orekit/python/PythonEphemerisFileParser.java new file mode 100644 index 0000000000000000000000000000000000000000..74debeef5de92ee686ec6656bfed646bee316860 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonEphemerisFileParser.java @@ -0,0 +1,86 @@ +/* Contributed in the public domain. + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.files.general.EphemerisFile; +import org.orekit.files.general.EphemerisFileParser; + +import java.io.BufferedReader; +import java.io.IOException; + +public class PythonEphemerisFileParser implements EphemerisFileParser { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Parse an ephemeris file from a stream. + * + * @param reader containing the ephemeris file. + * @param fileName to use in error messages. + * @return a parsed ephemeris file. + * @throws IOException if {@code reader} throws one. + */ + @Override + public native EphemerisFile parse(BufferedReader reader, String fileName) throws IOException; + + /** + * Parse an ephemeris file from a file on the local file system. + * + * <p> For Implementors: Most subclasses should implement this method as follows, but + * there is no default implementation because most subclasses should use a specialized + * return type. + * + * <code><pre> + * try (BufferedReader reader = Files.newBufferedReader(Paths.get(fileName))) { + * return parse(reader, fileName); + * } + * </pre></code> + * + * @param fileName path to the ephemeris file. + * @return parsed ephemeris file. + * @throws IOException if one is thrown while opening or reading from {@code + * fileName}. + */ + @Override + public native EphemerisFile parse(String fileName) throws IOException; +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonEphemerisFileWriter.java b/java_additions/src/main/java/org/orekit/python/PythonEphemerisFileWriter.java new file mode 100644 index 0000000000000000000000000000000000000000..f79a07f579fc4cccfe8122fb9f123e7ed7736144 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonEphemerisFileWriter.java @@ -0,0 +1,81 @@ +/* Copyright 2016 Applied Defense Solutions (ADS) + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * ADS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.files.general.EphemerisFile; +import org.orekit.files.general.EphemerisFileWriter; + +import java.io.IOException; + +public class PythonEphemerisFileWriter implements EphemerisFileWriter { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Write the passed in {@link EphemerisFile} using the passed in + * {@link Appendable}. + * + * @param writer a configured Appendable to feed with text + * @param ephemerisFile a populated ephemeris file to serialize into the buffer + * @throws IOException if any buffer writing operations fail or if the underlying + * format doesn't support a configuration in the EphemerisFile + * (for example having multiple satellites in one file, having + * the origin at an unspecified celestial body, etc.) + */ + @Override + public native void write(Appendable writer, EphemerisFile ephemerisFile) throws IOException; + + /** + * Write the passed in {@link EphemerisFile} to a file at the output path + * specified. + * + * @param outputFilePath a file path that the corresponding file will be written to + * @param ephemerisFile a populated ephemeris file to serialize into the buffer + * @throws IOException if any file writing operations fail or if the underlying + * format doesn't support a configuration in the EphemerisFile + * (for example having multiple satellites in one file, having + * the origin at an unspecified celestial body, etc.) + */ + @Override + public native void write(String outputFilePath, EphemerisFile ephemerisFile) throws IOException; +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonEstimationModifier.java b/java_additions/src/main/java/org/orekit/python/PythonEstimationModifier.java new file mode 100644 index 0000000000000000000000000000000000000000..180985ca0aad64476633e4cb45e1a6d86e0f95a3 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonEstimationModifier.java @@ -0,0 +1,71 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.estimation.measurements.EstimatedMeasurement; +import org.orekit.estimation.measurements.EstimationModifier; +import org.orekit.estimation.measurements.ObservedMeasurement; +import org.orekit.utils.ParameterDriver; + +import java.util.List; + +public class PythonEstimationModifier<T extends ObservedMeasurement<T>> implements EstimationModifier<T> { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the drivers for this modifier parameters. + * + * @return drivers for this modifier parameters + */ + @Override + public native List<ParameterDriver> getParametersDrivers(); + + /** + * Apply a modifier to an estimated measurement. + * + * @param estimated estimated measurement to modify + */ + @Override + public native void modify(EstimatedMeasurement<T> estimated); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonEstimationsProvider.java b/java_additions/src/main/java/org/orekit/python/PythonEstimationsProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..30d79dacdf6506a91cb7c1ed83a81480dc1c95c7 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonEstimationsProvider.java @@ -0,0 +1,70 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.estimation.measurements.EstimatedMeasurement; +import org.orekit.estimation.measurements.EstimationsProvider; + +public class PythonEstimationsProvider implements EstimationsProvider { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the number of evaluations available. + * + * @return number of evaluations available + */ + @Override + public native int getNumber(); + + /** + * Get one estimated measurement. + * + * @param index index of the estimated measurement, must be between 0 + * and {@link #getNumber() getNumber()} - 1, chronologically + * sorted + * @return estimated measurement at specified index + */ + @Override + public native EstimatedMeasurement<?> getEstimatedMeasurement(int index); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonExtendedPVCoordinatesProvider.java b/java_additions/src/main/java/org/orekit/python/PythonExtendedPVCoordinatesProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..048dbf72a1606524a17d5e2696e48dbe6699bdd9 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonExtendedPVCoordinatesProvider.java @@ -0,0 +1,87 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.frames.Frame; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.utils.ExtendedPVCoordinatesProvider; +import org.orekit.utils.TimeStampedFieldPVCoordinates; +import org.orekit.utils.TimeStampedPVCoordinates; + +public class PythonExtendedPVCoordinatesProvider implements ExtendedPVCoordinatesProvider { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the {@link FieldPVCoordinates} of the body in the selected frame. + * + * @param date current date + * @param frame the frame where to define the position + * @return time-stamped position/velocity of the body (m and m/s) + */ + @Override + public <T extends RealFieldElement<T>> TimeStampedFieldPVCoordinates<T> getPVCoordinates(FieldAbsoluteDate<T> date, Frame frame) { + return this.getFieldPVCoordinates(date, frame); + } + + /** + * Get the {@link FieldPVCoordinates} of the body in the selected frame. + * + * @param date current date + * @param frame the frame where to define the position + * @return time-stamped position/velocity of the body (m and m/s) + */ + public native <T extends RealFieldElement<T>> TimeStampedFieldPVCoordinates<T> getFieldPVCoordinates(FieldAbsoluteDate<T> date, Frame frame); + + /** + * Get the {@link PVCoordinates} of the body in the selected frame. + * + * @param date current date + * @param frame the frame where to define the position + * @return time-stamped position/velocity of the body (m and m/s) + */ + @Override + public native TimeStampedPVCoordinates getPVCoordinates(AbsoluteDate date, Frame frame); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldAbstractAnalyticalPropagator.java b/java_additions/src/main/java/org/orekit/python/PythonFieldAbstractAnalyticalPropagator.java new file mode 100644 index 0000000000000000000000000000000000000000..c536abf1b95e3bfa69f3df21d995af52eb43f1bf --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldAbstractAnalyticalPropagator.java @@ -0,0 +1,73 @@ +package org.orekit.python; + +import org.hipparchus.Field; +import org.hipparchus.RealFieldElement; +import org.orekit.attitudes.AttitudeProvider; +import org.orekit.orbits.FieldOrbit; +import org.orekit.propagation.FieldSpacecraftState; +import org.orekit.propagation.analytical.FieldAbstractAnalyticalPropagator; +import org.orekit.time.FieldAbsoluteDate; + +public class PythonFieldAbstractAnalyticalPropagator<T extends RealFieldElement<T>> extends FieldAbstractAnalyticalPropagator<T> { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** + * Build a new instance. + * + * @param field field used as default + * @param attitudeProvider provider for attitude computation + */ + protected PythonFieldAbstractAnalyticalPropagator(Field<T> field, AttitudeProvider attitudeProvider) { + super(field, attitudeProvider); + } + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the mass. + * + * @param date target date for the orbit + * @return mass mass + */ + @Override + public native T getMass(FieldAbsoluteDate<T> date); + + /** + * Reset an intermediate state. + * + * @param state new intermediate state to consider + * @param forward if true, the intermediate state is valid for + */ + @Override + public native void resetIntermediateState(FieldSpacecraftState<T> state, boolean forward); + + /** + * Extrapolate an orbit up to a specific target date. + * + * @param date target date for the orbit + * @return extrapolated parameters + */ + @Override + public native FieldOrbit<T> propagateOrbit(FieldAbsoluteDate<T> date); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldAbstractDetector.java b/java_additions/src/main/java/org/orekit/python/PythonFieldAbstractDetector.java new file mode 100644 index 0000000000000000000000000000000000000000..1a386122b4f7a8ff22a4808739a920625626d660 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldAbstractDetector.java @@ -0,0 +1,67 @@ +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.propagation.FieldSpacecraftState; +import org.orekit.propagation.events.FieldAbstractDetector; +import org.orekit.propagation.events.FieldEventDetector; +import org.orekit.propagation.events.handlers.FieldEventHandler; + +public class PythonFieldAbstractDetector<D extends FieldEventDetector<T>, + T extends RealFieldElement<T>> extends FieldAbstractDetector<D, T> { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** + * Build a new instance. + * + * @param maxCheck maximum checking interval (s) + * @param threshold convergence threshold (s) + * @param maxIter maximum number of iterations in the event time search + * @param handler event handler to call at event occurrences + */ + protected PythonFieldAbstractDetector(T maxCheck, T threshold, int maxIter, FieldEventHandler<? super D, T> handler) { + super(maxCheck, threshold, maxIter, handler); + } + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * {@inheritDoc} + * + * @param s + */ + @Override + public native T g(FieldSpacecraftState<T> s); + + /** + * Build a new instance. + * + * @param newMaxCheck maximum checking interval (s) + * @param newThreshold convergence threshold (s) + * @param newMaxIter maximum number of iterations in the event time search + * @param newHandler event handler to call at event occurrences + * @return a new instance of the appropriate sub-type + */ + @Override + public native D create(T newMaxCheck, T newThreshold, int newMaxIter, FieldEventHandler<? super D, T> newHandler); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldAbstractIntegratedPropagator.java b/java_additions/src/main/java/org/orekit/python/PythonFieldAbstractIntegratedPropagator.java new file mode 100644 index 0000000000000000000000000000000000000000..b32a43b95f59ef35e4de81bf7361aa027154e708 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldAbstractIntegratedPropagator.java @@ -0,0 +1,80 @@ +package org.orekit.python; + +import org.hipparchus.Field; +import org.hipparchus.RealFieldElement; +import org.hipparchus.ode.FieldODEIntegrator; +import org.orekit.attitudes.AttitudeProvider; +import org.orekit.frames.Frame; +import org.orekit.orbits.OrbitType; +import org.orekit.orbits.PositionAngle; +import org.orekit.propagation.integration.FieldAbstractIntegratedPropagator; +import org.orekit.propagation.integration.FieldStateMapper; +import org.orekit.time.FieldAbsoluteDate; + +public class PythonFieldAbstractIntegratedPropagator<T extends RealFieldElement<T>> extends FieldAbstractIntegratedPropagator<T> { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** + * Build a new instance. + * + * @param field Field used by default + * @param integrator numerical integrator to use for propagation. + * @param meanOrbit output only the mean orbit. + */ + protected PythonFieldAbstractIntegratedPropagator(Field<T> field, FieldODEIntegrator<T> integrator, boolean meanOrbit) { + super(field, integrator, meanOrbit); + } + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Create a mapper between raw double components and spacecraft state. + * /** Simple constructor. + * <p> + * The position parameter type is meaningful only if {@link + * #getOrbitType() propagation orbit type} + * support it. As an example, it is not meaningful for propagation + * in {@link OrbitType#CARTESIAN Cartesian} parameters. + * </p> + * + * @param referenceDate reference date + * @param mu central attraction coefficient (m³/s²) + * @param orbitType orbit type to use for mapping + * @param positionAngleType angle type to use for propagation + * @param attitudeProvider attitude provider + * @param frame inertial frame + * @return new mapper + */ + @Override + public native FieldStateMapper<T> createMapper(FieldAbsoluteDate<T> referenceDate, double mu, OrbitType orbitType, PositionAngle positionAngleType, AttitudeProvider attitudeProvider, Frame frame); + + /** + * Get the differential equations to integrate (for main state only). + * + * @param integ numerical integrator to use for propagation. + * @return differential equations for main state + */ + @Override + public native MainStateEquations<T> getMainStateEquations(FieldODEIntegrator<T> integ); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldAbstractPropagator.java b/java_additions/src/main/java/org/orekit/python/PythonFieldAbstractPropagator.java new file mode 100644 index 0000000000000000000000000000000000000000..4233a4b85cced014bd666abc516ecd25f91d9e45 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldAbstractPropagator.java @@ -0,0 +1,88 @@ +package org.orekit.python; + +import org.hipparchus.Field; +import org.hipparchus.RealFieldElement; +import org.orekit.propagation.FieldAbstractPropagator; +import org.orekit.propagation.FieldBoundedPropagator; +import org.orekit.propagation.FieldSpacecraftState; +import org.orekit.propagation.events.FieldEventDetector; +import org.orekit.time.FieldAbsoluteDate; + +import java.util.Collection; + +public class PythonFieldAbstractPropagator<T extends RealFieldElement<T>> extends FieldAbstractPropagator<T> { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** + * Build a new instance. + * + * @param field setting the field + */ + public PythonFieldAbstractPropagator(Field<T> field) { + super(field); + } + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * {@inheritDoc} + */ + @Override + public native FieldBoundedPropagator<T> getGeneratedEphemeris(); + + /** + * {@inheritDoc} + * + * @param detector + */ + @Override + public native <D extends FieldEventDetector<T>> void addEventDetector(D detector); + + /** + * {@inheritDoc} + */ + @Override + public native Collection<FieldEventDetector<T>> getEventsDetectors(); + + /** + * {@inheritDoc} + */ + @Override + public native void clearEventsDetectors(); + + /** + * Propagate from a start date towards a target date. + * <p>Those propagators use a start date and a target date to + * compute the propagated state. For propagators using event detection mechanism, + * if the provided start date is different from the initial state date, a first, + * simple propagation is performed, without processing any event computation. + * Then complete propagation is performed from start date to target date.</p> + * + * @param start start date from which orbit state should be propagated + * @param target target date to which orbit state should be propagated + * @return propagated state + */ + @Override + public native FieldSpacecraftState<T> propagate(FieldAbsoluteDate<T> start, FieldAbsoluteDate<T> target); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldAdditionalEquations.java b/java_additions/src/main/java/org/orekit/python/PythonFieldAdditionalEquations.java new file mode 100644 index 0000000000000000000000000000000000000000..cc4a5f2abc02f670567df7d0cf44ec808a998b0f --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldAdditionalEquations.java @@ -0,0 +1,116 @@ +/* Copyright 2010-2011 Centre National d'Études Spatiales + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// this file was created by SSC 2018 and is largely a derived work from the +// original java class + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.propagation.FieldSpacecraftState; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.integration.AbstractIntegratedPropagator; +import org.orekit.propagation.integration.AdditionalEquations; +import org.orekit.propagation.integration.FieldAdditionalEquations; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; + +/** This interface allows users to add their own differential equations to a numerical propagator. +* +* <p> +* In some cases users may need to integrate some problem-specific equations along with +* classical spacecraft equations of motions. One example is optimal control in low +* thrust where adjoint parameters linked to the minimized Hamiltonian must be integrated. +* Another example is formation flying or rendez-vous which use the Clohessy-Whiltshire +* equations for the relative motion. +* </p> +* <p> +* This interface allows users to add such equations to a {@link +* org.orekit.propagation.numerical.FieldNumericalPropagator numerical propagator}. Users provide the +* equations as an implementation of this interface and register it to the propagator thanks to +* its {@link org.orekit.propagation.numerical.FieldNumericalPropagator#addAdditionalEquations(FieldAdditionalEquations)} +* method. Several such objects can be registered with each numerical propagator, but it is +* recommended to gather in the same object the sets of parameters which equations can interact +* on each others states. +* </p> +* <p> +* The additional parameters are gathered in a simple p array. The additional equations compute +* the pDot array, which is the time-derivative of the p array. Since the additional parameters +* p may also have an influence on the equations of motion themselves that should be accumulated +* to the main state derivatives (for example an equation linked to a complex thrust model may +* induce an acceleration and a mass change), the {@link #computeDerivatives(FieldSpacecraftState, RealFieldElement[]) +* computeDerivatives} method can return a double array that will be +* <em>added</em> to the main state derivatives. This means these equations can be used as an +* additional force model if needed. If the additional parameters have no influence at all on +* the main spacecraft state, a null reference may be returned. +* </p> +* <p> +* This interface is the numerical (read not already integrated) counterpart of +* the {@link org.orekit.propagation.FieldAdditionalStateProvider} interface. +* It allows to append various additional state parameters to any {@link +* org.orekit.propagation.numerical.FieldNumericalPropagator numerical propagator}. +* </p> +* @see AbstractIntegratedPropagator +* @see org.orekit.propagation.AdditionalStateProvider +* @author Luc Maisonobe +*/ +public class PythonFieldAdditionalEquations<T extends RealFieldElement<T>> implements FieldAdditionalEquations<T> { + + + static final long serialVersionUID = 1L; + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + + /** Get the name of the additional state. + * @return name of the additional state + */ + public native String getName(); + + /** {@inheritDoc} */ + @Override + public native void init(final FieldSpacecraftState<T> initialState, final FieldAbsoluteDate<T> target); + + /** {@inheritDoc} */ + @Override + public native T[] computeDerivatives(FieldSpacecraftState<T> s, T[] pDot); + + +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldAdditionalStateProvider.java b/java_additions/src/main/java/org/orekit/python/PythonFieldAdditionalStateProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..bed643c7ba862d25f662ab5c855070ebee503faf --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldAdditionalStateProvider.java @@ -0,0 +1,68 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.propagation.FieldAdditionalStateProvider; +import org.orekit.propagation.FieldSpacecraftState; + +public class PythonFieldAdditionalStateProvider<T extends RealFieldElement<T>> implements FieldAdditionalStateProvider<T> { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the name of the additional state. + * + * @return name of the additional state + */ + @Override + public native String getName(); + + /** + * Get the additional state. + * + * @param state spacecraft state to which additional state should correspond + * @return additional state corresponding to spacecraft state + */ + @Override + public native T[] getAdditionalState(FieldSpacecraftState<T> state); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldBoundedPropagator.java b/java_additions/src/main/java/org/orekit/python/PythonFieldBoundedPropagator.java new file mode 100644 index 0000000000000000000000000000000000000000..3d0303d9c08b78601f6886a0235727e19cdb6eb9 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldBoundedPropagator.java @@ -0,0 +1,374 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.attitudes.AttitudeProvider; +import org.orekit.frames.Frame; +import org.orekit.propagation.FieldAdditionalStateProvider; +import org.orekit.propagation.FieldBoundedPropagator; +import org.orekit.propagation.FieldSpacecraftState; +import org.orekit.propagation.events.FieldEventDetector; +import org.orekit.propagation.integration.FieldAbstractIntegratedPropagator; +import org.orekit.propagation.integration.FieldAdditionalEquations; +import org.orekit.propagation.sampling.FieldOrekitFixedStepHandler; +import org.orekit.propagation.sampling.FieldOrekitStepHandler; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.utils.TimeStampedFieldPVCoordinates; + +import java.util.Collection; +import java.util.List; + +public class PythonFieldBoundedPropagator<T extends RealFieldElement<T>> implements FieldBoundedPropagator<T> { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the first date of the range. + * + * @return the first date of the range + */ + @Override + public native FieldAbsoluteDate<T> getMinDate(); + + /** + * Get the last date of the range. + * + * @return the last date of the range + */ + @Override + public native FieldAbsoluteDate<T> getMaxDate(); + + /** + * Get the current operating mode of the propagator. + * + * @return one of {@link #SLAVE_MODE}, {@link #MASTER_MODE}, + * {@link #EPHEMERIS_GENERATION_MODE} + * @see #setSlaveMode() + * @see #setMasterMode(RealFieldElement, FieldOrekitFixedStepHandler) + * @see #setMasterMode(FieldOrekitStepHandler) + * @see #setEphemerisMode() + */ + @Override + public native int getMode(); + + /** + * Set the propagator to slave mode. + * <p>This mode is used when the user needs only the final orbit at the target time. + * The (slave) propagator computes this result and return it to the calling + * (master) application, without any intermediate feedback.<p> + * <p>This is the default mode.</p> + * + * @see #setMasterMode(RealFieldElement, FieldOrekitFixedStepHandler) + * @see #setMasterMode(FieldOrekitStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #SLAVE_MODE + */ + @Override + public native void setSlaveMode(); + + /** + * Set the propagator to master mode with fixed steps. + * <p>This mode is used when the user needs to have some custom function called at the + * end of each finalized step during integration. The (master) propagator integration + * loop calls the (slave) application callback methods at each finalized step.</p> + * + * @param h fixed stepsize (s) + * @param handler handler called at the end of each finalized step + * @see #setSlaveMode() + * @see #setMasterMode(FieldOrekitStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #MASTER_MODE + */ + @Override + public void setMasterMode(T h, FieldOrekitFixedStepHandler<T> handler) { + this.setMasterMode_2p(h, handler); + } + + /** + * Set the propagator to master mode with fixed steps. + * <p>This mode is used when the user needs to have some custom function called at the + * end of each finalized step during integration. The (master) propagator integration + * loop calls the (slave) application callback methods at each finalized step.</p> + * + * @param h fixed stepsize (s) + * @param handler handler called at the end of each finalized step + * @see #setSlaveMode() + * @see #setMasterMode(FieldOrekitStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #MASTER_MODE + */ + public native void setMasterMode_2p(T h, FieldOrekitFixedStepHandler<T> handler); + + /** + * Set the propagator to master mode with variable steps. + * <p>This mode is used when the user needs to have some custom function called at the + * end of each finalized step during integration. The (master) propagator integration + * loop calls the (slave) application callback methods at each finalized step.</p> + * + * @param handler handler called at the end of each finalized step + * @see #setSlaveMode() + * @see #setMasterMode(RealFieldElement, FieldOrekitFixedStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #MASTER_MODE + */ + @Override + public native void setMasterMode(FieldOrekitStepHandler<T> handler); + + /** + * Set the propagator to ephemeris generation mode. + * <p>This mode is used when the user needs random access to the orbit state at any time + * between the initial and target times, and in no sequential order. A typical example is + * the implementation of search and iterative algorithms that may navigate forward and + * backward inside the propagation range before finding their result.</p> + * <p>Beware that since this mode stores <strong>all</strong> intermediate results, + * it may be memory intensive for long integration ranges and high precision/short + * time steps.</p> + * + * @see #getGeneratedEphemeris() + * @see #setSlaveMode() + * @see #setMasterMode(RealFieldElement, FieldOrekitFixedStepHandler) + * @see #setMasterMode(FieldOrekitStepHandler) + * @see #getMode() + * @see #EPHEMERIS_GENERATION_MODE + */ + @Override + public native void setEphemerisMode(); + + /** + * Get the ephemeris generated during propagation. + * + * @return generated ephemeris + * @throws IllegalStateException if the propagator was not set in ephemeris + * generation mode before propagation + * @see #setEphemerisMode() + */ + @Override + public native FieldBoundedPropagator<T> getGeneratedEphemeris() throws IllegalStateException; + + /** + * Get the propagator initial state. + * + * @return initial state + */ + @Override + public native FieldSpacecraftState<T> getInitialState(); + + /** + * Reset the propagator initial state. + * + * @param state new initial state to consider + */ + @Override + public native void resetInitialState(FieldSpacecraftState<T> state); + + /** + * Add a set of user-specified state parameters to be computed along with the orbit propagation. + * + * @param additionalStateProvider provider for additional state + */ + @Override + public native void addAdditionalStateProvider(FieldAdditionalStateProvider<T> additionalStateProvider); + + /** + * Get an unmodifiable list of providers for additional state. + * + * @return providers for the additional states + */ + @Override + public native List<FieldAdditionalStateProvider<T>> getAdditionalStateProviders(); + + /** + * Check if an additional state is managed. + * <p> + * Managed states are states for which the propagators know how to compute + * its evolution. They correspond to additional states for which an + * {@link FieldAdditionalStateProvider additional state provider} has been registered + * by calling the {@link #addAdditionalStateProvider(FieldAdditionalStateProvider) + * addAdditionalStateProvider} method. If the propagator is an {@link + * FieldAbstractIntegratedPropagator integrator-based + * propagator}, the states for which a set of {@link + * FieldAdditionalEquations additional equations} has + * been registered by calling the {@link + * FieldAbstractIntegratedPropagator#addAdditionalEquations( + *FieldAdditionalEquations) addAdditionalEquations} + * method are also counted as managed additional states. + * </p> + * <p> + * Additional states that are present in the {@link #getInitialState() initial state} + * but have no evolution method registered are <em>not</em> considered as managed states. + * These unmanaged additional states are not lost during propagation, though. Their + * value will simply be copied unchanged throughout propagation. + * </p> + * + * @param name name of the additional state + * @return true if the additional state is managed + */ + @Override + public native boolean isAdditionalStateManaged(String name); + + /** + * Get all the names of all managed states. + * + * @return names of all managed states + */ + @Override + public native String[] getManagedAdditionalStates(); + + /** + * Add an event detector. + * + * @param detector event detector to add + * @see #clearEventsDetectors() + * @see #getEventsDetectors() + */ + @Override + public native <D extends FieldEventDetector<T>> void addEventDetector(D detector); + + /** + * Get all the events detectors that have been added. + * + * @return an unmodifiable collection of the added detectors + * @see #addEventDetector(FieldEventDetector) + * @see #clearEventsDetectors() + */ + @Override + public native Collection<FieldEventDetector<T>> getEventsDetectors(); + + /** + * Remove all events detectors. + * + * @see #addEventDetector(FieldEventDetector) + * @see #getEventsDetectors() + */ + @Override + public native void clearEventsDetectors(); + + /** + * Get attitude provider. + * + * @return attitude provider + */ + @Override + public native AttitudeProvider getAttitudeProvider(); + + /** + * Set attitude provider. + * + * @param attitudeProvider attitude provider + */ + @Override + public native void setAttitudeProvider(AttitudeProvider attitudeProvider); + + /** + * Get the frame in which the orbit is propagated. + * <p> + * The propagation frame is the definition frame of the initial + * state, so this method should be called after this state has + * been set, otherwise it may return null. + * </p> + * + * @return frame in which the orbit is propagated + * @see #resetInitialState(FieldSpacecraftState) + */ + @Override + public native Frame getFrame(); + + /** + * Propagate towards a target date. + * <p>Simple propagators use only the target date as the specification for + * computing the propagated state. More feature rich propagators can consider + * other information and provide different operating modes or G-stop + * facilities to stop at pinpointed events occurrences. In these cases, the + * target date is only a hint, not a mandatory objective.</p> + * + * @param target target date towards which orbit state should be propagated + * @return propagated state + */ + @Override + public native FieldSpacecraftState<T> propagate(FieldAbsoluteDate<T> target); + + /** + * Propagate from a start date towards a target date. + * <p>Those propagators use a start date and a target date to + * compute the propagated state. For propagators using event detection mechanism, + * if the provided start date is different from the initial state date, a first, + * simple propagation is performed, without processing any event computation. + * Then complete propagation is performed from start date to target date.</p> + * + * @param start start date from which orbit state should be propagated + * @param target target date to which orbit state should be propagated + * @return propagated state + */ + @Override + public FieldSpacecraftState<T> propagate(FieldAbsoluteDate<T> start, FieldAbsoluteDate<T> target) { + return this.propagate_2p(start, target); + } + + /** + * Propagate from a start date towards a target date. + * <p>Those propagators use a start date and a target date to + * compute the propagated state. For propagators using event detection mechanism, + * if the provided start date is different from the initial state date, a first, + * simple propagation is performed, without processing any event computation. + * Then complete propagation is performed from start date to target date.</p> + * + * @param start start date from which orbit state should be propagated + * @param target target date to which orbit state should be propagated + * @return propagated state + */ + public native FieldSpacecraftState<T> propagate_2p(FieldAbsoluteDate<T> start, FieldAbsoluteDate<T> target); + + /** + * Get the {@link FieldPVCoordinates} of the body in the selected frame. + * + * @param date current date + * @param frame the frame where to define the position + * @return time-stamped position/velocity of the body (m and m/s) + */ + @Override + public native TimeStampedFieldPVCoordinates<T> getPVCoordinates(FieldAbsoluteDate<T> date, Frame frame); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldEventDetector.java b/java_additions/src/main/java/org/orekit/python/PythonFieldEventDetector.java new file mode 100644 index 0000000000000000000000000000000000000000..853ef7e82b2e9812c7d2c74414d92076444e74d5 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldEventDetector.java @@ -0,0 +1,137 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.propagation.FieldSpacecraftState; +import org.orekit.propagation.events.FieldEventDetector; +import org.orekit.propagation.events.handlers.FieldEventHandler; +import org.orekit.time.FieldAbsoluteDate; + +public class PythonFieldEventDetector<T extends RealFieldElement<T>> implements FieldEventDetector<T> { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Initialize event handler at the start of a propagation. + * <p> + * This method is called once at the start of the propagation. It + * may be used by the event handler to initialize some internal data + * if needed. + * </p> + * <p> + * The default implementation does nothing + * </p> + * + * @param s0 initial state + * @param t target time for the integration + */ + @Override + public native void init(FieldSpacecraftState<T> s0, FieldAbsoluteDate<T> t); + + /** + * Compute the value of the switching function. + * This function must be continuous (at least in its roots neighborhood), + * as the integrator will need to find its roots to locate the events. + * + * @param s the current state information: date, kinematics, attitude + * @return value of the switching function + */ + @Override + public native T g(FieldSpacecraftState<T> s); + + /** + * Get the convergence threshold in the event time search. + * + * @return convergence threshold (s) + */ + @Override + public native T getThreshold(); + + /** + * Get maximal time interval between switching function checks. + * + * @return maximal time interval (s) between switching function checks + */ + @Override + public native T getMaxCheckInterval(); + + /** + * Get maximal number of iterations in the event time search. + * + * @return maximal number of iterations in the event time search + */ + @Override + public native int getMaxIterationCount(); + + /** + * Handle the event. + * + * @param s SpaceCraft state to be used in the evaluation + * @param increasing with the event occurred in an "increasing" or "decreasing" slope direction + * @return the Action that the calling detector should pass back to the evaluation system + * @since 7.0 + */ + @Override + public native FieldEventHandler.Action eventOccurred(FieldSpacecraftState<T> s, boolean increasing); + + /** + * Reset the state prior to continue propagation. + * <p>This method is called after the step handler has returned and + * before the next step is started, but only when {@link + * #eventOccurred} has itself returned the {@link Action#RESET_STATE} + * indicator. It allows the user to reset the state for the next step, + * without perturbing the step handler of the finishing step. If the + * {@link #eventOccurred} never returns the {@link Action#RESET_STATE} + * indicator, this function will never be called, and it is safe to simply return null.</p> + * <p> + * The default implementation simply returns its argument. + * </p> + * + * @param oldState old state + * @return new state + * @since 7.0 + */ + @Override + public native FieldSpacecraftState<T> resetState(FieldSpacecraftState<T> oldState); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldModeHandler.java b/java_additions/src/main/java/org/orekit/python/PythonFieldModeHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..4ad698a783b0db748f52c44fb52e8498096ff1ef --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldModeHandler.java @@ -0,0 +1,61 @@ +/* Copyright 2010-2011 Centre National d'Études Spatiales + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.propagation.integration.FieldModeHandler; +import org.orekit.time.FieldAbsoluteDate; + +public class PythonFieldModeHandler<T extends RealFieldElement<T>> implements FieldModeHandler<T> { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Initialize the mode handler. + * + * @param activateHandlers if handlers shall be active + * @param targetDate propagation is expected to end on this date, but + * it may end early due to event detectors or + */ + @Override + public native void initialize(boolean activateHandlers, FieldAbsoluteDate<T> targetDate); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldOrekitFixedStepHandler.java b/java_additions/src/main/java/org/orekit/python/PythonFieldOrekitFixedStepHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..53d54cfce4adc0ff5ceb21e8a14aa6fcb8a891af --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldOrekitFixedStepHandler.java @@ -0,0 +1,77 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.propagation.FieldSpacecraftState; +import org.orekit.propagation.sampling.FieldOrekitFixedStepHandler; +import org.orekit.time.FieldAbsoluteDate; + +public class PythonFieldOrekitFixedStepHandler<T extends RealFieldElement<T>> implements FieldOrekitFixedStepHandler<T> { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Initialize step handler at the start of a propagation. + * <p> + * This method is called once at the start of the propagation. It + * may be used by the step handler to initialize some internal data + * if needed. + * </p> + * + * @param s0 initial state + * @param t target time for the integration + * @param step the duration in seconds of the fixed step. This value is + */ + @Override + public native void init(FieldSpacecraftState<T> s0, FieldAbsoluteDate<T> t, T step); + + /** + * Handle the current step. + * + * @param currentState current state at step time + * @param isLast if true, this is the last integration step + */ + @Override + public native void handleStep(FieldSpacecraftState<T> currentState, boolean isLast); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldOrekitStepHandler.java b/java_additions/src/main/java/org/orekit/python/PythonFieldOrekitStepHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..c7775f9b2ce7e15ff9699c4efd54a8947b8e441c --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldOrekitStepHandler.java @@ -0,0 +1,76 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.propagation.FieldSpacecraftState; +import org.orekit.propagation.sampling.FieldOrekitStepHandler; +import org.orekit.propagation.sampling.FieldOrekitStepInterpolator; +import org.orekit.time.FieldAbsoluteDate; + +public class PythonFieldOrekitStepHandler<T extends RealFieldElement<T>> implements FieldOrekitStepHandler<T> { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Initialize step handler at the start of a propagation. + * <p> + * This method is called once at the start of the propagation. It + * may be used by the step handler to initialize some internal data + * if needed. + * </p> + * + * @param s0 initial state + * @param t target time for the integration + */ + @Override + public native void init(FieldSpacecraftState<T> s0, FieldAbsoluteDate<T> t); + + /** + * Handle the current step. + * + * @param interpolator interpolator set up for the current step + * @param isLast if true, this is the last integration step + */ + @Override + public native void handleStep(FieldOrekitStepInterpolator<T> interpolator, boolean isLast); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldOrekitStepInterpolator.java b/java_additions/src/main/java/org/orekit/python/PythonFieldOrekitStepInterpolator.java new file mode 100644 index 0000000000000000000000000000000000000000..fdb156fc66b36fecbd176a5ef9586f48a793c38a --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldOrekitStepInterpolator.java @@ -0,0 +1,86 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.propagation.FieldSpacecraftState; +import org.orekit.propagation.sampling.FieldOrekitStepInterpolator; +import org.orekit.time.FieldAbsoluteDate; + +public class PythonFieldOrekitStepInterpolator<T extends RealFieldElement<T>> implements FieldOrekitStepInterpolator<T> { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the state at previous grid point date. + * + * @return state at previous grid point date + */ + @Override + public native FieldSpacecraftState<T> getPreviousState(); + + /** + * Get the state at previous grid point date. + * + * @return state at previous grid point date + */ + @Override + public native FieldSpacecraftState<T> getCurrentState(); + + /** + * Get the state at interpolated date. + * + * @param date date of the interpolated state + * @return state at interpolated date + * the date + */ + @Override + public native FieldSpacecraftState<T> getInterpolatedState(FieldAbsoluteDate<T> date); + + /** + * Check is integration direction is forward in date. + * + * @return true if integration is forward in date + */ + @Override + public native boolean isForward(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldPVCoordinatesProvider.java b/java_additions/src/main/java/org/orekit/python/PythonFieldPVCoordinatesProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..f09174f482ae15bd8ea535b7bdf85576cbf14f6c --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldPVCoordinatesProvider.java @@ -0,0 +1,64 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.frames.Frame; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.utils.FieldPVCoordinatesProvider; +import org.orekit.utils.TimeStampedFieldPVCoordinates; + +public class PythonFieldPVCoordinatesProvider<T extends RealFieldElement<T>> implements FieldPVCoordinatesProvider<T> { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the {@link FieldPVCoordinates} of the body in the selected frame. + * + * @param date current date + * @param frame the frame where to define the position + * @return time-stamped position/velocity of the body (m and m/s) + */ + @Override + public native TimeStampedFieldPVCoordinates<T> getPVCoordinates(FieldAbsoluteDate<T> date, Frame frame); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldPropagator.java b/java_additions/src/main/java/org/orekit/python/PythonFieldPropagator.java new file mode 100644 index 0000000000000000000000000000000000000000..24af051965d59f8eea6c6d6bd16bfa69a4e1f1f4 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldPropagator.java @@ -0,0 +1,362 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.attitudes.AttitudeProvider; +import org.orekit.frames.Frame; +import org.orekit.propagation.FieldAdditionalStateProvider; +import org.orekit.propagation.FieldBoundedPropagator; +import org.orekit.propagation.FieldPropagator; +import org.orekit.propagation.FieldSpacecraftState; +import org.orekit.propagation.events.FieldEventDetector; +import org.orekit.propagation.integration.FieldAbstractIntegratedPropagator; +import org.orekit.propagation.integration.FieldAdditionalEquations; +import org.orekit.propagation.sampling.FieldOrekitFixedStepHandler; +import org.orekit.propagation.sampling.FieldOrekitStepHandler; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.utils.TimeStampedFieldPVCoordinates; + +import java.util.Collection; +import java.util.List; + +public class PythonFieldPropagator<T extends RealFieldElement<T>> implements FieldPropagator<T> { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the current operating mode of the propagator. + * + * @return one of {@link #SLAVE_MODE}, {@link #MASTER_MODE}, + * {@link #EPHEMERIS_GENERATION_MODE} + * @see #setSlaveMode() + * @see #setMasterMode(RealFieldElement, FieldOrekitFixedStepHandler) + * @see #setMasterMode(FieldOrekitStepHandler) + * @see #setEphemerisMode() + */ + @Override + public native int getMode(); + + /** + * Set the propagator to slave mode. + * <p>This mode is used when the user needs only the final orbit at the target time. + * The (slave) propagator computes this result and return it to the calling + * (master) application, without any intermediate feedback.<p> + * <p>This is the default mode.</p> + * + * @see #setMasterMode(RealFieldElement, FieldOrekitFixedStepHandler) + * @see #setMasterMode(FieldOrekitStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #SLAVE_MODE + */ + @Override + public native void setSlaveMode(); + + /** + * Set the propagator to master mode with fixed steps. + * <p>This mode is used when the user needs to have some custom function called at the + * end of each finalized step during integration. The (master) propagator integration + * loop calls the (slave) application callback methods at each finalized step.</p> + * + * @param h fixed stepsize (s) + * @param handler handler called at the end of each finalized step + * @see #setSlaveMode() + * @see #setMasterMode(FieldOrekitStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #MASTER_MODE + */ + @Override + public void setMasterMode(T h, FieldOrekitFixedStepHandler<T> handler) { + this.setMasterMode_2p(h, handler); + } + + /** + * Set the propagator to master mode with fixed steps. + * <p>This mode is used when the user needs to have some custom function called at the + * end of each finalized step during integration. The (master) propagator integration + * loop calls the (slave) application callback methods at each finalized step.</p> + * + * @param h fixed stepsize (s) + * @param handler handler called at the end of each finalized step + * @see #setSlaveMode() + * @see #setMasterMode(FieldOrekitStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #MASTER_MODE + */ + public native void setMasterMode_2p(T h, FieldOrekitFixedStepHandler<T> handler); + + + /** + * Set the propagator to master mode with variable steps. + * <p>This mode is used when the user needs to have some custom function called at the + * end of each finalized step during integration. The (master) propagator integration + * loop calls the (slave) application callback methods at each finalized step.</p> + * + * @param handler handler called at the end of each finalized step + * @see #setSlaveMode() + * @see #setMasterMode(RealFieldElement, FieldOrekitFixedStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #MASTER_MODE + */ + @Override + public native void setMasterMode(FieldOrekitStepHandler<T> handler); + + /** + * Set the propagator to ephemeris generation mode. + * <p>This mode is used when the user needs random access to the orbit state at any time + * between the initial and target times, and in no sequential order. A typical example is + * the implementation of search and iterative algorithms that may navigate forward and + * backward inside the propagation range before finding their result.</p> + * <p>Beware that since this mode stores <strong>all</strong> intermediate results, + * it may be memory intensive for long integration ranges and high precision/short + * time steps.</p> + * + * @see #getGeneratedEphemeris() + * @see #setSlaveMode() + * @see #setMasterMode(RealFieldElement, FieldOrekitFixedStepHandler) + * @see #setMasterMode(FieldOrekitStepHandler) + * @see #getMode() + * @see #EPHEMERIS_GENERATION_MODE + */ + @Override + public native void setEphemerisMode(); + + /** + * Get the ephemeris generated during propagation. + * + * @return generated ephemeris + * @throws IllegalStateException if the propagator was not set in ephemeris + * generation mode before propagation + * @see #setEphemerisMode() + */ + @Override + public native FieldBoundedPropagator<T> getGeneratedEphemeris() throws IllegalStateException; + + /** + * Get the propagator initial state. + * + * @return initial state + */ + @Override + public native FieldSpacecraftState<T> getInitialState(); + + /** + * Reset the propagator initial state. + * + * @param state new initial state to consider + */ + @Override + public native void resetInitialState(FieldSpacecraftState<T> state); + + /** + * Add a set of user-specified state parameters to be computed along with the orbit propagation. + * + * @param additionalStateProvider provider for additional state + */ + @Override + public native void addAdditionalStateProvider(FieldAdditionalStateProvider<T> additionalStateProvider); + + /** + * Get an unmodifiable list of providers for additional state. + * + * @return providers for the additional states + */ + @Override + public native List<FieldAdditionalStateProvider<T>> getAdditionalStateProviders(); + + /** + * Check if an additional state is managed. + * <p> + * Managed states are states for which the propagators know how to compute + * its evolution. They correspond to additional states for which an + * {@link FieldAdditionalStateProvider additional state provider} has been registered + * by calling the {@link #addAdditionalStateProvider(FieldAdditionalStateProvider) + * addAdditionalStateProvider} method. If the propagator is an {@link + * FieldAbstractIntegratedPropagator integrator-based + * propagator}, the states for which a set of {@link + * FieldAdditionalEquations additional equations} has + * been registered by calling the {@link + * FieldAbstractIntegratedPropagator#addAdditionalEquations( + *FieldAdditionalEquations) addAdditionalEquations} + * method are also counted as managed additional states. + * </p> + * <p> + * Additional states that are present in the {@link #getInitialState() initial state} + * but have no evolution method registered are <em>not</em> considered as managed states. + * These unmanaged additional states are not lost during propagation, though. Their + * value will simply be copied unchanged throughout propagation. + * </p> + * + * @param name name of the additional state + * @return true if the additional state is managed + */ + @Override + public native boolean isAdditionalStateManaged(String name); + + /** + * Get all the names of all managed states. + * + * @return names of all managed states + */ + @Override + public native String[] getManagedAdditionalStates(); + + /** + * Add an event detector. + * + * @param detector event detector to add + * @see #clearEventsDetectors() + * @see #getEventsDetectors() + */ + @Override + public native <D extends FieldEventDetector<T>> void addEventDetector(D detector); + + /** + * Get all the events detectors that have been added. + * + * @return an unmodifiable collection of the added detectors + * @see #addEventDetector(FieldEventDetector) + * @see #clearEventsDetectors() + */ + @Override + public native Collection<FieldEventDetector<T>> getEventsDetectors(); + + /** + * Remove all events detectors. + * + * @see #addEventDetector(FieldEventDetector) + * @see #getEventsDetectors() + */ + @Override + public native void clearEventsDetectors(); + + /** + * Get attitude provider. + * + * @return attitude provider + */ + @Override + public native AttitudeProvider getAttitudeProvider(); + + /** + * Set attitude provider. + * + * @param attitudeProvider attitude provider + */ + @Override + public native void setAttitudeProvider(AttitudeProvider attitudeProvider); + + /** + * Get the frame in which the orbit is propagated. + * <p> + * The propagation frame is the definition frame of the initial + * state, so this method should be called after this state has + * been set, otherwise it may return null. + * </p> + * + * @return frame in which the orbit is propagated + * @see #resetInitialState(FieldSpacecraftState) + */ + @Override + public native Frame getFrame(); + + /** + * Propagate towards a target date. + * <p>Simple propagators use only the target date as the specification for + * computing the propagated state. More feature rich propagators can consider + * other information and provide different operating modes or G-stop + * facilities to stop at pinpointed events occurrences. In these cases, the + * target date is only a hint, not a mandatory objective.</p> + * + * @param target target date towards which orbit state should be propagated + * @return propagated state + */ + @Override + public native FieldSpacecraftState<T> propagate(FieldAbsoluteDate<T> target); + + /** + * Propagate from a start date towards a target date. + * <p>Those propagators use a start date and a target date to + * compute the propagated state. For propagators using event detection mechanism, + * if the provided start date is different from the initial state date, a first, + * simple propagation is performed, without processing any event computation. + * Then complete propagation is performed from start date to target date.</p> + * + * @param start start date from which orbit state should be propagated + * @param target target date to which orbit state should be propagated + * @return propagated state + */ + @Override + public FieldSpacecraftState<T> propagate(FieldAbsoluteDate<T> start, FieldAbsoluteDate<T> target) { + return this.propagate_2p(start, target); + } + + /** + * Propagate from a start date towards a target date. + * <p>Those propagators use a start date and a target date to + * compute the propagated state. For propagators using event detection mechanism, + * if the provided start date is different from the initial state date, a first, + * simple propagation is performed, without processing any event computation. + * Then complete propagation is performed from start date to target date.</p> + * + * @param start start date from which orbit state should be propagated + * @param target target date to which orbit state should be propagated + * @return propagated state + */ + public native FieldSpacecraftState<T> propagate_2p(FieldAbsoluteDate<T> start, FieldAbsoluteDate<T> target); + + + /** + * Get the {@link FieldPVCoordinates} of the body in the selected frame. + * + * @param date current date + * @param frame the frame where to define the position + * @return time-stamped position/velocity of the body (m and m/s) + */ + @Override + public native TimeStampedFieldPVCoordinates<T> getPVCoordinates(FieldAbsoluteDate<T> date, Frame frame); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldTimeDerivativesEquations.java b/java_additions/src/main/java/org/orekit/python/PythonFieldTimeDerivativesEquations.java new file mode 100644 index 0000000000000000000000000000000000000000..855108eb591e5053721097b56233ef3ac79f20b7 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldTimeDerivativesEquations.java @@ -0,0 +1,80 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.hipparchus.geometry.euclidean.threed.FieldVector3D; +import org.orekit.propagation.numerical.FieldTimeDerivativesEquations; + +public class PythonFieldTimeDerivativesEquations<T extends RealFieldElement<T>> implements FieldTimeDerivativesEquations<T> { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + /** + * Add the contribution of the Kepler evolution. + * <p>Since the Kepler evolution is the most important, it should + * be added after all the other ones, in order to improve + * numerical accuracy.</p> + * + * @param mu central body gravitational constant + */ + @Override + public native void addKeplerContribution(double mu); + + /** + * Add the contribution of an acceleration expressed in some inertial frame. + * + * @param gamma acceleration vector in the same inertial frame the spacecraft state is defined in (m/s²) + * @since 9.0 + */ + @Override + public native void addNonKeplerianAcceleration(FieldVector3D<T> gamma); + + /** + * Add the contribution of the flow rate (dm/dt). + * + * @param q the flow rate, must be negative (dm/dt) + * @throws IllegalArgumentException if flow-rate is positive + */ + @Override + public native void addMassDerivative(T q); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldTimeInterpolable.java b/java_additions/src/main/java/org/orekit/python/PythonFieldTimeInterpolable.java new file mode 100644 index 0000000000000000000000000000000000000000..49b1e7fc781c1cf921dc7692f5738a4bed0f5a8c --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldTimeInterpolable.java @@ -0,0 +1,55 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.time.FieldTimeInterpolable; + +import java.util.stream.Stream; + +public class PythonFieldTimeInterpolable<T extends FieldTimeInterpolable<T, KK>, KK extends RealFieldElement<KK>> implements FieldTimeInterpolable<T, KK> { + /** + * Get an interpolated instance. + * <p> + * Note that the state of the current instance may not be used + * in the interpolation process, only its type and non interpolable + * fields are used (for example central attraction coefficient or + * frame when interpolating orbits). The interpolable fields taken + * into account are taken only from the states of the sample points. + * So if the state of the instance must be used, the instance should + * be included in the sample points. + * </p> + * <p> + * Note that this method is designed for small samples only (say up + * to about 10-20 points) so it can be implemented using polynomial + * interpolation (typically Hermite interpolation). Using too much + * points may induce <a + * href="http://en.wikipedia.org/wiki/Runge%27s_phenomenon">Runge's + * phenomenon</a> and numerical problems (including NaN appearing). + * </p> + * + * @param date interpolation date + * @param sample sample points on which interpolation should be done + * @return a new instance, interpolated at specified date + */ + @Override + public native T interpolate(FieldAbsoluteDate<KK> date, Stream<T> sample); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldTimeShiftable.java b/java_additions/src/main/java/org/orekit/python/PythonFieldTimeShiftable.java new file mode 100644 index 0000000000000000000000000000000000000000..2a6e1e9115ccb303c07d4b1081d77a50441c1f7c --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldTimeShiftable.java @@ -0,0 +1,81 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.time.FieldTimeInterpolable; +import org.orekit.time.FieldTimeShiftable; + +public class PythonFieldTimeShiftable<T extends FieldTimeInterpolable<T, KK>, KK extends RealFieldElement<KK>> implements FieldTimeShiftable<T, KK> { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get a time-shifted instance. + * + * @param dt time shift in seconds + * @return a new instance, shifted with respect to instance (which is not changed) + */ + @Override + public native T shiftedBy(double dt); + + /** + * Get a time-shifted instance. Calls the ShiftedByType Python extension method + * + * @param dt time shift in seconds + * @return a new instance, shifted with respect to instance (which is not changed) + */ + @Override + public T shiftedBy(KK dt) { + return this.shiftedByType(dt); + } + + + /** + * Get a time-shifted instance. The Python extension method. + * + * @param dt time shift in seconds + * @return a new instance, shifted with respect to instance (which is not changed) + */ + public native T shiftedByType(KK dt); + +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldTimeStamped.java b/java_additions/src/main/java/org/orekit/python/PythonFieldTimeStamped.java new file mode 100644 index 0000000000000000000000000000000000000000..92b6f5fee8ff083834f58e5ec6beebdd22131418 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldTimeStamped.java @@ -0,0 +1,60 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.time.FieldTimeStamped; + +public class PythonFieldTimeStamped<T extends RealFieldElement<T>> implements FieldTimeStamped<T> { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the date. + * + * @return date attached to the object + */ + @Override + public native FieldAbsoluteDate<T> getDate(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonForceModel.java b/java_additions/src/main/java/org/orekit/python/PythonForceModel.java new file mode 100644 index 0000000000000000000000000000000000000000..d19d8f88f94e9d68bb2c9b1fdd239510403b6110 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonForceModel.java @@ -0,0 +1,218 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.Field; +import org.hipparchus.RealFieldElement; +import org.hipparchus.geometry.euclidean.threed.FieldVector3D; +import org.hipparchus.geometry.euclidean.threed.Vector3D; +import org.orekit.forces.ForceModel; +import org.orekit.propagation.FieldSpacecraftState; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.events.EventDetector; +import org.orekit.propagation.events.FieldEventDetector; +import org.orekit.propagation.numerical.FieldTimeDerivativesEquations; +import org.orekit.propagation.numerical.TimeDerivativesEquations; +import org.orekit.time.AbsoluteDate; +import org.orekit.utils.ParameterDriver; + +import java.util.stream.Stream; + +// TODO: CHECK HOW TO DEAL WITH METHODS OF SAME NAME!! + +public class PythonForceModel implements ForceModel { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Initialize the force model at the start of propagation. This method will be called + * before any calls to {@link #addContribution(SpacecraftState, TimeDerivativesEquations)}, + * {@link #addContribution(FieldSpacecraftState, FieldTimeDerivativesEquations)}, + * {@link #acceleration(SpacecraftState, double[])} or {@link #acceleration(FieldSpacecraftState, RealFieldElement[])} + * + * <p> The default implementation of this method does nothing.</p> + * + * @param initialState spacecraft state at the start of propagation. + * @param target date of propagation. Not equal to {@code initialState.getDate()}. + */ + @Override + public native void init(SpacecraftState initialState, AbsoluteDate target); + + /** + * Compute the contribution of the force model to the perturbing + * acceleration. + * <p> + * The default implementation simply adds the {@link #acceleration(SpacecraftState, double[]) acceleration} + * as a non-Keplerian acceleration. + * </p> + * + * @param s current state information: date, kinematics, attitude + * @param adder object where the contribution should be added + */ + @Override + public native void addContribution(SpacecraftState s, TimeDerivativesEquations adder); + + /** + * Compute the contribution of the force model to the perturbing + * acceleration. + * + * @param s current state information: date, kinematics, attitude + * @param adder object where the contribution should be added + */ + @Override + public <T extends RealFieldElement<T>> void addContribution(FieldSpacecraftState<T> s, FieldTimeDerivativesEquations<T> adder) { + this.addFieldContribution(s, adder); + } + + public native <T extends RealFieldElement<T>> void addFieldContribution(FieldSpacecraftState<T> s, FieldTimeDerivativesEquations<T> adder); + + /** + * Get force model parameters. + * + * @return force model parameters + * @since 9.0 + */ + @Override + public native double[] getParameters(); + + /** + * Get force model parameters. + * + * @param field field to which the elements belong + * @return force model parameters + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> T[] getParameters(Field<T> field) { + return this.getFieldParameters(field); + } + + /** + * Get force model parameters. + * + * @param field field to which the elements belong + * @return force model parameters + * @since 9.0 + */ + public native <T extends RealFieldElement<T>> T[] getFieldParameters(Field<T> field); + + /** + * Check if force models depends on position only. + * + * @return true if force model depends on position only, false + * if it depends on velocity, either directly or due to a dependency + * on attitude + * @since 9.0 + */ + @Override + public native boolean dependsOnPositionOnly(); + + /** + * Compute acceleration. + * + * @param s current state information: date, kinematics, attitude + * @param parameters values of the force model parameters + * @return acceleration in same frame as state + * @since 9.0 + */ + @Override + public native Vector3D acceleration(SpacecraftState s, double[] parameters); + + /** + * Compute acceleration. + * + * @param s current state information: date, kinematics, attitude + * @param parameters values of the force model parameters + * @return acceleration in same frame as state + * @since 9.0 + */ + @Override + public native <T extends RealFieldElement<T>> FieldVector3D<T> acceleration(FieldSpacecraftState<T> s, T[] parameters); + + /** + * Get the discrete events related to the model. + * + * @return stream of events detectors + */ + @Override + public native Stream<EventDetector> getEventsDetectors(); + + /** + * Get the discrete events related to the model. + * + * @param field field to which the state belongs + * @return stream of events detectors + */ + @Override + public native <T extends RealFieldElement<T>> Stream<FieldEventDetector<T>> getFieldEventsDetectors(Field<T> field); + + /** + * Get the drivers for force model parameters. + * + * @return drivers for force model parameters + * @since 8.0 + */ + @Override + public native ParameterDriver[] getParametersDrivers(); + + /** + * Get parameter value from its name. + * + * @param name parameter name + * @return parameter value + * @since 8.0 + */ + @Override + public native ParameterDriver getParameterDriver(String name); + + /** + * Check if a parameter is supported. + * <p>Supported parameters are those listed by {@link #getParametersDrivers()}.</p> + * + * @param name parameter name to check + * @return true if the parameter is supported + * @see #getParametersDrivers() + */ + @Override + public native boolean isSupported(String name); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonGNSSAttitudeProvider.java b/java_additions/src/main/java/org/orekit/python/PythonGNSSAttitudeProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..1c82df49c8e4aa133d770406dbc0d426b519a326 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonGNSSAttitudeProvider.java @@ -0,0 +1,110 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.attitudes.Attitude; +import org.orekit.attitudes.FieldAttitude; +import org.orekit.frames.Frame; +import org.orekit.gnss.attitude.GNSSAttitudeProvider; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.utils.FieldPVCoordinatesProvider; +import org.orekit.utils.PVCoordinatesProvider; + +public class PythonGNSSAttitudeProvider implements GNSSAttitudeProvider { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get start of validity for this provider. + * + * @return start of validity for this provider + */ + @Override + public native AbsoluteDate validityStart(); + + /** + * Get end of validity for this provider. + * + * @return end of validity for this provider + */ + @Override + public native AbsoluteDate validityEnd(); + + /** + * Compute the attitude corresponding to an orbital state. + * + * @param pvProv local position-velocity provider around current date + * @param date current date + * @param frame reference frame from which attitude is computed + * @return attitude attitude on the specified date and position-velocity state + */ + @Override + public native Attitude getAttitude(PVCoordinatesProvider pvProv, AbsoluteDate date, Frame frame); + + /** + * Compute the attitude corresponding to an orbital state. + * + * @param pvProv local position-velocity provider around current date + * @param date current date + * @param frame reference frame from which attitude is computed + * @return attitude attitude on the specified date and position-velocity state + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> FieldAttitude<T> getAttitude(FieldPVCoordinatesProvider<T> pvProv, FieldAbsoluteDate<T> date, Frame frame) { + return this.getFieldAttitude(pvProv, date, frame); + } + + /** + * Compute the attitude corresponding to an orbital state. + * + * @param pvProv local position-velocity provider around current date + * @param date current date + * @param frame reference frame from which attitude is computed + * @return attitude attitude on the specified date and position-velocity state + * @since 9.0 + */ + public native <T extends RealFieldElement<T>> FieldAttitude<T> getFieldAttitude(FieldPVCoordinatesProvider<T> pvProv, FieldAbsoluteDate<T> date, Frame frame); + +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonGPSOrbitalElements.java b/java_additions/src/main/java/org/orekit/python/PythonGPSOrbitalElements.java new file mode 100644 index 0000000000000000000000000000000000000000..b509fdb0b42f59a66f2c363aed5a16f50da801f5 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonGPSOrbitalElements.java @@ -0,0 +1,330 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.propagation.analytical.gnss.GPSOrbitalElements; +import org.orekit.time.AbsoluteDate; + +public class PythonGPSOrbitalElements implements GPSOrbitalElements { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Gets the PRN number of the GPS satellite. + * + * @return the PRN number of the GPS satellite + */ + @Override + public int getPRN() { + return 0; + } + + /** + * Gets the Reference Week of the GPS orbit. + * + * @return the Reference Week of the GPS orbit within [0, 1024[ + */ + @Override + public int getWeek() { + return 0; + } + + /** + * Gets the Reference Time of the GPS orbit as a duration from week start. + * + * @return the Reference Time of the GPS orbit (s) + */ + @Override + public double getTime() { + return 0; + } + + /** + * Gets the Semi-Major Axis. + * + * @return the Semi-Major Axis (m) + */ + @Override + public double getSma() { + return 0; + } + + /** + * Gets the Mean Motion. + * + * @return the Mean Motion (rad/s) + */ + @Override + public double getMeanMotion() { + return 0; + } + + /** + * Gets the Eccentricity. + * + * @return the Eccentricity + */ + @Override + public double getE() { + return 0; + } + + /** + * Gets the Inclination Angle at Reference Time. + * + * @return the Inclination Angle at Reference Time (rad) + */ + @Override + public double getI0() { + return 0; + } + + /** + * Gets the Rate of Inclination Angle. + * + * @return the Rate of Inclination Angle (rad/s) + */ + @Override + public double getIDot() { + return 0; + } + + /** + * Gets the Longitude of Ascending Node of Orbit Plane at Weekly Epoch. + * + * @return the Longitude of Ascending Node of Orbit Plane at Weekly Epoch (rad) + */ + @Override + public double getOmega0() { + return 0; + } + + /** + * Gets the Rate of Right Ascension. + * + * @return the Rate of Right Ascension (rad/s) + */ + @Override + public double getOmegaDot() { + return 0; + } + + /** + * Gets the Argument of Perigee. + * + * @return the Argument of Perigee (rad) + */ + @Override + public double getPa() { + return 0; + } + + /** + * Gets the Mean Anomaly at Reference Time. + * + * @return the Mean Anomaly at Reference Time (rad) + */ + @Override + public double getM0() { + return 0; + } + + /** + * Gets the Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude. + * + * @return the Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude (rad) + */ + @Override + public double getCuc() { + return 0; + } + + /** + * Gets the Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude. + * + * @return the Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude (rad) + */ + @Override + public double getCus() { + return 0; + } + + /** + * Gets the Amplitude of the Cosine Harmonic Correction Term to the Orbit Radius. + * + * @return the Amplitude of the Cosine Harmonic Correction Term to the Orbit Radius (m) + */ + @Override + public double getCrc() { + return 0; + } + + /** + * Gets the Amplitude of the Sine Harmonic Correction Term to the Orbit Radius. + * + * @return the Amplitude of the Sine Harmonic Correction Term to the Orbit Radius (m) + */ + @Override + public double getCrs() { + return 0; + } + + /** + * Gets the Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination. + * + * @return the Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination (rad) + */ + @Override + public double getCic() { + return 0; + } + + /** + * Gets the Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination. + * + * @return the Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination (rad) + */ + @Override + public double getCis() { + return 0; + } + + /** + * Gets the Issue Of Data Clock (IODC). + * + * @return the Issue Of Data Clock (IODC) + * @since 9.3 + */ + @Override + public int getIODC() { + return 0; + } + + /** + * Gets the Issue Of Data Ephemeris (IODE). + * + * @return the Issue Of Data Ephemeris (IODE) + * @since 9.3 + */ + @Override + public int getIODE() { + return 0; + } + + /** + * Gets the Zeroth Order Clock Correction. + * + * @return the Zeroth Order Clock Correction (s) + * @see #getAf1() + * @see #getAf2() + * @see #getToc() + * @since 9.3 + */ + @Override + public double getAf0() { + return 0; + } + + /** + * Gets the First Order Clock Correction. + * + * @return the First Order Clock Correction (s/s) + * @see #getAf0() + * @see #getAf2() + * @see #getToc() + * @since 9.3 + */ + @Override + public double getAf1() { + return 0; + } + + /** + * Gets the Second Order Clock Correction. + * + * @return the Second Order Clock Correction (s/s²) + * @see #getAf0() + * @see #getAf1() + * @see #getToc() + * @since 9.3 + */ + @Override + public double getAf2() { + return 0; + } + + /** + * Gets the clock correction reference time toc. + * + * @return the clock correction reference time (s) + * @see #getAf0() + * @see #getAf1() + * @see #getAf2() + * @since 9.3 + */ + @Override + public double getToc() { + return 0; + } + + /** + * Gets the estimated group delay differential TGD for L1-L2 correction. + * + * @return the estimated group delay differential TGD for L1-L2 correction (s) + * @since 9.3 + */ + @Override + public double getTGD() { + return 0; + } + + /** + * Get the date. + * + * @return date attached to the object + */ + @Override + public AbsoluteDate getDate() { + return null; + } +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonIAUPole.java b/java_additions/src/main/java/org/orekit/python/PythonIAUPole.java new file mode 100644 index 0000000000000000000000000000000000000000..32c588d4f587161eade1a388f770c7547f30a400 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonIAUPole.java @@ -0,0 +1,166 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import java.io.Serializable; + +import org.hipparchus.RealFieldElement; +import org.hipparchus.geometry.euclidean.threed.FieldVector3D; +import org.hipparchus.geometry.euclidean.threed.Vector3D; +import org.orekit.bodies.IAUPole; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; + + +public class PythonIAUPole implements IAUPole { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the body North pole direction in ICRF frame. + * + * @param date current date + * @return body North pole direction in ICRF frame + */ + @Override + public native Vector3D getPole(AbsoluteDate date); + + /** + * Get the body North pole direction in ICRF frame. + * + * @param date current date + * @return body North pole direction in ICRF frame + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> FieldVector3D<T> getPole(FieldAbsoluteDate<T> date) { + return this.getFieldPole(date); + } + + /** + * Get the body North pole direction in ICRF frame. + * + * @param date current date + * @return body North pole direction in ICRF frame + * @since 9.0 + */ + public native <T extends RealFieldElement<T>> FieldVector3D<T> getFieldPole(FieldAbsoluteDate<T> date); + + + + /** + * Get the body Q Node direction in ICRF frame. + * + * @param date current date + * @return body Q Node direction in ICRF frame + * @since 9.1 + */ + @Override + public native Vector3D getNode(AbsoluteDate date); + + /** + * Get the body Q Node direction in ICRF frame. + * + * @param date current date + * @return body Q Node direction in ICRF frame + * @since 9.1 + */ + @Override + public <T extends RealFieldElement<T>> FieldVector3D<T> getNode(FieldAbsoluteDate<T> date) { + return this.getFieldNode(date); + } + + /** + * Get the body Q Node direction in ICRF frame. + * + * @param date current date + * @return body Q Node direction in ICRF frame + * @since 9.1 + */ + public native <T extends RealFieldElement<T>> FieldVector3D<T> getFieldNode(FieldAbsoluteDate<T> date); + + + /** + * Get the prime meridian angle. + * <p> + * The prime meridian angle is the angle between the Q node and the + * prime meridian. represents the body rotation. + * </p> + * + * @param date current date + * @return prime meridian vector + */ + @Override + public native double getPrimeMeridianAngle(AbsoluteDate date); + + /** + * Get the prime meridian angle. + * <p> + * The prime meridian angle is the angle between the Q node and the + * prime meridian. represents the body rotation. + * </p> + * + * @param date current date + * @return prime meridian vector + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> T getPrimeMeridianAngle(FieldAbsoluteDate<T> date) { + return this.getFieldPrimeMeridianAngle(date); + } + + /** + * Get the prime meridian angle. + * <p> + * The prime meridian angle is the angle between the Q node and the + * prime meridian. represents the body rotation. + * </p> + * + * @param date current date + * @return prime meridian vector + * @since 9.0 + */ + public native <T extends RealFieldElement<T>> T getFieldPrimeMeridianAngle(FieldAbsoluteDate<T> date); + + +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonIonosphericModel.java b/java_additions/src/main/java/org/orekit/python/PythonIonosphericModel.java new file mode 100644 index 0000000000000000000000000000000000000000..0b019fe4476dd2ef8ee5c713c31e03517edb7e89 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonIonosphericModel.java @@ -0,0 +1,65 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.bodies.GeodeticPoint; +import org.orekit.models.earth.IonosphericModel; +import org.orekit.time.AbsoluteDate; + +public class PythonIonosphericModel implements IonosphericModel { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Calculates the ionospheric path delay for the signal path from a ground + * station to a satellite. + * + * @param date current date + * @param geo the Geodetic point of receiver/station + * @param elevation the elevation of the satellite + * @param azimuth the azimuth of the satellite + * @return the path delay due to the ionosphere in m + */ + @Override + public native double pathDelay(AbsoluteDate date, GeodeticPoint geo, double elevation, double azimuth); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonJB2008InputParameters.java b/java_additions/src/main/java/org/orekit/python/PythonJB2008InputParameters.java new file mode 100644 index 0000000000000000000000000000000000000000..55cad3c04484b91bb0e65dd6344020fa17173403 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonJB2008InputParameters.java @@ -0,0 +1,159 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.forces.drag.atmosphere.JB2008InputParameters; +import org.orekit.time.AbsoluteDate; + +public class PythonJB2008InputParameters implements JB2008InputParameters { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Gets the available data range minimum date. + * + * @return the minimum date. + */ + @Override + public AbsoluteDate getMinDate() { + return null; + } + + /** + * Gets the available data range maximum date. + * + * @return the maximum date. + */ + @Override + public native AbsoluteDate getMaxDate(); + + /** + * Get the value of the instantaneous solar flux index + * (1e<sup>-22</sup>*Watt/(m²*Hertz)). + * <p>Tabular time 1.0 day earlier.</p> + * + * @param date the current date + * @return the instantaneous F10.7 index + */ + @Override + public native double getF10(AbsoluteDate date); + + /** + * Get the value of the mean solar flux. + * Averaged 81-day centered F10.7 B index on the input time. + * <p>Tabular time 1.0 day earlier.</p> + * + * @param date the current date + * @return the mean solar flux F10.7B index + */ + @Override + public native double getF10B(AbsoluteDate date); + + /** + * Get the EUV index (26-34 nm) scaled to F10. + * <p>Tabular time 1.0 day earlier.</p> + * + * @param date the current date + * @return the the EUV S10 index + */ + @Override + public native double getS10(AbsoluteDate date); + + /** + * Get the EUV 81-day averaged centered index. + * <p>Tabular time 1.0 day earlier.</p> + * + * @param date the current date + * @return the the mean EUV S10B index + */ + @Override + public native double getS10B(AbsoluteDate date); + + /** + * Get the MG2 index scaled to F10. + * <p>Tabular time 2.0 days earlier.</p> + * + * @param date the current date + * @return the the MG2 index + */ + @Override + public native double getXM10(AbsoluteDate date); + + /** + * Get the MG2 81-day average centered index. + * <p>Tabular time 2.0 days earlier.</p> + * + * @param date the current date + * @return the the mean MG2 index + */ + @Override + public native double getXM10B(AbsoluteDate date); + + /** + * Get the Solar X-Ray & Lya index scaled to F10. + * <p>Tabular time 5.0 days earlier.</p> + * + * @param date the current date + * @return the Solar X-Ray & Lya index scaled to F10 + */ + @Override + public native double getY10(AbsoluteDate date); + + /** + * Get the Solar X-Ray & Lya 81-day ave. centered index. + * <p>Tabular time 5.0 days earlier.</p> + * + * @param date the current date + * @return the Solar X-Ray & Lya 81-day ave. centered index + */ + @Override + public native double getY10B(AbsoluteDate date); + + /** + * Get the temperature change computed from Dst index. + * + * @param date the current date + * @return the temperature change computed from Dst index + */ + @Override + public native double getDSTDTC(AbsoluteDate date); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonKalmanEstimation.java b/java_additions/src/main/java/org/orekit/python/PythonKalmanEstimation.java new file mode 100644 index 0000000000000000000000000000000000000000..dff0d17855222dc5f0830d13502d4bcf617711a3 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonKalmanEstimation.java @@ -0,0 +1,190 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.linear.RealMatrix; +import org.hipparchus.linear.RealVector; +import org.orekit.estimation.measurements.EstimatedMeasurement; +import org.orekit.estimation.sequential.KalmanEstimation; +import org.orekit.propagation.SpacecraftState; +import org.orekit.time.AbsoluteDate; +import org.orekit.utils.ParameterDriversList; + +public class PythonKalmanEstimation implements KalmanEstimation { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the list of estimated orbital parameters. + * + * @return the list of estimated orbital parameters + */ + @Override + public native ParameterDriversList getEstimatedOrbitalParameters(); + + /** + * Get the list of estimated propagation parameters. + * + * @return the list of estimated propagation parameters + */ + @Override + public native ParameterDriversList getEstimatedPropagationParameters(); + + /** + * Get the list of estimated measurements parameters. + * + * @return the list of estimated measurements parameters + */ + @Override + public native ParameterDriversList getEstimatedMeasurementsParameters(); + + /** + * Get the predicted spacecraft states. + * + * @return predicted spacecraft states + */ + @Override + public native SpacecraftState[] getPredictedSpacecraftStates(); + + /** + * Get the corrected spacecraft states. + * + * @return corrected spacecraft states + */ + @Override + public native SpacecraftState[] getCorrectedSpacecraftStates(); + + /** + * Get the "physical" estimated state (i.e. not normalized) + * + * @return the "physical" estimated state + */ + @Override + public native RealVector getPhysicalEstimatedState(); + + /** + * Get the "physical" estimated covariance matrix (i.e. not normalized) + * + * @return the "physical" estimated covariance matrix + */ + @Override + public native RealMatrix getPhysicalEstimatedCovarianceMatrix(); + + /** + * Get physical state transition matrix between previous state and estimated (but not yet corrected) state. + * + * @return state transition matrix between previous state and estimated state (but not yet corrected) + * (may be null for initial process estimate) + * @since 9.3 + */ + @Override + public native RealMatrix getPhysicalStateTransitionMatrix(); + + /** + * Get the physical Jacobian of the measurement with respect to the state (H matrix). + * + * @return physical Jacobian of the measurement with respect to the state (may be null for initial + * process estimate or if the measurement has been ignored) + * @since 9.3 + */ + @Override + public native RealMatrix getPhysicalMeasurementJacobian(); + + /** + * Get the physical innovation covariance matrix. + * + * @return physical innovation covariance matrix (may be null for initial + * process estimate or if the measurement has been ignored) + * @since 9.3 + */ + @Override + public native RealMatrix getPhysicalInnovationCovarianceMatrix(); + + /** + * Get the physical Kalman gain matrix. + * + * @return Kalman gain matrix (may be null for initial + * process estimate or if the measurement has been ignored) + * @since 9.3 + */ + @Override + public native RealMatrix getPhysicalKalmanGain(); + + /** + * Get the current measurement number. + * + * @return current measurement number + */ + @Override + public native int getCurrentMeasurementNumber(); + + /** + * Get the current date. + * + * @return current date + */ + @Override + public native AbsoluteDate getCurrentDate(); + + /** + * Get the predicted measurement. + * <p> + * This estimation has been evaluated on the last predicted orbits + * </p> + * + * @return predicted measurement + */ + @Override + public native EstimatedMeasurement<?> getPredictedMeasurement(); + + /** + * Get the estimated measurement. + * <p> + * This estimation has been evaluated on the last corrected orbits + * </p> + * + * @return corrected measurement + */ + @Override + public native EstimatedMeasurement<?> getCorrectedMeasurement(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonKalmanObserver.java b/java_additions/src/main/java/org/orekit/python/PythonKalmanObserver.java new file mode 100644 index 0000000000000000000000000000000000000000..cb78af504b48618982922bfccd5f5fc385390eb8 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonKalmanObserver.java @@ -0,0 +1,59 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.estimation.sequential.KalmanEstimation; +import org.orekit.estimation.sequential.KalmanObserver; + +public class PythonKalmanObserver implements KalmanObserver { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Notification callback after each one of a Kalman filter estimation. + * + * @param estimation estimation performed by Kalman estimator + */ + @Override + public native void evaluationPerformed(KalmanEstimation estimation); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonLocalizedException.java b/java_additions/src/main/java/org/orekit/python/PythonLocalizedException.java new file mode 100644 index 0000000000000000000000000000000000000000..93f0857013441cf0d972f7a776114e3a2476f9a7 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonLocalizedException.java @@ -0,0 +1,77 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.exception.Localizable; +import org.orekit.errors.LocalizedException; + +import java.util.Locale; + +public class PythonLocalizedException implements LocalizedException { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Gets the message in a specified locale. + * + * @param locale Locale in which the message should be translated + * @return localized message + */ + @Override + public native String getMessage(Locale locale); + + /** + * Get the localizable specifier of the error message. + * + * @return localizable specifier of the error message + */ + @Override + public native Localizable getSpecifier(); + + /** + * Get the variable parts of the error message. + * + * @return a copy of the variable parts of the error message + */ + @Override + public native Object[] getParts(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonMappingFunction.java b/java_additions/src/main/java/org/orekit/python/PythonMappingFunction.java new file mode 100644 index 0000000000000000000000000000000000000000..558088966d062bc7a0da3a980c8c7f3a5bb7aae3 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonMappingFunction.java @@ -0,0 +1,146 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.Field; +import org.hipparchus.RealFieldElement; +import org.orekit.models.earth.MappingFunction; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.utils.ParameterDriver; + +import java.util.List; + +public class PythonMappingFunction implements MappingFunction { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * This method allows the computation of the hydrostatic and + * wet mapping functions. The resulting element is an array having the following form: + * <ul> + * <li>double[0] = m<sub>h</sub>(e) -> hydrostatic mapping function + * <li>double[1] = m<sub>w</sub>(e) -> wet mapping function + * </ul> + * + * @param elevation the elevation of the satellite, in radians. + * @param height the height of the station in m above sea level. + * @param parameters tropospheric model parameters. + * @param date current date + * @return a two components array containing the hydrostatic and wet mapping functions. + */ + @Override + public native double[] mappingFactors(double elevation, double height, double[] parameters, AbsoluteDate date); + + /** + * This method allows the computation of the hydrostatic and + * wet mapping functions. The resulting element is an array having the following form: + * <ul> + * <li>T[0] = m<sub>h</sub>(e) -> hydrostatic mapping function + * <li>T[1] = m<sub>w</sub>(e) -> wet mapping function + * </ul> + * + * @param elevation the elevation of the satellite, in radians. + * @param height the height of the station in m above sea level. + * @param parameters tropospheric model parameters. + * @param date current date + * @return a two components array containing the hydrostatic and wet mapping functions. + */ + @Override + public <T extends RealFieldElement<T>> T[] mappingFactors(T elevation, T height, T[] parameters, FieldAbsoluteDate<T> date) { + return this.mappingFieldFactors(elevation, height, parameters, date); + } + + + /** + * This method allows the computation of the hydrostatic and + * wet mapping functions. The resulting element is an array having the following form: + * <ul> + * <li>T[0] = m<sub>h</sub>(e) -> hydrostatic mapping function + * <li>T[1] = m<sub>w</sub>(e) -> wet mapping function + * </ul> + * + * @param elevation the elevation of the satellite, in radians. + * @param height the height of the station in m above sea level. + * @param parameters tropospheric model parameters. + * @param date current date + * @return a two components array containing the hydrostatic and wet mapping functions. + */ + public native <T extends RealFieldElement<T>> T[] mappingFieldFactors(T elevation, T height, T[] parameters, FieldAbsoluteDate<T> date); + + + /** + * Get the drivers for tropospheric model parameters. + * + * @return drivers for tropospheric model parameters + */ + @Override + public native List<ParameterDriver> getParametersDrivers(); + + /** + * Get tropospheric model parameters. + * + * @return tropospheric model parameters + */ + @Override + public native double[] getParameters(); + + /** + * Get tropospheric model parameters. + * + * @param field field to which the elements belong + * @return tropospheric model parameters + */ + @Override + public <T extends RealFieldElement<T>> T[] getParameters(Field<T> field) { + return this.getFieldParameters(field); + } + + /** + * Get tropospheric model parameters. + * + * @param field field to which the elements belong + * @return tropospheric model parameters + */ + public native <T extends RealFieldElement<T>> T[] getFieldParameters(Field<T> field); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonModeHandler.java b/java_additions/src/main/java/org/orekit/python/PythonModeHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..08ecb52f277991afec8228e99e3343d661c92317 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonModeHandler.java @@ -0,0 +1,63 @@ +/* Copyright 2010-2011 Centre National d'Études Spatiales + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.propagation.integration.ModeHandler; +import org.orekit.time.AbsoluteDate; + +public class PythonModeHandler implements ModeHandler { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Initialize the mode handler. + * + * @param activateHandlers if handlers shall be active + * @param targetDate propagation is expected to end on this date, but + * it may end early due to event detectors or + */ + @Override + public void initialize(boolean activateHandlers, AbsoluteDate targetDate) { + + } +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonMultiSatStepHandler.java b/java_additions/src/main/java/org/orekit/python/PythonMultiSatStepHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..16936c52df7a1a9f7c3308506ce3cf69b2500212 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonMultiSatStepHandler.java @@ -0,0 +1,94 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.propagation.PropagatorsParallelizer; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.sampling.MultiSatStepHandler; +import org.orekit.propagation.sampling.OrekitStepInterpolator; +import org.orekit.time.AbsoluteDate; + +import java.util.List; + +public class PythonMultiSatStepHandler implements MultiSatStepHandler { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Initialize step handler at the start of a propagation. + * <p> + * This method is called once at the start of the propagation. It + * may be used by the step handler to initialize some internal data + * if needed. + * </p> + * <p> + * The default method does nothing + * </p> + * + * @param states0 initial states, one for each satellite in the same order + * used to {@link PropagatorsParallelizer#PropagatorsParallelizer(List, MultiSatStepHandler) + * build} the {@link PropagatorsParallelizer multi-sat propagator}. + * @param t target time for the integration + */ + @Override + public void init(List<SpacecraftState> states0, AbsoluteDate t) { + + } + + /** + * Handle the current step. + * <p> + * When called by {@link PropagatorsParallelizer PropagatorsParallelizer}, + * all interpolators have the same time range. + * </p> + * + * @param interpolators interpolators set up for the current step in the same order + * used to {@link PropagatorsParallelizer#PropagatorsParallelizer(List, MultiSatStepHandler) + * build} the {@link PropagatorsParallelizer multi-sat propagator} + * @param isLast if true, this is the last integration step + */ + @Override + public void handleStep(List<OrekitStepInterpolator> interpolators, boolean isLast) { + + } +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonNRLMSISE00InputParameters.java b/java_additions/src/main/java/org/orekit/python/PythonNRLMSISE00InputParameters.java new file mode 100644 index 0000000000000000000000000000000000000000..10300cbc89214e92733dc0ab82a00d848518609c --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonNRLMSISE00InputParameters.java @@ -0,0 +1,107 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.forces.drag.atmosphere.NRLMSISE00InputParameters; +import org.orekit.time.AbsoluteDate; + +public class PythonNRLMSISE00InputParameters implements NRLMSISE00InputParameters { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Gets the available data range minimum date. + * + * @return the minimum date. + */ + @Override + public native AbsoluteDate getMinDate(); + + /** + * Gets the available data range maximum date. + * + * @return the maximum date. + */ + @Override + public native AbsoluteDate getMaxDate(); + + /** + * Get the value of the daily F10.7 solar flux for previous day. + * + * @param date the current date + * @return the daily F10.7 flux for previous day + */ + @Override + public native double getDailyFlux(AbsoluteDate date); + + /** + * Get the value of the 81 day average of F10.7 solar flux centered on current day. + * + * @param date the current date + * @return the 81 day average of F10.7 solar flux centered on current day + */ + @Override + public native double getAverageFlux(AbsoluteDate date); + + /** + * Get the A<sub>p</sub> geomagnetic indices. + * <p> + * A<sub>p</sub> indices are provided as an array such as: + * <ul> + * <li>0 -> daily A<sub>p</sub></li> + * <li>1 -> 3 hr A<sub>p</sub> index for current time</li> + * <li>2 -> 3 hr A<sub>p</sub> index for 3 hrs before current time</li> + * <li>3 -> 3 hr A<sub>p</sub> index for 6 hrs before current time</li> + * <li>4 -> 3 hr A<sub>p</sub> index for 9 hrs before current time</li> + * <li>5 -> Average of eight 3 hr A<sub>p</sub> indices from 12 to 33 hrs + * prior to current time</li> + * <li>6 -> Average of eight 3 hr A<sub>p</sub> indices from 36 to 57 hrs + * prior to current time</li> + * </ul> + * </p> + * + * @param date the current date + * @return the array of A<sub>p</sub> indices + */ + @Override + public native double[] getAp(AbsoluteDate date); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonNormalizedSphericalHarmonicsProvider.java b/java_additions/src/main/java/org/orekit/python/PythonNormalizedSphericalHarmonicsProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..5f84f7056e76d4e7ecc0caf8271b069c719b22c8 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonNormalizedSphericalHarmonicsProvider.java @@ -0,0 +1,121 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.forces.gravity.potential.NormalizedSphericalHarmonicsProvider; +import org.orekit.forces.gravity.potential.TideSystem; +import org.orekit.time.AbsoluteDate; + +public class PythonNormalizedSphericalHarmonicsProvider implements NormalizedSphericalHarmonicsProvider { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the normalized spherical harmonic coefficients at a specific instance in time. + * + * @param date of evaluation + * @return normalized coefficients on {@code date}. + * @since 6.1 + */ + @Override + public native NormalizedSphericalHarmonics onDate(AbsoluteDate date); + + /** + * Get the maximal supported degree. + * + * @return maximal supported degree + */ + @Override + public native int getMaxDegree(); + + /** + * Get the maximal supported order. + * + * @return maximal supported order + */ + @Override + public native int getMaxOrder(); + + /** + * Get the central body attraction coefficient. + * + * @return mu (m³/s²) + */ + @Override + public native double getMu(); + + /** + * Get the value of the central body reference radius. + * + * @return ae (m) + */ + @Override + public native double getAe(); + + /** + * Get the reference date for the harmonics. + * + * @return reference date for the harmonics + */ + @Override + public native AbsoluteDate getReferenceDate(); + + /** + * Get the offset from {@link #getReferenceDate reference date} for the harmonics. + * + * @param date current date + * @return offset between current date and reference date if there is a reference + * date, or 0.0 if there are no reference dates (i.e. if {@link #getReferenceDate} + * returns null) + */ + @Override + public native double getOffset(AbsoluteDate date); + + /** + * Get the {@link TideSystem} used in the gravity field. + * + * @return tide system used in the gravity field + */ + @Override + public native TideSystem getTideSystem(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonODEIntegratorBuilder.java b/java_additions/src/main/java/org/orekit/python/PythonODEIntegratorBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..0be913bbd88374d87b2f7a838c0ac10eeb08bef6 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonODEIntegratorBuilder.java @@ -0,0 +1,63 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.ode.AbstractIntegrator; +import org.orekit.orbits.Orbit; +import org.orekit.orbits.OrbitType; +import org.orekit.propagation.conversion.ODEIntegratorBuilder; + +public class PythonODEIntegratorBuilder implements ODEIntegratorBuilder { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Build a first order integrator. + * + * @param orbit reference orbit + * @param orbitType orbit type to use + * @return a first order integrator ready to use + */ + @Override + public native AbstractIntegrator buildIntegrator(Orbit orbit, OrbitType orbitType); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonObservedMeasurement.java b/java_additions/src/main/java/org/orekit/python/PythonObservedMeasurement.java new file mode 100644 index 0000000000000000000000000000000000000000..730b193dfe6a0f9e6f935b958b44ce65fa715c02 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonObservedMeasurement.java @@ -0,0 +1,235 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.estimation.measurements.*; +import org.orekit.propagation.Propagator; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.conversion.PropagatorBuilder; +import org.orekit.time.AbsoluteDate; +import org.orekit.utils.ParameterDriver; + +import java.util.List; +import java.util.SortedSet; + +public class PythonObservedMeasurement<T extends ObservedMeasurement<T>> implements ObservedMeasurement<T> { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Enable or disable a measurement. + * <p> + * Disabling a measurement allow to not consider it at + * one stage of the orbit determination (for example when + * it appears to be an outlier as per current estimated + * covariance). + * </p> + * + * @param enabled if true the measurement will be enabled, + * otherwise it will be disabled + */ + @Override + public native void setEnabled(boolean enabled); + + /** + * Check if a measurement is enabled. + * + * @return true if the measurement is enabled + */ + @Override + public native boolean isEnabled(); + + /** + * Get the dimension of the measurement. + * <p> + * Dimension is the size of the array containing the + * value. It will be one for a scalar measurement like + * a range or range-rate, but 6 for a position-velocity + * measurement. + * </p> + * + * @return dimension of the measurement + */ + @Override + public native int getDimension(); + + /** + * Get the theoretical standard deviation. + * <p> + * The theoretical standard deviation is a theoretical value + * used for normalizing the residuals. It acts as a weighting + * factor to mix appropriately measurements with different units + * and different accuracy. The value has the same dimension as + * the measurement itself (i.e. when a residual is divided by + * this value, it becomes dimensionless). + * </p> + * + * @return expected standard deviation + * @see #getBaseWeight() + */ + @Override + public native double[] getTheoreticalStandardDeviation(); + + /** + * Get the base weight associated with the measurement + * <p> + * The base weight is used on residuals already normalized thanks to + * {@link #getTheoreticalStandardDeviation()} to increase or + * decrease relative effect of some measurements with respect to + * other measurements. It is a dimensionless value, typically between + * 0 and 1 (but it can really have any non-negative value). + * </p> + * + * @return base weight + * @see #getTheoreticalStandardDeviation() + * @see EstimatedMeasurement#getCurrentWeight() + */ + @Override + public native double[] getBaseWeight(); + + /** + * Add a modifier. + * <p> + * The modifiers are applied in the order in which they are added in order to + * {@link #estimate(int, int, SpacecraftState[]) estimate} the measurement. + * </p> + * + * @param modifier modifier to add + * @see #getModifiers() + */ + @Override + public native void addModifier(EstimationModifier<T> modifier); + + /** + * Get the modifiers that apply to a measurement. + * + * @return modifiers that apply to a measurement + * @see #addModifier(EstimationModifier) + */ + @Override + public native List<EstimationModifier<T>> getModifiers(); + + /** + * Get the drivers for this measurement parameters, including its modifiers parameters. + * + * @return drivers for this measurement parameters, including its modifiers parameters + */ + @Override + public native List<ParameterDriver> getParametersDrivers(); + + /** + * Get the indices of the {@link Propagator propagators} + * related to this measurement. + * <p> + * The propagators are indexed starting from 0 and ordered according to + * the order of the {@link PropagatorBuilder + * propagators builders} in the orbit determination engine used. + * </p> + * + * @return indices of the {@link Propagator propagators} + * related to this measurement + * @since 9.0 + * @deprecated as of 9.3, replaced by {@link #getSatellites()} + */ + @Override + public native List<Integer> getPropagatorsIndices(); + + /** + * Get the satellites related to this measurement. + * + * @return satellites related to this measurement + * @since 9.3 + */ + @Override + public native List<ObservableSatellite> getSatellites(); + + /** + * Estimate the theoretical value of the measurement. + * <p> + * The estimated value is the <em>combination</em> of the raw estimated + * value and all the modifiers that apply to the measurement. + * </p> + * + * @param iteration iteration number + * @param evaluation evaluations number + * @param states orbital states at measurement date + * @return estimated measurement + */ + @Override + public native EstimatedMeasurement<T> estimate(int iteration, int evaluation, SpacecraftState[] states); + + /** + * Get the observed value. + * <p> + * The observed value is the value that was measured by the instrument. + * </p> + * + * @return observed value (array of size {@link #getDimension()} + */ + @Override + public native double[] getObservedValue(); + + /** + * {@inheritDoc} + * <p> + * Measurements comparison is primarily chronological, but measurements + * with the same date are sorted based on the observed value. Even if they + * have the same value too, they will <em>not</em> be considered equal if they + * correspond to different instances. This allows to store measurements in + * {@link SortedSet SortedSet} without losing any measurements, even + * redundant ones. + * </p> + * + * @param other + */ + @Override + public native int compareTo(ComparableMeasurement other); + + /** + * Get the date. + * + * @return date attached to the object + */ + @Override + public native AbsoluteDate getDate(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonOrekitStepHandler.java b/java_additions/src/main/java/org/orekit/python/PythonOrekitStepHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..951bdef9f611f6683a6f29b953a4a77535ffe997 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonOrekitStepHandler.java @@ -0,0 +1,83 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.sampling.OrekitStepHandler; +import org.orekit.propagation.sampling.OrekitStepInterpolator; +import org.orekit.time.AbsoluteDate; + +public class PythonOrekitStepHandler implements OrekitStepHandler { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Initialize step handler at the start of a propagation. + * <p> + * This method is called once at the start of the propagation. It + * may be used by the step handler to initialize some internal data + * if needed. + * </p> + * <p> + * The default method does nothing + * </p> + * + * @param s0 initial state + * @param t target time for the integration + */ + @Override + public void init(SpacecraftState s0, AbsoluteDate t) { + + } + + /** + * Handle the current step. + * + * @param interpolator interpolator set up for the current step + * @param isLast if true, this is the last integration step + */ + @Override + public void handleStep(OrekitStepInterpolator interpolator, boolean isLast) { + + } +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonOrekitStepInterpolator.java b/java_additions/src/main/java/org/orekit/python/PythonOrekitStepInterpolator.java new file mode 100644 index 0000000000000000000000000000000000000000..9edbe5ffcb6a261363b345e275fe0665df8c596e --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonOrekitStepInterpolator.java @@ -0,0 +1,145 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.sampling.OrekitStepInterpolator; +import org.orekit.time.AbsoluteDate; + +public class PythonOrekitStepInterpolator implements OrekitStepInterpolator { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the state at previous grid point date. + * + * @return state at previous grid point date + */ + @Override + public SpacecraftState getPreviousState() { + return null; + } + + /** + * Determines if the {@link #getPreviousState() previous state} is computed directly + * by the integrator, or if it is calculated using {@link #getInterpolatedState(AbsoluteDate) + * interpolation}. + * + * <p> Typically the previous state is directly computed by the integrator, but when + * events are detected the steps are shortened so that events occur on step boundaries + * which means the previous state may be computed by the interpolator. + * + * @return {@code true} if the previous state was calculated by the interpolator and + * false if it was computed directly by the integrator. + */ + @Override + public boolean isPreviousStateInterpolated() { + return false; + } + + /** + * Get the state at current grid point date. + * + * @return state at current grid point date + */ + @Override + public SpacecraftState getCurrentState() { + return null; + } + + /** + * Determines if the {@link #getCurrentState() current state} is computed directly by + * the integrator, or if it is calculated using {@link #getInterpolatedState(AbsoluteDate) + * interpolation}. + * + * <p> Typically the current state is directly computed by the integrator, but when + * events are detected the steps are shortened so that events occur on step boundaries + * which means the current state may be computed by the interpolator. + * + * @return {@code true} if the current state was calculated by the interpolator and + * false if it was computed directly by the integrator. + */ + @Override + public boolean isCurrentStateInterpolated() { + return false; + } + + /** + * Get the state at interpolated date. + * + * @param date date of the interpolated state + * @return state at interpolated date + */ + @Override + public SpacecraftState getInterpolatedState(AbsoluteDate date) { + return null; + } + + /** + * Check is integration direction is forward in date. + * + * @return true if integration is forward in date + */ + @Override + public boolean isForward() { + return false; + } + + /** + * Create a new restricted version of the instance. + * <p> + * The instance is not changed at all. + * </p> + * + * @param newPreviousState start of the restricted step + * @param newCurrentState end of the restricted step + * @return restricted version of the instance + * @see #getPreviousState() + * @see #getCurrentState() + * @since 9.0 + */ + @Override + public OrekitStepInterpolator restrictStep(SpacecraftState newPreviousState, SpacecraftState newCurrentState) { + return null; + } +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonPVCoordinatesProvider.java b/java_additions/src/main/java/org/orekit/python/PythonPVCoordinatesProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..341967242fcc23b560979924842afdf4df2952db --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonPVCoordinatesProvider.java @@ -0,0 +1,63 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.frames.Frame; +import org.orekit.time.AbsoluteDate; +import org.orekit.utils.PVCoordinatesProvider; +import org.orekit.utils.TimeStampedPVCoordinates; + +public class PythonPVCoordinatesProvider implements PVCoordinatesProvider { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the {@link PVCoordinates} of the body in the selected frame. + * + * @param date current date + * @param frame the frame where to define the position + * @return time-stamped position/velocity of the body (m and m/s) + */ + @Override + public native TimeStampedPVCoordinates getPVCoordinates(AbsoluteDate date, Frame frame); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonParameterFunction.java b/java_additions/src/main/java/org/orekit/python/PythonParameterFunction.java new file mode 100644 index 0000000000000000000000000000000000000000..56b8c73f524df3d33ecba2f7da199d446735edf6 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonParameterFunction.java @@ -0,0 +1,59 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.utils.ParameterDriver; +import org.orekit.utils.ParameterFunction; + +public class PythonParameterFunction implements ParameterFunction { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Evaluate the function. + * + * @param parameterDriver driver for the parameter. + * @return scalar value of the function + */ + @Override + public native double value(ParameterDriver parameterDriver); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonParameterObserver.java b/java_additions/src/main/java/org/orekit/python/PythonParameterObserver.java new file mode 100644 index 0000000000000000000000000000000000000000..3dc3cf3f876e70263846d18c064db9fbbbec143d --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonParameterObserver.java @@ -0,0 +1,153 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.time.AbsoluteDate; +import org.orekit.utils.ParameterDriver; +import org.orekit.utils.ParameterObserver; + +public class PythonParameterObserver implements ParameterObserver { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Notify that a parameter value has been changed. + * + * @param previousValue previous value + * @param driver parameter driver that has been changed + */ + @Override + public native void valueChanged(double previousValue, ParameterDriver driver); + + /** + * Notify that a parameter reference date has been changed. + * <p> + * The default implementation does nothing + * </p> + * + * @param previousReferenceDate previous date (null if it is the first time + * the reference date is changed) + * @param driver parameter driver that has been changed + * @since 9.0 + */ + @Override + public native void referenceDateChanged(AbsoluteDate previousReferenceDate, ParameterDriver driver); + + /** + * Notify that a parameter name has been changed. + * <p> + * The default implementation does nothing + * </p> + * + * @param previousName previous name + * @param driver parameter driver that has been changed + * @since 9.0 + */ + @Override + public native void nameChanged(String previousName, ParameterDriver driver); + + /** + * Notify that a parameter selection status has been changed. + * <p> + * The default implementation does nothing + * </p> + * + * @param previousSelection previous selection + * @param driver parameter driver that has been changed + * @since 9.0 + */ + @Override + public native void selectionChanged(boolean previousSelection, ParameterDriver driver); + + /** + * Notify that a parameter reference value has been changed. + * <p> + * The default implementation does nothing + * </p> + * + * @param previousReferenceValue previous reference value + * @param driver parameter driver that has been changed + * @since 9.0 + */ + @Override + public native void referenceValueChanged(double previousReferenceValue, ParameterDriver driver); + + /** + * Notify that a parameter minimum value has been changed. + * <p> + * The default implementation does nothing + * </p> + * + * @param previousMinValue previous minimum value + * @param driver parameter driver that has been changed + * @since 9.0 + */ + @Override + public native void minValueChanged(double previousMinValue, ParameterDriver driver); + + /** + * Notify that a parameter maximum value has been changed. + * <p> + * The default implementation does nothing + * </p> + * + * @param previousMaxValue previous maximum value + * @param driver parameter driver that has been changed + * @since 9.0 + */ + @Override + public native void maxValueChanged(double previousMaxValue, ParameterDriver driver); + + /** + * Notify that a parameter scale has been changed. + * <p> + * The default implementation does nothing + * </p> + * + * @param previousScale previous scale + * @param driver parameter driver that has been changed + * @since 9.0 + */ + @Override + public native void scaleChanged(double previousScale, ParameterDriver driver); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonPhaseCenterVariationFunction.java b/java_additions/src/main/java/org/orekit/python/PythonPhaseCenterVariationFunction.java new file mode 100644 index 0000000000000000000000000000000000000000..0fbe9619ea978db7f84833692e022c6fedbb86ca --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonPhaseCenterVariationFunction.java @@ -0,0 +1,61 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.gnss.antenna.PhaseCenterVariationFunction; + +public class PythonPhaseCenterVariationFunction implements PhaseCenterVariationFunction { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Evaluate phase center variation in one signal direction. + * + * @param polarAngle angle from antenna axial direction + * (zenith angle for receiver antennas, nadir angle for + * GNSS satellites antennas) + * @param azimuthAngle angle around axial direction + * @return phase center variation in the signal direction (m) + */ + @Override + public native double value(double polarAngle, double azimuthAngle); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonPropagator.java b/java_additions/src/main/java/org/orekit/python/PythonPropagator.java new file mode 100644 index 0000000000000000000000000000000000000000..580ca0d9e85eb98aa95d37d1b692b9071a27ee73 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonPropagator.java @@ -0,0 +1,414 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.attitudes.AttitudeProvider; +import org.orekit.frames.Frame; +import org.orekit.propagation.AdditionalStateProvider; +import org.orekit.propagation.BoundedPropagator; +import org.orekit.propagation.Propagator; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.events.EventDetector; +import org.orekit.propagation.integration.AbstractIntegratedPropagator; +import org.orekit.propagation.integration.AdditionalEquations; +import org.orekit.propagation.sampling.OrekitFixedStepHandler; +import org.orekit.propagation.sampling.OrekitStepHandler; +import org.orekit.time.AbsoluteDate; +import org.orekit.utils.TimeStampedPVCoordinates; + +import java.util.Collection; +import java.util.List; + +public class PythonPropagator implements Propagator { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the current operating mode of the propagator. + * + * @return one of {@link #SLAVE_MODE}, {@link #MASTER_MODE}, + * {@link #EPHEMERIS_GENERATION_MODE} + * @see #setSlaveMode() + * @see #setMasterMode(double, OrekitFixedStepHandler) + * @see #setMasterMode(OrekitStepHandler) + * @see #setEphemerisMode() + */ + @Override + public native int getMode(); + + /** + * Set the propagator to slave mode. + * <p>This mode is used when the user needs only the final orbit at the target time. + * The (slave) propagator computes this result and return it to the calling + * (master) application, without any intermediate feedback. + * <p>This is the default mode.</p> + * + * @see #setMasterMode(double, OrekitFixedStepHandler) + * @see #setMasterMode(OrekitStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #SLAVE_MODE + */ + @Override + public native void setSlaveMode(); + + /** + * Set the propagator to master mode with fixed steps. + * <p>This mode is used when the user needs to have some custom function called at the + * end of each finalized step during integration. The (master) propagator integration + * loop calls the (slave) application callback methods at each finalized step.</p> + * + * @param h fixed stepsize (s) + * @param handler handler called at the end of each finalized step + * @see #setSlaveMode() + * @see #setMasterMode(OrekitStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #MASTER_MODE + */ + @Override + public void setMasterMode(double h, OrekitFixedStepHandler handler) { + this.setMasterMode_2p(h, handler); + } + + /** + * Set the propagator to master mode with fixed steps. + * <p>This mode is used when the user needs to have some custom function called at the + * end of each finalized step during integration. The (master) propagator integration + * loop calls the (slave) application callback methods at each finalized step.</p> + * + * @param h fixed stepsize (s) + * @param handler handler called at the end of each finalized step + * @see #setSlaveMode() + * @see #setMasterMode(OrekitStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #MASTER_MODE + */ + public native void setMasterMode_2p(double h, OrekitFixedStepHandler handler); + + /** + * Set the propagator to master mode with variable steps. + * <p>This mode is used when the user needs to have some custom function called at the + * end of each finalized step during integration. The (master) propagator integration + * loop calls the (slave) application callback methods at each finalized step.</p> + * + * @param handler handler called at the end of each finalized step + * @see #setSlaveMode() + * @see #setMasterMode(double, OrekitFixedStepHandler) + * @see #setEphemerisMode() + * @see #getMode() + * @see #MASTER_MODE + */ + @Override + public native void setMasterMode(OrekitStepHandler handler); + + /** + * Set the propagator to ephemeris generation mode. + * <p>This mode is used when the user needs random access to the orbit state at any time + * between the initial and target times, and in no sequential order. A typical example is + * the implementation of search and iterative algorithms that may navigate forward and + * backward inside the propagation range before finding their result.</p> + * <p>Beware that since this mode stores <strong>all</strong> intermediate results, + * it may be memory intensive for long integration ranges and high precision/short + * time steps.</p> + * + * @see #getGeneratedEphemeris() + * @see #setSlaveMode() + * @see #setMasterMode(double, OrekitFixedStepHandler) + * @see #setMasterMode(OrekitStepHandler) + * @see #getMode() + * @see #EPHEMERIS_GENERATION_MODE + */ + @Override + public native void setEphemerisMode(); + + /** + * Set the propagator to ephemeris generation mode with the specified handler for each + * integration step. + * + * <p>This mode is used when the user needs random access to the orbit state at any + * time between the initial and target times, as well as access to the steps computed + * by the integrator as in Master Mode. A typical example is the implementation of + * search and iterative algorithms that may navigate forward and backward inside the + * propagation range before finding their result.</p> + * + * <p>Beware that since this mode stores <strong>all</strong> intermediate results, it + * may be memory intensive for long integration ranges and high precision/short time + * steps.</p> + * + * @param handler handler called at the end of each finalized step + * @see #setEphemerisMode() + * @see #getGeneratedEphemeris() + * @see #setSlaveMode() + * @see #setMasterMode(double, OrekitFixedStepHandler) + * @see #setMasterMode(OrekitStepHandler) + * @see #getMode() + * @see #EPHEMERIS_GENERATION_MODE + */ + @Override + public void setEphemerisMode(OrekitStepHandler handler) { + this.setEphemerisModeHandler(handler); + } + + /** + * Set the propagator to ephemeris generation mode with the specified handler for each + * integration step. + * + * <p>This mode is used when the user needs random access to the orbit state at any + * time between the initial and target times, as well as access to the steps computed + * by the integrator as in Master Mode. A typical example is the implementation of + * search and iterative algorithms that may navigate forward and backward inside the + * propagation range before finding their result.</p> + * + * <p>Beware that since this mode stores <strong>all</strong> intermediate results, it + * may be memory intensive for long integration ranges and high precision/short time + * steps.</p> + * + * @param handler handler called at the end of each finalized step + * @see #setEphemerisMode() + * @see #getGeneratedEphemeris() + * @see #setSlaveMode() + * @see #setMasterMode(double, OrekitFixedStepHandler) + * @see #setMasterMode(OrekitStepHandler) + * @see #getMode() + * @see #EPHEMERIS_GENERATION_MODE + */ + public native void setEphemerisModeHandler(OrekitStepHandler handler); + + /** + * Get the ephemeris generated during propagation. + * + * @return generated ephemeris + * @throws IllegalStateException if the propagator was not set in ephemeris + * generation mode before propagation + * @see #setEphemerisMode() + */ + @Override + public native BoundedPropagator getGeneratedEphemeris() throws IllegalStateException; + + /** + * Get the propagator initial state. + * + * @return initial state + */ + @Override + public native SpacecraftState getInitialState(); + + /** + * Reset the propagator initial state. + * + * @param state new initial state to consider + */ + @Override + public native void resetInitialState(SpacecraftState state); + + /** + * Add a set of user-specified state parameters to be computed along with the orbit propagation. + * + * @param additionalStateProvider provider for additional state + */ + @Override + public native void addAdditionalStateProvider(AdditionalStateProvider additionalStateProvider); + + /** + * Get an unmodifiable list of providers for additional state. + * + * @return providers for the additional states + */ + @Override + public native List<AdditionalStateProvider> getAdditionalStateProviders(); + + /** + * Check if an additional state is managed. + * <p> + * Managed states are states for which the propagators know how to compute + * its evolution. They correspond to additional states for which an + * {@link AdditionalStateProvider additional state provider} has been registered + * by calling the {@link #addAdditionalStateProvider(AdditionalStateProvider) + * addAdditionalStateProvider} method. If the propagator is an {@link + * AbstractIntegratedPropagator integrator-based + * propagator}, the states for which a set of {@link + * AdditionalEquations additional equations} has + * been registered by calling the {@link + * AbstractIntegratedPropagator#addAdditionalEquations( + *AdditionalEquations) addAdditionalEquations} + * method are also counted as managed additional states. + * </p> + * <p> + * Additional states that are present in the {@link #getInitialState() initial state} + * but have no evolution method registered are <em>not</em> considered as managed states. + * These unmanaged additional states are not lost during propagation, though. Their + * value will simply be copied unchanged throughout propagation. + * </p> + * + * @param name name of the additional state + * @return true if the additional state is managed + */ + @Override + public native boolean isAdditionalStateManaged(String name); + + /** + * Get all the names of all managed states. + * + * @return names of all managed states + */ + @Override + public native String[] getManagedAdditionalStates(); + + /** + * Add an event detector. + * + * @param detector event detector to add + * @see #clearEventsDetectors() + * @see #getEventsDetectors() + */ + @Override + public native <T extends EventDetector> void addEventDetector(T detector); + + /** + * Get all the events detectors that have been added. + * + * @return an unmodifiable collection of the added detectors + * @see #addEventDetector(EventDetector) + * @see #clearEventsDetectors() + */ + @Override + public native Collection<EventDetector> getEventsDetectors(); + + /** + * Remove all events detectors. + * + * @see #addEventDetector(EventDetector) + * @see #getEventsDetectors() + */ + @Override + public native void clearEventsDetectors(); + + /** + * Get attitude provider. + * + * @return attitude provider + */ + @Override + public native AttitudeProvider getAttitudeProvider(); + + /** + * Set attitude provider. + * + * @param attitudeProvider attitude provider + */ + @Override + public native void setAttitudeProvider(AttitudeProvider attitudeProvider); + + /** + * Get the frame in which the orbit is propagated. + * <p> + * The propagation frame is the definition frame of the initial + * state, so this method should be called after this state has + * been set, otherwise it may return null. + * </p> + * + * @return frame in which the orbit is propagated + * @see #resetInitialState(SpacecraftState) + */ + @Override + public native Frame getFrame(); + + /** + * Propagate towards a target date. + * <p>Simple propagators use only the target date as the specification for + * computing the propagated state. More feature rich propagators can consider + * other information and provide different operating modes or G-stop + * facilities to stop at pinpointed events occurrences. In these cases, the + * target date is only a hint, not a mandatory objective.</p> + * + * @param target target date towards which orbit state should be propagated + * @return propagated state + */ + @Override + public native SpacecraftState propagate(AbsoluteDate target); + + /** + * Propagate from a start date towards a target date. + * <p>Those propagators use a start date and a target date to + * compute the propagated state. For propagators using event detection mechanism, + * if the provided start date is different from the initial state date, a first, + * simple propagation is performed, without processing any event computation. + * Then complete propagation is performed from start date to target date.</p> + * + * @param start start date from which orbit state should be propagated + * @param target target date to which orbit state should be propagated + * @return propagated state + */ + @Override + public SpacecraftState propagate(AbsoluteDate start, AbsoluteDate target) { + return this.propagate_2p(start, target); + } + + + /** + * Propagate from a start date towards a target date. + * <p>Those propagators use a start date and a target date to + * compute the propagated state. For propagators using event detection mechanism, + * if the provided start date is different from the initial state date, a first, + * simple propagation is performed, without processing any event computation. + * Then complete propagation is performed from start date to target date.</p> + * + * @param start start date from which orbit state should be propagated + * @param target target date to which orbit state should be propagated + * @return propagated state + */ + public native SpacecraftState propagate_2p(AbsoluteDate start, AbsoluteDate target); + + + /** + * Get the {@link PVCoordinates} of the body in the selected frame. + * + * @param date current date + * @param frame the frame where to define the position + * @return time-stamped position/velocity of the body (m and m/s) + */ + @Override + public native TimeStampedPVCoordinates getPVCoordinates(AbsoluteDate date, Frame frame); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonPropagatorBuilder.java b/java_additions/src/main/java/org/orekit/python/PythonPropagatorBuilder.java new file mode 100644 index 0000000000000000000000000000000000000000..fa1aa95f56f74ad081504616ede306d621874bd6 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonPropagatorBuilder.java @@ -0,0 +1,134 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.frames.Frame; +import org.orekit.orbits.OrbitType; +import org.orekit.orbits.PositionAngle; +import org.orekit.propagation.Propagator; +import org.orekit.propagation.conversion.PropagatorBuilder; +import org.orekit.time.AbsoluteDate; +import org.orekit.utils.ParameterDriversList; + +public class PythonPropagatorBuilder implements PropagatorBuilder { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Build a propagator. + * + * @param normalizedParameters normalized values for the selected parameters + * @return an initialized propagator + */ + @Override + public native Propagator buildPropagator(double[] normalizedParameters); + + /** + * Get the current value of selected normalized parameters. + * + * @return current value of selected normalized parameters + */ + @Override + public native double[] getSelectedNormalizedParameters(); + + /** + * Get the orbit type expected for the 6 first parameters in + * {@link #buildPropagator(double[])}. + * + * @return orbit type to use in {@link #buildPropagator(double[])} + * @see #buildPropagator(double[]) + * @see #getPositionAngle() + * @since 7.1 + */ + @Override + public native OrbitType getOrbitType(); + + /** + * Get the position angle type expected for the 6 first parameters in + * {@link #buildPropagator(double[])}. + * + * @return position angle type to use in {@link #buildPropagator(double[])} + * @see #buildPropagator(double[]) + * @see #getOrbitType() + * @since 7.1 + */ + @Override + public native PositionAngle getPositionAngle(); + + /** + * Get the date of the initial orbit. + * + * @return date of the initial orbit + */ + @Override + public native AbsoluteDate getInitialOrbitDate(); + + /** + * Get the frame in which the orbit is propagated. + * + * @return frame in which the orbit is propagated + */ + @Override + public native Frame getFrame(); + + /** + * Get the drivers for the configurable orbital parameters. + * + * @return drivers for the configurable orbital parameters + * @since 8.0 + */ + @Override + public native ParameterDriversList getOrbitalParametersDrivers(); + + /** + * Get the drivers for the configurable propagation parameters. + * <p> + * The parameters typically correspond to force models. + * </p> + * + * @return drivers for the configurable propagation parameters + * @since 8.0 + */ + @Override + public native ParameterDriversList getPropagationParametersDrivers(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonPropagatorConverter.java b/java_additions/src/main/java/org/orekit/python/PythonPropagatorConverter.java new file mode 100644 index 0000000000000000000000000000000000000000..56e03ce5c72a298eb0bd15e408e4805fed338ad9 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonPropagatorConverter.java @@ -0,0 +1,111 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + + +// TODO: Add python wrappers for this class. + +package org.orekit.python; + +import org.orekit.propagation.Propagator; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.conversion.PropagatorConverter; + +import java.util.List; + +public class PythonPropagatorConverter implements PropagatorConverter { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Convert a propagator into another one. + * + * @param source propagator to convert + * @param timeSpan time span considered for conversion + * @param nbPoints number of points for sampling over the time span + * @param freeParameters names of the free parameters + * @return adapted propagator + */ + @Override + public Propagator convert(Propagator source, double timeSpan, int nbPoints, List<String> freeParameters) { + return null; + } + + /** + * Convert a propagator into another one. + * + * @param source propagator to convert + * @param timeSpan time span considered for conversion + * @param nbPoints number of points for sampling over the time span + * @param freeParameters names of the free parameters + * @return adapted propagator + */ + @Override + public Propagator convert(Propagator source, double timeSpan, int nbPoints, String... freeParameters) { + return null; + } + + /** + * Find the propagator that minimize the mean square error for a sample of {@link SpacecraftState states}. + * + * @param states spacecraft states sample to fit + * @param positionOnly if true, consider only position data otherwise both position and velocity are used + * @param freeParameters names of the free parameters + * @return adapted propagator + */ + @Override + public Propagator convert(List<SpacecraftState> states, boolean positionOnly, List<String> freeParameters) { + return null; + } + + /** + * Find the propagator that minimize the mean square error for a sample of {@link SpacecraftState states}. + * + * @param states spacecraft states sample to fit + * @param positionOnly if true, consider only position data otherwise both position and velocity are used + * @param freeParameters names of the free parameters + * @return adapted propagator + */ + @Override + public Propagator convert(List<SpacecraftState> states, boolean positionOnly, String... freeParameters) { + return null; + } +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonRadiationSensitive.java b/java_additions/src/main/java/org/orekit/python/PythonRadiationSensitive.java new file mode 100644 index 0000000000000000000000000000000000000000..88bdaf66585fb2d6356b12521bb1f0fcd58c8859 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonRadiationSensitive.java @@ -0,0 +1,150 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.hipparchus.analysis.differentiation.DerivativeStructure; +import org.hipparchus.geometry.euclidean.threed.FieldRotation; +import org.hipparchus.geometry.euclidean.threed.FieldVector3D; +import org.hipparchus.geometry.euclidean.threed.Rotation; +import org.hipparchus.geometry.euclidean.threed.Vector3D; +import org.orekit.forces.radiation.RadiationSensitive; +import org.orekit.frames.Frame; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.utils.ParameterDriver; + +public class PythonRadiationSensitive implements RadiationSensitive { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the drivers for supported parameters. + * + * @return parameters drivers + * @since 8.0 + */ + @Override + public native ParameterDriver[] getRadiationParametersDrivers(); + + /** + * Compute the acceleration due to radiation pressure. + * + * @param date current date + * @param frame inertial reference frame for state (both orbit and attitude) + * @param position position of spacecraft in reference frame + * @param rotation orientation (attitude) of the spacecraft with respect to reference frame + * @param mass current mass + * @param flux radiation flux in the same inertial frame as spacecraft orbit + * @param parameters values of the force model parameters + * @return spacecraft acceleration in the same inertial frame as spacecraft orbit (m/s²) + */ + @Override + public native Vector3D radiationPressureAcceleration(AbsoluteDate date, Frame frame, Vector3D position, Rotation rotation, double mass, Vector3D flux, double[] parameters); + + /** + * Compute the acceleration due to radiation pressure. + * + * @param date current date + * @param frame inertial reference frame for state (both orbit and attitude) + * @param position position of spacecraft in reference frame + * @param rotation orientation (attitude) of the spacecraft with respect to reference frame + * @param mass current mass + * @param flux radiation flux in the same inertial frame as spacecraft orbit + * @param parameters values of the force model parameters + * @return spacecraft acceleration in the same inertial frame as spacecraft orbit (m/s²) + */ + @Override + public <T extends RealFieldElement<T>> FieldVector3D<T> radiationPressureAcceleration(FieldAbsoluteDate<T> date, Frame frame, FieldVector3D<T> position, FieldRotation<T> rotation, T mass, FieldVector3D<T> flux, T[] parameters) { + return this.radiationRealFieldPressureAcceleration(date, frame, position, rotation, mass, flux, parameters); + } + + /** + * Compute the acceleration due to radiation pressure. + * + * @param date current date + * @param frame inertial reference frame for state (both orbit and attitude) + * @param position position of spacecraft in reference frame + * @param rotation orientation (attitude) of the spacecraft with respect to reference frame + * @param mass current mass + * @param flux radiation flux in the same inertial frame as spacecraft orbit + * @param parameters values of the force model parameters + * @return spacecraft acceleration in the same inertial frame as spacecraft orbit (m/s²) + */ + public native <T extends RealFieldElement<T>> FieldVector3D<T> radiationRealFieldPressureAcceleration(FieldAbsoluteDate<T> date, Frame frame, FieldVector3D<T> position, FieldRotation<T> rotation, T mass, FieldVector3D<T> flux, T[] parameters); + + /** + * Compute the acceleration due to radiation pressure, with parameters derivatives. + * + * @param date current date + * @param frame inertial reference frame for state (both orbit and attitude) + * @param position position of spacecraft in reference frame + * @param rotation orientation (attitude) of the spacecraft with respect to reference frame + * @param mass current mass + * @param flux radiation flux in the same inertial frame as spacecraft orbit + * @param parameters values of the force model parameters + * @param paramName name of the parameter with respect to which derivatives are required + * @return spacecraft acceleration in the same inertial frame as spacecraft orbit (m/s²) + */ + @Override + public FieldVector3D<DerivativeStructure> radiationPressureAcceleration(AbsoluteDate date, Frame frame, Vector3D position, Rotation rotation, double mass, Vector3D flux, double[] parameters, String paramName) { + return this.radiationFieldVector3DPressureAcceleration(date, frame, position, rotation, mass, flux, parameters, paramName); + } + + /** + * Compute the acceleration due to radiation pressure, with parameters derivatives. + * + * @param date current date + * @param frame inertial reference frame for state (both orbit and attitude) + * @param position position of spacecraft in reference frame + * @param rotation orientation (attitude) of the spacecraft with respect to reference frame + * @param mass current mass + * @param flux radiation flux in the same inertial frame as spacecraft orbit + * @param parameters values of the force model parameters + * @param paramName name of the parameter with respect to which derivatives are required + * @return spacecraft acceleration in the same inertial frame as spacecraft orbit (m/s²) + */ + public native FieldVector3D<DerivativeStructure> radiationFieldVector3DPressureAcceleration(AbsoluteDate date, Frame frame, Vector3D position, Rotation rotation, double mass, Vector3D flux, double[] parameters, String paramName); + + +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonRawSphericalHarmonicsProvider.java b/java_additions/src/main/java/org/orekit/python/PythonRawSphericalHarmonicsProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..49d16f915531892742277e8e5ef0427b6e75a34d --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonRawSphericalHarmonicsProvider.java @@ -0,0 +1,119 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.forces.gravity.potential.RawSphericalHarmonicsProvider; +import org.orekit.forces.gravity.potential.TideSystem; +import org.orekit.time.AbsoluteDate; + +public class PythonRawSphericalHarmonicsProvider implements RawSphericalHarmonicsProvider { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the raw spherical harmonic coefficients on a specific date. + * + * @param date to evaluate the spherical harmonics + * @return the raw spherical harmonics on {@code date}. + */ + @Override + public native RawSphericalHarmonics onDate(AbsoluteDate date); + + /** + * Get the maximal supported degree. + * + * @return maximal supported degree + */ + @Override + public native int getMaxDegree(); + + /** + * Get the maximal supported order. + * + * @return maximal supported order + */ + @Override + public native int getMaxOrder(); + + /** + * Get the central body attraction coefficient. + * + * @return mu (m³/s²) + */ + @Override + public native double getMu(); + + /** + * Get the value of the central body reference radius. + * + * @return ae (m) + */ + @Override + public native double getAe(); + + /** + * Get the reference date for the harmonics. + * + * @return reference date for the harmonics + */ + @Override + public native AbsoluteDate getReferenceDate(); + + /** + * Get the offset from {@link #getReferenceDate reference date} for the harmonics. + * + * @param date current date + * @return offset between current date and reference date if there is a reference + * date, or 0.0 if there are no reference dates (i.e. if {@link #getReferenceDate} + * returns null) + */ + @Override + public native double getOffset(AbsoluteDate date); + + /** + * Get the {@link TideSystem} used in the gravity field. + * + * @return tide system used in the gravity field + */ + @Override + public native TideSystem getTideSystem(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonSphericalHarmonicsProvider.java b/java_additions/src/main/java/org/orekit/python/PythonSphericalHarmonicsProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..559c6ee127fed5ab15ed435194d86af76f0dbbfe --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonSphericalHarmonicsProvider.java @@ -0,0 +1,110 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.forces.gravity.potential.SphericalHarmonicsProvider; +import org.orekit.forces.gravity.potential.TideSystem; +import org.orekit.time.AbsoluteDate; + +public class PythonSphericalHarmonicsProvider implements SphericalHarmonicsProvider { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the maximal supported degree. + * + * @return maximal supported degree + */ + @Override + public native int getMaxDegree(); + + /** + * Get the maximal supported order. + * + * @return maximal supported order + */ + @Override + public native int getMaxOrder(); + + /** + * Get the central body attraction coefficient. + * + * @return mu (m³/s²) + */ + @Override + public native double getMu(); + + /** + * Get the value of the central body reference radius. + * + * @return ae (m) + */ + @Override + public native double getAe(); + + /** + * Get the reference date for the harmonics. + * + * @return reference date for the harmonics + */ + @Override + public native AbsoluteDate getReferenceDate(); + + /** + * Get the offset from {@link #getReferenceDate reference date} for the harmonics. + * + * @param date current date + * @return offset between current date and reference date if there is a reference + * date, or 0.0 if there are no reference dates (i.e. if {@link #getReferenceDate} + * returns null) + */ + @Override + public native double getOffset(AbsoluteDate date); + + /** + * Get the {@link TideSystem} used in the gravity field. + * + * @return tide system used in the gravity field + */ + @Override + public native TideSystem getTideSystem(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonStateFunction.java b/java_additions/src/main/java/org/orekit/python/PythonStateFunction.java new file mode 100644 index 0000000000000000000000000000000000000000..f50f6099d6c714380a46347d0284ef562e8e3c6d --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonStateFunction.java @@ -0,0 +1,60 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.propagation.SpacecraftState; +import org.orekit.utils.StateFunction; + +public class PythonStateFunction implements StateFunction { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Evaluate the function. + * + * @param state spacecraft state as the sole free parameter of the function. + * @return vector value of the function + */ + @Override + public native double[] value(SpacecraftState state); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonStateJacobian.java b/java_additions/src/main/java/org/orekit/python/PythonStateJacobian.java new file mode 100644 index 0000000000000000000000000000000000000000..e9926a5dc5bf399d7abdbacd7980d9be78f0369f --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonStateJacobian.java @@ -0,0 +1,60 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.propagation.SpacecraftState; +import org.orekit.utils.StateJacobian; + +public class PythonStateJacobian implements StateJacobian { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Evaluate the Jacobian of the function. + * + * @param state spacecraft state as the sole free parameter of the function. + * @return Jacobian matric + */ + @Override + public native double[][] value(SpacecraftState state); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonTideSystemProvider.java b/java_additions/src/main/java/org/orekit/python/PythonTideSystemProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..a4b25f99243dbe5615c6ecc54f614b2d7b1c40e8 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonTideSystemProvider.java @@ -0,0 +1,58 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.forces.gravity.potential.TideSystem; +import org.orekit.forces.gravity.potential.TideSystemProvider; + +public class PythonTideSystemProvider implements TideSystemProvider { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the {@link TideSystem} used in the gravity field. + * + * @return tide system used in the gravity field + */ + @Override + public native TideSystem getTideSystem(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonTimeDerivativesEquations.java b/java_additions/src/main/java/org/orekit/python/PythonTimeDerivativesEquations.java new file mode 100644 index 0000000000000000000000000000000000000000..0c30b818799ac3a02e089ad0e4cd5179fd22141c --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonTimeDerivativesEquations.java @@ -0,0 +1,79 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.geometry.euclidean.threed.Vector3D; +import org.orekit.propagation.numerical.TimeDerivativesEquations; + +public class PythonTimeDerivativesEquations implements TimeDerivativesEquations { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Add the contribution of the Kepler evolution. + * <p>Since the Kepler evolution is the most important, it should + * be added after all the other ones, in order to improve + * numerical accuracy.</p> + * + * @param mu central body gravitational constant + */ + @Override + public native void addKeplerContribution(double mu); + + /** + * Add the contribution of a non-Keplerian acceleration. + * + * @param gamma acceleration vector in the same inertial frame the spacecraft state is defined in (m/s²) + * @since 9.0 + */ + @Override + public native void addNonKeplerianAcceleration(Vector3D gamma); + + /** + * Add the contribution of the flow rate (dm/dt). + * + * @param q the flow rate, must be negative (dm/dt) + * @throws IllegalArgumentException if flow-rate is positive + */ + @Override + public native void addMassDerivative(double q); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonTimeInterpolable.java b/java_additions/src/main/java/org/orekit/python/PythonTimeInterpolable.java new file mode 100644 index 0000000000000000000000000000000000000000..7ad38651347b815cd4b3ef5a8b633a5bfd16bae9 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonTimeInterpolable.java @@ -0,0 +1,81 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.time.AbsoluteDate; +import org.orekit.time.TimeInterpolable; + +import java.util.stream.Stream; + +public class PythonTimeInterpolable<T extends TimeInterpolable<T>> implements TimeInterpolable<T> { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get an interpolated instance. + * <p> + * Note that the state of the current instance may not be used + * in the interpolation process, only its type and non interpolable + * fields are used (for example central attraction coefficient or + * frame when interpolating orbits). The interpolable fields taken + * into account are taken only from the states of the sample points. + * So if the state of the instance must be used, the instance should + * be included in the sample points. + * </p> + * <p> + * Note that this method is designed for small samples only (say up + * to about 10-20 points) so it can be implemented using polynomial + * interpolation (typically Hermite interpolation). Using too much + * points may induce <a + * href="http://en.wikipedia.org/wiki/Runge%27s_phenomenon">Runge's + * phenomenon</a> and numerical problems (including NaN appearing). + * </p> + * + * @param date interpolation date + * @param sample sample points on which interpolation should be done + * @return a new instance, interpolated at specified date + * @since 9.0 + */ + @Override + public native T interpolate(AbsoluteDate date, Stream<T> sample); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonTimeScalarFunction.java b/java_additions/src/main/java/org/orekit/python/PythonTimeScalarFunction.java new file mode 100644 index 0000000000000000000000000000000000000000..3c61f7734d25300e464d3a3d7a85a102f61aaa5f --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonTimeScalarFunction.java @@ -0,0 +1,82 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.time.TimeScalarFunction; + +public class PythonTimeScalarFunction implements TimeScalarFunction { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Compute a function of time. + * + * @param date date + * @return value of the function + */ + @Override + public native double value(AbsoluteDate date); + + /** + * Compute a function of time. + * + * @param date date + * @return value of the function + */ + @Override + public <T extends RealFieldElement<T>> T value(FieldAbsoluteDate<T> date) { + return this.valueField(date); + } + + + /** + * Compute a function of time. + * + * @param date date + * @return value of the function + */ + public native <T extends RealFieldElement<T>> T valueField(FieldAbsoluteDate<T> date); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonTimeScale.java b/java_additions/src/main/java/org/orekit/python/PythonTimeScale.java new file mode 100644 index 0000000000000000000000000000000000000000..f15290b7961f92abd5291d65ee0979969882547d --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonTimeScale.java @@ -0,0 +1,98 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.time.TimeScale; + +public class PythonTimeScale implements TimeScale { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the offset to convert locations from {@link TAIScale} to instance. + * + * @param date conversion date + * @return offset in seconds to add to a location in <em>{@link TAIScale} + * time scale</em> to get a location in <em>instance time scale</em> + * @see #offsetToTAI(DateComponents, TimeComponents) + */ + @Override + public native double offsetFromTAI(AbsoluteDate date); + + /** + * Get the offset to convert locations from {@link TAIScale} to instance. + * + * @param date conversion date + * @return offset in seconds to add to a location in <em>{@link TAIScale} + * time scale</em> to get a location in <em>instance time scale</em> + * @see #offsetToTAI(DateComponents, TimeComponents) + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> T offsetFromTAI(FieldAbsoluteDate<T> date) { + return this.offsetFieldFromTAI(date); + } + + /** + * Get the offset to convert locations from {@link TAIScale} to instance. + * + * @param date conversion date + * @return offset in seconds to add to a location in <em>{@link TAIScale} + * time scale</em> to get a location in <em>instance time scale</em> + * @see #offsetToTAI(DateComponents, TimeComponents) + * @since 9.0 + */ + public native <T extends RealFieldElement<T>> T offsetFieldFromTAI(FieldAbsoluteDate<T> date); + + + /** + * Get the name time scale. + * + * @return name of the time scale + */ + @Override + public native String getName(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonTimeShiftable.java b/java_additions/src/main/java/org/orekit/python/PythonTimeShiftable.java new file mode 100644 index 0000000000000000000000000000000000000000..deda04e787e115e98dd7b372c5d9444552291c9e --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonTimeShiftable.java @@ -0,0 +1,59 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.time.TimeShiftable; + +public class PythonTimeShiftable<T extends TimeShiftable<T>> implements TimeShiftable<T> { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get a time-shifted instance. + * + * @param dt time shift in seconds + * @return a new instance, shifted with respect to instance (which is not changed) + */ + @Override + public native T shiftedBy(double dt); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonTimeStamped.java b/java_additions/src/main/java/org/orekit/python/PythonTimeStamped.java new file mode 100644 index 0000000000000000000000000000000000000000..dcb7a34d8b823fb72c782a4a5091e5ce5be9814d --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonTimeStamped.java @@ -0,0 +1,59 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.time.AbsoluteDate; +import org.orekit.time.TimeStamped; + +public class PythonTimeStamped implements TimeStamped { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the date. + * + * @return date attached to the object + */ + @Override + public native AbsoluteDate getDate(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonTimeStampedCache.java b/java_additions/src/main/java/org/orekit/python/PythonTimeStampedCache.java new file mode 100644 index 0000000000000000000000000000000000000000..6a82c86992319271ee66176a414d0eec67779663 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonTimeStampedCache.java @@ -0,0 +1,101 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.time.AbsoluteDate; +import org.orekit.time.TimeStamped; +import org.orekit.utils.TimeStampedCache; + +import java.util.stream.Stream; + +public class PythonTimeStampedCache<T extends TimeStamped> implements TimeStampedCache<T> { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the entries surrounding a central date. + * <p> + * If the central date is well within covered range, the returned array will + * be balanced with half the points before central date and half the points + * after it (depending on n parity, of course). If the central date is near + * the boundary, then the returned array will be unbalanced and will contain + * only the n earliest (or latest) entries. A typical example of the later + * case is leap seconds cache, since the number of leap seconds cannot be + * arbitrarily increased. + * <p> + * This method is safe for multiple threads to execute concurrently. + * + * @param central central date + * @return list of cached entries surrounding the specified date. The size + * of the list is guaranteed to be {@link #getNeighborsSize()}. + */ + @Override + public native Stream<T> getNeighbors(AbsoluteDate central); + + /** + * Get the fixed size of the lists returned by + * {@link #getNeighbors(AbsoluteDate)}. + * + * @return size of the list + */ + @Override + public native int getNeighborsSize(); + + /** + * Get the earliest entry in this cache. + * + * @return earliest cached entry + * @throws IllegalStateException if this cache is empty + */ + @Override + public native T getEarliest() throws IllegalStateException; + + /** + * Get the latest entry in this cache. + * + * @return latest cached entry + * @throws IllegalStateException if this cache is empty + */ + @Override + public native T getLatest() throws IllegalStateException; +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonTimeStampedGenerator.java b/java_additions/src/main/java/org/orekit/python/PythonTimeStampedGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..24514b533378d273a46d1971b0879caefb05d29f --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonTimeStampedGenerator.java @@ -0,0 +1,83 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.time.AbsoluteDate; +import org.orekit.time.TimeStamped; +import org.orekit.utils.TimeStampedGenerator; + +import java.util.List; + +public class PythonTimeStampedGenerator<T extends TimeStamped> implements TimeStampedGenerator<T> { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Generate a chronologically sorted list of entries to be cached. + * <p> + * If {@code existingDate} is earlier than {@code date}, the range covered by + * generated entries must cover at least from {@code existingDate} (excluded) + * to {@code date} (included). If {@code existingDate} is later than {@code date}, + * the range covered by generated entries must cover at least from {@code date} + * (included) to {@code existingDate} (excluded). + * </p> + * <p> + * The generated entries may cover a range larger than the minimum specified above + * if the generator prefers to generate large chunks of data at once. It may + * generate again entries already generated by an earlier call (typically at {@code + * existingDate}), these extra entries will be silently ignored by the cache. + * </p> + * <p> + * Non-coverage of the minimum range may lead to a loss of data, as the gap will + * not be filled by the {@link GenericTimeStampedCache} in subsequent calls. + * </p> + * <p> + * The generated entries <em>must</em> be chronologically sorted. + * </p> + * + * @param existingDate date of the closest already existing entry (may be null) + * @param date date that must be covered by the range of the generated array + * @return chronologically sorted list of generated entries + */ + @Override + public native List<T> generate(AbsoluteDate existingDate, AbsoluteDate date); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonTimeVectorFunction.java b/java_additions/src/main/java/org/orekit/python/PythonTimeVectorFunction.java new file mode 100644 index 0000000000000000000000000000000000000000..9f31e13dd49e35f1e781118b4d33280b2face353 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonTimeVectorFunction.java @@ -0,0 +1,81 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; +import org.orekit.time.TimeVectorFunction; + +public class PythonTimeVectorFunction implements TimeVectorFunction { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Compute a function of time. + * + * @param date date + * @return value of the function + */ + @Override + public native double[] value(AbsoluteDate date); + + /** + * Compute a function of time. + * + * @param date date + * @return value of the function + */ + @Override + public <T extends RealFieldElement<T>> T[] value(FieldAbsoluteDate<T> date) { + return this.valueField(date); + } + + /** + * Compute a function of time. + * + * @param date date + * @return value of the function + */ + public native <T extends RealFieldElement<T>> T[] valueField(FieldAbsoluteDate<T> date); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonTransformProvider.java b/java_additions/src/main/java/org/orekit/python/PythonTransformProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..4a1196df8cd5da5540372283ee5311788a5dbdd4 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonTransformProvider.java @@ -0,0 +1,87 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.hipparchus.RealFieldElement; +import org.orekit.frames.FieldTransform; +import org.orekit.frames.Transform; +import org.orekit.frames.TransformProvider; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.FieldAbsoluteDate; + +public class PythonTransformProvider implements TransformProvider { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the {@link Transform} corresponding to specified date. + * + * @param date current date + * @return transform at specified date + */ + @Override + public native Transform getTransform(AbsoluteDate date); + + /** + * Get the {@link FieldTransform} corresponding to specified date. + * + * @param date current date + * @return transform at specified date + * @since 9.0 + */ + @Override + public <T extends RealFieldElement<T>> FieldTransform<T> getTransform(FieldAbsoluteDate<T> date) { + return this.getFieldTransform(date); + } + + /** + * Get the {@link FieldTransform} corresponding to specified date. + * + * @param date current date + * @return transform at specified date + * @since 9.0 + */ + + public native <T extends RealFieldElement<T>> FieldTransform<T> getFieldTransform(FieldAbsoluteDate<T> date); + +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonTroposphericModel.java b/java_additions/src/main/java/org/orekit/python/PythonTroposphericModel.java new file mode 100644 index 0000000000000000000000000000000000000000..df25d9a13f94fab18eeb9aac03bed98fdbdbf69b --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonTroposphericModel.java @@ -0,0 +1,60 @@ +/* Copyright 2011-2012 Space Applications Services + * Licensed to CS Communication & Systèmes (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.models.earth.TroposphericModel; + +public class PythonTroposphericModel implements TroposphericModel { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Calculates the tropospheric path delay for the signal path from a ground + * station to a satellite. + * + * @param elevation the elevation of the satellite, in radians + * @param height the height of the station in m above sea level + * @return the path delay due to the troposphere in m + */ + @Override + public native double pathDelay(double elevation, double height); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonUTCTAIOffsetsLoader.java b/java_additions/src/main/java/org/orekit/python/PythonUTCTAIOffsetsLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..55d970a781e058913daa34ede629ae89eabcad51 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonUTCTAIOffsetsLoader.java @@ -0,0 +1,61 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.time.OffsetModel; +import org.orekit.time.UTCTAIOffsetsLoader; + +import java.util.List; + +public class PythonUTCTAIOffsetsLoader implements UTCTAIOffsetsLoader { + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Load UTC-TAI offsets entries. + * + * @return sorted UTC-TAI offsets entries (if the linear offsets used + * prior to 1972 are missing, they will be inserted automatically) + */ + @Override + public native List<OffsetModel> loadOffsets(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonUnnormalizedSphericalHarmonicsProvider.java b/java_additions/src/main/java/org/orekit/python/PythonUnnormalizedSphericalHarmonicsProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..ee2b7d67202cc86bf3a48485751f26ef15c517ee --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonUnnormalizedSphericalHarmonicsProvider.java @@ -0,0 +1,121 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.forces.gravity.potential.TideSystem; +import org.orekit.forces.gravity.potential.UnnormalizedSphericalHarmonicsProvider; +import org.orekit.time.AbsoluteDate; + +public class PythonUnnormalizedSphericalHarmonicsProvider implements UnnormalizedSphericalHarmonicsProvider { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Get the un-normalized spherical harmonic coefficients at a specific instance in time. + * + * @param date of evaluation + * @return un-normalized coefficients on {@code date}. + * @since 6.1 + */ + @Override + public native UnnormalizedSphericalHarmonics onDate(AbsoluteDate date); + + /** + * Get the maximal supported degree. + * + * @return maximal supported degree + */ + @Override + public native int getMaxDegree(); + + /** + * Get the maximal supported order. + * + * @return maximal supported order + */ + @Override + public native int getMaxOrder(); + + /** + * Get the central body attraction coefficient. + * + * @return mu (m³/s²) + */ + @Override + public native double getMu(); + + /** + * Get the value of the central body reference radius. + * + * @return ae (m) + */ + @Override + public native double getAe(); + + /** + * Get the reference date for the harmonics. + * + * @return reference date for the harmonics + */ + @Override + public native AbsoluteDate getReferenceDate(); + + /** + * Get the offset from {@link #getReferenceDate reference date} for the harmonics. + * + * @param date current date + * @return offset between current date and reference date if there is a reference + * date, or 0.0 if there are no reference dates (i.e. if {@link #getReferenceDate} + * returns null) + */ + @Override + public native double getOffset(AbsoluteDate date); + + /** + * Get the {@link TideSystem} used in the gravity field. + * + * @return tide system used in the gravity field + */ + @Override + public native TideSystem getTideSystem(); +} diff --git a/java_additions/src/main/java/org/orekit/python/PythonWeatherModel.java b/java_additions/src/main/java/org/orekit/python/PythonWeatherModel.java new file mode 100644 index 0000000000000000000000000000000000000000..708a4762bd28d3cabada83a86c4bb103963c0b34 --- /dev/null +++ b/java_additions/src/main/java/org/orekit/python/PythonWeatherModel.java @@ -0,0 +1,62 @@ +/* Copyright 2002-2019 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// this file was created by SCC 2019 and is largely a derived work from the +// original java class/interface + +package org.orekit.python; + +import org.orekit.models.earth.WeatherModel; +import org.orekit.time.AbsoluteDate; + +public class PythonWeatherModel implements WeatherModel { + + /** Part of JCC Python interface to object */ + private long pythonObject; + + /** Part of JCC Python interface to object */ + public void pythonExtension(long pythonObject) + { + this.pythonObject = pythonObject; + } + + /** Part of JCC Python interface to object */ + public long pythonExtension() + { + return this.pythonObject; + } + + /** Part of JCC Python interface to object */ + public void finalize() + throws Throwable + { + pythonDecRef(); + } + + /** Part of JCC Python interface to object */ + public native void pythonDecRef(); + + /** + * Calculates the weather parameters of the model. + * In order to obtain the correct values of the parameters + * this method has to be call just after the construction of the model. + * + * @param stationHeight the height of the station in m + * @param currentDate current date + */ + @Override + public native void weatherParameters(double stationHeight, AbsoluteDate currentDate); +} diff --git a/python_files/test/AbstractDetectorTest.py b/python_files/test/AbstractDetectorTest.py new file mode 100644 index 0000000000000000000000000000000000000000..2bd3ddb35d88f7cfd41438f9775fc34274c2a032 --- /dev/null +++ b/python_files/test/AbstractDetectorTest.py @@ -0,0 +1,115 @@ +# -*- coding: utf-8 -*- + +import orekit +orekit.initVM() + +from org.orekit.frames import FramesFactory, TopocentricFrame +from org.orekit.bodies import OneAxisEllipsoid, GeodeticPoint +from org.orekit.time import AbsoluteDate, TimeScalesFactory +from org.orekit.orbits import KeplerianOrbit +from org.orekit.utils import Constants +from org.orekit.propagation.analytical import KeplerianPropagator +from org.orekit.utils import PVCoordinates, IERSConventions +from org.orekit.propagation.events.handlers import EventHandler +from org.hipparchus.geometry.euclidean.threed import Vector3D +from org.orekit.python import PythonEventHandler, PythonAbstractDetector +from org.orekit.propagation.events.handlers import ContinueOnEvent, StopOnEvent + +from math import radians +import math +import unittest +import sys + +from orekit.pyhelpers import setup_orekit_curdir +setup_orekit_curdir() + +class PassCounter(PythonEventHandler): + """Eventhandler that counts positive events""" + passes = 0 + + def eventOccurred(self, s, T, increasing): + if increasing: + self.passes = self.passes + 1 + + return EventHandler.Action.CONTINUE + + def resetState(self, detector, oldState): + return oldState + + +class MyElevationDetector(PythonAbstractDetector): + + def __init__(self, elevation, topo, handler=None): + self.elevation = elevation + self.topo = topo + + dmax = float(PythonAbstractDetector.DEFAULT_MAXCHECK) + dthresh = float(PythonAbstractDetector.DEFAULT_THRESHOLD) + dmaxiter = PythonAbstractDetector.DEFAULT_MAX_ITER + if handler is None: + handler = StopOnEvent().of_(MyElevationDetector) + + super(MyElevationDetector, self).__init__(dmax, dthresh, dmaxiter, handler) #super(maxCheck, threshold, maxIter, handler); + + def init(self, *args, **kw): + pass + + def getElevation(self): + return self.elevation + + def getTopocentricFrame(self): + return self.topo + + def g(self, s): + tmp = self.topo.getElevation(s.getPVCoordinates().getPosition(), s.getFrame(), s.getDate())-self.elevation + return tmp + + def create(self, newMaxCheck, newThreshHold, newMaxIter, newHandler): + return MyElevationDetector(self.elevation, self.topo, handler=newHandler) + +class AbstractDetectorTest(unittest.TestCase): + + def testOwnElevationDetector(self): + + initialDate = AbsoluteDate(2014, 1, 1, 23, 30, 00.000, TimeScalesFactory.getUTC()) + inertialFrame = FramesFactory.getEME2000() # inertial frame for orbit definition + position = Vector3D(-6142438.668, 3492467.560, -25767.25680) + velocity = Vector3D(505.8479685, 942.7809215, 7435.922231) + pvCoordinates = PVCoordinates(position, velocity) + initialOrbit = KeplerianOrbit(pvCoordinates, + inertialFrame, + initialDate, + Constants.WGS84_EARTH_MU) + + kepler = KeplerianPropagator(initialOrbit) + + ITRF = FramesFactory.getITRF(IERSConventions.IERS_2010, True) + earth = OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, + Constants.WGS84_EARTH_FLATTENING, + ITRF) + + # Station + longitude = radians(45.0) + latitude = radians(25.0) + altitude = 0 + station1 = GeodeticPoint(latitude, longitude, float (altitude)) + sta1Frame = TopocentricFrame(earth, station1, "station 1") + + elevation = math.radians(5.0) + + detector = MyElevationDetector(elevation, sta1Frame) + + mycounter = PassCounter().of_(MyElevationDetector) + detector = detector.withHandler(mycounter) + + kepler.addEventDetector(detector) + + finalState = kepler.propagate(initialDate.shiftedBy(60*60*24.0*15)) + + print(mycounter.passes) + self.assertEqual(52, mycounter.passes) + +if __name__ == '__main__': + suite = unittest.TestLoader().loadTestsFromTestCase(AbstractDetectorTest) + ret = not unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful() + sys.exit(ret) diff --git a/python_files/test/AdditionalEquationsTest.py b/python_files/test/AdditionalEquationsTest.py new file mode 100644 index 0000000000000000000000000000000000000000..8bb06fb4da1014cbc7603bcd92c26a3f7eed0989 --- /dev/null +++ b/python_files/test/AdditionalEquationsTest.py @@ -0,0 +1,159 @@ +# -*- coding: utf-8 -*- + + +""" +/* Copyright 2002-2018 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + Python version translated from Java by Petrus Hyvönen, SSC 2018 + +""" + +import unittest +import sys + +# Python orekit specifics +import orekit +orekit.initVM() + +from orekit import JArray_double +from org.orekit.data import DataProvidersManager, ZipJarCrawler +from org.orekit.python import PythonAdditionalEquations +from org.orekit.propagation.integration import AdditionalEquations +from org.orekit.forces.gravity.potential import GravityFieldFactory +from org.orekit.forces.gravity.potential import SHMFormatReader +from java.io import File + + +from org.hipparchus.geometry.euclidean.threed import Vector3D +from org.hipparchus.ode.nonstiff import DormandPrince853Integrator + +from org.orekit.frames import FramesFactory +from org.orekit.orbits import EquinoctialOrbit +from org.orekit.orbits import OrbitType +from org.orekit.propagation import SpacecraftState +from org.orekit.propagation.numerical import NumericalPropagator +from org.orekit.propagation.semianalytical.dsst import DSSTPropagator +from org.orekit.time import AbsoluteDate +from org.orekit.utils import PVCoordinates + + +# The class to be the additional equation +class InitCheckerEquations(PythonAdditionalEquations): # implements AdditionalEquations + + # This is the method called for object creation as in java InitCheckerEquations(self, expected) + def __init__(self, expected): + super(InitCheckerEquations, self).__init__() + self.expected = expected + self.called = False + + # Part of AdditionalEquations interface + def init(self, initialState, target): + assert (self.expected - 1.0e-15) < initialState.getAdditionalState(self.getName())[0] < (self.expected + 1.0e-15) + self.called = True + + # Part of AdditionalEquations interface + def computeDerivatives(self, s, pDot): + pDot[0] = 1.5 + return JArray_double(6) + + # Part of AdditionalEquations interface + def getName(self): + return "linear" + + def wasCalled(self): + return self.called + + +class AdditionalEquationsTest(unittest.TestCase): + + def setUp(self): + DM = DataProvidersManager.getInstance() + datafile = File('resources.zip') + if not datafile.exists(): + print('File :', datafile.absolutePath, ' not found') + + crawler = ZipJarCrawler(datafile) + DM.clearProviders() + DM.addProvider(crawler) + DataProvidersManager.OREKIT_DATA_PATH = 'potential/shm-format' + GravityFieldFactory.addPotentialCoefficientsReader(SHMFormatReader("^eigen_cg03c_coef$", False)) + + mu = GravityFieldFactory.getUnnormalizedProvider(0, 0).getMu() + position = Vector3D(7.0e6, 1.0e6, 4.0e6) + velocity = Vector3D(-500.0, 8000.0, 1000.0) + self.initDate = AbsoluteDate.J2000_EPOCH + orbit = EquinoctialOrbit(PVCoordinates(position, velocity), + FramesFactory.getEME2000(), self.initDate, mu) + self.initialState = SpacecraftState(orbit) + self.tolerance = NumericalPropagator.tolerances(0.001, orbit, OrbitType.EQUINOCTIAL) + + print('Setup Finished ok') + + def tearDown(self): + self.initDate = None + self.initialState = None + self.tolerance = None + + # Test for issue #401 with numerical propagator + def testInitNumerical(self): + # setup + reference = 1.25 + checker = InitCheckerEquations(reference) + self.assertFalse(checker.wasCalled()) + + # action + integrator = DormandPrince853Integrator(0.001, 200.0, JArray_double.cast_(self.tolerance[0]), + JArray_double.cast_(self.tolerance[1])) + integrator.setInitialStepSize(60.0) + propagatorNumerical = NumericalPropagator(integrator) + propagatorNumerical.setInitialState(self.initialState.addAdditionalState(checker.getName(), reference)) + propagatorNumerical.addAdditionalEquations(checker) + propagatorNumerical.propagate(self.initDate.shiftedBy(600.0)) + + # verify + self.assertTrue(checker.wasCalled()) + + print('testInitNumerical finished ok') + + # Test for issue #401 with a DSST propagator + def testInitDSST(self): + + # setup + reference = 3.5 + checker = InitCheckerEquations(reference) + self.assertFalse(checker.wasCalled()) + + # action + integrator = DormandPrince853Integrator(0.001, 200.0, JArray_double.cast_(self.tolerance[0]), + JArray_double.cast_(self.tolerance[1])) + integrator.setInitialStepSize(60.0) + + propagatorDSST = DSSTPropagator(integrator) + propagatorDSST.setInitialState(self.initialState.addAdditionalState(checker.getName(), reference)) + propagatorDSST.addAdditionalEquations(checker) + propagatorDSST.propagate(self.initDate.shiftedBy(600.0)) + + # verify + self.assertTrue(checker.wasCalled()) + print('testInitDSST was successfully finished') + + +if __name__ == '__main__': + suite = unittest.TestLoader().loadTestsFromTestCase(AdditionalEquationsTest) + ret = not unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful() + sys.exit(ret) diff --git a/python_files/test/FieldAdditionalEquationsTest.py b/python_files/test/FieldAdditionalEquationsTest.py new file mode 100644 index 0000000000000000000000000000000000000000..a5c6ca97785a9d1eb7dadd1cb73b92b9e6df3419 --- /dev/null +++ b/python_files/test/FieldAdditionalEquationsTest.py @@ -0,0 +1,150 @@ +# -*- coding: utf-8 -*- + + +""" +/* Copyright 2002-2018 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + Python version translated from Java by Petrus Hyvönen, SSC 2018 + +""" + +import unittest +import sys + +# Python orekit specifics +import orekit + +orekit.initVM() + +from orekit import JArray_double +from org.orekit.data import DataProvidersManager, ZipJarCrawler +from org.orekit.python import PythonFieldAdditionalEquations +from org.orekit.forces.gravity.potential import GravityFieldFactory +from org.orekit.forces.gravity.potential import SHMFormatReader +from java.io import File + + +from org.hipparchus.geometry.euclidean.threed import Vector3D +from org.hipparchus import RealFieldElement + +from org.hipparchus.ode.nonstiff import DormandPrince853Integrator +from org.hipparchus.ode.nonstiff import DormandPrince853FieldIntegrator + +from org.orekit.frames import FramesFactory +from org.orekit.orbits import EquinoctialOrbit +from org.orekit.orbits import OrbitType +from org.orekit.propagation import SpacecraftState, FieldSpacecraftState +from org.orekit.propagation.numerical import NumericalPropagator, FieldNumericalPropagator +from org.orekit.propagation.semianalytical.dsst import DSSTPropagator +from org.orekit.time import AbsoluteDate, FieldAbsoluteDate +from org.orekit.utils import PVCoordinates +from org.hipparchus.util import MathArrays +from org.hipparchus.util import Decimal64Field + + + +# The class to be the additional equation +class InitCheckerEquations(PythonFieldAdditionalEquations): # implements AdditionalEquations + + # This is the method called for object creation as in java InitCheckerEquations(self, expected) + def __init__(self, expected): + super(InitCheckerEquations, self).__init__() + self.expected = expected + self.called = False + + # Part of AdditionalEquations interface + def init(self, initialState, target): + assert (self.expected - 1.0e-15) < initialState.getAdditionalState(self.getName())[0].getReal() < ( + self.expected + 1.0e-15) + self.called = True + + # Part of AdditionalEquations interface + def computeDerivatives(self, s, pDot): + zerovalue = RealFieldElement.cast_(s.getDate().getField().getZero()) # Not completely sure why this needs casting but becomes just an "Object" otherwise + pDot[0] = zerovalue.add(1.5) + return MathArrays.buildArray(s.getDate().getField(), 7) + + # Part of AdditionalEquations interface + def getName(self): + return "linear" + + def wasCalled(self): + return self.called + + +class FieldAdditionalEquationsTest(unittest.TestCase): + def setUp(self): + # Initialize the data sources + DM = DataProvidersManager.getInstance() + datafile = File('resources.zip') + if not datafile.exists(): + print('File :', datafile.absolutePath, ' not found') + + crawler = ZipJarCrawler(datafile) + DM.clearProviders() + DM.addProvider(crawler) + DataProvidersManager.OREKIT_DATA_PATH = 'potential/shm-format' + GravityFieldFactory.addPotentialCoefficientsReader(SHMFormatReader("^eigen_cg03c_coef$", False)) + + mu = GravityFieldFactory.getUnnormalizedProvider(0, 0).getMu() + position = Vector3D(7.0e6, 1.0e6, 4.0e6) + velocity = Vector3D(-500.0, 8000.0, 1000.0) + self.initDate = AbsoluteDate.J2000_EPOCH + orbit = EquinoctialOrbit(PVCoordinates(position, velocity), + FramesFactory.getEME2000(), self.initDate, mu) + self.initialState = SpacecraftState(orbit) + self.tolerance = NumericalPropagator.tolerances(0.001, orbit, OrbitType.EQUINOCTIAL) + + print('Setup Finished ok') + + def tearDown(self): + self.initDate = None + self.initialState = None + self.tolerance = None + + # Test for issue #401 with numerical propagator + def testInitNumerical(self): + self.doTestInitNumerical(Decimal64Field.getInstance()) + + def doTestInitNumerical(self, field): + # setup + reference = 1.25 + checker = InitCheckerEquations(reference) + self.assertFalse(checker.wasCalled()) + + # action + integrator = DormandPrince853FieldIntegrator(field, 0.001, 200.0, JArray_double.cast_(self.tolerance[0]), + JArray_double.cast_(self.tolerance[1])) + integrator.setInitialStepSize(field.getZero().add(60.0)) + propagatorNumerical = FieldNumericalPropagator(field, integrator) + propagatorNumerical.setInitialState( + FieldSpacecraftState(field, self.initialState).addAdditionalState(checker.getName(), + field.getZero().add(reference))) + propagatorNumerical.addAdditionalEquations(checker) + propagatorNumerical.propagate(FieldAbsoluteDate(field, self.initDate).shiftedBy(600.0)) + + # verify + self.assertTrue(checker.wasCalled()) + + print('testInitNumerical finished ok') + + +if __name__ == '__main__': + suite = unittest.TestLoader().loadTestsFromTestCase(FieldAdditionalEquationsTest) + ret = not unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful() + sys.exit(ret) diff --git a/python_files/test/FieldStopOnDecreasingTest.py b/python_files/test/FieldStopOnDecreasingTest.py new file mode 100644 index 0000000000000000000000000000000000000000..aa8701b8d723ac1f58cc769b6badfffb42fd2daa --- /dev/null +++ b/python_files/test/FieldStopOnDecreasingTest.py @@ -0,0 +1,121 @@ +# -*- coding: utf-8 -*- + + +""" +/* Copyright 2002-2018 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + Python version translated from Java by Petrus Hyvönen, SSC 2019 + +""" + +import sys +import unittest + +# Python orekit specifics +import orekit + +orekit.initVM() + +from org.orekit.frames import FramesFactory +from org.orekit.propagation import FieldSpacecraftState +from org.orekit.time import FieldAbsoluteDate +from org.hipparchus.util import Decimal64Field +from org.orekit.orbits import FieldKeplerianOrbit +from org.orekit.orbits import PositionAngle +from org.orekit.utils import Constants +from org.orekit.propagation.events.handlers import FieldStopOnDecreasing +from org.orekit.propagation.events.handlers import FieldEventHandler + + +class FieldStopOnDecreasingTest(unittest.TestCase): + + def testNoReset(self): + self.doTestNoReset(Decimal64Field.getInstance()) + + def testIncreasing(self): + self.doTestIncreasing(Decimal64Field.getInstance()) + + # def testDecreasing(self): + # self.doTestDecreasing(Decimal64Field.getInstance()) + + def doTestNoReset(self, field): + zero = field.getZero() + date = FieldAbsoluteDate(field) + s = FieldSpacecraftState(FieldKeplerianOrbit(zero.add(24464560.0), + zero.add(0.7311), + zero.add(0.122138), + zero.add(3.10686), + zero.add(1.00681), + zero.add(0.048363), + PositionAngle.MEAN, + FramesFactory.getEME2000(), + date, + Constants.EIGEN5C_EARTH_MU)) + + handler = FieldStopOnDecreasing() + handler_casted = FieldEventHandler.cast_(handler) + s2 = handler_casted.resetState(None, s) + + self.assertEqual(s, s2) + + def doTestIncreasing(self, field): + zero = field.getZero() + date = FieldAbsoluteDate(field) + s = FieldSpacecraftState(FieldKeplerianOrbit(zero.add(24464560.0), + zero.add(0.7311), + zero.add(0.122138), + zero.add(3.10686), + zero.add(1.00681), + zero.add(0.048363), + PositionAngle.MEAN, + FramesFactory.getEME2000(), + date, + Constants.EIGEN5C_EARTH_MU)) + + handler = FieldStopOnDecreasing() + handler_casted = FieldEventHandler.cast_(handler) + event = handler_casted.eventOccurred(s, None, True) + + self.assertEqual(FieldEventHandler.Action.CONTINUE, event) + + + +""" + + private <T extends RealFieldElement<T>> void doTestDecreasing(Field<T> field) { + T zero = field.getZero(); + FieldAbsoluteDate<T> date = new FieldAbsoluteDate<>(field); + FieldSpacecraftState<T> s = new FieldSpacecraftState<>(new FieldKeplerianOrbit<>(zero.add(24464560.0), + zero.add(0.7311), + zero.add(0.122138), + zero.add(3.10686), + zero.add(1.00681), + zero.add(0.048363), + PositionAngle.MEAN, + FramesFactory.getEME2000(), + date, + Constants.EIGEN5C_EARTH_MU)); + Assert.assertSame(FieldEventHandler.Action.STOP, new FieldStopOnDecreasing<FieldEventDetector<T>, T>().eventOccurred(s, null, false)); + } + +} +""" +if __name__ == '__main__': + suite = unittest.TestLoader().loadTestsFromTestCase(FieldStopOnDecreasingTest) + ret = not unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful() + sys.exit(ret) diff --git a/python_files/test/SpinStabilizedTest.py b/python_files/test/SpinStabilizedTest.py new file mode 100644 index 0000000000000000000000000000000000000000..95c304581cd7eb931dae185a251b8185ebca2573 --- /dev/null +++ b/python_files/test/SpinStabilizedTest.py @@ -0,0 +1,164 @@ +# -*- coding: utf-8 -*- + +""" +/* Copyright 2002-2018 CS Systèmes d'Information + * Licensed to CS Systèmes d'Information (CS) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * CS licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + Python version translated from Java by Petrus Hyvönen, SSC 2018 + +""" + +import math +import sys +import unittest + +# Python orekit specifics +import orekit +orekit.initVM() + +from org.orekit.data import DataProvidersManager, ZipJarCrawler +from java.io import File + +from org.hipparchus.geometry.euclidean.threed import Rotation +from org.hipparchus.geometry.euclidean.threed import Vector3D +from org.hipparchus.util import Decimal64Field +from org.hipparchus.util import FastMath + +from org.orekit.bodies import CelestialBodyFactory + +from org.orekit.frames import FramesFactory +from org.orekit.orbits import KeplerianOrbit +from org.orekit.orbits import PositionAngle +from org.orekit.propagation import FieldSpacecraftState +from org.orekit.propagation import SpacecraftState +from org.orekit.propagation.analytical import KeplerianPropagator +from org.orekit.time import AbsoluteDate +from org.orekit.time import DateComponents +from org.orekit.time import FieldAbsoluteDate +from org.orekit.time import TimeComponents +from org.orekit.time import TimeScalesFactory +from org.orekit.utils import AngularCoordinates +from org.orekit.utils import PVCoordinates +from org.orekit.utils import PVCoordinatesProvider +from org.orekit.attitudes import CelestialBodyPointed, SpinStabilized, InertialProvider + + +class SpinStabilizedTest(unittest.TestCase): + + def setUp(self): + DM = DataProvidersManager.getInstance() + datafile = File('resources.zip') + if not datafile.exists(): + print('File :', datafile.absolutePath, ' not found') + + crawler = ZipJarCrawler(datafile) + DM.clearProviders() + DM.addProvider(crawler) + + def testBBQModel(self): + sun = CelestialBodyFactory.getSun() + + date = AbsoluteDate(DateComponents(1970, 1, 1), + TimeComponents(3, 25, 45.6789), + TimeScalesFactory.getTAI()) + + rate = 2.0 * math.pi / (12 * 60) # 12 minutes spin rate + cbp = CelestialBodyPointed(FramesFactory.getEME2000(), sun, Vector3D.PLUS_K, + Vector3D.PLUS_I, Vector3D.PLUS_K) + + bbq = SpinStabilized(cbp, date, Vector3D.PLUS_K, rate) + pv: Vector3D = PVCoordinates(Vector3D(28812595.32012577, 5948437.4640250085, 0.0), + Vector3D(0.0, 0.0, 3680.853673522056)) + + kep = KeplerianOrbit(pv, FramesFactory.getEME2000(), date, 3.986004415e14) + + attitude = bbq.getAttitude(kep, date, kep.getFrame()) + + # Decimal64Field is The field of double precision floating-point numbers + self.checkField(Decimal64Field.getInstance(), bbq, kep, kep.getDate(), kep.getFrame()) + + xDirection = attitude.getRotation().applyInverseTo(Vector3D.PLUS_I) + sunpos = PVCoordinatesProvider.cast_(sun).getPVCoordinates(date, FramesFactory.getEME2000()).getPosition() + angle = Vector3D.angle(xDirection, sunpos) + self.assertAlmostEqual(FastMath.atan(1.0 / 5000.0), angle, delta=2.0e-15) + self.assertAlmostEqual(rate, attitude.getSpin().getNorm(), delta=1.0e-6) + self.assertEqual(cbp.hashCode(), bbq.getUnderlyingAttitudeProvider().hashCode()) # The wrapped object seems to thus hash is used + + print("testBBQModel finished ok") + + def testSpin(self): + date = AbsoluteDate(DateComponents(1970, 1, 1), + TimeComponents(3, 25, 45.6789), + TimeScalesFactory.getTAI()) + + rate = 2.0 * math.pi / (12 * 60) # 12 minutes spin rate + + law = SpinStabilized(InertialProvider(Rotation.IDENTITY), date, Vector3D.PLUS_K, rate) + + orbit = KeplerianOrbit(7178000.0, 1.e-4, FastMath.toRadians(50.), + FastMath.toRadians(10.), FastMath.toRadians(20.), + FastMath.toRadians(30.), PositionAngle.MEAN, + FramesFactory.getEME2000(), date, 3.986004415e14) + + propagator = KeplerianPropagator(orbit, law) + + h = 10.0 + sMinus = propagator.propagate(date.shiftedBy(-h)) + s0 = propagator.propagate(date) + sPlus = propagator.propagate(date.shiftedBy(h)) + spin0 = s0.getAttitude().getSpin() + + # check that spin is consistent with attitude evolution + errorAngleMinus = Rotation.distance(sMinus.shiftedBy(h).getAttitude().getRotation(), + s0.getAttitude().getRotation()) + evolutionAngleMinus = Rotation.distance(sMinus.getAttitude().getRotation(), + s0.getAttitude().getRotation()) + self.assertTrue(errorAngleMinus <= 1.0e-6 * evolutionAngleMinus) + + errorAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), + sPlus.shiftedBy(-h).getAttitude().getRotation()) + evolutionAnglePlus = Rotation.distance(s0.getAttitude().getRotation(), + sPlus.getAttitude().getRotation()) + self.assertTrue(errorAnglePlus <= 1.0e-6 * evolutionAnglePlus) + + # compute spin axis using finite differences + rM = sMinus.getAttitude().getRotation() + rP = sPlus.getAttitude().getRotation() + reference = AngularCoordinates.estimateRate(rM, rP, 2 * h) + + self.assertAlmostEqual(2 * FastMath.PI / reference.getNorm(), 2 * FastMath.PI / spin0.getNorm(), delta=0.05) + self.assertAlmostEqual(0.0, FastMath.toDegrees(Vector3D.angle(reference, spin0)), delta=1.0e-10) + self.assertAlmostEqual(0.0, FastMath.toDegrees(Vector3D.angle(Vector3D.PLUS_K, spin0)), delta=1.0e-10) + + def checkField(self, field, provider, orbit, date, frame): + attitudeD = provider.getAttitude(orbit, date, frame) + orbitF = FieldSpacecraftState(field, SpacecraftState(orbit)).getOrbit() + dateF = FieldAbsoluteDate(field, date) + attitudeF = provider.getAttitude(orbitF, dateF, frame) # Get attitude in field-notation + self.assertAlmostEqual(0.0, Rotation.distance(attitudeD.getRotation(), attitudeF.getRotation().toRotation()), + delta=1.0e-15) + self.assertAlmostEqual(0.0, Vector3D.distance(attitudeD.getSpin(), attitudeF.getSpin().toVector3D()), + delta=1.0e-15) + self.assertAlmostEqual(0.0, + Vector3D.distance(attitudeD.getRotationAcceleration(), attitudeF.getRotationAcceleration().toVector3D()), + delta=1.0e-15) + + +if __name__ == '__main__': + suite = unittest.TestLoader().loadTestsFromTestCase(SpinStabilizedTest) + ret = not unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful() + sys.exit(ret) diff --git a/python_files/test/resources.zip b/python_files/test/resources.zip new file mode 100644 index 0000000000000000000000000000000000000000..44cbeb45d5dfe21453c52b1144c2bb5c97a096b9 Binary files /dev/null and b/python_files/test/resources.zip differ