1 diff -NaurwB netgen-5.3.1_orig/Makefile.in netgen-5.3.1_new/Makefile.in
2 --- netgen-5.3.1_orig/Makefile.in 2014-10-06 15:04:37.000000000 +0400
3 +++ netgen-5.3.1_new/Makefile.in 2016-10-03 16:17:10.164707368 +0300
5 top_srcdir = @top_srcdir@
6 ACLOCAL_AMFLAGS = -I m4
8 -SUBDIRS = libsrc ng tutorials doc windows nglib
9 +SUBDIRS = libsrc nglib #tutorials doc windows nglib
11 $(MAKE) $(AM_MAKEFLAGS) all-recursive
13 diff -NaurwB netgen-5.3.1_orig/configure.ac netgen-5.3.1_new/configure.ac
14 --- netgen-5.3.1_orig/configure.ac 2014-10-06 15:00:17.000000000 +0400
15 +++ netgen-5.3.1_new/configure.ac 2016-09-29 14:34:11.957389447 +0300
18 if test a$occon = atrue ; then
20 - AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I$occdir/inc -I/usr/include/opencascade"])
21 + AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I$occdir/include/opencascade"])
22 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"])
25 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/findip.hpp netgen-5.3.1_new/libsrc/meshing/findip.hpp
26 --- netgen-5.3.1_orig/libsrc/meshing/findip.hpp 2014-08-29 13:54:05.000000000 +0400
27 +++ netgen-5.3.1_new/libsrc/meshing/findip.hpp 2016-09-30 20:38:56.662234111 +0300
29 static int timer = NgProfiler::CreateTimer ("FindInnerPoint");
30 NgProfiler::RegionTimer reg (timer);
32 + if ( points.Size() < 3 )
38 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/improve3.cpp netgen-5.3.1_new/libsrc/meshing/improve3.cpp
39 --- netgen-5.3.1_orig/libsrc/meshing/improve3.cpp 2014-08-29 13:54:05.000000000 +0400
40 +++ netgen-5.3.1_new/libsrc/meshing/improve3.cpp 2016-10-03 16:16:57.636639300 +0300
47 for (int l = 2; l < nsuround; l++)
49 @@ -1239,10 +1240,12 @@
52 suroundpts[l] = newpi;
58 + if ( nbtetused < nsuround )
62 for (int k = 0; k < nsuround; k++)
63 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/meshtype.cpp netgen-5.3.1_new/libsrc/meshing/meshtype.cpp
64 --- netgen-5.3.1_orig/libsrc/meshing/meshtype.cpp 2014-08-29 13:54:05.000000000 +0400
65 +++ netgen-5.3.1_new/libsrc/meshing/meshtype.cpp 2016-09-29 14:04:51.500148293 +0300
68 +#include <float.h> // to get DBL_MIN defined
70 #include "meshing.hpp"
74 double det = trans.Det();
78 + if (det <= DBL_MIN) // avoid FPE
81 err += frob * frob / det;
84 double det = trans(0,0)*trans(1,1)-trans(1,0)*trans(0,1);
88 + if (det <= DBL_MIN) // avoid FPE
93 = dtrans(0,0) * trans(1,1) - trans(0,1) * dtrans(1,0)
94 + trans(0,0) * dtrans(1,1) - dtrans(0,1) * trans(1,0);
98 + if (det <= DBL_MIN) // avoid FPE
105 double det = trans.Det();
108 + if (det <= DBL_MIN) // avoid FPE
111 err += frob * frob / det;
112 @@ -1864,7 +1869,8 @@
116 - if (noz == 0.0) noz = 1e-10;
117 + //if (noz == 0.0) noz = 1e-10;
118 + if (noz <= DBL_MIN) noz = 1e-10; // avoid FPE
120 double xi = p(0) / noz;
121 double eta = p(1) / noz;
122 @@ -2030,7 +2036,8 @@
124 double det = -trans.Det();
128 + if (det <= DBL_MIN) // avoid FPE
131 err += frob * frob * frob / det;
132 @@ -2102,7 +2109,8 @@
138 + if (det <= DBL_MIN) // avoid FPE
142 @@ -2184,7 +2192,7 @@
147 + if (det <= DBL_MIN)
151 diff -NaurwB netgen-5.3.1_orig/libsrc/meshing/meshtype.hpp netgen-5.3.1_new/libsrc/meshing/meshtype.hpp
152 --- netgen-5.3.1_orig/libsrc/meshing/meshtype.hpp 2014-08-29 13:54:05.000000000 +0400
153 +++ netgen-5.3.1_new/libsrc/meshing/meshtype.hpp 2016-09-30 14:28:09.147575801 +0300
158 +class Mesh; // added due to compilation errors on some platforms
165 if (typ != QUAD && typ != QUAD6 && typ != QUAD8)
166 - PrintSysError ("element2d::GetNV not implemented for typ", typ)
167 + PrintSysError ("element2d::GetNV not implemented for typ", typ);
175 - PrintSysError ("Element3d::GetNV not implemented for typ ", typ)
176 + PrintSysError ("Element3d::GetNV not implemented for typ ", typ);
181 case PRISM12: return 5;
184 - PrintSysError ("element3d::GetNFaces not implemented for typ", typ)
185 + PrintSysError ("element3d::GetNFaces not implemented for typ", typ);
189 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.cxx netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.cxx
190 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.cxx 2014-08-29 13:54:03.000000000 +0400
191 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.cxx 2016-09-29 14:44:01.996464598 +0300
193 #include <TopOpeBRep_EdgesIntersector.hxx>
194 #include <TopOpeBRep_Point2d.hxx>
195 #include <TopTools_ListIteratorOfListOfShape.hxx>
196 -#include <TopTools_ListOfShape.hxx>
197 #include <TopTools_MapIteratorOfMapOfShape.hxx>
198 -#include <TopTools_MapOfShape.hxx>
199 #include <TopoDS.hxx>
200 #include <TopoDS_Edge.hxx>
201 #include <TopoDS_Vertex.hxx>
202 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.hxx
203 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter2d.hxx 2014-08-29 13:54:03.000000000 +0400
204 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter2d.hxx 2016-09-29 14:44:01.996464598 +0300
206 #ifndef _Partition_Inter2d_HeaderFile
207 #define _Partition_Inter2d_HeaderFile
209 -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile
210 +#include <Standard_Version.hxx>
212 +#if OCC_VERSION_MAJOR < 7
213 #include <Handle_BRepAlgo_AsDes.hxx>
215 #ifndef _Standard_Real_HeaderFile
217 #ifndef _Standard_Boolean_HeaderFile
218 #include <Standard_Boolean.hxx>
221 +#include <TopTools_MapOfShape.hxx>
222 +#include <TopTools_ListOfShape.hxx>
224 class BRepAlgo_AsDes;
226 -class TopTools_MapOfShape;
228 -class TopTools_ListOfShape;
232 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.cxx netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.cxx
233 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.cxx 2014-08-29 13:54:03.000000000 +0400
234 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.cxx 2016-09-29 14:44:02.000464619 +0300
236 #include <TopOpeBRepTool_BoxSort.hxx>
237 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
238 #include <TopTools_ListIteratorOfListOfShape.hxx>
239 -#include <TopTools_ListOfShape.hxx>
240 #include <TopoDS.hxx>
241 #include <TopoDS_Compound.hxx>
242 #include <TopoDS_Edge.hxx>
244 Handle (Geom_Surface) S = BRep_Tool::Surface(F,L);
246 if (S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
247 - S = (*(Handle_Geom_RectangularTrimmedSurface*)&S)->BasisSurface();
248 + S = Handle(Geom_RectangularTrimmedSurface)::DownCast (S)->BasisSurface();
250 if (!S->IsUPeriodic() && !S->IsVPeriodic())
252 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.hxx
253 --- netgen-5.3.1_orig/libsrc/occ/Partition_Inter3d.hxx 2014-08-29 13:54:03.000000000 +0400
254 +++ netgen-5.3.1_new/libsrc/occ/Partition_Inter3d.hxx 2016-09-29 14:44:02.000464619 +0300
256 #ifndef _Partition_Inter3d_HeaderFile
257 #define _Partition_Inter3d_HeaderFile
259 -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile
260 +#include <Standard_Version.hxx>
262 +#if OCC_VERSION_MAJOR < 7
263 #include <Handle_BRepAlgo_AsDes.hxx>
265 #ifndef _TopTools_DataMapOfShapeListOfShape_HeaderFile
267 #ifndef _TopTools_MapOfShape_HeaderFile
268 #include <TopTools_MapOfShape.hxx>
270 +#ifndef _TopTools_ListOfShape_HeaderFile
271 +#include <TopTools_ListOfShape.hxx>
273 #ifndef _TopTools_DataMapOfShapeShape_HeaderFile
274 #include <TopTools_DataMapOfShapeShape.hxx>
277 #include <Standard_Boolean.hxx>
279 class BRepAlgo_AsDes;
280 -class TopTools_ListOfShape;
281 -class TopTools_DataMapOfShapeShape;
283 -class TopTools_MapOfShape;
288 void FacesPartition(const TopoDS_Face& F1,const TopoDS_Face& F2) ;
289 Standard_Boolean IsDone(const TopoDS_Face& F1,const TopoDS_Face& F2) const;
290 TopTools_MapOfShape& TouchedFaces() ;
291 - Handle_BRepAlgo_AsDes AsDes() const;
292 + Handle(BRepAlgo_AsDes) AsDes() const;
293 TopTools_MapOfShape& NewEdges() ;
294 Standard_Boolean HasSameDomainF(const TopoDS_Shape& F) const;
295 Standard_Boolean IsSameDomainF(const TopoDS_Shape& F1,const TopoDS_Shape& F2) const;
296 const TopTools_ListOfShape& SameDomain(const TopoDS_Face& F) const;
297 TopoDS_Vertex ReplaceSameDomainV(const TopoDS_Vertex& V,const TopoDS_Edge& E) const;
298 - Handle_BRepAlgo_AsDes SectionEdgesAD() const;
299 + Handle(BRepAlgo_AsDes) SectionEdgesAD() const;
300 Standard_Boolean IsSectionEdge(const TopoDS_Edge& E) const;
301 Standard_Boolean HasSectionEdge(const TopoDS_Face& F) const;
302 Standard_Boolean IsSplitOn(const TopoDS_Edge& NewE,const TopoDS_Edge& OldE,const TopoDS_Face& F) const;
303 @@ -121,11 +123,11 @@
307 - Handle_BRepAlgo_AsDes myAsDes;
308 + Handle(BRepAlgo_AsDes) myAsDes;
309 TopTools_DataMapOfShapeListOfShape myDone;
310 TopTools_MapOfShape myTouched;
311 TopTools_MapOfShape myNewEdges;
312 - Handle_BRepAlgo_AsDes mySectionEdgesAD;
313 + Handle(BRepAlgo_AsDes) mySectionEdgesAD;
314 TopTools_DataMapOfShapeListOfShape mySameDomainFM;
315 TopTools_DataMapOfShapeShape mySameDomainVM;
317 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop.hxx netgen-5.3.1_new/libsrc/occ/Partition_Loop.hxx
318 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop.hxx 2014-08-29 13:54:03.000000000 +0400
319 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop.hxx 2016-09-29 14:44:02.000464619 +0300
324 -class TopTools_ListOfShape;
327 #ifndef _Standard_HeaderFile
328 #include <Standard.hxx>
329 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.cxx netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.cxx
330 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.cxx 2014-08-29 13:54:03.000000000 +0400
331 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.cxx 2016-09-29 14:04:51.504148314 +0300
333 Cc->D1(uc, PC, CTg1);
334 if (!isForward) CTg1.Reverse();
336 - Standard_Real anglemin = 3 * PI, tolAng = 1.e-8;
337 + Standard_Real anglemin = 3 * M_PI, tolAng = 1.e-8;
339 // select an edge whose first derivative is most left of CTg1
340 // ie an angle between Tg1 and CTg1 is least
343 Standard_Real angle = Tg1.Angle(CTg1);
345 - if (PI - Abs(angle) <= tolAng)
346 + if (M_PI - Abs(angle) <= tolAng)
348 // an angle is too close to PI; assure that an angle sign really
349 // reflects an edge position: +PI - an edge is worst,
350 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.hxx
351 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop2d.hxx 2014-08-29 13:54:03.000000000 +0400
352 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop2d.hxx 2016-09-29 14:44:02.000464619 +0300
357 -class TopTools_ListOfShape;
358 class BRepAlgo_Image;
361 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Loop3d.hxx netgen-5.3.1_new/libsrc/occ/Partition_Loop3d.hxx
362 --- netgen-5.3.1_orig/libsrc/occ/Partition_Loop3d.hxx 2014-08-29 13:54:03.000000000 +0400
363 +++ netgen-5.3.1_new/libsrc/occ/Partition_Loop3d.hxx 2016-09-29 14:44:02.000464619 +0300
365 #ifndef _TopTools_ListOfShape_HeaderFile
366 #include <TopTools_ListOfShape.hxx>
368 +#ifndef _TopTools_MapOfOrientedShape_HeaderFile
369 +#include <TopTools_MapOfOrientedShape.hxx>
371 #ifndef _TopTools_IndexedDataMapOfShapeListOfShape_HeaderFile
372 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
375 #include <Standard_Real.hxx>
378 -class TopTools_ListOfShape;
379 -class TopTools_MapOfOrientedShape;
383 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.cxx netgen-5.3.1_new/libsrc/occ/Partition_Spliter.cxx
384 --- netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.cxx 2014-08-29 13:54:03.000000000 +0400
385 +++ netgen-5.3.1_new/libsrc/occ/Partition_Spliter.cxx 2016-09-29 14:44:02.000464619 +0300
387 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
388 #include <TopTools_IndexedMapOfShape.hxx>
389 #include <TopTools_ListIteratorOfListOfShape.hxx>
390 -#include <TopTools_ListOfShape.hxx>
391 #include <TopTools_MapIteratorOfMapOfShape.hxx>
392 #include <TopTools_SequenceOfShape.hxx>
394 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.hxx netgen-5.3.1_new/libsrc/occ/Partition_Spliter.hxx
395 --- netgen-5.3.1_orig/libsrc/occ/Partition_Spliter.hxx 2014-08-29 13:54:03.000000000 +0400
396 +++ netgen-5.3.1_new/libsrc/occ/Partition_Spliter.hxx 2016-09-29 14:44:02.004464639 +0300
398 #ifndef _TopTools_DataMapOfShapeShape_HeaderFile
399 #include <TopTools_DataMapOfShapeShape.hxx>
401 -#ifndef _Handle_BRepAlgo_AsDes_HeaderFile
402 -#include <Handle_BRepAlgo_AsDes.hxx>
404 #ifndef _BRepAlgo_Image_HeaderFile
405 #include <BRepAlgo_Image.hxx>
409 class BRepAlgo_AsDes;
411 -class TopTools_ListOfShape;
416 TopTools_DataMapOfShapeShape myFaceShapeMap;
417 TopTools_DataMapOfShapeShape myInternalFaces;
418 TopTools_DataMapOfShapeShape myIntNotClFaces;
419 - Handle_BRepAlgo_AsDes myAsDes;
420 + Handle(BRepAlgo_AsDes) myAsDes;
421 BRepAlgo_Image myImagesFaces;
422 BRepAlgo_Image myImagesEdges;
423 BRepAlgo_Image myImageShape;
424 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occconstruction.cpp netgen-5.3.1_new/libsrc/occ/occconstruction.cpp
425 --- netgen-5.3.1_orig/libsrc/occ/occconstruction.cpp 2014-08-29 13:54:03.000000000 +0400
426 +++ netgen-5.3.1_new/libsrc/occ/occconstruction.cpp 2016-09-29 14:04:51.500148293 +0300
428 #include <BRepAlgoAPI_Common.hxx>
429 #include <BRepAlgoAPI_Fuse.hxx>
430 #include <BRepAlgoAPI_Section.hxx>
431 -#include <BRepOffsetAPI_Sewing.hxx>
432 +//#include <BRepOffsetAPI_Sewing.hxx>
433 //#include <BRepAlgo_Sewing.hxx>
434 #include <BRepOffsetAPI_MakeOffsetShape.hxx>
435 #include <ShapeFix_Shape.hxx>
436 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occgenmesh.cpp netgen-5.3.1_new/libsrc/occ/occgenmesh.cpp
437 --- netgen-5.3.1_orig/libsrc/occ/occgenmesh.cpp 2014-08-29 13:54:03.000000000 +0400
438 +++ netgen-5.3.1_new/libsrc/occ/occgenmesh.cpp 2016-09-29 14:04:51.500148293 +0300
440 if(h < 1e-4*maxside)
\r
444 - if (h > 30) return;
\r
445 + // commented to restrict H on a large sphere for example
446 + //if (h > 30) return;
449 if (h < maxside && depth < 10)
\r
452 pnt = c->Value(s0);
\r
454 - double olddist = 0;
\r
456 + //double olddist = 0; -- useless variables
459 int tmpVal = (int)(DIVIDEEDGESECTIONS);
\r
461 @@ -259,15 +259,19 @@
464 pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0));
\r
465 + // -- no more than 1 segment per <edge length>/DIVIDEEDGESECTIONS
466 hvalue[i] = hvalue[i-1] +
\r
467 + // 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
468 + // pnt.Distance(oldpnt);
470 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
\r
471 - pnt.Distance(oldpnt);
\r
472 + pnt.Distance(oldpnt));
474 //(*testout) << "mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z())) " << mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))
\r
475 // << " pnt.Distance(oldpnt) " << pnt.Distance(oldpnt) << endl;
\r
478 - dist = pnt.Distance(oldpnt);
\r
479 + //olddist = dist; -- useless variables
480 + //dist = pnt.Distance(oldpnt);
483 // nsubedges = int(ceil(hvalue[DIVIDEEDGESECTIONS]));
\r
486 if (hvalue[i1]/hvalue[DIVIDEEDGESECTIONS]*nsubedges >= i)
\r
488 - params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
\r
489 + // -- for nsubedges comparable to DIVIDEEDGESECTIONS
490 + //params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
491 + double d1 = i1 - (hvalue[i1] - i*hvalue[DIVIDEEDGESECTIONS]/nsubedges)/(hvalue[i1]-hvalue[i1-1]);
492 + params[i] = s0+(d1/double(DIVIDEEDGESECTIONS))*(s1-s0);
493 pnt = c->Value(params[i]);
\r
494 ps[i-1] = MeshPoint (Point3d(pnt.X(), pnt.Y(), pnt.Z()));
\r
497 (*testout) << "nedges = " << nedges << endl;
\r
499 double eps = 1e-6 * geom.GetBoundingBox().Diam();
\r
500 + const double eps2 = eps * eps; // -- small optimization
502 + int first_vp = mesh.GetNP()+1; // -- to support SALOME sub-meshes
504 for (int i = 1; i <= nvertices; i++)
\r
509 for (PointIndex pi = 1; pi <= mesh.GetNP(); pi++)
\r
510 - if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
\r
511 + //if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
512 + if ( Dist2 (mesh[pi], Point<3>(mp)) < eps2 ) // -- small optimization
518 TopoDS_Face face = TopoDS::Face(exp1.Current());
\r
519 int facenr = geom.fmap.FindIndex(face);
\r
520 + if ( facenr < 1 ) continue; // -- to support SALOME sub-meshes
522 if (face2solid[0][facenr-1] == 0)
\r
523 face2solid[0][facenr-1] = solidnr;
\r
528 + edgenr = mesh.GetNSeg(); // to support SALOME sub-meshes
530 (*testout) << "faces = " << geom.fmap.Extent() << endl;
\r
533 //(*testout) << "ignoring degenerated edge" << endl;
\r
536 + if ( geom.emap.FindIndex(edge) < 1 ) continue; // to support SALOME sub-meshes
538 if (geom.vmap.FindIndex(TopExp::FirstVertex (edge)) ==
\r
539 geom.vmap.FindIndex(TopExp::LastVertex (edge)))
\r
540 @@ -477,20 +491,104 @@
544 - pnums[0] = geom.vmap.FindIndex (TopExp::FirstVertex (edge));
\r
545 - pnums[pnums.Size()-1] = geom.vmap.FindIndex (TopExp::LastVertex (edge));
\r
546 + //pnums[0] = geom.vmap.FindIndex (TopExp::FirstVertex (edge));
547 + //pnums[pnums.Size()-1] = geom.vmap.FindIndex (TopExp::LastVertex (edge));
548 + MeshPoint dfltP ( Point<3> ( 0, 0, 0 ) );
549 + int *ipp[] = { &pnums[0], &pnums[pnums.Size()-1] };
550 + TopoDS_Iterator vIt( edge, false );
551 + TopoDS_Vertex v[2];
552 + v[0] = TopoDS::Vertex( vIt.Value() ); vIt.Next();
553 + v[1] = TopoDS::Vertex( vIt.Value() );
554 + if ( v[0].Orientation() == TopAbs_REVERSED )
555 + std::swap( v[0], v[1] );
556 + for ( int i = 0; i < 2; ++i)
559 + ip = geom.vmap.FindIndex ( v[i] );
560 + if ( ip == 0 || ip > nvertices )
564 + ip = iv = geom.vmap.Add( v[i] );
565 + gp_Pnt pnt = BRep_Tool::Pnt( v[i] );
566 + MeshPoint mp( Point<3>(pnt.X(), pnt.Y(), pnt.Z()) );
567 + for (PointIndex pi = 1; pi < first_vp; pi++)
568 + if ( Dist2 (mesh.Point(pi), Point<3>(mp)) < 1e-100 )
571 + if ( mesh.Point(ip).GetLayer() != dfltP.GetLayer() && mesh.Point(ip).GetLayer() != iv )
573 + if ( mesh.Point(ip).GetLayer() == dfltP.GetLayer())
574 + mesh.Point(ip) = MeshPoint( mesh.Point(ip), iv );
580 - Point<3> fp = occ2ng (BRep_Tool::Pnt (TopExp::FirstVertex (edge)));
\r
581 - Point<3> lp = occ2ng (BRep_Tool::Pnt (TopExp::LastVertex (edge)));
\r
582 + ip += first_vp - 1;
588 + TopoDS_Iterator vIt( edge, false );
589 + TopoDS_Vertex v1 = TopoDS::Vertex( vIt.Value() ); vIt.Next();
590 + TopoDS_Vertex v2 = TopoDS::Vertex( vIt.Value() );
591 + if ( v1.Orientation() == TopAbs_REVERSED )
592 + std::swap( v1, v2 );
593 + const bool isClosedEdge = v1.IsSame( v2 );
595 + Point<3> fp = occ2ng (BRep_Tool::Pnt (v1));
596 + Point<3> lp = occ2ng (BRep_Tool::Pnt (v2));
597 + double tol2 = std::min( eps*eps, 1e-6 * Dist2( fp, lp ));
598 + if ( isClosedEdge )
599 + tol2 = BRep_Tool::Tolerance( v1 ) * BRep_Tool::Tolerance( v1 );
603 for (PointIndex pi = 1; pi < first_ep; pi++)
\r
605 - if (Dist2 (mesh[pi], fp) < eps*eps) pnums[0] = pi;
\r
606 - if (Dist2 (mesh[pi], lp) < eps*eps) pnums.Last() = pi;
\r
607 + if (Dist2 (mesh[pi], fp) < tol2) pnums[0] = pi;
608 + if (Dist2 (mesh[pi], lp) < tol2) pnums.Last() = pi;
610 + if (( isClosedEdge && pnums[0] != pnums.Last() ) ||
611 + ( !isClosedEdge && pnums[0] == pnums.Last() ))
612 + pnums[0] = pnums.Last() = -1;
613 + if ( pnums[0] == -1 || pnums.Last() == -1 )
615 + // take into account a possible large gap between a vertex and an edge curve
616 + // end and a large vertex tolerance covering the whole edge
617 + if ( pnums[0] == -1 )
619 + double tol = BRep_Tool::Tolerance( v1 );
620 + for (PointIndex pi = 1; pi < first_ep; pi++)
621 + if (pi != pnums.Last() && Dist2 (mesh[pi], fp) < 2*tol*tol)
624 + if ( pnums[0] == -1 )
625 + pnums[0] = first_ep-1- nvertices + geom.vmap.FindIndex ( v1 );
627 + if ( isClosedEdge )
629 + pnums.Last() = pnums[0];
633 + if ( pnums.Last() == -1 )
635 + double tol = BRep_Tool::Tolerance( v2 );
636 + for (PointIndex pi = 1; pi < first_ep; pi++)
637 + if (pi != pnums[0] && Dist2 (mesh[pi], lp) < 2*tol*tol)
640 + if ( pnums.Last() == -1 )
641 + pnums.Last() = first_ep-1-nvertices + geom.vmap.FindIndex ( v2 );
644 + if ( Dist2( fp, mesh[PointIndex(pnums[0])]) >
645 + Dist2( lp, mesh[PointIndex(pnums.Last())]))
646 + std::swap( pnums[0], pnums.Last() );
651 @@ -500,17 +598,20 @@
654 for (j = first_ep; j <= mesh.GetNP(); j++)
\r
656 + if (!merge_solids && mesh.Point(j).GetLayer() != geomedgenr ) continue; // to support SALOME fuse edges
657 if ((mesh.Point(j)-Point<3>(mp[i-1])).Length() < eps)
\r
668 - mesh.AddPoint (mp[i-1]);
\r
669 + mesh.AddPoint (mp[i-1], geomedgenr); // to support SALOME fuse edges
670 (*testout) << "add meshpoint " << mp[i-1] << endl;
\r
671 pnums[i] = mesh.GetNP();
\r
674 // (*testout) << "edge " << mesh.LineSegment(i).edgenr << " face " << mesh.LineSegment(i).si
\r
675 // << " p1 " << mesh.LineSegment(i)[0] << " p2 " << mesh.LineSegment(i)[1] << endl;
\r
677 + for (int j = 1; j <= mesh.GetNP(); j++) // to support SALOME fuse edges: set level to zero
678 + mesh.Point(j) = MeshPoint( (Point<3>&) mesh.Point(j) );
680 mesh.CalcSurfacesOfNode();
\r
681 multithread.task = savetask;
\r
682 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occgeom.cpp netgen-5.3.1_new/libsrc/occ/occgeom.cpp
683 --- netgen-5.3.1_orig/libsrc/occ/occgeom.cpp 2014-08-29 13:54:03.000000000 +0400
684 +++ netgen-5.3.1_new/libsrc/occ/occgeom.cpp 2016-09-29 16:22:31.636328123 +0300
686 #include "ShapeAnalysis_CheckSmallFace.hxx"
\r
687 #include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx"
\r
688 #include "ShapeAnalysis_Surface.hxx"
\r
689 +#include <BRepTopAdaptor_FClass2d.hxx> // -- to optimize Project() and FastProject()
690 +#include <TopAbs_State.hxx>
691 #include "BRepAlgoAPI_Fuse.hxx"
\r
692 #include "BRepCheck_Analyzer.hxx"
\r
693 #include "BRepLib.hxx"
\r
695 #include "ShapeFix_FixSmallFace.hxx"
\r
696 #include "Partition_Spliter.hxx"
\r
701 + // free data used to optimize Project() and FastProject()
702 + OCCGeometry::~OCCGeometry()
704 + NCollection_DataMap<int,BRepTopAdaptor_FClass2d*>::Iterator it(fclsmap);
705 + for (; it.More(); it.Next())
709 void OCCGeometry :: PrintNrShapes ()
\r
713 double surfacecont = 0;
\r
716 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
717 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
718 rebuild->Apply(shape);
\r
719 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
722 cout << endl << "- repairing faces" << endl;
\r
724 Handle(ShapeFix_Face) sff;
\r
725 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
726 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
727 rebuild->Apply(shape);
\r
734 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
735 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
736 rebuild->Apply(shape);
\r
737 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
740 cout << endl << "- fixing small edges" << endl;
\r
742 Handle(ShapeFix_Wire) sfw;
\r
743 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
744 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
745 rebuild->Apply(shape);
\r
752 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
753 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
754 rebuild->Apply(shape);
\r
756 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
761 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
762 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
763 rebuild->Apply(shape);
\r
764 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
770 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
771 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
772 rebuild->Apply(shape);
\r
773 for (exp1.Init (shape, TopAbs_EDGE); exp1.More(); exp1.Next())
\r
776 TopoDS_Solid solid = TopoDS::Solid(exp0.Current());
\r
777 TopoDS_Solid newsolid = solid;
\r
778 BRepLib::OrientClosedSolid (newsolid);
\r
779 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
780 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
781 // rebuild->Apply(shape);
\r
782 rebuild->Replace(solid, newsolid, Standard_False);
\r
783 TopoDS_Shape newshape = rebuild->Apply(shape, TopAbs_COMPSOLID);//, 1);
\r
785 TopoDS_Solid solid = TopoDS::Solid(exp0.Current());
\r
786 TopoDS_Solid newsolid = solid;
\r
787 BRepLib::OrientClosedSolid (newsolid);
\r
788 - Handle_ShapeBuild_ReShape rebuild = new ShapeBuild_ReShape;
\r
789 + Handle(ShapeBuild_ReShape) rebuild = new ShapeBuild_ReShape;
790 rebuild->Replace(solid, newsolid, Standard_False);
\r
792 TopoDS_Shape newshape = rebuild->Apply(shape, TopAbs_SHAPE, 1);
\r
793 @@ -951,25 +960,58 @@
797 + // returns a projector and a classifier for the given surface
798 + void OCCGeometry::GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
799 + BRepTopAdaptor_FClass2d*& cls) const
801 + //MSV: organize caching projector in the map
802 + if (fprjmap.IsBound(surfi))
804 + proj = fprjmap.Find(surfi);
805 + cls = fclsmap.Find(surfi);
809 + const TopoDS_Face& aFace = TopoDS::Face(fmap(surfi));
810 + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
811 + proj = new ShapeAnalysis_Surface(aSurf);
812 + fprjmap.Bind(surfi, proj);
813 + cls = new BRepTopAdaptor_FClass2d(aFace,Precision::Confusion());
814 + fclsmap.Bind(surfi, cls);
819 - void OCCGeometry :: Project (int surfi, Point<3> & p) const
\r
820 + // void OCCGeometry :: Project (int surfi, Point<3> & p) const
821 + bool OCCGeometry :: Project (int surfi, Point<3> & p, double& u, double& v) const
823 static int cnt = 0;
\r
824 if (++cnt % 1000 == 0) cout << "Project cnt = " << cnt << endl;
\r
826 gp_Pnt pnt(p(0), p(1), p(2));
\r
829 - Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
\r
830 - Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
\r
831 - gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
\r
832 - suval.Coord( u, v);
\r
833 - pnt = thesurf->Value( u, v );
\r
834 + // -- Optimization: use cached projector and classifier
836 + // Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
837 + // Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
838 + // gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
839 + // suval.Coord( u, v);
840 + // pnt = thesurf->Value( u, v );
842 + Handle(ShapeAnalysis_Surface) proj;
843 + BRepTopAdaptor_FClass2d *cls;
844 + GetFaceTools(surfi, proj, cls);
846 + gp_Pnt2d p2d = proj->ValueOfUV(pnt, Precision::Confusion());
847 + if (cls->Perform(p2d) == TopAbs_OUT)
851 + pnt = proj->Value(p2d);
854 p = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
\r
860 @@ -979,54 +1021,69 @@
862 gp_Pnt p(ap(0), ap(1), ap(2));
\r
864 - Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
\r
866 - gp_Pnt x = surface->Value (u,v);
\r
868 - if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
\r
871 + // -- Optimization: use cached projector and classifier
872 + // Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
874 + // gp_Pnt x = surface->Value (u,v);
876 + // if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
880 + // surface->D1(u,v,x,du,dv);
886 + // double det, lambda, mu;
893 + // det = Det3 (n.X(), du.X(), dv.X(),
894 + // n.Y(), du.Y(), dv.Y(),
895 + // n.Z(), du.Z(), dv.Z());
897 + // if (det < 1e-15) return false;
899 + // lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
900 + // n.Y(), p.Y()-x.Y(), dv.Y(),
901 + // n.Z(), p.Z()-x.Z(), dv.Z())/det;
903 + // mu = Det3 (n.X(), du.X(), p.X()-x.X(),
904 + // n.Y(), du.Y(), p.Y()-x.Y(),
905 + // n.Z(), du.Z(), p.Z()-x.Z())/det;
911 + // surface->D1(u,v,x,du,dv);
913 + // } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
915 + // // (*testout) << "FastProject count: " << count << endl;
917 + // if (count == 50) return false;
919 + // ap = Point<3> (x.X(), x.Y(), x.Z());
920 + Handle(ShapeAnalysis_Surface) proj;
921 + BRepTopAdaptor_FClass2d *cls;
922 + GetFaceTools(surfi, proj, cls);
924 - surface->D1(u,v,x,du,dv);
\r
930 - double det, lambda, mu;
\r
937 - det = Det3 (n.X(), du.X(), dv.X(),
\r
938 - n.Y(), du.Y(), dv.Y(),
\r
939 - n.Z(), du.Z(), dv.Z());
\r
941 - if (det < 1e-15) return false;
\r
943 - lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
\r
944 - n.Y(), p.Y()-x.Y(), dv.Y(),
\r
945 - n.Z(), p.Z()-x.Z(), dv.Z())/det;
\r
947 - mu = Det3 (n.X(), du.X(), p.X()-x.X(),
\r
948 - n.Y(), du.Y(), p.Y()-x.Y(),
\r
949 - n.Z(), du.Z(), p.Z()-x.Z())/det;
\r
955 - surface->D1(u,v,x,du,dv);
\r
957 - } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
\r
959 - // (*testout) << "FastProject count: " << count << endl;
\r
961 - if (count == 50) return false;
\r
962 + gp_Pnt2d p2d = proj->NextValueOfUV(gp_Pnt2d(u,v), p, Precision::Confusion());
963 + if (cls->Perform(p2d) == TopAbs_OUT)
965 + //cout << "Projection fails" << endl;
969 - ap = Point<3> (x.X(), x.Y(), x.Z());
\r
970 + p = proj->Value(p2d);
972 + ap = Point<3> (p.X(), p.Y(), p.Z());
976 @@ -1038,9 +1095,9 @@
978 cout << "writing stl..."; cout.flush();
\r
979 StlAPI_Writer writer;
\r
980 - writer.RelativeMode() = Standard_False;
\r
981 + //writer.RelativeMode() = Standard_False;
983 - writer.SetDeflection(0.02);
\r
984 + //writer.SetDeflection(0.02);
985 writer.Write(shape,filename);
\r
987 cout << "done" << endl;
\r
988 @@ -1059,10 +1116,10 @@
989 occgeo = new OCCGeometry;
\r
991 // Initiate a dummy XCAF Application to handle the IGES XCAF Document
\r
992 - static Handle_XCAFApp_Application dummy_app = XCAFApp_Application::GetApplication();
\r
993 + static Handle(XCAFApp_Application) dummy_app = XCAFApp_Application::GetApplication();
995 // Create an XCAF Document to contain the IGES file itself
\r
996 - Handle_TDocStd_Document iges_doc;
\r
997 + Handle(TDocStd_Document) iges_doc;
999 // Check if a IGES File is already open under this handle, if so, close it to prevent
\r
1000 // Segmentation Faults when trying to create a new document
\r
1001 @@ -1089,8 +1146,8 @@
1002 reader.Transfer(iges_doc);
\r
1004 // Read in the shape(s) and the colours present in the IGES File
\r
1005 - Handle_XCAFDoc_ShapeTool iges_shape_contents = XCAFDoc_DocumentTool::ShapeTool(iges_doc->Main());
\r
1006 - Handle_XCAFDoc_ColorTool iges_colour_contents = XCAFDoc_DocumentTool::ColorTool(iges_doc->Main());
\r
1007 + Handle(XCAFDoc_ShapeTool) iges_shape_contents = XCAFDoc_DocumentTool::ShapeTool(iges_doc->Main());
1008 + Handle(XCAFDoc_ColorTool) iges_colour_contents = XCAFDoc_DocumentTool::ColorTool(iges_doc->Main());
1010 TDF_LabelSequence iges_shapes;
\r
1011 iges_shape_contents->GetShapes(iges_shapes);
\r
1012 @@ -1137,10 +1194,10 @@
1013 occgeo = new OCCGeometry;
\r
1015 // Initiate a dummy XCAF Application to handle the STEP XCAF Document
\r
1016 - static Handle_XCAFApp_Application dummy_app = XCAFApp_Application::GetApplication();
\r
1017 + static Handle(XCAFApp_Application) dummy_app = XCAFApp_Application::GetApplication();
1019 // Create an XCAF Document to contain the STEP file itself
\r
1020 - Handle_TDocStd_Document step_doc;
\r
1021 + Handle(TDocStd_Document) step_doc;
1023 // Check if a STEP File is already open under this handle, if so, close it to prevent
\r
1024 // Segmentation Faults when trying to create a new document
\r
1025 @@ -1167,8 +1224,8 @@
1026 reader.Transfer(step_doc);
\r
1028 // Read in the shape(s) and the colours present in the STEP File
\r
1029 - Handle_XCAFDoc_ShapeTool step_shape_contents = XCAFDoc_DocumentTool::ShapeTool(step_doc->Main());
\r
1030 - Handle_XCAFDoc_ColorTool step_colour_contents = XCAFDoc_DocumentTool::ColorTool(step_doc->Main());
\r
1031 + Handle(XCAFDoc_ShapeTool) step_shape_contents = XCAFDoc_DocumentTool::ShapeTool(step_doc->Main());
1032 + Handle(XCAFDoc_ColorTool) step_colour_contents = XCAFDoc_DocumentTool::ColorTool(step_doc->Main());
1034 TDF_LabelSequence step_shapes;
\r
1035 step_shape_contents->GetShapes(step_shapes);
\r
1036 @@ -1221,7 +1278,7 @@
1037 // Fixed a bug in the OpenCascade XDE Colour handling when
\r
1038 // opening BREP Files, since BREP Files have no colour data.
\r
1039 // Hence, the face_colours Handle needs to be created as a NULL handle.
\r
1040 - occgeo->face_colours = Handle_XCAFDoc_ColorTool();
\r
1041 + occgeo->face_colours = Handle(XCAFDoc_ColorTool)();
1042 occgeo->face_colours.Nullify();
\r
1043 occgeo->changed = 1;
\r
1044 occgeo->BuildFMap();
\r
1045 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occgeom.hpp netgen-5.3.1_new/libsrc/occ/occgeom.hpp
1046 --- netgen-5.3.1_orig/libsrc/occ/occgeom.hpp 2014-08-29 13:54:03.000000000 +0400
1047 +++ netgen-5.3.1_new/libsrc/occ/occgeom.hpp 2016-09-29 14:44:01.996464598 +0300
1049 #include "Geom_Curve.hxx"
\r
1050 #include "Geom2d_Curve.hxx"
\r
1051 #include "Geom_Surface.hxx"
\r
1052 -#include "GeomAPI_ProjectPointOnSurf.hxx"
\r
1053 -#include "GeomAPI_ProjectPointOnCurve.hxx"
\r
1054 +// #include "GeomAPI_ProjectPointOnSurf.hxx"
1055 +// #include "GeomAPI_ProjectPointOnCurve.hxx"
1056 #include "BRepTools.hxx"
\r
1057 #include "TopExp.hxx"
\r
1058 #include "BRepBuilderAPI_MakeVertex.hxx"
\r
1060 #include "Geom_Curve.hxx"
\r
1061 #include "Geom2d_Curve.hxx"
\r
1062 #include "Geom_Surface.hxx"
\r
1063 -#include "GeomAPI_ProjectPointOnSurf.hxx"
\r
1064 -#include "GeomAPI_ProjectPointOnCurve.hxx"
\r
1065 +// #include "GeomAPI_ProjectPointOnSurf.hxx"
1066 +// #include "GeomAPI_ProjectPointOnCurve.hxx"
1067 #include "TopoDS_Wire.hxx"
\r
1068 #include "BRepTools_WireExplorer.hxx"
\r
1069 #include "BRepTools.hxx"
\r
1071 #include "IGESToBRep_Reader.hxx"
\r
1072 #include "Interface_Static.hxx"
\r
1073 #include "GeomAPI_ExtremaCurveCurve.hxx"
\r
1074 -#include "Standard_ErrorHandler.hxx"
\r
1075 +//#include "Standard_ErrorHandler.hxx"
1076 #include "Standard_Failure.hxx"
\r
1077 #include "ShapeUpgrade_ShellSewing.hxx"
\r
1078 #include "ShapeFix_Shape.hxx"
\r
1079 #include "ShapeFix_Wireframe.hxx"
\r
1080 +#include <Standard_Version.hxx>
1081 +#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) <= 0x060702
1082 +// porting to OCCT6.7.3
1083 #include "BRepMesh.hxx"
\r
1085 #include "BRepMesh_IncrementalMesh.hxx"
\r
1086 #include "BRepBndLib.hxx"
\r
1087 #include "Bnd_Box.hxx"
\r
1088 #include "ShapeAnalysis.hxx"
\r
1089 #include "ShapeBuild_ReShape.hxx"
\r
1091 +// -- Optimization: to use cached projector and classifier
1092 +#include <NCollection_DataMap.hxx>
1093 +class ShapeAnalysis_Surface;
1094 +class BRepTopAdaptor_FClass2d;
1096 // Philippose - 29/01/2009
\r
1097 // OpenCascade XDE Support
\r
1099 class OCCGeometry : public NetgenGeometry
\r
1102 + // -- Optimization: to use cached projector and classifier
1103 + mutable NCollection_DataMap<int,Handle(ShapeAnalysis_Surface)> fprjmap;
1104 + mutable NCollection_DataMap<int,BRepTopAdaptor_FClass2d*> fclsmap;
1107 TopoDS_Shape shape;
\r
1109 // OpenCascade XDE Support
\r
1110 // XCAF Handle to make the face colours available to the rest of
\r
1112 - Handle_XCAFDoc_ColorTool face_colours;
\r
1113 + Handle(XCAFDoc_ColorTool) face_colours;
1115 mutable int changed;
\r
1116 Array<int> facemeshstatus;
\r
1118 virtual void Save (string filename) const;
\r
1121 + ~OCCGeometry(); // -- to free cached projector and classifier
1125 Box<3> GetBoundingBox()
\r
1126 @@ -266,9 +279,14 @@
1130 - void Project (int surfi, Point<3> & p) const;
\r
1131 + // void Project (int surfi, Point<3> & p) const; -- optimization
1132 + bool Project (int surfi, Point<3> & p, double& u, double& v) const;
1133 bool FastProject (int surfi, Point<3> & ap, double& u, double& v) const;
\r
1135 + // -- Optimization: to use cached projector and classifier
1136 + void GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
1137 + BRepTopAdaptor_FClass2d*& cls) const;
1139 OCCSurface GetSurface (int surfi)
\r
1141 cout << "OCCGeometry::GetSurface using PLANESPACE" << endl;
\r
1142 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/occmeshsurf.cpp netgen-5.3.1_new/libsrc/occ/occmeshsurf.cpp
1143 --- netgen-5.3.1_orig/libsrc/occ/occmeshsurf.cpp 2014-08-29 13:54:03.000000000 +0400
1144 +++ netgen-5.3.1_new/libsrc/occ/occmeshsurf.cpp 2016-09-29 14:08:00.045144560 +0300
1146 #include <meshing.hpp>
1147 #include <GeomLProp_SLProps.hxx>
1148 #include <ShapeAnalysis_Surface.hxx>
1149 +#include <GeomAPI_ProjectPointOnCurve.hxx> // -- moved here from occgeom.hpp
1158 + else if ( lprop.IsNormalDefined() )
1160 n(0)=lprop.Normal().X();
1161 n(1)=lprop.Normal().Y();
1162 n(2)=lprop.Normal().Z();
1171 (*testout) << "u " << geominfo.u << " v " << geominfo.v
1172 @@ -434,23 +435,33 @@
1174 void MeshOptimize2dOCCSurfaces :: ProjectPoint (INDEX surfind, Point<3> & p) const
1176 - geometry.Project (surfind, p);
1177 + // geometry.Project (surfind, p); -- signature of Project() changed for optimization
1179 + geometry.Project (surfind, p, u, v);
1183 int MeshOptimize2dOCCSurfaces :: ProjectPointGI (INDEX surfind, Point<3> & p, PointGeomInfo & gi) const
1187 + //double u = gi.u;
1188 + //double v = gi.v;
1191 - if (geometry.FastProject (surfind, hp, u, v))
1193 + // -- u and v are computed by FastProject() and Project(), no need to call CalcPointGeomInfo()
1194 + // if (geometry.FastProject (surfind, hp, u, v))
1199 + // ProjectPoint (surfind, p);
1200 + // return CalcPointGeomInfo (surfind, gi, p);
1202 + if (gi.trignum > 0)
1203 + ok = geometry.FastProject (surfind, hp, gi.u, gi.v);
1205 + ok = geometry.Project (surfind, hp, gi.u, gi.v);
1209 - ProjectPoint (surfind, p);
1210 - return CalcPointGeomInfo (surfind, gi, p);
1216 if (!geometry.FastProject (surfi, hnewp, u, v))
1218 // cout << "Fast projection to surface fails! Using OCC projection" << endl;
1219 - geometry.Project (surfi, hnewp);
1220 + // geometry.Project (surfi, hnewp); -- Project() changed for optimization
1221 + geometry.Project (surfi, hnewp, u, v);
1230 + }//; -- to compile with -Wall -pedantic
1233 void OCCRefinementSurfaces ::
1234 @@ -708,14 +720,18 @@
1235 hnewp = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
1239 + }//; -- to compile with -Wall -pedantic
1242 void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi) const
1245 - geometry.Project (surfi, p);
1247 + //geometry.Project (surfi, p);
1250 + geometry.Project (surfi, p, u, v);
1252 + }//; -- to compile with -Wall -pedantic
1254 void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi, PointGeomInfo & gi) const
1256 @@ -723,9 +739,10 @@
1257 if (!geometry.FastProject (surfi, p, gi.u, gi.v))
1259 cout << "Fast projection to surface fails! Using OCC projection" << endl;
1260 - geometry.Project (surfi, p);
1262 + geometry.Project (surfi, p, u, v);
1269 diff -NaurwB netgen-5.3.1_orig/libsrc/occ/utilities.h netgen-5.3.1_new/libsrc/occ/utilities.h
1270 --- netgen-5.3.1_orig/libsrc/occ/utilities.h 2014-08-29 13:54:03.000000000 +0400
1271 +++ netgen-5.3.1_new/libsrc/occ/utilities.h 2016-09-29 14:04:51.504148314 +0300
1278 // #include "SALOME_Log.hxx"
1280 diff -NaurwB netgen-5.3.1_orig/nglib/nglib.h netgen-5.3.1_new/nglib/nglib.h
1281 --- netgen-5.3.1_orig/nglib/nglib.h 2014-08-29 13:54:00.000000000 +0400
1282 +++ netgen-5.3.1_new/nglib/nglib.h 2016-09-29 14:04:51.504148314 +0300
1284 // Philippose - 14.02.2009
\r
1285 // Modifications for creating a DLL in Windows
\r
1287 - #ifdef NGLIB_EXPORTS || nglib_EXPORTS
\r
1288 + #if defined NGLIB_EXPORTS || defined nglib_EXPORTS
1289 #define DLL_HEADER __declspec(dllexport)
\r
1291 #define DLL_HEADER __declspec(dllimport)
\r