Merge branch 'master' into remove_tix2

This commit is contained in:
Gerhard Kitzler 2016-11-16 20:15:33 +01:00
commit 9eee23693e
3 changed files with 9 additions and 8 deletions

View File

@ -60,6 +60,7 @@ namespace netgen
T operator*() const { return ar[ind]; } T operator*() const { return ar[ind]; }
T & operator*() { return ar[ind]; } T & operator*() { return ar[ind]; }
bool operator != (ArrayIterator d2) { return ind != d2.ind; } bool operator != (ArrayIterator d2) { return ind != d2.ind; }
bool operator == (ArrayIterator d2) { return ind == d2.ind; }
}; };

View File

@ -10,6 +10,8 @@
#include <immintrin.h> #include <immintrin.h>
#ifdef WIN32 #ifdef WIN32
#ifndef AVX_OPERATORS_DEFINED
#define AVX_OPERATORS_DEFINED
inline __m128d operator- (__m128d a) { return _mm_xor_pd(a, _mm_set1_pd(-0.0)); } inline __m128d operator- (__m128d a) { return _mm_xor_pd(a, _mm_set1_pd(-0.0)); }
inline __m128d operator+ (__m128d a, __m128d b) { return _mm_add_pd(a,b); } inline __m128d operator+ (__m128d a, __m128d b) { return _mm_add_pd(a,b); }
inline __m128d operator- (__m128d a, __m128d b) { return _mm_sub_pd(a,b); } inline __m128d operator- (__m128d a, __m128d b) { return _mm_sub_pd(a,b); }
@ -36,6 +38,7 @@ inline __m256d operator-= (__m256d &a, __m256d b) { return a = a-b; }
inline __m256d operator*= (__m256d &a, __m256d b) { return a = a*b; } inline __m256d operator*= (__m256d &a, __m256d b) { return a = a*b; }
inline __m256d operator/= (__m256d &a, __m256d b) { return a = a/b; } inline __m256d operator/= (__m256d &a, __m256d b) { return a = a/b; }
#endif #endif
#endif

View File

@ -7,8 +7,6 @@
#include <csg.hpp> #include <csg.hpp>
#include <geometry2d.hpp> #include <geometry2d.hpp>
#include <../interface/writeuser.hpp> #include <../interface/writeuser.hpp>
#include <nginterface.h>
#include <nginterface_v2.hpp>
using namespace netgen; using namespace netgen;
@ -22,6 +20,7 @@ namespace netgen
template <typename T, int BASE = 0, typename TIND = int> template <typename T, int BASE = 0, typename TIND = int>
void ExportArray (py::module &m) void ExportArray (py::module &m)
{ {
using TA = Array<T,BASE,TIND>;
string name = string("Array_") + typeid(T).name(); string name = string("Array_") + typeid(T).name();
py::class_<Array<T,BASE,TIND>>(m, name.c_str()) py::class_<Array<T,BASE,TIND>>(m, name.c_str())
.def ("__len__", [] ( Array<T,BASE,TIND> &self ) { return self.Size(); } ) .def ("__len__", [] ( Array<T,BASE,TIND> &self ) { return self.Size(); } )
@ -33,6 +32,9 @@ void ExportArray (py::module &m)
return self[i]; return self[i];
}), }),
py::return_value_policy::reference) py::return_value_policy::reference)
.def("__iter__", [] ( TA & self) {
return py::make_iterator (self.begin(),self.end());
}, py::keep_alive<0,1>()) // keep array alive while iterator is used
; ;
} }
@ -300,10 +302,6 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
py::implicitly_convertible< int, PointIndex>(); py::implicitly_convertible< int, PointIndex>();
py::class_<Ngx_Mesh>(m, "Ngx_Mesh")
.def(py::init<shared_ptr<Mesh>>())
.def_property_readonly("ngmesh", &Ngx_Mesh::GetMesh)
;
py::class_<Mesh,shared_ptr<Mesh>>(m, "Mesh") py::class_<Mesh,shared_ptr<Mesh>>(m, "Mesh")
// .def(py::init<>("create empty mesh")) // .def(py::init<>("create empty mesh"))
@ -564,7 +562,6 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m)
)) ))
; ;
py::implicitly_convertible< shared_ptr<Mesh>, Ngx_Mesh >();
typedef MeshingParameters MP; typedef MeshingParameters MP;