From f82ea24a8ac88ede0316f105ff5bd3297f337d57 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Mon, 18 Nov 2013 09:16:11 +0000 Subject: [PATCH] second order elements with STL --- libsrc/stlgeom/stlgeom.cpp | 12 ++++++++---- libsrc/stlgeom/stlgeom.hpp | 2 ++ libsrc/stlgeom/stltopology.cpp | 7 +++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/libsrc/stlgeom/stlgeom.cpp b/libsrc/stlgeom/stlgeom.cpp index 0017c07c..795a2713 100644 --- a/libsrc/stlgeom/stlgeom.cpp +++ b/libsrc/stlgeom/stlgeom.cpp @@ -41,6 +41,7 @@ void STLMeshing (STLGeometry & geom, lineendpoints(), spiralpoints(), selectedmultiedge() */ { + ref = NULL; edgedata = new STLEdgeDataList(*this); externaledges.SetSize(0); Clear(); @@ -61,6 +62,7 @@ void STLMeshing (STLGeometry & geom, STLGeometry :: ~STLGeometry() { delete edgedata; + delete ref; } void STLGeometry :: Save (string filename) const @@ -98,7 +100,11 @@ int STLGeometry :: GenerateMesh (Mesh*& mesh, MeshingParameters & mparam, const Refinement & STLGeometry :: GetRefinement () const { - return RefinementSTLGeometry (*this); + delete ref; + ref = new RefinementSTLGeometry(*this); + // ref -> Set2dOptimizer(new MeshOptimizeSTLSurface(*this)); ??? copied from CSG + return *ref; + } @@ -3072,13 +3078,11 @@ void STLGeometry :: BuildSmoothEdges () for (int j = 1; j <= 3; j++) { int nbt = NeighbourTrig (i, j); - + ng2 = GetTriangle(nbt).GeomNormal(points); ng2 /= (ng2.Length() + 1e-24); - int pi1, pi2; - trig.GetNeighbourPoints(GetTriangle(nbt), pi1, pi2); if (!IsEdge(pi1,pi2)) diff --git a/libsrc/stlgeom/stlgeom.hpp b/libsrc/stlgeom/stlgeom.hpp index 85ae157f..d064e2d7 100644 --- a/libsrc/stlgeom/stlgeom.hpp +++ b/libsrc/stlgeom/stlgeom.hpp @@ -160,6 +160,8 @@ namespace netgen Vec<3> ex, ey, ez; Point<3> p1; + mutable class RefinementSTLGeometry * ref; + public: int edgesfound; int surfacemeshed; diff --git a/libsrc/stlgeom/stltopology.cpp b/libsrc/stlgeom/stltopology.cpp index c00299e2..d4efa612 100644 --- a/libsrc/stlgeom/stltopology.cpp +++ b/libsrc/stlgeom/stltopology.cpp @@ -409,6 +409,13 @@ STLGeometry * STLTopology ::Load (istream & ist) if (readtrigs.Size() % 100000 == 0) PrintMessageCR (3, readtrigs.Size(), " triangles loaded\r"); } + else + { + cout << "Skipping flat triangle " + << "l1 = " << Dist(pts[0], pts[1]) + << ", l2 = " << Dist(pts[0], pts[2]) + << ", l3 = " << Dist(pts[2], pts[1]) << endl; + } } }