mesh object allocation

This commit is contained in:
Joachim Schoeberl 2014-09-25 22:09:21 +00:00
parent 4dda85ac90
commit 0a260bc053
4 changed files with 18 additions and 16 deletions

View File

@ -239,7 +239,7 @@ AM_CONDITIONAL([NGPYTHON], [test x$pythonon = xtrue])
# echo "libs = $LIBS" # echo "libs = $LIBS"
# echo "TOGL_LIB = $MYTOGL_LIB" # 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 AC_CONFIG_FILES(Makefile libsrc/Makefile libsrc/csg/Makefile
libsrc/general/Makefile libsrc/geom2d/Makefile libsrc/gprim/Makefile libsrc/general/Makefile libsrc/geom2d/Makefile libsrc/gprim/Makefile

View File

@ -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) 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 if NGGUI
bin_PROGRAMS = netgen bin_PROGRAMS = netgen

View File

@ -238,7 +238,6 @@ namespace netgen
MyMPI_SendCmd ("mesh"); MyMPI_SendCmd ("mesh");
mesh -> Distribute(); mesh -> Distribute();
#endif #endif
for (int i = 0; i < geometryregister.Size(); i++) for (int i = 0; i < geometryregister.Size(); i++)
{ {
NetgenGeometry * hgeom = geometryregister[i]->LoadFromMeshFile (*infile); NetgenGeometry * hgeom = geometryregister[i]->LoadFromMeshFile (*infile);
@ -1274,9 +1273,13 @@ namespace netgen
else else
*/ */
{ {
/*
Mesh * hmesh = NULL; Mesh * hmesh = NULL;
int res = ng_geometry -> GenerateMesh (hmesh, mparam, perfstepsstart, perfstepsend); int res = ng_geometry -> GenerateMesh (hmesh, mparam, perfstepsstart, perfstepsend);
mesh = shared_ptr<Mesh> (hmesh); mesh = shared_ptr<Mesh> (hmesh);
*/
mesh = make_shared<Mesh> ();
int res = ng_geometry -> GenerateMesh (mesh, mparam, perfstepsstart, perfstepsend);
// int res = ng_geometry -> GenerateMesh (mesh.Ptr(), mparam, perfstepsstart, perfstepsend); // int res = ng_geometry -> GenerateMesh (mesh.Ptr(), mparam, perfstepsstart, perfstepsend);
if (res != MESHING3_OK) if (res != MESHING3_OK)

View File

@ -28,7 +28,7 @@
namespace netgen { namespace netgen {
extern void MeshFromSpline2D (SplineGeometry2d & geometry, extern void MeshFromSpline2D (SplineGeometry2d & geometry,
Mesh *& mesh, shared_ptr<Mesh> & mesh,
MeshingParameters & mp); MeshingParameters & mp);
} }
@ -502,8 +502,6 @@ namespace nglib
} }
DLL_HEADER Ng_Result Ng_GenerateMesh_2D (Ng_Geometry_2D * geom, DLL_HEADER Ng_Result Ng_GenerateMesh_2D (Ng_Geometry_2D * geom,
Ng_Mesh ** mesh, Ng_Mesh ** mesh,
Ng_Meshing_Parameters * mp) Ng_Meshing_Parameters * mp)
@ -512,12 +510,13 @@ namespace nglib
// MeshingParameters mparam; // MeshingParameters mparam;
mp->Transfer_Parameters(); mp->Transfer_Parameters();
Mesh * m; shared_ptr<Mesh> m;
MeshFromSpline2D (*(SplineGeometry2d*)geom, m, mparam); MeshFromSpline2D (*(SplineGeometry2d*)geom, m, mparam);
new shared_ptr<Mesh> (m); // hack to keep mesh m alive
cout << m->GetNSE() << " elements, " << m->GetNP() << " points" << endl; cout << m->GetNSE() << " elements, " << m->GetNP() << " points" << endl;
*mesh = (Ng_Mesh*)m; *mesh = (Ng_Mesh*)m.get();
return NG_OK; return NG_OK;
} }