1 diff -NaurwB netgen-5.3.1_orig/Makefile.am netgen-5.3.1_new/Makefile.am
2 --- netgen-5.3.1_orig/Makefile.am 2016-10-21 17:32:01.000000000 +0300
3 +++ netgen-5.3.1_new/Makefile.am 2016-10-21 17:31:54.000000000 +0300
8 -SUBDIRS = libsrc ng tutorials doc windows nglib
9 +SUBDIRS = libsrc nglib #tutorials doc windows nglib
11 # TESTS = ng/netgen -batchmode
13 diff -NaurwB netgen-5.3.1_orig/Makefile.in netgen-5.3.1_new/Makefile.in
14 --- netgen-5.3.1_orig/Makefile.in 2014-10-06 15:04:37.000000000 +0400
15 +++ netgen-5.3.1_new/Makefile.in 2016-10-03 16:17:10.164707368 +0300
17 top_srcdir = @top_srcdir@
18 ACLOCAL_AMFLAGS = -I m4
20 -SUBDIRS = libsrc ng tutorials doc windows nglib
21 +SUBDIRS = libsrc nglib #tutorials doc windows nglib
23 $(MAKE) $(AM_MAKEFLAGS) all-recursive
25 diff -NaurwB netgen-5.3.1_orig/configure.ac netgen-5.3.1_new/configure.ac
26 --- netgen-5.3.1_orig/configure.ac 2014-10-06 15:00:17.000000000 +0400
27 +++ netgen-5.3.1_new/configure.ac 2016-09-29 14:34:11.957389447 +0300
29 CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
30 # LDFLAGS="$LDFLAGS $OPENMP_CXXFLAGS"
33 +m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
39 if test a$occon = atrue ; then
41 - AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I$occdir/inc -I/usr/include/opencascade"])
42 - 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"])
43 + AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I$occdir/include/opencascade"])
44 + 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"])
48 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/findip.hpp netgen-5.3.1_new/libsrc/meshing/findip.hpp
49 --- netgen-5.3.1_orig/libsrc/meshing/findip.hpp 2014-08-29 13:54:05.000000000 +0400
50 +++ netgen-5.3.1_new/libsrc/meshing/findip.hpp 2016-09-30 20:38:56.662234111 +0300
52 static int timer = NgProfiler::CreateTimer ("FindInnerPoint");
53 NgProfiler::RegionTimer reg (timer);
55 + if ( points.Size() < 3 )
61 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/improve3.cpp netgen-5.3.1_new/libsrc/meshing/improve3.cpp
62 --- netgen-5.3.1_orig/libsrc/meshing/improve3.cpp 2014-08-29 13:54:05.000000000 +0400
63 +++ netgen-5.3.1_new/libsrc/meshing/improve3.cpp 2016-10-03 16:16:57.636639300 +0300
70 for (int l = 2; l < nsuround; l++)
72 @@ -1239,10 +1240,12 @@
75 suroundpts[l] = newpi;
81 + if ( nbtetused < nsuround )
85 for (int k = 0; k < nsuround; k++)
86 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/meshtype.cpp netgen-5.3.1_new/libsrc/meshing/meshtype.cpp
87 --- netgen-5.3.1_orig/libsrc/meshing/meshtype.cpp 2014-08-29 13:54:05.000000000 +0400
88 +++ netgen-5.3.1_new/libsrc/meshing/meshtype.cpp 2016-09-29 14:04:51.500148293 +0300
91 +#include <float.h> // to get DBL_MIN defined
93 #include "meshing.hpp"
97 double det = trans.Det();
101 + if (det <= DBL_MIN) // avoid FPE
104 err += frob * frob / det;
107 double det = trans(0,0)*trans(1,1)-trans(1,0)*trans(0,1);
111 + if (det <= DBL_MIN) // avoid FPE
116 = dtrans(0,0) * trans(1,1) - trans(0,1) * dtrans(1,0)
117 + trans(0,0) * dtrans(1,1) - dtrans(0,1) * trans(1,0);
121 + if (det <= DBL_MIN) // avoid FPE
128 double det = trans.Det();
131 + if (det <= DBL_MIN) // avoid FPE
134 err += frob * frob / det;
135 @@ -1864,7 +1869,8 @@
139 - if (noz == 0.0) noz = 1e-10;
140 + //if (noz == 0.0) noz = 1e-10;
141 + if (noz <= DBL_MIN) noz = 1e-10; // avoid FPE
143 double xi = p(0) / noz;
144 double eta = p(1) / noz;
145 @@ -2030,7 +2036,8 @@
147 double det = -trans.Det();
151 + if (det <= DBL_MIN) // avoid FPE
154 err += frob * frob * frob / det;
155 @@ -2102,7 +2109,8 @@
161 + if (det <= DBL_MIN) // avoid FPE
165 @@ -2184,7 +2192,7 @@
170 + if (det <= DBL_MIN)
174 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/meshtype.hpp netgen-5.3.1_new/libsrc/meshing/meshtype.hpp
175 --- netgen-5.3.1_orig/libsrc/meshing/meshtype.hpp 2014-08-29 13:54:05.000000000 +0400
176 +++ netgen-5.3.1_new/libsrc/meshing/meshtype.hpp 2016-09-30 14:28:09.147575801 +0300
181 +class Mesh; // added due to compilation errors on some platforms
188 if (typ != QUAD && typ != QUAD6 && typ != QUAD8)
189 - PrintSysError ("element2d::GetNV not implemented for typ", typ)
190 + PrintSysError ("element2d::GetNV not implemented for typ", typ);
198 - PrintSysError ("Element3d::GetNV not implemented for typ ", typ)
199 + PrintSysError ("Element3d::GetNV not implemented for typ ", typ);
204 case PRISM12: return 5;
207 - PrintSysError ("element3d::GetNFaces not implemented for typ", typ)
208 + PrintSysError ("element3d::GetNFaces not implemented for typ", typ);
212 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.cxx netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.cxx
213 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.cxx 2014-08-29 13:54:03.000000000 +0400
214 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.cxx 2016-09-29 14:44:01.996464598 +0300
216 #include <TopOpeBRep_EdgesIntersector.hxx>
217 #include <TopOpeBRep_Point2d.hxx>
218 #include <TopTools_ListIteratorOfListOfShape.hxx>
219 -#include <TopTools_ListOfShape.hxx>
220 #include <TopTools_MapIteratorOfMapOfShape.hxx>
221 -#include <TopTools_MapOfShape.hxx>
222 #include <TopoDS.hxx>
223 #include <TopoDS_Edge.hxx>
224 #include <TopoDS_Vertex.hxx>
225 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.hxx
226 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.hxx 2014-08-29 13:54:03.000000000 +0400
227 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.hxx 2016-09-29 14:44:01.996464598 +0300
229 #ifndef _Partition_Inter2d_HeaderFile
230 #define _Partition_Inter2d_HeaderFile
232 -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile
233 +#include <Standard_Version.hxx>
235 +#if OCC_VERSION_MAJOR < 7
236 #include <Handle_BRepAlgo_AsDes.hxx>
238 #ifndef _Standard_Real_HeaderFile
240 #ifndef _Standard_Boolean_HeaderFile
241 #include <Standard_Boolean.hxx>
244 +#include <TopTools_MapOfShape.hxx>
245 +#include <TopTools_ListOfShape.hxx>
247 class BRepAlgo_AsDes;
249 -class TopTools_MapOfShape;
251 -class TopTools_ListOfShape;
255 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.cxx netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.cxx
256 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.cxx 2014-08-29 13:54:03.000000000 +0400
257 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.cxx 2016-09-29 14:44:02.000464619 +0300
259 #include <TopOpeBRepTool_BoxSort.hxx>
260 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
261 #include <TopTools_ListIteratorOfListOfShape.hxx>
262 -#include <TopTools_ListOfShape.hxx>
263 #include <TopoDS.hxx>
264 #include <TopoDS_Compound.hxx>
265 #include <TopoDS_Edge.hxx>
267 Handle (Geom_Surface) S = BRep_Tool::Surface(F,L);
269 if (S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
270 - S = (*(Handle_Geom_RectangularTrimmedSurface*)&S)->BasisSurface();
271 + S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface();
273 if (!S->IsUPeriodic() && !S->IsVPeriodic())
275 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.hxx
276 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.hxx 2014-08-29 13:54:03.000000000 +0400
277 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.hxx 2016-09-29 14:44:02.000464619 +0300
279 #ifndef _Partition_Inter3d_HeaderFile
280 #define _Partition_Inter3d_HeaderFile
282 -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile
283 +#include <Standard_Version.hxx>
285 +#if OCC_VERSION_MAJOR < 7
286 #include <Handle_BRepAlgo_AsDes.hxx>
288 #ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile
290 #ifndef _TopTools_MapOfShape_HeaderFile
291 #include <TopTools_MapOfShape.hxx>
293 +#ifndef _TopTools_ListOfShape_HeaderFile
294 +#include <TopTools_ListOfShape.hxx>
296 #ifndef _TopTools_DataMapOfShapeShape_HeaderFile
297 #include <TopTools_DataMapOfShapeShape.hxx>
300 #include <Standard_Boolean.hxx>
302 class BRepAlgo_AsDes;
303 -class TopTools_ListOfShape;
304 -class TopTools_DataMapOfShapeShape;
306 -class TopTools_MapOfShape;
311 void FacesPartition(const TopoDS_Face& F1,const TopoDS_Face& F2) ;
312 Standard_Boolean IsDone(const TopoDS_Face& F1,const TopoDS_Face& F2) const;
313 TopTools_MapOfShape& TouchedFaces() ;
314 - Handle_BRepAlgo_AsDes AsDes() const;
315 + Handle(BRepAlgo_AsDes) AsDes() const;
316 TopTools_MapOfShape& NewEdges() ;
317 Standard_Boolean HasSameDomainF(const TopoDS_Shape& F) const;
318 Standard_Boolean IsSameDomainF(const TopoDS_Shape& F1,const TopoDS_Shape& F2) const;
319 const TopTools_ListOfShape& SameDomain(const TopoDS_Face& F) const;
320 TopoDS_Vertex ReplaceSameDomainV(const TopoDS_Vertex& V,const TopoDS_Edge& E) const;
321 - Handle_BRepAlgo_AsDes SectionEdgesAD() const;
322 + Handle(BRepAlgo_AsDes) SectionEdgesAD() const;
323 Standard_Boolean IsSectionEdge(const TopoDS_Edge& E) const;
324 Standard_Boolean HasSectionEdge(const TopoDS_Face& F) const;
325 Standard_Boolean IsSplitOn(const TopoDS_Edge& NewE,const TopoDS_Edge& OldE,const TopoDS_Face& F) const;
326 @@ -121,11 +123,11 @@
330 - Handle_BRepAlgo_AsDes myAsDes;
331 + Handle(BRepAlgo_AsDes) myAsDes;
332 TopTools_DataMapOfShapeListOfShape myDone;
333 TopTools_MapOfShape myTouched;
334 TopTools_MapOfShape myNewEdges;
335 - Handle_BRepAlgo_AsDes mySectionEdgesAD;
336 + Handle(BRepAlgo_AsDes) mySectionEdgesAD;
337 TopTools_DataMapOfShapeListOfShape mySameDomainFM;
338 TopTools_DataMapOfShapeShape mySameDomainVM;
340 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop.hxx netgen-5.3.1_new/libsrc/occ/Partition_Loop.hxx
341 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop.hxx 2014-08-29 13:54:03.000000000 +0400
342 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop.hxx 2016-09-29 14:44:02.000464619 +0300
347 -class TopTools_ListOfShape;
350 #ifndef _Standard_HeaderFile
351 #include <Standard.hxx>
352 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.cxx netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.cxx
353 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.cxx 2014-08-29 13:54:03.000000000 +0400
354 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.cxx 2016-09-29 14:04:51.504148314 +0300
356 Cc->D1(uc, PC, CTg1);
357 if (!isForward) CTg1.Reverse();
359 - Standard_Real anglemin = 3 * PI, tolAng = 1.e-8;
360 + Standard_Real anglemin = 3 * M_PI, tolAng = 1.e-8;
362 // select an edge whose first derivative is most left of CTg1
363 // ie an angle between Tg1 and CTg1 is least
366 Standard_Real angle = Tg1.Angle(CTg1);
368 - if (PI - Abs(angle) <= tolAng)
369 + if (M_PI - Abs(angle) <= tolAng)
371 // an angle is too close to PI; assure that an angle sign really
372 // reflects an edge position: +PI - an edge is worst,
373 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.hxx
374 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.hxx 2014-08-29 13:54:03.000000000 +0400
375 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.hxx 2016-09-29 14:44:02.000464619 +0300
380 -class TopTools_ListOfShape;
381 class BRepAlgo_Image;
384 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop3d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Loop3d.hxx
385 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop3d.hxx 2014-08-29 13:54:03.000000000 +0400
386 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop3d.hxx 2016-09-29 14:44:02.000464619 +0300
388 #ifndef _TopTools_ListOfShape_HeaderFile
389 #include <TopTools_ListOfShape.hxx>
391 +#ifndef _TopTools_MapOfOrientedShape_HeaderFile
392 +#include <TopTools_MapOfOrientedShape.hxx>
394 #ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile
395 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
398 #include <Standard_Real.hxx>
401 -class TopTools_ListOfShape;
402 -class TopTools_MapOfOrientedShape;
406 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.cxx netgen-5.3.1_new/libsrc/occ/Partition_Spliter.cxx
407 --- netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.cxx 2014-08-29 13:54:03.000000000 +0400
408 +++ netgen-5.3.1_new/libsrc/occ/Partition_Spliter.cxx 2016-09-29 14:44:02.000464619 +0300
410 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
411 #include <TopTools_IndexedMapOfShape.hxx>
412 #include <TopTools_ListIteratorOfListOfShape.hxx>
413 -#include <TopTools_ListOfShape.hxx>
414 #include <TopTools_MapIteratorOfMapOfShape.hxx>
415 #include <TopTools_SequenceOfShape.hxx>
417 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.hxx netgen-5.3.1_new/libsrc/occ/Partition_Spliter.hxx
418 --- netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.hxx 2014-08-29 13:54:03.000000000 +0400
419 +++ netgen-5.3.1_new/libsrc/occ/Partition_Spliter.hxx 2016-09-29 14:44:02.004464639 +0300
421 #ifndef _TopTools_DataMapOfShapeShape_HeaderFile
422 #include <TopTools_DataMapOfShapeShape.hxx>
424 -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile
425 -#include <Handle_BRepAlgo_AsDes.hxx>
427 #ifndef _BRepAlgo_Image_HeaderFile
428 #include <BRepAlgo_Image.hxx>
432 class BRepAlgo_AsDes;
434 -class TopTools_ListOfShape;
439 TopTools_DataMapOfShapeShape myFaceShapeMap;
440 TopTools_DataMapOfShapeShape myInternalFaces;
441 TopTools_DataMapOfShapeShape myIntNotClFaces;
442 - Handle_BRepAlgo_AsDes myAsDes;
443 + Handle(BRepAlgo_AsDes) myAsDes;
444 BRepAlgo_Image myImagesFaces;
445 BRepAlgo_Image myImagesEdges;
446 BRepAlgo_Image myImageShape;
447 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occconstruction.cpp netgen-5.3.1_new/libsrc/occ/occconstruction.cpp
448 --- netgen-5.3.1_orig/libsrc/occ/occconstruction.cpp 2014-08-29 13:54:03.000000000 +0400
449 +++ netgen-5.3.1_new/libsrc/occ/occconstruction.cpp 2016-09-29 14:04:51.500148293 +0300
451 #include <BRepAlgoAPI_Common.hxx>
452 #include <BRepAlgoAPI_Fuse.hxx>
453 #include <BRepAlgoAPI_Section.hxx>
454 -#include <BRepOffsetAPI_Sewing.hxx>
455 +//#include <BRepOffsetAPI_Sewing.hxx>
456 //#include <BRepAlgo_Sewing.hxx>
457 #include <BRepOffsetAPI_MakeOffsetShape.hxx>
458 #include <ShapeFix_Shape.hxx>
459 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occgenmesh.cpp netgen-5.3.1_new/libsrc/occ/occgenmesh.cpp
460 --- netgen-5.3.1_orig/libsrc/occ/occgenmesh.cpp 2014-08-29 13:54:03.000000000 +0400
461 +++ netgen-5.3.1_new/libsrc/occ/occgenmesh.cpp 2016-09-29 14:04:51.500148293 +0300
463 if(h < 1e-4*maxside)
\r
467 - if (h > 30) return;
\r
468 + // commented to restrict H on a large sphere for example
469 + //if (h > 30) return;
472 if (h < maxside && depth < 10)
\r
475 pnt = c->Value(s0);
\r
477 - double olddist = 0;
\r
479 + //double olddist = 0; -- useless variables
482 int tmpVal = (int)(DIVIDEEDGESECTIONS);
\r
484 @@ -259,15 +259,19 @@
487 pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0));
\r
488 + // -- no more than 1 segment per <edge length>/DIVIDEEDGESECTIONS
489 hvalue[i] = hvalue[i-1] +
\r
490 + // 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
491 + // pnt.Distance(oldpnt);
493 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
\r
494 - pnt.Distance(oldpnt);
\r
495 + pnt.Distance(oldpnt));
497 //(*testout) << "mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z())) " << mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))
\r
498 // << " pnt.Distance(oldpnt) " << pnt.Distance(oldpnt) << endl;
\r
501 - dist = pnt.Distance(oldpnt);
\r
502 + //olddist = dist; -- useless variables
503 + //dist = pnt.Distance(oldpnt);
506 // nsubedges = int(ceil(hvalue[DIVIDEEDGESECTIONS]));
\r
509 if (hvalue[i1]/hvalue[DIVIDEEDGESECTIONS]*nsubedges >= i)
\r
511 - params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
\r
512 + // -- for nsubedges comparable to DIVIDEEDGESECTIONS
513 + //params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
514 + double d1 = i1 - (hvalue[i1] - i*hvalue[DIVIDEEDGESECTIONS]/nsubedges)/(hvalue[i1]-hvalue[i1-1]);
515 + params[i] = s0+(d1/double(DIVIDEEDGESECTIONS))*(s1-s0);
516 pnt = c->Value(params[i]);
\r
517 ps[i-1] = MeshPoint (Point3d(pnt.X(), pnt.Y(), pnt.Z()));
\r
520 (*testout) << "nedges = " << nedges << endl;
\r
522 double eps = 1e-6 * geom.GetBoundingBox().Diam();
\r
523 + const double eps2 = eps * eps; // -- small optimization
525 + int first_vp = mesh.GetNP()+1; // -- to support SALOME sub-meshes
527 for (int i = 1; i <= nvertices; i++)
\r
532 for (PointIndex pi = 1; pi <= mesh.GetNP(); pi++)
\r
533 - if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
\r
534 + //if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
535 + if ( Dist2 (mesh[pi], Point<3>(mp)) < eps2 ) // -- small optimization
541 TopoDS_Face face = TopoDS::Face(exp1.Current());
\r
542 int facenr = geom.fmap.FindIndex(face);
\r
543 + if ( facenr < 1 ) continue; // -- to support SALOME sub-meshes
545 if (face2solid[0][facenr-1] == 0)
\r
546 face2solid[0][facenr-1] = solidnr;
\r
551 + edgenr = mesh.GetNSeg(); // to support SALOME sub-meshes
553 (*testout) << "faces = " << geom.fmap.Extent() << endl;
\r
556 //(*testout) << "ignoring degenerated edge" << endl;
\r
559 + if ( geom.emap.FindIndex(edge) < 1 ) continue; // to support SALOME sub-meshes
561 if (geom.vmap.FindIndex(TopExp::FirstVertex (edge)) ==
\r
562 geom.vmap.FindIndex(TopExp::LastVertex (edge)))
\r
563 @@ -477,20 +491,104 @@
567 - pnums[0] = geom.vmap.FindIndex (TopExp::FirstVertex (edge));
\r
568 - pnums[pnums.Size()-1] = geom.vmap.FindIndex (TopExp::LastVertex (edge));
\r
569 + //pnums[0] = geom.vmap.FindIndex (TopExp::FirstVertex (edge));
570 + //pnums[pnums.Size()-1] = geom.vmap.FindIndex (TopExp::LastVertex (edge));
571 + MeshPoint dfltP ( Point<3> ( 0, 0, 0 ) );
572 + int *ipp[] = { &pnums[0], &pnums[pnums.Size()-1] };
573 + TopoDS_Iterator vIt( edge, false );
574 + TopoDS_Vertex v[2];
575 + v[0] = TopoDS::Vertex( vIt.Value() ); vIt.Next();
576 + v[1] = TopoDS::Vertex( vIt.Value() );
577 + if ( v[0].Orientation() == TopAbs_REVERSED )
578 + std::swap( v[0], v[1] );
579 + for ( int i = 0; i < 2; ++i)
582 + ip = geom.vmap.FindIndex ( v[i] );
583 + if ( ip == 0 || ip > nvertices )
587 + ip = iv = geom.vmap.Add( v[i] );
588 + gp_Pnt pnt = BRep_Tool::Pnt( v[i] );
589 + MeshPoint mp( Point<3>(pnt.X(), pnt.Y(), pnt.Z()) );
590 + for (PointIndex pi = 1; pi < first_vp; pi++)
591 + if ( Dist2 (mesh.Point(pi), Point<3>(mp)) < 1e-100 )
594 + if ( mesh.Point(ip).GetLayer() != dfltP.GetLayer() && mesh.Point(ip).GetLayer() != iv )
596 + if ( mesh.Point(ip).GetLayer() == dfltP.GetLayer())
597 + mesh.Point(ip) = MeshPoint( mesh.Point(ip), iv );
603 - Point<3> fp = occ2ng (BRep_Tool::Pnt (TopExp::FirstVertex (edge)));
\r
604 - Point<3> lp = occ2ng (BRep_Tool::Pnt (TopExp::LastVertex (edge)));
\r
605 + ip += first_vp - 1;
611 + TopoDS_Iterator vIt( edge, false );
612 + TopoDS_Vertex v1 = TopoDS::Vertex( vIt.Value() ); vIt.Next();
613 + TopoDS_Vertex v2 = TopoDS::Vertex( vIt.Value() );
614 + if ( v1.Orientation() == TopAbs_REVERSED )
615 + std::swap( v1, v2 );
616 + const bool isClosedEdge = v1.IsSame( v2 );
618 + Point<3> fp = occ2ng (BRep_Tool::Pnt (v1));
619 + Point<3> lp = occ2ng (BRep_Tool::Pnt (v2));
620 + double tol2 = std::min( eps*eps, 1e-6 * Dist2( fp, lp ));
621 + if ( isClosedEdge )
622 + tol2 = BRep_Tool::Tolerance( v1 ) * BRep_Tool::Tolerance( v1 );
626 for (PointIndex pi = 1; pi < first_ep; pi++)
\r
628 - if (Dist2 (mesh[pi], fp) < eps*eps) pnums[0] = pi;
\r
629 - if (Dist2 (mesh[pi], lp) < eps*eps) pnums.Last() = pi;
\r
630 + if (Dist2 (mesh[pi], fp) < tol2) pnums[0] = pi;
631 + if (Dist2 (mesh[pi], lp) < tol2) pnums.Last() = pi;
633 + if (( isClosedEdge && pnums[0] != pnums.Last() ) ||
634 + ( !isClosedEdge && pnums[0] == pnums.Last() ))
635 + pnums[0] = pnums.Last() = -1;
636 + if ( pnums[0] == -1 || pnums.Last() == -1 )
638 + // take into account a possible large gap between a vertex and an edge curve
639 + // end and a large vertex tolerance covering the whole edge
640 + if ( pnums[0] == -1 )
642 + double tol = BRep_Tool::Tolerance( v1 );
643 + for (PointIndex pi = 1; pi < first_ep; pi++)
644 + if (pi != pnums.Last() && Dist2 (mesh[pi], fp) < 2*tol*tol)
647 + if ( pnums[0] == -1 )
648 + pnums[0] = first_ep-1- nvertices + geom.vmap.FindIndex ( v1 );
650 + if ( isClosedEdge )
652 + pnums.Last() = pnums[0];
656 + if ( pnums.Last() == -1 )
658 + double tol = BRep_Tool::Tolerance( v2 );
659 + for (PointIndex pi = 1; pi < first_ep; pi++)
660 + if (pi != pnums[0] && Dist2 (mesh[pi], lp) < 2*tol*tol)
663 + if ( pnums.Last() == -1 )
664 + pnums.Last() = first_ep-1-nvertices + geom.vmap.FindIndex ( v2 );
667 + if ( Dist2( fp, mesh[PointIndex(pnums[0])]) >
668 + Dist2( lp, mesh[PointIndex(pnums.Last())]))
669 + std::swap( pnums[0], pnums.Last() );
674 @@ -500,17 +598,20 @@
677 for (j = first_ep; j <= mesh.GetNP(); j++)
\r
679 + if (!merge_solids && mesh.Point(j).GetLayer() != geomedgenr ) continue; // to support SALOME fuse edges
680 if ((mesh.Point(j)-Point<3>(mp[i-1])).Length() < eps)
\r
691 - mesh.AddPoint (mp[i-1]);
\r
692 + mesh.AddPoint (mp[i-1], geomedgenr); // to support SALOME fuse edges
693 (*testout) << "add meshpoint " << mp[i-1] << endl;
\r
694 pnums[i] = mesh.GetNP();
\r
697 // (*testout) << "edge " << mesh.LineSegment(i).edgenr << " face " << mesh.LineSegment(i).si
\r
698 // << " p1 " << mesh.LineSegment(i)[0] << " p2 " << mesh.LineSegment(i)[1] << endl;
\r
700 + for (int j = 1; j <= mesh.GetNP(); j++) // to support SALOME fuse edges: set level to zero
701 + mesh.Point(j) = MeshPoint( (Point<3>&) mesh.Point(j) );
703 mesh.CalcSurfacesOfNode();
\r
704 multithread.task = savetask;
\r
705 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occgeom.cpp netgen-5.3.1_new/libsrc/occ/occgeom.cpp
706 --- netgen-5.3.1_orig/libsrc/occ/occgeom.cpp 2014-08-29 13:54:03.000000000 +0400
707 +++ netgen-5.3.1_new/libsrc/occ/occgeom.cpp 2016-09-29 16:22:31.636328123 +0300
709 #include "ShapeAnalysis_CheckSmallFace.hxx"
\r
710 #include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx"
\r
711 #include "ShapeAnalysis_Surface.hxx"
\r
712 +#include <BRepTopAdaptor_FClass2d.hxx> // -- to optimize Project() and FastProject()
713 +#include <TopAbs_State.hxx>
714 #include "BRepAlgoAPI_Fuse.hxx"
\r
715 #include "BRepCheck_Analyzer.hxx"
\r
716 #include "BRepLib.hxx"
\r
718 #include "ShapeFix_FixSmallFace.hxx"
\r
719 #include "Partition_Spliter.hxx"
\r
724 + // free data used to optimize Project() and FastProject()
725 + OCCGeometry::~OCCGeometry()
727 + NCollection_DataMap<int,BRepTopAdaptor_FClass2d*>::Iterator it(fclsmap);
728 + for (; it.More(); it.Next())
732 void OCCGeometry :: PrintNrShapes ()
\r
736 double surfacecont = 0;
\r
739 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
740 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
741 rebuild->Apply(shape);
\r
742 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
745 cout << endl << "- repairing faces" << endl;
\r
747 Handle(ShapeFix_Face) sff;
\r
748 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
749 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
750 rebuild->Apply(shape);
\r
757 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
758 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
759 rebuild->Apply(shape);
\r
760 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
763 cout << endl << "- fixing small edges" << endl;
\r
765 Handle(ShapeFix_Wire) sfw;
\r
766 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
767 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
768 rebuild->Apply(shape);
\r
775 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
776 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
777 rebuild->Apply(shape);
\r
779 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
784 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
785 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
786 rebuild->Apply(shape);
\r
787 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
793 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
794 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
795 rebuild->Apply(shape);
\r
796 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
799 TopoDS_Solid solid = TopoDS::Solid(exp0.Current());
\r
800 TopoDS_Solid newsolid = solid;
\r
801 BRepLib::OrientClosedSolid (newsolid);
\r
802 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
803 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
804 // rebuild->Apply(shape);
\r
805 rebuild->Replace(solid, newsolid, Standard_False);
\r
806 TopoDS_Shape newshape = rebuild->Apply(shape, TopAbs_COMPSOLID);//, 1);
\r
808 TopoDS_Solid solid = TopoDS::Solid(exp0.Current());
\r
809 TopoDS_Solid newsolid = solid;
\r
810 BRepLib::OrientClosedSolid (newsolid);
\r
811 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
812 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
813 rebuild->Replace(solid, newsolid, Standard_False);
\r
815 TopoDS_Shape newshape = rebuild->Apply(shape, TopAbs_SHAPE, 1);
\r
816 @@ -951,25 +960,58 @@
820 + // returns a projector and a classifier for the given surface
821 + void OCCGeometry::GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
822 + BRepTopAdaptor_FClass2d*& cls) const
824 + //MSV: organize caching projector in the map
825 + if (fprjmap.IsBound(surfi))
827 + proj = fprjmap.Find(surfi);
828 + cls = fclsmap.Find(surfi);
832 + const TopoDS_Face& aFace = TopoDS::Face(fmap(surfi));
833 + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
834 + proj = new ShapeAnalysis_Surface(aSurf);
835 + fprjmap.Bind(surfi, proj);
836 + cls = new BRepTopAdaptor_FClass2d(aFace,Precision::Confusion());
837 + fclsmap.Bind(surfi, cls);
842 - void OCCGeometry :: Project (int surfi, Point<3> & p) const
\r
843 + // void OCCGeometry :: Project (int surfi, Point<3> & p) const
844 + bool OCCGeometry :: Project (int surfi, Point<3> & p, double& u, double& v) const
846 static int cnt = 0;
\r
847 if (++cnt % 1000 == 0) cout << "Project cnt = " << cnt << endl;
\r
849 gp_Pnt pnt(p(0), p(1), p(2));
\r
852 - Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
\r
853 - Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
\r
854 - gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
\r
855 - suval.Coord( u, v);
\r
856 - pnt = thesurf->Value( u, v );
\r
857 + // -- Optimization: use cached projector and classifier
859 + // Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
860 + // Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
861 + // gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
862 + // suval.Coord( u, v);
863 + // pnt = thesurf->Value( u, v );
865 + Handle(ShapeAnalysis_Surface) proj;
866 + BRepTopAdaptor_FClass2d *cls;
867 + GetFaceTools(surfi, proj, cls);
869 + gp_Pnt2d p2d = proj->ValueOfUV(pnt, Precision::Confusion());
870 + if (cls->Perform(p2d) == TopAbs_OUT)
874 + pnt = proj->Value(p2d);
877 p = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
\r
883 @@ -979,54 +1021,69 @@
885 gp_Pnt p(ap(0), ap(1), ap(2));
\r
887 - Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
\r
889 - gp_Pnt x = surface->Value (u,v);
\r
891 - if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
\r
894 + // -- Optimization: use cached projector and classifier
895 + // Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
897 + // gp_Pnt x = surface->Value (u,v);
899 + // if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
903 + // surface->D1(u,v,x,du,dv);
909 + // double det, lambda, mu;
916 + // det = Det3 (n.X(), du.X(), dv.X(),
917 + // n.Y(), du.Y(), dv.Y(),
918 + // n.Z(), du.Z(), dv.Z());
920 + // if (det < 1e-15) return false;
922 + // lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
923 + // n.Y(), p.Y()-x.Y(), dv.Y(),
924 + // n.Z(), p.Z()-x.Z(), dv.Z())/det;
926 + // mu = Det3 (n.X(), du.X(), p.X()-x.X(),
927 + // n.Y(), du.Y(), p.Y()-x.Y(),
928 + // n.Z(), du.Z(), p.Z()-x.Z())/det;
934 + // surface->D1(u,v,x,du,dv);
936 + // } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
938 + // // (*testout) << "FastProject count: " << count << endl;
940 + // if (count == 50) return false;
942 + // ap = Point<3> (x.X(), x.Y(), x.Z());
943 + Handle(ShapeAnalysis_Surface) proj;
944 + BRepTopAdaptor_FClass2d *cls;
945 + GetFaceTools(surfi, proj, cls);
947 - surface->D1(u,v,x,du,dv);
\r
953 - double det, lambda, mu;
\r
960 - det = Det3 (n.X(), du.X(), dv.X(),
\r
961 - n.Y(), du.Y(), dv.Y(),
\r
962 - n.Z(), du.Z(), dv.Z());
\r
964 - if (det < 1e-15) return false;
\r
966 - lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
\r
967 - n.Y(), p.Y()-x.Y(), dv.Y(),
\r
968 - n.Z(), p.Z()-x.Z(), dv.Z())/det;
\r
970 - mu = Det3 (n.X(), du.X(), p.X()-x.X(),
\r
971 - n.Y(), du.Y(), p.Y()-x.Y(),
\r
972 - n.Z(), du.Z(), p.Z()-x.Z())/det;
\r
978 - surface->D1(u,v,x,du,dv);
\r
980 - } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
\r
982 - // (*testout) << "FastProject count: " << count << endl;
\r
984 - if (count == 50) return false;
\r
985 + gp_Pnt2d p2d = proj->NextValueOfUV(gp_Pnt2d(u,v), p, Precision::Confusion());
986 + if (cls->Perform(p2d) == TopAbs_OUT)
988 + //cout << "Projection fails" << endl;
992 - ap = Point<3> (x.X(), x.Y(), x.Z());
\r
993 + p = proj->Value(p2d);
995 + ap = Point<3> (p.X(), p.Y(), p.Z());
999 @@ -1038,9 +1095,9 @@
1001 cout << "writing stl..."; cout.flush();
\r
1002 StlAPI_Writer writer;
\r
1003 - writer.RelativeMode() = Standard_False;
\r
1004 + //writer.RelativeMode() = Standard_False;
1006 - writer.SetDeflection(0.02);
\r
1007 + //writer.SetDeflection(0.02);
1008 writer.Write(shape,filename);
\r
1010 cout << "done" << endl;
\r
1011 @@ -1059,10 +1116,10 @@
1012 occgeo = new OCCGeometry;
\r
1014 // Initiate a dummy XCAF Application to handle the IGES XCAF Document
\r
1015 - static Handle_XCAFApp_Application dummy_app = XCAFApp_Application::GetApplication();
\r
1016 + static Handle(XCAFApp_Application) dummy_app = XCAFApp_Application::GetApplication();
1018 // Create an XCAF Document to contain the IGES file itself
\r
1019 - Handle_TDocStd_Document iges_doc;
\r
1020 + Handle(TDocStd_Document) iges_doc;
1022 // Check if a IGES File is already open under this handle, if so, close it to prevent
\r
1023 // Segmentation Faults when trying to create a new document
\r
1024 @@ -1089,8 +1146,8 @@
1025 reader.Transfer(iges_doc);
\r
1027 // Read in the shape(s) and the colours present in the IGES File
\r
1028 - Handle_XCAFDoc_ShapeTool iges_shape_contents = XCAFDoc_DocumentTool::ShapeTool(iges_doc->Main());
\r
1029 - Handle_XCAFDoc_ColorTool iges_colour_contents = XCAFDoc_DocumentTool::ColorTool(iges_doc->Main());
\r
1030 + Handle(XCAFDoc_ShapeTool) iges_shape_contents = XCAFDoc_DocumentTool::ShapeTool(iges_doc->Main());
1031 + Handle(XCAFDoc_ColorTool) iges_colour_contents = XCAFDoc_DocumentTool::ColorTool(iges_doc->Main());
1033 TDF_LabelSequence iges_shapes;
\r
1034 iges_shape_contents->GetShapes(iges_shapes);
\r
1035 @@ -1137,10 +1194,10 @@
1036 occgeo = new OCCGeometry;
\r
1038 // Initiate a dummy XCAF Application to handle the STEP XCAF Document
\r
1039 - static Handle_XCAFApp_Application dummy_app = XCAFApp_Application::GetApplication();
\r
1040 + static Handle(XCAFApp_Application) dummy_app = XCAFApp_Application::GetApplication();
1042 // Create an XCAF Document to contain the STEP file itself
\r
1043 - Handle_TDocStd_Document step_doc;
\r
1044 + Handle(TDocStd_Document) step_doc;
1046 // Check if a STEP File is already open under this handle, if so, close it to prevent
\r
1047 // Segmentation Faults when trying to create a new document
\r
1048 @@ -1167,8 +1224,8 @@
1049 reader.Transfer(step_doc);
\r
1051 // Read in the shape(s) and the colours present in the STEP File
\r
1052 - Handle_XCAFDoc_ShapeTool step_shape_contents = XCAFDoc_DocumentTool::ShapeTool(step_doc->Main());
\r
1053 - Handle_XCAFDoc_ColorTool step_colour_contents = XCAFDoc_DocumentTool::ColorTool(step_doc->Main());
\r
1054 + Handle(XCAFDoc_ShapeTool) step_shape_contents = XCAFDoc_DocumentTool::ShapeTool(step_doc->Main());
1055 + Handle(XCAFDoc_ColorTool) step_colour_contents = XCAFDoc_DocumentTool::ColorTool(step_doc->Main());
1057 TDF_LabelSequence step_shapes;
\r
1058 step_shape_contents->GetShapes(step_shapes);
\r
1059 @@ -1221,7 +1278,7 @@
1060 // Fixed a bug in the OpenCascade XDE Colour handling when
\r
1061 // opening BREP Files, since BREP Files have no colour data.
\r
1062 // Hence, the face_colours Handle needs to be created as a NULL handle.
\r
1063 - occgeo->face_colours = Handle_XCAFDoc_ColorTool();
\r
1064 + occgeo->face_colours = Handle(XCAFDoc_ColorTool)();
1065 occgeo->face_colours.Nullify();
\r
1066 occgeo->changed = 1;
\r
1067 occgeo->BuildFMap();
\r
1068 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occgeom.hpp netgen-5.3.1_new/libsrc/occ/occgeom.hpp
1069 --- netgen-5.3.1_orig/libsrc/occ/occgeom.hpp 2014-08-29 13:54:03.000000000 +0400
1070 +++ netgen-5.3.1_new/libsrc/occ/occgeom.hpp 2016-09-29 14:44:01.996464598 +0300
1072 #include "Geom_Curve.hxx"
\r
1073 #include "Geom2d_Curve.hxx"
\r
1074 #include "Geom_Surface.hxx"
\r
1075 -#include "GeomAPI_ProjectPointOnSurf.hxx"
\r
1076 -#include "GeomAPI_ProjectPointOnCurve.hxx"
\r
1077 +// #include "GeomAPI_ProjectPointOnSurf.hxx"
1078 +// #include "GeomAPI_ProjectPointOnCurve.hxx"
1079 #include "BRepTools.hxx"
\r
1080 #include "TopExp.hxx"
\r
1081 #include "BRepBuilderAPI_MakeVertex.hxx"
\r
1083 #include "Geom_Curve.hxx"
\r
1084 #include "Geom2d_Curve.hxx"
\r
1085 #include "Geom_Surface.hxx"
\r
1086 -#include "GeomAPI_ProjectPointOnSurf.hxx"
\r
1087 -#include "GeomAPI_ProjectPointOnCurve.hxx"
\r
1088 +// #include "GeomAPI_ProjectPointOnSurf.hxx"
1089 +// #include "GeomAPI_ProjectPointOnCurve.hxx"
1090 #include "TopoDS_Wire.hxx"
\r
1091 #include "BRepTools_WireExplorer.hxx"
\r
1092 #include "BRepTools.hxx"
\r
1094 #include "IGESToBRep_Reader.hxx"
\r
1095 #include "Interface_Static.hxx"
\r
1096 #include "GeomAPI_ExtremaCurveCurve.hxx"
\r
1097 -#include "Standard_ErrorHandler.hxx"
\r
1098 +//#include "Standard_ErrorHandler.hxx"
1099 #include "Standard_Failure.hxx"
\r
1100 #include "ShapeUpgrade_ShellSewing.hxx"
\r
1101 #include "ShapeFix_Shape.hxx"
\r
1102 #include "ShapeFix_Wireframe.hxx"
\r
1103 +#include <Standard_Version.hxx>
1104 +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) <= 0x060702
1105 +// porting to OCCT6.7.3
1106 #include "BRepMesh.hxx"
\r
1108 #include "BRepMesh_IncrementalMesh.hxx"
\r
1109 #include "BRepBndLib.hxx"
\r
1110 #include "Bnd_Box.hxx"
\r
1111 #include "ShapeAnalysis.hxx"
\r
1112 #include "ShapeBuild_ReShape.hxx"
\r
1114 +// -- Optimization: to use cached projector and classifier
1115 +#include <NCollection_DataMap.hxx>
1116 +class ShapeAnalysis_Surface;
1117 +class BRepTopAdaptor_FClass2d;
1119 // Philippose - 29/01/2009
\r
1120 // OpenCascade XDE Support
\r
1122 class OCCGeometry : public NetgenGeometry
\r
1125 + // -- Optimization: to use cached projector and classifier
1126 + mutable NCollection_DataMap<int,Handle(ShapeAnalysis_Surface)> fprjmap;
1127 + mutable NCollection_DataMap<int,BRepTopAdaptor_FClass2d*> fclsmap;
1130 TopoDS_Shape shape;
\r
1132 // OpenCascade XDE Support
\r
1133 // XCAF Handle to make the face colours available to the rest of
\r
1135 - Handle_XCAFDoc_ColorTool face_colours;
\r
1136 + Handle(XCAFDoc_ColorTool) face_colours;
1138 mutable int changed;
\r
1139 Array<int> facemeshstatus;
\r
1141 virtual void Save (string filename) const;
\r
1144 + ~OCCGeometry(); // -- to free cached projector and classifier
1148 Box<3> GetBoundingBox()
\r
1149 @@ -266,9 +279,14 @@
1153 - void Project (int surfi, Point<3> & p) const;
\r
1154 + // void Project (int surfi, Point<3> & p) const; -- optimization
1155 + bool Project (int surfi, Point<3> & p, double& u, double& v) const;
1156 bool FastProject (int surfi, Point<3> & ap, double& u, double& v) const;
\r
1158 + // -- Optimization: to use cached projector and classifier
1159 + void GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
1160 + BRepTopAdaptor_FClass2d*& cls) const;
1162 OCCSurface GetSurface (int surfi)
\r
1164 cout << "OCCGeometry::GetSurface using PLANESPACE" << endl;
\r
1165 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occmeshsurf.cpp netgen-5.3.1_new/libsrc/occ/occmeshsurf.cpp
1166 --- netgen-5.3.1_orig/libsrc/occ/occmeshsurf.cpp 2014-08-29 13:54:03.000000000 +0400
1167 +++ netgen-5.3.1_new/libsrc/occ/occmeshsurf.cpp 2016-09-29 14:08:00.045144560 +0300
1169 #include <meshing.hpp>
1170 #include <GeomLProp_SLProps.hxx>
1171 #include <ShapeAnalysis_Surface.hxx>
1172 +#include <GeomAPI_ProjectPointOnCurve.hxx> // -- moved here from occgeom.hpp
1181 + else if ( lprop.IsNormalDefined() )
1183 n(0)=lprop.Normal().X();
1184 n(1)=lprop.Normal().Y();
1185 n(2)=lprop.Normal().Z();
1194 (*testout) << "u " << geominfo.u << " v " << geominfo.v
1195 @@ -434,23 +435,33 @@
1197 void MeshOptimize2dOCCSurfaces :: ProjectPoint (INDEX surfind, Point<3> & p) const
1199 - geometry.Project (surfind, p);
1200 + // geometry.Project (surfind, p); -- signature of Project() changed for optimization
1202 + geometry.Project (surfind, p, u, v);
1206 int MeshOptimize2dOCCSurfaces :: ProjectPointGI (INDEX surfind, Point<3> & p, PointGeomInfo & gi) const
1210 + //double u = gi.u;
1211 + //double v = gi.v;
1214 - if (geometry.FastProject (surfind, hp, u, v))
1216 + // -- u and v are computed by FastProject() and Project(), no need to call CalcPointGeomInfo()
1217 + // if (geometry.FastProject (surfind, hp, u, v))
1222 + // ProjectPoint (surfind, p);
1223 + // return CalcPointGeomInfo (surfind, gi, p);
1225 + if (gi.trignum > 0)
1226 + ok = geometry.FastProject (surfind, hp, gi.u, gi.v);
1228 + ok = geometry.Project (surfind, hp, gi.u, gi.v);
1232 - ProjectPoint (surfind, p);
1233 - return CalcPointGeomInfo (surfind, gi, p);
1239 if (!geometry.FastProject (surfi, hnewp, u, v))
1241 // cout << "Fast projection to surface fails! Using OCC projection" << endl;
1242 - geometry.Project (surfi, hnewp);
1243 + // geometry.Project (surfi, hnewp); -- Project() changed for optimization
1244 + geometry.Project (surfi, hnewp, u, v);
1253 + }//; -- to compile with -Wall -pedantic
1256 void OCCRefinementSurfaces ::
1257 @@ -708,14 +720,18 @@
1258 hnewp = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
1262 + }//; -- to compile with -Wall -pedantic
1265 void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi) const
1268 - geometry.Project (surfi, p);
1270 + //geometry.Project (surfi, p);
1273 + geometry.Project (surfi, p, u, v);
1275 + }//; -- to compile with -Wall -pedantic
1277 void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi, PointGeomInfo & gi) const
1279 @@ -723,9 +739,10 @@
1280 if (!geometry.FastProject (surfi, p, gi.u, gi.v))
1282 cout << "Fast projection to surface fails! Using OCC projection" << endl;
1283 - geometry.Project (surfi, p);
1285 + geometry.Project (surfi, p, u, v);
1292 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/utilities.h netgen-5.3.1_new/libsrc/occ/utilities.h
1293 --- netgen-5.3.1_orig/libsrc/occ/utilities.h 2014-08-29 13:54:03.000000000 +0400
1294 +++ netgen-5.3.1_new/libsrc/occ/utilities.h 2016-09-29 14:04:51.504148314 +0300
1301 // #include "SALOME_Log.hxx"
1303 diff -NaurwB netgen-5.3.1_orig/nglib/nglib.h netgen-5.3.1_new/nglib/nglib.h
1304 --- netgen-5.3.1_orig/nglib/nglib.h 2014-08-29 13:54:00.000000000 +0400
1305 +++ netgen-5.3.1_new/nglib/nglib.h 2016-09-29 14:04:51.504148314 +0300
1307 // Philippose - 14.02.2009
\r
1308 // Modifications for creating a DLL in Windows
\r
1310 - #ifdef NGLIB_EXPORTS || nglib_EXPORTS
\r
1311 + #if defined NGLIB_EXPORTS || defined nglib_EXPORTS
1312 #define DLL_HEADER __declspec(dllexport)
\r
1314 #define DLL_HEADER __declspec(dllimport)
\r
1315 diff -Naur netgen-5.3.1_orig/libsrc/csg/Makefile.am netgen-5.3.1_new/libsrc/csg/Makefile.am
1316 --- netgen-5.3.1_orig/libsrc/csg/Makefile.am 2014-08-29 13:54:06.000000000 +0400
1317 +++ netgen-5.3.1_new/libsrc/csg/Makefile.am 2016-11-08 17:48:02.000000000 +0300
1319 AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include $(TCL_INCLUDES)
1322 -lib_LTLIBRARIES = libcsg.la
1323 +noinst_LTLIBRARIES = libcsg.la
1326 libcsg_la_SOURCES = algprim.cpp brick.cpp \
1328 manifold.cpp meshsurf.cpp polyhedra.cpp revolution.cpp singularref.cpp \
1329 solid.cpp specpoin.cpp spline3d.cpp surface.cpp triapprox.cpp
1331 -libcsg_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la
1336 -lib_LTLIBRARIES += libcsgvis.la
1337 +lib_LTLIBRARIES = libcsgvis.la
1339 libcsgvis_la_SOURCES = vscsg.cpp csgpkg.cpp
1340 libcsgvis_la_LIBADD = libcsg.la
1341 diff -Naur netgen-5.3.1_orig/libsrc/geom2d/Makefile.am netgen-5.3.1_new/libsrc/geom2d/Makefile.am
1342 --- netgen-5.3.1_orig/libsrc/geom2d/Makefile.am 2014-08-29 13:54:06.000000000 +0400
1343 +++ netgen-5.3.1_new/libsrc/geom2d/Makefile.am 2016-11-08 17:49:13.000000000 +0300
1348 -lib_LTLIBRARIES = libgeom2d.la
1349 +noinst_LTLIBRARIES = libgeom2d.la
1352 -lib_LTLIBRARIES += libgeom2dvis.la
1353 +lib_LTLIBRARIES = libgeom2dvis.la
1358 libgeom2d_la_SOURCES = genmesh2d.cpp geom2dmesh.cpp geometry2d.cpp
1359 -libgeom2d_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la
1361 libgeom2dvis_la_SOURCES = geom2dpkg.cpp vsgeom2d.cpp
1362 libgeom2dvis_la_LIBADD = libgeom2d.la
1363 diff -Naur netgen-5.3.1_orig/libsrc/interface/Makefile.am netgen-5.3.1_new/libsrc/interface/Makefile.am
1364 --- netgen-5.3.1_orig/libsrc/interface/Makefile.am 2014-08-29 13:54:02.000000000 +0400
1365 +++ netgen-5.3.1_new/libsrc/interface/Makefile.am 2016-11-08 17:49:26.000000000 +0300
1368 AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include -I$(top_srcdir)/libsrc/interface $(MPI_INCLUDES) $(TCL_INCLUDES) -DOPENGL
1370 -lib_LTLIBRARIES = libinterface.la
1371 +noinst_LTLIBRARIES = libinterface.la
1372 libinterface_la_SOURCES = nginterface.cpp nginterface_v2.cpp \
1373 read_fnf_mesh.cpp readtetmesh.cpp readuser.cpp writeabaqus.cpp writediffpack.cpp \
1374 writedolfin.cpp writeelmer.cpp writefeap.cpp writefluent.cpp writegmsh.cpp writejcm.cpp \
1375 writepermas.cpp writetecplot.cpp writetet.cpp writetochnog.cpp writeuser.cpp \
1376 wuchemnitz.cpp writegmsh2.cpp writeOpenFOAM15x.cpp
1379 -libinterface_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la
1381 # libinterface_la_LDFLAGS = -rdynamic
1382 diff -Naur netgen-5.3.1_orig/libsrc/meshing/Makefile.am netgen-5.3.1_new/libsrc/meshing/Makefile.am
1383 --- netgen-5.3.1_orig/libsrc/meshing/Makefile.am 2014-08-29 13:54:05.000000000 +0400
1384 +++ netgen-5.3.1_new/libsrc/meshing/Makefile.am 2016-11-08 17:48:44.000000000 +0300
1389 -lib_LTLIBRARIES = libmesh.la
1390 +noinst_LTLIBRARIES = libmesh.la
1392 libmesh_la_SOURCES = adfront2.cpp adfront3.cpp bisect.cpp boundarylayer.cpp \
1393 clusters.cpp curvedelems.cpp delaunay.cpp delaunay2d.cpp \
1395 topology.cpp triarls.cpp validate.cpp zrefine.cpp bcfunctions.cpp \
1396 parallelmesh.cpp paralleltop.cpp paralleltop.hpp basegeom.cpp
1398 -libmesh_la_LIBADD = $(top_builddir)/libsrc/linalg/libla.la \
1399 - $(top_builddir)/libsrc/gprim/libgprim.la \
1400 - $(top_builddir)/libsrc/general/libgen.la \
1402 +libmesh_la_LIBADD = -lz
1404 diff -Naur netgen-5.3.1_orig/libsrc/occ/Makefile.am netgen-5.3.1_new/libsrc/occ/Makefile.am
1405 --- netgen-5.3.1_orig/libsrc/occ/Makefile.am 2014-08-29 13:54:03.000000000 +0400
1406 +++ netgen-5.3.1_new/libsrc/occ/Makefile.am 2016-11-08 17:30:53.000000000 +0300
1411 -lib_LTLIBRARIES = libocc.la
1412 +noinst_LTLIBRARIES = libocc.la
1415 -lib_LTLIBRARIES += liboccvis.la
1416 +lib_LTLIBRARIES = liboccvis.la
1420 diff -Naur netgen-5.3.1_orig/libsrc/stlgeom/Makefile.am netgen-5.3.1_new/libsrc/stlgeom/Makefile.am
1421 --- netgen-5.3.1_orig/libsrc/stlgeom/Makefile.am 2014-08-29 13:54:05.000000000 +0400
1422 +++ netgen-5.3.1_new/libsrc/stlgeom/Makefile.am 2016-11-08 18:28:09.000000000 +0300
1424 AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include $(TCL_INCLUDES)
1427 -lib_LTLIBRARIES = libstl.la
1428 +noinst_LTLIBRARIES = libstl.la
1431 -lib_LTLIBRARIES += libstlvis.la
1432 +lib_LTLIBRARIES = libstlvis.la
1435 libstl_la_SOURCES = meshstlsurface.cpp stlgeom.cpp stlgeomchart.cpp \
1438 libstlvis_la_SOURCES = stlpkg.cpp vsstl.cpp
1439 libstlvis_la_LIBADD = libstl.la
1440 -libstl_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la
1441 # libstlvis_la_LIBADD = libstl.la $(top_builddir)/libsrc/linalg/libla.la
1443 diff -Naur netgen-5.3.1_orig/nglib/Makefile.am netgen-5.3.1_new/nglib/Makefile.am
1444 --- netgen-5.3.1_orig/nglib/Makefile.am 2014-08-29 13:54:00.000000000 +0400
1445 +++ netgen-5.3.1_new/nglib/Makefile.am 2016-11-08 19:01:17.000000000 +0300
1447 $(top_builddir)/libsrc/stlgeom/libstl.la \
1448 $(top_builddir)/libsrc/occ/libocc.la \
1449 $(top_builddir)/libsrc/meshing/libmesh.la \
1450 + $(top_builddir)/libsrc/general/libgen.la \
1451 + $(top_builddir)/libsrc/gprim/libgprim.la \
1452 + $(top_builddir)/libsrc/linalg/libla.la
1453 $(OCCLIBS) $(MPI_LIBS)
1455 libnglib_la_LDFLAGS = -avoid-version