1 diff -Naur netgen-4.9.13_orig/libsrc/meshing/meshtype.cpp netgen-4.9.13_new/libsrc/meshing/meshtype.cpp
2 --- netgen-4.9.13_orig/libsrc/meshing/meshtype.cpp 2009-09-13 14:28:38.000000000 +0400
3 +++ netgen-4.9.13_new/libsrc/meshing/meshtype.cpp 2011-06-03 17:54:39.000000000 +0400
6 +#include <float.h> // to get DBL_MIN defined
12 double det = trans.Det();
16 + if (det <= DBL_MIN) // avoid FPE
19 err += frob * frob / det;
22 double det = trans(0,0)*trans(1,1)-trans(1,0)*trans(0,1);
26 + if (det <= DBL_MIN) // avoid FPE
31 = dtrans(0,0) * trans(1,1) - trans(0,1) * dtrans(1,0)
32 + trans(0,0) * dtrans(1,1) - dtrans(0,1) * trans(1,0);
36 + if (det <= DBL_MIN) // avoid FPE
43 double det = trans.Det();
46 + if (det <= DBL_MIN) // avoid FPE
49 err += frob * frob / det;
54 - if (noz == 0.0) noz = 1e-10;
55 + //if (noz == 0.0) noz = 1e-10;
56 + if (noz <= DBL_MIN) noz = 1e-10; // avoid FPE
58 double xi = p(0) / noz;
59 double eta = p(1) / noz;
62 double det = -trans.Det();
66 + if (det <= DBL_MIN) // avoid FPE
69 err += frob * frob * frob / det;
76 + if (det <= DBL_MIN) // avoid FPE
89 @@ -2522,10 +2530,10 @@
91 MeshingParameters :: MeshingParameters ()
93 - optimize3d = "cmdmustm";
94 + optimize3d = (char*)"cmdmustm"; // optimize3d = "cmdmustm";
95 //optimize3d = "cmdmstm";
97 - optimize2d = "smsmsmSmSmSm";
98 + optimize2d = (char*)"smsmsmSmSmSm"; // optimize2d = "smsmsmSmSmSm";
102 diff -Naur netgen-4.9.13_orig/libsrc/meshing/meshtype.hpp netgen-4.9.13_new/libsrc/meshing/meshtype.hpp
103 --- netgen-4.9.13_orig/libsrc/meshing/meshtype.hpp 2009-11-09 13:50:43.000000000 +0300
104 +++ netgen-4.9.13_new/libsrc/meshing/meshtype.hpp 2011-06-03 17:56:43.000000000 +0400
109 +class Mesh; // added due to compilation errors on some platforms
112 SEGMENT = 1, SEGMENT3 = 2,
113 diff -Naur netgen-4.9.13_orig/libsrc/meshing/smoothing2.cpp netgen-4.9.13_new/libsrc/meshing/smoothing2.cpp
114 --- netgen-4.9.13_orig/libsrc/meshing/smoothing2.cpp 2009-11-09 13:47:09.000000000 +0300
115 +++ netgen-4.9.13_new/libsrc/meshing/smoothing2.cpp 2011-06-03 18:04:35.000000000 +0400
120 - meshthis -> GetNormalVector (surfi, sp1, gi1, n);
121 + //normal already computed: meshthis -> GetNormalVector (surfi, sp1, gi1, n);
123 pp1 = sp1 + x(0) * t1 + x(1) * t2;
125 // meshthis -> ProjectPoint (surfi, pp1);
130 - meshthis -> GetNormalVector (surfi, sp1, gi1, n);
131 + //normal already computed: meshthis -> GetNormalVector (surfi, sp1, gi1, n);
134 pp1 = sp1 + x(0) * t1 + x(1) * t2;
140 - meshthis -> GetNormalVector (surfi, sp1, gi1, n);
141 + //normal already computed: meshthis -> GetNormalVector (surfi, sp1, gi1, n);
144 pp1 = sp1 + x(0) * t1 + x(1) * t2;
150 - meshthis -> GetNormalVector (surfi, sp1, gi1, n);
151 + //normal already computed: meshthis -> GetNormalVector (surfi, sp1, gi1, n);
155 // pp1.Add2 (x.Get(1), t1, x.Get(2), t2);
158 mesh[pi] = Point<3> (origp);
161 + break; // exit as <fact> is not used anymore
165 diff -Naur netgen-4.9.13_orig/libsrc/occ/occconstruction.cpp netgen-4.9.13_new/libsrc/occ/occconstruction.cpp
166 --- netgen-4.9.13_orig/libsrc/occ/occconstruction.cpp 2009-08-24 06:32:47.000000000 +0400
167 +++ netgen-4.9.13_new/libsrc/occ/occconstruction.cpp 2011-04-20 13:20:56.000000000 +0400
169 #include <BRepAlgoAPI_Common.hxx>
170 #include <BRepAlgoAPI_Fuse.hxx>
171 #include <BRepAlgoAPI_Section.hxx>
172 -#include <BRepOffsetAPI_Sewing.hxx>
173 +//#include <BRepOffsetAPI_Sewing.hxx>
174 //#include <BRepAlgo_Sewing.hxx>
175 #include <BRepOffsetAPI_MakeOffsetShape.hxx>
176 #include <ShapeFix_Shape.hxx>
177 diff -Naur netgen-4.9.13_orig/libsrc/occ/occgenmesh.cpp netgen-4.9.13_new/libsrc/occ/occgenmesh.cpp
178 --- netgen-4.9.13_orig/libsrc/occ/occgenmesh.cpp 2010-03-16 09:30:07.000000000 +0300
179 +++ netgen-4.9.13_new/libsrc/occ/occgenmesh.cpp 2011-06-28 12:04:32.000000000 +0400
182 #define DIVIDEEDGESECTIONS 1000
183 #define IGNORECURVELENGTH 1e-4
184 +// a small value used to avoid FPE
185 +#define VSMALL 1e-10
188 bool merge_solids = 1;
192 Point<3> p = p0 + 0.5*n;
193 - double lambda = (p-l.p0)*n / nq;
194 + // double lambda = (p-l.p0)*n / nq; -- avoid FPE
195 + double lambda = (fabs(nq) > 1e-10) ? (p-l.p0)*n / nq : -1;
197 if (lambda >= 0 && lambda <= 1)
204 + static // useless out of this file
205 double ComputeH (double kappa)
209 if (mparam.maxh * kappa < 1)
213 + // hret = 1 / kappa; -- avoid FPE
214 + hret = 1 / (kappa + VSMALL);
216 if (mparam.maxh < hret)
224 + static // useless out of this file
225 void RestrictHTriangle (gp_Pnt2d & par0, gp_Pnt2d & par1, gp_Pnt2d & par2,
226 BRepLProp_SLProps * prop, Mesh & mesh, int depth, double h = 0)
233 - if (h > 30) return;
234 + // commented to restrict H on a large sphere for example
235 + //if (h > 30) return;
238 if (h < maxside && depth < 10)
243 + static // useless out of this file
244 void DivideEdge (TopoDS_Edge & edge, Array<MeshPoint> & ps,
245 Array<double> & params, Mesh & mesh)
251 - double olddist = 0;
253 + //double olddist = 0; -- useless variables
256 int tmpVal = (int)(DIVIDEEDGESECTIONS);
258 @@ -256,15 +262,19 @@
261 pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0));
262 + // -- no more than 1 segment per <edge length>/DIVIDEEDGESECTIONS
263 hvalue[i] = hvalue[i-1] +
264 - 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
265 - pnt.Distance(oldpnt);
266 + // 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
267 + // pnt.Distance(oldpnt);
269 + 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
270 + pnt.Distance(oldpnt));
272 //(*testout) << "mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z())) " << mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))
273 // << " pnt.Distance(oldpnt) " << pnt.Distance(oldpnt) << endl;
276 - dist = pnt.Distance(oldpnt);
277 + //olddist = dist; -- useless variables
278 + //dist = pnt.Distance(oldpnt);
281 // nsubedges = int(ceil(hvalue[DIVIDEEDGESECTIONS]));
284 if (hvalue[i1]/hvalue[DIVIDEEDGESECTIONS]*nsubedges >= i)
286 - params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
287 + // -- for nsubedges comparable to DIVIDEEDGESECTIONS
288 + //params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
289 + double d1 = i1 - (hvalue[i1] - i*hvalue[DIVIDEEDGESECTIONS]/nsubedges)/(hvalue[i1]-hvalue[i1-1]);
290 + params[i] = s0+(d1/double(DIVIDEEDGESECTIONS))*(s1-s0);
291 pnt = c->Value(params[i]);
292 ps[i-1] = MeshPoint (Point3d(pnt.X(), pnt.Y(), pnt.Z()));
295 (*testout) << "nedges = " << nedges << endl;
297 double eps = 1e-6 * geom.GetBoundingBox().Diam();
298 + const double eps2 = eps * eps; // -- small optimization
300 for (int i = 1; i <= nvertices; i++)
305 for (PointIndex pi = 1; pi <= mesh.GetNP(); pi++)
306 - if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
307 + //if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
308 + if ( Dist2 (mesh[pi], Point<3>(mp)) < eps2 ) // -- small optimization
314 TopoDS_Face face = TopoDS::Face(exp1.Current());
315 int facenr = geom.fmap.FindIndex(face);
316 + if ( facenr < 1 ) continue; // -- to support SALOME sub-meshes
318 if (face2solid[0][facenr-1] == 0)
319 face2solid[0][facenr-1] = solidnr;
324 + edgenr = mesh.GetNSeg(); // to support SALOME sub-meshes
326 (*testout) << "faces = " << geom.fmap.Extent() << endl;
329 //(*testout) << "ignoring degenerated edge" << endl;
332 + if ( geom.emap.FindIndex(edge) < 1 ) continue; // to support SALOME sub-meshes
334 if (geom.vmap.FindIndex(TopExp::FirstVertex (edge)) ==
335 geom.vmap.FindIndex(TopExp::LastVertex (edge)))
336 @@ -481,13 +499,45 @@
338 Point<3> fp = occ2ng (BRep_Tool::Pnt (TopExp::FirstVertex (edge)));
339 Point<3> lp = occ2ng (BRep_Tool::Pnt (TopExp::LastVertex (edge)));
340 + double tol2 = std::min( eps*eps, 1e-6 * Dist2( fp, lp ));
344 for (PointIndex pi = 1; pi < first_ep; pi++)
346 - if (Dist2 (mesh[pi], fp) < eps*eps) pnums[0] = pi;
347 - if (Dist2 (mesh[pi], lp) < eps*eps) pnums.Last() = pi;
348 + if (Dist2 (mesh[pi], fp) < tol2) pnums[0] = pi;
349 + if (Dist2 (mesh[pi], lp) < tol2) pnums.Last() = pi;
351 + if ( pnums[0] == pnums.Last() )
353 + if ( pnums[0] == -1 || pnums.Last() == -1 )
355 + // take into account a possible large gap between a vertex and an edge curve
356 + // and a large vertex tolerance covering the whole edge
357 + if ( pnums[0] == -1 )
359 + double tol = BRep_Tool::Tolerance( TopExp::FirstVertex (edge));
360 + for (PointIndex pi = 1; pi < first_ep; pi++)
361 + if (pi != pnums.Last() && Dist2 (mesh[pi], fp) < 2*tol*tol)
364 + if ( pnums[0] == -1 )
365 + pnums[0] = geom.vmap.FindIndex (TopExp::FirstVertex (edge));
367 + if ( pnums.Last() == -1 )
369 + double tol = BRep_Tool::Tolerance( TopExp::LastVertex (edge));
370 + for (PointIndex pi = 1; pi < first_ep; pi++)
371 + if (pi != pnums[0] && Dist2 (mesh[pi], lp) < 2*tol*tol)
374 + if ( pnums.Last() == -1 )
375 + pnums.Last() = geom.vmap.FindIndex (TopExp::LastVertex (edge));
378 + if ( Dist2( fp, mesh[PointIndex(pnums[0])]) >
379 + Dist2( lp, mesh[PointIndex(pnums.Last())]))
380 + std::swap( pnums[0], pnums.Last() );
387 (*testout) << "mesh face " << k << endl;
388 - multithread.percent = 100 * k / (mesh.GetNFD()+1e-10);
389 + // multithread.percent = 100 * k / (mesh.GetNFD()+1e-10); -- avoid FPE
390 + multithread.percent = 100 * k / (mesh.GetNFD() + VSMALL);
391 geom.facemeshstatus[k-1] = -1;
395 // if (k != 36) continue;
397 // (*testout) << "optimize face " << k << endl;
398 - multithread.percent = 100 * k / (mesh.GetNFD()+1e-10);
399 + //multithread.percent = 100 * k / (mesh.GetNFD()+1e-10); -- avoid FPE
400 + multithread.percent = 100 * k / (mesh.GetNFD() + VSMALL);
402 FaceDescriptor & fd = mesh.GetFaceDescriptor(k);
404 @@ -1456,3 +1508,4 @@
409 diff -Naur netgen-4.9.13_orig/libsrc/occ/occgeom.cpp netgen-4.9.13_new/libsrc/occ/occgeom.cpp
410 --- netgen-4.9.13_orig/libsrc/occ/occgeom.cpp 2010-03-05 16:16:21.000000000 +0300
411 +++ netgen-4.9.13_new/libsrc/occ/occgeom.cpp 2011-06-03 19:32:06.000000000 +0400
413 #include "ShapeAnalysis_CheckSmallFace.hxx"
414 #include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx"
415 #include "ShapeAnalysis_Surface.hxx"
416 +#include <BRepTopAdaptor_FClass2d.hxx> // -- to optimize Project() and FastProject()
417 +#include <TopAbs_State.hxx>
418 #include "BRepAlgoAPI_Fuse.hxx"
419 #include "BRepCheck_Analyzer.hxx"
420 #include "BRepLib.hxx"
422 #include "ShapeFix_FixSmallFace.hxx"
423 #include "Partition_Spliter.hxx"
428 - void OCCGeometry :: PrintNrShapes ()
429 + // free data used to optimize Project() and FastProject()
430 + OCCGeometry::~OCCGeometry()
432 + NCollection_DataMap<int,BRepTopAdaptor_FClass2d*>::Iterator it(fclsmap);
433 + for (; it.More(); it.Next())
437 + void OCCGeometry :: PrintNrShapes ()
441 @@ -951,25 +960,58 @@
445 + // returns a projector and a classifier for the given surface
446 + void OCCGeometry::GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
447 + BRepTopAdaptor_FClass2d*& cls) const
449 + //MSV: organize caching projector in the map
450 + if (fprjmap.IsBound(surfi))
452 + proj = fprjmap.Find(surfi);
453 + cls = fclsmap.Find(surfi);
457 + const TopoDS_Face& aFace = TopoDS::Face(fmap(surfi));
458 + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
459 + proj = new ShapeAnalysis_Surface(aSurf);
460 + fprjmap.Bind(surfi, proj);
461 + cls = new BRepTopAdaptor_FClass2d(aFace,Precision::Confusion());
462 + fclsmap.Bind(surfi, cls);
467 - void OCCGeometry :: Project (int surfi, Point<3> & p) const
468 + // void OCCGeometry :: Project (int surfi, Point<3> & p) const
469 + bool OCCGeometry :: Project (int surfi, Point<3> & p, double& u, double& v) const
472 if (++cnt % 1000 == 0) cout << "Project cnt = " << cnt << endl;
474 gp_Pnt pnt(p(0), p(1), p(2));
477 - Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
478 - Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
479 - gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
480 - suval.Coord( u, v);
481 - pnt = thesurf->Value( u, v );
484 + // -- Optimization: use cached projector and classifier
486 + // Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
487 + // Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
488 + // gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
489 + // suval.Coord( u, v);
490 + // pnt = thesurf->Value( u, v );
492 + Handle(ShapeAnalysis_Surface) proj;
493 + BRepTopAdaptor_FClass2d *cls;
494 + GetFaceTools(surfi, proj, cls);
496 + gp_Pnt2d p2d = proj->ValueOfUV(pnt, Precision::Confusion());
497 + if (cls->Perform(p2d) == TopAbs_OUT)
501 + pnt = proj->Value(p2d);
504 p = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
510 @@ -979,54 +1021,69 @@
512 gp_Pnt p(ap(0), ap(1), ap(2));
514 - Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
516 - gp_Pnt x = surface->Value (u,v);
518 - if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
522 - surface->D1(u,v,x,du,dv);
528 - double det, lambda, mu;
535 - det = Det3 (n.X(), du.X(), dv.X(),
536 - n.Y(), du.Y(), dv.Y(),
537 - n.Z(), du.Z(), dv.Z());
539 - if (det < 1e-15) return false;
541 - lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
542 - n.Y(), p.Y()-x.Y(), dv.Y(),
543 - n.Z(), p.Z()-x.Z(), dv.Z())/det;
545 - mu = Det3 (n.X(), du.X(), p.X()-x.X(),
546 - n.Y(), du.Y(), p.Y()-x.Y(),
547 - n.Z(), du.Z(), p.Z()-x.Z())/det;
553 - surface->D1(u,v,x,du,dv);
555 - } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
557 - // (*testout) << "FastProject count: " << count << endl;
559 - if (count == 50) return false;
561 - ap = Point<3> (x.X(), x.Y(), x.Z());
562 + // -- Optimization: use cached projector and classifier
563 + // Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
565 + // gp_Pnt x = surface->Value (u,v);
567 + // if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
571 + // surface->D1(u,v,x,du,dv);
577 + // double det, lambda, mu;
584 + // det = Det3 (n.X(), du.X(), dv.X(),
585 + // n.Y(), du.Y(), dv.Y(),
586 + // n.Z(), du.Z(), dv.Z());
588 + // if (det < 1e-15) return false;
590 + // lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
591 + // n.Y(), p.Y()-x.Y(), dv.Y(),
592 + // n.Z(), p.Z()-x.Z(), dv.Z())/det;
594 + // mu = Det3 (n.X(), du.X(), p.X()-x.X(),
595 + // n.Y(), du.Y(), p.Y()-x.Y(),
596 + // n.Z(), du.Z(), p.Z()-x.Z())/det;
602 + // surface->D1(u,v,x,du,dv);
604 + // } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
606 + // // (*testout) << "FastProject count: " << count << endl;
608 + // if (count == 50) return false;
610 + // ap = Point<3> (x.X(), x.Y(), x.Z());
611 + Handle(ShapeAnalysis_Surface) proj;
612 + BRepTopAdaptor_FClass2d *cls;
613 + GetFaceTools(surfi, proj, cls);
615 + gp_Pnt2d p2d = proj->NextValueOfUV(gp_Pnt2d(u,v), p, Precision::Confusion());
616 + if (cls->Perform(p2d) == TopAbs_OUT)
618 + //cout << "Projection fails" << endl;
622 + p = proj->Value(p2d);
624 + ap = Point<3> (p.X(), p.Y(), p.Z());
628 diff -Naur netgen-4.9.13_orig/libsrc/occ/occgeom.hpp netgen-4.9.13_new/libsrc/occ/occgeom.hpp
629 --- netgen-4.9.13_orig/libsrc/occ/occgeom.hpp 2010-01-14 19:56:19.000000000 +0300
630 +++ netgen-4.9.13_new/libsrc/occ/occgeom.hpp 2011-06-28 11:07:52.000000000 +0400
632 #include "Geom_Curve.hxx"
633 #include "Geom2d_Curve.hxx"
634 #include "Geom_Surface.hxx"
635 -#include "GeomAPI_ProjectPointOnSurf.hxx"
636 -#include "GeomAPI_ProjectPointOnCurve.hxx"
637 +// #include "GeomAPI_ProjectPointOnSurf.hxx"
638 +// #include "GeomAPI_ProjectPointOnCurve.hxx"
639 #include "BRepTools.hxx"
640 #include "TopExp.hxx"
641 #include "BRepBuilderAPI_MakeVertex.hxx"
643 #include "Geom_Curve.hxx"
644 #include "Geom2d_Curve.hxx"
645 #include "Geom_Surface.hxx"
646 -#include "GeomAPI_ProjectPointOnSurf.hxx"
647 -#include "GeomAPI_ProjectPointOnCurve.hxx"
648 +// #include "GeomAPI_ProjectPointOnSurf.hxx"
649 +// #include "GeomAPI_ProjectPointOnCurve.hxx"
650 #include "TopoDS_Wire.hxx"
651 #include "BRepTools_WireExplorer.hxx"
652 #include "BRepTools.hxx"
654 #include "IGESToBRep_Reader.hxx"
655 #include "Interface_Static.hxx"
656 #include "GeomAPI_ExtremaCurveCurve.hxx"
657 -#include "Standard_ErrorHandler.hxx"
658 +//#include "Standard_ErrorHandler.hxx"
659 #include "Standard_Failure.hxx"
660 #include "ShapeUpgrade_ShellSewing.hxx"
661 #include "ShapeFix_Shape.hxx"
663 #include "ShapeAnalysis.hxx"
664 #include "ShapeBuild_ReShape.hxx"
666 +// -- Optimization: to use cached projector and classifier
667 +#include <NCollection_DataMap.hxx>
668 +class Handle_ShapeAnalysis_Surface;
669 +class BRepTopAdaptor_FClass2d;
671 // Philippose - 29/01/2009
672 // OpenCascade XDE Support
674 class OCCGeometry : public NetgenGeometry
677 + // -- Optimization: to use cached projector and classifier
678 + mutable NCollection_DataMap<int,Handle_ShapeAnalysis_Surface> fprjmap;
679 + mutable NCollection_DataMap<int,BRepTopAdaptor_FClass2d*> fclsmap;
687 + ~OCCGeometry(); // -- to free cached projector and classifier
691 Box<3> GetBoundingBox()
696 - void Project (int surfi, Point<3> & p) const;
697 + // void Project (int surfi, Point<3> & p) const; -- optimization
698 + bool Project (int surfi, Point<3> & p, double& u, double& v) const;
699 bool FastProject (int surfi, Point<3> & ap, double& u, double& v) const;
701 + // -- Optimization: to use cached projector and classifier
702 + void GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
703 + BRepTopAdaptor_FClass2d*& cls) const;
705 OCCSurface GetSurface (int surfi)
707 cout << "OCCGeometry::GetSurface using PLANESPACE" << endl;
708 diff -Naur netgen-4.9.13_orig/libsrc/occ/occmeshsurf.cpp netgen-4.9.13_new/libsrc/occ/occmeshsurf.cpp
709 --- netgen-4.9.13_orig/libsrc/occ/occmeshsurf.cpp 2009-08-24 06:32:47.000000000 +0400
710 +++ netgen-4.9.13_new/libsrc/occ/occmeshsurf.cpp 2011-06-03 19:55:14.000000000 +0400
712 #include <meshing.hpp>
713 #include <GeomLProp_SLProps.hxx>
714 #include <ShapeAnalysis_Surface.hxx>
715 +#include <GeomAPI_ProjectPointOnCurve.hxx> // -- moved here from occgeom.hpp
719 @@ -434,23 +435,33 @@
721 void MeshOptimize2dOCCSurfaces :: ProjectPoint (INDEX surfind, Point<3> & p) const
723 - geometry.Project (surfind, p);
724 + // geometry.Project (surfind, p); -- signature of Project() changed for optimization
726 + geometry.Project (surfind, p, u, v);
730 int MeshOptimize2dOCCSurfaces :: ProjectPointGI (INDEX surfind, Point<3> & p, PointGeomInfo & gi) const
738 - if (geometry.FastProject (surfind, hp, u, v))
743 - ProjectPoint (surfind, p);
744 - return CalcPointGeomInfo (surfind, gi, p);
745 + // -- u and v are computed by FastProject() and Project(), no need to call CalcPointGeomInfo()
746 + // if (geometry.FastProject (surfind, hp, u, v))
751 + // ProjectPoint (surfind, p);
752 + // return CalcPointGeomInfo (surfind, gi, p);
754 + if (gi.trignum > 0)
755 + ok = geometry.FastProject (surfind, hp, gi.u, gi.v);
757 + ok = geometry.Project (surfind, hp, gi.u, gi.v);
764 if (!geometry.FastProject (surfi, hnewp, u, v))
766 // cout << "Fast projection to surface fails! Using OCC projection" << endl;
767 - geometry.Project (surfi, hnewp);
768 + // geometry.Project (surfi, hnewp); -- Project() changed for optimization
769 + geometry.Project (surfi, hnewp, u, v);
778 + }//; -- to compile with -Wall -pedantic
781 void OCCRefinementSurfaces ::
782 @@ -708,14 +720,18 @@
783 hnewp = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
790 void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi)
793 - geometry.Project (surfi, p);
795 + // geometry.Project (surfi, p); -- Project() changed for optimization
798 + geometry.Project (surfi, p, u, v);
800 + }//; -- to compile with -Wall -pedantic
802 void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi, PointGeomInfo & gi)
805 if (!geometry.FastProject (surfi, p, gi.u, gi.v))
807 cout << "Fast projection to surface fails! Using OCC projection" << endl;
808 - geometry.Project (surfi, p);
810 + geometry.Project (surfi, p, u, v);
817 diff -Naur netgen-4.9.13_orig/libsrc/occ/utilities.h netgen-4.9.13_new/libsrc/occ/utilities.h
818 --- netgen-4.9.13_orig/libsrc/occ/utilities.h 2009-08-24 06:12:24.000000000 +0400
819 +++ netgen-4.9.13_new/libsrc/occ/utilities.h 2011-04-20 13:20:56.000000000 +0400
826 // #include "SALOME_Log.hxx"
828 diff -Naur netgen-4.9.13_orig/libsrc/stlgeom/stlgeommesh.cpp netgen-4.9.13_new/libsrc/stlgeom/stlgeommesh.cpp
829 --- netgen-4.9.13_orig/libsrc/stlgeom/stlgeommesh.cpp 2009-08-10 15:40:51.000000000 +0400
830 +++ netgen-4.9.13_new/libsrc/stlgeom/stlgeommesh.cpp 2011-06-03 19:57:16.000000000 +0400
831 @@ -1435,7 +1435,8 @@
833 if (!optstring || strlen(optstring) == 0)
835 - mparam.optimize2d = "smcm";
836 + //mparam.optimize2d = (char*)"smcm";
837 + mparam.optimize2d = (char*)"smcm";
841 @@ -1451,7 +1452,8 @@
843 mesh -> LoadLocalMeshSize (mparam.meshsizefilename);
844 mesh -> CalcLocalHFromSurfaceCurvature (stlparam.resthsurfmeshcurvfac);
845 - mparam.optimize2d = "cmsmSm";
846 + //mparam.optimize2d = (char*)"cmsmSm";
847 + mparam.optimize2d = (char*)"cmsmSm";
848 STLSurfaceOptimization (*stlgeometry, *mesh, mparam);
850 (*statout) << GetTime() << " & ";
851 @@ -1557,7 +1559,8 @@
853 if (!optstring || strlen(optstring) == 0)
855 - mparam.optimize3d = "cmdmstm";
856 + //mparam.optimize3d = "cmdmstm";
857 + mparam.optimize3d = (char*)"cmdmstm";
861 --- netgen-4.9.13_orig/nglib/nglib.h 2010-05-18 15:20:25.000000000 +0400
862 +++ netgen-4.9.13_new/nglib/nglib.h 2010-05-31 13:02:19.000000000 +0400
864 // Philippose - 14.02.2009
865 // Modifications for creating a DLL in Windows
867 - #ifdef NGLIB_EXPORTS || nglib_EXPORTS
868 + #if defined NGLIB_EXPORTS || defined nglib_EXPORTS
869 #define DLL_HEADER __declspec(dllexport)
871 #define DLL_HEADER __declspec(dllimport)