From 944fe927e34967358c39e24ea8b2266b6d16fa8d Mon Sep 17 00:00:00 2001 From: petrush <petrus.hyvonen@sscspace.com> Date: Wed, 27 Feb 2019 10:17:58 +0100 Subject: [PATCH] Updates of tests and java wrappers corresponding to conda build 2 of orekit --- .../orekit/python/PythonAbstractDetector.java | 2 - .../python/PythonAbstractMeasurement.java | 1 - .../org/orekit/python/PythonAtmosphere.java | 2 + .../PythonAtmosphericRefractionModel.java | 2 + .../orekit/python/PythonAttitudeProvider.java | 4 +- .../PythonAttitudeProviderModifier.java | 6 +- .../org/orekit/python/PythonBodyShape.java | 2 + .../orekit/python/PythonCelestialBody.java | 12 ++ .../python/PythonCelestialBodyLoader.java | 1 + .../python/PythonComparableMeasurement.java | 3 + .../PythonCovarianceMatrixProvider.java | 3 + .../python/PythonDTM2000InputParameters.java | 2 + .../org/orekit/python/PythonDataFilter.java | 1 + .../org/orekit/python/PythonDataLoader.java | 2 + .../org/orekit/python/PythonDataProvider.java | 1 + .../orekit/python/PythonDatesSelector.java | 1 + .../PythonDiscreteTroposphericModel.java | 21 ++ .../orekit/python/PythonDragSensitive.java | 7 + .../PythonEOPBasedTransformProvider.java | 20 +- .../org/orekit/python/PythonEarthShape.java | 2 + .../orekit/python/PythonEventDetector.java | 1 - .../PythonFieldAdditionalEquations.java | 3 - .../python/PythonGNSSAttitudeProvider.java | 2 + .../python/PythonGPSOrbitalElements.java | 104 +++------- .../java/org/orekit/python/PythonIAUPole.java | 4 +- .../orekit/python/PythonIonosphericModel.java | 2 + .../python/PythonJB2008InputParameters.java | 7 +- .../orekit/python/PythonMappingFunction.java | 2 + .../PythonNRLMSISE00InputParameters.java | 3 + .../python/PythonOrekitFixedStepHandler.java | 1 - .../python/PythonOrekitStepHandler.java | 10 +- .../python/PythonOrekitStepInterpolator.java | 32 ++- .../python/PythonPropagatorConverter.java | 18 +- .../org/orekit/python/PythonTimeScale.java | 2 + .../python/PythonTransformProvider.java | 2 + .../python/PythonTroposphericModel.java | 3 + python_files/test/AdditionalEquationsTest.py | 3 +- .../test/FieldAdditionalEquationsTest.py | 3 +- python_files/test/OrekitStepHandlerTest.py | 187 ++++++++++++++++++ python_files/test/SpinStabilizedTest.py | 2 +- 40 files changed, 336 insertions(+), 150 deletions(-) create mode 100644 python_files/test/OrekitStepHandlerTest.py diff --git a/java_additions/src/main/java/org/orekit/python/PythonAbstractDetector.java b/java_additions/src/main/java/org/orekit/python/PythonAbstractDetector.java index 5073f5f..e6ec0ba 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonAbstractDetector.java +++ b/java_additions/src/main/java/org/orekit/python/PythonAbstractDetector.java @@ -20,12 +20,10 @@ package org.orekit.python; -import org.orekit.errors.OrekitException; import org.orekit.propagation.SpacecraftState; import org.orekit.propagation.events.AbstractDetector; import org.orekit.propagation.events.EventDetector; import org.orekit.propagation.events.handlers.EventHandler; -import org.orekit.time.AbsoluteDate; /** Common parts shared by several orbital events finders. * @see org.orekit.propagation.Propagator#addEventDetector(EventDetector) diff --git a/java_additions/src/main/java/org/orekit/python/PythonAbstractMeasurement.java b/java_additions/src/main/java/org/orekit/python/PythonAbstractMeasurement.java index 22d47c9..7af9c37 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonAbstractMeasurement.java +++ b/java_additions/src/main/java/org/orekit/python/PythonAbstractMeasurement.java @@ -5,7 +5,6 @@ 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 */ diff --git a/java_additions/src/main/java/org/orekit/python/PythonAtmosphere.java b/java_additions/src/main/java/org/orekit/python/PythonAtmosphere.java index 8d2866a..c66626c 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonAtmosphere.java +++ b/java_additions/src/main/java/org/orekit/python/PythonAtmosphere.java @@ -30,6 +30,8 @@ import org.orekit.time.FieldAbsoluteDate; public class PythonAtmosphere implements Atmosphere { + private static final long serialVersionUID = 335860944218555301L; + /** Part of JCC Python interface to object */ private long pythonObject; diff --git a/java_additions/src/main/java/org/orekit/python/PythonAtmosphericRefractionModel.java b/java_additions/src/main/java/org/orekit/python/PythonAtmosphericRefractionModel.java index 7ae3679..789a3ed 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonAtmosphericRefractionModel.java +++ b/java_additions/src/main/java/org/orekit/python/PythonAtmosphericRefractionModel.java @@ -24,6 +24,8 @@ import org.orekit.models.AtmosphericRefractionModel; public class PythonAtmosphericRefractionModel implements AtmosphericRefractionModel { + private static final long serialVersionUID = -6933430021018867767L; + /** Part of JCC Python interface to object */ private long pythonObject; diff --git a/java_additions/src/main/java/org/orekit/python/PythonAttitudeProvider.java b/java_additions/src/main/java/org/orekit/python/PythonAttitudeProvider.java index 7a812fd..367e0a7 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonAttitudeProvider.java +++ b/java_additions/src/main/java/org/orekit/python/PythonAttitudeProvider.java @@ -20,8 +20,6 @@ package org.orekit.python; -import java.io.Serializable; - import org.hipparchus.RealFieldElement; import org.orekit.attitudes.Attitude; import org.orekit.attitudes.AttitudeProvider; @@ -34,6 +32,8 @@ import org.orekit.utils.PVCoordinatesProvider; public class PythonAttitudeProvider implements AttitudeProvider { + private static final long serialVersionUID = 6448449255147110967L; + /** Part of JCC Python interface to object */ private long pythonObject; diff --git a/java_additions/src/main/java/org/orekit/python/PythonAttitudeProviderModifier.java b/java_additions/src/main/java/org/orekit/python/PythonAttitudeProviderModifier.java index cf5559c..9963a3e 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonAttitudeProviderModifier.java +++ b/java_additions/src/main/java/org/orekit/python/PythonAttitudeProviderModifier.java @@ -32,6 +32,8 @@ import org.orekit.utils.PVCoordinatesProvider; public class PythonAttitudeProviderModifier implements AttitudeProviderModifier { + private static final long serialVersionUID = 4242537148465131675L; + /** Part of JCC Python interface to object */ private long pythonObject; @@ -64,9 +66,7 @@ public class PythonAttitudeProviderModifier implements AttitudeProviderModifier * @return underlying attitude provider */ @Override - public AttitudeProvider getUnderlyingAttitudeProvider() { - return null; - } + public native AttitudeProvider getUnderlyingAttitudeProvider(); /** * Compute the attitude corresponding to an orbital state. diff --git a/java_additions/src/main/java/org/orekit/python/PythonBodyShape.java b/java_additions/src/main/java/org/orekit/python/PythonBodyShape.java index c864e88..e4286bb 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonBodyShape.java +++ b/java_additions/src/main/java/org/orekit/python/PythonBodyShape.java @@ -37,6 +37,8 @@ import org.orekit.utils.TimeStampedPVCoordinates; public class PythonBodyShape implements BodyShape { + private static final long serialVersionUID = -8332951800383544536L; + /** Part of JCC Python interface to object */ private long pythonObject; diff --git a/java_additions/src/main/java/org/orekit/python/PythonCelestialBody.java b/java_additions/src/main/java/org/orekit/python/PythonCelestialBody.java index 10cb6e5..1b16538 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonCelestialBody.java +++ b/java_additions/src/main/java/org/orekit/python/PythonCelestialBody.java @@ -31,6 +31,8 @@ import org.orekit.utils.TimeStampedPVCoordinates; public class PythonCelestialBody implements CelestialBody { + private static final long serialVersionUID = -7481310063914250761L; + /** Part of JCC Python interface to object */ private long pythonObject; @@ -58,6 +60,8 @@ public class PythonCelestialBody implements CelestialBody { /** * Get an inertially oriented, body centered frame. + * Extension point for Python. + * * <p>The frame is always bound to the body center, and its axes have a * fixed orientation with respect to other inertial frames.</p> * @@ -69,6 +73,8 @@ public class PythonCelestialBody implements CelestialBody { /** * Get a body oriented, body centered frame. + * Extension point for Python. + * * <p>The frame is always bound to the body center, and its axes have a * fixed orientation with respect to the celestial body.</p> * @@ -80,6 +86,7 @@ public class PythonCelestialBody implements CelestialBody { /** * Get the name of the body. + * Extension point for Python. * * @return name of the body */ @@ -88,6 +95,7 @@ public class PythonCelestialBody implements CelestialBody { /** * Get the attraction coefficient of the body. + * Extension point for Python. * * @return attraction coefficient of the body (m³/s²) */ @@ -96,6 +104,7 @@ public class PythonCelestialBody implements CelestialBody { /** * Convert to a {@link FieldPVCoordinatesProvider} with a specific type. + * Extension point for Python. * * @param field field for the argument and value * @return converted function @@ -105,6 +114,7 @@ public class PythonCelestialBody implements CelestialBody { /** * Get the {@link FieldPVCoordinates} of the body in the selected frame. + * Links to getFieldPVCoordinates() for Python extension * * @param date current date * @param frame the frame where to define the position @@ -117,6 +127,7 @@ public class PythonCelestialBody implements CelestialBody { /** * Get the {@link FieldPVCoordinates} of the body in the selected frame. + * Extension point for Python. Links to getPVCoordinates() * * @param date current date * @param frame the frame where to define the position @@ -127,6 +138,7 @@ public class PythonCelestialBody implements CelestialBody { /** * Get the {@link PVCoordinates} of the body in the selected frame. + * Extension point for Python. * * @param date current date * @param frame the frame where to define the position diff --git a/java_additions/src/main/java/org/orekit/python/PythonCelestialBodyLoader.java b/java_additions/src/main/java/org/orekit/python/PythonCelestialBodyLoader.java index ead5234..e766818 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonCelestialBodyLoader.java +++ b/java_additions/src/main/java/org/orekit/python/PythonCelestialBodyLoader.java @@ -51,6 +51,7 @@ public class PythonCelestialBodyLoader implements CelestialBodyLoader { /** * Load celestial body. + * Extension point for Python. * * @param name name of the celestial body * @return loaded celestial body diff --git a/java_additions/src/main/java/org/orekit/python/PythonComparableMeasurement.java b/java_additions/src/main/java/org/orekit/python/PythonComparableMeasurement.java index 7498e47..c8347f8 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonComparableMeasurement.java +++ b/java_additions/src/main/java/org/orekit/python/PythonComparableMeasurement.java @@ -64,6 +64,8 @@ public class PythonComparableMeasurement implements ComparableMeasurement { /** * {@inheritDoc} + * + * Extension point for Python. * <p> * Measurements comparison is primarily chronological, but measurements * with the same date are sorted based on the observed value. Even if they @@ -80,6 +82,7 @@ public class PythonComparableMeasurement implements ComparableMeasurement { /** * Get the date. + * Extension point for Python. * * @return date attached to the object */ diff --git a/java_additions/src/main/java/org/orekit/python/PythonCovarianceMatrixProvider.java b/java_additions/src/main/java/org/orekit/python/PythonCovarianceMatrixProvider.java index 152782b..bc28b14 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonCovarianceMatrixProvider.java +++ b/java_additions/src/main/java/org/orekit/python/PythonCovarianceMatrixProvider.java @@ -53,6 +53,7 @@ public class PythonCovarianceMatrixProvider implements CovarianceMatrixProvider /** * Get the initial covariance matrix. + * Extension point for Python. * <p> * The initial covariance matrix is a covariance matrix corresponding to the * parameters managed by the {@link KalmanEstimator Kalman estimator}. @@ -84,6 +85,8 @@ public class PythonCovarianceMatrixProvider implements CovarianceMatrixProvider /** * 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}. diff --git a/java_additions/src/main/java/org/orekit/python/PythonDTM2000InputParameters.java b/java_additions/src/main/java/org/orekit/python/PythonDTM2000InputParameters.java index 9119321..ed8dac9 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonDTM2000InputParameters.java +++ b/java_additions/src/main/java/org/orekit/python/PythonDTM2000InputParameters.java @@ -24,6 +24,8 @@ import org.orekit.time.AbsoluteDate; public class PythonDTM2000InputParameters implements DTM2000InputParameters { + private static final long serialVersionUID = -3411393378880910291L; + /** Part of JCC Python interface to object */ private long pythonObject; diff --git a/java_additions/src/main/java/org/orekit/python/PythonDataFilter.java b/java_additions/src/main/java/org/orekit/python/PythonDataFilter.java index 192ed69..c1e5efb 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonDataFilter.java +++ b/java_additions/src/main/java/org/orekit/python/PythonDataFilter.java @@ -53,6 +53,7 @@ public class PythonDataFilter implements DataFilter { /** * Filter the named data. + * Extension point for Python. * <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 diff --git a/java_additions/src/main/java/org/orekit/python/PythonDataLoader.java b/java_additions/src/main/java/org/orekit/python/PythonDataLoader.java index 9073350..3da6a00 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonDataLoader.java +++ b/java_additions/src/main/java/org/orekit/python/PythonDataLoader.java @@ -54,6 +54,7 @@ public class PythonDataLoader implements DataLoader { /** * Check if the loader still accepts new data. + * Extension point for Python. * <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. @@ -70,6 +71,7 @@ public class PythonDataLoader implements DataLoader { /** * Load data from a stream. + * Extension point for Python. * * @param input data input stream * @param name name of the file (or zip entry) diff --git a/java_additions/src/main/java/org/orekit/python/PythonDataProvider.java b/java_additions/src/main/java/org/orekit/python/PythonDataProvider.java index fba0134..4f5f47d 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonDataProvider.java +++ b/java_additions/src/main/java/org/orekit/python/PythonDataProvider.java @@ -53,6 +53,7 @@ public class PythonDataProvider implements DataProvider { /** * Feed a data file loader by browsing the data collection. + * Extension point for Python. * <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 diff --git a/java_additions/src/main/java/org/orekit/python/PythonDatesSelector.java b/java_additions/src/main/java/org/orekit/python/PythonDatesSelector.java index 95add55..1f1ffc0 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonDatesSelector.java +++ b/java_additions/src/main/java/org/orekit/python/PythonDatesSelector.java @@ -53,6 +53,7 @@ public class PythonDatesSelector implements DatesSelector { /** * Select dates within an interval. + * Extension point for Python. * <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} diff --git a/java_additions/src/main/java/org/orekit/python/PythonDiscreteTroposphericModel.java b/java_additions/src/main/java/org/orekit/python/PythonDiscreteTroposphericModel.java index 25898db..4ad47b5 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonDiscreteTroposphericModel.java +++ b/java_additions/src/main/java/org/orekit/python/PythonDiscreteTroposphericModel.java @@ -32,6 +32,8 @@ import java.util.List; public class PythonDiscreteTroposphericModel implements DiscreteTroposphericModel { + private static final long serialVersionUID = -3910892044583856313L; + /** Part of JCC Python interface to object */ private long pythonObject; @@ -60,6 +62,7 @@ public class PythonDiscreteTroposphericModel implements DiscreteTroposphericMode /** * Calculates the tropospheric path delay for the signal path from a ground * station to a satellite. + * Extension point for Python. * * @param elevation the elevation of the satellite, in radians * @param height the height of the station in m above sea level @@ -73,6 +76,7 @@ public class PythonDiscreteTroposphericModel implements DiscreteTroposphericMode /** * Calculates the tropospheric path delay for the signal path from a ground * station to a satellite. + * Redirects to pathFieldDelay(...) for Python extension * * @param elevation the elevation of the satellite, in radians * @param height the height of the station in m above sea level @@ -88,6 +92,7 @@ public class PythonDiscreteTroposphericModel implements DiscreteTroposphericMode /** * Calculates the tropospheric path delay for the signal path from a ground * station to a satellite. + * Extension point for Python. Called by pathDelay for this parameter set. * * @param elevation the elevation of the satellite, in radians * @param height the height of the station in m above sea level @@ -99,6 +104,8 @@ public class PythonDiscreteTroposphericModel implements DiscreteTroposphericMode /** + * Extension point for Python. + * * This method allows the computation of the zenith hydrostatic and * zenith wet delay. The resulting element is an array having the following form: * <ul> @@ -122,6 +129,8 @@ public class PythonDiscreteTroposphericModel implements DiscreteTroposphericMode * <li>T[1] = D<sub>wz</sub> -> zenith wet delay * </ul> * + * Calls computeFieldZenithDelay(...) for Python extension. + * * @param height the height of the station in m above sea level. * @param parameters tropospheric model parameters. * @param date current date @@ -140,6 +149,8 @@ public class PythonDiscreteTroposphericModel implements DiscreteTroposphericMode * <li>T[1] = D<sub>wz</sub> -> zenith wet delay * </ul> * + * Extension point for Python. Connected to computeZenithDelay. + * * @param height the height of the station in m above sea level. * @param parameters tropospheric model parameters. * @param date current date @@ -155,6 +166,8 @@ public class PythonDiscreteTroposphericModel implements DiscreteTroposphericMode * <li>double[1] = m<sub>w</sub>(e) -> wet mapping function * </ul> * + * Extension point for Python. + * * @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. @@ -172,6 +185,8 @@ public class PythonDiscreteTroposphericModel implements DiscreteTroposphericMode * <li>T[1] = m<sub>w</sub>(e) -> wet mapping function * </ul> * + * Calls mappingFieldFactors(...) for Python extension. + * * @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. @@ -191,6 +206,8 @@ public class PythonDiscreteTroposphericModel implements DiscreteTroposphericMode * <li>T[1] = m<sub>w</sub>(e) -> wet mapping function * </ul> * + * Extension point for Python. Connected to mappingFactor(...) + * * @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. @@ -202,6 +219,7 @@ public class PythonDiscreteTroposphericModel implements DiscreteTroposphericMode /** * Get the drivers for tropospheric model parameters. + * Extension point for Python. * * @return drivers for tropospheric model parameters */ @@ -210,6 +228,7 @@ public class PythonDiscreteTroposphericModel implements DiscreteTroposphericMode /** * Get tropospheric model parameters. + * Extension point for Python. * * @return tropospheric model parameters */ @@ -218,6 +237,7 @@ public class PythonDiscreteTroposphericModel implements DiscreteTroposphericMode /** * Get tropospheric model parameters. + * Extension point for Python. * * @param field field to which the elements belong * @return tropospheric model parameters @@ -229,6 +249,7 @@ public class PythonDiscreteTroposphericModel implements DiscreteTroposphericMode /** * Get tropospheric model parameters. + * Extension point for Python. * * @param field field to which the elements belong * @return tropospheric model parameters diff --git a/java_additions/src/main/java/org/orekit/python/PythonDragSensitive.java b/java_additions/src/main/java/org/orekit/python/PythonDragSensitive.java index 5c0d268..8280383 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonDragSensitive.java +++ b/java_additions/src/main/java/org/orekit/python/PythonDragSensitive.java @@ -60,6 +60,7 @@ public class PythonDragSensitive implements DragSensitive { /** * Get the drivers for supported parameters. + * Extension point for Python. * * @return parameters drivers * @since 8.0 @@ -69,6 +70,8 @@ public class PythonDragSensitive implements DragSensitive { /** * Compute the acceleration due to drag. + * Extension point for Python. + * * <p> * The computation includes all spacecraft specific characteristics * like shape, area and coefficients. @@ -90,6 +93,7 @@ public class PythonDragSensitive implements DragSensitive { /** * Compute the acceleration due to drag. + * Connects to dragRealFieldElementAcceleration for Python extension. * <p> * The computation includes all spacecraft specific characteristics * like shape, area and coefficients. @@ -112,11 +116,13 @@ public class PythonDragSensitive implements DragSensitive { return this.dragRealFieldElementAcceleration(date,frame, position, rotation, mass, density, relativeVelocity, parameters); } + /* Extension point for Python. Connected to dragAcceleration(...)*/ 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. + * Connects to dragFieldVector3DAcceleration for Python extension. * * @param date current date * @param frame inertial reference frame for state (both orbit and attitude) @@ -135,6 +141,7 @@ public class PythonDragSensitive implements DragSensitive { return this.dragFieldVector3DAcceleration(date,frame,position, rotation, mass, density, relativeVelocity, parameters, paramName); } + /* Extension point for Python. Connects to dragAcceleration(...) */ 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 index 8ccc0a2..f7844a7 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonEOPBasedTransformProvider.java +++ b/java_additions/src/main/java/org/orekit/python/PythonEOPBasedTransformProvider.java @@ -29,6 +29,8 @@ import org.orekit.time.FieldAbsoluteDate; public class PythonEOPBasedTransformProvider implements EOPBasedTransformProvider { + private static final long serialVersionUID = 6434996513250596254L; + /** Part of JCC Python interface to object */ private long pythonObject; @@ -60,9 +62,7 @@ public class PythonEOPBasedTransformProvider implements EOPBasedTransformProvide * @return EOP history */ @Override - public EOPHistory getEOPHistory() { - return null; - } + public native EOPHistory getEOPHistory(); /** * Get a version of the provider that does <em>not</em> cache tidal corrections. @@ -81,9 +81,7 @@ public class PythonEOPBasedTransformProvider implements EOPBasedTransformProvide * @see FramesFactory#getNonInterpolatingTransform(Frame, Frame, AbsoluteDate) */ @Override - public EOPBasedTransformProvider getNonInterpolatingProvider() { - return null; - } + public native EOPBasedTransformProvider getNonInterpolatingProvider(); /** * Get the {@link Transform} corresponding to specified date. @@ -92,9 +90,9 @@ public class PythonEOPBasedTransformProvider implements EOPBasedTransformProvide * @return transform at specified date */ @Override - public Transform getTransform(AbsoluteDate date) { - return null; - } + public native Transform getTransform(AbsoluteDate date); + + /* TODO: These methods needs to be separated */ /** * Get the {@link FieldTransform} corresponding to specified date. @@ -104,9 +102,7 @@ public class PythonEOPBasedTransformProvider implements EOPBasedTransformProvide * @since 9.0 */ @Override - public <T extends RealFieldElement<T>> FieldTransform<T> getTransform(FieldAbsoluteDate<T> date) { - return this.getFieldTransform(date); - } + public native <T extends RealFieldElement<T>> FieldTransform<T> getTransform(FieldAbsoluteDate<T> date); /** * Get the {@link FieldTransform} corresponding to specified date. diff --git a/java_additions/src/main/java/org/orekit/python/PythonEarthShape.java b/java_additions/src/main/java/org/orekit/python/PythonEarthShape.java index fecce2c..aacd309 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonEarthShape.java +++ b/java_additions/src/main/java/org/orekit/python/PythonEarthShape.java @@ -35,6 +35,8 @@ import org.orekit.utils.TimeStampedPVCoordinates; public class PythonEarthShape implements EarthShape { + private static final long serialVersionUID = -3177940928549930595L; + /** Part of JCC Python interface to object */ private long pythonObject; diff --git a/java_additions/src/main/java/org/orekit/python/PythonEventDetector.java b/java_additions/src/main/java/org/orekit/python/PythonEventDetector.java index ad61c1a..4ad6280 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonEventDetector.java +++ b/java_additions/src/main/java/org/orekit/python/PythonEventDetector.java @@ -20,7 +20,6 @@ package org.orekit.python; -import org.orekit.errors.OrekitException; import org.orekit.propagation.SpacecraftState; import org.orekit.propagation.events.EventDetector; import org.orekit.propagation.events.handlers.EventHandler.Action; diff --git a/java_additions/src/main/java/org/orekit/python/PythonFieldAdditionalEquations.java b/java_additions/src/main/java/org/orekit/python/PythonFieldAdditionalEquations.java index cc4a5f2..1a0ff9c 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonFieldAdditionalEquations.java +++ b/java_additions/src/main/java/org/orekit/python/PythonFieldAdditionalEquations.java @@ -22,11 +22,8 @@ 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. diff --git a/java_additions/src/main/java/org/orekit/python/PythonGNSSAttitudeProvider.java b/java_additions/src/main/java/org/orekit/python/PythonGNSSAttitudeProvider.java index 1c82df4..7a9f5f3 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonGNSSAttitudeProvider.java +++ b/java_additions/src/main/java/org/orekit/python/PythonGNSSAttitudeProvider.java @@ -30,6 +30,8 @@ import org.orekit.utils.FieldPVCoordinatesProvider; import org.orekit.utils.PVCoordinatesProvider; public class PythonGNSSAttitudeProvider implements GNSSAttitudeProvider { + private static final long serialVersionUID = 7166332223515373718L; + /** Part of JCC Python interface to object */ private long pythonObject; diff --git a/java_additions/src/main/java/org/orekit/python/PythonGPSOrbitalElements.java b/java_additions/src/main/java/org/orekit/python/PythonGPSOrbitalElements.java index b509fdb..63bb4ec 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonGPSOrbitalElements.java +++ b/java_additions/src/main/java/org/orekit/python/PythonGPSOrbitalElements.java @@ -55,9 +55,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the PRN number of the GPS satellite */ @Override - public int getPRN() { - return 0; - } + public native int getPRN(); /** * Gets the Reference Week of the GPS orbit. @@ -65,9 +63,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Reference Week of the GPS orbit within [0, 1024[ */ @Override - public int getWeek() { - return 0; - } + public native int getWeek(); /** * Gets the Reference Time of the GPS orbit as a duration from week start. @@ -75,9 +71,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Reference Time of the GPS orbit (s) */ @Override - public double getTime() { - return 0; - } + public native double getTime(); /** * Gets the Semi-Major Axis. @@ -85,9 +79,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Semi-Major Axis (m) */ @Override - public double getSma() { - return 0; - } + public native double getSma(); /** * Gets the Mean Motion. @@ -95,9 +87,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Mean Motion (rad/s) */ @Override - public double getMeanMotion() { - return 0; - } + public native double getMeanMotion(); /** * Gets the Eccentricity. @@ -105,9 +95,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Eccentricity */ @Override - public double getE() { - return 0; - } + public native double getE(); /** * Gets the Inclination Angle at Reference Time. @@ -115,9 +103,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Inclination Angle at Reference Time (rad) */ @Override - public double getI0() { - return 0; - } + public native double getI0(); /** * Gets the Rate of Inclination Angle. @@ -125,9 +111,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Rate of Inclination Angle (rad/s) */ @Override - public double getIDot() { - return 0; - } + public native double getIDot(); /** * Gets the Longitude of Ascending Node of Orbit Plane at Weekly Epoch. @@ -135,9 +119,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Longitude of Ascending Node of Orbit Plane at Weekly Epoch (rad) */ @Override - public double getOmega0() { - return 0; - } + public native double getOmega0(); /** * Gets the Rate of Right Ascension. @@ -145,9 +127,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Rate of Right Ascension (rad/s) */ @Override - public double getOmegaDot() { - return 0; - } + public native double getOmegaDot(); /** * Gets the Argument of Perigee. @@ -155,9 +135,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Argument of Perigee (rad) */ @Override - public double getPa() { - return 0; - } + public native double getPa(); /** * Gets the Mean Anomaly at Reference Time. @@ -165,9 +143,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Mean Anomaly at Reference Time (rad) */ @Override - public double getM0() { - return 0; - } + public native double getM0(); /** * Gets the Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude. @@ -175,9 +151,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude (rad) */ @Override - public double getCuc() { - return 0; - } + public native double getCuc(); /** * Gets the Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude. @@ -185,9 +159,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Amplitude of the Sine Harmonic Correction Term to the Argument of Latitude (rad) */ @Override - public double getCus() { - return 0; - } + public native double getCus(); /** * Gets the Amplitude of the Cosine Harmonic Correction Term to the Orbit Radius. @@ -195,9 +167,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Amplitude of the Cosine Harmonic Correction Term to the Orbit Radius (m) */ @Override - public double getCrc() { - return 0; - } + public native double getCrc(); /** * Gets the Amplitude of the Sine Harmonic Correction Term to the Orbit Radius. @@ -205,9 +175,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Amplitude of the Sine Harmonic Correction Term to the Orbit Radius (m) */ @Override - public double getCrs() { - return 0; - } + public native double getCrs(); /** * Gets the Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination. @@ -215,9 +183,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination (rad) */ @Override - public double getCic() { - return 0; - } + public native double getCic(); /** * Gets the Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination. @@ -225,9 +191,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return the Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination (rad) */ @Override - public double getCis() { - return 0; - } + public native double getCis(); /** * Gets the Issue Of Data Clock (IODC). @@ -236,9 +200,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @since 9.3 */ @Override - public int getIODC() { - return 0; - } + public native int getIODC(); /** * Gets the Issue Of Data Ephemeris (IODE). @@ -247,9 +209,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @since 9.3 */ @Override - public int getIODE() { - return 0; - } + public native int getIODE(); /** * Gets the Zeroth Order Clock Correction. @@ -261,9 +221,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @since 9.3 */ @Override - public double getAf0() { - return 0; - } + public native double getAf0(); /** * Gets the First Order Clock Correction. @@ -275,9 +233,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @since 9.3 */ @Override - public double getAf1() { - return 0; - } + public native double getAf1(); /** * Gets the Second Order Clock Correction. @@ -289,9 +245,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @since 9.3 */ @Override - public double getAf2() { - return 0; - } + public native double getAf2(); /** * Gets the clock correction reference time toc. @@ -303,9 +257,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @since 9.3 */ @Override - public double getToc() { - return 0; - } + public native double getToc(); /** * Gets the estimated group delay differential TGD for L1-L2 correction. @@ -314,9 +266,7 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @since 9.3 */ @Override - public double getTGD() { - return 0; - } + public native double getTGD(); /** * Get the date. @@ -324,7 +274,5 @@ public class PythonGPSOrbitalElements implements GPSOrbitalElements { * @return date attached to the object */ @Override - public AbsoluteDate getDate() { - return null; - } + public native AbsoluteDate getDate(); } diff --git a/java_additions/src/main/java/org/orekit/python/PythonIAUPole.java b/java_additions/src/main/java/org/orekit/python/PythonIAUPole.java index 32c588d..2145a83 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonIAUPole.java +++ b/java_additions/src/main/java/org/orekit/python/PythonIAUPole.java @@ -19,8 +19,6 @@ 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; @@ -31,6 +29,8 @@ import org.orekit.time.FieldAbsoluteDate; public class PythonIAUPole implements IAUPole { + private static final long serialVersionUID = -1083702732696194808L; + /** Part of JCC Python interface to object */ private long pythonObject; diff --git a/java_additions/src/main/java/org/orekit/python/PythonIonosphericModel.java b/java_additions/src/main/java/org/orekit/python/PythonIonosphericModel.java index 0b019fe..a1f91d7 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonIonosphericModel.java +++ b/java_additions/src/main/java/org/orekit/python/PythonIonosphericModel.java @@ -25,6 +25,8 @@ import org.orekit.time.AbsoluteDate; public class PythonIonosphericModel implements IonosphericModel { + private static final long serialVersionUID = 1716300861604915492L; + /** Part of JCC Python interface to object */ private long pythonObject; diff --git a/java_additions/src/main/java/org/orekit/python/PythonJB2008InputParameters.java b/java_additions/src/main/java/org/orekit/python/PythonJB2008InputParameters.java index 55cad3c..2f7dfdb 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonJB2008InputParameters.java +++ b/java_additions/src/main/java/org/orekit/python/PythonJB2008InputParameters.java @@ -23,6 +23,9 @@ import org.orekit.forces.drag.atmosphere.JB2008InputParameters; import org.orekit.time.AbsoluteDate; public class PythonJB2008InputParameters implements JB2008InputParameters { + + private static final long serialVersionUID = -7188821056124189596L; + /** Part of JCC Python interface to object */ private long pythonObject; @@ -54,9 +57,7 @@ public class PythonJB2008InputParameters implements JB2008InputParameters { * @return the minimum date. */ @Override - public AbsoluteDate getMinDate() { - return null; - } + public native AbsoluteDate getMinDate(); /** * Gets the available data range maximum date. diff --git a/java_additions/src/main/java/org/orekit/python/PythonMappingFunction.java b/java_additions/src/main/java/org/orekit/python/PythonMappingFunction.java index 5580889..faf3450 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonMappingFunction.java +++ b/java_additions/src/main/java/org/orekit/python/PythonMappingFunction.java @@ -30,6 +30,8 @@ import java.util.List; public class PythonMappingFunction implements MappingFunction { + private static final long serialVersionUID = -9157284216952908403L; + /** Part of JCC Python interface to object */ private long pythonObject; diff --git a/java_additions/src/main/java/org/orekit/python/PythonNRLMSISE00InputParameters.java b/java_additions/src/main/java/org/orekit/python/PythonNRLMSISE00InputParameters.java index 10300cb..69b0804 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonNRLMSISE00InputParameters.java +++ b/java_additions/src/main/java/org/orekit/python/PythonNRLMSISE00InputParameters.java @@ -23,6 +23,9 @@ import org.orekit.forces.drag.atmosphere.NRLMSISE00InputParameters; import org.orekit.time.AbsoluteDate; public class PythonNRLMSISE00InputParameters implements NRLMSISE00InputParameters { + + private static final long serialVersionUID = -2826576363359682591L; + /** Part of JCC Python interface to object */ private long pythonObject; diff --git a/java_additions/src/main/java/org/orekit/python/PythonOrekitFixedStepHandler.java b/java_additions/src/main/java/org/orekit/python/PythonOrekitFixedStepHandler.java index eedd4c8..11b9342 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonOrekitFixedStepHandler.java +++ b/java_additions/src/main/java/org/orekit/python/PythonOrekitFixedStepHandler.java @@ -21,7 +21,6 @@ package org.orekit.python; import org.orekit.propagation.sampling.OrekitFixedStepHandler; -import org.orekit.errors.OrekitException; import org.orekit.propagation.SpacecraftState; import org.orekit.time.AbsoluteDate; diff --git a/java_additions/src/main/java/org/orekit/python/PythonOrekitStepHandler.java b/java_additions/src/main/java/org/orekit/python/PythonOrekitStepHandler.java index 951bdef..d24d84c 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonOrekitStepHandler.java +++ b/java_additions/src/main/java/org/orekit/python/PythonOrekitStepHandler.java @@ -53,6 +53,7 @@ public class PythonOrekitStepHandler implements OrekitStepHandler { /** * Initialize step handler at the start of a propagation. + * Extension point for Python. * <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 @@ -66,18 +67,15 @@ public class PythonOrekitStepHandler implements OrekitStepHandler { * @param t target time for the integration */ @Override - public void init(SpacecraftState s0, AbsoluteDate t) { - - } + public native void init(SpacecraftState s0, AbsoluteDate t); /** * Handle the current step. + * Extension point for Python. * * @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) { - - } + public native 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 index 9edbe5f..91a369a 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonOrekitStepInterpolator.java +++ b/java_additions/src/main/java/org/orekit/python/PythonOrekitStepInterpolator.java @@ -52,18 +52,18 @@ public class PythonOrekitStepInterpolator implements OrekitStepInterpolator { /** * Get the state at previous grid point date. + * Extension point for Python. * * @return state at previous grid point date */ @Override - public SpacecraftState getPreviousState() { - return null; - } + public native SpacecraftState getPreviousState(); /** * Determines if the {@link #getPreviousState() previous state} is computed directly * by the integrator, or if it is calculated using {@link #getInterpolatedState(AbsoluteDate) * interpolation}. + * Extension point for Python. * * <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 @@ -73,24 +73,22 @@ public class PythonOrekitStepInterpolator implements OrekitStepInterpolator { * false if it was computed directly by the integrator. */ @Override - public boolean isPreviousStateInterpolated() { - return false; - } + public native boolean isPreviousStateInterpolated(); /** * Get the state at current grid point date. + * Extension point for Python. * * @return state at current grid point date */ @Override - public SpacecraftState getCurrentState() { - return null; - } + public native SpacecraftState getCurrentState(); /** * Determines if the {@link #getCurrentState() current state} is computed directly by * the integrator, or if it is calculated using {@link #getInterpolatedState(AbsoluteDate) * interpolation}. + * Extension point for Python. * * <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 @@ -100,9 +98,7 @@ public class PythonOrekitStepInterpolator implements OrekitStepInterpolator { * false if it was computed directly by the integrator. */ @Override - public boolean isCurrentStateInterpolated() { - return false; - } + public native boolean isCurrentStateInterpolated(); /** * Get the state at interpolated date. @@ -111,9 +107,7 @@ public class PythonOrekitStepInterpolator implements OrekitStepInterpolator { * @return state at interpolated date */ @Override - public SpacecraftState getInterpolatedState(AbsoluteDate date) { - return null; - } + public native SpacecraftState getInterpolatedState(AbsoluteDate date); /** * Check is integration direction is forward in date. @@ -121,9 +115,7 @@ public class PythonOrekitStepInterpolator implements OrekitStepInterpolator { * @return true if integration is forward in date */ @Override - public boolean isForward() { - return false; - } + public native boolean isForward(); /** * Create a new restricted version of the instance. @@ -139,7 +131,5 @@ public class PythonOrekitStepInterpolator implements OrekitStepInterpolator { * @since 9.0 */ @Override - public OrekitStepInterpolator restrictStep(SpacecraftState newPreviousState, SpacecraftState newCurrentState) { - return null; - } + public native OrekitStepInterpolator restrictStep(SpacecraftState newPreviousState, SpacecraftState newCurrentState); } diff --git a/java_additions/src/main/java/org/orekit/python/PythonPropagatorConverter.java b/java_additions/src/main/java/org/orekit/python/PythonPropagatorConverter.java index 56e03ce..1f83194 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonPropagatorConverter.java +++ b/java_additions/src/main/java/org/orekit/python/PythonPropagatorConverter.java @@ -65,9 +65,9 @@ public class PythonPropagatorConverter implements PropagatorConverter { * @return adapted propagator */ @Override - public Propagator convert(Propagator source, double timeSpan, int nbPoints, List<String> freeParameters) { - return null; - } + public native Propagator convert(Propagator source, double timeSpan, int nbPoints, List<String> freeParameters); + + /* TODO: These methods needs to be separated for Python */ /** * Convert a propagator into another one. @@ -79,9 +79,7 @@ public class PythonPropagatorConverter implements PropagatorConverter { * @return adapted propagator */ @Override - public Propagator convert(Propagator source, double timeSpan, int nbPoints, String... freeParameters) { - return null; - } + public native Propagator convert(Propagator source, double timeSpan, int nbPoints, String... freeParameters); /** * Find the propagator that minimize the mean square error for a sample of {@link SpacecraftState states}. @@ -92,9 +90,7 @@ public class PythonPropagatorConverter implements PropagatorConverter { * @return adapted propagator */ @Override - public Propagator convert(List<SpacecraftState> states, boolean positionOnly, List<String> freeParameters) { - return null; - } + public native Propagator convert(List<SpacecraftState> states, boolean positionOnly, List<String> freeParameters); /** * Find the propagator that minimize the mean square error for a sample of {@link SpacecraftState states}. @@ -105,7 +101,5 @@ public class PythonPropagatorConverter implements PropagatorConverter { * @return adapted propagator */ @Override - public Propagator convert(List<SpacecraftState> states, boolean positionOnly, String... freeParameters) { - return null; - } + public native Propagator convert(List<SpacecraftState> states, boolean positionOnly, String... freeParameters); } diff --git a/java_additions/src/main/java/org/orekit/python/PythonTimeScale.java b/java_additions/src/main/java/org/orekit/python/PythonTimeScale.java index f15290b..38c7583 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonTimeScale.java +++ b/java_additions/src/main/java/org/orekit/python/PythonTimeScale.java @@ -26,6 +26,8 @@ import org.orekit.time.TimeScale; public class PythonTimeScale implements TimeScale { + private static final long serialVersionUID = 1472684095479052858L; + /** Part of JCC Python interface to object */ private long pythonObject; diff --git a/java_additions/src/main/java/org/orekit/python/PythonTransformProvider.java b/java_additions/src/main/java/org/orekit/python/PythonTransformProvider.java index 4a1196d..4389e79 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonTransformProvider.java +++ b/java_additions/src/main/java/org/orekit/python/PythonTransformProvider.java @@ -28,6 +28,8 @@ import org.orekit.time.FieldAbsoluteDate; public class PythonTransformProvider implements TransformProvider { + private static final long serialVersionUID = 8758418222722463528L; + /** Part of JCC Python interface to object */ private long pythonObject; diff --git a/java_additions/src/main/java/org/orekit/python/PythonTroposphericModel.java b/java_additions/src/main/java/org/orekit/python/PythonTroposphericModel.java index df25d9a..cb40c1e 100644 --- a/java_additions/src/main/java/org/orekit/python/PythonTroposphericModel.java +++ b/java_additions/src/main/java/org/orekit/python/PythonTroposphericModel.java @@ -22,6 +22,9 @@ package org.orekit.python; import org.orekit.models.earth.TroposphericModel; public class PythonTroposphericModel implements TroposphericModel { + + private static final long serialVersionUID = 9108275770987643642L; + /** Part of JCC Python interface to object */ private long pythonObject; diff --git a/python_files/test/AdditionalEquationsTest.py b/python_files/test/AdditionalEquationsTest.py index 8bb06fb..b6d6cf8 100644 --- a/python_files/test/AdditionalEquationsTest.py +++ b/python_files/test/AdditionalEquationsTest.py @@ -37,6 +37,7 @@ 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 java.lang import System from org.hipparchus.geometry.euclidean.threed import Vector3D @@ -90,7 +91,7 @@ class AdditionalEquationsTest(unittest.TestCase): crawler = ZipJarCrawler(datafile) DM.clearProviders() DM.addProvider(crawler) - DataProvidersManager.OREKIT_DATA_PATH = 'potential/shm-format' + System.setProperty(DataProvidersManager.OREKIT_DATA_PATH, 'potential/shm-format') GravityFieldFactory.addPotentialCoefficientsReader(SHMFormatReader("^eigen_cg03c_coef$", False)) mu = GravityFieldFactory.getUnnormalizedProvider(0, 0).getMu() diff --git a/python_files/test/FieldAdditionalEquationsTest.py b/python_files/test/FieldAdditionalEquationsTest.py index a5c6ca9..17660c4 100644 --- a/python_files/test/FieldAdditionalEquationsTest.py +++ b/python_files/test/FieldAdditionalEquationsTest.py @@ -37,6 +37,7 @@ 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 java.lang import System from org.hipparchus.geometry.euclidean.threed import Vector3D @@ -98,7 +99,7 @@ class FieldAdditionalEquationsTest(unittest.TestCase): crawler = ZipJarCrawler(datafile) DM.clearProviders() DM.addProvider(crawler) - DataProvidersManager.OREKIT_DATA_PATH = 'potential/shm-format' + System.setProperty(DataProvidersManager.OREKIT_DATA_PATH, 'potential/shm-format') GravityFieldFactory.addPotentialCoefficientsReader(SHMFormatReader("^eigen_cg03c_coef$", False)) mu = GravityFieldFactory.getUnnormalizedProvider(0, 0).getMu() diff --git a/python_files/test/OrekitStepHandlerTest.py b/python_files/test/OrekitStepHandlerTest.py new file mode 100644 index 0000000..be8f20d --- /dev/null +++ b/python_files/test/OrekitStepHandlerTest.py @@ -0,0 +1,187 @@ +# -*- coding: utf-8 -*- + +""" +/* 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. + */ + +Python version translated from Java by Petrus Hyvönen, SSC 2019 +""" + +import sys +import unittest +from collections import deque + +import orekit +orekit.initVM() + +#package org.orekit.propagation.sampling + +#import static org.junit.Assert.assertEquals +#import static org.junit.Assert.assertNotNull +#import static org.junit.Assert.assertTrue + +from org.orekit.data import DataProvidersManager, ZipJarCrawler +from java.io import File + +#from java.util import ArrayDeque +from java.util import Arrays +from java.util import Queue +#from java.util.concurrent.Callable +#from java.util.concurrent.ExecutionException +#from java.util.concurrent.ExecutorService +#from java.util.concurrent import Executors +#from java.util.concurrent.Future + +from org.hipparchus.ode.nonstiff import ClassicalRungeKuttaIntegrator +from org.hipparchus.util import FastMath +#from org.junit.Before +#from org.junit.Test +#from org.orekit import Utils +from org.orekit.bodies import CelestialBodyFactory +from org.orekit.frames import FactoryManagedFrame +from org.orekit.frames import Frame +from org.orekit.frames import FramesFactory +from org.orekit.orbits import KeplerianOrbit +from org.orekit.orbits import OrbitType +from org.orekit.orbits import PositionAngle +from org.orekit.propagation import Propagator +from org.orekit.propagation import SpacecraftState +from org.orekit.propagation.analytical import KeplerianPropagator +from org.orekit.propagation.events import DateDetector +from org.orekit.propagation.events.handlers import ContinueOnEvent +from org.orekit.propagation.numerical import NumericalPropagator +from org.orekit.time import AbsoluteDate +from org.orekit.time import TimeScalesFactory +from org.orekit.utils import Constants +from org.orekit.python import PythonOrekitStepHandler + +class OrekitStepHandlerTest(unittest.TestCase): + # + # def testForwardBackwardStep(): + # initialDate = AbsoluteDate(2014, 01, 01, 00, 00, + # 00.000, + # TimeScalesFactory.getUTC()) + # + # mu = CelestialBodyFactory.getEarth().getGM() + # inertialFrame = FramesFactory.getEME2000() + # + # propagationTime = 7200.0 # seconds + # fixedStepSize = 3600 # seconds + # + # semimajorAxis = 8000e3 # meters + # eccentricity = 0.001 # unitless + # inclination = FastMath.toRadians(15.0) + # argPerigee = FastMath.toRadians(10.0) + # raan = FastMath.toRadians(45.0) + # trueAnomaly = FastMath.toRadians(10.0) + # + # initialOrbit = KeplerianOrbit(semimajorAxis, + # eccentricity, + # inclination, + # argPerigee, raan, + # trueAnomaly, + # PositionAngle.TRUE, + # inertialFrame, + # initialDate, mu) + # + # kepler = KeplerianPropagator(initialOrbit) + # + # class MyHandler(PythonOrekitStepHandler): + # def init(self): # All native defined calls needs to be implemented + # pass + # + # def handleStep(self, currentState, isLast): + # pass + # + # kepler.setMasterMode(fixedStepSize, MyHandler()) + # + # kepler.propagate(initialDate.shiftedBy(propagationTime)) + # + # stepSizeInSeconds = 120 + # longestWaitTimeMS = 20 + # service = Executors.ingleThreadExecutor() + # for (elapsedTime = 0 elapsedTime <= propagationTime elapsedTime += stepSizeInSeconds) { + # final double dt = elapsedTime + # Future<SpacecraftState> stateFuture = service + # .submit(Callable<SpacecraftState>() { + # + # public SpacecraftState call() + # { + # return kepler.propagate(initialDate.shiftedBy(dt)) + # } + # }) + # + # Thread.sleep(longestWaitTimeMS) + # assertTrue(stateFuture.isDone()) + # SpacecraftState finalState = stateFuture.get() + # assertNotNull(finalState) + # } + # } + + # /** + # * Check {@link OrekitStepInterpolator#isPreviousStateInterpolated()} and {@link + # * OrekitStepInterpolator#isCurrentStateInterpolated()}. + # */ + + + def testIsInterpolated(self): + # setup + propagator = NumericalPropagator(ClassicalRungeKuttaIntegrator(60.0)) + date = AbsoluteDate.J2000_EPOCH + eci = FramesFactory.getGCRF() + ic = SpacecraftState(KeplerianOrbit(6378137 + 500e3, 1e-3, 0.0, 0.0, 0.0, 0.0, + PositionAngle.TRUE, eci, date, Constants.EIGEN5C_EARTH_MU)) + propagator.setInitialState(ic) + propagator.setOrbitType(OrbitType.CARTESIAN) + # detector triggers half way through second step + detector = DateDetector(date.shiftedBy(90.0)).withHandler(ContinueOnEvent()) + propagator.addEventDetector(detector) + + expected = deque([False, False, False, True, True, False]) + + class MyHandler(PythonOrekitStepHandler): + # All methods in an interface needs to be specified, even if no action is done. + def init(self, s0, t): + pass + + def handleStep(self, interpolator, isLast): + assert(expected.popleft() == interpolator.isPreviousStateInterpolated()) + assert(expected.popleft() == interpolator.isCurrentStateInterpolated()) + + propagator.setMasterMode(MyHandler()) + end = date.shiftedBy(120.0) + prop_end = propagator.propagate(end) + self.assertEqual(end, prop_end.getDate()) + print('testIsInterpolated OK') + + def setUp(self): + # Utils.setDataRoot("regular-data") + + 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) + + +if __name__ == '__main__': + suite = unittest.TestLoader().loadTestsFromTestCase(OrekitStepHandlerTest) + 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 index 95c3045..60bcb40 100644 --- a/python_files/test/SpinStabilizedTest.py +++ b/python_files/test/SpinStabilizedTest.py @@ -81,7 +81,7 @@ class SpinStabilizedTest(unittest.TestCase): Vector3D.PLUS_I, Vector3D.PLUS_K) bbq = SpinStabilized(cbp, date, Vector3D.PLUS_K, rate) - pv: Vector3D = PVCoordinates(Vector3D(28812595.32012577, 5948437.4640250085, 0.0), + pv = PVCoordinates(Vector3D(28812595.32012577, 5948437.4640250085, 0.0), Vector3D(0.0, 0.0, 3680.853673522056)) kep = KeplerianOrbit(pv, FramesFactory.getEME2000(), date, 3.986004415e14) -- GitLab