1 diff -Naur netgen-5.3.1_SRC_orig/Makefile.am netgen-5.3.1_SRC_modif/Makefile.am
2 --- netgen-5.3.1_SRC_orig/Makefile.am 2014-08-29 13:55:03.000000000 +0400
3 +++ netgen-5.3.1_SRC_modif/Makefile.am 2017-09-11 18:08:21.217313702 +0300
8 -SUBDIRS = libsrc ng tutorials doc windows nglib
9 +SUBDIRS = libsrc nglib #tutorials doc windows nglib
11 # TESTS = ng/netgen -batchmode
13 diff -Naur netgen-5.3.1_SRC_orig/Makefile.in netgen-5.3.1_SRC_modif/Makefile.in
14 --- netgen-5.3.1_SRC_orig/Makefile.in 2014-10-06 15:04:37.000000000 +0400
15 +++ netgen-5.3.1_SRC_modif/Makefile.in 2017-09-11 18:08:21.225312838 +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 -Naur netgen-5.3.1_SRC_orig/configure.ac netgen-5.3.1_SRC_modif/configure.ac
26 --- netgen-5.3.1_SRC_orig/configure.ac 2014-10-06 15:00:17.000000000 +0400
27 +++ netgen-5.3.1_SRC_modif/configure.ac 2017-09-11 18:08:21.226312730 +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 -Naur netgen-5.3.1_SRC_orig/libsrc/csg/Makefile.am netgen-5.3.1_SRC_modif/libsrc/csg/Makefile.am
49 --- netgen-5.3.1_SRC_orig/libsrc/csg/Makefile.am 2014-08-29 13:54:06.000000000 +0400
50 +++ netgen-5.3.1_SRC_modif/libsrc/csg/Makefile.am 2017-09-11 18:08:21.234311865 +0300
52 AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include $(TCL_INCLUDES)
55 -lib_LTLIBRARIES = libcsg.la
56 +noinst_LTLIBRARIES = libcsg.la
59 libcsg_la_SOURCES = algprim.cpp brick.cpp \
61 manifold.cpp meshsurf.cpp polyhedra.cpp revolution.cpp singularref.cpp \
62 solid.cpp specpoin.cpp spline3d.cpp surface.cpp triapprox.cpp
64 -libcsg_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la
69 -lib_LTLIBRARIES += libcsgvis.la
70 +lib_LTLIBRARIES = libcsgvis.la
72 libcsgvis_la_SOURCES = vscsg.cpp csgpkg.cpp
73 libcsgvis_la_LIBADD = libcsg.la
74 diff -Naur netgen-5.3.1_SRC_orig/libsrc/geom2d/Makefile.am netgen-5.3.1_SRC_modif/libsrc/geom2d/Makefile.am
75 --- netgen-5.3.1_SRC_orig/libsrc/geom2d/Makefile.am 2014-08-29 13:54:06.000000000 +0400
76 +++ netgen-5.3.1_SRC_modif/libsrc/geom2d/Makefile.am 2017-09-11 18:08:21.234311865 +0300
81 -lib_LTLIBRARIES = libgeom2d.la
82 +noinst_LTLIBRARIES = libgeom2d.la
85 -lib_LTLIBRARIES += libgeom2dvis.la
86 +lib_LTLIBRARIES = libgeom2dvis.la
91 libgeom2d_la_SOURCES = genmesh2d.cpp geom2dmesh.cpp geometry2d.cpp
92 -libgeom2d_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la
94 libgeom2dvis_la_SOURCES = geom2dpkg.cpp vsgeom2d.cpp
95 libgeom2dvis_la_LIBADD = libgeom2d.la
96 diff -Naur netgen-5.3.1_SRC_orig/libsrc/interface/Makefile.am netgen-5.3.1_SRC_modif/libsrc/interface/Makefile.am
97 --- netgen-5.3.1_SRC_orig/libsrc/interface/Makefile.am 2014-08-29 13:54:02.000000000 +0400
98 +++ netgen-5.3.1_SRC_modif/libsrc/interface/Makefile.am 2017-09-11 18:08:21.234311865 +0300
101 AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include -I$(top_srcdir)/libsrc/interface $(MPI_INCLUDES) $(TCL_INCLUDES) -DOPENGL
103 -lib_LTLIBRARIES = libinterface.la
104 +noinst_LTLIBRARIES = libinterface.la
105 libinterface_la_SOURCES = nginterface.cpp nginterface_v2.cpp \
106 read_fnf_mesh.cpp readtetmesh.cpp readuser.cpp writeabaqus.cpp writediffpack.cpp \
107 writedolfin.cpp writeelmer.cpp writefeap.cpp writefluent.cpp writegmsh.cpp writejcm.cpp \
108 writepermas.cpp writetecplot.cpp writetet.cpp writetochnog.cpp writeuser.cpp \
109 wuchemnitz.cpp writegmsh2.cpp writeOpenFOAM15x.cpp
112 -libinterface_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la
114 # libinterface_la_LDFLAGS = -rdynamic
115 diff -Naur netgen-5.3.1_SRC_orig/libsrc/meshing/Makefile.am netgen-5.3.1_SRC_modif/libsrc/meshing/Makefile.am
116 --- netgen-5.3.1_SRC_orig/libsrc/meshing/Makefile.am 2014-08-29 13:54:05.000000000 +0400
117 +++ netgen-5.3.1_SRC_modif/libsrc/meshing/Makefile.am 2017-09-11 18:08:21.234311865 +0300
122 -lib_LTLIBRARIES = libmesh.la
123 +noinst_LTLIBRARIES = libmesh.la
125 libmesh_la_SOURCES = adfront2.cpp adfront3.cpp bisect.cpp boundarylayer.cpp \
126 clusters.cpp curvedelems.cpp delaunay.cpp delaunay2d.cpp \
128 topology.cpp triarls.cpp validate.cpp zrefine.cpp bcfunctions.cpp \
129 parallelmesh.cpp paralleltop.cpp paralleltop.hpp basegeom.cpp
131 -libmesh_la_LIBADD = $(top_builddir)/libsrc/linalg/libla.la \
132 - $(top_builddir)/libsrc/gprim/libgprim.la \
133 - $(top_builddir)/libsrc/general/libgen.la \
135 +libmesh_la_LIBADD = -lz
137 diff -Naur netgen-5.3.1_SRC_orig/libsrc/meshing/findip.hpp netgen-5.3.1_SRC_modif/libsrc/meshing/findip.hpp
138 --- netgen-5.3.1_SRC_orig/libsrc/meshing/findip.hpp 2014-08-29 13:54:05.000000000 +0400
139 +++ netgen-5.3.1_SRC_modif/libsrc/meshing/findip.hpp 2017-09-11 18:08:21.226312730 +0300
141 static int timer = NgProfiler::CreateTimer ("FindInnerPoint");
142 NgProfiler::RegionTimer reg (timer);
144 + if ( points.Size() < 3 )
150 diff -Naur netgen-5.3.1_SRC_orig/libsrc/meshing/improve3.cpp netgen-5.3.1_SRC_modif/libsrc/meshing/improve3.cpp
151 --- netgen-5.3.1_SRC_orig/libsrc/meshing/improve3.cpp 2014-08-29 13:54:05.000000000 +0400
152 +++ netgen-5.3.1_SRC_modif/libsrc/meshing/improve3.cpp 2017-09-11 18:08:21.227312622 +0300
153 @@ -1219,6 +1219,7 @@
159 for (int l = 2; l < nsuround; l++)
161 @@ -1239,10 +1240,12 @@
164 suroundpts[l] = newpi;
170 + if ( nbtetused < nsuround )
174 for (int k = 0; k < nsuround; k++)
175 diff -Naur netgen-5.3.1_SRC_orig/libsrc/meshing/meshtype.cpp netgen-5.3.1_SRC_modif/libsrc/meshing/meshtype.cpp
176 --- netgen-5.3.1_SRC_orig/libsrc/meshing/meshtype.cpp 2014-08-29 13:54:05.000000000 +0400
177 +++ netgen-5.3.1_SRC_modif/libsrc/meshing/meshtype.cpp 2017-09-11 18:08:21.227312622 +0300
179 #include <mystdlib.h>
180 +#include <float.h> // to get DBL_MIN defined
182 #include "meshing.hpp"
186 double det = trans.Det();
190 + if (det <= DBL_MIN) // avoid FPE
193 err += frob * frob / det;
196 double det = trans(0,0)*trans(1,1)-trans(1,0)*trans(0,1);
200 + if (det <= DBL_MIN) // avoid FPE
205 = dtrans(0,0) * trans(1,1) - trans(0,1) * dtrans(1,0)
206 + trans(0,0) * dtrans(1,1) - dtrans(0,1) * trans(1,0);
210 + if (det <= DBL_MIN) // avoid FPE
217 double det = trans.Det();
220 + if (det <= DBL_MIN) // avoid FPE
223 err += frob * frob / det;
224 @@ -1864,7 +1869,8 @@
228 - if (noz == 0.0) noz = 1e-10;
229 + //if (noz == 0.0) noz = 1e-10;
230 + if (noz <= DBL_MIN) noz = 1e-10; // avoid FPE
232 double xi = p(0) / noz;
233 double eta = p(1) / noz;
234 @@ -2030,7 +2036,8 @@
236 double det = -trans.Det();
240 + if (det <= DBL_MIN) // avoid FPE
243 err += frob * frob * frob / det;
244 @@ -2102,7 +2109,8 @@
250 + if (det <= DBL_MIN) // avoid FPE
254 @@ -2184,7 +2192,7 @@
259 + if (det <= DBL_MIN)
263 diff -Naur netgen-5.3.1_SRC_orig/libsrc/meshing/meshtype.hpp netgen-5.3.1_SRC_modif/libsrc/meshing/meshtype.hpp
264 --- netgen-5.3.1_SRC_orig/libsrc/meshing/meshtype.hpp 2014-08-29 13:54:05.000000000 +0400
265 +++ netgen-5.3.1_SRC_modif/libsrc/meshing/meshtype.hpp 2017-09-11 18:08:21.228312514 +0300
270 +class Mesh; // added due to compilation errors on some platforms
277 if (typ != QUAD && typ != QUAD6 && typ != QUAD8)
278 - PrintSysError ("element2d::GetNV not implemented for typ", typ)
279 + PrintSysError ("element2d::GetNV not implemented for typ", typ);
287 - PrintSysError ("Element3d::GetNV not implemented for typ ", typ)
288 + PrintSysError ("Element3d::GetNV not implemented for typ ", typ);
293 case PRISM12: return 5;
296 - PrintSysError ("element3d::GetNFaces not implemented for typ", typ)
297 + PrintSysError ("element3d::GetNFaces not implemented for typ", typ);
301 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/Makefile.am netgen-5.3.1_SRC_modif/libsrc/occ/Makefile.am
302 --- netgen-5.3.1_SRC_orig/libsrc/occ/Makefile.am 2014-08-29 13:54:03.000000000 +0400
303 +++ netgen-5.3.1_SRC_modif/libsrc/occ/Makefile.am 2017-09-11 18:08:21.234311865 +0300
308 -lib_LTLIBRARIES = libocc.la
309 +noinst_LTLIBRARIES = libocc.la
312 -lib_LTLIBRARIES += liboccvis.la
313 +lib_LTLIBRARIES = liboccvis.la
317 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Inter2d.cxx netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Inter2d.cxx
318 --- netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Inter2d.cxx 2014-08-29 13:54:03.000000000 +0400
319 +++ netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Inter2d.cxx 2017-09-11 18:08:21.228312514 +0300
321 #include <TopOpeBRep_EdgesIntersector.hxx>
322 #include <TopOpeBRep_Point2d.hxx>
323 #include <TopTools_ListIteratorOfListOfShape.hxx>
324 -#include <TopTools_ListOfShape.hxx>
325 #include <TopTools_MapIteratorOfMapOfShape.hxx>
326 -#include <TopTools_MapOfShape.hxx>
327 #include <TopoDS.hxx>
328 #include <TopoDS_Edge.hxx>
329 #include <TopoDS_Vertex.hxx>
330 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Inter2d.hxx netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Inter2d.hxx
331 --- netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Inter2d.hxx 2014-08-29 13:54:03.000000000 +0400
332 +++ netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Inter2d.hxx 2017-09-11 18:08:21.228312514 +0300
334 #ifndef _Partition_Inter2d_HeaderFile
335 #define _Partition_Inter2d_HeaderFile
337 -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile
338 +#include <Standard_Version.hxx>
340 +#if OCC_VERSION_MAJOR < 7
341 #include <Handle_BRepAlgo_AsDes.hxx>
343 #ifndef _Standard_Real_HeaderFile
345 #ifndef _Standard_Boolean_HeaderFile
346 #include <Standard_Boolean.hxx>
349 +#include <TopTools_MapOfShape.hxx>
350 +#include <TopTools_ListOfShape.hxx>
352 class BRepAlgo_AsDes;
354 -class TopTools_MapOfShape;
356 -class TopTools_ListOfShape;
360 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Inter3d.cxx netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Inter3d.cxx
361 --- netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Inter3d.cxx 2014-08-29 13:54:03.000000000 +0400
362 +++ netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Inter3d.cxx 2017-09-11 18:08:21.229312406 +0300
364 #include <TopOpeBRepTool_BoxSort.hxx>
365 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
366 #include <TopTools_ListIteratorOfListOfShape.hxx>
367 -#include <TopTools_ListOfShape.hxx>
368 #include <TopoDS.hxx>
369 #include <TopoDS_Compound.hxx>
370 #include <TopoDS_Edge.hxx>
372 Handle (Geom_Surface) S = BRep_Tool::Surface(F,L);
374 if (S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
375 - S = (*(Handle_Geom_RectangularTrimmedSurface*)&S)->BasisSurface();
376 + S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface();
378 if (!S->IsUPeriodic() && !S->IsVPeriodic())
380 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Inter3d.hxx netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Inter3d.hxx
381 --- netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Inter3d.hxx 2014-08-29 13:54:03.000000000 +0400
382 +++ netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Inter3d.hxx 2017-09-11 18:08:21.229312406 +0300
384 #ifndef _Partition_Inter3d_HeaderFile
385 #define _Partition_Inter3d_HeaderFile
387 -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile
388 +#include <Standard_Version.hxx>
390 +#if OCC_VERSION_MAJOR < 7
391 #include <Handle_BRepAlgo_AsDes.hxx>
393 #ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile
395 #ifndef _TopTools_MapOfShape_HeaderFile
396 #include <TopTools_MapOfShape.hxx>
398 +#ifndef _TopTools_ListOfShape_HeaderFile
399 +#include <TopTools_ListOfShape.hxx>
401 #ifndef _TopTools_DataMapOfShapeShape_HeaderFile
402 #include <TopTools_DataMapOfShapeShape.hxx>
405 #include <Standard_Boolean.hxx>
407 class BRepAlgo_AsDes;
408 -class TopTools_ListOfShape;
409 -class TopTools_DataMapOfShapeShape;
411 -class TopTools_MapOfShape;
416 void FacesPartition(const TopoDS_Face& F1,const TopoDS_Face& F2) ;
417 Standard_Boolean IsDone(const TopoDS_Face& F1,const TopoDS_Face& F2) const;
418 TopTools_MapOfShape& TouchedFaces() ;
419 - Handle_BRepAlgo_AsDes AsDes() const;
420 + Handle(BRepAlgo_AsDes) AsDes() const;
421 TopTools_MapOfShape& NewEdges() ;
422 Standard_Boolean HasSameDomainF(const TopoDS_Shape& F) const;
423 Standard_Boolean IsSameDomainF(const TopoDS_Shape& F1,const TopoDS_Shape& F2) const;
424 const TopTools_ListOfShape& SameDomain(const TopoDS_Face& F) const;
425 TopoDS_Vertex ReplaceSameDomainV(const TopoDS_Vertex& V,const TopoDS_Edge& E) const;
426 - Handle_BRepAlgo_AsDes SectionEdgesAD() const;
427 + Handle(BRepAlgo_AsDes) SectionEdgesAD() const;
428 Standard_Boolean IsSectionEdge(const TopoDS_Edge& E) const;
429 Standard_Boolean HasSectionEdge(const TopoDS_Face& F) const;
430 Standard_Boolean IsSplitOn(const TopoDS_Edge& NewE,const TopoDS_Edge& OldE,const TopoDS_Face& F) const;
431 @@ -121,11 +123,11 @@
435 - Handle_BRepAlgo_AsDes myAsDes;
436 + Handle(BRepAlgo_AsDes) myAsDes;
437 TopTools_DataMapOfShapeListOfShape myDone;
438 TopTools_MapOfShape myTouched;
439 TopTools_MapOfShape myNewEdges;
440 - Handle_BRepAlgo_AsDes mySectionEdgesAD;
441 + Handle(BRepAlgo_AsDes) mySectionEdgesAD;
442 TopTools_DataMapOfShapeListOfShape mySameDomainFM;
443 TopTools_DataMapOfShapeShape mySameDomainVM;
445 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Loop.hxx netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Loop.hxx
446 --- netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Loop.hxx 2014-08-29 13:54:03.000000000 +0400
447 +++ netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Loop.hxx 2017-09-11 18:08:21.229312406 +0300
452 -class TopTools_ListOfShape;
455 #ifndef _Standard_HeaderFile
456 #include <Standard.hxx>
457 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Loop2d.cxx netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Loop2d.cxx
458 --- netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Loop2d.cxx 2014-08-29 13:54:03.000000000 +0400
459 +++ netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Loop2d.cxx 2017-09-11 18:08:21.229312406 +0300
461 Cc->D1(uc, PC, CTg1);
462 if (!isForward) CTg1.Reverse();
464 - Standard_Real anglemin = 3 * PI, tolAng = 1.e-8;
465 + Standard_Real anglemin = 3 * M_PI, tolAng = 1.e-8;
467 // select an edge whose first derivative is most left of CTg1
468 // ie an angle between Tg1 and CTg1 is least
471 Standard_Real angle = Tg1.Angle(CTg1);
473 - if (PI - Abs(angle) <= tolAng)
474 + if (M_PI - Abs(angle) <= tolAng)
476 // an angle is too close to PI; assure that an angle sign really
477 // reflects an edge position: +PI - an edge is worst,
478 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Loop2d.hxx netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Loop2d.hxx
479 --- netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Loop2d.hxx 2014-08-29 13:54:03.000000000 +0400
480 +++ netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Loop2d.hxx 2017-09-11 18:08:21.230312298 +0300
485 -class TopTools_ListOfShape;
486 class BRepAlgo_Image;
489 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Loop3d.hxx netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Loop3d.hxx
490 --- netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Loop3d.hxx 2014-08-29 13:54:03.000000000 +0400
491 +++ netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Loop3d.hxx 2017-09-11 18:08:21.230312298 +0300
493 #ifndef _TopTools_ListOfShape_HeaderFile
494 #include <TopTools_ListOfShape.hxx>
496 +#ifndef _TopTools_MapOfOrientedShape_HeaderFile
497 +#include <TopTools_MapOfOrientedShape.hxx>
499 #ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile
500 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
503 #include <Standard_Real.hxx>
506 -class TopTools_ListOfShape;
507 -class TopTools_MapOfOrientedShape;
511 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Spliter.cxx netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Spliter.cxx
512 --- netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Spliter.cxx 2014-08-29 13:54:03.000000000 +0400
513 +++ netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Spliter.cxx 2017-09-11 18:08:21.230312298 +0300
515 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
516 #include <TopTools_IndexedMapOfShape.hxx>
517 #include <TopTools_ListIteratorOfListOfShape.hxx>
518 -#include <TopTools_ListOfShape.hxx>
519 #include <TopTools_MapIteratorOfMapOfShape.hxx>
520 #include <TopTools_SequenceOfShape.hxx>
522 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Spliter.hxx netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Spliter.hxx
523 --- netgen-5.3.1_SRC_orig/libsrc/occ/Partition_Spliter.hxx 2014-08-29 13:54:03.000000000 +0400
524 +++ netgen-5.3.1_SRC_modif/libsrc/occ/Partition_Spliter.hxx 2017-09-11 18:08:21.231312190 +0300
526 #ifndef _TopTools_DataMapOfShapeShape_HeaderFile
527 #include <TopTools_DataMapOfShapeShape.hxx>
529 -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile
530 -#include <Handle_BRepAlgo_AsDes.hxx>
532 #ifndef _BRepAlgo_Image_HeaderFile
533 #include <BRepAlgo_Image.hxx>
537 class BRepAlgo_AsDes;
539 -class TopTools_ListOfShape;
544 TopTools_DataMapOfShapeShape myFaceShapeMap;
545 TopTools_DataMapOfShapeShape myInternalFaces;
546 TopTools_DataMapOfShapeShape myIntNotClFaces;
547 - Handle_BRepAlgo_AsDes myAsDes;
548 + Handle(BRepAlgo_AsDes) myAsDes;
549 BRepAlgo_Image myImagesFaces;
550 BRepAlgo_Image myImagesEdges;
551 BRepAlgo_Image myImageShape;
552 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/occconstruction.cpp netgen-5.3.1_SRC_modif/libsrc/occ/occconstruction.cpp
553 --- netgen-5.3.1_SRC_orig/libsrc/occ/occconstruction.cpp 2014-08-29 13:54:03.000000000 +0400
554 +++ netgen-5.3.1_SRC_modif/libsrc/occ/occconstruction.cpp 2017-09-11 18:08:21.231312190 +0300
556 #include <BRepAlgoAPI_Common.hxx>
557 #include <BRepAlgoAPI_Fuse.hxx>
558 #include <BRepAlgoAPI_Section.hxx>
559 -#include <BRepOffsetAPI_Sewing.hxx>
560 +//#include <BRepOffsetAPI_Sewing.hxx>
561 //#include <BRepAlgo_Sewing.hxx>
562 #include <BRepOffsetAPI_MakeOffsetShape.hxx>
563 #include <ShapeFix_Shape.hxx>
564 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/occgenmesh.cpp netgen-5.3.1_SRC_modif/libsrc/occ/occgenmesh.cpp
565 --- netgen-5.3.1_SRC_orig/libsrc/occ/occgenmesh.cpp 2014-08-29 13:54:03.000000000 +0400
566 +++ netgen-5.3.1_SRC_modif/libsrc/occ/occgenmesh.cpp 2017-09-11 18:08:21.231312190 +0300
568 if(h < 1e-4*maxside)
\r
572 - if (h > 30) return;
\r
573 + // commented to restrict H on a large sphere for example
574 + //if (h > 30) return;
577 if (h < maxside && depth < 10)
\r
580 pnt = c->Value(s0);
\r
582 - double olddist = 0;
\r
584 + //double olddist = 0; -- useless variables
587 int tmpVal = (int)(DIVIDEEDGESECTIONS);
\r
589 @@ -259,15 +259,19 @@
592 pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0));
\r
593 + // -- no more than 1 segment per <edge length>/DIVIDEEDGESECTIONS
594 hvalue[i] = hvalue[i-1] +
\r
595 + // 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
596 + // pnt.Distance(oldpnt);
598 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
\r
599 - pnt.Distance(oldpnt);
\r
600 + pnt.Distance(oldpnt));
602 //(*testout) << "mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z())) " << mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))
\r
603 // << " pnt.Distance(oldpnt) " << pnt.Distance(oldpnt) << endl;
\r
606 - dist = pnt.Distance(oldpnt);
\r
607 + //olddist = dist; -- useless variables
608 + //dist = pnt.Distance(oldpnt);
611 // nsubedges = int(ceil(hvalue[DIVIDEEDGESECTIONS]));
\r
614 if (hvalue[i1]/hvalue[DIVIDEEDGESECTIONS]*nsubedges >= i)
\r
616 - params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
\r
617 + // -- for nsubedges comparable to DIVIDEEDGESECTIONS
618 + //params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
619 + double d1 = i1 - (hvalue[i1] - i*hvalue[DIVIDEEDGESECTIONS]/nsubedges)/(hvalue[i1]-hvalue[i1-1]);
620 + params[i] = s0+(d1/double(DIVIDEEDGESECTIONS))*(s1-s0);
621 pnt = c->Value(params[i]);
\r
622 ps[i-1] = MeshPoint (Point3d(pnt.X(), pnt.Y(), pnt.Z()));
\r
625 (*testout) << "nedges = " << nedges << endl;
\r
627 double eps = 1e-6 * geom.GetBoundingBox().Diam();
\r
628 + const double eps2 = eps * eps; // -- small optimization
630 + int first_vp = mesh.GetNP()+1; // -- to support SALOME sub-meshes
632 for (int i = 1; i <= nvertices; i++)
\r
637 for (PointIndex pi = 1; pi <= mesh.GetNP(); pi++)
\r
638 - if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
\r
639 + //if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
640 + if ( Dist2 (mesh[pi], Point<3>(mp)) < eps2 ) // -- small optimization
646 TopoDS_Face face = TopoDS::Face(exp1.Current());
\r
647 int facenr = geom.fmap.FindIndex(face);
\r
648 + if ( facenr < 1 ) continue; // -- to support SALOME sub-meshes
650 if (face2solid[0][facenr-1] == 0)
\r
651 face2solid[0][facenr-1] = solidnr;
\r
656 + edgenr = mesh.GetNSeg(); // to support SALOME sub-meshes
658 (*testout) << "faces = " << geom.fmap.Extent() << endl;
\r
661 //(*testout) << "ignoring degenerated edge" << endl;
\r
664 + if ( geom.emap.FindIndex(edge) < 1 ) continue; // to support SALOME sub-meshes
666 if (geom.vmap.FindIndex(TopExp::FirstVertex (edge)) ==
\r
667 geom.vmap.FindIndex(TopExp::LastVertex (edge)))
\r
668 @@ -477,20 +491,104 @@
672 - pnums[0] = geom.vmap.FindIndex (TopExp::FirstVertex (edge));
\r
673 - pnums[pnums.Size()-1] = geom.vmap.FindIndex (TopExp::LastVertex (edge));
\r
674 + //pnums[0] = geom.vmap.FindIndex (TopExp::FirstVertex (edge));
675 + //pnums[pnums.Size()-1] = geom.vmap.FindIndex (TopExp::LastVertex (edge));
676 + MeshPoint dfltP ( Point<3> ( 0, 0, 0 ) );
677 + int *ipp[] = { &pnums[0], &pnums[pnums.Size()-1] };
678 + TopoDS_Iterator vIt( edge, false );
679 + TopoDS_Vertex v[2];
680 + v[0] = TopoDS::Vertex( vIt.Value() ); vIt.Next();
681 + v[1] = TopoDS::Vertex( vIt.Value() );
682 + if ( v[0].Orientation() == TopAbs_REVERSED )
683 + std::swap( v[0], v[1] );
684 + for ( int i = 0; i < 2; ++i)
687 + ip = geom.vmap.FindIndex ( v[i] );
688 + if ( ip == 0 || ip > nvertices )
692 + ip = iv = geom.vmap.Add( v[i] );
693 + gp_Pnt pnt = BRep_Tool::Pnt( v[i] );
694 + MeshPoint mp( Point<3>(pnt.X(), pnt.Y(), pnt.Z()) );
695 + for (PointIndex pi = 1; pi < first_vp; pi++)
696 + if ( Dist2 (mesh.Point(pi), Point<3>(mp)) < 1e-100 )
699 + if ( mesh.Point(ip).GetLayer() != dfltP.GetLayer() && mesh.Point(ip).GetLayer() != iv )
701 + if ( mesh.Point(ip).GetLayer() == dfltP.GetLayer())
702 + mesh.Point(ip) = MeshPoint( mesh.Point(ip), iv );
708 - Point<3> fp = occ2ng (BRep_Tool::Pnt (TopExp::FirstVertex (edge)));
\r
709 - Point<3> lp = occ2ng (BRep_Tool::Pnt (TopExp::LastVertex (edge)));
\r
710 + ip += first_vp - 1;
716 + TopoDS_Iterator vIt( edge, false );
717 + TopoDS_Vertex v1 = TopoDS::Vertex( vIt.Value() ); vIt.Next();
718 + TopoDS_Vertex v2 = TopoDS::Vertex( vIt.Value() );
719 + if ( v1.Orientation() == TopAbs_REVERSED )
720 + std::swap( v1, v2 );
721 + const bool isClosedEdge = v1.IsSame( v2 );
723 + Point<3> fp = occ2ng (BRep_Tool::Pnt (v1));
724 + Point<3> lp = occ2ng (BRep_Tool::Pnt (v2));
725 + double tol2 = std::min( eps*eps, 1e-6 * Dist2( fp, lp ));
726 + if ( isClosedEdge )
727 + tol2 = BRep_Tool::Tolerance( v1 ) * BRep_Tool::Tolerance( v1 );
731 for (PointIndex pi = 1; pi < first_ep; pi++)
\r
733 - if (Dist2 (mesh[pi], fp) < eps*eps) pnums[0] = pi;
\r
734 - if (Dist2 (mesh[pi], lp) < eps*eps) pnums.Last() = pi;
\r
735 + if (Dist2 (mesh[pi], fp) < tol2) pnums[0] = pi;
736 + if (Dist2 (mesh[pi], lp) < tol2) pnums.Last() = pi;
738 + if (( isClosedEdge && pnums[0] != pnums.Last() ) ||
739 + ( !isClosedEdge && pnums[0] == pnums.Last() ))
740 + pnums[0] = pnums.Last() = -1;
741 + if ( pnums[0] == -1 || pnums.Last() == -1 )
743 + // take into account a possible large gap between a vertex and an edge curve
744 + // end and a large vertex tolerance covering the whole edge
745 + if ( pnums[0] == -1 )
747 + double tol = BRep_Tool::Tolerance( v1 );
748 + for (PointIndex pi = 1; pi < first_ep; pi++)
749 + if (pi != pnums.Last() && Dist2 (mesh[pi], fp) < 2*tol*tol)
752 + if ( pnums[0] == -1 )
753 + pnums[0] = first_ep-1- nvertices + geom.vmap.FindIndex ( v1 );
755 + if ( isClosedEdge )
757 + pnums.Last() = pnums[0];
761 + if ( pnums.Last() == -1 )
763 + double tol = BRep_Tool::Tolerance( v2 );
764 + for (PointIndex pi = 1; pi < first_ep; pi++)
765 + if (pi != pnums[0] && Dist2 (mesh[pi], lp) < 2*tol*tol)
768 + if ( pnums.Last() == -1 )
769 + pnums.Last() = first_ep-1-nvertices + geom.vmap.FindIndex ( v2 );
772 + if ( Dist2( fp, mesh[PointIndex(pnums[0])]) >
773 + Dist2( lp, mesh[PointIndex(pnums.Last())]))
774 + std::swap( pnums[0], pnums.Last() );
779 @@ -500,17 +598,20 @@
782 for (j = first_ep; j <= mesh.GetNP(); j++)
\r
784 + if (!merge_solids && mesh.Point(j).GetLayer() != geomedgenr ) continue; // to support SALOME fuse edges
785 if ((mesh.Point(j)-Point<3>(mp[i-1])).Length() < eps)
\r
796 - mesh.AddPoint (mp[i-1]);
\r
797 + mesh.AddPoint (mp[i-1], geomedgenr); // to support SALOME fuse edges
798 (*testout) << "add meshpoint " << mp[i-1] << endl;
\r
799 pnums[i] = mesh.GetNP();
\r
802 // (*testout) << "edge " << mesh.LineSegment(i).edgenr << " face " << mesh.LineSegment(i).si
\r
803 // << " p1 " << mesh.LineSegment(i)[0] << " p2 " << mesh.LineSegment(i)[1] << endl;
\r
805 + for (int j = 1; j <= mesh.GetNP(); j++) // to support SALOME fuse edges: set level to zero
806 + mesh.Point(j) = MeshPoint( (Point<3>&) mesh.Point(j) );
808 mesh.CalcSurfacesOfNode();
\r
809 multithread.task = savetask;
\r
810 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/occgeom.cpp netgen-5.3.1_SRC_modif/libsrc/occ/occgeom.cpp
811 --- netgen-5.3.1_SRC_orig/libsrc/occ/occgeom.cpp 2014-08-29 13:54:03.000000000 +0400
812 +++ netgen-5.3.1_SRC_modif/libsrc/occ/occgeom.cpp 2017-09-11 18:08:32.836058020 +0300
814 #include "ShapeAnalysis_CheckSmallFace.hxx"
\r
815 #include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx"
\r
816 #include "ShapeAnalysis_Surface.hxx"
\r
817 +#include <BRepTopAdaptor_FClass2d.hxx> // -- to optimize Project() and FastProject()
818 +#include <TopAbs_State.hxx>
819 #include "BRepAlgoAPI_Fuse.hxx"
\r
820 #include "BRepCheck_Analyzer.hxx"
\r
821 #include "BRepLib.hxx"
\r
823 #include "ShapeFix_FixSmallFace.hxx"
\r
824 #include "Partition_Spliter.hxx"
\r
829 + // free data used to optimize Project() and FastProject()
830 + OCCGeometry::~OCCGeometry()
832 + NCollection_DataMap<int,BRepTopAdaptor_FClass2d*>::Iterator it(fclsmap);
833 + for (; it.More(); it.Next())
837 void OCCGeometry :: PrintNrShapes ()
\r
840 @@ -112,13 +121,13 @@
841 double surfacecont = 0;
\r
844 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
845 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
846 rebuild->Apply(shape);
\r
847 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
849 TopoDS_Edge edge = TopoDS::Edge(exp1.Current());
\r
850 if ( BRep_Tool::Degenerated(edge) )
\r
851 - rebuild->Remove(edge, false);
\r
852 + rebuild->Remove(edge);
\r
854 shape = rebuild->Apply(shape);
\r
857 cout << endl << "- repairing faces" << endl;
\r
859 Handle(ShapeFix_Face) sff;
\r
860 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
861 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
862 rebuild->Apply(shape);
\r
866 cout << "(natural bounds added)" <<endl;
\r
867 TopoDS_Face newface = sff->Face();
\r
869 - rebuild->Replace(face, newface, Standard_False);
\r
870 + rebuild->Replace(face, newface);
\r
873 // Set the original colour of the face to the newly created
\r
874 @@ -200,13 +209,13 @@
878 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
879 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
880 rebuild->Apply(shape);
\r
881 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
883 TopoDS_Edge edge = TopoDS::Edge(exp1.Current());
\r
884 if ( BRep_Tool::Degenerated(edge) )
\r
885 - rebuild->Remove(edge, false);
\r
886 + rebuild->Remove(edge);
\r
888 shape = rebuild->Apply(shape);
\r
891 cout << endl << "- fixing small edges" << endl;
\r
893 Handle(ShapeFix_Wire) sfw;
\r
894 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
895 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
896 rebuild->Apply(shape);
\r
902 TopoDS_Wire newwire = sfw->Wire();
\r
903 - rebuild->Replace(oldwire, newwire, Standard_False);
\r
904 + rebuild->Replace(oldwire, newwire);
\r
907 //delete sfw; sfw = NULL;
\r
912 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
913 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
914 rebuild->Apply(shape);
\r
916 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
918 cout << "removing degenerated edge " << emap.FindIndex(edge)
\r
919 << " from vertex " << vmap.FindIndex(TopExp::FirstVertex (edge))
\r
920 << " to vertex " << vmap.FindIndex(TopExp::LastVertex (edge)) << endl;
\r
921 - rebuild->Remove(edge, false);
\r
922 + rebuild->Remove(edge);
\r
926 @@ -312,13 +321,13 @@
930 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
931 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
932 rebuild->Apply(shape);
\r
933 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
935 TopoDS_Edge edge = TopoDS::Edge(exp1.Current());
\r
936 if ( BRep_Tool::Degenerated(edge) )
\r
937 - rebuild->Remove(edge, false);
\r
938 + rebuild->Remove(edge);
\r
940 shape = rebuild->Apply(shape);
\r
942 @@ -438,13 +447,13 @@
946 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
947 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
948 rebuild->Apply(shape);
\r
949 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
951 TopoDS_Edge edge = TopoDS::Edge(exp1.Current());
\r
952 if ( BRep_Tool::Degenerated(edge) )
\r
953 - rebuild->Remove(edge, false);
\r
954 + rebuild->Remove(edge);
\r
956 shape = rebuild->Apply(shape);
\r
959 TopoDS_Solid solid = TopoDS::Solid(exp0.Current());
\r
960 TopoDS_Solid newsolid = solid;
\r
961 BRepLib::OrientClosedSolid (newsolid);
\r
962 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
963 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
964 // rebuild->Apply(shape);
\r
965 - rebuild->Replace(solid, newsolid, Standard_False);
\r
966 + rebuild->Replace(solid, newsolid);
\r
967 TopoDS_Shape newshape = rebuild->Apply(shape, TopAbs_COMPSOLID);//, 1);
\r
968 // TopoDS_Shape newshape = rebuild->Apply(shape);
\r
971 TopoDS_Solid solid = TopoDS::Solid(exp0.Current());
\r
972 TopoDS_Solid newsolid = solid;
\r
973 BRepLib::OrientClosedSolid (newsolid);
\r
974 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
975 - rebuild->Replace(solid, newsolid, Standard_False);
\r
976 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
977 + rebuild->Replace(solid, newsolid);
\r
979 TopoDS_Shape newshape = rebuild->Apply(shape, TopAbs_SHAPE, 1);
\r
981 @@ -951,25 +960,58 @@
985 + // returns a projector and a classifier for the given surface
986 + void OCCGeometry::GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
987 + BRepTopAdaptor_FClass2d*& cls) const
989 + //MSV: organize caching projector in the map
990 + if (fprjmap.IsBound(surfi))
992 + proj = fprjmap.Find(surfi);
993 + cls = fclsmap.Find(surfi);
997 + const TopoDS_Face& aFace = TopoDS::Face(fmap(surfi));
998 + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
999 + proj = new ShapeAnalysis_Surface(aSurf);
1000 + fprjmap.Bind(surfi, proj);
1001 + cls = new BRepTopAdaptor_FClass2d(aFace,Precision::Confusion());
1002 + fclsmap.Bind(surfi, cls);
1007 - void OCCGeometry :: Project (int surfi, Point<3> & p) const
\r
1008 + // void OCCGeometry :: Project (int surfi, Point<3> & p) const
1009 + bool OCCGeometry :: Project (int surfi, Point<3> & p, double& u, double& v) const
1011 static int cnt = 0;
\r
1012 if (++cnt % 1000 == 0) cout << "Project cnt = " << cnt << endl;
\r
1014 gp_Pnt pnt(p(0), p(1), p(2));
\r
1017 - Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
\r
1018 - Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
\r
1019 - gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
\r
1020 - suval.Coord( u, v);
\r
1021 - pnt = thesurf->Value( u, v );
\r
1023 + // -- Optimization: use cached projector and classifier
1025 + // Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
1026 + // Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
1027 + // gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
1028 + // suval.Coord( u, v);
1029 + // pnt = thesurf->Value( u, v );
1031 + Handle(ShapeAnalysis_Surface) proj;
1032 + BRepTopAdaptor_FClass2d *cls;
1033 + GetFaceTools(surfi, proj, cls);
1035 + gp_Pnt2d p2d = proj->ValueOfUV(pnt, Precision::Confusion());
1036 + if (cls->Perform(p2d) == TopAbs_OUT)
1040 + pnt = proj->Value(p2d);
1043 p = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
\r
1049 @@ -979,54 +1021,69 @@
1051 gp_Pnt p(ap(0), ap(1), ap(2));
\r
1053 - Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
\r
1055 - gp_Pnt x = surface->Value (u,v);
\r
1057 - if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
\r
1061 - surface->D1(u,v,x,du,dv);
\r
1067 - double det, lambda, mu;
\r
1074 - det = Det3 (n.X(), du.X(), dv.X(),
\r
1075 - n.Y(), du.Y(), dv.Y(),
\r
1076 - n.Z(), du.Z(), dv.Z());
\r
1078 - if (det < 1e-15) return false;
\r
1080 - lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
\r
1081 - n.Y(), p.Y()-x.Y(), dv.Y(),
\r
1082 - n.Z(), p.Z()-x.Z(), dv.Z())/det;
\r
1084 - mu = Det3 (n.X(), du.X(), p.X()-x.X(),
\r
1085 - n.Y(), du.Y(), p.Y()-x.Y(),
\r
1086 - n.Z(), du.Z(), p.Z()-x.Z())/det;
\r
1092 - surface->D1(u,v,x,du,dv);
\r
1094 - } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
\r
1096 - // (*testout) << "FastProject count: " << count << endl;
\r
1098 - if (count == 50) return false;
\r
1100 - ap = Point<3> (x.X(), x.Y(), x.Z());
\r
1101 + // -- Optimization: use cached projector and classifier
1102 + // Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
1104 + // gp_Pnt x = surface->Value (u,v);
1106 + // if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
1110 + // surface->D1(u,v,x,du,dv);
1116 + // double det, lambda, mu;
1123 + // det = Det3 (n.X(), du.X(), dv.X(),
1124 + // n.Y(), du.Y(), dv.Y(),
1125 + // n.Z(), du.Z(), dv.Z());
1127 + // if (det < 1e-15) return false;
1129 + // lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
1130 + // n.Y(), p.Y()-x.Y(), dv.Y(),
1131 + // n.Z(), p.Z()-x.Z(), dv.Z())/det;
1133 + // mu = Det3 (n.X(), du.X(), p.X()-x.X(),
1134 + // n.Y(), du.Y(), p.Y()-x.Y(),
1135 + // n.Z(), du.Z(), p.Z()-x.Z())/det;
1141 + // surface->D1(u,v,x,du,dv);
1143 + // } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
1145 + // // (*testout) << "FastProject count: " << count << endl;
1147 + // if (count == 50) return false;
1149 + // ap = Point<3> (x.X(), x.Y(), x.Z());
1150 + Handle(ShapeAnalysis_Surface) proj;
1151 + BRepTopAdaptor_FClass2d *cls;
1152 + GetFaceTools(surfi, proj, cls);
1154 + gp_Pnt2d p2d = proj->NextValueOfUV(gp_Pnt2d(u,v), p, Precision::Confusion());
1155 + if (cls->Perform(p2d) == TopAbs_OUT)
1157 + //cout << "Projection fails" << endl;
1161 + p = proj->Value(p2d);
1163 + ap = Point<3> (p.X(), p.Y(), p.Z());
1167 @@ -1038,9 +1095,9 @@
1169 cout << "writing stl..."; cout.flush();
\r
1170 StlAPI_Writer writer;
\r
1171 - writer.RelativeMode() = Standard_False;
\r
1172 + //writer.RelativeMode() = Standard_False;
1174 - writer.SetDeflection(0.02);
\r
1175 + //writer.SetDeflection(0.02);
1176 writer.Write(shape,filename);
\r
1178 cout << "done" << endl;
\r
1179 @@ -1059,10 +1116,10 @@
1180 occgeo = new OCCGeometry;
\r
1182 // Initiate a dummy XCAF Application to handle the IGES XCAF Document
\r
1183 - static Handle_XCAFApp_Application dummy_app = XCAFApp_Application::GetApplication();
\r
1184 + static Handle(XCAFApp_Application) dummy_app = XCAFApp_Application::GetApplication();
1186 // Create an XCAF Document to contain the IGES file itself
\r
1187 - Handle_TDocStd_Document iges_doc;
\r
1188 + Handle(TDocStd_Document) iges_doc;
1190 // Check if a IGES File is already open under this handle, if so, close it to prevent
\r
1191 // Segmentation Faults when trying to create a new document
\r
1192 @@ -1089,8 +1146,8 @@
1193 reader.Transfer(iges_doc);
\r
1195 // Read in the shape(s) and the colours present in the IGES File
\r
1196 - Handle_XCAFDoc_ShapeTool iges_shape_contents = XCAFDoc_DocumentTool::ShapeTool(iges_doc->Main());
\r
1197 - Handle_XCAFDoc_ColorTool iges_colour_contents = XCAFDoc_DocumentTool::ColorTool(iges_doc->Main());
\r
1198 + Handle(XCAFDoc_ShapeTool) iges_shape_contents = XCAFDoc_DocumentTool::ShapeTool(iges_doc->Main());
1199 + Handle(XCAFDoc_ColorTool) iges_colour_contents = XCAFDoc_DocumentTool::ColorTool(iges_doc->Main());
1201 TDF_LabelSequence iges_shapes;
\r
1202 iges_shape_contents->GetShapes(iges_shapes);
\r
1203 @@ -1137,10 +1194,10 @@
1204 occgeo = new OCCGeometry;
\r
1206 // Initiate a dummy XCAF Application to handle the STEP XCAF Document
\r
1207 - static Handle_XCAFApp_Application dummy_app = XCAFApp_Application::GetApplication();
\r
1208 + static Handle(XCAFApp_Application) dummy_app = XCAFApp_Application::GetApplication();
1210 // Create an XCAF Document to contain the STEP file itself
\r
1211 - Handle_TDocStd_Document step_doc;
\r
1212 + Handle(TDocStd_Document) step_doc;
1214 // Check if a STEP File is already open under this handle, if so, close it to prevent
\r
1215 // Segmentation Faults when trying to create a new document
\r
1216 @@ -1167,8 +1224,8 @@
1217 reader.Transfer(step_doc);
\r
1219 // Read in the shape(s) and the colours present in the STEP File
\r
1220 - Handle_XCAFDoc_ShapeTool step_shape_contents = XCAFDoc_DocumentTool::ShapeTool(step_doc->Main());
\r
1221 - Handle_XCAFDoc_ColorTool step_colour_contents = XCAFDoc_DocumentTool::ColorTool(step_doc->Main());
\r
1222 + Handle(XCAFDoc_ShapeTool) step_shape_contents = XCAFDoc_DocumentTool::ShapeTool(step_doc->Main());
1223 + Handle(XCAFDoc_ColorTool) step_colour_contents = XCAFDoc_DocumentTool::ColorTool(step_doc->Main());
1225 TDF_LabelSequence step_shapes;
\r
1226 step_shape_contents->GetShapes(step_shapes);
\r
1227 @@ -1221,7 +1278,7 @@
1228 // Fixed a bug in the OpenCascade XDE Colour handling when
\r
1229 // opening BREP Files, since BREP Files have no colour data.
\r
1230 // Hence, the face_colours Handle needs to be created as a NULL handle.
\r
1231 - occgeo->face_colours = Handle_XCAFDoc_ColorTool();
\r
1232 + occgeo->face_colours = Handle(XCAFDoc_ColorTool)();
1233 occgeo->face_colours.Nullify();
\r
1234 occgeo->changed = 1;
\r
1235 occgeo->BuildFMap();
\r
1236 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/occgeom.hpp netgen-5.3.1_SRC_modif/libsrc/occ/occgeom.hpp
1237 --- netgen-5.3.1_SRC_orig/libsrc/occ/occgeom.hpp 2014-08-29 13:54:03.000000000 +0400
1238 +++ netgen-5.3.1_SRC_modif/libsrc/occ/occgeom.hpp 2017-09-11 18:08:21.233311974 +0300
1240 #include "Geom_Curve.hxx"
\r
1241 #include "Geom2d_Curve.hxx"
\r
1242 #include "Geom_Surface.hxx"
\r
1243 -#include "GeomAPI_ProjectPointOnSurf.hxx"
\r
1244 -#include "GeomAPI_ProjectPointOnCurve.hxx"
\r
1245 +// #include "GeomAPI_ProjectPointOnSurf.hxx"
1246 +// #include "GeomAPI_ProjectPointOnCurve.hxx"
1247 #include "BRepTools.hxx"
\r
1248 #include "TopExp.hxx"
\r
1249 #include "BRepBuilderAPI_MakeVertex.hxx"
\r
1251 #include "Geom_Curve.hxx"
\r
1252 #include "Geom2d_Curve.hxx"
\r
1253 #include "Geom_Surface.hxx"
\r
1254 -#include "GeomAPI_ProjectPointOnSurf.hxx"
\r
1255 -#include "GeomAPI_ProjectPointOnCurve.hxx"
\r
1256 +// #include "GeomAPI_ProjectPointOnSurf.hxx"
1257 +// #include "GeomAPI_ProjectPointOnCurve.hxx"
1258 #include "TopoDS_Wire.hxx"
\r
1259 #include "BRepTools_WireExplorer.hxx"
\r
1260 #include "BRepTools.hxx"
\r
1262 #include "IGESToBRep_Reader.hxx"
\r
1263 #include "Interface_Static.hxx"
\r
1264 #include "GeomAPI_ExtremaCurveCurve.hxx"
\r
1265 -#include "Standard_ErrorHandler.hxx"
\r
1266 +//#include "Standard_ErrorHandler.hxx"
1267 #include "Standard_Failure.hxx"
\r
1268 #include "ShapeUpgrade_ShellSewing.hxx"
\r
1269 #include "ShapeFix_Shape.hxx"
\r
1270 #include "ShapeFix_Wireframe.hxx"
\r
1271 +#include <Standard_Version.hxx>
1272 +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) <= 0x060702
1273 +// porting to OCCT6.7.3
1274 #include "BRepMesh.hxx"
\r
1276 #include "BRepMesh_IncrementalMesh.hxx"
\r
1277 #include "BRepBndLib.hxx"
\r
1278 #include "Bnd_Box.hxx"
\r
1279 #include "ShapeAnalysis.hxx"
\r
1280 #include "ShapeBuild_ReShape.hxx"
\r
1282 +// -- Optimization: to use cached projector and classifier
1283 +#include <NCollection_DataMap.hxx>
1284 +class ShapeAnalysis_Surface;
1285 +class BRepTopAdaptor_FClass2d;
1287 // Philippose - 29/01/2009
\r
1288 // OpenCascade XDE Support
\r
1290 class OCCGeometry : public NetgenGeometry
\r
1293 + // -- Optimization: to use cached projector and classifier
1294 + mutable NCollection_DataMap<int,Handle(ShapeAnalysis_Surface)> fprjmap;
1295 + mutable NCollection_DataMap<int,BRepTopAdaptor_FClass2d*> fclsmap;
1298 TopoDS_Shape shape;
\r
1300 // OpenCascade XDE Support
\r
1301 // XCAF Handle to make the face colours available to the rest of
\r
1303 - Handle_XCAFDoc_ColorTool face_colours;
\r
1304 + Handle(XCAFDoc_ColorTool) face_colours;
1306 mutable int changed;
\r
1307 Array<int> facemeshstatus;
\r
1309 virtual void Save (string filename) const;
\r
1312 + ~OCCGeometry(); // -- to free cached projector and classifier
1316 Box<3> GetBoundingBox()
\r
1317 @@ -266,9 +279,14 @@
1321 - void Project (int surfi, Point<3> & p) const;
\r
1322 + // void Project (int surfi, Point<3> & p) const; -- optimization
1323 + bool Project (int surfi, Point<3> & p, double& u, double& v) const;
1324 bool FastProject (int surfi, Point<3> & ap, double& u, double& v) const;
\r
1326 + // -- Optimization: to use cached projector and classifier
1327 + void GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
1328 + BRepTopAdaptor_FClass2d*& cls) const;
1330 OCCSurface GetSurface (int surfi)
\r
1332 cout << "OCCGeometry::GetSurface using PLANESPACE" << endl;
\r
1333 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/occmeshsurf.cpp netgen-5.3.1_SRC_modif/libsrc/occ/occmeshsurf.cpp
1334 --- netgen-5.3.1_SRC_orig/libsrc/occ/occmeshsurf.cpp 2014-08-29 13:54:03.000000000 +0400
1335 +++ netgen-5.3.1_SRC_modif/libsrc/occ/occmeshsurf.cpp 2017-09-11 18:08:21.233311974 +0300
1337 #include <meshing.hpp>
1338 #include <GeomLProp_SLProps.hxx>
1339 #include <ShapeAnalysis_Surface.hxx>
1340 +#include <GeomAPI_ProjectPointOnCurve.hxx> // -- moved here from occgeom.hpp
1349 + else if ( lprop.IsNormalDefined() )
1351 n(0)=lprop.Normal().X();
1352 n(1)=lprop.Normal().Y();
1353 n(2)=lprop.Normal().Z();
1362 (*testout) << "u " << geominfo.u << " v " << geominfo.v
1363 @@ -434,23 +438,33 @@
1365 void MeshOptimize2dOCCSurfaces :: ProjectPoint (INDEX surfind, Point<3> & p) const
1367 - geometry.Project (surfind, p);
1368 + // geometry.Project (surfind, p); -- signature of Project() changed for optimization
1370 + geometry.Project (surfind, p, u, v);
1374 int MeshOptimize2dOCCSurfaces :: ProjectPointGI (INDEX surfind, Point<3> & p, PointGeomInfo & gi) const
1378 + //double u = gi.u;
1379 + //double v = gi.v;
1382 - if (geometry.FastProject (surfind, hp, u, v))
1384 + // -- u and v are computed by FastProject() and Project(), no need to call CalcPointGeomInfo()
1385 + // if (geometry.FastProject (surfind, hp, u, v))
1390 + // ProjectPoint (surfind, p);
1391 + // return CalcPointGeomInfo (surfind, gi, p);
1393 + if (gi.trignum > 0)
1394 + ok = geometry.FastProject (surfind, hp, gi.u, gi.v);
1396 + ok = geometry.Project (surfind, hp, gi.u, gi.v);
1400 - ProjectPoint (surfind, p);
1401 - return CalcPointGeomInfo (surfind, gi, p);
1407 if (!geometry.FastProject (surfi, hnewp, u, v))
1409 // cout << "Fast projection to surface fails! Using OCC projection" << endl;
1410 - geometry.Project (surfi, hnewp);
1411 + // geometry.Project (surfi, hnewp); -- Project() changed for optimization
1412 + geometry.Project (surfi, hnewp, u, v);
1421 + }//; -- to compile with -Wall -pedantic
1424 void OCCRefinementSurfaces ::
1425 @@ -708,14 +723,18 @@
1426 hnewp = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
1430 + }//; -- to compile with -Wall -pedantic
1433 void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi) const
1436 - geometry.Project (surfi, p);
1438 + //geometry.Project (surfi, p);
1441 + geometry.Project (surfi, p, u, v);
1443 + }//; -- to compile with -Wall -pedantic
1445 void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi, PointGeomInfo & gi) const
1447 @@ -723,9 +742,10 @@
1448 if (!geometry.FastProject (surfi, p, gi.u, gi.v))
1450 cout << "Fast projection to surface fails! Using OCC projection" << endl;
1451 - geometry.Project (surfi, p);
1453 + geometry.Project (surfi, p, u, v);
1460 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/occpkg.cpp netgen-5.3.1_SRC_modif/libsrc/occ/occpkg.cpp
1461 --- netgen-5.3.1_SRC_orig/libsrc/occ/occpkg.cpp 2014-08-29 13:54:03.000000000 +0400
1462 +++ netgen-5.3.1_SRC_modif/libsrc/occ/occpkg.cpp 2017-09-11 18:08:32.837057913 +0300
1464 if (strcmp (argv[2], "Wire") == 0) sh = occgeometry->wmap(nr);
\r
1465 if (strcmp (argv[2], "Edge") == 0) sh = occgeometry->emap(nr);
\r
1467 - rebuild->Replace(sh, sh.Reversed(), Standard_False);
\r
1468 + rebuild->Replace(sh, sh.Reversed());
\r
1470 TopoDS_Shape newshape = rebuild->Apply(occgeometry->shape, TopAbs_SHELL, 1);
\r
1471 occgeometry->shape = newshape;
\r
1472 diff -Naur netgen-5.3.1_SRC_orig/libsrc/occ/utilities.h netgen-5.3.1_SRC_modif/libsrc/occ/utilities.h
1473 --- netgen-5.3.1_SRC_orig/libsrc/occ/utilities.h 2014-08-29 13:54:03.000000000 +0400
1474 +++ netgen-5.3.1_SRC_modif/libsrc/occ/utilities.h 2017-09-11 18:08:21.233311974 +0300
1481 // #include "SALOME_Log.hxx"
1483 diff -Naur netgen-5.3.1_SRC_orig/libsrc/stlgeom/Makefile.am netgen-5.3.1_SRC_modif/libsrc/stlgeom/Makefile.am
1484 --- netgen-5.3.1_SRC_orig/libsrc/stlgeom/Makefile.am 2014-08-29 13:54:05.000000000 +0400
1485 +++ netgen-5.3.1_SRC_modif/libsrc/stlgeom/Makefile.am 2017-09-11 18:08:21.235311757 +0300
1487 AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include $(TCL_INCLUDES)
1490 -lib_LTLIBRARIES = libstl.la
1491 +noinst_LTLIBRARIES = libstl.la
1494 -lib_LTLIBRARIES += libstlvis.la
1495 +lib_LTLIBRARIES = libstlvis.la
1498 libstl_la_SOURCES = meshstlsurface.cpp stlgeom.cpp stlgeomchart.cpp \
1501 libstlvis_la_SOURCES = stlpkg.cpp vsstl.cpp
1502 libstlvis_la_LIBADD = libstl.la
1503 -libstl_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la
1504 # libstlvis_la_LIBADD = libstl.la $(top_builddir)/libsrc/linalg/libla.la
1506 diff -Naur netgen-5.3.1_SRC_orig/nglib/Makefile.am netgen-5.3.1_SRC_modif/nglib/Makefile.am
1507 --- netgen-5.3.1_SRC_orig/nglib/Makefile.am 2014-08-29 13:54:00.000000000 +0400
1508 +++ netgen-5.3.1_SRC_modif/nglib/Makefile.am 2017-09-11 18:08:21.235311757 +0300
1510 $(top_builddir)/libsrc/stlgeom/libstl.la \
1511 $(top_builddir)/libsrc/occ/libocc.la \
1512 $(top_builddir)/libsrc/meshing/libmesh.la \
1513 + $(top_builddir)/libsrc/general/libgen.la \
1514 + $(top_builddir)/libsrc/gprim/libgprim.la \
1515 + $(top_builddir)/libsrc/linalg/libla.la
1516 $(OCCLIBS) $(MPI_LIBS)
1518 libnglib_la_LDFLAGS = -avoid-version
1519 diff -Naur netgen-5.3.1_SRC_orig/nglib/nglib.h netgen-5.3.1_SRC_modif/nglib/nglib.h
1520 --- netgen-5.3.1_SRC_orig/nglib/nglib.h 2014-08-29 13:54:00.000000000 +0400
1521 +++ netgen-5.3.1_SRC_modif/nglib/nglib.h 2017-09-11 18:08:21.233311974 +0300
1523 // Philippose - 14.02.2009
\r
1524 // Modifications for creating a DLL in Windows
\r
1526 - #ifdef NGLIB_EXPORTS || nglib_EXPORTS
\r
1527 + #if defined NGLIB_EXPORTS || defined nglib_EXPORTS
1528 #define DLL_HEADER __declspec(dllexport)
\r
1530 #define DLL_HEADER __declspec(dllimport)
\r