Commit e68407dd authored by Anton Gladky's avatar Anton Gladky
Browse files

Optimize using of ndarray.

Minor fixes.
parent 594dd1c0
......@@ -762,11 +762,6 @@ init_gts(void)
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);
......
......@@ -3,20 +3,19 @@
#ifdef YADE_CGAL
#include"pkg/dem/Polyhedra.hpp"
#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 <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 <numpy/ndarraytypes.h>
namespace py = boost::python;
//**********************************************************************************
//print polyhedron in basic position
void PrintPolyhedra(const shared_ptr<Shape>& shape){
......@@ -519,11 +518,7 @@ bool convexHull(vector<Vector3r> points){
}
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.");
......
#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 @@ void setBodyColor(int id, Vector3r newColor){
}
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.");
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment