From 46aa7858288d374cd0288d75e44b5c9717f545f9 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Fri, 5 Dec 2014 15:58:49 +0000 Subject: [PATCH] fix SetMaxH in python --- libsrc/csg/algprim.cpp | 10 ++++++++++ libsrc/csg/algprim.hpp | 6 +++++- libsrc/csg/csgeom.cpp | 2 +- libsrc/csg/edgeflw.cpp | 12 +++++------- libsrc/csg/python_csg.cpp | 2 +- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/libsrc/csg/algprim.cpp b/libsrc/csg/algprim.cpp index 17dff2fe..4ab7ee9a 100644 --- a/libsrc/csg/algprim.cpp +++ b/libsrc/csg/algprim.cpp @@ -95,6 +95,12 @@ namespace netgen return new Plane (p, n); } + void Plane :: Print (ostream & ost) const + { + ost << "plane(" << p << "; " << n << ")"; + } + + void Plane :: Transform (Transformation<3> & trans) { Point<3> hp; @@ -828,6 +834,10 @@ namespace netgen return new Cylinder (a, b, r); } + void Cylinder :: Print (ostream & ost) const + { + ost << "cylinder(" << a << "; " << b << "; " << r << ")"; + } int Cylinder :: IsIdentic (const Surface & s2, int & inv, double eps) const { diff --git a/libsrc/csg/algprim.hpp b/libsrc/csg/algprim.hpp index 8d7ca839..c71dc8c2 100644 --- a/libsrc/csg/algprim.hpp +++ b/libsrc/csg/algprim.hpp @@ -44,7 +44,7 @@ namespace netgen virtual Point<3> GetSurfacePoint () const; - virtual void Print (ostream & ist) const; + virtual void Print (ostream & str) const; virtual void Read (istream & ist); void PrintCoeff (ostream & ost) const; }; @@ -70,6 +70,8 @@ namespace netgen static Primitive * CreateDefault (); virtual Primitive * Copy () const; + virtual void Print (ostream & str) const; + virtual void Transform (Transformation<3> & trans); @@ -190,6 +192,8 @@ namespace netgen static Primitive * CreateDefault (); virtual Primitive * Copy () const; + virtual void Print (ostream & str) const; + virtual void Transform (Transformation<3> & trans); /// diff --git a/libsrc/csg/csgeom.cpp b/libsrc/csg/csgeom.cpp index dfa9128b..917993a5 100644 --- a/libsrc/csg/csgeom.cpp +++ b/libsrc/csg/csgeom.cpp @@ -511,7 +511,7 @@ namespace netgen void CSGeometry :: AddSurface (char * name, Surface * surf) { - (*testout) << "Adding surface " << name << endl; + (*testout) << "Adding surface " << name << ": " << (*surf) << endl; surfaces.Set (name, surf); surf->SetName (name); changeval++; diff --git a/libsrc/csg/edgeflw.cpp b/libsrc/csg/edgeflw.cpp index d567532b..0a3ff1bc 100644 --- a/libsrc/csg/edgeflw.cpp +++ b/libsrc/csg/edgeflw.cpp @@ -41,9 +41,8 @@ namespace netgen PrintMessage (1, "Find edges"); PushStatus ("Find edges"); - for (int i = 1; i <= mesh.GetNP(); i++) - meshpoint_tree->Insert (mesh.Point(i), i); - + for (PointIndex pi : mesh.Points().Range()) + meshpoint_tree->Insert (mesh[pi], pi); // add all special points before edge points (important for periodic identification) // JS, Jan 2007 @@ -63,6 +62,7 @@ namespace netgen meshpoint_tree -> Insert (p, pi); } } + /* // slow version @@ -856,11 +856,9 @@ namespace netgen if (uselocalh) { double lh = mesh.GetH(np); - if (lh < loch) - loch = lh; + if (lh < loch) loch = lh; } - - + len += Dist (p, np) / loch; edgepoints.Append (np); curvelength.Append (len); diff --git a/libsrc/csg/python_csg.cpp b/libsrc/csg/python_csg.cpp index 87292f2d..86658d2c 100644 --- a/libsrc/csg/python_csg.cpp +++ b/libsrc/csg/python_csg.cpp @@ -93,7 +93,7 @@ public: } } - void SetMaxH(int amaxh) + void SetMaxH(double amaxh) { if (maxh == -1) {