From d7d66641f1e65dcb98b810ce941ec0d7737d3922 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 25 Nov 2010 12:50:21 +0000 Subject: [PATCH] Merge from V5_1_main branch 24/11/2010 --- adm_local/unix/config_files/check_NETGEN.m4 | 4 +- configure.ac | 15 +- src/GUI/Makefile.am | 5 +- src/GUI/NETGENPluginGUI_HypothesisCreator.cxx | 3 +- src/GUI/NETGENPluginGUI_SimpleCreator.cxx | 1 - src/GUI/NETGENPlugin_msg_en.ts | 312 ++++++------ src/GUI/NETGENPlugin_msg_fr.ts | 147 ++++++ src/NETGEN/netgen45ForSalome.patch | 450 +++++++++++++----- src/NETGENPlugin/NETGENPlugin_Mesher.cxx | 348 +++++++++----- .../NETGENPlugin_NETGEN_2D_ONLY.cxx | 11 +- src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx | 55 ++- 11 files changed, 907 insertions(+), 444 deletions(-) create mode 100755 src/GUI/NETGENPlugin_msg_fr.ts diff --git a/adm_local/unix/config_files/check_NETGEN.m4 b/adm_local/unix/config_files/check_NETGEN.m4 index df9f542..0141553 100644 --- a/adm_local/unix/config_files/check_NETGEN.m4 +++ b/adm_local/unix/config_files/check_NETGEN.m4 @@ -94,8 +94,8 @@ if test "x$NETGEN_HOME" != "x"; then CPPFLAGS_old="$CPPFLAGS" CXXFLAGS_old="$CXXFLAGS" - CPPFLAGS="$NETGEN_INCLUDES $CAS_CPPFLAGS $CPPFLAGS" - CXXFLAGS="$NETGEN_INCLUDES $CAS_CPPFLAGS $CXXFLAGS" + CPPFLAGS="$CAS_CPPFLAGS $NETGEN_INCLUDES $CPPFLAGS" + CXXFLAGS="$CAS_CPPFLAGS $NETGEN_INCLUDES $CXXFLAGS" AC_MSG_CHECKING(for Netgen header file) diff --git a/configure.ac b/configure.ac index 993552d..99e2137 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,7 @@ # Reorganization for usage of autotools # Created from configure.in.base # -AC_INIT([Salome2 Project NETGENPLUGIN module], [6.1.0], [webmaster.salome@opencascade.com], [SalomeNETGENPLUGIN]) +AC_INIT([Salome2 Project NETGENPLUGIN module], [6.2.0], [webmaster.salome@opencascade.com], [SalomeNETGENPLUGIN]) AC_CONFIG_AUX_DIR(adm_local/unix/config_files) AC_CANONICAL_HOST AC_CANONICAL_TARGET @@ -413,6 +413,19 @@ echo # chmod +x ./bin/salome/*; #]) +AC_CONFIG_COMMANDS([hack_libtool],[ +sed -i "s%^CC=\"\(.*\)\"%hack_libtool (){ \n\ + if test \"\$(echo \$[@] | grep -E '\\\-L/usr/lib(/../lib)?(64)? ')\" == \"\" \n\ + then\n\ + cmd=\"\1 \$[@]\"\n\ + else\n\ + cmd=\"\1 \"\`echo \$[@] | sed -r -e 's|(.*)-L/usr/lib(/../lib)?(64)? (.*)|\\\1\\\4 -L/usr/lib\\\3|g'\`\n\ + fi\n\ + \$cmd\n\ +}\n\ +CC=\"hack_libtool\"%g" libtool +],[]) + # This list is initiated using autoscan and must be updated manually # when adding a new file .in to manage. When you execute # autoscan, the Makefile list is generated in the output file configure.scan. diff --git a/src/GUI/Makefile.am b/src/GUI/Makefile.am index b2cbac7..302eae3 100644 --- a/src/GUI/Makefile.am +++ b/src/GUI/Makefile.am @@ -49,9 +49,9 @@ nodist_libNETGENPluginGUI_la_SOURCES= \ # additionnal information to compil and link file libNETGENPluginGUI_la_CPPFLAGS = \ + $(CAS_CPPFLAGS) \ $(NETGEN_INCLUDES) \ $(QT_INCLUDES) \ - $(CAS_CPPFLAGS) \ $(PYTHON_INCLUDES) \ $(KERNEL_CXXFLAGS) \ $(GUI_CXXFLAGS) \ @@ -74,5 +74,6 @@ libNETGENPluginGUI_la_LDFLAGS = \ # resources files nodist_salomeres_DATA= \ NETGENPlugin_images.qm \ - NETGENPlugin_msg_en.qm + NETGENPlugin_msg_en.qm \ + NETGENPlugin_msg_fr.qm diff --git a/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx b/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx index 930a5d3..56be4ba 100644 --- a/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/NETGENPluginGUI_HypothesisCreator.cxx @@ -30,7 +30,6 @@ #include #include -#include #include #include @@ -165,7 +164,7 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame() aGroupLayout->addWidget( new QLabel( tr( "NETGEN_GROWTH_RATE" ), GroupC1 ), row, 0 ); myGrowthRate = new SMESHGUI_SpinBox( GroupC1 ); - myGrowthRate->RangeStepAndValidator( .1, 10., .1, "parametric_precision" ); + myGrowthRate->RangeStepAndValidator( .0001, 10., .1, "parametric_precision" ); aGroupLayout->addWidget( myGrowthRate, row, 1 ); row++; diff --git a/src/GUI/NETGENPluginGUI_SimpleCreator.cxx b/src/GUI/NETGENPluginGUI_SimpleCreator.cxx index 6bdf065..981a7cd 100644 --- a/src/GUI/NETGENPluginGUI_SimpleCreator.cxx +++ b/src/GUI/NETGENPluginGUI_SimpleCreator.cxx @@ -26,7 +26,6 @@ #include #include #include -#include // IDL includes #include CORBA_SERVER_HEADER(NETGENPlugin_Algorithm) diff --git a/src/GUI/NETGENPlugin_msg_en.ts b/src/GUI/NETGENPlugin_msg_en.ts index f8c30ac..dd9dd70 100644 --- a/src/GUI/NETGENPlugin_msg_en.ts +++ b/src/GUI/NETGENPlugin_msg_en.ts @@ -1,169 +1,147 @@ + - - - - @default - - NETGEN_2D_HYPOTHESIS - Netgen 2D - - - NETGEN_2D_TITLE - Hypothesis Construction - - - NETGEN_3D_HYPOTHESIS - Netgen 3D - - - NETGEN_3D_TITLE - Hypothesis Construction - - - NETGEN_SimpleParameters_3D_HYPOTHESIS - Netgen 3D simple parameters - - - NETGEN_SimpleParameters_3D_TITLE - Hypothesis Construction - - - NETGEN_SimpleParameters_2D_HYPOTHESIS - Netgen 2D simple parameters - - - NETGEN_SimpleParameters_2D_TITLE - Hypothesis Construction - - - NETGEN_ALLOW_QUADRANGLES - Allow Quadrangles - - - NETGEN_COARSE - Coarse - - - NETGEN_CUSTOM - Custom - - - NETGEN_FINE - Fine - - - NETGEN_FINENESS - Fineness - - - NETGEN_GROWTH_RATE - Growth Rate - - - NETGEN_MAX_SIZE - Max. Size - - - NETGEN_MODERATE - Moderate - - - NETGEN_OPTIMIZE - Optimize - - - NETGEN_SECOND_ORDER - Second Order - - - NETGEN_SEG_PER_EDGE - Nb. Segs per Edge - - - NETGEN_SEG_PER_RADIUS - Nb. Segs per Radius - - - NETGEN_VERYCOARSE - Very Coarse - - - NETGEN_VERYFINE - Very Fine - - - NG_1D - 1D - - - NG_2D - 2D - - - NG_3D - 3D - - - NG_LENGTH_FROM_EDGES - Length from edges - - - NG_LENGTH_FROM_FACES - Length from faces - - - NETGEN_LOCAL_SIZE - Local sizes - - - NETGEN_LSZ_VERTEX - On Vertex - - - NETGEN_LSZ_EDGE - On Edge - - - NETGEN_LSZ_FACE - On Sub-Face - - - NETGEN_LSZ_REMOVE - Remove - - - LSZ_ENTRY_COLUMN - Entry - - - LSZ_NAME_COLUMN - Name - - - LSZ_LOCALSIZE_COLUMN - Value - - + + + @default + + NETGEN_2D_HYPOTHESIS + Netgen 2D + + + NETGEN_2D_TITLE + Hypothesis Construction + + + NETGEN_3D_HYPOTHESIS + Netgen 3D + + + NETGEN_3D_TITLE + Hypothesis Construction + + + NETGEN_SimpleParameters_3D_HYPOTHESIS + Netgen 3D simple parameters + + + NETGEN_SimpleParameters_3D_TITLE + Hypothesis Construction + + + NETGEN_SimpleParameters_2D_HYPOTHESIS + Netgen 2D simple parameters + + + NETGEN_SimpleParameters_2D_TITLE + Hypothesis Construction + + + NETGEN_ALLOW_QUADRANGLES + Allow Quadrangles + + + NETGEN_COARSE + Coarse + + + NETGEN_CUSTOM + Custom + + + NETGEN_FINE + Fine + + + NETGEN_FINENESS + Fineness + + + NETGEN_GROWTH_RATE + Growth Rate + + + NETGEN_MAX_SIZE + Max. Size + + + NETGEN_MODERATE + Moderate + + + NETGEN_OPTIMIZE + Optimize + + + NETGEN_SECOND_ORDER + Second Order + + + NETGEN_SEG_PER_EDGE + Nb. Segs per Edge + + + NETGEN_SEG_PER_RADIUS + Nb. Segs per Radius + + + NETGEN_VERYCOARSE + Very Coarse + + + NETGEN_VERYFINE + Very Fine + + + NG_1D + 1D + + + NG_2D + 2D + + + NG_3D + 3D + + + NG_LENGTH_FROM_EDGES + Length from edges + + + NG_LENGTH_FROM_FACES + Length from faces + + + NETGEN_LOCAL_SIZE + Local sizes + + + NETGEN_LSZ_VERTEX + On Vertex + + + NETGEN_LSZ_EDGE + On Edge + + + NETGEN_LSZ_FACE + On Sub-Face + + + NETGEN_LSZ_REMOVE + Remove + + + LSZ_ENTRY_COLUMN + Entry + + + LSZ_NAME_COLUMN + Name + + + LSZ_LOCALSIZE_COLUMN + Value + + diff --git a/src/GUI/NETGENPlugin_msg_fr.ts b/src/GUI/NETGENPlugin_msg_fr.ts new file mode 100755 index 0000000..82030ae --- /dev/null +++ b/src/GUI/NETGENPlugin_msg_fr.ts @@ -0,0 +1,147 @@ + + + + + @default + + NETGEN_2D_HYPOTHESIS + Netgen 2D + + + NETGEN_2D_TITLE + Construction d'une hypothèse + + + NETGEN_3D_HYPOTHESIS + Netgen 3D + + + NETGEN_3D_TITLE + Construction d'une hypothèse + + + NETGEN_SimpleParameters_3D_HYPOTHESIS + Netgen 3D paramètres simplifiés + + + NETGEN_SimpleParameters_3D_TITLE + Construction d'une hypothèse + + + NETGEN_SimpleParameters_2D_HYPOTHESIS + Netgen 2D paramètres simplifiés + + + NETGEN_SimpleParameters_2D_TITLE + Construction d'une hypothèse + + + NETGEN_ALLOW_QUADRANGLES + Autoriser les quadrangles + + + NETGEN_COARSE + Grossier + + + NETGEN_CUSTOM + Personnalisé + + + NETGEN_FINE + Fin + + + NETGEN_FINENESS + Finesse + + + NETGEN_GROWTH_RATE + Taux d'accroissement + + + NETGEN_MAX_SIZE + Taille maximale + + + NETGEN_MODERATE + Moyen + + + NETGEN_OPTIMIZE + Optimiser + + + NETGEN_SECOND_ORDER + Second ordre + + + NETGEN_SEG_PER_EDGE + Nb. segments par arête + + + NETGEN_SEG_PER_RADIUS + Nb. segments par rayon + + + NETGEN_VERYCOARSE + Très grossier + + + NETGEN_VERYFINE + Très fin + + + NG_1D + 1D + + + NG_2D + 2D + + + NG_3D + 3D + + + NG_LENGTH_FROM_EDGES + Longueur à partir des arêtes + + + NG_LENGTH_FROM_FACES + Longueur à partir des faces + + + NETGEN_LOCAL_SIZE + Tailles locales + + + NETGEN_LSZ_VERTEX + Sur un point + + + NETGEN_LSZ_EDGE + Sur une arête + + + NETGEN_LSZ_FACE + Sur une sous-face + + + NETGEN_LSZ_REMOVE + Supprimer + + + LSZ_ENTRY_COLUMN + Entrée + + + LSZ_NAME_COLUMN + Nom + + + LSZ_LOCALSIZE_COLUMN + Valeur + + + diff --git a/src/NETGEN/netgen45ForSalome.patch b/src/NETGEN/netgen45ForSalome.patch index 1d2b2cf..a790b0c 100644 --- a/src/NETGEN/netgen45ForSalome.patch +++ b/src/NETGEN/netgen45ForSalome.patch @@ -1,6 +1,66 @@ -diff -Naur netgen-4.5.old/libsrc/csg/meshsurf.cpp netgen-4.5.new/libsrc/csg/meshsurf.cpp ---- netgen-4.5.old/libsrc/csg/meshsurf.cpp 2006-02-14 08:54:35.000000000 +0000 -+++ netgen-4.5.new/libsrc/csg/meshsurf.cpp 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/csg/algprim.cpp netgen-4.5_new/libsrc/csg/algprim.cpp +--- netgen-4.5_orig/libsrc/csg/algprim.cpp 2006-01-25 16:30:28.000000000 +0300 ++++ netgen-4.5_new/libsrc/csg/algprim.cpp 2010-06-23 12:35:22.000000000 +0400 +@@ -108,7 +108,7 @@ + void Plane :: GetPrimitiveData (char *& classname, + ARRAY & coeffs) const + { +- classname = "plane"; ++ classname = (char*)"plane"; + coeffs.SetSize (6); + coeffs.Elem(1) = p(0); + coeffs.Elem(2) = p(1); +@@ -355,7 +355,7 @@ + + void Sphere :: GetPrimitiveData (char *& classname, ARRAY & coeffs) const + { +- classname = "sphere"; ++ classname = (char*)"sphere"; + coeffs.SetSize (4); + coeffs.Elem(1) = c(0); + coeffs.Elem(2) = c(1); +@@ -760,7 +760,7 @@ + + void Cylinder :: GetPrimitiveData (char *& classname, ARRAY & coeffs) const + { +- classname = "cylinder"; ++ classname = (char*)"cylinder"; + coeffs.SetSize (7); + coeffs.Elem(1) = a(0); + coeffs.Elem(2) = a(1); +@@ -1243,7 +1243,7 @@ + + void Cone :: GetPrimitiveData (char *& classname, ARRAY & coeffs) const + { +- classname = "cone"; ++ classname = (char*)"cone"; + coeffs.SetSize (8); + coeffs.Elem(1) = a(0); + coeffs.Elem(2) = a(1); +@@ -1446,7 +1446,7 @@ + + void Torus :: GetPrimitiveData (char *& classname, ARRAY & coeffs) const + { +- classname = "torus"; ++ classname = (char*)"torus"; + coeffs.SetSize (8); + coeffs.Elem(1) = c(0); + coeffs.Elem(2) = c(1); +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/csg/brick.cpp netgen-4.5_new/libsrc/csg/brick.cpp +--- netgen-4.5_orig/libsrc/csg/brick.cpp 2006-02-08 15:23:15.000000000 +0300 ++++ netgen-4.5_new/libsrc/csg/brick.cpp 2010-06-23 12:35:35.000000000 +0400 +@@ -345,7 +345,7 @@ + void Brick :: + GetPrimitiveData (char *& classname, ARRAY & coeffs) const + { +- classname = "brick"; ++ classname = (char*)"brick"; + coeffs.SetSize(12); + coeffs.Elem(1) = p1(0); + coeffs.Elem(2) = p1(1); +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/csg/meshsurf.cpp netgen-4.5_new/libsrc/csg/meshsurf.cpp +--- netgen-4.5_orig/libsrc/csg/meshsurf.cpp 2006-02-14 11:54:35.000000000 +0300 ++++ netgen-4.5_new/libsrc/csg/meshsurf.cpp 2010-06-23 13:19:48.000000000 +0400 @@ -77,11 +77,12 @@ } @@ -15,9 +75,9 @@ diff -Naur netgen-4.5.old/libsrc/csg/meshsurf.cpp netgen-4.5.new/libsrc/csg/mesh } void MeshOptimize2dSurfaces :: ProjectPoint2 (INDEX surfind, INDEX surfind2, -diff -Naur netgen-4.5.old/libsrc/csg/meshsurf.hpp netgen-4.5.new/libsrc/csg/meshsurf.hpp ---- netgen-4.5.old/libsrc/csg/meshsurf.hpp 2004-01-20 11:49:44.000000000 +0000 -+++ netgen-4.5.new/libsrc/csg/meshsurf.hpp 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/csg/meshsurf.hpp netgen-4.5_new/libsrc/csg/meshsurf.hpp +--- netgen-4.5_orig/libsrc/csg/meshsurf.hpp 2004-01-20 14:49:44.000000000 +0300 ++++ netgen-4.5_new/libsrc/csg/meshsurf.hpp 2010-06-23 13:19:48.000000000 +0400 @@ -45,7 +45,7 @@ MeshOptimize2dSurfaces (const CSGeometry & ageometry); @@ -27,9 +87,33 @@ diff -Naur netgen-4.5.old/libsrc/csg/meshsurf.hpp netgen-4.5.new/libsrc/csg/mesh /// virtual void ProjectPoint2 (INDEX surfind, INDEX surfind2, Point3d & p) const; /// -diff -Naur netgen-4.5.old/libsrc/general/profiler.cpp netgen-4.5.new/libsrc/general/profiler.cpp ---- netgen-4.5.old/libsrc/general/profiler.cpp 2006-01-11 10:05:59.000000000 +0000 -+++ netgen-4.5.new/libsrc/general/profiler.cpp 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/csg/polyhedra.cpp netgen-4.5_new/libsrc/csg/polyhedra.cpp +--- netgen-4.5_orig/libsrc/csg/polyhedra.cpp 2006-02-09 13:33:11.000000000 +0300 ++++ netgen-4.5_new/libsrc/csg/polyhedra.cpp 2010-06-23 12:36:00.000000000 +0400 +@@ -287,7 +287,7 @@ + void Polyhedra :: GetPrimitiveData (char *& classname, + ARRAY & coeffs) const + { +- classname = "Polyhedra"; ++ classname = (char*)"Polyhedra"; + coeffs.SetSize(0); + coeffs.Append (points.Size()); + coeffs.Append (faces.Size()); +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/csg/surface.cpp netgen-4.5_new/libsrc/csg/surface.cpp +--- netgen-4.5_orig/libsrc/csg/surface.cpp 2006-02-08 15:23:16.000000000 +0300 ++++ netgen-4.5_new/libsrc/csg/surface.cpp 2010-06-23 12:35:47.000000000 +0400 +@@ -215,7 +215,7 @@ + void Primitive :: GetPrimitiveData (char *& classname, + ARRAY & coeffs) const + { +- classname = "undef"; ++ classname = (char*)"undef"; + coeffs.SetSize (0); + } + +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/general/profiler.cpp netgen-4.5_new/libsrc/general/profiler.cpp +--- netgen-4.5_orig/libsrc/general/profiler.cpp 2006-01-11 13:05:59.000000000 +0300 ++++ netgen-4.5_new/libsrc/general/profiler.cpp 2010-06-23 13:19:48.000000000 +0400 @@ -34,8 +34,14 @@ { StopTimer (total_timer); @@ -47,20 +131,49 @@ diff -Naur netgen-4.5.old/libsrc/general/profiler.cpp netgen-4.5.new/libsrc/gene } -diff -Naur netgen-4.5.old/libsrc/include/mystdlib.h netgen-4.5.new/libsrc/include/mystdlib.h ---- netgen-4.5.old/libsrc/include/mystdlib.h 2006-01-16 14:16:56.000000000 +0000 -+++ netgen-4.5.new/libsrc/include/mystdlib.h 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/geom2d/genmesh2d.cpp netgen-4.5_new/libsrc/geom2d/genmesh2d.cpp +--- netgen-4.5_orig/libsrc/geom2d/genmesh2d.cpp 2006-02-16 19:17:47.000000000 +0300 ++++ netgen-4.5_new/libsrc/geom2d/genmesh2d.cpp 2010-06-23 12:36:59.000000000 +0400 +@@ -121,11 +121,11 @@ + + int hsteps = mp.optsteps2d; + +- mp.optimize2d = "smcm"; ++ mp.optimize2d = (char*)"smcm"; + mp.optsteps2d = hsteps/2; + Optimize2d (*mesh, mp); + +- mp.optimize2d = "Smcm"; ++ mp.optimize2d = (char*)"Smcm"; + mp.optsteps2d = (hsteps+1)/2; + Optimize2d (*mesh, mp); + +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/gprim/geom2d.hpp netgen-4.5_new/libsrc/gprim/geom2d.hpp +--- netgen-4.5_orig/libsrc/gprim/geom2d.hpp 2004-01-20 14:49:44.000000000 +0300 ++++ netgen-4.5_new/libsrc/gprim/geom2d.hpp 2010-06-23 13:19:48.000000000 +0400 +@@ -53,7 +53,7 @@ + int IsOnLongLine (const Line2d & l, const Point2d & p); + int Hit (const Line2d & l1, const Line2d & l2, double heps = EPSGEOM); + ostream & operator<<(ostream & s, const Line2d & l); +-Point2d CrossPoint (const PLine2d & l1, const PLine2d & l2); ++Point2d CrossPoint (const Line2d & l1, const Line2d & l2); + int Parallel (const PLine2d & l1, const PLine2d & l2, double peps = EPSGEOM); + int IsOnLine (const PLine2d & l, const Point2d & p, double heps = EPSGEOM); + int IsOnLongLine (const PLine2d & l, const Point2d & p); +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/gprim/geom3d.hpp netgen-4.5_new/libsrc/gprim/geom3d.hpp +--- netgen-4.5_orig/libsrc/gprim/geom3d.hpp 2004-08-30 16:04:04.000000000 +0400 ++++ netgen-4.5_new/libsrc/gprim/geom3d.hpp 2010-06-23 13:19:48.000000000 +0400 @@ -25,6 +25,7 @@ - #include - #include - #include -+#include - #endif - - -diff -Naur netgen-4.5.old/libsrc/interface/Makefile netgen-4.5.new/libsrc/interface/Makefile ---- netgen-4.5.old/libsrc/interface/Makefile 2005-08-09 14:14:59.000000000 +0000 -+++ netgen-4.5.new/libsrc/interface/Makefile 2009-08-07 08:41:22.000000000 +0000 + inline Point3d Center (const Point3d & p1, const Point3d & p2, const Point3d & p3); + inline Point3d Center (const Point3d & p1, const Point3d & p2, + const Point3d & p3, const Point3d & p4); ++inline double Dist2 (const Point3d & p1, const Point3d & p2); + ostream & operator<<(ostream & s, const Point3d & p); + inline Vec3d operator- (const Vec3d & p1, const Vec3d & v); + inline Vec3d operator+ (const Vec3d & p1, const Vec3d & v); +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/interface/Makefile netgen-4.5_new/libsrc/interface/Makefile +--- netgen-4.5_orig/libsrc/interface/Makefile 2005-08-09 18:14:59.000000000 +0400 ++++ netgen-4.5_new/libsrc/interface/Makefile 2010-06-23 13:19:48.000000000 +0400 @@ -1,4 +1,5 @@ -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 +#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 @@ -68,9 +181,9 @@ diff -Naur netgen-4.5.old/libsrc/interface/Makefile netgen-4.5.new/libsrc/interf # lib = nginterface libpath = libsrc/interface -diff -Naur netgen-4.5.old/libsrc/interface/nglib.cpp netgen-4.5.new/libsrc/interface/nglib.cpp ---- netgen-4.5.old/libsrc/interface/nglib.cpp 2005-10-18 13:53:18.000000000 +0000 -+++ netgen-4.5.new/libsrc/interface/nglib.cpp 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/interface/nglib.cpp netgen-4.5_new/libsrc/interface/nglib.cpp +--- netgen-4.5_orig/libsrc/interface/nglib.cpp 2005-10-18 17:53:18.000000000 +0400 ++++ netgen-4.5_new/libsrc/interface/nglib.cpp 2010-06-23 13:19:48.000000000 +0400 @@ -56,7 +56,8 @@ void Ng_Exit () @@ -81,9 +194,33 @@ diff -Naur netgen-4.5.old/libsrc/interface/nglib.cpp netgen-4.5.new/libsrc/inter } -diff -Naur netgen-4.5.old/libsrc/makefile.inc netgen-4.5.new/libsrc/makefile.inc ---- netgen-4.5.old/libsrc/makefile.inc 2005-09-02 13:17:51.000000000 +0000 -+++ netgen-4.5.new/libsrc/makefile.inc 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/interface/writeuser.cpp netgen-4.5_new/libsrc/interface/writeuser.cpp +--- netgen-4.5_orig/libsrc/interface/writeuser.cpp 2005-08-09 18:14:59.000000000 +0400 ++++ netgen-4.5_new/libsrc/interface/writeuser.cpp 2010-06-23 12:37:42.000000000 +0400 +@@ -17,7 +17,7 @@ + + void RegisterUserFormats (ARRAY & names) + { +- char *types[] = ++ const char *types[] = + { + "Neutral Format", + "Surface Mesh Format" , +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/linalg/densemat.hpp netgen-4.5_new/libsrc/linalg/densemat.hpp +--- netgen-4.5_orig/libsrc/linalg/densemat.hpp 2005-12-09 15:26:19.000000000 +0300 ++++ netgen-4.5_new/libsrc/linalg/densemat.hpp 2010-06-23 13:19:48.000000000 +0400 +@@ -14,6 +14,8 @@ + + #include + ++class DenseMatrix; ++void CalcAtA (const DenseMatrix & a, DenseMatrix & m2); + + class DenseMatrix + { +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/makefile.inc netgen-4.5_new/libsrc/makefile.inc +--- netgen-4.5_orig/libsrc/makefile.inc 2005-09-02 17:17:51.000000000 +0400 ++++ netgen-4.5_new/libsrc/makefile.inc 2010-06-23 13:19:48.000000000 +0400 @@ -8,17 +8,14 @@ LIBSRC_DIR=$(CPP_DIR)/libsrc LIB_DIR=$(CPP_DIR)/lib/$(MACHINE) @@ -107,9 +244,9 @@ diff -Naur netgen-4.5.old/libsrc/makefile.inc netgen-4.5.new/libsrc/makefile.inc # ARFLAGS = r # -diff -Naur netgen-4.5.old/libsrc/makefile.mach.LINUX netgen-4.5.new/libsrc/makefile.mach.LINUX ---- netgen-4.5.old/libsrc/makefile.mach.LINUX 2004-10-11 19:49:26.000000000 +0000 -+++ netgen-4.5.new/libsrc/makefile.mach.LINUX 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/makefile.mach.LINUX netgen-4.5_new/libsrc/makefile.mach.LINUX +--- netgen-4.5_orig/libsrc/makefile.mach.LINUX 2004-10-11 23:49:26.000000000 +0400 ++++ netgen-4.5_new/libsrc/makefile.mach.LINUX 2010-06-23 13:19:48.000000000 +0400 @@ -16,7 +16,7 @@ # CFLAGS2 = @@ -119,9 +256,9 @@ diff -Naur netgen-4.5.old/libsrc/makefile.mach.LINUX netgen-4.5.new/libsrc/makef -ftemplate-depth-99 -finline-limit=10000 \ -Wdisabled-optimization -funroll-loops -DnoNGSOLVE -diff -Naur netgen-4.5.old/libsrc/meshing/improve2.cpp netgen-4.5.new/libsrc/meshing/improve2.cpp ---- netgen-4.5.old/libsrc/meshing/improve2.cpp 2006-01-11 16:08:19.000000000 +0000 -+++ netgen-4.5.new/libsrc/meshing/improve2.cpp 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/meshing/improve2.cpp netgen-4.5_new/libsrc/meshing/improve2.cpp +--- netgen-4.5_orig/libsrc/meshing/improve2.cpp 2006-01-11 19:08:19.000000000 +0300 ++++ netgen-4.5_new/libsrc/meshing/improve2.cpp 2010-06-23 13:19:48.000000000 +0400 @@ -4,7 +4,7 @@ #include @@ -131,9 +268,9 @@ diff -Naur netgen-4.5.old/libsrc/meshing/improve2.cpp netgen-4.5.new/libsrc/mesh #endif namespace netgen -diff -Naur netgen-4.5.old/libsrc/meshing/improve2.hpp netgen-4.5.new/libsrc/meshing/improve2.hpp ---- netgen-4.5.old/libsrc/meshing/improve2.hpp 2004-10-12 19:22:55.000000000 +0000 -+++ netgen-4.5.new/libsrc/meshing/improve2.hpp 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/meshing/improve2.hpp netgen-4.5_new/libsrc/meshing/improve2.hpp +--- netgen-4.5_orig/libsrc/meshing/improve2.hpp 2004-10-12 23:22:55.000000000 +0400 ++++ netgen-4.5_new/libsrc/meshing/improve2.hpp 2010-06-23 13:19:48.000000000 +0400 @@ -32,17 +32,16 @@ /// virtual void SelectSurfaceOfPoint (const Point3d & p, @@ -160,9 +297,9 @@ diff -Naur netgen-4.5.old/libsrc/meshing/improve2.hpp netgen-4.5.new/libsrc/mesh /// virtual void GetNormalVector(INDEX surfind, const Point3d & p, PointGeomInfo & gi, Vec3d & n) const; -diff -Naur netgen-4.5.old/libsrc/meshing/meshtype.cpp netgen-4.5.new/libsrc/meshing/meshtype.cpp ---- netgen-4.5.old/libsrc/meshing/meshtype.cpp 2006-02-10 10:11:08.000000000 +0000 -+++ netgen-4.5.new/libsrc/meshing/meshtype.cpp 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/meshing/meshtype.cpp netgen-4.5_new/libsrc/meshing/meshtype.cpp +--- netgen-4.5_orig/libsrc/meshing/meshtype.cpp 2006-02-10 13:11:08.000000000 +0300 ++++ netgen-4.5_new/libsrc/meshing/meshtype.cpp 2010-06-23 12:39:02.000000000 +0400 @@ -1,4 +1,5 @@ #include +#include @@ -178,9 +315,21 @@ diff -Naur netgen-4.5.old/libsrc/meshing/meshtype.cpp netgen-4.5.new/libsrc/mesh err += 1e12; else err += frob * frob / det; -diff -Naur netgen-4.5.old/libsrc/meshing/meshtype.hpp netgen-4.5.new/libsrc/meshing/meshtype.hpp ---- netgen-4.5.old/libsrc/meshing/meshtype.hpp 2006-02-10 10:11:08.000000000 +0000 -+++ netgen-4.5.new/libsrc/meshing/meshtype.hpp 2009-08-07 08:41:22.000000000 +0000 +@@ -2222,9 +2223,9 @@ + + MeshingParameters :: MeshingParameters () + { +- optimize3d = "cmdmstm"; ++ optimize3d = (char*)"cmdmstm"; + optsteps3d = 3; +- optimize2d = "smsmsmSmSmSm"; ++ optimize2d = (char*)"smsmsmSmSmSm"; + optsteps2d = 3; + opterrpow = 2; + blockfill = 1; +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/meshing/meshtype.hpp netgen-4.5_new/libsrc/meshing/meshtype.hpp +--- netgen-4.5_orig/libsrc/meshing/meshtype.hpp 2006-02-10 13:11:08.000000000 +0300 ++++ netgen-4.5_new/libsrc/meshing/meshtype.hpp 2010-06-23 13:19:48.000000000 +0400 @@ -13,7 +13,7 @@ Classes for NETGEN */ @@ -190,9 +339,9 @@ diff -Naur netgen-4.5.old/libsrc/meshing/meshtype.hpp netgen-4.5.new/libsrc/mesh enum ELEMENT_TYPE { SEGMENT = 1, SEGMENT3 = 2, TRIG = 10, QUAD=11, TRIG6 = 12, QUAD6 = 13, QUAD8 = 14, -diff -Naur netgen-4.5.old/libsrc/meshing/smoothing2.cpp netgen-4.5.new/libsrc/meshing/smoothing2.cpp ---- netgen-4.5.old/libsrc/meshing/smoothing2.cpp 2006-01-11 16:08:20.000000000 +0000 -+++ netgen-4.5.new/libsrc/meshing/smoothing2.cpp 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/meshing/smoothing2.cpp netgen-4.5_new/libsrc/meshing/smoothing2.cpp +--- netgen-4.5_orig/libsrc/meshing/smoothing2.cpp 2006-01-11 19:08:20.000000000 +0300 ++++ netgen-4.5_new/libsrc/meshing/smoothing2.cpp 2010-06-23 13:19:48.000000000 +0400 @@ -300,7 +300,7 @@ double Opti2SurfaceMinFunction :: FuncGrad (const Vector & x, Vector & grad) const @@ -311,9 +460,9 @@ diff -Naur netgen-4.5.old/libsrc/meshing/smoothing2.cpp netgen-4.5.new/libsrc/me if (moveisok) { for (j = 0; j < locelements.Size(); j++) -diff -Naur netgen-4.5.old/libsrc/occ/Partition_Inter2d.cxx netgen-4.5.new/libsrc/occ/Partition_Inter2d.cxx ---- netgen-4.5.old/libsrc/occ/Partition_Inter2d.cxx 2005-06-09 14:51:10.000000000 +0000 -+++ netgen-4.5.new/libsrc/occ/Partition_Inter2d.cxx 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/Partition_Inter2d.cxx netgen-4.5_new/libsrc/occ/Partition_Inter2d.cxx +--- netgen-4.5_orig/libsrc/occ/Partition_Inter2d.cxx 2005-06-09 18:51:10.000000000 +0400 ++++ netgen-4.5_new/libsrc/occ/Partition_Inter2d.cxx 2010-06-23 13:19:48.000000000 +0400 @@ -29,10 +29,10 @@ // $Header$ @@ -327,9 +476,9 @@ diff -Naur netgen-4.5.old/libsrc/occ/Partition_Inter2d.cxx netgen-4.5.new/libsrc #include #include #include -diff -Naur netgen-4.5.old/libsrc/occ/Partition_Inter3d.cxx netgen-4.5.new/libsrc/occ/Partition_Inter3d.cxx ---- netgen-4.5.old/libsrc/occ/Partition_Inter3d.cxx 2005-06-09 14:51:10.000000000 +0000 -+++ netgen-4.5.new/libsrc/occ/Partition_Inter3d.cxx 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/Partition_Inter3d.cxx netgen-4.5_new/libsrc/occ/Partition_Inter3d.cxx +--- netgen-4.5_orig/libsrc/occ/Partition_Inter3d.cxx 2005-06-09 18:51:10.000000000 +0400 ++++ netgen-4.5_new/libsrc/occ/Partition_Inter3d.cxx 2010-06-23 13:19:48.000000000 +0400 @@ -29,13 +29,17 @@ // $Header$ @@ -349,9 +498,9 @@ diff -Naur netgen-4.5.old/libsrc/occ/Partition_Inter3d.cxx netgen-4.5.new/libsrc #include #include #include -diff -Naur netgen-4.5.old/libsrc/occ/Partition_Loop.cxx netgen-4.5.new/libsrc/occ/Partition_Loop.cxx ---- netgen-4.5.old/libsrc/occ/Partition_Loop.cxx 2005-06-09 14:51:10.000000000 +0000 -+++ netgen-4.5.new/libsrc/occ/Partition_Loop.cxx 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/Partition_Loop.cxx netgen-4.5_new/libsrc/occ/Partition_Loop.cxx +--- netgen-4.5_orig/libsrc/occ/Partition_Loop.cxx 2005-06-09 18:51:10.000000000 +0400 ++++ netgen-4.5_new/libsrc/occ/Partition_Loop.cxx 2010-06-23 13:19:48.000000000 +0400 @@ -29,12 +29,14 @@ // $Header$ @@ -369,9 +518,9 @@ diff -Naur netgen-4.5.old/libsrc/occ/Partition_Loop.cxx netgen-4.5.new/libsrc/oc #include #include #include -diff -Naur netgen-4.5.old/libsrc/occ/Partition_Loop2d.cxx netgen-4.5.new/libsrc/occ/Partition_Loop2d.cxx ---- netgen-4.5.old/libsrc/occ/Partition_Loop2d.cxx 2005-06-09 14:51:10.000000000 +0000 -+++ netgen-4.5.new/libsrc/occ/Partition_Loop2d.cxx 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/Partition_Loop2d.cxx netgen-4.5_new/libsrc/occ/Partition_Loop2d.cxx +--- netgen-4.5_orig/libsrc/occ/Partition_Loop2d.cxx 2005-06-09 18:51:10.000000000 +0400 ++++ netgen-4.5_new/libsrc/occ/Partition_Loop2d.cxx 2010-06-23 13:19:48.000000000 +0400 @@ -12,9 +12,11 @@ // $Header$ @@ -385,9 +534,9 @@ diff -Naur netgen-4.5.old/libsrc/occ/Partition_Loop2d.cxx netgen-4.5.new/libsrc/ #include #include -diff -Naur netgen-4.5.old/libsrc/occ/Partition_Loop3d.cxx netgen-4.5.new/libsrc/occ/Partition_Loop3d.cxx ---- netgen-4.5.old/libsrc/occ/Partition_Loop3d.cxx 2005-06-09 14:51:10.000000000 +0000 -+++ netgen-4.5.new/libsrc/occ/Partition_Loop3d.cxx 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/Partition_Loop3d.cxx netgen-4.5_new/libsrc/occ/Partition_Loop3d.cxx +--- netgen-4.5_orig/libsrc/occ/Partition_Loop3d.cxx 2005-06-09 18:51:10.000000000 +0400 ++++ netgen-4.5_new/libsrc/occ/Partition_Loop3d.cxx 2010-06-23 13:19:48.000000000 +0400 @@ -10,6 +10,11 @@ // Module : GEOM @@ -400,9 +549,9 @@ diff -Naur netgen-4.5.old/libsrc/occ/Partition_Loop3d.cxx netgen-4.5.new/libsrc/ #include "Partition_Loop3d.ixx" #include -diff -Naur netgen-4.5.old/libsrc/occ/Partition_Spliter.cxx netgen-4.5.new/libsrc/occ/Partition_Spliter.cxx ---- netgen-4.5.old/libsrc/occ/Partition_Spliter.cxx 2005-07-11 06:33:27.000000000 +0000 -+++ netgen-4.5.new/libsrc/occ/Partition_Spliter.cxx 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/Partition_Spliter.cxx netgen-4.5_new/libsrc/occ/Partition_Spliter.cxx +--- netgen-4.5_orig/libsrc/occ/Partition_Spliter.cxx 2005-07-11 10:33:27.000000000 +0400 ++++ netgen-4.5_new/libsrc/occ/Partition_Spliter.cxx 2010-06-23 13:19:48.000000000 +0400 @@ -29,14 +29,15 @@ // $Header$ @@ -421,9 +570,9 @@ diff -Naur netgen-4.5.old/libsrc/occ/Partition_Spliter.cxx netgen-4.5.new/libsrc #include #include #include -diff -Naur netgen-4.5.old/libsrc/occ/occconstruction.cpp netgen-4.5.new/libsrc/occ/occconstruction.cpp ---- netgen-4.5.old/libsrc/occ/occconstruction.cpp 2005-12-06 15:15:53.000000000 +0000 -+++ netgen-4.5.new/libsrc/occ/occconstruction.cpp 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occconstruction.cpp netgen-4.5_new/libsrc/occ/occconstruction.cpp +--- netgen-4.5_orig/libsrc/occ/occconstruction.cpp 2005-12-06 18:15:53.000000000 +0300 ++++ netgen-4.5_new/libsrc/occ/occconstruction.cpp 2010-06-23 13:19:48.000000000 +0400 @@ -28,8 +28,8 @@ #include #include @@ -435,9 +584,9 @@ diff -Naur netgen-4.5.old/libsrc/occ/occconstruction.cpp netgen-4.5.new/libsrc/o #include #include namespace netgen -diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/occgenmesh.cpp ---- netgen-4.5.old/libsrc/occ/occgenmesh.cpp 2006-02-07 10:12:48.000000000 +0000 -+++ netgen-4.5.new/libsrc/occ/occgenmesh.cpp 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgenmesh.cpp netgen-4.5_new/libsrc/occ/occgenmesh.cpp +--- netgen-4.5_orig/libsrc/occ/occgenmesh.cpp 2006-02-07 13:12:48.000000000 +0300 ++++ netgen-4.5_new/libsrc/occ/occgenmesh.cpp 2010-06-23 13:19:48.000000000 +0400 @@ -28,7 +28,7 @@ return Point<3> (p.X(), p.Y(), p.Z()); } @@ -447,7 +596,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc ARRAY & ps, ARRAY & params, Mesh & mesh) -@@ -49,23 +49,19 @@ +@@ -49,23 +49,18 @@ hvalue[0] = 0; pnt = c->Value(s0); @@ -460,11 +609,12 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc { oldpnt = pnt; pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0)); -+ double dist = pnt.Distance(oldpnt); - hvalue[i] = hvalue[i-1] + - 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))* +- hvalue[i] = hvalue[i-1] + +- 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))* - pnt.Distance(oldpnt); -+ dist; ++ double dist = pnt.Distance(oldpnt); ++ hvalue[i] = hvalue[i-1] + min( 1.0, ++ 1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*dist); //(*testout) << "mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z())) " << mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z())) // << " pnt.Distance(oldpnt) " << pnt.Distance(oldpnt) << endl; @@ -475,7 +625,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc } // nsubedges = int(ceil(hvalue[DIVIDEEDGESECTIONS])); -@@ -74,7 +70,7 @@ +@@ -74,13 +69,16 @@ ps.SetSize(nsubedges-1); params.SetSize(nsubedges+1); @@ -484,7 +634,17 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc int i1 = 0; do { -@@ -112,7 +108,7 @@ + if (hvalue[i1]/hvalue[DIVIDEEDGESECTIONS]*nsubedges >= i) + { +- params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0); ++ // EAP. For nsubedges comparable to DIVIDEEDGESECTIONS (issue 0021073) ++ double d1 = i1 - (hvalue[i1] - i*hvalue[DIVIDEEDGESECTIONS]/nsubedges)/(hvalue[i1]-hvalue[i1-1]); ++ params[i] = s0+(d1/double(DIVIDEEDGESECTIONS))*(s1-s0); ++ //params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0); + pnt = c->Value(params[i]); + ps[i-1] = MeshPoint (Point3d(pnt.X(), pnt.Y(), pnt.Z())); + i++; +@@ -112,7 +110,7 @@ static void FindEdges (OCCGeometry & geom, Mesh & mesh) { @@ -493,7 +653,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc multithread.task = "Edge meshing"; (*testout) << "edge meshing" << endl; -@@ -124,6 +120,7 @@ +@@ -124,6 +122,7 @@ (*testout) << "nedges = " << nedges << endl; double eps = 1e-6 * geom.GetBoundingBox().Diam(); @@ -501,7 +661,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc for (int i = 1; i <= nvertices; i++) { -@@ -133,7 +130,7 @@ +@@ -133,7 +132,7 @@ bool exists = 0; if (merge_solids) for (PointIndex pi = 1; pi <= mesh.GetNP(); pi++) @@ -510,7 +670,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc { exists = 1; break; -@@ -163,6 +160,7 @@ +@@ -163,6 +162,7 @@ { TopoDS_Face face = TopoDS::Face(exp1.Current()); int facenr = geom.fmap.FindIndex(face); @@ -518,7 +678,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc if (face2solid[0][facenr-1] == 0) face2solid[0][facenr-1] = solidnr; -@@ -184,6 +182,9 @@ +@@ -184,6 +184,9 @@ int facenr = 0; int edgenr = 0; @@ -528,7 +688,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc (*testout) << "faces = " << geom.fmap.Extent() << endl; int curr = 0; -@@ -232,6 +233,11 @@ +@@ -232,6 +235,11 @@ continue; } @@ -540,7 +700,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc if (geom.vmap.FindIndex(TopExp::FirstVertex (edge)) == geom.vmap.FindIndex(TopExp::LastVertex (edge))) { -@@ -276,8 +282,8 @@ +@@ -276,8 +284,8 @@ pnums.Last() = -1; for (PointIndex pi = 1; pi < first_ep; pi++) { @@ -551,7 +711,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc } } -@@ -287,7 +293,7 @@ +@@ -287,7 +295,7 @@ bool exists = 0; int j; for (j = first_ep; j <= mesh.GetNP(); j++) @@ -560,7 +720,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc { exists = 1; break; -@@ -394,7 +400,7 @@ +@@ -394,7 +402,7 @@ int i, j, k; int changed; @@ -569,7 +729,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc multithread.task = "Surface meshing"; geom.facemeshstatus = 0; -@@ -751,7 +757,7 @@ +@@ -751,7 +759,7 @@ multithread.task = savetask; } @@ -578,7 +738,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc { double hret; kappa *= mparam.curvaturesafety; -@@ -779,7 +785,7 @@ +@@ -779,7 +787,7 @@ double nq = n*q; Point<3> p = p0 + 0.5*n; @@ -587,7 +747,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc if (lambda >= 0 && lambda <= 1) { -@@ -799,55 +805,55 @@ +@@ -799,55 +807,55 @@ @@ -663,7 +823,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc //(*testout) << "curvature " << curvature << endl; -@@ -886,51 +892,47 @@ +@@ -886,51 +894,47 @@ pm1.SetX(0.5*(par0.X()+par2.X())); pm1.SetY(0.5*(par0.Y()+par2.Y())); pm2.SetX(0.5*(par1.X()+par0.X())); pm2.SetY(0.5*(par1.Y()+par0.Y())); @@ -730,7 +890,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc (*testout) << pnt.X() << " " << pnt.Y() << " " << pnt.Z() << endl; */ } -@@ -970,7 +972,7 @@ +@@ -970,7 +974,7 @@ if (mparam.uselocalh) { @@ -739,7 +899,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc multithread.percent = 0; mesh->SetLocalH (bb.PMin(), bb.PMax(), mparam.grading); -@@ -1075,7 +1077,6 @@ +@@ -1075,7 +1079,6 @@ if (triangulation.IsNull()) continue; BRepAdaptor_Surface sf(face, Standard_True); @@ -747,7 +907,7 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc int ntriangles = triangulation -> NbTriangles(); for (int j = 1; j <= ntriangles; j++) -@@ -1096,7 +1097,7 @@ +@@ -1096,7 +1099,7 @@ maxside = max (maxside, p[1].Distance(p[2])); //cout << "\rFace " << i << " pos11 ntriangles " << ntriangles << " maxside " << maxside << flush; @@ -756,9 +916,9 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgenmesh.cpp netgen-4.5.new/libsrc/occ/oc //cout << "\rFace " << i << " pos12 ntriangles " << ntriangles << flush; } } -diff -Naur netgen-4.5.old/libsrc/occ/occgeom.cpp netgen-4.5.new/libsrc/occ/occgeom.cpp ---- netgen-4.5.old/libsrc/occ/occgeom.cpp 2006-01-25 13:35:50.000000000 +0000 -+++ netgen-4.5.new/libsrc/occ/occgeom.cpp 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgeom.cpp netgen-4.5_new/libsrc/occ/occgeom.cpp +--- netgen-4.5_orig/libsrc/occ/occgeom.cpp 2006-01-25 16:35:50.000000000 +0300 ++++ netgen-4.5_new/libsrc/occ/occgeom.cpp 2010-06-23 12:38:22.000000000 +0400 @@ -7,6 +7,8 @@ #include "ShapeAnalysis_ShapeContents.hxx" #include "ShapeAnalysis_CheckSmallFace.hxx" @@ -935,9 +1095,29 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgeom.cpp netgen-4.5.new/libsrc/occ/occge return true; } -diff -Naur netgen-4.5.old/libsrc/occ/occgeom.hpp netgen-4.5.new/libsrc/occ/occgeom.hpp ---- netgen-4.5.old/libsrc/occ/occgeom.hpp 2006-01-25 13:35:50.000000000 +0000 -+++ netgen-4.5.new/libsrc/occ/occgeom.hpp 2009-08-07 08:41:22.000000000 +0000 +@@ -1190,16 +1189,16 @@ + return occgeo; + } + +- char * shapesname[] = ++ const char * shapesname[] = + {" ", "CompSolids", "Solids", "Shells", + + "Faces", "Wires", "Edges", "Vertices"}; + +- char * shapename[] = ++ const char * shapename[] = + {" ", "CompSolid", "Solid", "Shell", + "Face", "Wire", "Edge", "Vertex"}; + +- char * orientationstring[] = ++ const char * orientationstring[] = + {"+", "-"}; + + void OCCGeometry :: RecursiveTopologyTree (const TopoDS_Shape & sh, +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occgeom.hpp netgen-4.5_new/libsrc/occ/occgeom.hpp +--- netgen-4.5_orig/libsrc/occ/occgeom.hpp 2006-01-25 16:35:50.000000000 +0300 ++++ netgen-4.5_new/libsrc/occ/occgeom.hpp 2010-06-23 13:19:48.000000000 +0400 @@ -15,8 +15,6 @@ #include "Geom_Curve.hxx" #include "Geom2d_Curve.hxx" @@ -1014,9 +1194,9 @@ diff -Naur netgen-4.5.old/libsrc/occ/occgeom.hpp netgen-4.5.new/libsrc/occ/occge OCCSurface GetSurface (int surfi) { cout << "OCCGeometry::GetSurface using PLANESPACE" << endl; -diff -Naur netgen-4.5.old/libsrc/occ/occmeshsurf.cpp netgen-4.5.new/libsrc/occ/occmeshsurf.cpp ---- netgen-4.5.old/libsrc/occ/occmeshsurf.cpp 2006-01-25 13:36:26.000000000 +0000 -+++ netgen-4.5.new/libsrc/occ/occmeshsurf.cpp 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occmeshsurf.cpp netgen-4.5_new/libsrc/occ/occmeshsurf.cpp +--- netgen-4.5_orig/libsrc/occ/occmeshsurf.cpp 2006-01-25 16:36:26.000000000 +0300 ++++ netgen-4.5_new/libsrc/occ/occmeshsurf.cpp 2010-06-23 13:19:48.000000000 +0400 @@ -5,6 +5,8 @@ #include #include @@ -1132,9 +1312,9 @@ diff -Naur netgen-4.5.old/libsrc/occ/occmeshsurf.cpp netgen-4.5.new/libsrc/occ/o -diff -Naur netgen-4.5.old/libsrc/occ/occmeshsurf.hpp netgen-4.5.new/libsrc/occ/occmeshsurf.hpp ---- netgen-4.5.old/libsrc/occ/occmeshsurf.hpp 2005-06-09 14:51:10.000000000 +0000 -+++ netgen-4.5.new/libsrc/occ/occmeshsurf.hpp 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/occmeshsurf.hpp netgen-4.5_new/libsrc/occ/occmeshsurf.hpp +--- netgen-4.5_orig/libsrc/occ/occmeshsurf.hpp 2005-06-09 18:51:10.000000000 +0400 ++++ netgen-4.5_new/libsrc/occ/occmeshsurf.hpp 2010-06-23 13:19:48.000000000 +0400 @@ -151,7 +151,7 @@ MeshOptimize2dOCCSurfaces (const OCCGeometry & ageometry); @@ -1154,9 +1334,9 @@ diff -Naur netgen-4.5.old/libsrc/occ/occmeshsurf.hpp netgen-4.5.new/libsrc/occ/o }; -diff -Naur netgen-4.5.old/libsrc/occ/utilities.h netgen-4.5.new/libsrc/occ/utilities.h ---- netgen-4.5.old/libsrc/occ/utilities.h 2005-02-11 11:35:43.000000000 +0000 -+++ netgen-4.5.new/libsrc/occ/utilities.h 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/occ/utilities.h netgen-4.5_new/libsrc/occ/utilities.h +--- netgen-4.5_orig/libsrc/occ/utilities.h 2005-02-11 14:35:43.000000000 +0300 ++++ netgen-4.5_new/libsrc/occ/utilities.h 2010-06-23 13:19:48.000000000 +0400 @@ -33,6 +33,7 @@ #include @@ -1165,9 +1345,9 @@ diff -Naur netgen-4.5.old/libsrc/occ/utilities.h netgen-4.5.new/libsrc/occ/utili #include // #include "SALOME_Log.hxx" -diff -Naur netgen-4.5.old/libsrc/stlgeom/meshstlsurface.cpp netgen-4.5.new/libsrc/stlgeom/meshstlsurface.cpp ---- netgen-4.5.old/libsrc/stlgeom/meshstlsurface.cpp 2006-01-11 16:08:20.000000000 +0000 -+++ netgen-4.5.new/libsrc/stlgeom/meshstlsurface.cpp 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/stlgeom/meshstlsurface.cpp netgen-4.5_new/libsrc/stlgeom/meshstlsurface.cpp +--- netgen-4.5_orig/libsrc/stlgeom/meshstlsurface.cpp 2006-01-11 19:08:20.000000000 +0300 ++++ netgen-4.5_new/libsrc/stlgeom/meshstlsurface.cpp 2010-06-23 13:19:48.000000000 +0400 @@ -946,20 +946,23 @@ } @@ -1216,9 +1396,9 @@ diff -Naur netgen-4.5.old/libsrc/stlgeom/meshstlsurface.cpp netgen-4.5.new/libsr void MeshOptimizeSTLSurface :: GetNormalVector(INDEX surfind, const Point3d & p, Vec3d & n) const { n = geom.GetChartNormalVector(); -diff -Naur netgen-4.5.old/libsrc/stlgeom/meshstlsurface.hpp netgen-4.5.new/libsrc/stlgeom/meshstlsurface.hpp ---- netgen-4.5.old/libsrc/stlgeom/meshstlsurface.hpp 2004-09-30 13:13:56.000000000 +0000 -+++ netgen-4.5.new/libsrc/stlgeom/meshstlsurface.hpp 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/stlgeom/meshstlsurface.hpp netgen-4.5_new/libsrc/stlgeom/meshstlsurface.hpp +--- netgen-4.5_orig/libsrc/stlgeom/meshstlsurface.hpp 2004-09-30 17:13:56.000000000 +0400 ++++ netgen-4.5_new/libsrc/stlgeom/meshstlsurface.hpp 2010-06-23 13:19:48.000000000 +0400 @@ -79,12 +79,10 @@ virtual void SelectSurfaceOfPoint (const Point3d & p, const PointGeomInfo & gi); @@ -1233,9 +1413,39 @@ diff -Naur netgen-4.5.old/libsrc/stlgeom/meshstlsurface.hpp netgen-4.5.new/libsr virtual void GetNormalVector(INDEX surfind, const Point3d & p, Vec3d & n) const; }; -diff -Naur netgen-4.5.old/makeForSalome.sh netgen-4.5.new/makeForSalome.sh ---- netgen-4.5.old/makeForSalome.sh 1970-01-01 00:00:00.000000000 +0000 -+++ netgen-4.5.new/makeForSalome.sh 2009-08-07 08:41:22.000000000 +0000 +diff -Naur --exclude=CVS netgen-4.5_orig/libsrc/stlgeom/stlgeommesh.cpp netgen-4.5_new/libsrc/stlgeom/stlgeommesh.cpp +--- netgen-4.5_orig/libsrc/stlgeom/stlgeommesh.cpp 2004-08-10 03:39:45.000000000 +0400 ++++ netgen-4.5_new/libsrc/stlgeom/stlgeommesh.cpp 2010-06-23 12:39:38.000000000 +0400 +@@ -1437,7 +1437,7 @@ + + if (!optstring || strlen(optstring) == 0) + { +- mparam.optimize2d = "smcm"; ++ mparam.optimize2d = (char*)"smcm"; + } + else + { +@@ -1453,7 +1453,7 @@ + mparam.grading); + mesh -> LoadLocalMeshSize (mparam.meshsizefilename); + mesh -> CalcLocalHFromSurfaceCurvature (stlparam.resthsurfmeshcurvfac); +- mparam.optimize2d = "cmsmSm"; ++ mparam.optimize2d = (char*)"cmsmSm"; + STLSurfaceOptimization (*stlgeometry, *mesh, mparam); + #ifdef STAT_STREAM + (*statout) << GetTime() << " & "; +@@ -1559,7 +1559,7 @@ + + if (!optstring || strlen(optstring) == 0) + { +- mparam.optimize3d = "cmdmstm"; ++ mparam.optimize3d = (char*)"cmdmstm"; + } + else + { +diff -Naur --exclude=CVS netgen-4.5_orig/makeForSalome.sh netgen-4.5_new/makeForSalome.sh +--- netgen-4.5_orig/makeForSalome.sh 1970-01-01 03:00:00.000000000 +0300 ++++ netgen-4.5_new/makeForSalome.sh 2010-06-23 13:19:48.000000000 +0400 @@ -0,0 +1,35 @@ +#! /bin/sh +cp ngtcltk/ngnewdelete.* libsrc/interface/ @@ -1268,7 +1478,7 @@ diff -Naur netgen-4.5.old/makeForSalome.sh netgen-4.5.new/makeForSalome.sh +fi + +cp libsrc/interface/nglib.h libsrc/general/*.hpp libsrc/csg/*.hpp libsrc/geom2d/*.hpp \ -+ libsrc/gprim/*.hpp libsrc/linalg/*.hpp libsrc/meshing/*.hpp \ -+ libsrc/occ/*.hpp libsrc/opti/*.hpp libsrc/include/mydefs.hpp \ -+ libsrc/stlgeom/*.hpp libsrc/include/mystdlib.h \ -+ install/include ++ libsrc/gprim/*.hpp libsrc/linalg/*.hpp libsrc/meshing/*.hpp \ ++ libsrc/occ/*.hpp libsrc/opti/*.hpp libsrc/include/mydefs.hpp \ ++ libsrc/stlgeom/*.hpp libsrc/include/mystdlib.h \ ++ install/include diff --git a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx index 9e19aff..d2f9177 100644 --- a/src/NETGENPlugin/NETGENPlugin_Mesher.cxx +++ b/src/NETGENPlugin/NETGENPlugin_Mesher.cxx @@ -76,6 +76,7 @@ namespace netgen { extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*); extern MeshingParameters mparam; + extern volatile multithreadt multithread; } using namespace nglib; @@ -493,6 +494,10 @@ bool NETGENPlugin_Mesher::fillNgMesh(const netgen::OCCGeometry& occgeom, seg.si = faceID; // = geom.fmap.FindIndex (face); seg.edgenr = ngMesh.GetNSeg() + 1; // segment id ngMesh.AddSegment (seg); + + netgen::Point3d ngP1(p1.node->X(), p1.node->Y(), p1.node->Z()); + netgen::Point3d ngP2(p2.node->X(), p2.node->Y(), p2.node->Z()); + ngMesh.RestrictLocalH( netgen::Center( ngP1,ngP2), Dist(ngP1,ngP2)); #ifdef DUMP_SEGMENTS cout << "Segment: " << seg.edgenr << " on SMESH face " << helper.GetMeshDS()->ShapeToIndex( face ) << endl << "\tface index: " << seg.si << endl @@ -1396,6 +1401,66 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry& occgeo, return comment.empty() ? 0 : 1; } +namespace +{ + //================================================================================ + /*! + * \brief Restrict size of elements on the given edge + */ + //================================================================================ + + void setLocalSize(const TopoDS_Edge& edge, + double size, + netgen::Mesh& mesh) + { + const int nb = 1000; + Standard_Real u1, u2; + Handle(Geom_Curve) curve = BRep_Tool::Curve(edge, u1, u2); + Standard_Real delta = (u2-u1)/nb; + for(int i=0; iValue(u); + netgen::Point3d pi(p.X(), p.Y(), p.Z()); + mesh.RestrictLocalH(pi, size); + double resultSize = mesh.GetH(pi); + if ( resultSize - size > 0.1*size ) + // netgen does restriction iff oldH/newH > 1.2 (localh.cpp:136) + mesh.RestrictLocalH(pi, resultSize/1.201); + } + } + + //================================================================================ + /*! + * \brief Convert error into text + */ + //================================================================================ + + std::string text(int err) + { + if ( !err ) + return string(""); + return + SMESH_Comment("Error in netgen::OCCGenerateMesh() at ") << netgen::multithread.task; + } + + //================================================================================ + /*! + * \brief Convert exception into text + */ + //================================================================================ + + std::string text(Standard_Failure& ex) + { + SMESH_Comment str("Exception in netgen::OCCGenerateMesh()"); + str << " at " << netgen::multithread.task + << ": " << ex.DynamicType()->Name(); + if ( ex.GetMessageString() && strlen( ex.GetMessageString() )) + str << ": " << ex.GetMessageString(); + return str; + } +} + //============================================================================= /*! * Here we are going to use the NETGEN mesher @@ -1458,71 +1523,81 @@ bool NETGENPlugin_Mesher::Compute() // vector of nodes in which node index == netgen ID vector< const SMDS_MeshNode* > nodeVec; - try + { // ---------------- // compute 1D mesh // ---------------- - // Pass 1D simple parameters to NETGEN - if ( _simpleHyp ) { - if ( int nbSeg = _simpleHyp->GetNumberOfSegments() ) { + if ( _simpleHyp ) + { + // not to RestrictLocalH() according to curvature during MESHCONST_ANALYSE + mparams.uselocalh = false; + mparams.grading = 0.8; // not limitited size growth + + if ( _simpleHyp->GetNumberOfSegments() ) // nb of segments - mparams.segmentsperedge = nbSeg + 0.1; mparams.maxh = occgeo.boundingbox.Diam(); - mparams.grading = 0.01; - } - else { + else // segment length - mparams.segmentsperedge = 1; mparams.maxh = _simpleHyp->GetLocalLength(); - } } + // Let netgen create ngMesh and calculate element size on not meshed shapes char *optstr = 0; int startWith = netgen::MESHCONST_ANALYSE; int endWith = netgen::MESHCONST_ANALYSE; - err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr); - if (err) comment << "Error in netgen::OCCGenerateMesh() at MESHCONST_ANALYSE step"; + try + { + OCC_CATCH_SIGNALS; + err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr); + comment << text(err); + } + catch (Standard_Failure& ex) + { + comment << text(ex); + if ( !ngMesh ) + return false; + err = 1; + } ngLib.setMesh(( Ng_Mesh*) ngMesh ); - // -------------------------------- - // Local size on vertices and edges - // -------------------------------- - - if ( ! _simpleHyp ) + if ( _simpleHyp ) + { + // Pass 1D simple parameters to NETGEN + // -------------------------------- + int nbSeg = _simpleHyp->GetNumberOfSegments(); + double segSize = _simpleHyp->GetLocalLength(); + for ( int iE = 1; iE <= occgeo.emap.Extent(); ++iE ) { - for(std::map::const_iterator it=EdgeId2LocalSize.begin(); it!=EdgeId2LocalSize.end(); it++) - { - int key = (*it).first; - double hi = (*it).second; - const TopoDS_Shape& shape = ShapesWithLocalSize.FindKey(key); - const TopoDS_Edge& e = TopoDS::Edge(shape); - Standard_Real u1, u2; - Handle(Geom_Curve) curve = BRep_Tool::Curve(e, u1, u2); - GeomAdaptor_Curve AdaptCurve(curve); - double length = GCPnts_AbscissaPoint::Length(AdaptCurve, u1, u2); - int nb = length/hi; - if(nb<2) nb=2; - Standard_Real delta = (u2-u1)/nb; - for(int i=0; iValue(u); - netgen::Point3d pi(p.X(), p.Y(), p.Z()); - ngMesh->RestrictLocalH(pi, hi); - } - } - for(std::map::const_iterator it=VertexId2LocalSize.begin(); it!=VertexId2LocalSize.end(); it++) - { - int key = (*it).first; - double hi = (*it).second; - const TopoDS_Shape& shape = ShapesWithLocalSize.FindKey(key); - const TopoDS_Vertex& v = TopoDS::Vertex(shape); - gp_Pnt p = BRep_Tool::Pnt(v); - netgen::Point3d pi(p.X(), p.Y(), p.Z()); - ngMesh->RestrictLocalH(pi, hi); - } + const TopoDS_Edge& e = TopoDS::Edge( occgeo.emap(iE)); + if ( nbSeg ) + segSize = SMESH_Algo::EdgeLength( e ) / ( nbSeg - 0.4 ); + setLocalSize( e, segSize, *ngMesh ); } + } + else // if ( ! _simpleHyp ) + { + // Local size on vertices and edges + // -------------------------------- + for(std::map::const_iterator it=EdgeId2LocalSize.begin(); it!=EdgeId2LocalSize.end(); it++) + { + int key = (*it).first; + double hi = (*it).second; + const TopoDS_Shape& shape = ShapesWithLocalSize.FindKey(key); + const TopoDS_Edge& e = TopoDS::Edge(shape); + setLocalSize( e, hi, *ngMesh ); + } + for(std::map::const_iterator it=VertexId2LocalSize.begin(); it!=VertexId2LocalSize.end(); it++) + { + int key = (*it).first; + double hi = (*it).second; + const TopoDS_Shape& shape = ShapesWithLocalSize.FindKey(key); + const TopoDS_Vertex& v = TopoDS::Vertex(shape); + gp_Pnt p = BRep_Tool::Pnt(v); + netgen::Point3d pi(p.X(), p.Y(), p.Z()); + ngMesh->RestrictLocalH(pi, hi); + } + } // Precompute internal edges (issue 0020676) in order to // add mesh on them correctly (twice) to netgen mesh @@ -1536,16 +1611,24 @@ bool NETGENPlugin_Mesher::Compute() // let netgen compute element size by the main geometry in temporary mesh netgen::Mesh *tmpNgMesh = NULL; - netgen::OCCGenerateMesh(occgeo, tmpNgMesh, startWith, endWith, optstr); - // compute mesh on internal edges - endWith = netgen::MESHCONST_MESHEDGES; - err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, startWith, endWith, optstr); - if (err) comment << "Error in netgen::OCCGenerateMesh() at meshing internal edges"; - + try + { + OCC_CATCH_SIGNALS; + netgen::OCCGenerateMesh(occgeo, tmpNgMesh, startWith, endWith, optstr); + // compute mesh on internal edges + endWith = netgen::MESHCONST_MESHEDGES; + err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, startWith, endWith, optstr); + comment << text(err); + } + catch (Standard_Failure& ex) + { + comment << text(ex); + err = 1; + } // fill SMESH by netgen mesh vector< const SMDS_MeshNode* > tmpNodeVec; FillSMesh( intOccgeo, *tmpNgMesh, initState, *_mesh, tmpNodeVec, comment ); - err = ( !comment.empty() ); + err = ( err || !comment.empty() ); nglib::Ng_DeleteMesh((nglib::Ng_Mesh*)tmpNgMesh); } @@ -1562,9 +1645,20 @@ bool NETGENPlugin_Mesher::Compute() if (!err) { startWith = endWith = netgen::MESHCONST_MESHEDGES; - err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr); - if (err) comment << "Error in netgen::OCCGenerateMesh() at 1D mesh generation"; + try + { + OCC_CATCH_SIGNALS; + err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr); + comment << text(err); + } + catch (Standard_Failure& ex) + { + comment << text(ex); + err = 1; + } } + mparams.uselocalh = true; // restore as it is used at surface optimization + // --------------------- // compute surface mesh // --------------------- @@ -1613,55 +1707,25 @@ bool NETGENPlugin_Mesher::Compute() initState = NETGENPlugin_ngMeshInfo(ngMesh); } - // Precompute internal faces (issue 0020676) in order to - // add mesh on them correctly (twice to emulate the crack) to netgen mesh - //if ( internals.hasInternalFaces() ) - // { -// // fill SMESH with generated segments -// FillSMesh( occgeo, *ngMesh, initState, *_mesh, nodeVec, comment ); - -// // load internal shapes into a separate OCCGeometry -// netgen::OCCGeometry intOccgeo; -// list< SMESH_subMesh* > boundarySM; -// internals.getInternalFaces( intOccgeo.fmap, intOccgeo.emap, meshedSM, boundarySM); -// intOccgeo.boundingbox = occgeo.boundingbox; -// intOccgeo.shape = occgeo.shape; -// intOccgeo.facemeshstatus.SetSize (intOccgeo.fmap.Extent()); -// intOccgeo.facemeshstatus = 0; - -// // let netgen compute element size by the main geometry in temporary mesh -// int start = netgen::MESHCONST_ANALYSE, end = netgen::MESHCONST_ANALYSE; -// netgen::Mesh *tmpNgMesh = NULL; -// netgen::OCCGenerateMesh(occgeo, tmpNgMesh, start, end, optstr); - -// // add already computed elements from submeshes of internal faces to tmpNgMesh -// vector< const SMDS_MeshNode* > tmpNodeVec; -// fillNgMesh(intOccgeo, *tmpNgMesh, tmpNodeVec, boundarySM); -// addIntVerticesInFaces( intOccgeo, *tmpNgMesh, tmpNodeVec, internals ); - -// // compute mesh on internal faces -// NETGENPlugin_ngMeshInfo prevState(tmpNgMesh); -// start = netgen::MESHCONST_MESHEDGES; -// end = netgen::MESHCONST_MESHSURFACE; -// err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, start, end, optstr); -// if (err) comment << "Error in netgen::OCCGenerateMesh() at meshing internal faces"; - -// // fill SMESH with computed elements -// FillSMesh( intOccgeo, *tmpNgMesh, prevState, *_mesh, tmpNodeVec, comment ); -// err = ( !comment.empty() ); - -// // finally, correctly add elements on internal faces to netgen mesh -// err = ! fillNgMesh(occgeo, *ngMesh, nodeVec, meshedSM); -// initState = NETGENPlugin_ngMeshInfo(ngMesh); - -// nglib::Ng_DeleteMesh((nglib::Ng_Mesh*)tmpNgMesh); -// } - // Let netgen compute 2D mesh startWith = netgen::MESHCONST_MESHSURFACE; endWith = _optimize ? netgen::MESHCONST_OPTSURFACE : netgen::MESHCONST_MESHSURFACE; - err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr); - if (err) comment << "Error in netgen::OCCGenerateMesh() at surface mesh generation"; + try + { + OCC_CATCH_SIGNALS; + err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr); + comment << text (err); + } + catch (Standard_Failure& ex) + { + comment << text(ex); + err = 1; + } + catch (netgen::NgException exc) + { + error->myName = err = COMPERR_ALGO_FAILED; + comment << exc.What(); + } } // --------------------- // generate volume mesh @@ -1689,10 +1753,6 @@ bool NETGENPlugin_Mesher::Compute() // length from faces mparams.maxh = ngMesh->AverageH(); } -// netgen::ARRAY maxhdom; -// maxhdom.SetSize (occgeo.NrSolids()); -// maxhdom = mparams.maxh; -// ngMesh->SetMaxHDomain (maxhdom); ngMesh->SetGlobalH (mparams.maxh); mparams.grading = 0.4; ngMesh->CalcLocalH(); @@ -1710,23 +1770,65 @@ bool NETGENPlugin_Mesher::Compute() initState = NETGENPlugin_ngMeshInfo(ngMesh); } // Let netgen compute 3D mesh - startWith = netgen::MESHCONST_MESHVOLUME; - endWith = _optimize ? netgen::MESHCONST_OPTVOLUME : netgen::MESHCONST_MESHVOLUME; - err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr); - if (err) comment << "Error in netgen::OCCGenerateMesh()"; + startWith = endWith = netgen::MESHCONST_MESHVOLUME; + try + { + OCC_CATCH_SIGNALS; + err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr); + comment << text(err); + } + catch (Standard_Failure& ex) + { + comment << text(ex); + err = 1; + } + catch (netgen::NgException exc) + { + error->myName = err = COMPERR_ALGO_FAILED; + comment << exc.What(); + } + // Let netgen optimize 3D mesh + if ( !err && _optimize ) + { + startWith = endWith = netgen::MESHCONST_OPTVOLUME; + try + { + OCC_CATCH_SIGNALS; + err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr); + comment << text(err); + } + catch (Standard_Failure& ex) + { + comment << text(ex); + err = 1; + } + catch (netgen::NgException exc) + { + error->myName = err = COMPERR_ALGO_FAILED; + comment << exc.What(); + } + } } if (!err && mparams.secondorder > 0) { - netgen::OCCRefinementSurfaces ref (occgeo); - ref.MakeSecondOrder (*ngMesh); + try + { + OCC_CATCH_SIGNALS; + netgen::OCCRefinementSurfaces ref (occgeo); + ref.MakeSecondOrder (*ngMesh); + } + catch (Standard_Failure& ex) + { + comment << "Exception in netgen at passing to 2nd order "; + err = 1; + } + catch (netgen::NgException exc) + { + error->myName = err = COMPERR_ALGO_FAILED; + comment << exc.What(); + } } } - catch (netgen::NgException exc) - { - error->myName = err = COMPERR_ALGO_FAILED; - comment << exc.What(); - } - int nbNod = ngMesh->GetNP(); int nbSeg = ngMesh->GetNSeg(); int nbFac = ngMesh->GetNSE(); @@ -1734,10 +1836,10 @@ bool NETGENPlugin_Mesher::Compute() bool isOK = ( !err && (_isVolume ? (nbVol > 0) : (nbFac > 0)) ); MESSAGE((err ? "Mesh Generation failure" : "End of Mesh Generation") << - ", nb nodes: " << nbNod << + ", nb nodes: " << nbNod << ", nb segments: " << nbSeg << - ", nb faces: " << nbFac << - ", nb volumes: " << nbVol); + ", nb faces: " << nbFac << + ", nb volumes: " << nbVol); // ------------------------------------------------------------ // Feed back the SMESHDS with the generated Nodes and Elements @@ -1934,7 +2036,7 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap) aVec[SMDSEntity_Quad_Triangle] = nbFaces; } else { - aVec[SMDSEntity_Node] = nbNodes; + aVec[SMDSEntity_Node] = Max ( nbNodes, 0 ); aVec[SMDSEntity_Triangle] = nbFaces; } aResMap[sm].swap(aVec); diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx index dc396b7..99e71a7 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx @@ -179,9 +179,14 @@ static TError AddSegmentsToMesh(netgen::Mesh& ngMesh, { StdMeshers_FaceSidePtr wire = wires[ iW ]; if ( wire->MissVertexNode() ) - return TError - (new SMESH_ComputeError(COMPERR_BAD_INPUT_MESH, "Missing nodes on vertices")); - + { + // Commented for issue 0020960. It worked for the case, let's wait for case where it doesn't. + // It seems that there is no reason for this limitation +// return TError +// (new SMESH_ComputeError(COMPERR_BAD_INPUT_MESH, "Missing nodes on vertices")); + if (getenv("USER") && string("eap")==getenv("USER")) + cout << "Warning: NETGENPlugin_NETGEN_2D_ONLY : try to work with missing nodes on vertices"<& uvPtVec = wire->GetUVPtStruct(); if ( uvPtVec.size() != wire->NbPoints() ) return TError diff --git a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx index cdee329..fb0a1bd 100644 --- a/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx +++ b/src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx @@ -235,7 +235,7 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, if ( !isTraingle ) { // use adaptor to convert quadrangle face into triangles - const list* faces = Adaptor.GetTriangles(elem); + const list* faces = Adaptor.GetTriangles(elem); if(faces==0) return error( COMPERR_BAD_INPUT_MESH, SMESH_Comment("No triangles in adaptor for element ")<GetID()); @@ -423,25 +423,22 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, _quadraticMesh = true; StdMeshers_QuadToTriaAdaptor Adaptor; - Adaptor.Compute(aMesh); + if ( aMesh.NbQuadrangles() > 0 ) + Adaptor.Compute(aMesh); - SMDS_FaceIteratorPtr fIt = MeshDS->facesIterator(); - TIDSortedElemSet sortedFaces; // 0020279: control the "random" use when using mesh algorithms - while( fIt->more()) sortedFaces.insert( fIt->next() ); - - TIDSortedElemSet::iterator itFace = sortedFaces.begin(), fEnd = sortedFaces.end(); - for ( ; itFace != fEnd; ++itFace ) + SMDS_FaceIteratorPtr fIt = MeshDS->facesIterator(/*idInceasingOrder=*/true); + while( fIt->more()) { // check element - const SMDS_MeshElement* elem = *itFace; + const SMDS_MeshElement* elem = fIt->next(); if ( !elem ) return error( COMPERR_BAD_INPUT_MESH, "Null element encounters"); vector< const SMDS_MeshElement* > trias; - bool isTraingle = ( elem->NbNodes() == ( elem->IsQuadratic() ? 6 : 3 )); + bool isTraingle = ( elem->NbCornerNodes() == 3 ); if ( !isTraingle ) { // using adaptor - const list* faces = Adaptor.GetTriangles(elem); + const list* faces = Adaptor.GetTriangles(elem); if(faces==0) continue; // Issue 0020682. There already can be 3d mesh trias.assign( faces->begin(), faces->end() ); @@ -508,6 +505,13 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, Ng_AddSurfaceElement(Netgen_mesh, NG_TRIG, Netgen_triangle); } + // vector of nodes in which node index == netgen ID + vector< const SMDS_MeshNode* > nodeVec ( nodeToNetgenID.size() + 1 ); + // insert old nodes into nodeVec + for ( n_id = nodeToNetgenID.begin(); n_id != nodeToNetgenID.end(); ++n_id ) + nodeVec.at( n_id->second ) = n_id->first; + nodeToNetgenID.clear(); + // ------------------------- // Generate the volume mesh // ------------------------- @@ -531,11 +535,17 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, status = NG_VOLUME_FAILURE; } catch (...) { - error("Bad mesh input!!!"); + error("Exception in Ng_GenerateVolumeMesh()"); status = NG_VOLUME_FAILURE; } if ( GetComputeError()->IsOK() ) { - error( status, "Bad mesh input!!!"); + switch ( status ) { + case NG_SURFACE_INPUT_ERROR:error( status, "NG_SURFACE_INPUT_ERROR"); + case NG_VOLUME_FAILURE: error( status, "NG_VOLUME_FAILURE"); + case NG_STL_INPUT_ERROR: error( status, "NG_STL_INPUT_ERROR"); + case NG_SURFACE_FAILURE: error( status, "NG_SURFACE_FAILURE"); + case NG_FILE_NOT_FOUND: error( status, "NG_FILE_NOT_FOUND"); + }; } int Netgen_NbOfNodesNew = Ng_GetNP(Netgen_mesh); @@ -550,25 +560,24 @@ bool NETGENPlugin_NETGEN_3D::Compute(SMESH_Mesh& aMesh, // Feed back the SMESHDS with the generated Nodes and Volume Elements // ------------------------------------------------------------------- + if ( status == NG_VOLUME_FAILURE ) + { + SMESH_ComputeErrorPtr err = NETGENPlugin_Mesher::readErrors(nodeVec); + if ( err && !err->myBadElements.empty() ) + error( err ); + } + bool isOK = ( Netgen_NbOfTetra > 0 );// get whatever built if ( isOK ) { - // vector of nodes in which node index == netgen ID - vector< const SMDS_MeshNode* > nodeVec ( Netgen_NbOfNodesNew + 1 ); - // insert old nodes into nodeVec - for ( n_id = nodeToNetgenID.begin(); n_id != nodeToNetgenID.end(); ++n_id ) { - nodeVec.at( n_id->second ) = n_id->first; - } // create and insert new nodes into nodeVec + nodeVec.resize( Netgen_NbOfNodesNew + 1 ); int nodeIndex = Netgen_NbOfNodes + 1; for ( ; nodeIndex <= Netgen_NbOfNodesNew; ++nodeIndex ) { Ng_GetPoint( Netgen_mesh, nodeIndex, Netgen_point ); - SMDS_MeshNode * node = aHelper->AddNode(Netgen_point[0], - Netgen_point[1], - Netgen_point[2]); - nodeVec.at(nodeIndex) = node; + nodeVec.at(nodeIndex) = aHelper->AddNode(Netgen_point[0],Netgen_point[1],Netgen_point[2]); } // create tetrahedrons