diff --git a/libsrc/csg/edgeflw.cpp b/libsrc/csg/edgeflw.cpp index 30ac3b8..acbfd70 100644 --- a/libsrc/csg/edgeflw.cpp +++ b/libsrc/csg/edgeflw.cpp @@ -1157,6 +1157,7 @@ namespace netgen seg.tlosurf = -1; //seg.surfnr1 = s1_rep; //seg.surfnr2 = s2_rep; + seg.surfnr = lsi; seg.surfnr1 = s1; seg.surfnr2 = s2; refedges.Append (seg); @@ -1410,6 +1411,7 @@ namespace netgen seg.domout = refedges.Get(k).domout; seg.tlosurf = refedges.Get(k).tlosurf; seg.edgenr = refedges.Get(k).edgenr; + seg.surfnr = refedges.Get(k).surfnr; seg.surfnr1 = refedges.Get(k).surfnr1; seg.surfnr2 = refedges.Get(k).surfnr2; seg.seginfo = 0; @@ -1578,6 +1580,7 @@ namespace netgen seg.domout = refedges.Get(k).domout; seg.tlosurf = refedges.Get(k).tlosurf; seg.edgenr = refedges.Get(k).edgenr; + seg.surfnr = refedges.Get(k).surfnr; seg.surfnr1 = refedges.Get(k).surfnr1; seg.surfnr2 = refedges.Get(k).surfnr2; seg.seginfo = 0; @@ -1709,6 +1712,7 @@ namespace netgen seg.domout = refedges.Get(k).domout; seg.tlosurf = refedges.Get(k).tlosurf; seg.edgenr = refedges.Get(k).edgenr; + seg.surfnr = refedges.Get(k).surfnr; seg.surfnr1 = refedges.Get(k).surfnr1; seg.surfnr2 = refedges.Get(k).surfnr2; seg.seginfo = 0; diff --git a/libsrc/csg/genmesh.cpp b/libsrc/csg/genmesh.cpp index 4683c4e..3f60f58 100644 --- a/libsrc/csg/genmesh.cpp +++ b/libsrc/csg/genmesh.cpp @@ -86,6 +86,7 @@ namespace netgen for (int k = 1; k <= mesh.GetNFD(); k++) if (mesh.GetFaceDescriptor(k).SegmentFits (mesh.LineSegment(i))) { + mesh.GetFaceDescriptor(k).UpdateSurfNr_orig (mesh.LineSegment(i)); ok = k; //(*testout) << "fits to " << k << endl; } @@ -423,6 +424,7 @@ namespace netgen Meshing2Surfaces meshing(*surf, mparam, geom.BoundingBox()); + meshing.SetLocHSurface(geom.GetSurface(mesh.GetFaceDescriptor(k).SurfNr_orig())); meshing.SetStartTime (starttime); double eps = 1e-8 * geom.MaxSize(); diff --git a/libsrc/csg/meshsurf.cpp b/libsrc/csg/meshsurf.cpp index 54a70af..ac888d1 100644 --- a/libsrc/csg/meshsurf.cpp +++ b/libsrc/csg/meshsurf.cpp @@ -17,7 +17,7 @@ Meshing2Surfaces :: Meshing2Surfaces (const Surface & asurface) Meshing2Surfaces :: Meshing2Surfaces (const Surface & asurf, const MeshingParameters & mp, const Box<3> & abb) - : Meshing2(mp, abb), surface(asurf), mparam (mp) + : Meshing2(mp, abb), surface(asurf), loch_surface(0), mparam (mp) { ; } @@ -58,6 +58,7 @@ int Meshing2Surfaces :: TransformFromPlain (Point2d & planepoint, double Meshing2Surfaces :: CalcLocalH (const Point3d & p, double gh) const { + if (loch_surface) return loch_surface->LocH (p, 3, 1, mparam, gh); return surface.LocH (p, 3, 1, mparam, gh); /* double loch = mesh.lochfunc->GetH(p); diff --git a/libsrc/csg/meshsurf.hpp b/libsrc/csg/meshsurf.hpp index 39fb24b..54ed984 100644 --- a/libsrc/csg/meshsurf.hpp +++ b/libsrc/csg/meshsurf.hpp @@ -9,6 +9,7 @@ namespace netgen { /// const Surface & surface; + const Surface * loch_surface; /// should be movec to base ... const MeshingParameters & mparam; @@ -18,6 +19,7 @@ namespace netgen /// Meshing2Surfaces (const Surface & asurf, const MeshingParameters & mp, const Box<3> & aboundingbox); + void SetLocHSurface(const Surface * surf) { loch_surface = surf; } protected: /// diff --git a/libsrc/meshing/meshtype.cpp b/libsrc/meshing/meshtype.cpp index cdfa7c7..90c56b3 100644 --- a/libsrc/meshing/meshtype.cpp +++ b/libsrc/meshing/meshtype.cpp @@ -73,6 +73,7 @@ namespace netgen domout = -1; tlosurf = -1; + surfnr = -1; surfnr1 = -1; surfnr2 = -1; pnums[2] = -1; @@ -101,6 +102,7 @@ namespace netgen domout(other.domout), tlosurf(other.tlosurf), geominfo(), + surfnr(other.surfnr), surfnr1(other.surfnr1), surfnr2(other.surfnr2), epgeominfo(), @@ -134,6 +136,7 @@ namespace netgen tlosurf = other.tlosurf; geominfo[0] = other.geominfo[0]; geominfo[1] = other.geominfo[1]; + surfnr = other.surfnr; surfnr1 = other.surfnr1; surfnr2 = other.surfnr2; epgeominfo[0] = other.epgeominfo[0]; @@ -2351,6 +2354,7 @@ namespace netgen FaceDescriptor :: FaceDescriptor() { surfnr = domin = domout = bcprop = 0; + surfnr_orig = -1; domin_singular = domout_singular = 0.; // Philippose - 06/07/2009 // Initialise surface colour @@ -2361,7 +2365,8 @@ namespace netgen } FaceDescriptor :: FaceDescriptor(const FaceDescriptor& other) - : surfnr(other.surfnr), domin(other.domin), domout(other.domout), + : surfnr(other.surfnr), surfnr_orig(other.surfnr_orig), + domin(other.domin), domout(other.domout), tlosurf(other.tlosurf), bcprop(other.bcprop), surfcolour(other.surfcolour), bcname(other.bcname), domin_singular(other.domin_singular), domout_singular(other.domout_singular) @@ -2373,6 +2378,7 @@ namespace netgen FaceDescriptor(int surfnri, int domini, int domouti, int tlosurfi) { surfnr = surfnri; + surfnr_orig = -1; domin = domini; domout = domouti; // Philippose - 06/07/2009 @@ -2388,6 +2394,7 @@ namespace netgen FaceDescriptor :: FaceDescriptor(const Segment & seg) { surfnr = seg.si; + surfnr_orig = seg.surfnr; domin = seg.domin+1; domout = seg.domout+1; // Philippose - 06/07/2009 @@ -2400,7 +2407,7 @@ namespace netgen firstelement = -1; } - int FaceDescriptor :: SegmentFits (const Segment & seg) + int FaceDescriptor :: SegmentFits (const Segment & seg) const { return surfnr == seg.si && @@ -2409,6 +2416,12 @@ namespace netgen tlosurf == seg.tlosurf+1; } + void FaceDescriptor :: UpdateSurfNr_orig (const Segment & seg) + { + if (surfnr_orig != seg.surfnr) + surfnr_orig = -1; + } + string FaceDescriptor :: default_bcname = "default"; /* const string & FaceDescriptor :: GetBCName () const diff --git a/libsrc/meshing/meshtype.hpp b/libsrc/meshing/meshtype.hpp index 5fe1d8a..da8560a 100644 --- a/libsrc/meshing/meshtype.hpp +++ b/libsrc/meshing/meshtype.hpp @@ -976,6 +976,8 @@ namespace netgen /// PointGeomInfo geominfo[2]; + /// possible original surface, -1 if not available + int surfnr; /// surfaces describing edge int surfnr1, surfnr2; /// @@ -1078,6 +1080,8 @@ namespace netgen { /// which surface, 0 if not available int surfnr; + /// possible original surface, -1 if not available + int surfnr_orig; /// domain nr inside int domin; /// domain nr outside @@ -1108,9 +1112,11 @@ namespace netgen DLL_HEADER FaceDescriptor(const FaceDescriptor& other); DLL_HEADER ~FaceDescriptor() { ; } - DLL_HEADER int SegmentFits (const Segment & seg); + DLL_HEADER int SegmentFits (const Segment & seg) const; + DLL_HEADER void UpdateSurfNr_orig (const Segment & seg); int SurfNr () const { return surfnr; } + int SurfNr_orig () const { return surfnr_orig >= 0 ? surfnr_orig : surfnr; } int DomainIn () const { return domin; } int DomainOut () const { return domout; } int TLOSurface () const { return tlosurf; }