1 diff -NaurwB netgen-5.3.1_orig/Makefile.in netgen-5.3.1_new/Makefile.in
2 --- netgen-5.3.1_orig/Makefile.in 2014-10-06 15:04:37.000000000 +0400
3 +++ netgen-5.3.1_new/Makefile.in 2016-10-03 16:17:10.164707368 +0300
5 top_srcdir = @top_srcdir@
6 ACLOCAL_AMFLAGS = -I m4
8 -SUBDIRS = libsrc ng tutorials doc windows nglib
9 +SUBDIRS = libsrc nglib #tutorials doc windows nglib
11 $(MAKE) $(AM_MAKEFLAGS) all-recursive
13 diff -NaurwB netgen-5.3.1_orig/configure.ac netgen-5.3.1_new/configure.ac
14 --- netgen-5.3.1_orig/configure.ac 2014-10-06 15:00:17.000000000 +0400
15 +++ netgen-5.3.1_new/configure.ac 2016-09-29 14:34:11.957389447 +0300
18 if test a$occon = atrue ; then
20 - AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I$occdir/inc -I/usr/include/opencascade"])
21 - AC_SUBST([OCCLIBS], ["-L$occdir/lib -lTKernel -lTKGeomBase -lTKMath -lTKG2d -lTKG3d -lTKXSBase -lTKOffset -lTKFillet -lTKShHealing -lTKMesh -lTKMeshVS -lTKTopAlgo -lTKGeomAlgo -lTKBool -lTKPrim -lTKBO -lTKIGES -lTKBRep -lTKSTEPBase -lTKSTEP -lTKSTL -lTKSTEPAttr -lTKSTEP209 -lTKXDESTEP -lTKXDEIGES -lTKXCAF -lTKLCAF -lFWOSPlugin"])
22 + AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I$occdir/include/opencascade"])
23 + AC_SUBST([OCCLIBS], ["-L$occdir/lib -lTKernel -lTKGeomBase -lTKMath -lTKG2d -lTKG3d -lTKXSBase -lTKOffset -lTKFillet -lTKShHealing -lTKMesh -lTKMeshVS -lTKTopAlgo -lTKGeomAlgo -lTKBool -lTKPrim -lTKBO -lTKIGES -lTKBRep -lTKSTEPBase -lTKSTEP -lTKSTL -lTKSTEPAttr -lTKSTEP209 -lTKXDESTEP -lTKXDEIGES -lTKXCAF -lTKLCAF"])
24 AC_SUBST([OCCLIBS], ["-L$occdir/lib -lTKernel -lTKGeomBase -lTKMath -lTKG2d -lTKG3d -lTKXSBase -lTKOffset -lTKFillet -lTKShHealing -lTKMesh -lTKMeshVS -lTKTopAlgo -lTKGeomAlgo -lTKBool -lTKPrim -lTKBO -lTKIGES -lTKBRep -lTKSTEPBase -lTKSTEP -lTKSTL -lTKSTEPAttr -lTKSTEP209 -lTKXDESTEP -lTKXDEIGES -lTKXCAF -lTKLCAF -lFWOSPlugin"])
27 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/findip.hpp netgen-5.3.1_new/libsrc/meshing/findip.hpp
28 --- netgen-5.3.1_orig/libsrc/meshing/findip.hpp 2014-08-29 13:54:05.000000000 +0400
29 +++ netgen-5.3.1_new/libsrc/meshing/findip.hpp 2016-09-30 20:38:56.662234111 +0300
31 static int timer = NgProfiler::CreateTimer ("FindInnerPoint");
32 NgProfiler::RegionTimer reg (timer);
34 + if ( points.Size() < 3 )
40 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/improve3.cpp netgen-5.3.1_new/libsrc/meshing/improve3.cpp
41 --- netgen-5.3.1_orig/libsrc/meshing/improve3.cpp 2014-08-29 13:54:05.000000000 +0400
42 +++ netgen-5.3.1_new/libsrc/meshing/improve3.cpp 2016-10-03 16:16:57.636639300 +0300
49 for (int l = 2; l < nsuround; l++)
51 @@ -1239,10 +1240,12 @@
54 suroundpts[l] = newpi;
60 + if ( nbtetused < nsuround )
64 for (int k = 0; k < nsuround; k++)
65 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/meshtype.cpp netgen-5.3.1_new/libsrc/meshing/meshtype.cpp
66 --- netgen-5.3.1_orig/libsrc/meshing/meshtype.cpp 2014-08-29 13:54:05.000000000 +0400
67 +++ netgen-5.3.1_new/libsrc/meshing/meshtype.cpp 2016-09-29 14:04:51.500148293 +0300
70 +#include <float.h> // to get DBL_MIN defined
72 #include "meshing.hpp"
76 double det = trans.Det();
80 + if (det <= DBL_MIN) // avoid FPE
83 err += frob * frob / det;
86 double det = trans(0,0)*trans(1,1)-trans(1,0)*trans(0,1);
90 + if (det <= DBL_MIN) // avoid FPE
95 = dtrans(0,0) * trans(1,1) - trans(0,1) * dtrans(1,0)
96 + trans(0,0) * dtrans(1,1) - dtrans(0,1) * trans(1,0);
100 + if (det <= DBL_MIN) // avoid FPE
107 double det = trans.Det();
110 + if (det <= DBL_MIN) // avoid FPE
113 err += frob * frob / det;
114 @@ -1864,7 +1869,8 @@
118 - if (noz == 0.0) noz = 1e-10;
119 + //if (noz == 0.0) noz = 1e-10;
120 + if (noz <= DBL_MIN) noz = 1e-10; // avoid FPE
122 double xi = p(0) / noz;
123 double eta = p(1) / noz;
124 @@ -2030,7 +2036,8 @@
126 double det = -trans.Det();
130 + if (det <= DBL_MIN) // avoid FPE
133 err += frob * frob * frob / det;
134 @@ -2102,7 +2109,8 @@
140 + if (det <= DBL_MIN) // avoid FPE
144 @@ -2184,7 +2192,7 @@
149 + if (det <= DBL_MIN)
153 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/meshtype.hpp netgen-5.3.1_new/libsrc/meshing/meshtype.hpp
154 --- netgen-5.3.1_orig/libsrc/meshing/meshtype.hpp 2014-08-29 13:54:05.000000000 +0400
155 +++ netgen-5.3.1_new/libsrc/meshing/meshtype.hpp 2016-09-30 14:28:09.147575801 +0300
160 +class Mesh; // added due to compilation errors on some platforms
167 if (typ != QUAD && typ != QUAD6 && typ != QUAD8)
168 - PrintSysError ("element2d::GetNV not implemented for typ", typ)
169 + PrintSysError ("element2d::GetNV not implemented for typ", typ);
177 - PrintSysError ("Element3d::GetNV not implemented for typ ", typ)
178 + PrintSysError ("Element3d::GetNV not implemented for typ ", typ);
183 case PRISM12: return 5;
186 - PrintSysError ("element3d::GetNFaces not implemented for typ", typ)
187 + PrintSysError ("element3d::GetNFaces not implemented for typ", typ);
191 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.cxx netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.cxx
192 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.cxx 2014-08-29 13:54:03.000000000 +0400
193 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.cxx 2016-09-29 14:44:01.996464598 +0300
195 #include <TopOpeBRep_EdgesIntersector.hxx>
196 #include <TopOpeBRep_Point2d.hxx>
197 #include <TopTools_ListIteratorOfListOfShape.hxx>
198 -#include <TopTools_ListOfShape.hxx>
199 #include <TopTools_MapIteratorOfMapOfShape.hxx>
200 -#include <TopTools_MapOfShape.hxx>
201 #include <TopoDS.hxx>
202 #include <TopoDS_Edge.hxx>
203 #include <TopoDS_Vertex.hxx>
204 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.hxx
205 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.hxx 2014-08-29 13:54:03.000000000 +0400
206 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.hxx 2016-09-29 14:44:01.996464598 +0300
208 #ifndef _Partition_Inter2d_HeaderFile
209 #define _Partition_Inter2d_HeaderFile
211 -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile
212 +#include <Standard_Version.hxx>
214 +#if OCC_VERSION_MAJOR < 7
215 #include <Handle_BRepAlgo_AsDes.hxx>
217 #ifndef _Standard_Real_HeaderFile
219 #ifndef _Standard_Boolean_HeaderFile
220 #include <Standard_Boolean.hxx>
223 +#include <TopTools_MapOfShape.hxx>
224 +#include <TopTools_ListOfShape.hxx>
226 class BRepAlgo_AsDes;
228 -class TopTools_MapOfShape;
230 -class TopTools_ListOfShape;
234 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.cxx netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.cxx
235 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.cxx 2014-08-29 13:54:03.000000000 +0400
236 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.cxx 2016-09-29 14:44:02.000464619 +0300
238 #include <TopOpeBRepTool_BoxSort.hxx>
239 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
240 #include <TopTools_ListIteratorOfListOfShape.hxx>
241 -#include <TopTools_ListOfShape.hxx>
242 #include <TopoDS.hxx>
243 #include <TopoDS_Compound.hxx>
244 #include <TopoDS_Edge.hxx>
246 Handle (Geom_Surface) S = BRep_Tool::Surface(F,L);
248 if (S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
249 - S = (*(Handle_Geom_RectangularTrimmedSurface*)&S)->BasisSurface();
250 + S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface();
252 if (!S->IsUPeriodic() && !S->IsVPeriodic())
254 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.hxx
255 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.hxx 2014-08-29 13:54:03.000000000 +0400
256 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.hxx 2016-09-29 14:44:02.000464619 +0300
258 #ifndef _Partition_Inter3d_HeaderFile
259 #define _Partition_Inter3d_HeaderFile
261 -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile
262 +#include <Standard_Version.hxx>
264 +#if OCC_VERSION_MAJOR < 7
265 #include <Handle_BRepAlgo_AsDes.hxx>
267 #ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile
269 #ifndef _TopTools_MapOfShape_HeaderFile
270 #include <TopTools_MapOfShape.hxx>
272 +#ifndef _TopTools_ListOfShape_HeaderFile
273 +#include <TopTools_ListOfShape.hxx>
275 #ifndef _TopTools_DataMapOfShapeShape_HeaderFile
276 #include <TopTools_DataMapOfShapeShape.hxx>
279 #include <Standard_Boolean.hxx>
281 class BRepAlgo_AsDes;
282 -class TopTools_ListOfShape;
283 -class TopTools_DataMapOfShapeShape;
285 -class TopTools_MapOfShape;
290 void FacesPartition(const TopoDS_Face& F1,const TopoDS_Face& F2) ;
291 Standard_Boolean IsDone(const TopoDS_Face& F1,const TopoDS_Face& F2) const;
292 TopTools_MapOfShape& TouchedFaces() ;
293 - Handle_BRepAlgo_AsDes AsDes() const;
294 + Handle(BRepAlgo_AsDes) AsDes() const;
295 TopTools_MapOfShape& NewEdges() ;
296 Standard_Boolean HasSameDomainF(const TopoDS_Shape& F) const;
297 Standard_Boolean IsSameDomainF(const TopoDS_Shape& F1,const TopoDS_Shape& F2) const;
298 const TopTools_ListOfShape& SameDomain(const TopoDS_Face& F) const;
299 TopoDS_Vertex ReplaceSameDomainV(const TopoDS_Vertex& V,const TopoDS_Edge& E) const;
300 - Handle_BRepAlgo_AsDes SectionEdgesAD() const;
301 + Handle(BRepAlgo_AsDes) SectionEdgesAD() const;
302 Standard_Boolean IsSectionEdge(const TopoDS_Edge& E) const;
303 Standard_Boolean HasSectionEdge(const TopoDS_Face& F) const;
304 Standard_Boolean IsSplitOn(const TopoDS_Edge& NewE,const TopoDS_Edge& OldE,const TopoDS_Face& F) const;
305 @@ -121,11 +123,11 @@
309 - Handle_BRepAlgo_AsDes myAsDes;
310 + Handle(BRepAlgo_AsDes) myAsDes;
311 TopTools_DataMapOfShapeListOfShape myDone;
312 TopTools_MapOfShape myTouched;
313 TopTools_MapOfShape myNewEdges;
314 - Handle_BRepAlgo_AsDes mySectionEdgesAD;
315 + Handle(BRepAlgo_AsDes) mySectionEdgesAD;
316 TopTools_DataMapOfShapeListOfShape mySameDomainFM;
317 TopTools_DataMapOfShapeShape mySameDomainVM;
319 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop.hxx netgen-5.3.1_new/libsrc/occ/Partition_Loop.hxx
320 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop.hxx 2014-08-29 13:54:03.000000000 +0400
321 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop.hxx 2016-09-29 14:44:02.000464619 +0300
326 -class TopTools_ListOfShape;
329 #ifndef _Standard_HeaderFile
330 #include <Standard.hxx>
331 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.cxx netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.cxx
332 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.cxx 2014-08-29 13:54:03.000000000 +0400
333 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.cxx 2016-09-29 14:04:51.504148314 +0300
335 Cc->D1(uc, PC, CTg1);
336 if (!isForward) CTg1.Reverse();
338 - Standard_Real anglemin = 3 * PI, tolAng = 1.e-8;
339 + Standard_Real anglemin = 3 * M_PI, tolAng = 1.e-8;
341 // select an edge whose first derivative is most left of CTg1
342 // ie an angle between Tg1 and CTg1 is least
345 Standard_Real angle = Tg1.Angle(CTg1);
347 - if (PI - Abs(angle) <= tolAng)
348 + if (M_PI - Abs(angle) <= tolAng)
350 // an angle is too close to PI; assure that an angle sign really
351 // reflects an edge position: +PI - an edge is worst,
352 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.hxx
353 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.hxx 2014-08-29 13:54:03.000000000 +0400
354 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.hxx 2016-09-29 14:44:02.000464619 +0300
359 -class TopTools_ListOfShape;
360 class BRepAlgo_Image;
363 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop3d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Loop3d.hxx
364 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop3d.hxx 2014-08-29 13:54:03.000000000 +0400
365 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop3d.hxx 2016-09-29 14:44:02.000464619 +0300
367 #ifndef _TopTools_ListOfShape_HeaderFile
368 #include <TopTools_ListOfShape.hxx>
370 +#ifndef _TopTools_MapOfOrientedShape_HeaderFile
371 +#include <TopTools_MapOfOrientedShape.hxx>
373 #ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile
374 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
377 #include <Standard_Real.hxx>
380 -class TopTools_ListOfShape;
381 -class TopTools_MapOfOrientedShape;
385 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.cxx netgen-5.3.1_new/libsrc/occ/Partition_Spliter.cxx
386 --- netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.cxx 2014-08-29 13:54:03.000000000 +0400
387 +++ netgen-5.3.1_new/libsrc/occ/Partition_Spliter.cxx 2016-09-29 14:44:02.000464619 +0300
389 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
390 #include <TopTools_IndexedMapOfShape.hxx>
391 #include <TopTools_ListIteratorOfListOfShape.hxx>
392 -#include <TopTools_ListOfShape.hxx>
393 #include <TopTools_MapIteratorOfMapOfShape.hxx>
394 #include <TopTools_SequenceOfShape.hxx>
396 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.hxx netgen-5.3.1_new/libsrc/occ/Partition_Spliter.hxx
397 --- netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.hxx 2014-08-29 13:54:03.000000000 +0400
398 +++ netgen-5.3.1_new/libsrc/occ/Partition_Spliter.hxx 2016-09-29 14:44:02.004464639 +0300
400 #ifndef _TopTools_DataMapOfShapeShape_HeaderFile
401 #include <TopTools_DataMapOfShapeShape.hxx>
403 -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile
404 -#include <Handle_BRepAlgo_AsDes.hxx>
406 #ifndef _BRepAlgo_Image_HeaderFile
407 #include <BRepAlgo_Image.hxx>
411 class BRepAlgo_AsDes;
413 -class TopTools_ListOfShape;
418 TopTools_DataMapOfShapeShape myFaceShapeMap;
419 TopTools_DataMapOfShapeShape myInternalFaces;
420 TopTools_DataMapOfShapeShape myIntNotClFaces;
421 - Handle_BRepAlgo_AsDes myAsDes;
422 + Handle(BRepAlgo_AsDes) myAsDes;
423 BRepAlgo_Image myImagesFaces;
424 BRepAlgo_Image myImagesEdges;
425 BRepAlgo_Image myImageShape;
426 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occconstruction.cpp netgen-5.3.1_new/libsrc/occ/occconstruction.cpp
427 --- netgen-5.3.1_orig/libsrc/occ/occconstruction.cpp 2014-08-29 13:54:03.000000000 +0400
428 +++ netgen-5.3.1_new/libsrc/occ/occconstruction.cpp 2016-09-29 14:04:51.500148293 +0300
430 #include <BRepAlgoAPI_Common.hxx>
431 #include <BRepAlgoAPI_Fuse.hxx>
432 #include <BRepAlgoAPI_Section.hxx>
433 -#include <BRepOffsetAPI_Sewing.hxx>
434 +//#include <BRepOffsetAPI_Sewing.hxx>
435 //#include <BRepAlgo_Sewing.hxx>
436 #include <BRepOffsetAPI_MakeOffsetShape.hxx>
437 #include <ShapeFix_Shape.hxx>
438 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occgenmesh.cpp netgen-5.3.1_new/libsrc/occ/occgenmesh.cpp
439 --- netgen-5.3.1_orig/libsrc/occ/occgenmesh.cpp 2014-08-29 13:54:03.000000000 +0400
440 +++ netgen-5.3.1_new/libsrc/occ/occgenmesh.cpp 2016-09-29 14:04:51.500148293 +0300
442 if(h < 1e-4*maxside)
\r
446 - if (h > 30) return;
\r
447 + // commented to restrict H on a large sphere for example
448 + //if (h > 30) return;
451 if (h < maxside && depth < 10)
\r
454 pnt = c->Value(s0);
\r
456 - double olddist = 0;
\r
458 + //double olddist = 0; -- useless variables
461 int tmpVal = (int)(DIVIDEEDGESECTIONS);
\r
463 @@ -259,15 +259,19 @@
466 pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0));
\r
467 + // -- no more than 1 segment per <edge length>/DIVIDEEDGESECTIONS
468 hvalue[i] = hvalue[i-1] +
\r
469 + // 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
470 + // pnt.Distance(oldpnt);
472 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
\r
473 - pnt.Distance(oldpnt);
\r
474 + pnt.Distance(oldpnt));
476 //(*testout) << "mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z())) " << mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))
\r
477 // << " pnt.Distance(oldpnt) " << pnt.Distance(oldpnt) << endl;
\r
480 - dist = pnt.Distance(oldpnt);
\r
481 + //olddist = dist; -- useless variables
482 + //dist = pnt.Distance(oldpnt);
485 // nsubedges = int(ceil(hvalue[DIVIDEEDGESECTIONS]));
\r
488 if (hvalue[i1]/hvalue[DIVIDEEDGESECTIONS]*nsubedges >= i)
\r
490 - params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
\r
491 + // -- for nsubedges comparable to DIVIDEEDGESECTIONS
492 + //params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
493 + double d1 = i1 - (hvalue[i1] - i*hvalue[DIVIDEEDGESECTIONS]/nsubedges)/(hvalue[i1]-hvalue[i1-1]);
494 + params[i] = s0+(d1/double(DIVIDEEDGESECTIONS))*(s1-s0);
495 pnt = c->Value(params[i]);
\r
496 ps[i-1] = MeshPoint (Point3d(pnt.X(), pnt.Y(), pnt.Z()));
\r
499 (*testout) << "nedges = " << nedges << endl;
\r
501 double eps = 1e-6 * geom.GetBoundingBox().Diam();
\r
502 + const double eps2 = eps * eps; // -- small optimization
504 + int first_vp = mesh.GetNP()+1; // -- to support SALOME sub-meshes
506 for (int i = 1; i <= nvertices; i++)
\r
511 for (PointIndex pi = 1; pi <= mesh.GetNP(); pi++)
\r
512 - if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
\r
513 + //if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
514 + if ( Dist2 (mesh[pi], Point<3>(mp)) < eps2 ) // -- small optimization
520 TopoDS_Face face = TopoDS::Face(exp1.Current());
\r
521 int facenr = geom.fmap.FindIndex(face);
\r
522 + if ( facenr < 1 ) continue; // -- to support SALOME sub-meshes
524 if (face2solid[0][facenr-1] == 0)
\r
525 face2solid[0][facenr-1] = solidnr;
\r
530 + edgenr = mesh.GetNSeg(); // to support SALOME sub-meshes
532 (*testout) << "faces = " << geom.fmap.Extent() << endl;
\r
535 //(*testout) << "ignoring degenerated edge" << endl;
\r
538 + if ( geom.emap.FindIndex(edge) < 1 ) continue; // to support SALOME sub-meshes
540 if (geom.vmap.FindIndex(TopExp::FirstVertex (edge)) ==
\r
541 geom.vmap.FindIndex(TopExp::LastVertex (edge)))
\r
542 @@ -477,20 +491,104 @@
546 - pnums[0] = geom.vmap.FindIndex (TopExp::FirstVertex (edge));
\r
547 - pnums[pnums.Size()-1] = geom.vmap.FindIndex (TopExp::LastVertex (edge));
\r
548 + //pnums[0] = geom.vmap.FindIndex (TopExp::FirstVertex (edge));
549 + //pnums[pnums.Size()-1] = geom.vmap.FindIndex (TopExp::LastVertex (edge));
550 + MeshPoint dfltP ( Point<3> ( 0, 0, 0 ) );
551 + int *ipp[] = { &pnums[0], &pnums[pnums.Size()-1] };
552 + TopoDS_Iterator vIt( edge, false );
553 + TopoDS_Vertex v[2];
554 + v[0] = TopoDS::Vertex( vIt.Value() ); vIt.Next();
555 + v[1] = TopoDS::Vertex( vIt.Value() );
556 + if ( v[0].Orientation() == TopAbs_REVERSED )
557 + std::swap( v[0], v[1] );
558 + for ( int i = 0; i < 2; ++i)
561 + ip = geom.vmap.FindIndex ( v[i] );
562 + if ( ip == 0 || ip > nvertices )
566 + ip = iv = geom.vmap.Add( v[i] );
567 + gp_Pnt pnt = BRep_Tool::Pnt( v[i] );
568 + MeshPoint mp( Point<3>(pnt.X(), pnt.Y(), pnt.Z()) );
569 + for (PointIndex pi = 1; pi < first_vp; pi++)
570 + if ( Dist2 (mesh.Point(pi), Point<3>(mp)) < 1e-100 )
573 + if ( mesh.Point(ip).GetLayer() != dfltP.GetLayer() && mesh.Point(ip).GetLayer() != iv )
575 + if ( mesh.Point(ip).GetLayer() == dfltP.GetLayer())
576 + mesh.Point(ip) = MeshPoint( mesh.Point(ip), iv );
582 - Point<3> fp = occ2ng (BRep_Tool::Pnt (TopExp::FirstVertex (edge)));
\r
583 - Point<3> lp = occ2ng (BRep_Tool::Pnt (TopExp::LastVertex (edge)));
\r
584 + ip += first_vp - 1;
590 + TopoDS_Iterator vIt( edge, false );
591 + TopoDS_Vertex v1 = TopoDS::Vertex( vIt.Value() ); vIt.Next();
592 + TopoDS_Vertex v2 = TopoDS::Vertex( vIt.Value() );
593 + if ( v1.Orientation() == TopAbs_REVERSED )
594 + std::swap( v1, v2 );
595 + const bool isClosedEdge = v1.IsSame( v2 );
597 + Point<3> fp = occ2ng (BRep_Tool::Pnt (v1));
598 + Point<3> lp = occ2ng (BRep_Tool::Pnt (v2));
599 + double tol2 = std::min( eps*eps, 1e-6 * Dist2( fp, lp ));
600 + if ( isClosedEdge )
601 + tol2 = BRep_Tool::Tolerance( v1 ) * BRep_Tool::Tolerance( v1 );
605 for (PointIndex pi = 1; pi < first_ep; pi++)
\r
607 - if (Dist2 (mesh[pi], fp) < eps*eps) pnums[0] = pi;
\r
608 - if (Dist2 (mesh[pi], lp) < eps*eps) pnums.Last() = pi;
\r
609 + if (Dist2 (mesh[pi], fp) < tol2) pnums[0] = pi;
610 + if (Dist2 (mesh[pi], lp) < tol2) pnums.Last() = pi;
612 + if (( isClosedEdge && pnums[0] != pnums.Last() ) ||
613 + ( !isClosedEdge && pnums[0] == pnums.Last() ))
614 + pnums[0] = pnums.Last() = -1;
615 + if ( pnums[0] == -1 || pnums.Last() == -1 )
617 + // take into account a possible large gap between a vertex and an edge curve
618 + // end and a large vertex tolerance covering the whole edge
619 + if ( pnums[0] == -1 )
621 + double tol = BRep_Tool::Tolerance( v1 );
622 + for (PointIndex pi = 1; pi < first_ep; pi++)
623 + if (pi != pnums.Last() && Dist2 (mesh[pi], fp) < 2*tol*tol)
626 + if ( pnums[0] == -1 )
627 + pnums[0] = first_ep-1- nvertices + geom.vmap.FindIndex ( v1 );
629 + if ( isClosedEdge )
631 + pnums.Last() = pnums[0];
635 + if ( pnums.Last() == -1 )
637 + double tol = BRep_Tool::Tolerance( v2 );
638 + for (PointIndex pi = 1; pi < first_ep; pi++)
639 + if (pi != pnums[0] && Dist2 (mesh[pi], lp) < 2*tol*tol)
642 + if ( pnums.Last() == -1 )
643 + pnums.Last() = first_ep-1-nvertices + geom.vmap.FindIndex ( v2 );
646 + if ( Dist2( fp, mesh[PointIndex(pnums[0])]) >
647 + Dist2( lp, mesh[PointIndex(pnums.Last())]))
648 + std::swap( pnums[0], pnums.Last() );
653 @@ -500,17 +598,20 @@
656 for (j = first_ep; j <= mesh.GetNP(); j++)
\r
658 + if (!merge_solids && mesh.Point(j).GetLayer() != geomedgenr ) continue; // to support SALOME fuse edges
659 if ((mesh.Point(j)-Point<3>(mp[i-1])).Length() < eps)
\r
670 - mesh.AddPoint (mp[i-1]);
\r
671 + mesh.AddPoint (mp[i-1], geomedgenr); // to support SALOME fuse edges
672 (*testout) << "add meshpoint " << mp[i-1] << endl;
\r
673 pnums[i] = mesh.GetNP();
\r
676 // (*testout) << "edge " << mesh.LineSegment(i).edgenr << " face " << mesh.LineSegment(i).si
\r
677 // << " p1 " << mesh.LineSegment(i)[0] << " p2 " << mesh.LineSegment(i)[1] << endl;
\r
679 + for (int j = 1; j <= mesh.GetNP(); j++) // to support SALOME fuse edges: set level to zero
680 + mesh.Point(j) = MeshPoint( (Point<3>&) mesh.Point(j) );
682 mesh.CalcSurfacesOfNode();
\r
683 multithread.task = savetask;
\r
684 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occgeom.cpp netgen-5.3.1_new/libsrc/occ/occgeom.cpp
685 --- netgen-5.3.1_orig/libsrc/occ/occgeom.cpp 2014-08-29 13:54:03.000000000 +0400
686 +++ netgen-5.3.1_new/libsrc/occ/occgeom.cpp 2016-09-29 16:22:31.636328123 +0300
688 #include "ShapeAnalysis_CheckSmallFace.hxx"
\r
689 #include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx"
\r
690 #include "ShapeAnalysis_Surface.hxx"
\r
691 +#include <BRepTopAdaptor_FClass2d.hxx> // -- to optimize Project() and FastProject()
692 +#include <TopAbs_State.hxx>
693 #include "BRepAlgoAPI_Fuse.hxx"
\r
694 #include "BRepCheck_Analyzer.hxx"
\r
695 #include "BRepLib.hxx"
\r
697 #include "ShapeFix_FixSmallFace.hxx"
\r
698 #include "Partition_Spliter.hxx"
\r
703 + // free data used to optimize Project() and FastProject()
704 + OCCGeometry::~OCCGeometry()
706 + NCollection_DataMap<int,BRepTopAdaptor_FClass2d*>::Iterator it(fclsmap);
707 + for (; it.More(); it.Next())
711 void OCCGeometry :: PrintNrShapes ()
\r
715 double surfacecont = 0;
\r
718 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
719 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
720 rebuild->Apply(shape);
\r
721 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
724 cout << endl << "- repairing faces" << endl;
\r
726 Handle(ShapeFix_Face) sff;
\r
727 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
728 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
729 rebuild->Apply(shape);
\r
736 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
737 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
738 rebuild->Apply(shape);
\r
739 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
742 cout << endl << "- fixing small edges" << endl;
\r
744 Handle(ShapeFix_Wire) sfw;
\r
745 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
746 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
747 rebuild->Apply(shape);
\r
754 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
755 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
756 rebuild->Apply(shape);
\r
758 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
763 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
764 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
765 rebuild->Apply(shape);
\r
766 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
772 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
773 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
774 rebuild->Apply(shape);
\r
775 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
778 TopoDS_Solid solid = TopoDS::Solid(exp0.Current());
\r
779 TopoDS_Solid newsolid = solid;
\r
780 BRepLib::OrientClosedSolid (newsolid);
\r
781 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
782 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
783 // rebuild->Apply(shape);
\r
784 rebuild->Replace(solid, newsolid, Standard_False);
\r
785 TopoDS_Shape newshape = rebuild->Apply(shape, TopAbs_COMPSOLID);//, 1);
\r
787 TopoDS_Solid solid = TopoDS::Solid(exp0.Current());
\r
788 TopoDS_Solid newsolid = solid;
\r
789 BRepLib::OrientClosedSolid (newsolid);
\r
790 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
791 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
792 rebuild->Replace(solid, newsolid, Standard_False);
\r
794 TopoDS_Shape newshape = rebuild->Apply(shape, TopAbs_SHAPE, 1);
\r
795 @@ -951,25 +960,58 @@
799 + // returns a projector and a classifier for the given surface
800 + void OCCGeometry::GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
801 + BRepTopAdaptor_FClass2d*& cls) const
803 + //MSV: organize caching projector in the map
804 + if (fprjmap.IsBound(surfi))
806 + proj = fprjmap.Find(surfi);
807 + cls = fclsmap.Find(surfi);
811 + const TopoDS_Face& aFace = TopoDS::Face(fmap(surfi));
812 + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
813 + proj = new ShapeAnalysis_Surface(aSurf);
814 + fprjmap.Bind(surfi, proj);
815 + cls = new BRepTopAdaptor_FClass2d(aFace,Precision::Confusion());
816 + fclsmap.Bind(surfi, cls);
821 - void OCCGeometry :: Project (int surfi, Point<3> & p) const
\r
822 + // void OCCGeometry :: Project (int surfi, Point<3> & p) const
823 + bool OCCGeometry :: Project (int surfi, Point<3> & p, double& u, double& v) const
825 static int cnt = 0;
\r
826 if (++cnt % 1000 == 0) cout << "Project cnt = " << cnt << endl;
\r
828 gp_Pnt pnt(p(0), p(1), p(2));
\r
831 - Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
\r
832 - Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
\r
833 - gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
\r
834 - suval.Coord( u, v);
\r
835 - pnt = thesurf->Value( u, v );
\r
836 + // -- Optimization: use cached projector and classifier
838 + // Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
839 + // Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
840 + // gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
841 + // suval.Coord( u, v);
842 + // pnt = thesurf->Value( u, v );
844 + Handle(ShapeAnalysis_Surface) proj;
845 + BRepTopAdaptor_FClass2d *cls;
846 + GetFaceTools(surfi, proj, cls);
848 + gp_Pnt2d p2d = proj->ValueOfUV(pnt, Precision::Confusion());
849 + if (cls->Perform(p2d) == TopAbs_OUT)
853 + pnt = proj->Value(p2d);
856 p = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
\r
862 @@ -979,54 +1021,69 @@
864 gp_Pnt p(ap(0), ap(1), ap(2));
\r
866 - Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
\r
868 - gp_Pnt x = surface->Value (u,v);
\r
870 - if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
\r
873 + // -- Optimization: use cached projector and classifier
874 + // Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
876 + // gp_Pnt x = surface->Value (u,v);
878 + // if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
882 + // surface->D1(u,v,x,du,dv);
888 + // double det, lambda, mu;
895 + // det = Det3 (n.X(), du.X(), dv.X(),
896 + // n.Y(), du.Y(), dv.Y(),
897 + // n.Z(), du.Z(), dv.Z());
899 + // if (det < 1e-15) return false;
901 + // lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
902 + // n.Y(), p.Y()-x.Y(), dv.Y(),
903 + // n.Z(), p.Z()-x.Z(), dv.Z())/det;
905 + // mu = Det3 (n.X(), du.X(), p.X()-x.X(),
906 + // n.Y(), du.Y(), p.Y()-x.Y(),
907 + // n.Z(), du.Z(), p.Z()-x.Z())/det;
913 + // surface->D1(u,v,x,du,dv);
915 + // } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
917 + // // (*testout) << "FastProject count: " << count << endl;
919 + // if (count == 50) return false;
921 + // ap = Point<3> (x.X(), x.Y(), x.Z());
922 + Handle(ShapeAnalysis_Surface) proj;
923 + BRepTopAdaptor_FClass2d *cls;
924 + GetFaceTools(surfi, proj, cls);
926 - surface->D1(u,v,x,du,dv);
\r
932 - double det, lambda, mu;
\r
939 - det = Det3 (n.X(), du.X(), dv.X(),
\r
940 - n.Y(), du.Y(), dv.Y(),
\r
941 - n.Z(), du.Z(), dv.Z());
\r
943 - if (det < 1e-15) return false;
\r
945 - lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
\r
946 - n.Y(), p.Y()-x.Y(), dv.Y(),
\r
947 - n.Z(), p.Z()-x.Z(), dv.Z())/det;
\r
949 - mu = Det3 (n.X(), du.X(), p.X()-x.X(),
\r
950 - n.Y(), du.Y(), p.Y()-x.Y(),
\r
951 - n.Z(), du.Z(), p.Z()-x.Z())/det;
\r
957 - surface->D1(u,v,x,du,dv);
\r
959 - } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
\r
961 - // (*testout) << "FastProject count: " << count << endl;
\r
963 - if (count == 50) return false;
\r
964 + gp_Pnt2d p2d = proj->NextValueOfUV(gp_Pnt2d(u,v), p, Precision::Confusion());
965 + if (cls->Perform(p2d) == TopAbs_OUT)
967 + //cout << "Projection fails" << endl;
971 - ap = Point<3> (x.X(), x.Y(), x.Z());
\r
972 + p = proj->Value(p2d);
974 + ap = Point<3> (p.X(), p.Y(), p.Z());
978 @@ -1038,9 +1095,9 @@
980 cout << "writing stl..."; cout.flush();
\r
981 StlAPI_Writer writer;
\r
982 - writer.RelativeMode() = Standard_False;
\r
983 + //writer.RelativeMode() = Standard_False;
985 - writer.SetDeflection(0.02);
\r
986 + //writer.SetDeflection(0.02);
987 writer.Write(shape,filename);
\r
989 cout << "done" << endl;
\r
990 @@ -1059,10 +1116,10 @@
991 occgeo = new OCCGeometry;
\r
993 // Initiate a dummy XCAF Application to handle the IGES XCAF Document
\r
994 - static Handle_XCAFApp_Application dummy_app = XCAFApp_Application::GetApplication();
\r
995 + static Handle(XCAFApp_Application) dummy_app = XCAFApp_Application::GetApplication();
997 // Create an XCAF Document to contain the IGES file itself
\r
998 - Handle_TDocStd_Document iges_doc;
\r
999 + Handle(TDocStd_Document) iges_doc;
1001 // Check if a IGES File is already open under this handle, if so, close it to prevent
\r
1002 // Segmentation Faults when trying to create a new document
\r
1003 @@ -1089,8 +1146,8 @@
1004 reader.Transfer(iges_doc);
\r
1006 // Read in the shape(s) and the colours present in the IGES File
\r
1007 - Handle_XCAFDoc_ShapeTool iges_shape_contents = XCAFDoc_DocumentTool::ShapeTool(iges_doc->Main());
\r
1008 - Handle_XCAFDoc_ColorTool iges_colour_contents = XCAFDoc_DocumentTool::ColorTool(iges_doc->Main());
\r
1009 + Handle(XCAFDoc_ShapeTool) iges_shape_contents = XCAFDoc_DocumentTool::ShapeTool(iges_doc->Main());
1010 + Handle(XCAFDoc_ColorTool) iges_colour_contents = XCAFDoc_DocumentTool::ColorTool(iges_doc->Main());
1012 TDF_LabelSequence iges_shapes;
\r
1013 iges_shape_contents->GetShapes(iges_shapes);
\r
1014 @@ -1137,10 +1194,10 @@
1015 occgeo = new OCCGeometry;
\r
1017 // Initiate a dummy XCAF Application to handle the STEP XCAF Document
\r
1018 - static Handle_XCAFApp_Application dummy_app = XCAFApp_Application::GetApplication();
\r
1019 + static Handle(XCAFApp_Application) dummy_app = XCAFApp_Application::GetApplication();
1021 // Create an XCAF Document to contain the STEP file itself
\r
1022 - Handle_TDocStd_Document step_doc;
\r
1023 + Handle(TDocStd_Document) step_doc;
1025 // Check if a STEP File is already open under this handle, if so, close it to prevent
\r
1026 // Segmentation Faults when trying to create a new document
\r
1027 @@ -1167,8 +1224,8 @@
1028 reader.Transfer(step_doc);
\r
1030 // Read in the shape(s) and the colours present in the STEP File
\r
1031 - Handle_XCAFDoc_ShapeTool step_shape_contents = XCAFDoc_DocumentTool::ShapeTool(step_doc->Main());
\r
1032 - Handle_XCAFDoc_ColorTool step_colour_contents = XCAFDoc_DocumentTool::ColorTool(step_doc->Main());
\r
1033 + Handle(XCAFDoc_ShapeTool) step_shape_contents = XCAFDoc_DocumentTool::ShapeTool(step_doc->Main());
1034 + Handle(XCAFDoc_ColorTool) step_colour_contents = XCAFDoc_DocumentTool::ColorTool(step_doc->Main());
1036 TDF_LabelSequence step_shapes;
\r
1037 step_shape_contents->GetShapes(step_shapes);
\r
1038 @@ -1221,7 +1278,7 @@
1039 // Fixed a bug in the OpenCascade XDE Colour handling when
\r
1040 // opening BREP Files, since BREP Files have no colour data.
\r
1041 // Hence, the face_colours Handle needs to be created as a NULL handle.
\r
1042 - occgeo->face_colours = Handle_XCAFDoc_ColorTool();
\r
1043 + occgeo->face_colours = Handle(XCAFDoc_ColorTool)();
1044 occgeo->face_colours.Nullify();
\r
1045 occgeo->changed = 1;
\r
1046 occgeo->BuildFMap();
\r
1047 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occgeom.hpp netgen-5.3.1_new/libsrc/occ/occgeom.hpp
1048 --- netgen-5.3.1_orig/libsrc/occ/occgeom.hpp 2014-08-29 13:54:03.000000000 +0400
1049 +++ netgen-5.3.1_new/libsrc/occ/occgeom.hpp 2016-09-29 14:44:01.996464598 +0300
1051 #include "Geom_Curve.hxx"
\r
1052 #include "Geom2d_Curve.hxx"
\r
1053 #include "Geom_Surface.hxx"
\r
1054 -#include "GeomAPI_ProjectPointOnSurf.hxx"
\r
1055 -#include "GeomAPI_ProjectPointOnCurve.hxx"
\r
1056 +// #include "GeomAPI_ProjectPointOnSurf.hxx"
1057 +// #include "GeomAPI_ProjectPointOnCurve.hxx"
1058 #include "BRepTools.hxx"
\r
1059 #include "TopExp.hxx"
\r
1060 #include "BRepBuilderAPI_MakeVertex.hxx"
\r
1062 #include "Geom_Curve.hxx"
\r
1063 #include "Geom2d_Curve.hxx"
\r
1064 #include "Geom_Surface.hxx"
\r
1065 -#include "GeomAPI_ProjectPointOnSurf.hxx"
\r
1066 -#include "GeomAPI_ProjectPointOnCurve.hxx"
\r
1067 +// #include "GeomAPI_ProjectPointOnSurf.hxx"
1068 +// #include "GeomAPI_ProjectPointOnCurve.hxx"
1069 #include "TopoDS_Wire.hxx"
\r
1070 #include "BRepTools_WireExplorer.hxx"
\r
1071 #include "BRepTools.hxx"
\r
1073 #include "IGESToBRep_Reader.hxx"
\r
1074 #include "Interface_Static.hxx"
\r
1075 #include "GeomAPI_ExtremaCurveCurve.hxx"
\r
1076 -#include "Standard_ErrorHandler.hxx"
\r
1077 +//#include "Standard_ErrorHandler.hxx"
1078 #include "Standard_Failure.hxx"
\r
1079 #include "ShapeUpgrade_ShellSewing.hxx"
\r
1080 #include "ShapeFix_Shape.hxx"
\r
1081 #include "ShapeFix_Wireframe.hxx"
\r
1082 +#include <Standard_Version.hxx>
1083 +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) <= 0x060702
1084 +// porting to OCCT6.7.3
1085 #include "BRepMesh.hxx"
\r
1087 #include "BRepMesh_IncrementalMesh.hxx"
\r
1088 #include "BRepBndLib.hxx"
\r
1089 #include "Bnd_Box.hxx"
\r
1090 #include "ShapeAnalysis.hxx"
\r
1091 #include "ShapeBuild_ReShape.hxx"
\r
1093 +// -- Optimization: to use cached projector and classifier
1094 +#include <NCollection_DataMap.hxx>
1095 +class ShapeAnalysis_Surface;
1096 +class BRepTopAdaptor_FClass2d;
1098 // Philippose - 29/01/2009
\r
1099 // OpenCascade XDE Support
\r
1101 class OCCGeometry : public NetgenGeometry
\r
1104 + // -- Optimization: to use cached projector and classifier
1105 + mutable NCollection_DataMap<int,Handle(ShapeAnalysis_Surface)> fprjmap;
1106 + mutable NCollection_DataMap<int,BRepTopAdaptor_FClass2d*> fclsmap;
1109 TopoDS_Shape shape;
\r
1111 // OpenCascade XDE Support
\r
1112 // XCAF Handle to make the face colours available to the rest of
\r
1114 - Handle_XCAFDoc_ColorTool face_colours;
\r
1115 + Handle(XCAFDoc_ColorTool) face_colours;
1117 mutable int changed;
\r
1118 Array<int> facemeshstatus;
\r
1120 virtual void Save (string filename) const;
\r
1123 + ~OCCGeometry(); // -- to free cached projector and classifier
1127 Box<3> GetBoundingBox()
\r
1128 @@ -266,9 +279,14 @@
1132 - void Project (int surfi, Point<3> & p) const;
\r
1133 + // void Project (int surfi, Point<3> & p) const; -- optimization
1134 + bool Project (int surfi, Point<3> & p, double& u, double& v) const;
1135 bool FastProject (int surfi, Point<3> & ap, double& u, double& v) const;
\r
1137 + // -- Optimization: to use cached projector and classifier
1138 + void GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
1139 + BRepTopAdaptor_FClass2d*& cls) const;
1141 OCCSurface GetSurface (int surfi)
\r
1143 cout << "OCCGeometry::GetSurface using PLANESPACE" << endl;
\r
1144 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occmeshsurf.cpp netgen-5.3.1_new/libsrc/occ/occmeshsurf.cpp
1145 --- netgen-5.3.1_orig/libsrc/occ/occmeshsurf.cpp 2014-08-29 13:54:03.000000000 +0400
1146 +++ netgen-5.3.1_new/libsrc/occ/occmeshsurf.cpp 2016-09-29 14:08:00.045144560 +0300
1148 #include <meshing.hpp>
1149 #include <GeomLProp_SLProps.hxx>
1150 #include <ShapeAnalysis_Surface.hxx>
1151 +#include <GeomAPI_ProjectPointOnCurve.hxx> // -- moved here from occgeom.hpp
1160 + else if ( lprop.IsNormalDefined() )
1162 n(0)=lprop.Normal().X();
1163 n(1)=lprop.Normal().Y();
1164 n(2)=lprop.Normal().Z();
1173 (*testout) << "u " << geominfo.u << " v " << geominfo.v
1174 @@ -434,23 +435,33 @@
1176 void MeshOptimize2dOCCSurfaces :: ProjectPoint (INDEX surfind, Point<3> & p) const
1178 - geometry.Project (surfind, p);
1179 + // geometry.Project (surfind, p); -- signature of Project() changed for optimization
1181 + geometry.Project (surfind, p, u, v);
1185 int MeshOptimize2dOCCSurfaces :: ProjectPointGI (INDEX surfind, Point<3> & p, PointGeomInfo & gi) const
1189 + //double u = gi.u;
1190 + //double v = gi.v;
1193 - if (geometry.FastProject (surfind, hp, u, v))
1195 + // -- u and v are computed by FastProject() and Project(), no need to call CalcPointGeomInfo()
1196 + // if (geometry.FastProject (surfind, hp, u, v))
1201 + // ProjectPoint (surfind, p);
1202 + // return CalcPointGeomInfo (surfind, gi, p);
1204 + if (gi.trignum > 0)
1205 + ok = geometry.FastProject (surfind, hp, gi.u, gi.v);
1207 + ok = geometry.Project (surfind, hp, gi.u, gi.v);
1211 - ProjectPoint (surfind, p);
1212 - return CalcPointGeomInfo (surfind, gi, p);
1218 if (!geometry.FastProject (surfi, hnewp, u, v))
1220 // cout << "Fast projection to surface fails! Using OCC projection" << endl;
1221 - geometry.Project (surfi, hnewp);
1222 + // geometry.Project (surfi, hnewp); -- Project() changed for optimization
1223 + geometry.Project (surfi, hnewp, u, v);
1232 + }//; -- to compile with -Wall -pedantic
1235 void OCCRefinementSurfaces ::
1236 @@ -708,14 +720,18 @@
1237 hnewp = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
1241 + }//; -- to compile with -Wall -pedantic
1244 void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi) const
1247 - geometry.Project (surfi, p);
1249 + //geometry.Project (surfi, p);
1252 + geometry.Project (surfi, p, u, v);
1254 + }//; -- to compile with -Wall -pedantic
1256 void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi, PointGeomInfo & gi) const
1258 @@ -723,9 +739,10 @@
1259 if (!geometry.FastProject (surfi, p, gi.u, gi.v))
1261 cout << "Fast projection to surface fails! Using OCC projection" << endl;
1262 - geometry.Project (surfi, p);
1264 + geometry.Project (surfi, p, u, v);
1271 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/utilities.h netgen-5.3.1_new/libsrc/occ/utilities.h
1272 --- netgen-5.3.1_orig/libsrc/occ/utilities.h 2014-08-29 13:54:03.000000000 +0400
1273 +++ netgen-5.3.1_new/libsrc/occ/utilities.h 2016-09-29 14:04:51.504148314 +0300
1280 // #include "SALOME_Log.hxx"
1282 diff -NaurwB netgen-5.3.1_orig/nglib/nglib.h netgen-5.3.1_new/nglib/nglib.h
1283 --- netgen-5.3.1_orig/nglib/nglib.h 2014-08-29 13:54:00.000000000 +0400
1284 +++ netgen-5.3.1_new/nglib/nglib.h 2016-09-29 14:04:51.504148314 +0300
1286 // Philippose - 14.02.2009
\r
1287 // Modifications for creating a DLL in Windows
\r
1289 - #ifdef NGLIB_EXPORTS || nglib_EXPORTS
\r
1290 + #if defined NGLIB_EXPORTS || defined nglib_EXPORTS
1291 #define DLL_HEADER __declspec(dllexport)
\r
1293 #define DLL_HEADER __declspec(dllimport)
\r