1 diff -Naur netgen-4.5.old/libsrc/csg/meshsurf.cpp netgen-4.5.new/libsrc/csg/meshsurf.cpp
2 --- netgen-4.5.old/libsrc/csg/meshsurf.cpp 2006-02-14 11:54:35.000000000 +0300
3 +++ netgen-4.5.new/libsrc/csg/meshsurf.cpp 2008-02-12 14:57:01.000000000 +0300
8 -void MeshOptimize2dSurfaces :: ProjectPoint (INDEX surfind, Point3d & p) const
9 +bool MeshOptimize2dSurfaces :: ProjectPoint (INDEX surfind, Point3d & p) const
12 geometry.GetSurface(surfind)->Project (hp);
17 void MeshOptimize2dSurfaces :: ProjectPoint2 (INDEX surfind, INDEX surfind2,
18 diff -Naur netgen-4.5.old/libsrc/csg/meshsurf.hpp netgen-4.5.new/libsrc/csg/meshsurf.hpp
19 --- netgen-4.5.old/libsrc/csg/meshsurf.hpp 2004-01-20 14:49:44.000000000 +0300
20 +++ netgen-4.5.new/libsrc/csg/meshsurf.hpp 2008-02-12 14:57:01.000000000 +0300
22 MeshOptimize2dSurfaces (const CSGeometry & ageometry);
25 - virtual void ProjectPoint (INDEX surfind, Point3d & p) const;
26 + virtual bool ProjectPoint (INDEX surfind, Point3d & p) const;
28 virtual void ProjectPoint2 (INDEX surfind, INDEX surfind2, Point3d & p) const;
30 diff -Naur netgen-4.5.old/libsrc/interface/Makefile netgen-4.5.new/libsrc/interface/Makefile
31 --- netgen-4.5.old/libsrc/interface/Makefile 2005-08-09 18:14:59.000000000 +0400
32 +++ netgen-4.5.new/libsrc/interface/Makefile 2008-02-12 14:57:01.000000000 +0300
34 -src = nginterface.cpp writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.cpp writeelmer.cpp writegmsh.cpp writejcm.cpp readuser.cpp importsolution.cpp
35 +#src = nginterface.cpp writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.cpp writeelmer.cpp writegmsh.cpp writejcm.cpp readuser.cpp importsolution.cpp
36 +src = writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.cpp writeelmer.cpp writegmsh.cpp writejcm.cpp readuser.cpp nglib.cpp ngnewdelete.cpp
39 libpath = libsrc/interface
40 diff -Naur netgen-4.5.old/libsrc/interface/nglib.cpp netgen-4.5.new/libsrc/interface/nglib.cpp
41 --- netgen-4.5.old/libsrc/interface/nglib.cpp 2005-10-18 17:53:18.000000000 +0400
42 +++ netgen-4.5.new/libsrc/interface/nglib.cpp 2008-02-12 14:57:01.000000000 +0300
53 diff -Naur netgen-4.5.old/libsrc/makefile.inc netgen-4.5.new/libsrc/makefile.inc
54 --- netgen-4.5.old/libsrc/makefile.inc 2005-09-02 17:17:51.000000000 +0400
55 +++ netgen-4.5.new/libsrc/makefile.inc 2008-02-12 14:59:55.000000000 +0300
57 LIBSRC_DIR=$(CPP_DIR)/libsrc
58 LIB_DIR=$(CPP_DIR)/lib/$(MACHINE)
61 -#OCCINC_DIR=$(OCC_DIR)/inc
62 -#OCCLIB_DIR=$(OCC_DIR)/lib
63 -# OCC_DIR=/opt/OpenCASCADE5.2/ros
64 -# OCC_DIR=/home/joachim/download/occ/Linux
65 -# OCCINC_DIR=$(OCC_DIR)/inc -I$(OCC_DIR)/ros/inc
66 -# OCCLIB_DIR=$(OCC_DIR)/Linux/lib
68 +OCCINC_DIR=$(OCC_DIR)/inc
69 +OCCLIB_DIR=$(OCC_DIR)/Linux/lib
71 include $(LIBSRC_DIR)/makefile.mach.$(MACHINE)
73 -CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include -I$(OCCINC_DIR)
74 +CPLUSPLUSFLAGS1 = -c -fPIC -I$(LIBSRC_DIR)/include -I$(OCCINC_DIR) \
75 + -DOCCGEOMETRY -DOCC52 -DHAVE_IOSTREAM -DHAVE_LIMITS_H
79 diff -Naur netgen-4.5.old/libsrc/makefile.mach.LINUX netgen-4.5.new/libsrc/makefile.mach.LINUX
80 --- netgen-4.5.old/libsrc/makefile.mach.LINUX 2004-10-11 23:49:26.000000000 +0400
81 +++ netgen-4.5.new/libsrc/makefile.mach.LINUX 2008-02-12 14:57:01.000000000 +0300
86 -CPLUSPLUSFLAGS2 = -O2 -I/usr/include/GL3.5 -DLINUX -DOPENGL \
87 +CPLUSPLUSFLAGS2 = -O2 -I/usr/include/GL3.5 -DLINUX \
88 -ftemplate-depth-99 -finline-limit=10000 \
89 -Wdisabled-optimization -funroll-loops -DnoNGSOLVE
91 diff -Naur netgen-4.5.old/libsrc/meshing/meshtype.cpp netgen-4.5.new/libsrc/meshing/meshtype.cpp
92 --- netgen-4.5.old/libsrc/meshing/meshtype.cpp 2006-02-10 13:11:08.000000000 +0300
93 +++ netgen-4.5.new/libsrc/meshing/meshtype.cpp 2008-03-14 13:19:53.000000000 +0300
98 #include "meshing.hpp"
103 double det = trans.Det();
105 + if (det <= DBL_MIN)
108 err += frob * frob / det;
111 diff -Naur netgen-4.5.old/libsrc/meshing/improve2.cpp netgen-4.5.new/libsrc/meshing/improve2.cpp
112 --- netgen-4.5.old/libsrc/meshing/improve2.cpp 2006-01-11 19:08:19.000000000 +0300
113 +++ netgen-4.5.new/libsrc/meshing/improve2.cpp 2008-02-12 14:57:01.000000000 +0300
118 -#include <visual.hpp>
119 +//#include <visual.hpp>
123 diff -Naur netgen-4.5.old/libsrc/meshing/improve2.hpp netgen-4.5.new/libsrc/meshing/improve2.hpp
124 --- netgen-4.5.old/libsrc/meshing/improve2.hpp 2004-10-12 23:22:55.000000000 +0400
125 +++ netgen-4.5.new/libsrc/meshing/improve2.hpp 2008-02-12 14:57:01.000000000 +0300
128 virtual void SelectSurfaceOfPoint (const Point3d & p,
129 const PointGeomInfo & gi);
131 - virtual void ProjectPoint (INDEX /* surfind */, Point3d & /* p */) const { };
133 + /// project point on surface, returns true if success
134 + virtual bool ProjectPoint (INDEX /* surfind */, Point3d & /* p */) const { return false; }
135 + /// fast project point on surface using point geom info of a neighboring point
136 + /// if gi.trignum != 0,
137 + /// returns true if success, gi is updated
138 + virtual bool ProjectPoint (INDEX surfind, Point3d & p, PointGeomInfo& gi) const
139 + { gi.trignum = 1; return ProjectPoint (surfind, p); }
141 virtual void ProjectPoint2 (INDEX /* surfind */, INDEX /* surfind2 */, Point3d & /* p */) const { };
142 - /// liefert zu einem 3d-Punkt die geominfo (Dreieck) und liefert 1, wenn erfolgreich,
143 - /// 0, wenn nicht (Punkt ausserhalb von chart)
144 - virtual int CalcPointGeomInfo(PointGeomInfo& gi, const Point3d& /*p3*/) const
145 - { gi.trignum = 1; return 1;};
147 - virtual int CalcPointGeomInfo(int /* surfind */, PointGeomInfo& gi, const Point3d& p3) const
148 - { return CalcPointGeomInfo (gi, p3); }
151 virtual void GetNormalVector(INDEX surfind, const Point3d & p, PointGeomInfo & gi, Vec3d & n) const;
152 diff -Naur netgen-4.5.old/libsrc/meshing/smoothing2.cpp netgen-4.5.new/libsrc/meshing/smoothing2.cpp
153 --- netgen-4.5.old/libsrc/meshing/smoothing2.cpp 2006-01-11 19:08:20.000000000 +0300
154 +++ netgen-4.5.new/libsrc/meshing/smoothing2.cpp 2008-02-12 14:57:01.000000000 +0300
156 double Opti2SurfaceMinFunction ::
157 FuncGrad (const Vector & x, Vector & grad) const
163 double badness, hbadness;
168 - meshthis -> GetNormalVector (surfi, sp1, gi1, n);
171 pp1.Add2 (x.Get(1), t1, x.Get(2), t2);
174 double Opti2SurfaceMinFunction ::
175 FuncDeriv (const Vector & x, const Vector & dir, double & deriv) const
181 double badness, hbadness;
186 - meshthis -> GetNormalVector (surfi, sp1, gi1, n);
189 pp1.Add2 (x.Get(1), t1, x.Get(2), t2);
199 double badness, hbadness, hbad, hderiv;
204 - meshthis -> GetNormalVector (surfi, sp1, gi1, n);
207 pp1.Add2 (x.Get(1), t1, x.Get(2), t2);
217 double badness, hbadness, hbad, hderiv;
222 - meshthis -> GetNormalVector (surfi, sp1, gi1, n);
225 pp1.Add2 (x.Get(1), t1, x.Get(2), t2);
227 @@ -859,19 +851,21 @@
228 locelements.SetSize(0);
233 for (j = 0; j < elementsonpoint[pi].Size(); j++)
235 sei = elementsonpoint[pi][j];
236 const Element2d & bel = mesh[sei];
237 surfi = mesh.GetFaceDescriptor(bel.GetIndex()).SurfNr();
240 locelements.Append (sei);
242 for (k = 1; k <= bel.GetNP(); k++)
243 if (bel.PNum(k) == pi)
246 + ngi = bel.GeomInfoPi(k);
253 //optimizer loop (if not whole distance is not possible, move only a bit!!!!)
254 - while (loci <= 5 && !moveisok)
255 + while (loci <= 5 && !moveisok)
258 mesh[pi].X() = origp.X() + (x.Get(1) * t1.X() + x.Get(2) * t2.X())*fact;
263 - ProjectPoint (surfi, mesh[pi]);
264 + moveisok = ProjectPoint (surfi, mesh[pi], ngi);
266 - moveisok = CalcPointGeomInfo(surfi, ngi, mesh[pi]);
267 - // point lies on same chart in stlsurface
269 + // point lies on same chart in stlsurface
272 for (j = 0; j < locelements.Size(); j++)
273 diff -Naur netgen-4.5.old/libsrc/occ/occconstruction.cpp netgen-4.5.new/libsrc/occ/occconstruction.cpp
274 --- netgen-4.5.old/libsrc/occ/occconstruction.cpp 2005-12-06 18:15:53.000000000 +0300
275 +++ netgen-4.5.new/libsrc/occ/occconstruction.cpp 2008-02-12 14:57:01.000000000 +0300
277 #include <BRepAlgoAPI_Common.hxx>
278 #include <BRepAlgoAPI_Fuse.hxx>
279 #include <BRepAlgoAPI_Section.hxx>
280 -#include <BRepOffsetAPI_Sewing.hxx>
281 -#include <BRepAlgo_Sewing.hxx>
282 +//#include <BRepOffsetAPI_Sewing.hxx>
283 +//#include <BRepAlgo_Sewing.hxx>
284 #include <BRepOffsetAPI_MakeOffsetShape.hxx>
285 #include <ShapeFix_Shape.hxx>
287 diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/occgenmesh.cpp
288 --- netgen-4.5.old/libsrc/occ/occgenmesh.cpp 2006-02-07 13:12:48.000000000 +0300
289 +++ netgen-4.5.new/libsrc/occ/occgenmesh.cpp 2008-02-12 14:57:01.000000000 +0300
291 return Point<3> (p.X(), p.Y(), p.Z());
294 - void DivideEdge (TopoDS_Edge & edge,
295 + static void DivideEdge (TopoDS_Edge & edge,
296 ARRAY<MeshPoint> & ps,
297 ARRAY<double> & params,
303 - double olddist = 0;
306 - for (int i = 1; i <= DIVIDEEDGESECTIONS; i++)
308 + for (i = 1; i <= DIVIDEEDGESECTIONS; i++)
311 pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0));
312 + double dist = pnt.Distance(oldpnt);
313 hvalue[i] = hvalue[i-1] +
314 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
315 - pnt.Distance(oldpnt);
318 //(*testout) << "mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z())) " << mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))
319 // << " pnt.Distance(oldpnt) " << pnt.Distance(oldpnt) << endl;
323 - dist = pnt.Distance(oldpnt);
326 // nsubedges = int(ceil(hvalue[DIVIDEEDGESECTIONS]));
328 ps.SetSize(nsubedges-1);
329 params.SetSize(nsubedges+1);
338 static void FindEdges (OCCGeometry & geom, Mesh & mesh)
340 - char * savetask = multithread.task;
341 + const char * savetask = multithread.task;
342 multithread.task = "Edge meshing";
344 (*testout) << "edge meshing" << endl;
346 (*testout) << "nedges = " << nedges << endl;
348 double eps = 1e-6 * geom.GetBoundingBox().Diam();
349 + double eps2 = eps * eps;
351 for (int i = 1; i <= nvertices; i++)
356 for (PointIndex pi = 1; pi <= mesh.GetNP(); pi++)
357 - if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
358 + if ( Dist2 (mesh[pi], Point<3>(mp)) < eps2)
364 TopoDS_Face face = TopoDS::Face(exp1.Current());
365 int facenr = geom.fmap.FindIndex(face);
366 + if ( facenr < 1 ) continue;
368 if (face2solid[0][facenr-1] == 0)
369 face2solid[0][facenr-1] = solidnr;
374 + // EAP, IMP [SALOME platform 0013410].
375 + // take into account nb of already meshed edges
376 + edgenr = mesh.GetNSeg();
378 (*testout) << "faces = " << geom.fmap.Extent() << endl;
384 + // EAP, IMP [SALOME platform 0013410].
385 + // Do not divide already meshed edges
386 + if ( geom.emap.FindIndex(edge) < 1 )
389 if (geom.vmap.FindIndex(TopExp::FirstVertex (edge)) ==
390 geom.vmap.FindIndex(TopExp::LastVertex (edge)))
394 for (PointIndex pi = 1; pi < first_ep; pi++)
396 - if (Dist2 (mesh[pi], fp) < eps*eps) pnums[0] = pi;
397 - if (Dist2 (mesh[pi], lp) < eps*eps) pnums.Last() = pi;
398 + if (Dist2 (mesh[pi], fp) < eps2) pnums[0] = pi;
399 + if (Dist2 (mesh[pi], lp) < eps2) pnums.Last() = pi;
406 for (j = first_ep; j <= mesh.GetNP(); j++)
407 - if ((mesh.Point(j)-Point<3>(mp[i-1])).Length() < eps)
408 + if (Dist2(mesh.Point(j), Point<3>(mp[i-1])) < eps2)
416 - char * savetask = multithread.task;
417 + const char * savetask = multithread.task;
418 multithread.task = "Surface meshing";
420 geom.facemeshstatus = 0;
422 multithread.task = savetask;
425 - double ComputeH (double kappa)
426 + static double ComputeH (double kappa)
429 kappa *= mparam.curvaturesafety;
433 Point<3> p = p0 + 0.5*n;
434 - double lambda = (p-l.p0)*n / nq;
435 + double lambda = (fabs(nq) > 1e-10 ? (p-l.p0)*n / nq : -1);
437 if (lambda >= 0 && lambda <= 1)
439 @@ -799,55 +808,55 @@
443 - void RestrictHTriangle (gp_Pnt2d & par0, gp_Pnt2d & par1, gp_Pnt2d & par2,
444 - BRepLProp_SLProps * prop, Mesh & mesh, const double maxside, int depth, double h = 0)
445 + static void RestrictHTriangle (gp_Pnt2d & par0, gp_Pnt2d & par1, gp_Pnt2d & par2,
446 + BRepAdaptor_Surface& surf, Mesh & mesh, const double maxside, int depth, double h = 0)
449 + BRepLProp_SLProps prop(surf, 2, 1e-5);
453 parmid.SetX(0.3*(par0.X()+par1.X()+par2.X()));
454 parmid.SetY(0.3*(par0.Y()+par1.Y()+par2.Y()));
459 double curvature = 0;
461 - prop->SetParameters (parmid.X(), parmid.Y());
462 - if (!prop->IsCurvatureDefined())
463 + prop.SetParameters (parmid.X(), parmid.Y());
464 + if (!prop.IsCurvatureDefined())
466 (*testout) << "curvature not defined!" << endl;
469 - curvature = max(fabs(prop->MinCurvature()),
470 - fabs(prop->MaxCurvature()));
471 + curvature = max(fabs(prop.MinCurvature()),
472 + fabs(prop.MaxCurvature()));
474 - prop->SetParameters (par0.X(), par0.Y());
475 - if (!prop->IsCurvatureDefined())
476 + prop.SetParameters (par0.X(), par0.Y());
477 + if (!prop.IsCurvatureDefined())
479 (*testout) << "curvature not defined!" << endl;
482 - curvature = max(curvature,max(fabs(prop->MinCurvature()),
483 - fabs(prop->MaxCurvature())));
484 + curvature = max(curvature,max(fabs(prop.MinCurvature()),
485 + fabs(prop.MaxCurvature())));
487 - prop->SetParameters (par1.X(), par1.Y());
488 - if (!prop->IsCurvatureDefined())
489 + prop.SetParameters (par1.X(), par1.Y());
490 + if (!prop.IsCurvatureDefined())
492 (*testout) << "curvature not defined!" << endl;
495 - curvature = max(curvature,max(fabs(prop->MinCurvature()),
496 - fabs(prop->MaxCurvature())));
497 + curvature = max(curvature,max(fabs(prop.MinCurvature()),
498 + fabs(prop.MaxCurvature())));
500 - prop->SetParameters (par2.X(), par2.Y());
501 - if (!prop->IsCurvatureDefined())
502 + prop.SetParameters (par2.X(), par2.Y());
503 + if (!prop.IsCurvatureDefined())
505 (*testout) << "curvature not defined!" << endl;
508 - curvature = max(curvature,max(fabs(prop->MinCurvature()),
509 - fabs(prop->MaxCurvature())));
510 + curvature = max(curvature,max(fabs(prop.MinCurvature()),
511 + fabs(prop.MaxCurvature())));
513 //(*testout) << "curvature " << curvature << endl;
515 @@ -886,51 +895,47 @@
516 pm1.SetX(0.5*(par0.X()+par2.X())); pm1.SetY(0.5*(par0.Y()+par2.Y()));
517 pm2.SetX(0.5*(par1.X()+par0.X())); pm2.SetY(0.5*(par1.Y()+par0.Y()));
519 - RestrictHTriangle (pm0, pm1, pm2, prop, mesh, 0.5*maxside, depth+1, h);
520 - RestrictHTriangle (par0, pm1, pm2, prop, mesh, 0.5*maxside, depth+1, h);
521 - RestrictHTriangle (par1, pm0, pm2, prop, mesh, 0.5*maxside, depth+1, h);
522 - RestrictHTriangle (par2, pm1, pm0, prop, mesh, 0.5*maxside, depth+1, h);
523 + RestrictHTriangle (pm0, pm1, pm2, surf, mesh, 0.5*maxside, depth+1, h);
524 + RestrictHTriangle (par0, pm1, pm2, surf, mesh, 0.5*maxside, depth+1, h);
525 + RestrictHTriangle (par1, pm0, pm2, surf, mesh, 0.5*maxside, depth+1, h);
526 + RestrictHTriangle (par2, pm1, pm0, surf, mesh, 0.5*maxside, depth+1, h);
533 - prop->SetParameters (parmid.X(), parmid.Y());
534 - pnt = prop->Value();
535 + surf.D0(parmid.X(), parmid.Y(), pnt);
536 p3d = Point3d(pnt.X(), pnt.Y(), pnt.Z());
537 mesh.RestrictLocalH (p3d, h);
540 - prop->SetParameters (par0.X(), par0.Y());
541 - pnt = prop->Value();
542 + surf.D0(par0.X(), par0.Y(), pnt);
543 p3d = Point3d(pnt.X(), pnt.Y(), pnt.Z());
544 mesh.RestrictLocalH (p3d, h);
546 - prop->SetParameters (par1.X(), par1.Y());
547 - pnt = prop->Value();
548 + surf.D0(par1.X(), par1.Y(), pnt);
549 p3d = Point3d(pnt.X(), pnt.Y(), pnt.Z());
550 mesh.RestrictLocalH (p3d, h);
552 - prop->SetParameters (par2.X(), par2.Y());
553 - pnt = prop->Value();
554 + surf.D0(par2.X(), par2.Y(), pnt);
555 p3d = Point3d(pnt.X(), pnt.Y(), pnt.Z());
556 mesh.RestrictLocalH (p3d, h);
558 - (*testout) << "p = " << p3d << ", h = " << h << ", maxside = " << maxside << endl;
559 + //(*testout) << "p = " << p3d << ", h = " << h << ", maxside = " << maxside << endl;
561 (*testout) << pnt.X() << " " << pnt.Y() << " " << pnt.Z() << endl;
563 - prop->SetParameters (par0.X(), par0.Y());
564 - pnt = prop->Value();
565 + prop.SetParameters (par0.X(), par0.Y());
566 + pnt = prop.Value();
567 (*testout) << pnt.X() << " " << pnt.Y() << " " << pnt.Z() << endl;
569 - prop->SetParameters (par1.X(), par1.Y());
570 - pnt = prop->Value();
571 + prop.SetParameters (par1.X(), par1.Y());
572 + pnt = prop.Value();
573 (*testout) << pnt.X() << " " << pnt.Y() << " " << pnt.Z() << endl;
575 - prop->SetParameters (par2.X(), par2.Y());
576 - pnt = prop->Value();
577 + prop.SetParameters (par2.X(), par2.Y());
578 + pnt = prop.Value();
579 (*testout) << pnt.X() << " " << pnt.Y() << " " << pnt.Z() << endl;
583 if (mparam.uselocalh)
586 - char * savetask = multithread.task;
587 + const char * savetask = multithread.task;
588 multithread.percent = 0;
590 mesh->SetLocalH (bb.PMin(), bb.PMax(), mparam.grading);
591 @@ -1075,7 +1080,6 @@
592 if (triangulation.IsNull()) continue;
594 BRepAdaptor_Surface sf(face, Standard_True);
595 - BRepLProp_SLProps prop(sf, 2, 1e-5);
597 int ntriangles = triangulation -> NbTriangles();
598 for (int j = 1; j <= ntriangles; j++)
599 @@ -1096,7 +1100,7 @@
600 maxside = max (maxside, p[1].Distance(p[2]));
601 //cout << "\rFace " << i << " pos11 ntriangles " << ntriangles << " maxside " << maxside << flush;
603 - RestrictHTriangle (par[0], par[1], par[2], &prop, *mesh, maxside, 0);
604 + RestrictHTriangle (par[0], par[1], par[2], sf, *mesh, maxside, 0);
605 //cout << "\rFace " << i << " pos12 ntriangles " << ntriangles << flush;
608 diff -Naur netgen-4.5.old/libsrc/occ/occgeom.cpp netgen-4.5.new/libsrc/occ/occgeom.cpp
609 --- netgen-4.5.old/libsrc/occ/occgeom.cpp 2006-01-25 16:35:50.000000000 +0300
610 +++ netgen-4.5.new/libsrc/occ/occgeom.cpp 2008-02-12 14:57:01.000000000 +0300
612 #include "ShapeAnalysis_ShapeContents.hxx"
613 #include "ShapeAnalysis_CheckSmallFace.hxx"
614 #include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx"
615 +#include <ShapeAnalysis_Surface.hxx>
616 +#include <BRepTopAdaptor_FClass2d.hxx>
617 #include "BRepAlgoAPI_Fuse.hxx"
618 #include "BRepCheck_Analyzer.hxx"
619 #include "BRepLib.hxx"
621 #include "Partition_Spliter.hxx"
622 //#include "VrmlAPI.hxx"
623 //#include "StlAPI.hxx"
624 +#include <TopAbs_State.hxx>
630 + OCCGeometry::~OCCGeometry()
632 + NCollection_DataMap<int,BRepTopAdaptor_FClass2d*>::Iterator it(fclsmap);
633 + for (; it.More(); it.Next())
637 void OCCGeometry :: PrintNrShapes ()
640 @@ -947,13 +957,13 @@
642 void OCCGeometry :: BuildVisualizationMesh ()
645 - cout << "Preparing visualization (deflection = " << vispar.occdeflection << ") ... " << flush;
646 + double vispar_occdeflection = 0.01;
647 + cout << "Preparing visualization (deflection = " << vispar_occdeflection << ") ... " << flush;
650 BRepTools::Clean (shape);
651 //WriteOCC_STL("test.stl");
652 - BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh (shape, vispar.occdeflection, true);
653 + BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh (shape, vispar_occdeflection, true);
654 cout << "done" << endl;
661 + void OCCGeometry::GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
662 + BRepTopAdaptor_FClass2d*& cls) const
664 + //MSV: organize caching projector in the map
665 + if (fprjmap.IsBound(surfi))
667 + proj = fprjmap.Find(surfi);
668 + cls = fclsmap.Find(surfi);
672 + const TopoDS_Face& aFace = TopoDS::Face(fmap(surfi));
673 + Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
674 + proj = new ShapeAnalysis_Surface(aSurf);
675 + fprjmap.Bind(surfi, proj);
676 + cls = new BRepTopAdaptor_FClass2d(aFace,Precision::Confusion());
677 + fclsmap.Bind(surfi, cls);
681 - void OCCGeometry :: Project (int surfi, Point<3> & p) const
682 + bool OCCGeometry :: Project (int surfi, Point<3> & p, double& u, double& v) const
685 if (++cnt % 1000 == 0) cout << "Project cnt = " << cnt << endl;
686 @@ -983,18 +1012,22 @@
688 //(*testout) << "before " << pnt.X() << " "<< pnt.Y() << " "<< pnt.Z() << " " << endl;
690 - GeomAPI_ProjectPointOnSurf proj(pnt, BRep_Tool::Surface(TopoDS::Face(fmap(surfi))));
691 - if (proj.NbPoints() == 0)
693 - cout << "Projection fails" << endl;
697 - pnt = proj.NearestPoint();
698 - //(*testout) << "after " << pnt.X() << " "<< pnt.Y() << " "<< pnt.Z() << " " << endl;
699 + Handle(ShapeAnalysis_Surface) proj;
700 + BRepTopAdaptor_FClass2d *cls;
701 + GetFaceTools(surfi, proj, cls);
703 - p = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
705 + gp_Pnt2d p2d = proj->ValueOfUV(pnt, Precision::Confusion());
706 + if (cls->Perform(p2d) == TopAbs_OUT)
708 + //cout << "Projection fails" << endl;
711 + pnt = proj->Value(p2d);
713 + //(*testout) << "after " << pnt.X() << " "<< pnt.Y() << " "<< pnt.Z() << " " << endl;
715 + p = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
720 @@ -1002,54 +1035,20 @@
722 gp_Pnt p(ap(0), ap(1), ap(2));
724 - Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
725 + Handle(ShapeAnalysis_Surface) proj;
726 + BRepTopAdaptor_FClass2d *cls;
727 + GetFaceTools(surfi, proj, cls);
729 - gp_Pnt x = surface->Value (u,v);
731 - if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
735 - surface->D1(u,v,x,du,dv);
741 - double det, lambda, mu;
748 - det = Det3 (n.X(), du.X(), dv.X(),
749 - n.Y(), du.Y(), dv.Y(),
750 - n.Z(), du.Z(), dv.Z());
752 - if (det < 1e-15) return false;
754 - lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
755 - n.Y(), p.Y()-x.Y(), dv.Y(),
756 - n.Z(), p.Z()-x.Z(), dv.Z())/det;
758 - mu = Det3 (n.X(), du.X(), p.X()-x.X(),
759 - n.Y(), du.Y(), p.Y()-x.Y(),
760 - n.Z(), du.Z(), p.Z()-x.Z())/det;
766 - surface->D1(u,v,x,du,dv);
768 - } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
770 - // (*testout) << "FastProject count: " << count << endl;
772 - if (count == 50) return false;
773 + gp_Pnt2d p2d = proj->NextValueOfUV(gp_Pnt2d(u,v), p, Precision::Confusion());
774 + if (cls->Perform(p2d) == TopAbs_OUT)
776 + //cout << "Projection fails" << endl;
780 - ap = Point<3> (x.X(), x.Y(), x.Z());
781 + p = proj->Value(p2d);
783 + ap = Point<3> (p.X(), p.Y(), p.Z());
787 diff -Naur netgen-4.5.old/libsrc/occ/occgeom.hpp netgen-4.5.new/libsrc/occ/occgeom.hpp
788 --- netgen-4.5.old/libsrc/occ/occgeom.hpp 2006-01-25 16:35:50.000000000 +0300
789 +++ netgen-4.5.new/libsrc/occ/occgeom.hpp 2008-02-12 14:57:01.000000000 +0300
791 #include "Geom_Curve.hxx"
792 #include "Geom2d_Curve.hxx"
793 #include "Geom_Surface.hxx"
794 -#include "GeomAPI_ProjectPointOnSurf.hxx"
795 -#include "GeomAPI_ProjectPointOnCurve.hxx"
796 #include "BRepTools.hxx"
797 #include "TopExp.hxx"
798 #include "BRepBuilderAPI_MakeVertex.hxx"
800 #include "Geom_Curve.hxx"
801 #include "Geom2d_Curve.hxx"
802 #include "Geom_Surface.hxx"
803 -#include "GeomAPI_ProjectPointOnSurf.hxx"
804 -#include "GeomAPI_ProjectPointOnCurve.hxx"
805 #include "TopoDS_Wire.hxx"
806 #include "BRepTools_WireExplorer.hxx"
807 #include "BRepTools.hxx"
809 #include "IGESToBRep_Reader.hxx"
810 #include "Interface_Static.hxx"
811 #include "GeomAPI_ExtremaCurveCurve.hxx"
812 -#include "Standard_ErrorHandler.hxx"
813 +//#include "Standard_ErrorHandler.hxx"
814 #include "Standard_Failure.hxx"
815 #include "ShapeUpgrade_ShellSewing.hxx"
816 #include "ShapeFix_Shape.hxx"
818 #include "STEPControl_Writer.hxx"
819 #include "StlAPI_Writer.hxx"
820 #include "STEPControl_StepModelType.hxx"
821 +#include <NCollection_DataMap.hxx>
823 +class Handle_ShapeAnalysis_Surface;
824 +class BRepTopAdaptor_FClass2d;
829 -#include "../visualization/vispar.hpp"
830 + //#include "../visualization/vispar.hpp"
831 // class VisualizationParameters;
832 // extern VisualizationParameters vispar;
838 + mutable NCollection_DataMap<int,Handle_ShapeAnalysis_Surface> fprjmap;
839 + mutable NCollection_DataMap<int,BRepTopAdaptor_FClass2d*> fclsmap;
851 @@ -204,10 +207,12 @@
855 - void Project (int surfi, Point<3> & p) const;
856 + bool Project (int surfi, Point<3> & p, double& u, double& v) const;
857 bool FastProject (int surfi, Point<3> & ap, double& u, double& v) const;
860 + void GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
861 + BRepTopAdaptor_FClass2d*& cls) const;
863 OCCSurface GetSurface (int surfi)
865 cout << "OCCGeometry::GetSurface using PLANESPACE" << endl;
866 diff -Naur netgen-4.5.old/libsrc/occ/occmeshsurf.cpp netgen-4.5.new/libsrc/occ/occmeshsurf.cpp
867 --- netgen-4.5.old/libsrc/occ/occmeshsurf.cpp 2006-01-25 16:36:26.000000000 +0300
868 +++ netgen-4.5.new/libsrc/occ/occmeshsurf.cpp 2008-02-12 14:57:01.000000000 +0300
870 #include <occgeom.hpp>
871 #include <meshing.hpp>
872 #include <GeomLProp_SLProps.hxx>
873 +#include <GeomAPI_ProjectPointOnSurf.hxx>
874 +#include <GeomAPI_ProjectPointOnCurve.hxx>
878 @@ -411,11 +413,16 @@
882 - void MeshOptimize2dOCCSurfaces :: ProjectPoint (INDEX surfind, Point3d & p) const
883 + bool MeshOptimize2dOCCSurfaces :: ProjectPoint (INDEX surfind, Point3d & p, PointGeomInfo& gi) const
886 - geometry.Project (surfind, hp);
888 + if (gi.trignum > 0)
889 + ok = geometry.FastProject (surfind, hp, gi.u, gi.v);
891 + ok = geometry.Project (surfind, hp, gi.u, gi.v);
896 void MeshOptimize2dOCCSurfaces :: ProjectPoint2 (INDEX surfind, INDEX surfind2,
901 - int MeshOptimize2dOCCSurfaces ::
902 - CalcPointGeomInfo(int surfind, PointGeomInfo& gi, const Point3d& p) const
906 - gp_Pnt pnt(p.X(), p.Y(), p.Z());
908 - Handle(Geom_Surface) occface;
909 - occface = BRep_Tool::Surface(TopoDS::Face(geometry.fmap(surfind)));
911 - GeomAPI_ProjectPointOnSurf proj(pnt, occface);
913 - if (proj.NbPoints() < 1)
915 - cout << "ERROR: OCCSurface :: GetNormalVector: GeomAPI_ProjectPointOnSurf failed!"
921 - proj.LowerDistanceParameters (u, v);
933 OCCRefinementSurfaces :: OCCRefinementSurfaces (const OCCGeometry & ageometry)
934 : Refinement(), geometry(ageometry)
936 @@ -627,10 +602,11 @@
937 if (!geometry.FastProject (surfi, hnewp, u, v))
939 cout << "Fast projection to surface fails! Using OCC projection" << endl;
940 - geometry.Project (surfi, hnewp);
942 + geometry.Project (surfi, hnewp, u, v);
946 + newgi.trignum = surfi;
950 @@ -653,14 +629,17 @@
951 hnewp = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
958 void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi)
961 - geometry.Project (surfi, p);
965 + geometry.Project (surfi, p, u, v);
969 void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi, PointGeomInfo & gi)
972 if (!geometry.FastProject (surfi, p, gi.u, gi.v))
974 cout << "Fast projection to surface fails! Using OCC projection" << endl;
975 - geometry.Project (surfi, p);
977 + geometry.Project (surfi, p, u, v);
984 diff -Naur netgen-4.5.old/libsrc/occ/occmeshsurf.hpp netgen-4.5.new/libsrc/occ/occmeshsurf.hpp
985 --- netgen-4.5.old/libsrc/occ/occmeshsurf.hpp 2005-06-09 18:51:10.000000000 +0400
986 +++ netgen-4.5.new/libsrc/occ/occmeshsurf.hpp 2008-02-12 14:57:01.000000000 +0300
988 MeshOptimize2dOCCSurfaces (const OCCGeometry & ageometry);
991 - virtual void ProjectPoint (INDEX surfind, Point3d & p) const;
992 + virtual bool ProjectPoint (INDEX surfind, Point3d & p, PointGeomInfo& gi) const;
994 virtual void ProjectPoint2 (INDEX surfind, INDEX surfind2, Point3d & p) const;
998 virtual void GetNormalVector(INDEX surfind, const Point3d & p, PointGeomInfo & gi, Vec3d & n) const;
1001 - virtual int CalcPointGeomInfo(int surfind, PointGeomInfo& gi, const Point3d& p3) const;
1006 diff -Naur netgen-4.5.old/libsrc/stlgeom/meshstlsurface.cpp netgen-4.5.new/libsrc/stlgeom/meshstlsurface.cpp
1007 --- netgen-4.5.old/libsrc/stlgeom/meshstlsurface.cpp 2006-01-11 19:08:20.000000000 +0300
1008 +++ netgen-4.5.new/libsrc/stlgeom/meshstlsurface.cpp 2008-02-12 14:57:01.000000000 +0300
1009 @@ -946,20 +946,23 @@
1013 -void MeshOptimizeSTLSurface :: ProjectPoint (INDEX surfind, Point3d & p) const
1014 +bool MeshOptimizeSTLSurface :: ProjectPoint (INDEX surfind, Point3d & p, PointGeomInfo& gi) const
1017 - if (!geom.Project (hp))
1018 + if (gi.trignum > 0)
1019 + ((STLGeometry&)geom).SelectChartOfTriangle (gi.trignum);
1020 + if (!(gi.trignum = geom.Project (hp)))
1022 PrintMessage(7,"project failed");
1024 - if (!geom.ProjectOnWholeSurface(hp))
1025 + if (!(gi.trignum = geom.ProjectOnWholeSurface(hp)))
1027 PrintMessage(7, "project on whole surface failed");
1031 // geometry.GetSurface(surfind)->Project (p);
1032 + return gi.trignum > 0;
1035 void MeshOptimizeSTLSurface :: ProjectPoint2 (INDEX surfind, INDEX surfind2, Point3d & p) const
1036 @@ -970,20 +973,6 @@
1040 -int MeshOptimizeSTLSurface :: CalcPointGeomInfo(PointGeomInfo& gi, const Point3d& p3) const
1043 - gi.trignum = geom.Project (hp);
1054 void MeshOptimizeSTLSurface :: GetNormalVector(INDEX surfind, const Point3d & p, Vec3d & n) const
1056 n = geom.GetChartNormalVector();
1057 diff -Naur netgen-4.5.old/libsrc/stlgeom/meshstlsurface.hpp netgen-4.5.new/libsrc/stlgeom/meshstlsurface.hpp
1058 --- netgen-4.5.old/libsrc/stlgeom/meshstlsurface.hpp 2004-09-30 17:13:56.000000000 +0400
1059 +++ netgen-4.5.new/libsrc/stlgeom/meshstlsurface.hpp 2008-02-12 14:57:01.000000000 +0300
1061 virtual void SelectSurfaceOfPoint (const Point3d & p,
1062 const PointGeomInfo & gi);
1064 - virtual void ProjectPoint (INDEX surfind, Point3d & p) const;
1065 + virtual bool ProjectPoint (INDEX surfind, Point3d & p, PointGeomInfo& gi) const;
1067 virtual void ProjectPoint2 (INDEX surfind, INDEX surfind2, Point3d & p) const;
1069 - virtual int CalcPointGeomInfo(PointGeomInfo& gi, const Point3d& p3) const;
1071 virtual void GetNormalVector(INDEX surfind, const Point3d & p, Vec3d & n) const;
1074 diff -Naur netgen-4.5.old/makeForSalome.sh netgen-4.5.new/makeForSalome.sh
1075 --- netgen-4.5.old/makeForSalome.sh 1970-01-01 03:00:00.000000000 +0300
1076 +++ netgen-4.5.new/makeForSalome.sh 2008-02-12 14:57:01.000000000 +0300
1079 +cp ngtcltk/ngnewdelete.* libsrc/interface/
1081 +if test `uname -m` == "x86_64" ; then
1088 +make -C libsrc/general
1089 +make -C libsrc/geom2d
1090 +make -C libsrc/gprim
1091 +make -C libsrc/interface
1092 +make -C libsrc/linalg
1093 +make -C libsrc/meshing
1094 +make -C libsrc/opti
1095 +make -C libsrc/stlgeom
1098 +if [ ! -d install ] ; then
1104 +if [ ! -d install/include ] ; then
1105 + mkdir install/include
1108 +cp libsrc/interface/nglib.h libsrc/general/*.hpp libsrc/csg/*.hpp libsrc/geom2d/*.hpp \
1109 + libsrc/gprim/*.hpp libsrc/linalg/*.hpp libsrc/meshing/*.hpp \
1110 + libsrc/occ/*.hpp libsrc/opti/*.hpp libsrc/include/mydefs.hpp \
1111 + libsrc/stlgeom/*.hpp libsrc/include/mystdlib.h \
1113 diff -Naur netgen-4.5.old/libsrc/occ/Partition_Inter2d.cxx netgen-4.5.new/libsrc/occ/Partition_Inter2d.cxx
1114 --- netgen-4.5.old/libsrc/occ/Partition_Inter2d.cxx 2005-06-09 18:51:10.000000000 +0400
1115 +++ netgen-4.5.new/libsrc/occ/Partition_Inter2d.cxx 2008-02-26 12:34:14.000000000 +0300
1119 //using namespace std;
1120 -#include "Partition_Inter2d.ixx"
1122 #include "utilities.h"
1124 +#include "Partition_Inter2d.ixx"
1126 #include <BRepAdaptor_Curve.hxx>
1127 #include <BRepAlgo_AsDes.hxx>
1128 #include <BRepLib_MakeVertex.hxx>
1129 diff -Naur netgen-4.5.old/libsrc/occ/Partition_Inter3d.cxx netgen-4.5.new/libsrc/occ/Partition_Inter3d.cxx
1130 --- netgen-4.5.old/libsrc/occ/Partition_Inter3d.cxx 2005-06-09 18:51:10.000000000 +0400
1131 +++ netgen-4.5.new/libsrc/occ/Partition_Inter3d.cxx 2008-02-26 12:36:27.000000000 +0300
1135 //using namespace std;
1137 +#include "utilities.h"
1139 #include "Partition_Inter2d.hxx"
1140 #include "Partition_Inter3d.ixx"
1141 -#include "utilities.h"
1143 #include <BRepAlgo_AsDes.hxx>
1144 #include <BRepAlgo_Image.hxx>
1145 #include <BRepLib.hxx>
1146 +//using namespace std;
1148 #include <BRepOffset_Tool.hxx>
1149 #include <BRep_Builder.hxx>
1150 #include <BRep_Tool.hxx>
1151 diff -Naur netgen-4.5.old/libsrc/occ/Partition_Loop2d.cxx netgen-4.5.new/libsrc/occ/Partition_Loop2d.cxx
1152 --- netgen-4.5.old/libsrc/occ/Partition_Loop2d.cxx 2005-06-09 18:51:10.000000000 +0400
1153 +++ netgen-4.5.new/libsrc/occ/Partition_Loop2d.cxx 2008-02-26 12:37:10.000000000 +0300
1157 //using namespace std;
1158 -#include "Partition_Loop2d.ixx"
1161 #include "utilities.h"
1163 +#include "Partition_Loop2d.ixx"
1166 #include <BRepAdaptor_Curve2d.hxx>
1167 diff -Naur netgen-4.5.old/libsrc/occ/Partition_Loop3d.cxx netgen-4.5.new/libsrc/occ/Partition_Loop3d.cxx
1168 --- netgen-4.5.old/libsrc/occ/Partition_Loop3d.cxx 2005-06-09 18:51:10.000000000 +0400
1169 +++ netgen-4.5.new/libsrc/occ/Partition_Loop3d.cxx 2008-02-26 12:39:32.000000000 +0300
1173 //using namespace std;
1177 +#include "utilities.h"
1179 #include "Partition_Loop3d.ixx"
1181 #include <TopExp_Explorer.hxx>
1182 diff -Naur netgen-4.5.old/libsrc/occ/Partition_Loop.cxx netgen-4.5.new/libsrc/occ/Partition_Loop.cxx
1183 --- netgen-4.5.old/libsrc/occ/Partition_Loop.cxx 2005-06-09 18:51:10.000000000 +0400
1184 +++ netgen-4.5.new/libsrc/occ/Partition_Loop.cxx 2008-02-26 12:40:41.000000000 +0300
1188 //using namespace std;
1191 -#include "Partition_Loop.ixx"
1193 #include "utilities.h"
1197 +#include "Partition_Loop.ixx"
1199 #include <BRep_Builder.hxx>
1200 #include <BRepAlgo_FaceRestrictor.hxx>
1201 #include <BRep_Tool.hxx>
1202 diff -Naur netgen-4.5.old/libsrc/occ/Partition_Spliter.cxx netgen-4.5.new/libsrc/occ/Partition_Spliter.cxx
1203 --- netgen-4.5.old/libsrc/occ/Partition_Spliter.cxx 2005-07-11 10:33:27.000000000 +0400
1204 +++ netgen-4.5.new/libsrc/occ/Partition_Spliter.cxx 2008-02-26 12:41:32.000000000 +0300
1208 //using namespace std;
1210 +#include "utilities.h"
1212 #include "Partition_Inter2d.hxx"
1213 #include "Partition_Inter3d.hxx"
1214 #include "Partition_Loop2d.hxx"
1215 #include "Partition_Loop3d.hxx"
1216 #include "Partition_Spliter.ixx"
1218 -#include "utilities.h"
1220 #include <Precision.hxx>
1221 #include <TopAbs_Orientation.hxx>
1222 #include <TopExp.hxx>
1223 diff -Naur netgen-4.5.old/libsrc/occ/utilities.h netgen-4.5.new/libsrc/occ/utilities.h
1224 --- netgen-4.5.old/libsrc/occ/utilities.h 2005-02-11 14:35:43.000000000 +0300
1225 +++ netgen-4.5.new/libsrc/occ/utilities.h 2008-02-26 12:28:02.000000000 +0300
1232 // #include "SALOME_Log.hxx"
1234 diff -Naur netgen-4.5.old/libsrc/general/profiler.cpp netgen-4.5.new/libsrc/general/profiler.cpp
1235 --- netgen-4.5.old/libsrc/general/profiler.cpp 2006-01-11 13:05:59.000000000 +0300
1236 +++ netgen-4.5.new/libsrc/general/profiler.cpp 2009-05-28 18:47:00.000000000 +0400
1238 StopTimer (total_timer);
1240 ofstream prof ("netgen.prof");
1243 + ostream& pprof = getenv("NETGEN_PROF") ? prof : std::cout;
1249 diff -Naur netgen-4.5.old/libsrc/meshing/meshtype.hpp netgen-4.5.new/libsrc/meshing/meshtype.hpp
1250 --- netgen-4.5.old/libsrc/meshing/meshtype.hpp 2009-05-28 19:22:04.000000000 +0400
1251 +++ netgen-4.5.new/libsrc/meshing/meshtype.hpp 2009-05-28 18:37:18.000000000 +0400
1259 SEGMENT = 1, SEGMENT3 = 2,
1260 TRIG = 10, QUAD=11, TRIG6 = 12, QUAD6 = 13, QUAD8 = 14,