[Debian-astro-commits] [gyoto] 152/221: Python: fix Scenery interface so ray-tracing is possible. Implement a way to connect a buffer to Astrobj::intensity.

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 fdde55aebd59b2011082e9ecbd36a3b1c63901ca
Author: Thibaut Paumard <paumard at users.sourceforge.net>
Date:   Wed Dec 17 12:52:13 2014 +0100

    Python: fix Scenery interface so ray-tracing is possible. Implement a way to connect a buffer to Astrobj::intensity.
---
 include/GyotoScenery.h |  7 ++++++-
 python/gyoto.i         | 23 ++++++++++++++++++++---
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/include/GyotoScenery.h b/include/GyotoScenery.h
index ae3330f..22eb5d8 100644
--- a/include/GyotoScenery.h
+++ b/include/GyotoScenery.h
@@ -449,7 +449,12 @@ class Gyoto::Scenery
    * distributions are not. impactcoords can be computed using the
    * ImpactCoords quantity.
    */
-  void rayTrace(Screen::Coord2dSet & ij,
+  void rayTrace(
+#ifdef GYOTO_SWIGIMPORTED
+		Coord2dSet & ij,
+#else
+		Screen::Coord2dSet & ij,
+#endif
 		Astrobj::Properties *data,
 		double * impactcoords=NULL);
 
diff --git a/python/gyoto.i b/python/gyoto.i
index f034ee1..d49a7d8 100644
--- a/python/gyoto.i
+++ b/python/gyoto.i
@@ -2,6 +2,7 @@
 
 %{
 #define SWIG_FILE_WITH_INIT
+#include "Python.h"
 #define GYOTO_NO_DEPRECATED
 #include "GyotoConfig.h"
 #include "GyotoFactory.h"
@@ -22,8 +23,17 @@ void pyGyotoErrorHandler (const Gyoto::Error e) {
   PyErr_SetString(PyExc_RuntimeError, e);
   return;
 }
+
+void AstrobjPropertiesSetIntensity(Gyoto::Astrobj::Properties *p,
+                                    double *invec, int n1, int n2)
+{
+  p->intensity=invec;
+} 
 %}
 
+
+
+
 %include "std_string.i" 
 %include "numpy.i"
 
@@ -35,15 +45,17 @@ void pyGyotoErrorHandler (const Gyoto::Error e) {
   import_array();
  }
 
+
+%apply (double* IN_ARRAY2, int DIM1, int DIM2) {(double *invec, int n1, int n2)}
+void AstrobjPropertiesSetIntensity(Gyoto::Astrobj::Properties *p,
+                                   double *invec, int n1, int n2);
+
 %ignore Gyoto::SmartPointee;
 %include "GyotoSmartPointer.h"
 
 %include "GyotoValue.h"
 %include "GyotoObject.h"
 
-%template(SceneryPtr) Gyoto::SmartPointer<Gyoto::Scenery>;
-%include "GyotoScenery.h"
-
 %template(ScreenPtr) Gyoto::SmartPointer<Gyoto::Screen>;
 %include "GyotoScreen.h"
 
@@ -230,3 +242,8 @@ public:
   Coord1dSet& operator++();
   double angle() const ;
 };
+
+%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