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
30 if test a$occon = atrue ; then
32 - AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I$occdir/inc -I/usr/include/opencascade"])
33 - 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"])
34 + AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I$occdir/include/opencascade"])
35 + 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"])
36 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"])
39 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/findip.hpp netgen-5.3.1_new/libsrc/meshing/findip.hpp
40 --- netgen-5.3.1_orig/libsrc/meshing/findip.hpp 2014-08-29 13:54:05.000000000 +0400
41 +++ netgen-5.3.1_new/libsrc/meshing/findip.hpp 2016-09-30 20:38:56.662234111 +0300
43 static int timer = NgProfiler::CreateTimer ("FindInnerPoint");
44 NgProfiler::RegionTimer reg (timer);
46 + if ( points.Size() < 3 )
52 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/improve3.cpp netgen-5.3.1_new/libsrc/meshing/improve3.cpp
53 --- netgen-5.3.1_orig/libsrc/meshing/improve3.cpp 2014-08-29 13:54:05.000000000 +0400
54 +++ netgen-5.3.1_new/libsrc/meshing/improve3.cpp 2016-10-03 16:16:57.636639300 +0300
61 for (int l = 2; l < nsuround; l++)
63 @@ -1239,10 +1240,12 @@
66 suroundpts[l] = newpi;
72 + if ( nbtetused < nsuround )
76 for (int k = 0; k < nsuround; k++)
77 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/meshtype.cpp netgen-5.3.1_new/libsrc/meshing/meshtype.cpp
78 --- netgen-5.3.1_orig/libsrc/meshing/meshtype.cpp 2014-08-29 13:54:05.000000000 +0400
79 +++ netgen-5.3.1_new/libsrc/meshing/meshtype.cpp 2016-09-29 14:04:51.500148293 +0300
82 +#include <float.h> // to get DBL_MIN defined
84 #include "meshing.hpp"
88 double det = trans.Det();
92 + if (det <= DBL_MIN) // avoid FPE
95 err += frob * frob / det;
98 double det = trans(0,0)*trans(1,1)-trans(1,0)*trans(0,1);
102 + if (det <= DBL_MIN) // avoid FPE
107 = dtrans(0,0) * trans(1,1) - trans(0,1) * dtrans(1,0)
108 + trans(0,0) * dtrans(1,1) - dtrans(0,1) * trans(1,0);
112 + if (det <= DBL_MIN) // avoid FPE
119 double det = trans.Det();
122 + if (det <= DBL_MIN) // avoid FPE
125 err += frob * frob / det;
126 @@ -1864,7 +1869,8 @@
130 - if (noz == 0.0) noz = 1e-10;
131 + //if (noz == 0.0) noz = 1e-10;
132 + if (noz <= DBL_MIN) noz = 1e-10; // avoid FPE
134 double xi = p(0) / noz;
135 double eta = p(1) / noz;
136 @@ -2030,7 +2036,8 @@
138 double det = -trans.Det();
142 + if (det <= DBL_MIN) // avoid FPE
145 err += frob * frob * frob / det;
146 @@ -2102,7 +2109,8 @@
152 + if (det <= DBL_MIN) // avoid FPE
156 @@ -2184,7 +2192,7 @@
161 + if (det <= DBL_MIN)
165 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/meshtype.hpp netgen-5.3.1_new/libsrc/meshing/meshtype.hpp
166 --- netgen-5.3.1_orig/libsrc/meshing/meshtype.hpp 2014-08-29 13:54:05.000000000 +0400
167 +++ netgen-5.3.1_new/libsrc/meshing/meshtype.hpp 2016-09-30 14:28:09.147575801 +0300
172 +class Mesh; // added due to compilation errors on some platforms
179 if (typ != QUAD && typ != QUAD6 && typ != QUAD8)
180 - PrintSysError ("element2d::GetNV not implemented for typ", typ)
181 + PrintSysError ("element2d::GetNV not implemented for typ", typ);
189 - PrintSysError ("Element3d::GetNV not implemented for typ ", typ)
190 + PrintSysError ("Element3d::GetNV not implemented for typ ", typ);
195 case PRISM12: return 5;
198 - PrintSysError ("element3d::GetNFaces not implemented for typ", typ)
199 + PrintSysError ("element3d::GetNFaces not implemented for typ", typ);
203 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.cxx netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.cxx
204 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.cxx 2014-08-29 13:54:03.000000000 +0400
205 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.cxx 2016-09-29 14:44:01.996464598 +0300
207 #include <TopOpeBRep_EdgesIntersector.hxx>
208 #include <TopOpeBRep_Point2d.hxx>
209 #include <TopTools_ListIteratorOfListOfShape.hxx>
210 -#include <TopTools_ListOfShape.hxx>
211 #include <TopTools_MapIteratorOfMapOfShape.hxx>
212 -#include <TopTools_MapOfShape.hxx>
213 #include <TopoDS.hxx>
214 #include <TopoDS_Edge.hxx>
215 #include <TopoDS_Vertex.hxx>
216 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.hxx
217 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.hxx 2014-08-29 13:54:03.000000000 +0400
218 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.hxx 2016-09-29 14:44:01.996464598 +0300
220 #ifndef _Partition_Inter2d_HeaderFile
221 #define _Partition_Inter2d_HeaderFile
223 -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile
224 +#include <Standard_Version.hxx>
226 +#if OCC_VERSION_MAJOR < 7
227 #include <Handle_BRepAlgo_AsDes.hxx>
229 #ifndef _Standard_Real_HeaderFile
231 #ifndef _Standard_Boolean_HeaderFile
232 #include <Standard_Boolean.hxx>
235 +#include <TopTools_MapOfShape.hxx>
236 +#include <TopTools_ListOfShape.hxx>
238 class BRepAlgo_AsDes;
240 -class TopTools_MapOfShape;
242 -class TopTools_ListOfShape;
246 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.cxx netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.cxx
247 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.cxx 2014-08-29 13:54:03.000000000 +0400
248 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.cxx 2016-09-29 14:44:02.000464619 +0300
250 #include <TopOpeBRepTool_BoxSort.hxx>
251 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
252 #include <TopTools_ListIteratorOfListOfShape.hxx>
253 -#include <TopTools_ListOfShape.hxx>
254 #include <TopoDS.hxx>
255 #include <TopoDS_Compound.hxx>
256 #include <TopoDS_Edge.hxx>
258 Handle (Geom_Surface) S = BRep_Tool::Surface(F,L);
260 if (S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
261 - S = (*(Handle_Geom_RectangularTrimmedSurface*)&S)->BasisSurface();
262 + S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface();
264 if (!S->IsUPeriodic() && !S->IsVPeriodic())
266 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.hxx
267 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.hxx 2014-08-29 13:54:03.000000000 +0400
268 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.hxx 2016-09-29 14:44:02.000464619 +0300
270 #ifndef _Partition_Inter3d_HeaderFile
271 #define _Partition_Inter3d_HeaderFile
273 -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile
274 +#include <Standard_Version.hxx>
276 +#if OCC_VERSION_MAJOR < 7
277 #include <Handle_BRepAlgo_AsDes.hxx>
279 #ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile
281 #ifndef _TopTools_MapOfShape_HeaderFile
282 #include <TopTools_MapOfShape.hxx>
284 +#ifndef _TopTools_ListOfShape_HeaderFile
285 +#include <TopTools_ListOfShape.hxx>
287 #ifndef _TopTools_DataMapOfShapeShape_HeaderFile
288 #include <TopTools_DataMapOfShapeShape.hxx>
291 #include <Standard_Boolean.hxx>
293 class BRepAlgo_AsDes;
294 -class TopTools_ListOfShape;
295 -class TopTools_DataMapOfShapeShape;
297 -class TopTools_MapOfShape;
302 void FacesPartition(const TopoDS_Face& F1,const TopoDS_Face& F2) ;
303 Standard_Boolean IsDone(const TopoDS_Face& F1,const TopoDS_Face& F2) const;
304 TopTools_MapOfShape& TouchedFaces() ;
305 - Handle_BRepAlgo_AsDes AsDes() const;
306 + Handle(BRepAlgo_AsDes) AsDes() const;
307 TopTools_MapOfShape& NewEdges() ;
308 Standard_Boolean HasSameDomainF(const TopoDS_Shape& F) const;
309 Standard_Boolean IsSameDomainF(const TopoDS_Shape& F1,const TopoDS_Shape& F2) const;
310 const TopTools_ListOfShape& SameDomain(const TopoDS_Face& F) const;
311 TopoDS_Vertex ReplaceSameDomainV(const TopoDS_Vertex& V,const TopoDS_Edge& E) const;
312 - Handle_BRepAlgo_AsDes SectionEdgesAD() const;
313 + Handle(BRepAlgo_AsDes) SectionEdgesAD() const;
314 Standard_Boolean IsSectionEdge(const TopoDS_Edge& E) const;
315 Standard_Boolean HasSectionEdge(const TopoDS_Face& F) const;
316 Standard_Boolean IsSplitOn(const TopoDS_Edge& NewE,const TopoDS_Edge& OldE,const TopoDS_Face& F) const;
317 @@ -121,11 +123,11 @@
321 - Handle_BRepAlgo_AsDes myAsDes;
322 + Handle(BRepAlgo_AsDes) myAsDes;
323 TopTools_DataMapOfShapeListOfShape myDone;
324 TopTools_MapOfShape myTouched;
325 TopTools_MapOfShape myNewEdges;
326 - Handle_BRepAlgo_AsDes mySectionEdgesAD;
327 + Handle(BRepAlgo_AsDes) mySectionEdgesAD;
328 TopTools_DataMapOfShapeListOfShape mySameDomainFM;
329 TopTools_DataMapOfShapeShape mySameDomainVM;
331 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop.hxx netgen-5.3.1_new/libsrc/occ/Partition_Loop.hxx
332 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop.hxx 2014-08-29 13:54:03.000000000 +0400
333 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop.hxx 2016-09-29 14:44:02.000464619 +0300
338 -class TopTools_ListOfShape;
341 #ifndef _Standard_HeaderFile
342 #include <Standard.hxx>
343 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.cxx netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.cxx
344 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.cxx 2014-08-29 13:54:03.000000000 +0400
345 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.cxx 2016-09-29 14:04:51.504148314 +0300
347 Cc->D1(uc, PC, CTg1);
348 if (!isForward) CTg1.Reverse();
350 - Standard_Real anglemin = 3 * PI, tolAng = 1.e-8;
351 + Standard_Real anglemin = 3 * M_PI, tolAng = 1.e-8;
353 // select an edge whose first derivative is most left of CTg1
354 // ie an angle between Tg1 and CTg1 is least
357 Standard_Real angle = Tg1.Angle(CTg1);
359 - if (PI - Abs(angle) <= tolAng)
360 + if (M_PI - Abs(angle) <= tolAng)
362 // an angle is too close to PI; assure that an angle sign really
363 // reflects an edge position: +PI - an edge is worst,
364 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.hxx
365 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.hxx 2014-08-29 13:54:03.000000000 +0400
366 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.hxx 2016-09-29 14:44:02.000464619 +0300
371 -class TopTools_ListOfShape;
372 class BRepAlgo_Image;
375 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop3d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Loop3d.hxx
376 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop3d.hxx 2014-08-29 13:54:03.000000000 +0400
377 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop3d.hxx 2016-09-29 14:44:02.000464619 +0300
379 #ifndef _TopTools_ListOfShape_HeaderFile
380 #include <TopTools_ListOfShape.hxx>
382 +#ifndef _TopTools_MapOfOrientedShape_HeaderFile
383 +#include <TopTools_MapOfOrientedShape.hxx>
385 #ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile
386 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
389 #include <Standard_Real.hxx>
392 -class TopTools_ListOfShape;
393 -class TopTools_MapOfOrientedShape;
397 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.cxx netgen-5.3.1_new/libsrc/occ/Partition_Spliter.cxx
398 --- netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.cxx 2014-08-29 13:54:03.000000000 +0400
399 +++ netgen-5.3.1_new/libsrc/occ/Partition_Spliter.cxx 2016-09-29 14:44:02.000464619 +0300
401 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
402 #include <TopTools_IndexedMapOfShape.hxx>
403 #include <TopTools_ListIteratorOfListOfShape.hxx>
404 -#include <TopTools_ListOfShape.hxx>
405 #include <TopTools_MapIteratorOfMapOfShape.hxx>
406 #include <TopTools_SequenceOfShape.hxx>
408 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.hxx netgen-5.3.1_new/libsrc/occ/Partition_Spliter.hxx
409 --- netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.hxx 2014-08-29 13:54:03.000000000 +0400
410 +++ netgen-5.3.1_new/libsrc/occ/Partition_Spliter.hxx 2016-09-29 14:44:02.004464639 +0300
412 #ifndef _TopTools_DataMapOfShapeShape_HeaderFile
413 #include <TopTools_DataMapOfShapeShape.hxx>
415 -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile
416 -#include <Handle_BRepAlgo_AsDes.hxx>
418 #ifndef _BRepAlgo_Image_HeaderFile
419 #include <BRepAlgo_Image.hxx>
423 class BRepAlgo_AsDes;
425 -class TopTools_ListOfShape;
430 TopTools_DataMapOfShapeShape myFaceShapeMap;
431 TopTools_DataMapOfShapeShape myInternalFaces;
432 TopTools_DataMapOfShapeShape myIntNotClFaces;
433 - Handle_BRepAlgo_AsDes myAsDes;
434 + Handle(BRepAlgo_AsDes) myAsDes;
435 BRepAlgo_Image myImagesFaces;
436 BRepAlgo_Image myImagesEdges;
437 BRepAlgo_Image myImageShape;
438 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occconstruction.cpp netgen-5.3.1_new/libsrc/occ/occconstruction.cpp
439 --- netgen-5.3.1_orig/libsrc/occ/occconstruction.cpp 2014-08-29 13:54:03.000000000 +0400
440 +++ netgen-5.3.1_new/libsrc/occ/occconstruction.cpp 2016-09-29 14:04:51.500148293 +0300
442 #include <BRepAlgoAPI_Common.hxx>
443 #include <BRepAlgoAPI_Fuse.hxx>
444 #include <BRepAlgoAPI_Section.hxx>
445 -#include <BRepOffsetAPI_Sewing.hxx>
446 +//#include <BRepOffsetAPI_Sewing.hxx>
447 //#include <BRepAlgo_Sewing.hxx>
448 #include <BRepOffsetAPI_MakeOffsetShape.hxx>
449 #include <ShapeFix_Shape.hxx>
450 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occgenmesh.cpp netgen-5.3.1_new/libsrc/occ/occgenmesh.cpp
451 --- netgen-5.3.1_orig/libsrc/occ/occgenmesh.cpp 2014-08-29 13:54:03.000000000 +0400
452 +++ netgen-5.3.1_new/libsrc/occ/occgenmesh.cpp 2016-09-29 14:04:51.500148293 +0300
454 if(h < 1e-4*maxside)
\r
458 - if (h > 30) return;
\r
459 + // commented to restrict H on a large sphere for example
460 + //if (h > 30) return;
463 if (h < maxside && depth < 10)
\r
466 pnt = c->Value(s0);
\r
468 - double olddist = 0;
\r
470 + //double olddist = 0; -- useless variables
473 int tmpVal = (int)(DIVIDEEDGESECTIONS);
\r
475 @@ -259,15 +259,19 @@
478 pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0));
\r
479 + // -- no more than 1 segment per <edge length>/DIVIDEEDGESECTIONS
480 hvalue[i] = hvalue[i-1] +
\r
481 + // 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
482 + // pnt.Distance(oldpnt);
484 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
\r
485 - pnt.Distance(oldpnt);
\r
486 + pnt.Distance(oldpnt));
488 //(*testout) << "mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z())) " << mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))
\r
489 // << " pnt.Distance(oldpnt) " << pnt.Distance(oldpnt) << endl;
\r
492 - dist = pnt.Distance(oldpnt);
\r
493 + //olddist = dist; -- useless variables
494 + //dist = pnt.Distance(oldpnt);
497 // nsubedges = int(ceil(hvalue[DIVIDEEDGESECTIONS]));
\r
500 if (hvalue[i1]/hvalue[DIVIDEEDGESECTIONS]*nsubedges >= i)
\r
502 - params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
\r
503 + // -- for nsubedges comparable to DIVIDEEDGESECTIONS
504 + //params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
505 + double d1 = i1 - (hvalue[i1] - i*hvalue[DIVIDEEDGESECTIONS]/nsubedges)/(hvalue[i1]-hvalue[i1-1]);
506 + params[i] = s0+(d1/double(DIVIDEEDGESECTIONS))*(s1-s0);
507 pnt = c->Value(params[i]);
\r
508 ps[i-1] = MeshPoint (Point3d(pnt.X(), pnt.Y(), pnt.Z()));
\r
511 (*testout) << "nedges = " << nedges << endl;
\r
513 double eps = 1e-6 * geom.GetBoundingBox().Diam();
\r
514 + const double eps2 = eps * eps; // -- small optimization
516 + int first_vp = mesh.GetNP()+1; // -- to support SALOME sub-meshes
518 for (int i = 1; i <= nvertices; i++)
\r
523 for (PointIndex pi = 1; pi <= mesh.GetNP(); pi++)
\r
524 - if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
\r
525 + //if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
526 + if ( Dist2 (mesh[pi], Point<3>(mp)) < eps2 ) // -- small optimization
532 TopoDS_Face face = TopoDS::Face(exp1.Current());
\r
533 int facenr = geom.fmap.FindIndex(face);
\r
534 + if ( facenr < 1 ) continue; // -- to support SALOME sub-meshes
536 if (face2solid[0][facenr-1] == 0)
\r
537 face2solid[0][facenr-1] = solidnr;
\r
542 + edgenr = mesh.GetNSeg(); // to support SALOME sub-meshes
544 (*testout) << "faces = " << geom.fmap.Extent() << endl;
\r
547 //(*testout) << "ignoring degenerated edge" << endl;
\r
550 + if ( geom.emap.FindIndex(edge) < 1 ) continue; // to support SALOME sub-meshes
552 if (geom.vmap.FindIndex(TopExp::FirstVertex (edge)) ==
\r
553 geom.vmap.FindIndex(TopExp::LastVertex (edge)))
\r
554 @@ -477,20 +491,104 @@
558 - pnums[0] = geom.vmap.FindIndex (TopExp::FirstVertex (edge));
\r
559 - pnums[pnums.Size()-1] = geom.vmap.FindIndex (TopExp::LastVertex (edge));
\r
560 + //pnums[0] = geom.vmap.FindIndex (TopExp::FirstVertex (edge));
561 + //pnums[pnums.Size()-1] = geom.vmap.FindIndex (TopExp::LastVertex (edge));
562 + MeshPoint dfltP ( Point<3> ( 0, 0, 0 ) );
563 + int *ipp[] = { &pnums[0], &pnums[pnums.Size()-1] };
564 + TopoDS_Iterator vIt( edge, false );
565 + TopoDS_Vertex v[2];
566 + v[0] = TopoDS::Vertex( vIt.Value() ); vIt.Next();
567 + v[1] = TopoDS::Vertex( vIt.Value() );
568 + if ( v[0].Orientation() == TopAbs_REVERSED )
569 + std::swap( v[0], v[1] );
570 + for ( int i = 0; i < 2; ++i)
573 + ip = geom.vmap.FindIndex ( v[i] );
574 + if ( ip == 0 || ip > nvertices )
578 + ip = iv = geom.vmap.Add( v[i] );
579 + gp_Pnt pnt = BRep_Tool::Pnt( v[i] );
580 + MeshPoint mp( Point<3>(pnt.X(), pnt.Y(), pnt.Z()) );
581 + for (PointIndex pi = 1; pi < first_vp; pi++)
582 + if ( Dist2 (mesh.Point(pi), Point<3>(mp)) < 1e-100 )
585 + if ( mesh.Point(ip).GetLayer() != dfltP.GetLayer() && mesh.Point(ip).GetLayer() != iv )
587 + if ( mesh.Point(ip).GetLayer() == dfltP.GetLayer())
588 + mesh.Point(ip) = MeshPoint( mesh.Point(ip), iv );
594 - Point<3> fp = occ2ng (BRep_Tool::Pnt (TopExp::FirstVertex (edge)));
\r
595 - Point<3> lp = occ2ng (BRep_Tool::Pnt (TopExp::LastVertex (edge)));
\r
596 + ip += first_vp - 1;
602 + TopoDS_Iterator vIt( edge, false );
603 + TopoDS_Vertex v1 = TopoDS::Vertex( vIt.Value() ); vIt.Next();
604 + TopoDS_Vertex v2 = TopoDS::Vertex( vIt.Value() );
605 + if ( v1.Orientation() == TopAbs_REVERSED )
606 + std::swap( v1, v2 );
607 + const bool isClosedEdge = v1.IsSame( v2 );
609 + Point<3> fp = occ2ng (BRep_Tool::Pnt (v1));
610 + Point<3> lp = occ2ng (BRep_Tool::Pnt (v2));
611 + double tol2 = std::min( eps*eps, 1e-6 * Dist2( fp, lp ));
612 + if ( isClosedEdge )
613 + tol2 = BRep_Tool::Tolerance( v1 ) * BRep_Tool::Tolerance( v1 );
617 for (PointIndex pi = 1; pi < first_ep; pi++)
\r
619 - if (Dist2 (mesh[pi], fp) < eps*eps) pnums[0] = pi;
\r
620 - if (Dist2 (mesh[pi], lp) < eps*eps) pnums.Last() = pi;
\r
621 + if (Dist2 (mesh[pi], fp) < tol2) pnums[0] = pi;
622 + if (Dist2 (mesh[pi], lp) < tol2) pnums.Last() = pi;
624 + if (( isClosedEdge && pnums[0] != pnums.Last() ) ||
625 + ( !isClosedEdge && pnums[0] == pnums.Last() ))
626 + pnums[0] = pnums.Last() = -1;
627 + if ( pnums[0] == -1 || pnums.Last() == -1 )
629 + // take into account a possible large gap between a vertex and an edge curve
630 + // end and a large vertex tolerance covering the whole edge
631 + if ( pnums[0] == -1 )
633 + double tol = BRep_Tool::Tolerance( v1 );
634 + for (PointIndex pi = 1; pi < first_ep; pi++)
635 + if (pi != pnums.Last() && Dist2 (mesh[pi], fp) < 2*tol*tol)
638 + if ( pnums[0] == -1 )
639 + pnums[0] = first_ep-1- nvertices + geom.vmap.FindIndex ( v1 );
641 + if ( isClosedEdge )
643 + pnums.Last() = pnums[0];
647 + if ( pnums.Last() == -1 )
649 + double tol = BRep_Tool::Tolerance( v2 );
650 + for (PointIndex pi = 1; pi < first_ep; pi++)
651 + if (pi != pnums[0] && Dist2 (mesh[pi], lp) < 2*tol*tol)
654 + if ( pnums.Last() == -1 )
655 + pnums.Last() = first_ep-1-nvertices + geom.vmap.FindIndex ( v2 );
658 + if ( Dist2( fp, mesh[PointIndex(pnums[0])]) >
659 + Dist2( lp, mesh[PointIndex(pnums.Last())]))
660 + std::swap( pnums[0], pnums.Last() );
665 @@ -500,17 +598,20 @@
668 for (j = first_ep; j <= mesh.GetNP(); j++)
\r
670 + if (!merge_solids && mesh.Point(j).GetLayer() != geomedgenr ) continue; // to support SALOME fuse edges
671 if ((mesh.Point(j)-Point<3>(mp[i-1])).Length() < eps)
\r
682 - mesh.AddPoint (mp[i-1]);
\r
683 + mesh.AddPoint (mp[i-1], geomedgenr); // to support SALOME fuse edges
684 (*testout) << "add meshpoint " << mp[i-1] << endl;
\r
685 pnums[i] = mesh.GetNP();
\r
688 // (*testout) << "edge " << mesh.LineSegment(i).edgenr << " face " << mesh.LineSegment(i).si
\r
689 // << " p1 " << mesh.LineSegment(i)[0] << " p2 " << mesh.LineSegment(i)[1] << endl;
\r
691 + for (int j = 1; j <= mesh.GetNP(); j++) // to support SALOME fuse edges: set level to zero
692 + mesh.Point(j) = MeshPoint( (Point<3>&) mesh.Point(j) );
694 mesh.CalcSurfacesOfNode();
\r
695 multithread.task = savetask;
\r
696 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occgeom.cpp netgen-5.3.1_new/libsrc/occ/occgeom.cpp
697 --- netgen-5.3.1_orig/libsrc/occ/occgeom.cpp 2014-08-29 13:54:03.000000000 +0400
698 +++ netgen-5.3.1_new/libsrc/occ/occgeom.cpp 2016-09-29 16:22:31.636328123 +0300
700 #include "ShapeAnalysis_CheckSmallFace.hxx"
\r
701 #include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx"
\r
702 #include "ShapeAnalysis_Surface.hxx"
\r
703 +#include <BRepTopAdaptor_FClass2d.hxx> // -- to optimize Project() and FastProject()
704 +#include <TopAbs_State.hxx>
705 #include "BRepAlgoAPI_Fuse.hxx"
\r
706 #include "BRepCheck_Analyzer.hxx"
\r
707 #include "BRepLib.hxx"
\r
709 #include "ShapeFix_FixSmallFace.hxx"
\r
710 #include "Partition_Spliter.hxx"
\r
715 + // free data used to optimize Project() and FastProject()
716 + OCCGeometry::~OCCGeometry()
718 + NCollection_DataMap<int,BRepTopAdaptor_FClass2d*>::Iterator it(fclsmap);
719 + for (; it.More(); it.Next())
723 void OCCGeometry :: PrintNrShapes ()
\r
727 double surfacecont = 0;
\r
730 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
731 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
732 rebuild->Apply(shape);
\r
733 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
736 cout << endl << "- repairing faces" << endl;
\r
738 Handle(ShapeFix_Face) sff;
\r
739 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
740 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
741 rebuild->Apply(shape);
\r
748 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
749 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
750 rebuild->Apply(shape);
\r
751 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
754 cout << endl << "- fixing small edges" << endl;
\r
756 Handle(ShapeFix_Wire) sfw;
\r
757 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
758 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
759 rebuild->Apply(shape);
\r
766 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
767 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
768 rebuild->Apply(shape);
\r
770 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
775 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
776 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
777 rebuild->Apply(shape);
\r
778 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
790 TopoDS_Solid solid = TopoDS::Solid(exp0.Current());
\r
791 TopoDS_Solid newsolid = solid;
\r
792 BRepLib::OrientClosedSolid (newsolid);
\r
793 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
794 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
795 // rebuild->Apply(shape);
\r
796 rebuild->Replace(solid, newsolid, Standard_False);
\r
797 TopoDS_Shape newshape = rebuild->Apply(shape, TopAbs_COMPSOLID);//, 1);
\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->Replace(solid, newsolid, Standard_False);
\r
806 TopoDS_Shape newshape = rebuild->Apply(shape, TopAbs_SHAPE, 1);
\r
807 @@ -951,25 +960,58 @@
811 + // returns a projector and a classifier for the given surface
812 + void OCCGeometry::GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
813 + BRepTopAdaptor_FClass2d*& cls) const
815 + //MSV: organize caching projector in the map
816 + if (fprjmap.IsBound(surfi))
818 + proj = fprjmap.Find(surfi);
819 + cls = fclsmap.Find(surfi);
823 + const TopoDS_Face& aFace = TopoDS::Face(fmap(surfi));
824 + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
825 + proj = new ShapeAnalysis_Surface(aSurf);
826 + fprjmap.Bind(surfi, proj);
827 + cls = new BRepTopAdaptor_FClass2d(aFace,Precision::Confusion());
828 + fclsmap.Bind(surfi, cls);
833 - void OCCGeometry :: Project (int surfi, Point<3> & p) const
\r
834 + // void OCCGeometry :: Project (int surfi, Point<3> & p) const
835 + bool OCCGeometry :: Project (int surfi, Point<3> & p, double& u, double& v) const
837 static int cnt = 0;
\r
838 if (++cnt % 1000 == 0) cout << "Project cnt = " << cnt << endl;
\r
840 gp_Pnt pnt(p(0), p(1), p(2));
\r
843 - Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
\r
844 - Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
\r
845 - gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
\r
846 - suval.Coord( u, v);
\r
847 - pnt = thesurf->Value( u, v );
\r
848 + // -- Optimization: use cached projector and classifier
850 + // Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
851 + // Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
852 + // gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
853 + // suval.Coord( u, v);
854 + // pnt = thesurf->Value( u, v );
856 + Handle(ShapeAnalysis_Surface) proj;
857 + BRepTopAdaptor_FClass2d *cls;
858 + GetFaceTools(surfi, proj, cls);
860 + gp_Pnt2d p2d = proj->ValueOfUV(pnt, Precision::Confusion());
861 + if (cls->Perform(p2d) == TopAbs_OUT)
865 + pnt = proj->Value(p2d);
868 p = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
\r
874 @@ -979,54 +1021,69 @@
876 gp_Pnt p(ap(0), ap(1), ap(2));
\r
878 - Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
\r
880 - gp_Pnt x = surface->Value (u,v);
\r
882 - if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
\r
885 + // -- Optimization: use cached projector and classifier
886 + // Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
888 + // gp_Pnt x = surface->Value (u,v);
890 + // if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
894 + // surface->D1(u,v,x,du,dv);
900 + // double det, lambda, mu;
907 + // det = Det3 (n.X(), du.X(), dv.X(),
908 + // n.Y(), du.Y(), dv.Y(),
909 + // n.Z(), du.Z(), dv.Z());
911 + // if (det < 1e-15) return false;
913 + // lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
914 + // n.Y(), p.Y()-x.Y(), dv.Y(),
915 + // n.Z(), p.Z()-x.Z(), dv.Z())/det;
917 + // mu = Det3 (n.X(), du.X(), p.X()-x.X(),
918 + // n.Y(), du.Y(), p.Y()-x.Y(),
919 + // n.Z(), du.Z(), p.Z()-x.Z())/det;
925 + // surface->D1(u,v,x,du,dv);
927 + // } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
929 + // // (*testout) << "FastProject count: " << count << endl;
931 + // if (count == 50) return false;
933 + // ap = Point<3> (x.X(), x.Y(), x.Z());
934 + Handle(ShapeAnalysis_Surface) proj;
935 + BRepTopAdaptor_FClass2d *cls;
936 + GetFaceTools(surfi, proj, cls);
938 - surface->D1(u,v,x,du,dv);
\r
944 - double det, lambda, mu;
\r
951 - det = Det3 (n.X(), du.X(), dv.X(),
\r
952 - n.Y(), du.Y(), dv.Y(),
\r
953 - n.Z(), du.Z(), dv.Z());
\r
955 - if (det < 1e-15) return false;
\r
957 - lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
\r
958 - n.Y(), p.Y()-x.Y(), dv.Y(),
\r
959 - n.Z(), p.Z()-x.Z(), dv.Z())/det;
\r
961 - mu = Det3 (n.X(), du.X(), p.X()-x.X(),
\r
962 - n.Y(), du.Y(), p.Y()-x.Y(),
\r
963 - n.Z(), du.Z(), p.Z()-x.Z())/det;
\r
969 - surface->D1(u,v,x,du,dv);
\r
971 - } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
\r
973 - // (*testout) << "FastProject count: " << count << endl;
\r
975 - if (count == 50) return false;
\r
976 + gp_Pnt2d p2d = proj->NextValueOfUV(gp_Pnt2d(u,v), p, Precision::Confusion());
977 + if (cls->Perform(p2d) == TopAbs_OUT)
979 + //cout << "Projection fails" << endl;
983 - ap = Point<3> (x.X(), x.Y(), x.Z());
\r
984 + p = proj->Value(p2d);
986 + ap = Point<3> (p.X(), p.Y(), p.Z());
990 @@ -1038,9 +1095,9 @@
992 cout << "writing stl..."; cout.flush();
\r
993 StlAPI_Writer writer;
\r
994 - writer.RelativeMode() = Standard_False;
\r
995 + //writer.RelativeMode() = Standard_False;
997 - writer.SetDeflection(0.02);
\r
998 + //writer.SetDeflection(0.02);
999 writer.Write(shape,filename);
\r
1001 cout << "done" << endl;
\r
1002 @@ -1059,10 +1116,10 @@
1003 occgeo = new OCCGeometry;
\r
1005 // Initiate a dummy XCAF Application to handle the IGES XCAF Document
\r
1006 - static Handle_XCAFApp_Application dummy_app = XCAFApp_Application::GetApplication();
\r
1007 + static Handle(XCAFApp_Application) dummy_app = XCAFApp_Application::GetApplication();
1009 // Create an XCAF Document to contain the IGES file itself
\r
1010 - Handle_TDocStd_Document iges_doc;
\r
1011 + Handle(TDocStd_Document) iges_doc;
1013 // Check if a IGES File is already open under this handle, if so, close it to prevent
\r
1014 // Segmentation Faults when trying to create a new document
\r
1015 @@ -1089,8 +1146,8 @@
1016 reader.Transfer(iges_doc);
\r
1018 // Read in the shape(s) and the colours present in the IGES File
\r
1019 - Handle_XCAFDoc_ShapeTool iges_shape_contents = XCAFDoc_DocumentTool::ShapeTool(iges_doc->Main());
\r
1020 - Handle_XCAFDoc_ColorTool iges_colour_contents = XCAFDoc_DocumentTool::ColorTool(iges_doc->Main());
\r
1021 + Handle(XCAFDoc_ShapeTool) iges_shape_contents = XCAFDoc_DocumentTool::ShapeTool(iges_doc->Main());
1022 + Handle(XCAFDoc_ColorTool) iges_colour_contents = XCAFDoc_DocumentTool::ColorTool(iges_doc->Main());
1024 TDF_LabelSequence iges_shapes;
\r
1025 iges_shape_contents->GetShapes(iges_shapes);
\r
1026 @@ -1137,10 +1194,10 @@
1027 occgeo = new OCCGeometry;
\r
1029 // Initiate a dummy XCAF Application to handle the STEP XCAF Document
\r
1030 - static Handle_XCAFApp_Application dummy_app = XCAFApp_Application::GetApplication();
\r
1031 + static Handle(XCAFApp_Application) dummy_app = XCAFApp_Application::GetApplication();
1033 // Create an XCAF Document to contain the STEP file itself
\r
1034 - Handle_TDocStd_Document step_doc;
\r
1035 + Handle(TDocStd_Document) step_doc;
1037 // Check if a STEP File is already open under this handle, if so, close it to prevent
\r
1038 // Segmentation Faults when trying to create a new document
\r
1039 @@ -1167,8 +1224,8 @@
1040 reader.Transfer(step_doc);
\r
1042 // Read in the shape(s) and the colours present in the STEP File
\r
1043 - Handle_XCAFDoc_ShapeTool step_shape_contents = XCAFDoc_DocumentTool::ShapeTool(step_doc->Main());
\r
1044 - Handle_XCAFDoc_ColorTool step_colour_contents = XCAFDoc_DocumentTool::ColorTool(step_doc->Main());
\r
1045 + Handle(XCAFDoc_ShapeTool) step_shape_contents = XCAFDoc_DocumentTool::ShapeTool(step_doc->Main());
1046 + Handle(XCAFDoc_ColorTool) step_colour_contents = XCAFDoc_DocumentTool::ColorTool(step_doc->Main());
1048 TDF_LabelSequence step_shapes;
\r
1049 step_shape_contents->GetShapes(step_shapes);
\r
1050 @@ -1221,7 +1278,7 @@
1051 // Fixed a bug in the OpenCascade XDE Colour handling when
\r
1052 // opening BREP Files, since BREP Files have no colour data.
\r
1053 // Hence, the face_colours Handle needs to be created as a NULL handle.
\r
1054 - occgeo->face_colours = Handle_XCAFDoc_ColorTool();
\r
1055 + occgeo->face_colours = Handle(XCAFDoc_ColorTool)();
1056 occgeo->face_colours.Nullify();
\r
1057 occgeo->changed = 1;
\r
1058 occgeo->BuildFMap();
\r
1059 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occgeom.hpp netgen-5.3.1_new/libsrc/occ/occgeom.hpp
1060 --- netgen-5.3.1_orig/libsrc/occ/occgeom.hpp 2014-08-29 13:54:03.000000000 +0400
1061 +++ netgen-5.3.1_new/libsrc/occ/occgeom.hpp 2016-09-29 14:44:01.996464598 +0300
1063 #include "Geom_Curve.hxx"
\r
1064 #include "Geom2d_Curve.hxx"
\r
1065 #include "Geom_Surface.hxx"
\r
1066 -#include "GeomAPI_ProjectPointOnSurf.hxx"
\r
1067 -#include "GeomAPI_ProjectPointOnCurve.hxx"
\r
1068 +// #include "GeomAPI_ProjectPointOnSurf.hxx"
1069 +// #include "GeomAPI_ProjectPointOnCurve.hxx"
1070 #include "BRepTools.hxx"
\r
1071 #include "TopExp.hxx"
\r
1072 #include "BRepBuilderAPI_MakeVertex.hxx"
\r
1074 #include "Geom_Curve.hxx"
\r
1075 #include "Geom2d_Curve.hxx"
\r
1076 #include "Geom_Surface.hxx"
\r
1077 -#include "GeomAPI_ProjectPointOnSurf.hxx"
\r
1078 -#include "GeomAPI_ProjectPointOnCurve.hxx"
\r
1079 +// #include "GeomAPI_ProjectPointOnSurf.hxx"
1080 +// #include "GeomAPI_ProjectPointOnCurve.hxx"
1081 #include "TopoDS_Wire.hxx"
\r
1082 #include "BRepTools_WireExplorer.hxx"
\r
1083 #include "BRepTools.hxx"
\r
1085 #include "IGESToBRep_Reader.hxx"
\r
1086 #include "Interface_Static.hxx"
\r
1087 #include "GeomAPI_ExtremaCurveCurve.hxx"
\r
1088 -#include "Standard_ErrorHandler.hxx"
\r
1089 +//#include "Standard_ErrorHandler.hxx"
1090 #include "Standard_Failure.hxx"
\r
1091 #include "ShapeUpgrade_ShellSewing.hxx"
\r
1092 #include "ShapeFix_Shape.hxx"
\r
1093 #include "ShapeFix_Wireframe.hxx"
\r
1094 +#include <Standard_Version.hxx>
1095 +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) <= 0x060702
1096 +// porting to OCCT6.7.3
1097 #include "BRepMesh.hxx"
\r
1099 #include "BRepMesh_IncrementalMesh.hxx"
\r
1100 #include "BRepBndLib.hxx"
\r
1101 #include "Bnd_Box.hxx"
\r
1102 #include "ShapeAnalysis.hxx"
\r
1103 #include "ShapeBuild_ReShape.hxx"
\r
1105 +// -- Optimization: to use cached projector and classifier
1106 +#include <NCollection_DataMap.hxx>
1107 +class ShapeAnalysis_Surface;
1108 +class BRepTopAdaptor_FClass2d;
1110 // Philippose - 29/01/2009
\r
1111 // OpenCascade XDE Support
\r
1113 class OCCGeometry : public NetgenGeometry
\r
1116 + // -- Optimization: to use cached projector and classifier
1117 + mutable NCollection_DataMap<int,Handle(ShapeAnalysis_Surface)> fprjmap;
1118 + mutable NCollection_DataMap<int,BRepTopAdaptor_FClass2d*> fclsmap;
1121 TopoDS_Shape shape;
\r
1123 // OpenCascade XDE Support
\r
1124 // XCAF Handle to make the face colours available to the rest of
\r
1126 - Handle_XCAFDoc_ColorTool face_colours;
\r
1127 + Handle(XCAFDoc_ColorTool) face_colours;
1129 mutable int changed;
\r
1130 Array<int> facemeshstatus;
\r
1132 virtual void Save (string filename) const;
\r
1135 + ~OCCGeometry(); // -- to free cached projector and classifier
1139 Box<3> GetBoundingBox()
\r
1140 @@ -266,9 +279,14 @@
1144 - void Project (int surfi, Point<3> & p) const;
\r
1145 + // void Project (int surfi, Point<3> & p) const; -- optimization
1146 + bool Project (int surfi, Point<3> & p, double& u, double& v) const;
1147 bool FastProject (int surfi, Point<3> & ap, double& u, double& v) const;
\r
1149 + // -- Optimization: to use cached projector and classifier
1150 + void GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
1151 + BRepTopAdaptor_FClass2d*& cls) const;
1153 OCCSurface GetSurface (int surfi)
\r
1155 cout << "OCCGeometry::GetSurface using PLANESPACE" << endl;
\r
1156 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occmeshsurf.cpp netgen-5.3.1_new/libsrc/occ/occmeshsurf.cpp
1157 --- netgen-5.3.1_orig/libsrc/occ/occmeshsurf.cpp 2014-08-29 13:54:03.000000000 +0400
1158 +++ netgen-5.3.1_new/libsrc/occ/occmeshsurf.cpp 2016-09-29 14:08:00.045144560 +0300
1160 #include <meshing.hpp>
1161 #include <GeomLProp_SLProps.hxx>
1162 #include <ShapeAnalysis_Surface.hxx>
1163 +#include <GeomAPI_ProjectPointOnCurve.hxx> // -- moved here from occgeom.hpp
1172 + else if ( lprop.IsNormalDefined() )
1174 n(0)=lprop.Normal().X();
1175 n(1)=lprop.Normal().Y();
1176 n(2)=lprop.Normal().Z();
1185 (*testout) << "u " << geominfo.u << " v " << geominfo.v
1186 @@ -434,23 +435,33 @@
1188 void MeshOptimize2dOCCSurfaces :: ProjectPoint (INDEX surfind, Point<3> & p) const
1190 - geometry.Project (surfind, p);
1191 + // geometry.Project (surfind, p); -- signature of Project() changed for optimization
1193 + geometry.Project (surfind, p, u, v);
1197 int MeshOptimize2dOCCSurfaces :: ProjectPointGI (INDEX surfind, Point<3> & p, PointGeomInfo & gi) const
1201 + //double u = gi.u;
1202 + //double v = gi.v;
1205 - if (geometry.FastProject (surfind, hp, u, v))
1207 + // -- u and v are computed by FastProject() and Project(), no need to call CalcPointGeomInfo()
1208 + // if (geometry.FastProject (surfind, hp, u, v))
1213 + // ProjectPoint (surfind, p);
1214 + // return CalcPointGeomInfo (surfind, gi, p);
1216 + if (gi.trignum > 0)
1217 + ok = geometry.FastProject (surfind, hp, gi.u, gi.v);
1219 + ok = geometry.Project (surfind, hp, gi.u, gi.v);
1223 - ProjectPoint (surfind, p);
1224 - return CalcPointGeomInfo (surfind, gi, p);
1230 if (!geometry.FastProject (surfi, hnewp, u, v))
1232 // cout << "Fast projection to surface fails! Using OCC projection" << endl;
1233 - geometry.Project (surfi, hnewp);
1234 + // geometry.Project (surfi, hnewp); -- Project() changed for optimization
1235 + geometry.Project (surfi, hnewp, u, v);
1244 + }//; -- to compile with -Wall -pedantic
1247 void OCCRefinementSurfaces ::
1248 @@ -708,14 +720,18 @@
1249 hnewp = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
1253 + }//; -- to compile with -Wall -pedantic
1256 void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi) const
1259 - geometry.Project (surfi, p);
1261 + //geometry.Project (surfi, p);
1264 + geometry.Project (surfi, p, u, v);
1266 + }//; -- to compile with -Wall -pedantic
1268 void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi, PointGeomInfo & gi) const
1270 @@ -723,9 +739,10 @@
1271 if (!geometry.FastProject (surfi, p, gi.u, gi.v))
1273 cout << "Fast projection to surface fails! Using OCC projection" << endl;
1274 - geometry.Project (surfi, p);
1276 + geometry.Project (surfi, p, u, v);
1283 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/utilities.h netgen-5.3.1_new/libsrc/occ/utilities.h
1284 --- netgen-5.3.1_orig/libsrc/occ/utilities.h 2014-08-29 13:54:03.000000000 +0400
1285 +++ netgen-5.3.1_new/libsrc/occ/utilities.h 2016-09-29 14:04:51.504148314 +0300
1292 // #include "SALOME_Log.hxx"
1294 diff -NaurwB netgen-5.3.1_orig/nglib/nglib.h netgen-5.3.1_new/nglib/nglib.h
1295 --- netgen-5.3.1_orig/nglib/nglib.h 2014-08-29 13:54:00.000000000 +0400
1296 +++ netgen-5.3.1_new/nglib/nglib.h 2016-09-29 14:04:51.504148314 +0300
1298 // Philippose - 14.02.2009
\r
1299 // Modifications for creating a DLL in Windows
\r
1301 - #ifdef NGLIB_EXPORTS || nglib_EXPORTS
\r
1302 + #if defined NGLIB_EXPORTS || defined nglib_EXPORTS
1303 #define DLL_HEADER __declspec(dllexport)
\r
1305 #define DLL_HEADER __declspec(dllimport)
\r