From 953bd13cf4af63093f68e1cb526ec5973dc2299b Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 2 Dec 2016 12:27:26 +0100 Subject: [PATCH 1/4] Support for OpenGL buffer objects on Windows --- libsrc/include/incopengl.hpp | 26 +++++++++++++++++--------- libsrc/visualization/vssolution.cpp | 19 +++++++++++++++++++ libsrc/visualization/vssolution.hpp | 2 +- ng/ngpkg.cpp | 3 +++ 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/libsrc/include/incopengl.hpp b/libsrc/include/incopengl.hpp index 4e54002e..b060f67c 100644 --- a/libsrc/include/incopengl.hpp +++ b/libsrc/include/incopengl.hpp @@ -1,5 +1,8 @@ +#ifndef INCOPENGL_HPP___ +#define INCOPENGL_HPP___ #define GL_GLEXT_PROTOTYPES +#include # if defined(TOGL_AGL) || defined(TOGL_AGL_CLASSIC) || defined(TOGL_NSOPENGL) # include @@ -17,15 +20,20 @@ #include #endif - - - - +#ifdef WIN32 // part of OpenGL 1.2, but not in Microsoft's OpenGL 1.1 header: // GL version sould be checked at runtime -#ifndef GL_CLAMP_TO_EDGE -#define GL_CLAMP_TO_EDGE 0x812F +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_STATIC_DRAW 0x88E4 +typedef ptrdiff_t GLintptr; +typedef ptrdiff_t GLsizeiptr; +extern void (*glBindBuffer) (GLenum a, GLuint b); +extern void (*glDeleteBuffers) (GLsizei a, const GLuint *b); +extern void (*glGenBuffers) (GLsizei a, GLuint *b); +extern void (*glBufferData) (GLenum a, GLsizeiptr b, const GLvoid *c, GLenum d); +extern void (*glBufferSubData) (GLenum a, GLintptr b, GLsizeiptr c, const GLvoid *d); #endif - - - +DLL_HEADER void LoadOpenGLFunctionPointers(); +#endif // INCOPENGL_HPP___ diff --git a/libsrc/visualization/vssolution.cpp b/libsrc/visualization/vssolution.cpp index 6a02e54e..a83fd9c0 100644 --- a/libsrc/visualization/vssolution.cpp +++ b/libsrc/visualization/vssolution.cpp @@ -4805,3 +4805,22 @@ void Ng_Redraw (bool blocking) #endif } +#ifdef OPENGL +#ifdef WIN32 +void (*glBindBuffer) (GLenum a, GLuint b); +void (*glDeleteBuffers) (GLsizei a, const GLuint *b); +void (*glGenBuffers) (GLsizei a, GLuint *b); +void (*glBufferData) (GLenum a, GLsizeiptr b, const GLvoid *c, GLenum d); +void (*glBufferSubData) (GLenum a, GLintptr b, GLsizeiptr c, const GLvoid *d); +DLL_HEADER void LoadOpenGLFunctionPointers() { + glBindBuffer = (decltype(glBindBuffer)) wglGetProcAddress("glBindBuffer"); + glBufferSubData = (decltype(glBufferSubData)) wglGetProcAddress("glBufferSubData"); + glBufferData = (decltype(glBufferData)) wglGetProcAddress("glBufferData"); + glDeleteBuffers = (decltype(glDeleteBuffers)) wglGetProcAddress("glDeleteBuffers"); + glGenBuffers = (decltype(glGenBuffers)) wglGetProcAddress("glGenBuffers"); + if(!glBindBuffer) throw std::runtime_error("Could not load OpenGL functions!"); +} +#else // WIN32 +DLL_HEADER void LoadOpenGLFunctionPointers() { } +#endif // WIN32 +#endif // OPENGL diff --git a/libsrc/visualization/vssolution.hpp b/libsrc/visualization/vssolution.hpp index d8193d56..80cf1c5b 100644 --- a/libsrc/visualization/vssolution.hpp +++ b/libsrc/visualization/vssolution.hpp @@ -43,7 +43,7 @@ class DLL_HEADER VisualSceneSolution : public VisualScene Point<3> p; }; - // #define USE_BUFFERS +#define USE_BUFFERS #ifdef USE_BUFFERS bool has_surfel_vbo = false; GLuint surfel_vbo[4]; // diff --git a/ng/ngpkg.cpp b/ng/ngpkg.cpp index 957bf7c3..e01087ca 100644 --- a/ng/ngpkg.cpp +++ b/ng/ngpkg.cpp @@ -1938,6 +1938,7 @@ namespace netgen if (nodisplay) return; + LoadOpenGLFunctionPointers(); fontbase = Togl_LoadBitmapFont( togl, TOGL_BITMAP_8_BY_13 ); Set_OpenGLText_Callback (&MyOpenGLText_GUI); @@ -2078,6 +2079,8 @@ namespace netgen // possible values: 12,14,16,18,20,22,24,28,32 font = selectFont(18); + LoadOpenGLFunctionPointers(); + glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); From 7e4892a9e70fe08686854c8350bd9fab9249de82 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Mon, 5 Dec 2016 13:50:21 +0100 Subject: [PATCH 2/4] firststep and laststep as meshingparameters to be exported to python --- libsrc/csg/csgeom.cpp | 8 +++----- libsrc/csg/csgeom.hpp | 3 +-- libsrc/csg/genmesh.cpp | 25 ++++++++++++------------- libsrc/csg/python_csg.cpp | 2 +- libsrc/geom2d/geometry2d.cpp | 3 +-- libsrc/geom2d/geometry2d.hpp | 3 +-- libsrc/geom2d/python_geom2d.cpp | 2 +- libsrc/meshing/basegeom.cpp | 9 ++++----- libsrc/meshing/basegeom.hpp | 3 +-- libsrc/meshing/meshtype.hpp | 5 +++++ libsrc/meshing/python_mesh.cpp | 10 +++++++--- libsrc/occ/occgenmesh.cpp | 23 +++++++++++------------ libsrc/occ/occgeom.cpp | 5 ++--- libsrc/occ/occgeom.hpp | 3 +-- libsrc/stlgeom/stlgeom.cpp | 5 ++--- libsrc/stlgeom/stlgeom.hpp | 6 ++---- libsrc/stlgeom/stlgeommesh.cpp | 23 +++++++++++------------ ng/ngpkg.cpp | 5 +++-- 18 files changed, 69 insertions(+), 74 deletions(-) diff --git a/libsrc/csg/csgeom.cpp b/libsrc/csg/csgeom.cpp index fb89cd46..8e18590f 100644 --- a/libsrc/csg/csgeom.cpp +++ b/libsrc/csg/csgeom.cpp @@ -129,14 +129,12 @@ namespace netgen extern int CSGGenerateMesh (CSGeometry & geom, - shared_ptr & mesh, MeshingParameters & mparam, - int perfstepsstart, int perfstepsend); + shared_ptr & mesh, MeshingParameters & mparam); - int CSGeometry :: GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam, - int perfstepsstart, int perfstepsend) + int CSGeometry :: GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam) { - return CSGGenerateMesh (*this, mesh, mparam, perfstepsstart, perfstepsend); + return CSGGenerateMesh (*this, mesh, mparam); } diff --git a/libsrc/csg/csgeom.hpp b/libsrc/csg/csgeom.hpp index 3301dc36..66e3e7cb 100644 --- a/libsrc/csg/csgeom.hpp +++ b/libsrc/csg/csgeom.hpp @@ -313,8 +313,7 @@ namespace netgen Array bcmodifications; - virtual int GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam, - int perfstepsstart, int perfstepsend); + virtual int GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam); virtual const Refinement & GetRefinement () const; }; diff --git a/libsrc/csg/genmesh.cpp b/libsrc/csg/genmesh.cpp index ad67151f..566f94a1 100644 --- a/libsrc/csg/genmesh.cpp +++ b/libsrc/csg/genmesh.cpp @@ -658,17 +658,16 @@ namespace netgen int CSGGenerateMesh (CSGeometry & geom, - shared_ptr & mesh, MeshingParameters & mparam, - int perfstepsstart, int perfstepsend) + shared_ptr & mesh, MeshingParameters & mparam) { if (mesh && mesh->GetNSE() && !geom.GetNSolids()) { - if (perfstepsstart < MESHCONST_MESHVOLUME) - perfstepsstart = MESHCONST_MESHVOLUME; + if (mparam.perfstepsstart < MESHCONST_MESHVOLUME) + mparam.perfstepsstart = MESHCONST_MESHVOLUME; } - if (perfstepsstart <= MESHCONST_ANALYSE) + if (mparam.perfstepsstart <= MESHCONST_ANALYSE) { if (mesh) mesh -> DeleteMesh(); @@ -709,11 +708,11 @@ namespace netgen } - if (multithread.terminate || perfstepsend <= MESHCONST_ANALYSE) + if (multithread.terminate || mparam.perfstepsend <= MESHCONST_ANALYSE) return TCL_OK; - if (perfstepsstart <= MESHCONST_MESHEDGES) + if (mparam.perfstepsstart <= MESHCONST_MESHEDGES) { FindEdges (geom, *mesh, mparam, true); if (multithread.terminate) return TCL_OK; @@ -746,11 +745,11 @@ namespace netgen } } - if (multithread.terminate || perfstepsend <= MESHCONST_MESHEDGES) + if (multithread.terminate || mparam.perfstepsend <= MESHCONST_MESHEDGES) return TCL_OK; - if (perfstepsstart <= MESHCONST_MESHSURFACE) + if (mparam.perfstepsstart <= MESHCONST_MESHSURFACE) { MeshSurface (geom, *mesh, mparam); if (multithread.terminate) return TCL_OK; @@ -791,11 +790,11 @@ namespace netgen mesh->CalcSurfacesOfNode(); } - if (multithread.terminate || perfstepsend <= MESHCONST_OPTSURFACE) + if (multithread.terminate || mparam.perfstepsend <= MESHCONST_OPTSURFACE) return TCL_OK; - if (perfstepsstart <= MESHCONST_MESHVOLUME) + if (mparam.perfstepsstart <= MESHCONST_MESHVOLUME) { multithread.task = "Volume meshing"; @@ -826,11 +825,11 @@ namespace netgen #endif } - if (multithread.terminate || perfstepsend <= MESHCONST_MESHVOLUME) + if (multithread.terminate || mparam.perfstepsend <= MESHCONST_MESHVOLUME) return TCL_OK; - if (perfstepsstart <= MESHCONST_OPTVOLUME) + if (mparam.perfstepsstart <= MESHCONST_OPTVOLUME) { multithread.task = "Volume optimization"; diff --git a/libsrc/csg/python_csg.cpp b/libsrc/csg/python_csg.cpp index afc4836a..fefc6604 100644 --- a/libsrc/csg/python_csg.cpp +++ b/libsrc/csg/python_csg.cpp @@ -626,7 +626,7 @@ DLL_HEADER void ExportCSG(py::module &m) geo->FindIdenticSurfaces(1e-8 * geo->MaxSize()); try { - geo->GenerateMesh (dummy, param, 0, 6); + geo->GenerateMesh (dummy, param); } catch (NgException ex) { diff --git a/libsrc/geom2d/geometry2d.cpp b/libsrc/geom2d/geometry2d.cpp index 8d51d9bf..00f588e4 100644 --- a/libsrc/geom2d/geometry2d.cpp +++ b/libsrc/geom2d/geometry2d.cpp @@ -986,8 +986,7 @@ namespace netgen MeshingParameters & mp); - int SplineGeometry2d :: GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam, - int perfstepsstart, int perfstepsend) + int SplineGeometry2d :: GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam) { MeshFromSpline2D (*this, mesh, mparam); return 0; diff --git a/libsrc/geom2d/geometry2d.hpp b/libsrc/geom2d/geometry2d.hpp index 29bed482..9f8fc3c2 100644 --- a/libsrc/geom2d/geometry2d.hpp +++ b/libsrc/geom2d/geometry2d.hpp @@ -156,8 +156,7 @@ namespace netgen } - DLL_HEADER virtual int GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam, - int perfstepsstart, int perfstepsend); + DLL_HEADER virtual int GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam); void PartitionBoundary (MeshingParameters & mp, double h, Mesh & mesh2d); diff --git a/libsrc/geom2d/python_geom2d.cpp b/libsrc/geom2d/python_geom2d.cpp index ce72e81f..f39919e5 100644 --- a/libsrc/geom2d/python_geom2d.cpp +++ b/libsrc/geom2d/python_geom2d.cpp @@ -258,7 +258,7 @@ DLL_HEADER void ExportGeom2d(py::module &m) mesh->SetGeometry(self); SetGlobalMesh (mesh); ng_geometry = self; - self->GenerateMesh(mesh, mparam, 0, 0); + self->GenerateMesh(mesh, mparam); return mesh; })) diff --git a/libsrc/meshing/basegeom.cpp b/libsrc/meshing/basegeom.cpp index b531481a..94558633 100644 --- a/libsrc/meshing/basegeom.cpp +++ b/libsrc/meshing/basegeom.cpp @@ -14,12 +14,11 @@ namespace netgen - int NetgenGeometry :: GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam, - int perfstepsstart, int perfstepsend) + int NetgenGeometry :: GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam) { if (!mesh) return 1; - if (perfstepsstart <= MESHCONST_MESHVOLUME) + if (mparam.perfstepsstart <= MESHCONST_MESHVOLUME) { multithread.task = "Volume meshing"; @@ -37,11 +36,11 @@ namespace netgen } - if (multithread.terminate || perfstepsend <= MESHCONST_MESHVOLUME) + if (multithread.terminate || mparam.perfstepsend <= MESHCONST_MESHVOLUME) return 0; - if (perfstepsstart <= MESHCONST_OPTVOLUME) + if (mparam.perfstepsstart <= MESHCONST_OPTVOLUME) { multithread.task = "Volume optimization"; diff --git a/libsrc/meshing/basegeom.hpp b/libsrc/meshing/basegeom.hpp index a9592cbf..eaf12c70 100644 --- a/libsrc/meshing/basegeom.hpp +++ b/libsrc/meshing/basegeom.hpp @@ -18,8 +18,7 @@ namespace netgen public: virtual ~NetgenGeometry () { ; } - virtual int GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam, - int perfstepsstart, int perfstepsend); + virtual int GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam); virtual const Refinement & GetRefinement () const; diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index fb6e66f0..e46b17c9 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -1091,6 +1091,11 @@ namespace netgen double elsizeweight = 0.2; /// init with default values + /// start at step + int perfstepsstart = 0; + /// end at step + int perfstepsend = 6; + /// from mp3: /// give up quality class, 2d meshing diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index f8507890..1e72a5e5 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -590,19 +590,23 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) py::class_ (m, "MeshingParameters") .def(py::init<>()) .def("__init__", - [](MP *instance, double maxh, bool quad_dominated, int optsteps2d, int optsteps3d) + [](MP *instance, double maxh, bool quad_dominated, int optsteps2d, int optsteps3d, + int perfstepsstart, int perfstepsend) { new (instance) MeshingParameters; instance->maxh = maxh; instance->quad = int(quad_dominated); instance->optsteps2d = optsteps2d; instance->optsteps3d = optsteps3d; + instance->perfstepsstart = perfstepsstart; + instance->perfstepsend = perfstepsend; }, py::arg("maxh")=1000, py::arg("quad_dominated")=false, py::arg("optsteps2d") = 3, - py::arg("optsteps3d") = 3 - , + py::arg("optsteps3d") = 3, + py::arg("perfstepsstart") = 0, + py::arg("perfstepsend") = 6, "create meshing parameters" ) .def("__str__", &ToString) diff --git a/libsrc/occ/occgenmesh.cpp b/libsrc/occ/occgenmesh.cpp index 4b361ab5..f0ca2501 100644 --- a/libsrc/occ/occgenmesh.cpp +++ b/libsrc/occ/occgenmesh.cpp @@ -1273,12 +1273,11 @@ namespace netgen - int OCCGenerateMesh (OCCGeometry & geom, shared_ptr & mesh, MeshingParameters & mparam, - int perfstepsstart, int perfstepsend) + int OCCGenerateMesh (OCCGeometry & geom, shared_ptr & mesh, MeshingParameters & mparam) { multithread.percent = 0; - if (perfstepsstart <= MESHCONST_ANALYSE) + if (mparam.perfstepsstart <= MESHCONST_ANALYSE) { // delete mesh; // mesh = make_shared(); @@ -1287,10 +1286,10 @@ namespace netgen OCCSetLocalMeshSize(geom,*mesh); } - if (multithread.terminate || perfstepsend <= MESHCONST_ANALYSE) + if (multithread.terminate || mparam.perfstepsend <= MESHCONST_ANALYSE) return TCL_OK; - if (perfstepsstart <= MESHCONST_MESHEDGES) + if (mparam.perfstepsstart <= MESHCONST_MESHEDGES) { OCCFindEdges (geom, *mesh); @@ -1360,12 +1359,12 @@ namespace netgen #endif } - if (multithread.terminate || perfstepsend <= MESHCONST_MESHEDGES) + if (multithread.terminate || mparam.perfstepsend <= MESHCONST_MESHEDGES) return TCL_OK; - if (perfstepsstart <= MESHCONST_MESHSURFACE) + if (mparam.perfstepsstart <= MESHCONST_MESHSURFACE) { - OCCMeshSurface (geom, *mesh, perfstepsend); + OCCMeshSurface (geom, *mesh, mparam.perfstepsend); if (multithread.terminate) return TCL_OK; #ifdef LOG_STREAM @@ -1384,10 +1383,10 @@ namespace netgen mesh->CalcSurfacesOfNode(); } - if (multithread.terminate || perfstepsend <= MESHCONST_OPTSURFACE) + if (multithread.terminate || mparam.perfstepsend <= MESHCONST_OPTSURFACE) return TCL_OK; - if (perfstepsstart <= MESHCONST_MESHVOLUME) + if (mparam.perfstepsstart <= MESHCONST_MESHVOLUME) { multithread.task = "Volume meshing"; @@ -1426,10 +1425,10 @@ namespace netgen #endif } - if (multithread.terminate || perfstepsend <= MESHCONST_MESHVOLUME) + if (multithread.terminate || mparam.perfstepsend <= MESHCONST_MESHVOLUME) return TCL_OK; - if (perfstepsstart <= MESHCONST_OPTVOLUME) + if (mparam.perfstepsstart <= MESHCONST_OPTVOLUME) { multithread.task = "Volume optimization"; diff --git a/libsrc/occ/occgeom.cpp b/libsrc/occ/occgeom.cpp index f2527d9c..1a6b8a46 100644 --- a/libsrc/occ/occgeom.cpp +++ b/libsrc/occ/occgeom.cpp @@ -1564,10 +1564,9 @@ namespace netgen - int OCCGeometry :: GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam, - int perfstepsstart, int perfstepsend) + int OCCGeometry :: GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam) { - return OCCGenerateMesh (*this, mesh, mparam, perfstepsstart, perfstepsend); + return OCCGenerateMesh (*this, mesh, mparam); } diff --git a/libsrc/occ/occgeom.hpp b/libsrc/occ/occgeom.hpp index de725ef4..9e79c2a1 100644 --- a/libsrc/occ/occgeom.hpp +++ b/libsrc/occ/occgeom.hpp @@ -387,8 +387,7 @@ namespace netgen // void WriteOCC_STL(char * filename); - DLL_HEADER virtual int GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam, - int perfstepsstart, int perfstepsend); + DLL_HEADER virtual int GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam); DLL_HEADER virtual const Refinement & GetRefinement () const; }; diff --git a/libsrc/stlgeom/stlgeom.cpp b/libsrc/stlgeom/stlgeom.cpp index 48f64c55..91f3ab22 100644 --- a/libsrc/stlgeom/stlgeom.cpp +++ b/libsrc/stlgeom/stlgeom.cpp @@ -91,10 +91,9 @@ void STLGeometry :: Save (string filename) const -int STLGeometry :: GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam, - int perfstepsstart, int perfstepsend) +int STLGeometry :: GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam) { - return STLMeshingDummy (this, mesh, mparam, perfstepsstart, perfstepsend); + return STLMeshingDummy (this, mesh, mparam); } diff --git a/libsrc/stlgeom/stlgeom.hpp b/libsrc/stlgeom/stlgeom.hpp index 1f34eb65..59a3342e 100644 --- a/libsrc/stlgeom/stlgeom.hpp +++ b/libsrc/stlgeom/stlgeom.hpp @@ -452,8 +452,7 @@ namespace netgen friend class MeshingSTLSurface; - virtual int GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam, - int perfstepsstart, int perfstepsend); + virtual int GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam); virtual const Refinement & GetRefinement () const; }; @@ -463,8 +462,7 @@ namespace netgen - extern int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr & mesh, MeshingParameters & mparam, - int perfstepsstart, int perfstepsend); + extern int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr & mesh, MeshingParameters & mparam); } diff --git a/libsrc/stlgeom/stlgeommesh.cpp b/libsrc/stlgeom/stlgeommesh.cpp index 31b8b0be..cfe2c115 100644 --- a/libsrc/stlgeom/stlgeommesh.cpp +++ b/libsrc/stlgeom/stlgeommesh.cpp @@ -1329,16 +1329,15 @@ void STLGeometry :: RestrictHChartDistOneChart(int chartnum, Array& acttrig } -int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr & mesh, MeshingParameters & mparam, - int perfstepsstart, int perfstepsend) +int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr & mesh, MeshingParameters & mparam) { - if (perfstepsstart > perfstepsend) return 0; + if (mparam.perfstepsstart > mparam.perfstepsend) return 0; multithread.terminate = 0; int success = 1; //int trialcntouter = 0; - if (perfstepsstart <= MESHCONST_MESHEDGES) + if (mparam.perfstepsstart <= MESHCONST_MESHEDGES) { if (mesh) mesh -> DeleteMesh(); @@ -1368,8 +1367,8 @@ int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr & mesh, MeshingP if (multithread.terminate) return 0; - if (perfstepsstart <= MESHCONST_MESHSURFACE && - perfstepsend >= MESHCONST_MESHSURFACE) + if (mparam.perfstepsstart <= MESHCONST_MESHSURFACE && + mparam.perfstepsend >= MESHCONST_MESHSURFACE) { if (!stlgeometry->edgesfound) @@ -1417,8 +1416,8 @@ int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr & mesh, MeshingP if (success) { - if (perfstepsstart <= MESHCONST_OPTSURFACE && - perfstepsend >= MESHCONST_OPTSURFACE) + if (mparam.perfstepsstart <= MESHCONST_OPTSURFACE && + mparam.perfstepsend >= MESHCONST_OPTSURFACE) { if (!stlgeometry->edgesfound) { @@ -1469,8 +1468,8 @@ int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr & mesh, MeshingP if (multithread.terminate) return 0; - if (perfstepsstart <= MESHCONST_MESHVOLUME && - perfstepsend >= MESHCONST_MESHVOLUME) + if (mparam.perfstepsstart <= MESHCONST_MESHVOLUME && + mparam.perfstepsend >= MESHCONST_MESHVOLUME) { if (stlgeometry->volumemeshed) { @@ -1540,8 +1539,8 @@ int STLMeshingDummy (STLGeometry* stlgeometry, shared_ptr & mesh, MeshingP if (multithread.terminate) return 0; - if (perfstepsstart <= MESHCONST_OPTVOLUME && - perfstepsend >= MESHCONST_OPTVOLUME) + if (mparam.perfstepsstart <= MESHCONST_OPTVOLUME && + mparam.perfstepsend >= MESHCONST_OPTVOLUME) { if (!stlgeometry->edgesfound) { diff --git a/ng/ngpkg.cpp b/ng/ngpkg.cpp index e01087ca..8a534211 100644 --- a/ng/ngpkg.cpp +++ b/ng/ngpkg.cpp @@ -1328,8 +1328,9 @@ namespace netgen // vsmesh.SetMesh (mesh); SetGlobalMesh (mesh); mesh -> SetGeometry(ng_geometry); - - int res = ng_geometry -> GenerateMesh (mesh, mparam, perfstepsstart, perfstepsend); + mparam.perfstepsstart = perfstepsstart; + mparam.perfstepsend = perfstepsend; + int res = ng_geometry -> GenerateMesh (mesh, mparam); if (res != MESHING3_OK) { From f582c7935f2caae80f64a7bed203fb7e916ea925 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Mon, 5 Dec 2016 14:31:12 +0100 Subject: [PATCH 3/4] remove perfstepsstart from python interface --- libsrc/meshing/python_mesh.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index 1e72a5e5..69e5d5d4 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -591,21 +591,19 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) .def(py::init<>()) .def("__init__", [](MP *instance, double maxh, bool quad_dominated, int optsteps2d, int optsteps3d, - int perfstepsstart, int perfstepsend) + int perfstepsend) { new (instance) MeshingParameters; instance->maxh = maxh; instance->quad = int(quad_dominated); instance->optsteps2d = optsteps2d; instance->optsteps3d = optsteps3d; - instance->perfstepsstart = perfstepsstart; instance->perfstepsend = perfstepsend; }, py::arg("maxh")=1000, py::arg("quad_dominated")=false, py::arg("optsteps2d") = 3, py::arg("optsteps3d") = 3, - py::arg("perfstepsstart") = 0, py::arg("perfstepsend") = 6, "create meshing parameters" ) From bd39b8df8811d8c98a95350197ada4cbb07d8061 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Mon, 5 Dec 2016 14:39:09 +0100 Subject: [PATCH 4/4] export enum MeshingStep --- libsrc/meshing/python_mesh.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index 69e5d5d4..ba85c585 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -586,12 +586,18 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) ; + py::enum_(m,"MeshingStep") + .value("MESHEDGES",MESHCONST_MESHEDGES) + .value("MESHSURFACE",MESHCONST_OPTSURFACE) + .value("MESHVOLUME",MESHCONST_OPTVOLUME) + ; + typedef MeshingParameters MP; py::class_ (m, "MeshingParameters") .def(py::init<>()) .def("__init__", [](MP *instance, double maxh, bool quad_dominated, int optsteps2d, int optsteps3d, - int perfstepsend) + MESHING_STEP perfstepsend) { new (instance) MeshingParameters; instance->maxh = maxh; @@ -604,7 +610,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) py::arg("quad_dominated")=false, py::arg("optsteps2d") = 3, py::arg("optsteps3d") = 3, - py::arg("perfstepsend") = 6, + py::arg("perfstepsend") = MESHCONST_OPTVOLUME, "create meshing parameters" ) .def("__str__", &ToString)