[Debian-astro-commits] [gyoto] 155/221: Python: basic (but sufficient) support for tracing intidivual geodesics

Thibaut Jean-Claude Paumard thibaut at moszumanska.debian.org
Fri May 22 20:52:42 UTC 2015


This is an automated email from the git hooks/post-receive script.

thibaut pushed a commit to branch master
in repository gyoto.

commit e35255bf64a9fa8f30838826cca3419105c8b2d5
Author: Thibaut Paumard <paumard at users.sourceforge.net>
Date:   Thu Dec 18 13:15:22 2014 +0100

    Python: basic (but sufficient) support for tracing intidivual geodesics
---
 include/GyotoWorldline.h |  4 ++--
 python/gyoto.i           | 27 +++++++++++++++++++++++++--
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/include/GyotoWorldline.h b/include/GyotoWorldline.h
index 5776dac..a8befa0 100644
--- a/include/GyotoWorldline.h
+++ b/include/GyotoWorldline.h
@@ -635,7 +635,7 @@ class Gyoto::Worldline
   SmartPointer<Worldline::IntegState::Generic> state_;
 };
 
-
+#ifndef GYOTO_SWIGIMPORTED
 /**
  * \class Gyoto::Worldline::IntegState::Generic
  * \brief Current state of a geodesic integration
@@ -826,5 +826,5 @@ class Gyoto::Worldline::IntegState::Boost : public Generic {
   
 };
 #endif /// HAVE_BOOST
-
+#endif /// GYOTO_SWIGIMPORTED
 #endif
diff --git a/python/gyoto.i b/python/gyoto.i
index dfbf8e2..c101ea0 100644
--- a/python/gyoto.i
+++ b/python/gyoto.i
@@ -1,5 +1,8 @@
 %module gyoto
 
+%define GYOTO_SWIGIMPORTED
+%enddef
+
 %{
 #define SWIG_FILE_WITH_INIT
   //#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
@@ -12,6 +15,7 @@
 #include "GyotoObject.h"
 #include "GyotoAstrobj.h"
 #include "GyotoError.h"
+#include "GyotoWorldline.h"
 #include "GyotoPhoton.h"
 #include "GyotoScreen.h"
 using namespace Gyoto;
@@ -31,6 +35,11 @@ void pyGyotoErrorHandler (const Gyoto::Error e) {
 
 
 %include "std_string.i" 
+%include "std_vector.i"
+%template(vector_double) std::vector<double>;
+%template(vector_unsigned_long) std::vector<unsigned long>;
+%include "carrays.i"
+%array_class(double, array_double)
 %include "numpy.i"
 
 %include "GyotoError.h"
@@ -50,6 +59,22 @@ void pyGyotoErrorHandler (const Gyoto::Error e) {
 %template(ScreenPtr) Gyoto::SmartPointer<Gyoto::Screen>;
 %include "GyotoScreen.h"
 
+%ignore Gyoto::Worldline::IntegState;
+%ignore Gyoto::Worldline::IntegState::Generic;
+%ignore Gyoto::Worldline::IntegState::Boost;
+%ignore Gyoto::Worldline::IntegState::Legacy;
+%include "GyotoWorldline.h"
+
+%rename (castToWorldline) pyGyotoCastToWorldline;
+%inline %{
+Gyoto::Worldline * pyGyotoCastToWorldline
+  (Gyoto::SmartPointer<Gyoto::Astrobj::Generic> const_p) {
+  Gyoto::SmartPointee * p=const_cast<Gyoto::Astrobj::Generic*>(const_p());
+  Gyoto::Worldline * res = dynamic_cast<Gyoto::Worldline*>(p);
+  return res;
+}
+%}
+
 %template(PhotonPtr) Gyoto::SmartPointer<Gyoto::Photon>;
 %include "GyotoPhoton.h"
 
@@ -257,6 +282,4 @@ public:
 };
 
 %template(SceneryPtr) Gyoto::SmartPointer<Gyoto::Scenery>;
-%define GYOTO_SWIGIMPORTED
-%enddef
 %include "GyotoScenery.h"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/gyoto.git



More information about the Debian-astro-commits mailing list