yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #12766
[Branch ~yade-pkg/yade/git-trunk] Rev 3912: Optimize using of ndarray.
------------------------------------------------------------
revno: 3912
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Fri 2016-07-01 22:21:10 +0200
message:
Optimize using of ndarray.
Minor fixes.
modified:
py/3rd-party/pygts-0.3.1/pygts.c
py/_polyhedra_utils.cpp
py/_utils.cpp
py/_utils.hpp
--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk
Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'py/3rd-party/pygts-0.3.1/pygts.c'
--- py/3rd-party/pygts-0.3.1/pygts.c 2009-07-27 17:08:23 +0000
+++ py/3rd-party/pygts-0.3.1/pygts.c 2016-07-01 20:21:10 +0000
@@ -762,11 +762,6 @@
m = Py_InitModule3("_gts", gts_methods,"Gnu Triangulated Surface Library");
if (m == NULL) return;
-#if PYGTS_HAS_NUMPY
- /* Make sure Surface.iso can work with numpy arrays */
- import_array()
-#endif
-
/* Add new types to python */
Py_INCREF(&PygtsObjectType);
PyModule_AddObject(m, "Object", (PyObject *)&PygtsObjectType);
=== modified file 'py/_polyhedra_utils.cpp'
--- py/_polyhedra_utils.cpp 2016-01-28 15:00:38 +0000
+++ py/_polyhedra_utils.cpp 2016-07-01 20:21:10 +0000
@@ -3,20 +3,19 @@
#ifdef YADE_CGAL
-#include"pkg/dem/Polyhedra.hpp"
-
-#include<core/Scene.hpp>
-#include<core/Omega.hpp>
-#include<pkg/common/Sphere.hpp>
-#include<pkg/common/ElastMat.hpp>
-#include<lib/pyutil/doc_opts.hpp>
-#include<cmath>
-
-#include<numpy/ndarrayobject.h>
+#include "pkg/dem/Polyhedra.hpp"
+
+#include <core/Scene.hpp>
+#include <core/Omega.hpp>
+#include <pkg/common/Sphere.hpp>
+#include <pkg/common/ElastMat.hpp>
+#include <lib/pyutil/doc_opts.hpp>
+#include <cmath>
+
+#include <numpy/ndarraytypes.h>
namespace py = boost::python;
-
//**********************************************************************************
//print polyhedron in basic position
void PrintPolyhedra(const shared_ptr<Shape>& shape){
@@ -519,11 +518,7 @@
}
BOOST_PYTHON_MODULE(_polyhedra_utils){
- // http://numpy.scipy.org/numpydoc/numpy-13.html mentions this must be done in module init, otherwise we will crash
- import_array();
-
YADE_SET_DOCSTRING_OPTS;
-
py::def("PrintPolyhedra",PrintPolyhedra,"Print list of vertices sorted according to polyhedrons facets.");
py::def("PrintPolyhedraActualPos",PrintPolyhedraActualPos,"Print list of vertices sorted according to polyhedrons facets.");
py::def("PWaveTimeStep",PWaveTimeStep,"Get timestep accoring to the velocity of P-Wave propagation; computed from sphere radii, rigidities and masses.");
=== modified file 'py/_utils.cpp'
--- py/_utils.cpp 2016-06-08 21:12:54 +0000
+++ py/_utils.cpp 2016-07-01 20:21:10 +0000
@@ -1,4 +1,5 @@
#include <py/_utils.hpp>
+#include <numpy/arrayobject.h>
bool isInBB(Vector3r p, Vector3r bbMin, Vector3r bbMax){return p[0]>bbMin[0] && p[0]<bbMax[0] && p[1]>bbMin[1] && p[1]<bbMax[1] && p[2]>bbMin[2] && p[2]<bbMax[2];}
@@ -453,9 +454,6 @@
}
BOOST_PYTHON_MODULE(_utils){
- // http://numpy.scipy.org/numpydoc/numpy-13.html mentions this must be done in module init, otherwise we will crash
- import_array();
-
YADE_SET_DOCSTRING_OPTS;
py::def("PWaveTimeStep",PWaveTimeStep,"Get timestep accoring to the velocity of P-Wave propagation; computed from sphere radii, rigidities and masses.");
=== modified file 'py/_utils.hpp'
--- py/_utils.hpp 2016-06-08 21:12:54 +0000
+++ py/_utils.hpp 2016-07-01 20:21:10 +0000
@@ -11,8 +11,6 @@
#include<lib/pyutil/doc_opts.hpp>
#include<pkg/dem/ViscoelasticPM.hpp>
-#include<numpy/ndarrayobject.h>
-
namespace py = boost::python;
bool isInBB(Vector3r p, Vector3r bbMin, Vector3r bbMax);