From 0a260bc0531fc31e03dd527534c0b0dc32fcedc2 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Thu, 25 Sep 2014 22:09:21 +0000 Subject: [PATCH] mesh object allocation --- configure.ac | 2 +- ng/Makefile.am | 2 +- ng/ngpkg.cpp | 7 +++++-- nglib/nglib.cpp | 23 +++++++++++------------ 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index 72542762..265bfb49 100644 --- a/configure.ac +++ b/configure.ac @@ -239,7 +239,7 @@ AM_CONDITIONAL([NGPYTHON], [test x$pythonon = xtrue]) # echo "libs = $LIBS" # echo "TOGL_LIB = $MYTOGL_LIB" -AC_CONFIG_SUBDIRS([ng/Togl-1.7]) +# AC_CONFIG_SUBDIRS([ng/Togl-1.7]) AC_CONFIG_FILES(Makefile libsrc/Makefile libsrc/csg/Makefile libsrc/general/Makefile libsrc/geom2d/Makefile libsrc/gprim/Makefile diff --git a/ng/Makefile.am b/ng/Makefile.am index 913e681f..05403dff 100644 --- a/ng/Makefile.am +++ b/ng/Makefile.am @@ -2,7 +2,7 @@ include_HEADERS = AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include -I$(top_srcdir)/libsrc/interface -DOPENGL -D$(TOGL_WINDOWINGSYSTEM) $(TCL_INCLUDES) $(MPI_INCLUDES) $(FFMPEG_INCLUDES) $(JPEGLIB_INCLUDES) -SUBDIRS = Togl-1.7 +# SUBDIRS = Togl-1.7 if NGGUI bin_PROGRAMS = netgen diff --git a/ng/ngpkg.cpp b/ng/ngpkg.cpp index f6d1cb5b..66a4e19f 100644 --- a/ng/ngpkg.cpp +++ b/ng/ngpkg.cpp @@ -238,7 +238,6 @@ namespace netgen MyMPI_SendCmd ("mesh"); mesh -> Distribute(); #endif - for (int i = 0; i < geometryregister.Size(); i++) { NetgenGeometry * hgeom = geometryregister[i]->LoadFromMeshFile (*infile); @@ -1274,9 +1273,13 @@ namespace netgen else */ { + /* Mesh * hmesh = NULL; - int res = ng_geometry -> GenerateMesh (hmesh, mparam, perfstepsstart, perfstepsend); + int res = ng_geometry -> GenerateMesh (hmesh, mparam, perfstepsstart, perfstepsend); mesh = shared_ptr (hmesh); + */ + mesh = make_shared (); + int res = ng_geometry -> GenerateMesh (mesh, mparam, perfstepsstart, perfstepsend); // int res = ng_geometry -> GenerateMesh (mesh.Ptr(), mparam, perfstepsstart, perfstepsend); if (res != MESHING3_OK) diff --git a/nglib/nglib.cpp b/nglib/nglib.cpp index 34c20836..1e62d35a 100644 --- a/nglib/nglib.cpp +++ b/nglib/nglib.cpp @@ -28,7 +28,7 @@ namespace netgen { extern void MeshFromSpline2D (SplineGeometry2d & geometry, - Mesh *& mesh, + shared_ptr & mesh, MeshingParameters & mp); } @@ -502,8 +502,6 @@ namespace nglib } - - DLL_HEADER Ng_Result Ng_GenerateMesh_2D (Ng_Geometry_2D * geom, Ng_Mesh ** mesh, Ng_Meshing_Parameters * mp) @@ -512,12 +510,13 @@ namespace nglib // MeshingParameters mparam; mp->Transfer_Parameters(); - Mesh * m; + shared_ptr m; MeshFromSpline2D (*(SplineGeometry2d*)geom, m, mparam); + new shared_ptr (m); // hack to keep mesh m alive cout << m->GetNSE() << " elements, " << m->GetNP() << " points" << endl; - *mesh = (Ng_Mesh*)m; + *mesh = (Ng_Mesh*)m.get(); return NG_OK; } @@ -1241,11 +1240,11 @@ void Ng_InitSolutionData (Ng_SolutionData * soldata) { ; } #ifdef NG_PYTHON -#include -void ExportNetgenMeshing(); -void ExportCSG(); -BOOST_PYTHON_MODULE(nglib) { - ExportCSG(); - ExportNetgenMeshing(); +#include +void ExportNetgenMeshing(); +void ExportCSG(); +BOOST_PYTHON_MODULE(nglib) { + ExportCSG(); + ExportNetgenMeshing(); } -#endif \ No newline at end of file +#endif