From d26ec958fef8aa4e593ecf6d27d3b0cabbd3e751 Mon Sep 17 00:00:00 2001 From: unknown <PHY@R9E3HFB.ssc.internal> Date: Mon, 12 May 2014 19:35:37 +0200 Subject: [PATCH] Added the java classes for the python wrapper --- INSTALL.txt | 35 ++++ .../orekit/python/PythonAbstractDetector.java | 94 ++++++++++ .../python/PythonAlignmentDetector.java | 115 +++++++++++++ .../orekit/python/PythonAltitudeDetector.java | 128 ++++++++++++++ .../orekit/python/PythonApsideDetector.java | 110 ++++++++++++ .../PythonCircularFieldOfViewDetector.java | 102 +++++++++++ .../org/orekit/python/PythonDateDetector.java | 113 ++++++++++++ .../PythonDihedralFieldOfViewDetector.java | 110 ++++++++++++ .../orekit/python/PythonEclipseDetector.java | 147 ++++++++++++++++ .../python/PythonElevationDetector.java | 162 ++++++++++++++++++ .../orekit/python/PythonEventDetector.java | 107 ++++++++++++ .../org/orekit/python/PythonEventHandler.java | 115 +++++++++++++ .../org/orekit/python/PythonNodeDetector.java | 110 ++++++++++++ .../python/PythonOrekitFixedStepHandler.java | 85 +++++++++ .../python/PythonUnivariateFunction.java | 72 ++++++++ .../java/org/orekit/python/package-info.java | 32 ++++ 16 files changed, 1637 insertions(+) create mode 100644 INSTALL.txt create mode 100644 orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonAbstractDetector.java create mode 100644 orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonAlignmentDetector.java create mode 100644 orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonAltitudeDetector.java create mode 100644 orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonApsideDetector.java create mode 100644 orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonCircularFieldOfViewDetector.java create mode 100644 orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonDateDetector.java create mode 100644 orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonDihedralFieldOfViewDetector.java create mode 100644 orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonEclipseDetector.java create mode 100644 orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonElevationDetector.java create mode 100644 orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonEventDetector.java create mode 100644 orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonEventHandler.java create mode 100644 orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonNodeDetector.java create mode 100644 orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonOrekitFixedStepHandler.java create mode 100644 orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonUnivariateFunction.java create mode 100644 orekit-6.1-java-wrappers/src/main/java/org/orekit/python/package-info.java diff --git a/INSTALL.txt b/INSTALL.txt new file mode 100644 index 0000000..a587eb4 --- /dev/null +++ b/INSTALL.txt @@ -0,0 +1,35 @@ +INSTALLATION + +The python orekit wrapper requires: +- a python 2.X installation +- The JCC tool http://lucene.apache.org/pylucene/jcc/ +- a java JDK + + +Hints: +One common failure is that the JCC package cannot reach the java virtual machine. +The location varies on different platforms and on different java versions. + +Mint Linux +---------- +for open-jdk it seems that the libjvm.so is not added to the library path by itself. +Add the path to libjvm.so to a file in /etc/ld.conf.d/ such as java.conf +such as: + + /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server + +then run sudo ldconfig +check if it is there by: ldconfig -p | grep jvm + +you might need to set the enviroment variable JCC_JDK. Example: + + export JCC_JDK=/usr/lib/jvm/java-7-openjdk-amd64 + +Windows +------- +Needs to set the variable JCC_JDK and include java items in the PATH. Example: + + set JCC_JDK=C:\Program Files (x86)\Java\jdk1.6.0_35 + set PATH=%JCC_JDK%\jre\bin\client;%JCC_JDK%\bin;%JCC_JDK%\lib;%PATH% + +These can be etiher set in a bat file or directly in the computer environment variable dialog in windows. diff --git a/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonAbstractDetector.java b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonAbstractDetector.java new file mode 100644 index 0000000..03ec023 --- /dev/null +++ b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonAbstractDetector.java @@ -0,0 +1,94 @@ +/** Copyright 2014 SSC and 2002-2014 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 and is largely a derived work from the +// original file AbstractDetector.java created by CS Systèmes d'Information + +package org.orekit.python; + +import org.orekit.errors.OrekitException; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.events.AbstractDetector; +import org.orekit.time.AbsoluteDate; + +/** Common parts shared by several orbital events finders. + * @see org.orekit.propagation.Propagator#addEventDetector(EventDetector) + * @author Luc Maisonobe + */ +public abstract class PythonAbstractDetector extends AbstractDetector { + + /** Serializable UID. */ + private static final long serialVersionUID = -334171965326514174L; + + 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 maxCheck maximum checking interval (s) + * @param threshold convergence threshold (s) + * @param maxIter maximum number of iterations in the event time search + */ + public PythonAbstractDetector(final double maxCheck, final double threshold, final int maxIter) { + super(maxCheck, threshold, maxIter); + } + + /** Build a new instance. + * @param maxCheck maximum checking interval (s) + * @param threshold convergence threshold (s) + */ + public PythonAbstractDetector(final double maxCheck, final double threshold) { + super(maxCheck, threshold); + } + + /** {@inheritDoc} */ + public native void init(final SpacecraftState s0, final AbsoluteDate t); + + /** {@inheritDoc} */ + public native double g(SpacecraftState s) throws OrekitException; + + /** {@inheritDoc} */ + public native double getMaxCheckInterval(); + + /** {@inheritDoc} */ + public native int getMaxIterationCount(); + + /** {@inheritDoc} */ + public native double getThreshold(); + +} diff --git a/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonAlignmentDetector.java b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonAlignmentDetector.java new file mode 100644 index 0000000..5df244f --- /dev/null +++ b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonAlignmentDetector.java @@ -0,0 +1,115 @@ +/** Copyright 2002-2012 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 and is largely a derived work from the +// original file AlignmentDetector.java created by CS Systèmes d'Information + +package org.orekit.python; + +import org.orekit.propagation.events.AlignmentDetector; +import org.orekit.orbits.Orbit; +import org.orekit.propagation.SpacecraftState; +import org.orekit.utils.PVCoordinatesProvider; +import org.orekit.errors.OrekitException; + + +/** Finder for satellite/body alignment events. + * <p>This class finds alignment events.</p> + * <p>Alignment means the conjunction, with some threshold angle, between the satellite + * position and the projection in the orbital plane of some body position.</p> + * <p>The default implementation behavior is to {@link EventDetector.Action#STOP stop} propagation when + * alignment is reached. This can be changed by overriding the + * {@link #eventOccurred(SpacecraftState, boolean) eventOccurred} method in a + * derived class.</p> + * @see org.orekit.propagation.Propagator#addEventDetector(EventDetector) + * @author Pascal Parraud + */ +public class PythonAlignmentDetector extends AlignmentDetector { + + /** Serializable UID. */ + private static final long serialVersionUID = -5512125598111644915L; + + /** 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(); + + /* Below this is specific class stuff */ + + + /** Build a new alignment detector. + * <p>The orbit is used only to set an upper bound for the max check interval + * to period/3 and to set the convergence threshold according to orbit size.</p> + * @param orbit initial orbit + * @param body the body to align + * @param alignAngle the alignment angle (rad) + */ + public PythonAlignmentDetector(final Orbit orbit, + final PVCoordinatesProvider body, + final double alignAngle) { + super(orbit, body, alignAngle); + } + + /** Build a new alignment detector. + * <p>The orbit is used only to set an upper bound for the max check interval + * to period/3.</p> + * @param threshold convergence threshold (s) + * @param orbit initial orbit + * @param body the body to align + * @param alignAngle the alignment angle (rad) + */ + public PythonAlignmentDetector(final double threshold, + final Orbit orbit, + final PVCoordinatesProvider body, + final double alignAngle) { + super(threshold, orbit, body, alignAngle); + } + + /** Handle an alignment event and choose what to do next. + * <p>The default implementation behavior is to {@link EventDetector.Action#STOP stop} propagation + * when alignment is reached.</p> + * @param s the current state information : date, kinematics, attitude + * @param increasing if true, the value of the switching function increases + * when times increases around event. + * @return {@link EventDetector.Action#STOP} or {@link EventDetector.Action#CONTINUE} + * @exception OrekitException if some specific error occurs + */ + public native Action eventOccurred(final SpacecraftState s, final boolean increasing) + throws OrekitException; + + +} diff --git a/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonAltitudeDetector.java b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonAltitudeDetector.java new file mode 100644 index 0000000..ff9ee9d --- /dev/null +++ b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonAltitudeDetector.java @@ -0,0 +1,128 @@ +/** Copyright 2002-2012 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 and is largely a derived work from the +// original file AltitudeDetector.java created by CS Systèmes d'Information + +package org.orekit.python; + +import org.orekit.bodies.BodyShape; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.events.AltitudeDetector; +import org.orekit.errors.OrekitException; + +/** Finder for satellite altitude crossing events. + * <p>This class finds altitude events (i.e. satellite crossing + * a predefined altitude level above ground).</p> + * <p>The default implementation behavior is to {@link + * EventDetector.Action#CONTINUE continue} propagation when ascending and to + * {@link EventDetector.Action#STOP stop} propagation + * when descending. This can be changed by overriding the + * {@link #eventOccurred(SpacecraftState, boolean) eventOccurred} method in a + * derived class.</p> + * @see org.orekit.propagation.Propagator#addEventDetector(EventDetector) + * @author Luc Maisonobe + */ +public class PythonAltitudeDetector extends AltitudeDetector { + + /** Serializable UID. */ + private static final long serialVersionUID = -1552109617025755015L; + + /** 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(); + + /* Below this class specifics */ + + /** Build a new altitude detector. + * <p>This simple constructor takes default values for maximal checking + * interval ({@link #DEFAULT_MAXCHECK}) and convergence threshold + * ({@link #DEFAULT_THRESHOLD}).</p> + * @param altitude threshold altitude value + * @param bodyShape body shape with respect to which altitude should be evaluated + */ + public PythonAltitudeDetector(final double altitude, final BodyShape bodyShape) { + super(altitude, bodyShape); + } + + /** Build a new altitude detector. + * <p>This simple constructor takes default value for convergence threshold + * ({@link #DEFAULT_THRESHOLD}).</p> + * <p>The maximal interval between altitude checks should + * be smaller than the half duration of the minimal pass to handle, + * otherwise some short passes could be missed.</p> + * @param maxCheck maximal checking interval (s) + * @param altitude threshold altitude value (m) + * @param bodyShape body shape with respect to which altitude should be evaluated + */ + public PythonAltitudeDetector(final double maxCheck, + final double altitude, + final BodyShape bodyShape) { + super(maxCheck, altitude, bodyShape); + } + + /** Build a new altitude detector. + * <p>The maximal interval between altitude checks should + * be smaller than the half duration of the minimal pass to handle, + * otherwise some short passes could be missed.</p> + * @param maxCheck maximal checking interval (s) + * @param threshold convergence threshold (s) + * @param altitude threshold altitude value (m) + * @param bodyShape body shape with respect to which altitude should be evaluated + */ + public PythonAltitudeDetector(final double maxCheck, + final double threshold, + final double altitude, + final BodyShape bodyShape) { + super(maxCheck, threshold, altitude, bodyShape); + } + + /** Handle an altitude event and choose what to do next. + * <p>The default implementation behavior is to {@link + * EventDetector.Action#CONTINUE continue} propagation when ascending and to + * {@link EventDetector.Action#STOP stop} propagationwhen descending.</p> + * @param s the current state information : date, kinematics, attitude + * @param increasing if true, the value of the switching function increases + * when times increases around event + * @return {@link EventDetector.Action#STOP} or {@link EventDetector.Action#CONTINUE} + * @exception OrekitException if some specific error occurs + */ + public native Action eventOccurred(final SpacecraftState s, final boolean increasing) + throws OrekitException; + +} diff --git a/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonApsideDetector.java b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonApsideDetector.java new file mode 100644 index 0000000..77bde42 --- /dev/null +++ b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonApsideDetector.java @@ -0,0 +1,110 @@ +/** Copyright 2002-2012 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 and is largely a derived work from the +// original file ApsideDetector.java created by CS Systèmes d'Information + +package org.orekit.python; +import org.orekit.orbits.Orbit; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.events.ApsideDetector; +import org.orekit.errors.OrekitException; + +/** Finder for apside crossing events. + * <p>This class finds apside crossing events (i.e. apogee or perigee crossing).</p> + * <p>The default implementation behavior is to {@link + * EventDetector.Action#CONTINUE continue} propagation at apogee crossing + * and to {@link EventDetector.Action#STOP stop} propagation + * at perigee crossing. This can be changed by overriding the + * {@link #eventOccurred(SpacecraftState, boolean) eventOccurred} method in a + * derived class.</p> + * <p>Beware that apside detection will fail for almost circular orbits. If + * for example an apside detector is used to trigger an {@link + * org.orekit.forces.maneuvers.ImpulseManeuver ImpulseManeuver} and the maneuver + * change the orbit shape to circular, then the detector may completely fail just + * after the maneuver has been performed!</p> + * @see org.orekit.propagation.Propagator#addEventDetector(EventDetector) + * @author Luc Maisonobe + */ + +public class PythonApsideDetector extends ApsideDetector { + + /** Serializable UID. */ + private static final long serialVersionUID = -7542434866922384844L; + + /** 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 orbit is used only to set an upper bound for the + * max check interval to period/3 and to set the convergence + * threshold according to orbit size</p> + * @param orbit initial orbit + */ + public PythonApsideDetector(final Orbit orbit) { + super(orbit); + } + + /** Build a new instance. + * <p>The orbit is used only to set an upper bound for the + * max check interval to period/3</p> + * @param threshold convergence threshold (s) + * @param orbit initial orbit + */ + public PythonApsideDetector(final double threshold, final Orbit orbit) { + super(threshold, orbit); + } + + /** Handle an apside crossing event and choose what to do next. + * <p>The default implementation behavior is to {@link + * EventDetector.Action#CONTINUE continue} propagation at apogee + * crossing and to {@link EventDetector.Action#STOP stop} propagation + * at perigee crossing.</p> + * @param s the current state information : date, kinematics, attitude + * @param increasing if true, the value of the switching function increases + * when times increases around event. + * @return {@link EventDetector.Action#STOP} or {@link EventDetector.Action#CONTINUE} + * @exception OrekitException if some specific error occurs + */ + public native Action eventOccurred(final SpacecraftState s, final boolean increasing) + throws OrekitException; + + +} diff --git a/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonCircularFieldOfViewDetector.java b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonCircularFieldOfViewDetector.java new file mode 100644 index 0000000..c9ae305 --- /dev/null +++ b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonCircularFieldOfViewDetector.java @@ -0,0 +1,102 @@ +/** Copyright 2002-2012 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 and is largely a derived work from the +// original file CircularFieldOfViewDetector.java created by CS Systèmes d'Information + +package org.orekit.python; + +import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.events.CircularFieldOfViewDetector; +import org.orekit.utils.PVCoordinatesProvider; +import org.orekit.errors.OrekitException; + +/** Finder for target entry/exit events with respect to a satellite sensor field of view. + * <p>This class handle fields of view with a circular boundary.</p> + * <p>The default implementation behavior is to {@link + * EventDetector.Action#CONTINUE continue} propagation at fov entry and to + * {@link EventDetector.Action#STOP stop} propagation + * at fov exit. This can be changed by overriding the + * {@link #eventOccurred(SpacecraftState, boolean) eventOccurred} method in a + * derived class.</p> + * @see org.orekit.propagation.Propagator#addEventDetector(EventDetector) + * @see DihedralFieldOfViewDetector + * @author Véronique Pommier-Maurussane + */ +public class PythonCircularFieldOfViewDetector extends CircularFieldOfViewDetector { + + /** Serializable UID. */ + private static final long serialVersionUID = 4571340030201230951L; + + /** 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 maximal interval between distance to fov boundary checks should + * be smaller than the half duration of the minimal pass to handle, + * otherwise some short passes could be missed.</p> + * @param maxCheck maximal interval in seconds + * @param pvTarget Position/velocity provider of the considered target + * @param center Direction of the fov center, in spacecraft frame + * @param halfAperture Fov half aperture angle + */ + public PythonCircularFieldOfViewDetector(final double maxCheck, + final PVCoordinatesProvider pvTarget, final Vector3D center, final double halfAperture) { + super(maxCheck, pvTarget, center, halfAperture); + } + + /** Handle an fov event and choose what to do next. + * <p>The default implementation behavior is to {@link + * EventDetector.Action#CONTINUE continue} propagation at entry and to + * {@link EventDetector.Action#STOP stop} propagation at exit. This can + * be changed by overriding the {@link #eventOccurred(SpacecraftState, boolean) + * eventOccurred} method in a derived class.</p> + * @param s the current state information : date, kinematics, attitude + * @param increasing if true, the value of the switching function increases + * when times increases around event, i.e. target enters the fov (note that increase + * is measured with respect to physical time, not with respect to propagation which + * may go backward in time) + * @return one of {@link EventDetector.Action#STOP}, {@link EventDetector.Action#RESET_STATE}, + * {@link EventDetector.Action#RESET_DERIVATIVES} or {@link EventDetector.Action#CONTINUE} + * @exception OrekitException if some specific error occurs + */ + public native Action eventOccurred(final SpacecraftState s, final boolean increasing) + throws OrekitException; +} diff --git a/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonDateDetector.java b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonDateDetector.java new file mode 100644 index 0000000..794a0ab --- /dev/null +++ b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonDateDetector.java @@ -0,0 +1,113 @@ +/** Copyright 2002-2012 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 and is largely a derived work from the +// original file DateDetector.java created by CS Systèmes d'Information + +package org.orekit.python; + +import org.orekit.propagation.events.DateDetector; +import org.orekit.propagation.events.EventDetector; +import org.orekit.propagation.events.handlers.EventHandler; +import org.orekit.time.AbsoluteDate; +import org.orekit.time.TimeStamped; +import org.orekit.errors.OrekitException; +import org.orekit.propagation.SpacecraftState; + + +/** Finder for date events. + * <p>This class finds date events (i.e. occurrence of some predefined dates).</p> + * <p>As of version 5.1, it is an enhanced date detector:</p> + * <ul> + * <li>it can be defined without prior date ({@link #DateDetector(double, double, TimeStamped...)})</li> + * <li>several dates can be added ({@link #addEventDate(AbsoluteDate)})</li> + * </ul> + * <p>The gap between the added dates must be more than the maxCheck.</p> + * <p>The default implementation behavior is to {@link + * org.orekit.propagation.events.handlers.EventHandler.Action#STOP stop} + * propagation at the first event date occurrence. This can be changed by calling + * {@link #withHandler(EventHandler)} after construction.</p> + * @see org.orekit.propagation.Propagator#addEventDetector(EventDetector) + * @author Luc Maisonobe + * @author Pascal Parraud + */ +public class PythonDateDetector extends DateDetector { + + /** Serializable UID. */ + private static final long serialVersionUID = -334171965326514174L; + + /** 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>First event dates are set here, but others can be + * added later with {@link #addEventDate(AbsoluteDate)}.</p> + * @param maxCheck maximum checking interval (s) + * @param threshold convergence threshold (s) + * @param dates list of event dates + * @see #addEventDate(AbsoluteDate) + */ + public PythonDateDetector(final double maxCheck, final double threshold, final TimeStamped ... dates) { + super(maxCheck, threshold, dates); + } + + + /** Build a new instance. + * <p>This constructor is dedicated to single date detection. + * {@link #getMaxCheckInterval() max check interval} is set to 1.0e10, so almost + * no other date can be added. Tolerance is set to 1.0e-9.</p> + * @param target target date + * @see #addEventDate(AbsoluteDate) + */ + public PythonDateDetector(final AbsoluteDate target) { + super(target); + } + + /** Handle a date event and choose what to do next. + * <p>The default implementation behavior is to {@link + * EventDetector.Action#STOP stop} propagation at date occurrence.</p> + * @param s the current state information : date, kinematics, attitude + * @param increasing the way of the switching function is not guaranted + * as it can change according to the added event dates. + * @return {@link EventDetector.Action#STOP} + * @exception OrekitException if some specific error occurs + */ + public native Action eventOccurred(final SpacecraftState s, final boolean increasing) + throws OrekitException; +} diff --git a/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonDihedralFieldOfViewDetector.java b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonDihedralFieldOfViewDetector.java new file mode 100644 index 0000000..8ac0729 --- /dev/null +++ b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonDihedralFieldOfViewDetector.java @@ -0,0 +1,110 @@ +/** Copyright 2002-2012 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 and is largely a derived work from the +// original file DihedralFieldOfViewDetector.java created by CS Systèmes d'Information + +package org.orekit.python; + +import org.apache.commons.math3.geometry.euclidean.threed.Vector3D; +import org.orekit.propagation.events.CircularFieldOfViewDetector; +import org.orekit.propagation.events.DihedralFieldOfViewDetector; +import org.orekit.propagation.events.EventDetector; +import org.orekit.propagation.events.handlers.EventHandler; +import org.orekit.utils.PVCoordinatesProvider; +import org.orekit.errors.OrekitException; +import org.orekit.propagation.SpacecraftState; + +/** Finder for body entering/exiting dihedral FOV events. + * <p>This class finds dihedral field of view events (i.e. body entry and exit in FOV).</p> + * <p>The default implementation behavior is to {@link + * org.orekit.propagation.events.handlers.EventHandler.Action#CONTINUE continue} + * propagation at entry and to {@link + * org.orekit.propagation.events.handlers.EventHandler.Action#STOP stop} propagation + * at exit. This can be changed by calling + * {@link #withHandler(EventHandler)} after construction.</p> + * @see org.orekit.propagation.Propagator#addEventDetector(EventDetector) + * @see CircularFieldOfViewDetector + * @author Véronique Pommier-Maurussane + */ +public class PythonDihedralFieldOfViewDetector extends DihedralFieldOfViewDetector { + + /** Serializable UID. */ + private static final long serialVersionUID = 4571340030201230951L; + + /** 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 maximal interval between distance to FOV boundary checks should + * be smaller than the half duration of the minimal pass to handle, + * otherwise some short passes could be missed.</p> + * @param maxCheck maximal interval in seconds + * @param pvTarget Position/velocity provider of the considered target + * @param center Direction of the FOV center + * @param axis1 FOV dihedral axis 1 + * @param halfAperture1 FOV dihedral half aperture angle 1 + * @param axis2 FOV dihedral axis 2 + * @param halfAperture2 FOV dihedral half aperture angle 2 + */ + public PythonDihedralFieldOfViewDetector(final double maxCheck, + final PVCoordinatesProvider pvTarget, final Vector3D center, final Vector3D axis1, final double halfAperture1, + final Vector3D axis2, final double halfAperture2) { + super(maxCheck, pvTarget, center, axis1, halfAperture1, axis2, halfAperture2); + } + + /** Handle an fov event and choose what to do next. + * <p>The default implementation behavior is to {@link + * EventDetector.Action#CONTINUE continue} propagation at entry and to + * {@link EventDetector.Action#STOP stop} propagation at exit. This can + * be changed by overriding the {@link #eventOccurred(SpacecraftState, boolean) + * eventOccurred} method in a derived class.</p> + * @param s the current state information : date, kinematics, attitude + * @param increasing if true, the value of the switching function increases + * when times increases around event, i.e. target enters the fov (note that increase + * is measured with respect to physical time, not with respect to propagation which + * may go backward in time) + * @return one of {@link EventDetector.Action#STOP}, {@link EventDetector.Action#RESET_STATE}, + * {@link EventDetector.Action#RESET_DERIVATIVES} or {@link EventDetector.Action#CONTINUE} + * @exception OrekitException if some specific error occurs + */ + public native Action eventOccurred(final SpacecraftState s, final boolean increasing) + throws OrekitException; + +} diff --git a/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonEclipseDetector.java b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonEclipseDetector.java new file mode 100644 index 0000000..e86edd8 --- /dev/null +++ b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonEclipseDetector.java @@ -0,0 +1,147 @@ +/** Copyright 2014 SSC and 2002-2014 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 and is largely a derived work from the +// original file EclipseDetector.java created by CS Systèmes d'Information + +package org.orekit.python; + +import org.orekit.utils.PVCoordinatesProvider; +import org.orekit.propagation.events.EclipseDetector; +import org.orekit.propagation.events.EventDetector; +import org.orekit.propagation.events.handlers.EventHandler; +import org.orekit.errors.OrekitException; +import org.orekit.propagation.SpacecraftState; + + +/** Finder for satellite eclipse related events. + * <p>This class finds eclipse events, i.e. satellite within umbra (total + * eclipse) or penumbra (partial eclipse).</p> + * <p>The default implementation behavior is to {@link + * org.orekit.propagation.events.handlers.EventHandler.Action#CONTINUE continue} + * propagation when entering the eclipse and to {@link + * org.orekit.propagation.events.handlers.EventHandler.Action#STOP stop} propagation + * when exiting the eclipse. This can be changed by calling {@link + * #withHandler(EventHandler)} after construction.</p> + * @see org.orekit.propagation.Propagator#addEventDetector(EventDetector) + * @author Pascal Parraud + */ +public class PythonEclipseDetector extends EclipseDetector +{ + + private 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(); + + /** Build a new eclipse detector. + * <p>The new instance is a total eclipse (umbra) detector with default + * values for maximal checking interval ({@link #DEFAULT_MAXCHECK}) + * and convergence threshold ({@link #DEFAULT_THRESHOLD}).</p> + * @param occulted the body to be occulted + * @param occultedRadius the radius of the body to be occulted (m) + * @param occulting the occulting body + * @param occultingRadius the occulting body radius (m) + */ + public PythonEclipseDetector(final PVCoordinatesProvider occulted, + final double occultedRadius, + final PVCoordinatesProvider occulting, + final double occultingRadius) + { + super(occulted, occultedRadius, occulting, occultingRadius); + } + + /** Build a new eclipse detector. + * <p>The new instance is a total eclipse (umbra) detector with default + * value for convergence threshold ({@link #DEFAULT_THRESHOLD}).</p> + * <p>The maximal interval between eclipse checks should be smaller than + * the half duration of the minimal pass to handle, otherwise some short + * passes could be missed.</p> + * @param maxCheck maximal checking interval (s) + * @param occulted the body to be occulted + * @param occultedRadius the radius of the body to be occulted in meters + * @param occulting the occulting body + * @param occultingRadius the occulting body radius in meters + */ + public PythonEclipseDetector(final double maxCheck, + final PVCoordinatesProvider occulted, + final double occultedRadius, + final PVCoordinatesProvider occulting, + final double occultingRadius) + { + super(maxCheck,occulted,occultedRadius,occulting,occultingRadius); + } + + /** Build a new eclipse detector. + * <p>The new instance is a total eclipse (umbra) detector.</p> + * <p>The maximal interval between eclipse checks should be smaller than + * the half duration of the minimal pass to handle, otherwise some short + * passes could be missed.</p> + * @param maxCheck maximal checking interval (s) + * @param threshold convergence threshold (s) + * @param occulted the body to be occulted + * @param occultedRadius the radius of the body to be occulted in meters + * @param occulting the occulting body + * @param occultingRadius the occulting body radius in meters + */ + public PythonEclipseDetector(final double maxCheck, + final double threshold, + final PVCoordinatesProvider occulted, + final double occultedRadius, + final PVCoordinatesProvider occulting, + final double occultingRadius) + { + super(maxCheck,threshold,occulted, occultedRadius, occulting, occultingRadius); + } + + public PythonEclipseDetector(final double maxCheck, + final double threshold, + final PVCoordinatesProvider occulted, + final double occultedRadius, + final PVCoordinatesProvider occulting, + final double occultingRadius, + final boolean totalEclipse) + { + super(maxCheck, threshold, occulted, occultedRadius, occulting, occultingRadius, totalEclipse); + } + + public native Action eventOccurred(final SpacecraftState s, final boolean increasing) throws OrekitException; + +} + diff --git a/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonElevationDetector.java b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonElevationDetector.java new file mode 100644 index 0000000..1204203 --- /dev/null +++ b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonElevationDetector.java @@ -0,0 +1,162 @@ +/** Copyright 2014 SSC and 2002-2014 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 and is largely a derived work from the +// original file ElevationDetector.java created by CS Systèmes d'Information + +package org.orekit.python; + +import org.orekit.frames.TopocentricFrame; +import org.orekit.models.AtmosphericRefractionModel; +import org.orekit.propagation.events.ElevationDetector; +import org.orekit.propagation.events.EventDetector; +/*import org.orekit.propagation.events.handlers.EventHandler;*/ +import org.orekit.utils.ElevationMask; +import org.orekit.errors.OrekitException; +import org.orekit.propagation.SpacecraftState; + +/** + * Finder for satellite raising/setting events that allows for the + * setting of azimuth and/or elevation bounds or a ground azimuth/elevation + * mask input. Each calculation be configured to use atmospheric refraction + * as well. + * <p>The default implementation behavior is to {@link + * org.orekit.propagation.events.handlers.EventHandler.Action#CONTINUE continue} + * propagation at raising and to {@link + * org.orekit.propagation.events.handlers.EventHandler.Action#STOP stop} propagation + * at setting. This can be changed by calling + * {@link #withHandler(EventHandler)} after construction.</p> + * @author Hank Grabowski + * @since 6.1 + */ + +public class PythonElevationDetector extends ElevationDetector +{ + + private static final long serialVersionUID = -8444573139251039785L; + + /** 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(); + } + + /** + * Creates an instance of Elevation detector based on passed in topocentric frame + * and the minimum elevation angle. + * <p> + * uses default values for maximal checking interval ({@link #DEFAULT_MAXCHECK}) + * and convergence threshold ({@link #DEFAULT_THRESHOLD}).</p> + * @param topo reference to a topocentric model + * @see #withConstantElevation(double) + * @see #withElevationMask(ElevationMask) + * @see #withRefraction(AtmosphericRefractionModel) + */ + public PythonElevationDetector(TopocentricFrame topo) { + super(topo); + } + + + /** + * Creates an instance of Elevation detector based on passed in topocentric frame + * and the minimum elevation angle. + * <p> + * uses default values for maximal checking interval ({@link #DEFAULT_MAXCHECK}) + * and convergence threshold ({@link #DEFAULT_THRESHOLD}).</p> + * @param minElevation minimum elevation angle + * @param topo reference to a topocentric model + * @deprecated as of 6.1 replace with {@link #ElevationDetector(TopocentricFrame)} followed + * by a call to {@link #withConstantElevation(double)} + */ + public PythonElevationDetector(double elevation, TopocentricFrame topo) { + super(elevation, topo); + } + + /** + * Creates an instance of Elevation detector based on passed in topocentric frame + * and overrides of default maximal checking interval and convergence threshold values. + * @param maxCheck maximum checking interval (s) + * @param threshold maximum divergence threshold (s) + * @param topo reference to a topocentric model + * @see #withConstantElevation(double) + * @see #withElevationMask(ElevationMask) + * @see #withRefraction(AtmosphericRefractionModel) + */ + public PythonElevationDetector(final double maxCheck, final double threshold, final TopocentricFrame topo) { + super(maxCheck, threshold, topo); + } + + /** Handle an event and choose what to do next. + + * <p>The scheduling between this method and the {@link + * org.orekit.propagation.sampling.OrekitStepHandler OrekitStepHandler} method {@link + * org.orekit.propagation.sampling.OrekitStepHandler#handleStep( + * org.orekit.propagation.sampling.OrekitStepInterpolator, boolean) + * handleStep(interpolator, isLast)} is to call this method first and + * <code>handleStep</code> afterwards. This scheduling allows the propagator to + * pass <code>true</code> as the <code>isLast</code> parameter to the step + * handler to make it aware the step will be the last one if this method + * returns {@link EventDetector.Action#STOP}. As the interpolator may be used to navigate back + * throughout the last step (as {@link + * org.orekit.propagation.sampling.OrekitStepNormalizer OrekitStepNormalizer} + * does for example), user code called by this method and user + * code called by step handlers may experience apparently out of order values + * of the independent time variable. As an example, if the same user object + * implements both this {@link EventDetector EventDetector} interface and the + * {@link org.orekit.propagation.sampling.OrekitFixedStepHandler OrekitFixedStepHandler} + * interface, a <em>forward</em> integration may call its + * <code>eventOccurred</code> method with a state at 2000-01-01T00:00:10 first + * and call its <code>handleStep</code> method with a state at 2000-01-01T00:00:09 + * afterwards. Such out of order calls are limited to the size of the + * integration step for {@link + * org.orekit.propagation.sampling.OrekitStepHandler variable step handlers} and + * to the size of the fixed step for {@link + * org.orekit.propagation.sampling.OrekitFixedStepHandler fixed step handlers}.</p> + + * @param s the current state information : date, kinematics, attitude + * @param increasing if true, the value of the switching function increases + * when times increases around event (note that increase is measured with respect + * to physical time, not with respect to propagation which may go backward in time) + * @return one of {@link EventDetector.Action#STOP}, {@link EventDetector.Action#RESET_STATE}, + * {@link EventDetector.Action#RESET_DERIVATIVES} or {@link EventDetector.Action#CONTINUE} + * @exception OrekitException if some specific error occurs + * @deprecated as of 6.1 replaced by {@link + * org.orekit.propagation.events.handlers.EventHandler#eventOccurred(SpacecraftState, + * EventDetector, boolean)} + */ + public native Action eventOccurred(final SpacecraftState s, final boolean increasing) throws OrekitException; + + public native void pythonDecRef(); + +} + diff --git a/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonEventDetector.java b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonEventDetector.java new file mode 100644 index 0000000..5f7deb6 --- /dev/null +++ b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonEventDetector.java @@ -0,0 +1,107 @@ +/** Copyright 2014 SSC and 2002-2014 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 and is largely a derived work from the +// original file EventDetector.java created by CS Systèmes d'Information + +package org.orekit.python; + +import org.orekit.errors.OrekitException; +import org.orekit.propagation.SpacecraftState; +import org.orekit.propagation.events.EventDetector; +import org.orekit.time.AbsoluteDate; + +/** This interface represents space-dynamics aware events detectors. +* +* <p>It mirrors the {@link org.apache.commons.math3.ode.events.EventHandler +* EventHandler} interface from <a href="http://commons.apache.org/math/"> +* Apache Commons Math</a> but provides a space-dynamics interface to the +* methods.</p> +* +* <p>Events detectors are a useful solution to meet the requirements +* of propagators concerning discrete conditions. The state of each +* event detector is queried by the integrator at each step. When the +* sign of the underlying g switching function changes, the step is rejected +* and reduced, in order to make sure the sign changes occur only at steps +* boundaries.</p> +* +* <p>When step ends exactly at a switching function sign change, the corresponding +* event is triggered, by calling the {@link #eventOccurred(SpacecraftState, boolean)} +* method. The method can do whatever it needs with the event (logging it, performing +* some processing, ignore it ...). The return value of the method will be used by +* the propagator to stop or resume propagation, possibly changing the state vector.<p> +* +* @author Luc Maisonobe +* @author Véronique Pommier-Maurussane +*/ +public class PythonEventDetector implements EventDetector +{ + + 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(); + + + @Override + public native void init(SpacecraftState s0, AbsoluteDate t); + + @Override + public native double g(SpacecraftState s) throws OrekitException; + + + @Override + public native double getThreshold(); + + @Override + public native double getMaxCheckInterval(); + + @Override + public native int getMaxIterationCount(); + + @Override + public native SpacecraftState resetState(SpacecraftState oldState) throws OrekitException; + + @Override + public native Action eventOccurred(SpacecraftState s, boolean increasing) + throws OrekitException; + + +} + diff --git a/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonEventHandler.java b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonEventHandler.java new file mode 100644 index 0000000..7681be0 --- /dev/null +++ b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonEventHandler.java @@ -0,0 +1,115 @@ +/** Copyright 2014 SSC and 2002-2014 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 and is largely a derived work from the +// original file EventHandler.java created by CS Systèmes d'Information + +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; +import org.orekit.propagation.events.handlers.EventHandler.Action; + +/** This interface represents space-dynamics aware events detectors. +* +* <p>It mirrors the {@link org.apache.commons.math3.ode.events.EventHandler +* EventHandler} interface from <a href="http://commons.apache.org/math/"> +* Apache Commons Math</a> but provides a space-dynamics interface to the +* methods.</p> +* +* <p>Events detectors are a useful solution to meet the requirements +* of propagators concerning discrete conditions. The state of each +* event detector is queried by the integrator at each step. When the +* sign of the underlying g switching function changes, the step is rejected +* and reduced, in order to make sure the sign changes occur only at steps +* boundaries.</p> +* +* <p>When step ends exactly at a switching function sign change, the corresponding +* event is triggered, by calling the {@link #eventOccurred(SpacecraftState, boolean)} +* method. The method can do whatever it needs with the event (logging it, performing +* some processing, ignore it ...). The return value of the method will be used by +* the propagator to stop or resume propagation, possibly changing the state vector.<p> +* +* @author Luc Maisonobe +* @author Véronique Pommier-Maurussane +*/ +public class PythonEventHandler<T extends EventDetector> implements EventHandler<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(); + + /** + * eventOccurred method mirrors the same interface method as in {@link EventDetector} + * and its subclasses, but with an additional parameter that allows the calling + * method to pass in an object from the detector which would have potential + * additional data to allow the implementing class to determine the correct + * return state. + * + * @param s SpaceCraft state to be used in the evaluation + * @param detector object with appropriate type that can be used in determining correct return state + * @param increasing with the event occured in an "increasing" or "decreasing" slope direction + * @return the Action that the calling detector should pass back to the evaluation system + * + * @exception OrekitException if some specific error occurs + */ + public native Action eventOccurred(SpacecraftState s, T detector, boolean increasing) throws OrekitException; + + /** 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> + * @param detector object with appropriate type that can be used in determining correct return state + * @param oldState old state + * @return new state + * @exception OrekitException if the state cannot be reseted + */ + public native SpacecraftState resetState(T detector, SpacecraftState oldState) throws OrekitException; + + +} + diff --git a/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonNodeDetector.java b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonNodeDetector.java new file mode 100644 index 0000000..cdd36c0 --- /dev/null +++ b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonNodeDetector.java @@ -0,0 +1,110 @@ +/** Copyright 2014 SSC and 2002-2014 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 and is largely a derived work from the +// original file NodeDetector.java created by CS Systèmes d'Information + +package org.orekit.python; + +import org.orekit.frames.Frame; +import org.orekit.orbits.Orbit; +import org.orekit.propagation.events.EventDetector; +import org.orekit.propagation.events.NodeDetector; +/*import org.orekit.propagation.events.handlers.EventHandler;*/ +import org.orekit.propagation.SpacecraftState; +import org.orekit.errors.OrekitException; + +/** Finder for node crossing events. + * <p>This class finds equator crossing events (i.e. ascending + * or descending node crossing).</p> + * <p>The default implementation behavior is to {@link + * org.orekit.propagation.events.handlers.EventHandler.Action#CONTINUE continue} + * propagation at descending node crossing and to {@link + * org.orekit.propagation.events.handlers.EventHandler.Action#STOP stop} propagation + * at ascending node crossing. This can be changed by calling + * {@link #withHandler(EventHandler)} after construction.</p> + * <p>Beware that node detection will fail for almost equatorial orbits. If + * for example a node detector is used to trigger an {@link + * org.orekit.forces.maneuvers.ImpulseManeuver ImpulseManeuver} and the maneuver + * turn the orbit plane to equator, then the detector may completely fail just + * after the maneuver has been performed! This is a real case that has been + * encountered during validation ...</p> + * @see org.orekit.propagation.Propagator#addEventDetector(EventDetector) + * @author Luc Maisonobe + */ +public class PythonNodeDetector extends NodeDetector +{ + + private static final long serialVersionUID = 2369785604202125622L; + + /** 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 orbit is used only to set an upper bound for the max check interval + * to period/3 and to set the convergence threshold according to orbit size.</p> + * @param orbit initial orbit + * @param frame frame in which the equator is defined (typical + * values are {@link org.orekit.frames.FramesFactory#getEME2000() J<sub>2000</sub>} or + * {@link org.orekit.frames.FramesFactory#getITRF2005() ITRF 2005}) + */ + public PythonNodeDetector(final Orbit orbit, final Frame frame) { + super(orbit, frame); + } + + /** Build a new instance. + * <p>The orbit is used only to set an upper bound for the max check interval + * to period/3.</p> + * @param threshold convergence threshold (s) + * @param orbit initial orbit + * @param frame frame in which the equator is defined (typical + * values are {@link org.orekit.frames.FramesFactory#getEME2000() J<sub>2000</sub>} or + * {@link org.orekit.frames.FramesFactory#getITRF2005() ITRF 2005}) + */ + public PythonNodeDetector(final double threshold, final Orbit orbit, final Frame frame) + { + super(threshold, orbit, frame); + } + + public native Action eventOccurred(final SpacecraftState s, final boolean increasing) throws OrekitException; + + +} + diff --git a/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonOrekitFixedStepHandler.java b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonOrekitFixedStepHandler.java new file mode 100644 index 0000000..4489491 --- /dev/null +++ b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonOrekitFixedStepHandler.java @@ -0,0 +1,85 @@ +/** Copyright 2014 SSC and 2002-2014 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 and is largely a derived work from the +// original file OrekitFixedStepHandler.java created by CS Systèmes d'Information + +package org.orekit.python; +import org.orekit.propagation.sampling.OrekitFixedStepHandler; + +import org.orekit.errors.PropagationException; +import org.orekit.propagation.SpacecraftState; +import org.orekit.time.AbsoluteDate; + +/** This interface is a space-dynamics aware fixed size step handler. + * + * <p>It mirrors the <code>FixedStepHandler</code> interface from <a + * href="http://commons.apache.org/math/">commons-math</a> but provides + * a space-dynamics interface to the methods.</p> + * @author Luc Maisonobe + */ + +public class PythonOrekitFixedStepHandler implements OrekitFixedStepHandler { + + private 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(); + + /** 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 + */ + public native void init(SpacecraftState s0, AbsoluteDate t) throws PropagationException; + + /** Handle the current step. + * @param currentState current state at step time + * @param isLast if true, this is the last integration step + * @exception PropagationException if step cannot be handled + */ + + public native void handleStep(final SpacecraftState currentState, final boolean isLast) + throws PropagationException; + +} diff --git a/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonUnivariateFunction.java b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonUnivariateFunction.java new file mode 100644 index 0000000..d51b215 --- /dev/null +++ b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/PythonUnivariateFunction.java @@ -0,0 +1,72 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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 and is largely a derived work from the +// original file UnivariateFunction.java + +package org.orekit.python; + +import org.apache.commons.math3.analysis.UnivariateFunction; + + +public class PythonUnivariateFunction implements UnivariateFunction { + + 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(); + + + /** + * Compute the value of the function. + * + * @param x Point at which the function value should be computed. + * @return the value of the function. + * @throws IllegalArgumentException when the activated method itself can + * ascertain that a precondition, specified in the API expressed at the + * level of the activated method, has been violated. + * When Commons Math throws an {@code IllegalArgumentException}, it is + * usually the consequence of checking the actual parameters passed to + * the method. + */ + @Override + public native double value(double x); + +} + diff --git a/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/package-info.java b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/package-info.java new file mode 100644 index 0000000..82a849e --- /dev/null +++ b/orekit-6.1-java-wrappers/src/main/java/org/orekit/python/package-info.java @@ -0,0 +1,32 @@ +/** Copyright 2014 SSC and 2002-2014 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 package provides classes that are made to be interfaced to the JCC tool + * that provides an interface between Java and C++/Python. Creating specific + * objects like in this package enables subclassing with the possibility to call + * Python methods from java, which is useful for some classes in orekit. + * + * All methods that are to be overridden shall be declared native. + * See http://lucene.apache.org/pylucene/jcc/features.html for details. + * + * @author Petrus Hyvonen + */ + +package org.orekit.python; -- GitLab