[cig-commits] r13870 - in short/3D/PyLith/trunk/playpen/swigtest: . applications modulesrc

brad at geodynamics.org brad at geodynamics.org
Wed Jan 14 11:31:00 PST 2009


Author: brad
Date: 2009-01-14 11:31:00 -0800 (Wed, 14 Jan 2009)
New Revision: 13870

Modified:
   short/3D/PyLith/trunk/playpen/swigtest/applications/testswig.py
   short/3D/PyLith/trunk/playpen/swigtest/configure.ac
   short/3D/PyLith/trunk/playpen/swigtest/modulesrc/Makefile.am
   short/3D/PyLith/trunk/playpen/swigtest/modulesrc/Scene.i
   short/3D/PyLith/trunk/playpen/swigtest/modulesrc/geometry.i
Log:
Added testing of array.

Modified: short/3D/PyLith/trunk/playpen/swigtest/applications/testswig.py
===================================================================
--- short/3D/PyLith/trunk/playpen/swigtest/applications/testswig.py	2009-01-14 18:30:17 UTC (rev 13869)
+++ short/3D/PyLith/trunk/playpen/swigtest/applications/testswig.py	2009-01-14 19:31:00 UTC (rev 13870)
@@ -46,25 +46,11 @@
     """
     Run the application.
     """
-    import swigtest.geometry as geometry
-
-    bar = geometry.Bar()
-    bar.length(4.0)
-    bar.width(2.0)
-    bar.color("yellow")
-    bar.id(0)
-
-    sphere = geometry.Sphere()
-    sphere.radius(3.0);
-    sphere.color("green");
-    sphere.id(1);
-
-    scene = geometry.Scene()
-    scene.bar(bar);
-    scene.sphere(sphere);
-    scene.view();
-
     self.scene.view()
+
+    import numpy
+    x = numpy.array([1.1, 2.2, 3.3, 4.4], dtype=numpy.float32)
+    self.scene.printData(x)
     return
   
 

Modified: short/3D/PyLith/trunk/playpen/swigtest/configure.ac
===================================================================
--- short/3D/PyLith/trunk/playpen/swigtest/configure.ac	2009-01-14 18:30:17 UTC (rev 13869)
+++ short/3D/PyLith/trunk/playpen/swigtest/configure.ac	2009-01-14 19:31:00 UTC (rev 13870)
@@ -38,7 +38,11 @@
 CIT_PYTHON_SYSCONFIG
 AM_PATH_PYTHON([2.3])
 
+# NUMPY
+CIT_NUMPY_PYTHON_MODULE
+CIT_NUMPY_INCDIR
 
+
 # SWIG
 AC_PROG_SWIG
 

Modified: short/3D/PyLith/trunk/playpen/swigtest/modulesrc/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/playpen/swigtest/modulesrc/Makefile.am	2009-01-14 18:30:17 UTC (rev 13869)
+++ short/3D/PyLith/trunk/playpen/swigtest/modulesrc/Makefile.am	2009-01-14 19:31:00 UTC (rev 13870)
@@ -38,7 +38,7 @@
 	$(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
 endif
 
-INCLUDES = -I$(top_srcdir)/libsrc -I$(PYTHON_INCDIR)
+INCLUDES = -I$(top_srcdir)/libsrc -I$(NUMPY_INCDIR) -I$(PYTHON_INCDIR)
 
 $(srcdir)/geometry_wrap.cxx $(srcdir)/geometry.py: $(swig_sources)
 	$(SWIG) -Wall -c++ -python $<

Modified: short/3D/PyLith/trunk/playpen/swigtest/modulesrc/Scene.i
===================================================================
--- short/3D/PyLith/trunk/playpen/swigtest/modulesrc/Scene.i	2009-01-14 18:30:17 UTC (rev 13869)
+++ short/3D/PyLith/trunk/playpen/swigtest/modulesrc/Scene.i	2009-01-14 19:31:00 UTC (rev 13870)
@@ -30,6 +30,10 @@
 
   void view(void) const;
 
+  %apply(double* IN_ARRAY1, int DIM1) {(const double* values, const int size)};
+  void printData(const double* values,
+		 const int size) const;  
+  %clear (const double* values, const int size);
 }; // Scene
 
 } // namespace geometry

Modified: short/3D/PyLith/trunk/playpen/swigtest/modulesrc/geometry.i
===================================================================
--- short/3D/PyLith/trunk/playpen/swigtest/modulesrc/geometry.i	2009-01-14 18:30:17 UTC (rev 13869)
+++ short/3D/PyLith/trunk/playpen/swigtest/modulesrc/geometry.i	2009-01-14 19:31:00 UTC (rev 13870)
@@ -18,6 +18,8 @@
   }
 }
 
+%include "array.i"
+
 %include "Shape.i"
 %include "Bar.i"
 %include "Sphere.i"



More information about the CIG-COMMITS mailing list