From 6cdaec8ece903be5d098b233dfdb6a03e9700d00 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Tue, 23 Mar 2010 12:52:07 +0000 Subject: [PATCH] meshing from surface mesh bug fix --- libsrc/csg/csgeom.hpp | 2 +- libsrc/meshing/Makefile.am | 6 ++--- libsrc/meshing/basegeom.cpp | 51 +++++++++++++++++++++++++++++++++++++ libsrc/meshing/basegeom.hpp | 9 +++++-- ng/ngpkg.cpp | 9 +++++-- nglib/cube.surf | 1 + 6 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 libsrc/meshing/basegeom.cpp diff --git a/libsrc/csg/csgeom.hpp b/libsrc/csg/csgeom.hpp index bb8676b1..831713a0 100644 --- a/libsrc/csg/csgeom.hpp +++ b/libsrc/csg/csgeom.hpp @@ -146,7 +146,7 @@ namespace netgen public: CSGeometry (); CSGeometry (const string & afilename); - ~CSGeometry (); + virtual ~CSGeometry (); void Clean (); diff --git a/libsrc/meshing/Makefile.am b/libsrc/meshing/Makefile.am index 373d13d4..1d0a9be6 100644 --- a/libsrc/meshing/Makefile.am +++ b/libsrc/meshing/Makefile.am @@ -9,7 +9,7 @@ validate.hpp classifyhpel.hpp hpref_hex.hpp improve2.hpp meshtool.hpp \ clusters.hpp hprefinement.hpp improve3.hpp meshtype.hpp \ hpref_prism.hpp localh.hpp msghandler.hpp curvedelems.hpp \ hpref_pyramid.hpp meshclass.hpp ruler2.hpp bcfunctions.hpp \ - basegeom.hpp + basegeom.hpp @@ -24,5 +24,5 @@ libmesh_la_SOURCES = adfront2.cpp adfront3.cpp bisect.cpp boundarylayer.cpp \ pyramid2rls.cpp pyramidrls.cpp quadrls.cpp refine.cpp \ ruler2.cpp ruler3.cpp secondorder.cpp smoothing2.5.cpp \ smoothing2.cpp smoothing3.cpp specials.cpp tetrarls.cpp \ - topology.cpp triarls.cpp validate.cpp zrefine.cpp bcfunctions.cpp \ - parallelmesh.cpp paralleltop.cpp paralleltop.hpp + topology.cpp triarls.cpp validate.cpp zrefine.cpp bcfunctions.cpp \ + parallelmesh.cpp paralleltop.cpp paralleltop.hpp basegeom.cpp diff --git a/libsrc/meshing/basegeom.cpp b/libsrc/meshing/basegeom.cpp new file mode 100644 index 00000000..7ec75809 --- /dev/null +++ b/libsrc/meshing/basegeom.cpp @@ -0,0 +1,51 @@ +#include +#include "meshing.hpp" + +namespace netgen +{ + + + int NetgenGeometry :: GenerateMesh (Mesh*& mesh, + int perfstepsstart, int perfstepsend, char* optstring) + { + if (!mesh) return 1; + + if (perfstepsstart <= MESHCONST_MESHVOLUME) + { + multithread.task = "Volume meshing"; + + MESHING3_RESULT res = + MeshVolume (mparam, *mesh); + + if (res != MESHING3_OK) return 1; + + if (multithread.terminate) return 0; + + RemoveIllegalElements (*mesh); + if (multithread.terminate) return 0; + + MeshQuality3d (*mesh); + } + + + if (multithread.terminate || perfstepsend <= MESHCONST_MESHVOLUME) + return 0; + + + if (perfstepsstart <= MESHCONST_OPTVOLUME) + { + multithread.task = "Volume optimization"; + + OptimizeVolume (mparam, *mesh); + if (multithread.terminate) return 0; + } + + return 0; + } + + + const Refinement & NetgenGeometry :: GetRefinement () const + { + return *new Refinement;; + } +} diff --git a/libsrc/meshing/basegeom.hpp b/libsrc/meshing/basegeom.hpp index 709cdb5c..bf3f8bb0 100644 --- a/libsrc/meshing/basegeom.hpp +++ b/libsrc/meshing/basegeom.hpp @@ -14,10 +14,15 @@ public: virtual ~NetgenGeometry () { ; } virtual int GenerateMesh (Mesh*& mesh, - int perfstepsstart, int perfstepsend, char* optstring) = 0; + int perfstepsstart, int perfstepsend, char* optstring); - virtual const Refinement & GetRefinement () const = 0; + virtual const Refinement & GetRefinement () const; }; + + + + + #endif diff --git a/ng/ngpkg.cpp b/ng/ngpkg.cpp index d2a992aa..223dcbed 100644 --- a/ng/ngpkg.cpp +++ b/ng/ngpkg.cpp @@ -183,7 +183,7 @@ namespace netgen OCCGeometry * occgeometry = NULL; #endif - NetgenGeometry * ng_geometry; + NetgenGeometry * ng_geometry = new NetgenGeometry; Tcl_Interp * tcl_interp; @@ -2149,7 +2149,12 @@ namespace netgen else { int res = ng_geometry -> GenerateMesh (mesh.Ptr(), perfstepsstart, perfstepsend, optstringcsg); - if (res != MESHING3_OK) return 0; + if (res != MESHING3_OK) + { + multithread.task = savetask; + multithread.running = 0; + return 0; + } } if (mparam.autozrefine && ( (NetgenGeometry*)geometry.Ptr() == ng_geometry)) diff --git a/nglib/cube.surf b/nglib/cube.surf index 1fee858b..48cb136e 100644 --- a/nglib/cube.surf +++ b/nglib/cube.surf @@ -1,3 +1,4 @@ +xxx 8 0 0 0 1 0 0