Salome HOME
1) Remove obsolete staff (Netgen version < 4.9.13)
authorvsr <vsr@opencascade.com>
Thu, 28 Feb 2013 09:01:37 +0000 (09:01 +0000)
committervsr <vsr@opencascade.com>
Thu, 28 Feb 2013 09:01:37 +0000 (09:01 +0000)
2) Compatibility with Netgen 5.0

15 files changed:
adm_local/cmake_files/FindNETGEN.cmake
adm_local/unix/config_files/check_NETGEN.m4
configure.ac
src/GUI/NETGENPluginGUI_HypothesisCreator.cxx
src/Makefile.am
src/NETGEN/Makefile.am [deleted file]
src/NETGEN/ReadMeForNgUsers
src/NETGEN/netgen43ForSalome.patch [deleted file]
src/NETGEN/netgen45ForSalome.patch [deleted file]
src/NETGEN/netgen45lib64.patch [deleted file]
src/NETGEN/netgen50ForSalome.patch [new file with mode: 0644]
src/NETGENPlugin/Makefile.am
src/NETGENPlugin/NETGENPlugin_Mesher.cxx
src/NETGENPlugin/NETGENPlugin_NETGEN_2D_ONLY.cxx
src/NETGENPlugin/NETGENPlugin_NETGEN_3D.cxx

index 65dc9ee400dc830284d31dbcb5354fadf1b1fd9b..1b2209fb8515688862b2dc55eb32390d37f20948 100644 (file)
 SET(NETGENHOME $ENV{NETGENHOME})
 FIND_PATH(NETGEN_INCLUDES_DIR nglib.h ${NETGENHOME}/include)
 SET(NETGEN_INCLUDES)
-SET(NETGEN_INCLUDES ${NETGEN_INCLUDES} -I${NETGEN_INCLUDES_DIR})
+SET(NETGEN_INCLUDES ${NETGEN_INCLUDES} -I${NETGEN_INCLUDES_DIR} -I${NETGENHOME}/share/netgen/include)
 SET(NETGEN_INCLUDES ${NETGEN_INCLUDES} -DNO_PARALLEL_THREADS -DOCCGEOMETRY)
 
 FIND_LIBRARY(NETGEN_LIB_nglib nglib PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX)
 
-IF(NETGEN_LIB_nglib)
-  SET(NETGEN_NEW ON)
-  SET(NETGEN_INCLUDES ${NETGEN_INCLUDES} -I${NETGENHOME}/share/netgen/include -DNETGEN_NEW)
-ELSE(NETGEN_LIB_nglib)
-  SET(NETGEN_NEW OFF)
-ENDIF(NETGEN_LIB_nglib)
+# temporary, check to be added later
+SET(NETGEN_V5 OFF)
 
-IF(NETGEN_NEW)
-  SET(NETGEN_LIBS)
-  IF(WINDOWS)
+IF(NETGEN_V5)
+  SET(NETGEN_INCLUDES ${NETGEN_INCLUDES} -DNETGEN_V5)
+ENDIF(NETGEN_V5)
+
+SET(NETGEN_LIBS)
+IF(WINDOWS)
   FIND_LIBRARY(NETGEN_LIB_csg csg PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX)
   FIND_LIBRARY(NETGEN_LIB_gen gen PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX)
   FIND_LIBRARY(NETGEN_LIB_geom2d geom2d PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX)
@@ -53,30 +52,5 @@ IF(NETGEN_NEW)
   SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_mesh})
   SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_occ})
   SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_stl})
-  ENDIF(WINDOWS)
-  SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_nglib})
-ELSE(NETGEN_NEW)
-  FIND_LIBRARY(NETGEN_LIB_csg csg PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX)
-  FIND_LIBRARY(NETGEN_LIB_gen gen PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX)
-  FIND_LIBRARY(NETGEN_LIB_geom2d geom2d PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX)
-  FIND_LIBRARY(NETGEN_LIB_gprim gprim PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX)
-  FIND_LIBRARY(NETGEN_LIB_la la PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX)
-  FIND_LIBRARY(NETGEN_LIB_mesh mesh PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX)
-  FIND_LIBRARY(NETGEN_LIB_nginterface nginterface PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX)
-  FIND_LIBRARY(NETGEN_LIB_occ occ PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX)
-  FIND_LIBRARY(NETGEN_LIB_opti opti PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX)
-  FIND_LIBRARY(NETGEN_LIB_stlgeom stlgeom PATHS ${NETGENHOME}/lib ${NETGENHOME}/lib/LINUX)
-  SET(NETGEN_LIBS)
-  SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_csg})
-  SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_gen})
-  SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_geom2d})
-  SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_gprim})
-  SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_la})
-  SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_mesh})
-  SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_nginterface})
-  SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_occ})
-  SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_opti})
-  SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_stlgeom})
-ENDIF(NETGEN_NEW)
-
-SET(CMAKE_BUILD 1)
+ENDIF(WINDOWS)
+SET(NETGEN_LIBS ${NETGEN_LIBS} ${NETGEN_LIB_nglib})
index 2738aeb54cf8582f547117bfdb350d725368ce9e..5aa0eebe745e25eed7d36bbcd260ccae1a71b964 100644 (file)
@@ -24,233 +24,223 @@ AC_DEFUN([CHECK_NETGEN],[
 
 AC_REQUIRE([AC_PROG_CXX])dnl
 AC_REQUIRE([AC_PROG_CXXCPP])dnl
+AC_REQUIRE([CHECK_CAS])dnl
 
-AC_CHECKING(for Netgen 4.5 and higher Libraries)
+AC_CHECKING([for Netgen])
 
 AC_LANG_SAVE
 AC_LANG_CPLUSPLUS
 
-AC_ARG_WITH(netgen,
-           [  --with-netgen=DIR root directory path of NETGEN installation],
-           NETGEN_HOME=$withval,NETGEN_HOME="")
+AC_ARG_WITH([netgen],
+           [AC_HELP_STRING([--with-netgen=DIR], [root directory path to NETGEN library installation])],
+           [NETGEN_HOME=$withval],[NETGEN_HOME=yes])
 
 NETGEN_INCLUDES=""
-NETGEN_LIBS_DIR=""
 NETGEN_LIBS=""
-NETGEN_NEW=no
+NETGEN_V5=no
 
-Netgen_ok=no
-
-if test "x$NETGEN_HOME" == "x" ; then
+AC_SUBST(NETGEN_INCLUDES)
+AC_SUBST(NETGEN_LIBS)
 
-# no --with-netgen option used
-   if test "x$NETGENHOME" != "x" ; then
+Netgen_ok=no
 
-    # NETGENHOME environment variable defined
-      NETGEN_HOME=$NETGENHOME
+if test "x$NETGEN_HOME" = "x" -o "x$NETGEN_HOME" = "xyes" -o "x$NETGEN_HOME" = "xauto" ; then
+  # auto-detection
 
-   fi
-# 
+  if test "x$NETGENHOME" != "x" ; then
+    # - by environment variable NETGENHOME
+    NETGEN_HOME=$NETGENHOME
+  else
+    # - by searching NETGEN executables
+    AC_PATH_PROG([TEMP], [ng_stl])
+    if test "x$TEMP" != "x" ; then
+      NETGEN_BIN_DIR=`dirname $TEMP`
+      NETGEN_HOME=`dirname $NETGEN_BIN_DIR`
+    else
+      NETGEN_HOME=""
+    fi
+  fi 
 fi
 
-if test "x$NETGEN_HOME" != "x"; then
+echo NETGEN_HOME=$NETGEN_HOME
 
-  if test -f ${NETGEN_HOME}/lib/libnglib.so ; then
-    NETGEN_NEW=yes  
-  fi
+if test "x$NETGEN_HOME" != "x"; then
 
-  echo ----------------------------------------------------------
   echo ----------------------------------------------------------
   echo You are about to choose to use somehow the
   echo Netgen Library to generate Tetrahedric mesh.
-  echo ----------------------------------------------------------
-  echo ----------------------------------------------------------
+  echo
   echo You are strongly advised to consult the file
   echo NETGENPLUGIN_SRC/src/NETGEN/ReadMeForNgUsers, particularly
   echo about assumptions made on the installation of the Netgen
   echo application and libraries.
   echo ----------------------------------------------------------
-  echo ----------------------------------------------------------
-
-  NETGEN_INCLUDES="-I${NETGEN_HOME}/include"
 
-  if test "$NETGEN_NEW" = "yes" ; then
-    NETGEN_INCLUDES="${NETGEN_INCLUDES} -DNETGEN_NEW -I${NETGEN_HOME}/share/netgen/include"
-  fi
-
-  # check ${NETGEN_HOME}/lib/LINUX directory for libraries
-  if test -f ${NETGEN_HOME}/lib/LINUX/libcsg.a ; then
-       NETGEN_LIBS_DIR="${NETGEN_HOME}/lib/LINUX"
-  else
-       # check ${NETGEN_HOME}/lib/LINUX64 directory for libraries
-       if test -f ${NETGEN_HOME}/lib/LINUX64/libcsg.a ; then
-               NETGEN_LIBS_DIR="${NETGEN_HOME}/lib/LINUX64"
-       else
-               NETGEN_LIBS_DIR="${NETGEN_HOME}/lib"
-       fi
-  fi
-
-  echo "NETGEN_LIBS_DIR = $NETGEN_LIBS_DIR"
+  NETGEN_INCLUDES="-I${NETGEN_HOME}/include -I${NETGEN_HOME}/share/netgen/include"
+  NETGEN_LIBS="-L${NETGEN_HOME}/lib -lnglib"
   
+  dnl check Netgen headers availability 
+
   CPPFLAGS_old="$CPPFLAGS"
   CXXFLAGS_old="$CXXFLAGS"
   CPPFLAGS="$CAS_CPPFLAGS $NETGEN_INCLUDES $CPPFLAGS"
-  CXXFLAGS="$CAS_CPPFLAGS $NETGEN_INCLUDES $CXXFLAGS"
-
-  AC_MSG_CHECKING(for Netgen header file)
-
-  AC_CHECK_HEADER(nglib.h,Netgen_ok=yes,Netgen_ok=no)
-  if test "x$Netgen_ok" == "xyes"; then
-
-    if test "$NETGEN_NEW" = "no" ; then
-
-    AC_MSG_CHECKING(for Netgen libraries)
-
-    LIBS_old="$LIBS"
-    LIBS="-L. -lNETGEN $CAS_LDPATH -lTKernel -lTKMath -lTKG3d -lTKBRep -lTKShHealing -lTKSTEP -lTKXSBase -lTKIGES -lTKSTL -lTKTopAlgo $LIBS"
-
-    AC_TRY_COMPILE(#include <iostream>
-#include <fstream>
-namespace nglib {
-#include "nglib.h"
-}
-#define OCCGEOMETRY
-#include <occgeom.hpp>
-,nglib::Ng_Init();
- netgen::OCCGeometry occgeo;
- nglib::Ng_Exit();,Netgen_ok=yes;ar x "$NETGEN_LIBS_DIR/libnginterface.a";
-           ar x "$NETGEN_LIBS_DIR/libocc.a";
-            ar x "$NETGEN_LIBS_DIR/libcsg.a";
-            ar x "$NETGEN_LIBS_DIR/libgprim.a";
-            ar x "$NETGEN_LIBS_DIR/libmesh.a";
-            ar x "$NETGEN_LIBS_DIR/libopti.a";
-            ar x "$NETGEN_LIBS_DIR/libgen.a";
-            ar x "$NETGEN_LIBS_DIR/libla.a";
-            ar x "$NETGEN_LIBS_DIR/libstlgeom.a";
-            ar x "$NETGEN_LIBS_DIR/libgeom2d.a";
-            $CXX -shared linopt.o bfgs.o linsearch.o global.o bisect.o meshtool.o refine.o ruler3.o improve3.o adfront3.o tetrarls.o prism2rls.o profiler.o pyramidrls.o pyramid2rls.o netrule3.o ruler2.o meshclass.o improve2.o adfront2.o netrule2.o triarls.o geomsearch.o secondorder.o meshtype.o parser3.o quadrls.o specials.o parser2.o meshing2.o meshing3.o meshfunc.o localh.o improve2gen.o delaunay.o boundarylayer.o msghandler.o meshfunc2d.o smoothing2.o smoothing3.o topology.o curvedelems_new.o clusters.o zrefine.o ngexception.o geomtest3d.o geom2d.o geom2dmesh.o geom3d.o adtree.o transform3d.o geomfuncs.o polynomial.o densemat.o vector.o basemat.o sparsmat.o algprim.o brick.o manifold.o bspline2d.o meshsurf.o csgeom.o polyhedra.o curve2d.o singularref.o edgeflw.o solid.o explicitcurve2d.o specpoin.o gencyl.o revolution.o genmesh.o genmesh2d.o spline3d.o surface.o identify.o triapprox.o meshstlsurface.o stlline.o stltopology.o stltool.o stlgeom.o stlgeomchart.o stlgeommesh.o table.o optmem.o spbita2d.o hashtabl.o sort.o flags.o seti.o bitarray.o array.o symbolta.o mystring.o moveablemem.o spline.o splinegeometry.o ngnewdelete.o nglib.o hprefinement.o Partition_Inter2d.o Partition_Loop.o Partition_Loop3d.o Partition_Inter3d.o Partition_Loop2d.o Partition_Spliter.o occgeom.o occgenmesh.o occmeshsurf.o -o libNETGEN.so;
-            rm -rf linopt.o bfgs.o linsearch.o global.o bisect.o meshtool.o refine.o ruler3.o improve3.o adfront3.o tetrarls.o prism2rls.o profiler.o pyramidrls.o pyramid2rls.o netrule3.o ruler2.o meshclass.o improve2.o adfront2.o netrule2.o triarls.o geomsearch.o secondorder.o meshtype.o parser3.o quadrls.o specials.o parser2.o meshing2.o meshing3.o meshfunc.o localh.o improve2gen.o delaunay.o boundarylayer.o msghandler.o meshfunc2d.o smoothing2.o smoothing3.o topology.o curvedelems_new.o clusters.o zrefine.o ngexception.o geomtest3d.o geom2d.o geom2dmesh.o geom3d.o adtree.o transform3d.o geomfuncs.o polynomial.o densemat.o vector.o basemat.o sparsmat.o algprim.o brick.o manifold.o bspline2d.o meshsurf.o csgeom.o polyhedra.o curve2d.o singularref.o edgeflw.o solid.o explicitcurve2d.o specpoin.o gencyl.o revolution.o genmesh.o genmesh2d.o spline3d.o surface.o identify.o triapprox.o meshstlsurface.o stlline.o stltopology.o stltool.o stlgeom.o stlgeomchart.o stlgeommesh.o table.o optmem.o spbita2d.o hashtabl.o sort.o flags.o seti.o bitarray.o array.o symbolta.o mystring.o moveablemem.o spline.o splinegeometry.o ngnewdelete.o nglib.o hprefinement.o Partition_Inter2d.o Partition_Loop.o Partition_Loop3d.o Partition_Inter3d.o Partition_Loop2d.o Partition_Spliter.o occgeom.o occgenmesh.o occmeshsurf.o csgparser.o dynamicmem.o extrusion.o occconstruction.o parthreads.o readuser.o writeabaqus.o writediffpack.o writeelmer.o writefeap.o writefluent.o writegmsh.o writejcm.o writepermas.o writetecplot.o writetochnog.o writeuser.o wuchemnitz.o,
-            Netgen_ok=no)
-
-    AC_CACHE_VAL(salome_cv_netgen_lib,[
-                 AC_TRY_LINK([
+  CXXFLAGS="$CAS_CXXFLAGS $NETGEN_INCLUDES $CXXFLAGS"
+
+  AC_MSG_CHECKING([for Netgen header file])
+
+  AC_CHECK_HEADER([nglib.h], [Netgen_ok=yes], [Netgen_ok=no])
+
+  dnl check Netgen libraries
+
+  LIBS_old="$LIBS"
+  LIBS="$NETGEN_LIBS $CAS_LDPATH -lTKernel -lTKMath -lTKG3d -lTKBRep -lTKShHealing -lTKSTEP -lTKXSBase -lTKIGES -lTKSTL -lTKTopAlgo -lTKGeomBase $LIBS"
+
+  if test "x$Netgen_ok" = "xyes"; then
+
+    AC_MSG_CHECKING([for Netgen libraries])
+
+    AC_CACHE_VAL([salome_cv_netgen_lib],
+                 [AC_TRY_LINK(
+                   [
                      #include <iostream>
                      #include <fstream>
                      namespace nglib {
                      #include "nglib.h"
                      }
-                     #define OCCGEOMETRY
-                     #include <occgeom.hpp>
-                  ],[
+                   ],
+                   [
                      nglib::Ng_Init();
-                     netgen::OCCGeometry occgeo;
                      nglib::Ng_Exit();
-                  ],
-                  [eval "salome_cv_netgen_lib=yes";rm -rf libNETGEN.so],
-                  [eval "salome_cv_netgen_lib=no";rm -rf libNETGEN.so])
-    ])
+                   ],
+                   [eval "salome_cv_netgen_lib=yes"],
+                   [eval "salome_cv_netgen_lib=no"])
+                 ])
+
     Netgen_ok="$salome_cv_netgen_lib"
 
-    else
+  fi
+
+  dnl check if Netgen of v5 or v4
 
-      LIBS_old="$LIBS"
-      LIBS="-L${NETGEN_LIBS_DIR} -lnglib $CAS_LDPATH -lTKernel -lTKMath -lTKG3d -lTKBRep -lTKShHealing -lTKSTEP -lTKXSBase -lTKIGES -lTKSTL -lTKTopAlgo -lTKGeomBase $LIBS"
-
-      AC_MSG_CHECKING(for official Netgen libraries)
-      AC_CACHE_VAL(salome_cv_netgen_lib,[
-      AC_TRY_LINK([
-      #include <iostream>
-      #include <fstream>
-      namespace nglib {
-      #include "nglib.h"
-      }
-      ],[
-      nglib::Ng_Init();
-      nglib::Ng_Exit();
-      ],
-      [eval "salome_cv_netgen_lib=yes"],
-      [eval "salome_cv_netgen_lib=no"])
-      ])
-      Netgen_ok="$salome_cv_netgen_lib"
-
-      if test "$Netgen_ok" = "yes" ; then
-      AC_MSG_RESULT(yes)
-      AC_MSG_CHECKING(for occ support in Netgen libraries)
-      AC_CACHE_VAL(salome_cv_netgen_occ_lib,[
-      AC_TRY_LINK([
-      #include <iostream>
-      #include <fstream>
-      #define OCCGEOMETRY
-      namespace nglib {
-      #include "nglib.h"
-      }
-      ],[
-      nglib::Ng_Init();
-      nglib::Ng_OCC_Geometry * ng_occ_geom = nglib::Ng_OCC_NewGeometry();
-      nglib::Ng_Exit();
-      ],
-      [eval "salome_cv_netgen_occ_lib=yes"],
-      [eval "salome_cv_netgen_occ_lib=no"])
-      ])
-      Netgen_ok="$salome_cv_netgen_occ_lib"
-      fi
-
-      if test "$Netgen_ok" = "yes" ; then
-      AC_MSG_RESULT(yes)
-      AC_MSG_CHECKING(for salome patch in Netgen installation)
-      AC_CACHE_VAL(salome_cv_netgen_salome_patch_lib,[
-      AC_TRY_LINK([
-      #include <iostream>
-      #include <fstream>
-      #define OCCGEOMETRY
-      namespace nglib {
-      #include "nglib.h"
-      }
-      #include <occgeom.hpp>
-      ],[
-      nglib::Ng_Init();
-      netgen::OCCGeometry occgeo;
-      nglib::Ng_Exit();
-      ],
-      [eval "salome_cv_netgen_salome_patch_lib=yes"],
-      [eval "salome_cv_netgen_salome_patch_lib=no"])
-      ])
-      Netgen_ok="$salome_cv_netgen_salome_patch_lib"
-      fi
-
-      if test "x$Netgen_ok" == xno ; then
-      AC_MSG_RESULT(no)
-      AC_MSG_ERROR(Netgen is not properly installed. Read NETGENPLUGIN_SRC/src/NETGEN/ReadMeForNgUsers for details.)
-      fi
-
-      NETGEN_LIBS="-L${NETGEN_LIBS_DIR} -lnglib"
+  if test "$Netgen_ok" = "yes" ; then
 
+    AC_MSG_RESULT([yes])
+
+    AC_MSG_CHECKING([Netgen version])
+
+    AC_CACHE_VAL([salome_cv_netgen_v5_lib],
+                 [AC_TRY_LINK(
+                   [
+                     #include <iostream>
+                     #include <fstream>
+                     #define OCCGEOMETRY
+                     namespace nglib {
+                     #include "nglib.h"
+                     }
+                     #include <occgeom.hpp>
+                   ],
+                   [
+                     nglib::Ng_Init();
+                     netgen::Mesh* ngMesh;
+                     ngMesh->CalcLocalH(1.0);
+                     nglib::Ng_Exit();
+                   ],
+                   [eval "salome_cv_netgen_v5_lib=yes"],
+                   [eval "salome_cv_netgen_v5_lib=no"])
+                 ])
+
+    if test "x$salome_cv_netgen_v5_lib" = "xyes" ; then
+      NETGEN_V5=yes
     fi
+  fi
+
+  dnl check OCCT support in Netgen
+
+  if test "$Netgen_ok" = "yes" ; then
+
+    AC_MSG_RESULT([yes])
+
+    AC_MSG_CHECKING([for OCCT support in Netgen library])
+
+    AC_CACHE_VAL([salome_cv_netgen_occ_lib],
+                 [AC_TRY_LINK(
+                   [
+                     #include <iostream>
+                     #include <fstream>
+                     #define OCCGEOMETRY
+                     namespace nglib {
+                     #include "nglib.h"
+                     }
+                   ],
+                   [
+                     nglib::Ng_Init();
+                     nglib::Ng_OCC_Geometry* ng_occ_geom = nglib::Ng_OCC_NewGeometry();
+                     nglib::Ng_Exit();
+                   ],
+                   [eval "salome_cv_netgen_occ_lib=yes"],
+                   [eval "salome_cv_netgen_occ_lib=no"])
+                 ])
+
+    Netgen_ok="$salome_cv_netgen_occ_lib"
 
-    LIBS="$LIBS_old"
   fi
 
+  dnl check SALOME patch in Netgen
+
+  if test "$Netgen_ok" = "yes" ; then
+
+    AC_MSG_RESULT([yes])
+
+    AC_MSG_CHECKING([for SALOME patch in Netgen library])
+
+    AC_CACHE_VAL([salome_cv_netgen_salome_patch_lib],
+                 [AC_TRY_LINK(
+                   [
+                     #include <iostream>
+                     #include <fstream>
+                     #define OCCGEOMETRY
+                     namespace nglib {
+                     #include "nglib.h"
+                     }
+                     #include <occgeom.hpp>
+                   ],
+                   [
+                     nglib::Ng_Init();
+                     netgen::OCCGeometry occgeo;
+                     nglib::Ng_Exit();
+                   ],
+                   [eval "salome_cv_netgen_salome_patch_lib=yes"],
+                   [eval "salome_cv_netgen_salome_patch_lib=no"])
+                 ])
+
+    Netgen_ok="$salome_cv_netgen_salome_patch_lib"
+    
+  fi
+
+  LIBS="$LIBS_old"
   CPPFLAGS="$CPPFLAGS_old"
   CXXFLAGS="$CXXFLAGS_old"
 
-  if test "x$Netgen_ok" == xno ; then
-    AC_MSG_RESULT(no)
-    AC_MSG_ERROR(Netgen libraries not found or not properly installed)
+fi
+
+if test "x$Netgen_ok" = xyes ; then
+
+  AC_MSG_RESULT([yes])
+
+  if test "x$NETGEN_V5" = "xyes" ; then
+    AC_MSG_RESULT([Netgen is of version 5.0 or newer])
+    NETGEN_INCLUDES="$NETGEN_INCLUDES -DNETGEN_V5"
   else
-    AC_MSG_RESULT(yes)
+    AC_MSG_RESULT([Netgen is of version 4.9.13 or older])
   fi
 
 else
 
-    AC_MSG_ERROR(Netgen libraries not found. Please define NETGENHOME or use --with-netgen option)
+  AC_MSG_RESULT([no])
+  AC_MSG_ERROR([Netgen is not properly installed. Read NETGENPLUGIN_SRC/src/NETGEN/ReadMeForNgUsers for more details.])
 
 fi
 
-AC_SUBST(NETGEN_INCLUDES)
-AC_SUBST(NETGEN_LIBS_DIR)
-AC_SUBST(NETGEN_LIBS)
-AM_CONDITIONAL(NETGEN_NEW, [test x"$NETGEN_NEW" = x"yes"])
-
 AC_LANG_RESTORE
 
 ])dnl
index 625f85275ff6a8421b313c118a68af4bbdf0d8b3..391a27b0ce131ce4bd40a324a58d40569649c2b7 100644 (file)
@@ -450,7 +450,6 @@ AC_OUTPUT([ \
   doc/salome/gui/NETGENPLUGIN/static/header_py.html \
   src/Makefile \
   src/GUI/Makefile \
-  src/NETGEN/Makefile \
   src/NETGENPlugin/Makefile \
   resources/Makefile \
   idl/Makefile \
index 408b01fe64c47c9a2395d52dd15790f52dbfa8ee..36772a796b756a628d59edc9deb0ca1416d79738 100644 (file)
@@ -79,9 +79,7 @@ enum {
   LSZ_BTNS = 0,
   LSZ_VERTEX_BTN,
   LSZ_EDGE_BTN,
-#ifdef NETGEN_NEW
   LSZ_FACE_BTN,
-#endif
   LSZ_SEPARATOR2,
   LSZ_REMOVE_BTN
 };
@@ -241,10 +239,8 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame()
     localSizeLayout->addWidget(addVertexButton, LSZ_VERTEX_BTN, 1, 1, 1);
     QPushButton* addEdgeButton = new QPushButton(tr("NETGEN_LSZ_EDGE"), localSizeGroup);
     localSizeLayout->addWidget(addEdgeButton, LSZ_EDGE_BTN, 1, 1, 1);
-#ifdef NETGEN_NEW
     QPushButton* addFaceButton = new QPushButton(tr("NETGEN_LSZ_FACE"), localSizeGroup);
     localSizeLayout->addWidget(addFaceButton, LSZ_FACE_BTN, 1, 1, 1);
-#endif
 
     QFrame *line2 = new QFrame(localSizeGroup);
     line2->setFrameShape(QFrame::HLine);
@@ -256,9 +252,7 @@ QFrame* NETGENPluginGUI_HypothesisCreator::buildFrame()
 
     connect( addVertexButton, SIGNAL(clicked()), this, SLOT(onAddLocalSizeOnVertex()));
     connect( addEdgeButton, SIGNAL(clicked()), this, SLOT(onAddLocalSizeOnEdge()));
-#ifdef NETGEN_NEW
     connect( addFaceButton, SIGNAL(clicked()), this, SLOT(onAddLocalSizeOnFace()));
-#endif
     connect( removeButton, SIGNAL(clicked()), this, SLOT(onRemoveLocalSizeOnShape()));
     connect( myLocalSizeTable, SIGNAL(cellChanged(int, int)), this, SLOT(onSetLocalSize(int, int)));
 
index 0b988a725a07f5bd214190deb77f596eb4f5a2af..40da73d9d98965d8b95c763d865496f7e39f9b34 100644 (file)
 #
 include $(top_srcdir)/adm_local/unix/make_common_starter.am
 
-SUBDIRS =
-if CMAKE_BUILD
-else
-if NETGEN_NEW
-else
-  SUBDIRS += NETGEN
-endif
-endif
-SUBDIRS += NETGENPlugin
+SUBDIRS = NETGENPlugin
 
 if NETGENPLUGIN_ENABLE_GUI
   SUBDIRS += GUI
 endif
 
-DIST_SUBDIRS = NETGEN NETGENPlugin GUI
+DIST_SUBDIRS = NETGENPlugin GUI
diff --git a/src/NETGEN/Makefile.am b/src/NETGEN/Makefile.am
deleted file mode 100644 (file)
index c494321..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-# Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-# -* Makefile *- 
-# Author : Edward AGAPOV (OCC)
-#  Modified by : Alexander BORODIN (OCN) - autotools usage
-# Module : NETGENPLUGIN
-# Date : 10/01/2004
-#
-include $(top_srcdir)/adm_local/unix/make_common_starter.am
-
-# build .so of NETGEN itself
-
-lib_LTLIBRARIES = libNETGEN.la
-
-LIB_OBJ_O = \
-       linopt.o bfgs.o linsearch.o global.o bisect.o meshtool.o refine.o ruler3.o \
-       improve3.o adfront3.o tetrarls.o prism2rls.o profiler.o pyramidrls.o pyramid2rls.o \
-       netrule3.o ruler2.o meshclass.o improve2.o adfront2.o netrule2.o triarls.o geomsearch.o \
-       secondorder.o meshtype.o parser3.o quadrls.o specials.o parser2.o meshing2.o meshing3.o \
-       meshfunc.o localh.o improve2gen.o delaunay.o boundarylayer.o msghandler.o \
-       meshfunc2d.o smoothing2.o smoothing3.o topology.o curvedelems_new.o clusters.o zrefine.o \
-       ngexception.o geomtest3d.o geom2d.o geom2dmesh.o geom3d.o adtree.o transform3d.o geomfuncs.o \
-       polynomial.o densemat.o vector.o basemat.o sparsmat.o algprim.o brick.o manifold.o bspline2d.o \
-       meshsurf.o csgeom.o polyhedra.o curve2d.o singularref.o edgeflw.o solid.o explicitcurve2d.o \
-       specpoin.o gencyl.o revolution.o genmesh.o genmesh2d.o spline3d.o surface.o identify.o \
-       triapprox.o meshstlsurface.o stlline.o stltopology.o stltool.o stlgeom.o stlgeomchart.o \
-       stlgeommesh.o table.o optmem.o spbita2d.o hashtabl.o sort.o flags.o seti.o bitarray.o \
-       array.o symbolta.o mystring.o moveablemem.o spline.o splinegeometry.o ngnewdelete.o nglib.o \
-       hprefinement.o Partition_Inter2d.o Partition_Loop.o Partition_Loop3d.o Partition_Inter3d.o \
-       Partition_Loop2d.o Partition_Spliter.o occgeom.o occgenmesh.o occmeshsurf.o
-
-NETGEN_LIBS_DIR=@NETGEN_LIBS_DIR@
-
-$(LIB_OBJ_O):
-       ar x $(NETGEN_LIBS_DIR)/libnginterface.a
-       ar x $(NETGEN_LIBS_DIR)/libocc.a
-       ar x $(NETGEN_LIBS_DIR)/libcsg.a
-       ar x $(NETGEN_LIBS_DIR)/libgprim.a
-       ar x $(NETGEN_LIBS_DIR)/libmesh.a
-       ar x $(NETGEN_LIBS_DIR)/libopti.a
-       ar x $(NETGEN_LIBS_DIR)/libgen.a
-       ar x $(NETGEN_LIBS_DIR)/libla.a
-       ar x $(NETGEN_LIBS_DIR)/libstlgeom.a
-       ar x $(NETGEN_LIBS_DIR)/libgeom2d.a
-       rm -rf csgparser.o dynamicmem.o extrusion.o occconstruction.o parthreads.o readuser.o writeabaqus.o writediffpack.o writeelmer.o writefeap.o writefluent.o writegmsh.o writejcm.o writepermas.o writetecplot.o writetochnog.o writeuser.o wuchemnitz.o
-
-#LIB_OBJ_LO = $(LIB_OBJ_O:%.o=%.lo)
-#%.lo: %.o; @ln -s $< $@
-
-nodist_libNETGEN_la_SOURCES =
-
-libNETGEN_la_LDFLAGS  = $(LIB_OBJ_O) \
-       $(CAS_LDPATH) -lTKernel -lTKBRep -lTKShHealing -lTKSTEP -lTKXSBase -lTKIGES -lTKMesh -lTKSTL $(FCLIBS) $(STDLIB)
-
-libNETGEN_la_DEPENDENCIES = $(LIB_OBJ_O)
-
-EXTRA_DIST += \
-       ReadMeForNgUsers        \
-       netgen43ForSalome.patch \
-       netgen45ForSalome.patch \
-       netgen45lib64.patch
index 7d982a80803a6d56266c830bfa6ce2cfc4de690f..85d4f3f9084bb6e1fd3ca0b87e8f29bddbf04df5 100644 (file)
 # ------------------------------------------------------------------
 # ------------------------------------------------------------------
-# Notes for Netgen >= 4.9
+# Notes for Netgen >= 4.9.13
 # ------------------------------------------------------------------
 # ------------------------------------------------------------------
 
-Netgen can be find at http://www.hpfem.jku.at/netgen/
+Netgen home page: http://sourceforge.net/apps/mediawiki/netgen-mesher.
 
-1. How to build Netgen for Netgen Plugin
-------------------------------
+1. Minimal requirements
 
-1.1. Download Netgen archive (here netgen-4.9.12.tar.gz) and unpack it
+Minimal version of Netgen required for SALOME is 4.9.13.
 
-1.2. Configure the netgen compilation. The "good" options are
-     ../netgen-4.9.12/configure \ 
-        --prefix=THE_INSTALLATION_PATH \
-        --with-occ=${CASROOT} \
-        CXXFLAGS="-I${TOGL_HOME}/include" \
-        LDFLAGS="-L${TOGL_HOME}/lib/Togl1.7"
+2. How to build Netgen for SALOME NETGEN Plugin
+-----------------------------------------
 
-1.3. Compile the netgen product
-     make then make install
+2.1. Download Netgen archive (here netgen-4.9.13.tar.gz) and unpack it
 
-1.4. Patch the installation directory to copy include files
-     needed by NETGEN Plugin. Use the script
-     NETGENPLUGIN_SRC/src/NETGEN/netgen_copy_include_for_salome
-     to achieve that. The first argument is the directory containing
-     the Netgen sources. The second argument is THE_INSTALLATION_PATH
-
-Erwan ADAM
-erwan.adam@cea.fr
-
-# ------------------------------------------------------------------
-# ------------------------------------------------------------------
-# Notes for Netgen 4.5
-# ------------------------------------------------------------------
-# ------------------------------------------------------------------
-
-The Netgen 4.5 from the web location : http://www.hpfem.jku.at/netgen/
-(CVS access) is used in the SMESH Module of Salome3 distribution.
-
-1. How to build Netgen for Salome
-------------------------------
-
-1.1. Download Netgen 4.5 from the NETGEN home site (see above).
-
-1.2. Unpack the downloaded Netgen 4.5 archive 
-     (hereafter we assume that this is netgen45 directory)
-
-1.3. Patch the netgen 4.5 distribution for SALOME:
-
-$ cd netgen45
-$ patch -p1 < patch_directory/netgen45ForSalome.patch
-
-1.4. For 64-bit platform you also need to apply another patch:
-
-$ cd netgen45
-$ patch -p1 < patch_directory/netgen45lib64.patch
-
-1.5. Set CASROOT environment variable to OCCT installation path,
-     since Netgen 4.5 requires Open CASCADE Technology:
+2.2. Patch the Netgen distribution for SALOME
 
-$ setenv CASROOT <occt_installation_path>
+       $ cd netgen45
+       $ patch -p1 < patch_directory/netgen49ForSalome.patch
 
-1.6. Compile and install netgen 4.5. To do this, simply run 
-     makeForSalome.sh script (it is created from the patch):
+     Note that patch corresponds to the version of Netgen you use.
+     For example, netgen49ForSalome.patch mentioned above is a patch
+     file for Netgen 4.9.13. The patch for Netgen can be found in
+     NETGENPLUGIN_SRC/src/NETGEN directory.
 
-$ sh makeForSalome.sh
+2.3. Configure the netgen compilation. For example
 
+       $ cd netgen-4.9.13
+       $ ./configure --prefix=THE_INSTALLATION_PATH \
+         --with-occ=${CASROOT} \
+         --with-tcl=${TCLHOME}/lib --with-tk=${TCLHOME}/lib \
+         --with-tclinclude=${TCLHOME}/include
 
-2. Additional information for maintainers
---------------------------------------
+     Note that Netgen depends on some products like Open CASCADE
+     Technology and Tcl/Tk. These products should be specified
+     to the configure script via options.
 
-The file check_NETGEN.m4 assumes that Netgen is installed in 
-the directory <netgen_installation_path> as follow:
+2.4. Compile the netgen product
+       $ make 
+       $ make install
 
-prompt> ls <netgen_installation_path>
-
-include/  lib/
-
-prompt> ls <netgen_installation_path>/include
-
-adfront2.hpp        explicitcurve2d.hpp  hpref_quad.hpp      myadt.hpp        spbita2d.hpp
-adfront3.hpp        extrusion.hpp        hpref_segm.hpp      mydefs.hpp       specials.hpp
-adtree.hpp          findip.hpp           hpref_tet.hpp       mystdlib.h       specpoin.hpp
-algprim.hpp         findip2.hpp          hpref_trig.hpp      mystring.hpp     spline.hpp
-array.hpp           flags.hpp            hprefinement.hpp    ngexception.hpp  spline2d.hpp
-autoptr.hpp         gencyl.hpp           identify.hpp        nglib.h          spline3d.hpp
-basemat.hpp         geom2d.hpp           improve2.hpp        occgeom.hpp      splinegeometry.hpp
-bisect.hpp          geom2dmesh.hpp       improve3.hpp        occmeshsurf.hpp  splinegeometry2.hpp
-bitarray.hpp        geom3d.hpp           linalg.hpp          opti.hpp         stack.hpp
-boundarylayer.hpp    geometry2d.hpp      localh.hpp          optmem.hpp       stlgeom.hpp
-brick.hpp           geomfuncs.hpp        manifold.hpp        parthreads.hpp   stlline.hpp
-classifyhpel.hpp     geoml.hpp           meshclass.hpp       polyhedra.hpp    stltool.hpp
-clusters.hpp        geomobjects.hpp      meshfunc.hpp        polynomial.hpp   stltopology.hpp
-csg.hpp                     geomops.hpp          meshing.hpp         profiler.hpp     surface.hpp
-csgeom.hpp          geomsearch.hpp       meshing2.hpp        revolution.hpp   symbolta.hpp
-csgparser.hpp       geomtest3d.hpp       meshing3.hpp        ruler2.hpp       table.hpp
-curve2d.hpp         global.hpp           meshstlsurface.hpp  ruler3.hpp       template.hpp
-curvedelems.hpp      gprim.hpp           meshsurf.hpp        seti.hpp         topology.hpp
-curvedelems_new.hpp  hashtabl.hpp        meshtool.hpp        singularref.hpp  transform3d.hpp
-densemat.hpp        hpref_hex.hpp        meshtype.hpp        solid.hpp        triapprox.hpp
-dynamicmem.hpp      hpref_prism.hpp      moveablemem.hpp     sort.hpp         vector.hpp
-edgeflw.hpp         hpref_pyramid.hpp    msghandler.hpp      sparsmat.hpp
-
-prompt> ls <netgen_installation_path>/lib
-
-libcsg.a  libgeom2d.a  libla.a   libnginterface.a  libopti.a
-libgen.a  libgprim.a   libmesh.a  libocc.a         libstlgeom.a
-
-The library files can be also installed in the LINUX or LINUX64
-subfolder of the lib directory.
-
-All the libraries *.a should be compiled without the option -DOPENGL.
-netgen45 is assumed to be the directory downloaded from the above web
-location archive of Netgen. The library 
-<netgen_installation_path>/lib/libnginterface.a should contain the objects
-nglib.o (from netgen45/libsrc/interface/nglib.cpp) and ngnewdelete.o
-(from netgen45/ngtcltk/ngnewdelete.cpp).
-
-To have that kind of distribution from the version in the above web location you
-need not to compile Netgen as suggested in the netgen45/README.INSTALL file.
-Simply modify the Makefiles to remove -DOPENGL from compiler flags
-list and to add OCC include dir and flags to compiler flags, add the objects
-nglib.o and ngnewdelete.o to the library libnginterface.a and
-recompile the libraries only.
-All this job is done by applying the patch and running the script makeForSalome.sh.
-
-The suggested patch alters some Netgen sources to compile them.
-
-Michael SAZONOV
-m-sazonov@opencascade.com
-
-# ------------------------------------------------------------------
-# ------------------------------------------------------------------
-# ------------------------------------------------------------------
-# ------------------------------------------------------------------
+2.5. Patch the installation directory by copying include files
+     needed by NETGEN Plugin. Use the script
+     NETGENPLUGIN_SRC/src/NETGEN/netgen_copy_include_for_salome
+     to achieve that. The first argument is the directory containing
+     the Netgen sources. The second argument is THE_INSTALLATION_PATH
diff --git a/src/NETGEN/netgen43ForSalome.patch b/src/NETGEN/netgen43ForSalome.patch
deleted file mode 100644 (file)
index 5e08d88..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-diff -N -r -u netgen43/libsrc/include/spline2d.hpp /tmp/netgen43/libsrc/include/spline2d.hpp
---- netgen43/libsrc/include/spline2d.hpp       1970-01-01 01:00:00.000000000 +0100
-+++ /tmp/netgen43/libsrc/include/spline2d.hpp  2003-12-10 16:28:12.000000000 +0100
-@@ -0,0 +1 @@
-+#include "../geom2d/spline2d.hpp"
-diff -N -r -u netgen43/libsrc/include/splinegeometry2.hpp /tmp/netgen43/libsrc/include/splinegeometry2.hpp
---- netgen43/libsrc/include/splinegeometry2.hpp        1970-01-01 01:00:00.000000000 +0100
-+++ /tmp/netgen43/libsrc/include/splinegeometry2.hpp   2003-12-10 16:28:23.000000000 +0100
-@@ -0,0 +1 @@
-+#include "../geom2d/splinegeometry2.hpp"
-diff -N -r -u netgen43/libsrc/interface/Makefile /tmp/netgen43/libsrc/interface/Makefile
---- netgen43/libsrc/interface/Makefile 2003-05-07 16:01:43.000000000 +0200
-+++ /tmp/netgen43/libsrc/interface/Makefile    2003-12-10 15:59:47.000000000 +0100
-@@ -1,4 +1,4 @@
--src = nginterface.cpp writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.cpp readuser.cpp importsolution.cpp
-+src = writeuser.cpp writediffpack.cpp writeabaqus.cpp writefluent.cpp writepermas.cpp writetochnog.cpp writetecplot.cpp wuchemnitz.cpp writetochnog.cpp writefeap.cpp readuser.cpp importsolution.cpp nglib.cpp ngnewdelete.cpp
- #
- lib = nginterface
- libpath = libsrc/interface
-diff -N -r -u netgen43/libsrc/interface/nglib.cpp /tmp/netgen43/libsrc/interface/nglib.cpp
---- netgen43/libsrc/interface/nglib.cpp        2003-05-07 16:01:43.000000000 +0200
-+++ /tmp/netgen43/libsrc/interface/nglib.cpp   2003-12-10 16:32:54.000000000 +0100
-@@ -23,6 +23,20 @@
- #include "nglib.h"
-+namespace netgen
-+{
-+  char geomfilename [100];
-+
-+  //Destination for messages, errors, ...
-+  void Ng_PrintDest(const char * s)
-+  {
-+    (*mycout) << s << flush;
-+  }
-+
-+#include <spline2d.hpp>
-+#include <splinegeometry2.hpp>
-+}
-+
- using namespace netgen;
- // constants and types:
-@@ -171,8 +185,6 @@
- // CSG Geometry
- // FlexLexer * lexer;
--char geomfilename [100];
--
- // 2D Meshing Functions:
-@@ -362,7 +374,18 @@
-         cout << "e(" << readedges.Get(i) << "," << readedges.Get(i+1) << ")" << endl;
-       }
-       */
--      geo->AddEdges(readedges);
-+
-+      ARRAY< Point<3> > readedges1;
-+
-+      for (i = 1; i <= readedges.Size(); i++)
-+      {
-+        Point3d readedgesData = readedges.Get(i);
-+        Point <3> readedges1Data = Point<3>(readedgesData.X(),readedgesData.Y(),readedgesData.Z());
-+
-+        readedges1.Append(readedges1Data);
-+      }
-+
-+      geo->AddEdges(readedges1);
-     }
-   if (geo->GetStatus() == STLTopology::STL_GOOD || geo->GetStatus() == STLTopology::STL_WARNING) return NG_OK;
-@@ -472,7 +495,14 @@
-     n = Vec3d(nv[0],nv[1],nv[2]);
-   }
--  readtrias.Append(STLReadTriangle(apts,n));
-+  Point<3> apts1[3];
-+  apts1[0] = Point<3>(p1[0],p1[1],p1[2]);
-+  apts1[1] = Point<3>(p2[0],p2[1],p2[2]);
-+  apts1[2] = Point<3>(p3[0],p3[1],p3[2]);
-+
-+  Vec<3> n1 = Vec<3>(n.X(),n.Y(),n.Z());
-+
-+  readtrias.Append(STLReadTriangle(apts1,n1));
- }
-   // add (optional) edges:
-@@ -487,30 +517,29 @@
- // compatibility functions:
--void MyError (const char * ch)
-+void netgen::MyError (const char * ch)
- {
-   cerr << ch;
- }
--//Destination for messages, errors, ...
--void Ng_PrintDest(const char * s)
--{
--  (*mycout) << s << flush;
--}
--
--
--double GetTime ()
-+double netgen::GetTime ()
- {
-   return 0;
- }
--void ResetTime ()
-+void netgen::ResetTime ()
- {
-   ;
- }
--void MyBeep (int i)
-+void netgen::MyBeep (int i)
- {
-   ;
- }
-+void MeshFromSpline2D (SplineGeometry2d & geometry,
-+                     Mesh *& mesh, 
-+                     MeshingParameters & mp)
-+{
-+  MeshFromSpline2D (geometry, mesh,  mp);
-+}
-diff -N -r -u netgen43/libsrc/makefile.mach.LINUX /tmp/netgen43/libsrc/makefile.mach.LINUX
---- netgen43/libsrc/makefile.mach.LINUX        2003-05-07 16:01:43.000000000 +0200
-+++ /tmp/netgen43/libsrc/makefile.mach.LINUX   2003-12-10 15:12:18.000000000 +0100
-@@ -14,7 +14,8 @@
- #
- CFLAGS2 =
- # pg stands for profiling - also in linkflags2
--CPLUSPLUSFLAGS2 =  -O2 -I/usr/X11R6/include -DLINUX -DOPENGL
-+#CPLUSPLUSFLAGS2 =  -O2 -I/usr/X11R6/include -DLINUX -DOPENGL
-+CPLUSPLUSFLAGS2 =  -O2 -I/usr/X11R6/include -DLINUX
- # -fomit-frame-pointer
- # -ffast-math
- #
-diff -N -r -u netgen43/libsrc/meshing/improve2.cpp /tmp/netgen43/libsrc/meshing/improve2.cpp
---- netgen43/libsrc/meshing/improve2.cpp       2003-05-07 16:01:43.000000000 +0200
-+++ /tmp/netgen43/libsrc/meshing/improve2.cpp  2003-12-10 15:42:00.000000000 +0100
-@@ -3,7 +3,7 @@
- #include "meshing.hpp"
- #include <opti.hpp>
--#include <visual.hpp>
-+/*#include <visual.hpp>*/
- namespace netgen
-diff -N -r -u netgen43/libsrc/meshing/meshing2.cpp /tmp/netgen43/libsrc/meshing/meshing2.cpp
---- netgen43/libsrc/meshing/meshing2.cpp       2003-05-07 16:01:43.000000000 +0200
-+++ /tmp/netgen43/libsrc/meshing/meshing2.cpp  2003-12-10 15:34:35.000000000 +0100
-@@ -1785,7 +1785,7 @@
- #else
--void glrender (int wait)
-+void netgen::glrender (int wait)
- {
-   ;
- } 
-diff -N -r -u netgen43/libsrc/visualization/stlmeshing.cpp /tmp/netgen43/libsrc/visualization/stlmeshing.cpp
---- netgen43/libsrc/visualization/stlmeshing.cpp       2003-05-07 16:01:43.000000000 +0200
-+++ /tmp/netgen43/libsrc/visualization/stlmeshing.cpp  2003-12-10 15:52:53.000000000 +0100
-@@ -5,7 +5,7 @@
- #include <stlgeom.hpp>
- #include <meshing.hpp>
--#include <visual.hpp>
-+/*#include <visual.hpp>*/
- namespace netgen
- {
-diff -N -r -u netgen43/Makefile /tmp/netgen43/Makefile
---- netgen43/Makefile  2003-05-07 16:01:43.000000000 +0200
-+++ /tmp/netgen43/Makefile     2003-12-10 15:11:41.000000000 +0100
-@@ -35,7 +35,8 @@
- .SUFFIXES: .cpp .o
- #
- #
--CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include  -DOPENGL
-+#CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include  -DOPENGL
-+CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include
- LINKFLAGS1 =   -lGL -lGLU -lX11 -lXext -lXmu
- #
- CPLUSPLUSFLAGS = $(CPLUSPLUSFLAGS1) $(CPLUSPLUSFLAGS2) $(CPLUSPLUSFLAGS3)
-diff -N -r -u netgen43/makeForSalome.sh /tmp/netgen43/makeForSalome.sh
---- netgen43/makeForSalome.sh  1970-01-01 01:00:00.000000000 +0100
-+++ /tmp/netgen43/makeForSalome.sh     2004-01-05 12:33:59.000000000 +0100
-@@ -0,0 +1,26 @@
-+#! /bin/sh
-+cp ngtcltk/ngnewdelete.* libsrc/interface/
-+
-+MACHINE=LINUX
-+export MACHINE
-+make -C libsrc/csg
-+make -C libsrc/general
-+make -C libsrc/geom2d
-+make -C libsrc/gprim
-+make -C libsrc/interface
-+make -C libsrc/linalg
-+make -C libsrc/meshing
-+make -C libsrc/opti
-+make -C libsrc/stlgeom
-+
-+if [ ! -d install ] ; then
-+      mkdir install
-+fi
-+
-+cp -r lib install/
-+
-+if [ ! -d install/include ] ; then
-+      mkdir install/include
-+fi
-+
-+cp libsrc/interface/nglib.h install/include
diff --git a/src/NETGEN/netgen45ForSalome.patch b/src/NETGEN/netgen45ForSalome.patch
deleted file mode 100644 (file)
index b77fc51..0000000
+++ /dev/null
@@ -1,1495 +0,0 @@
-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-11-25 10:11:30.000000000 +0300
-@@ -108,7 +108,7 @@
- void Plane :: GetPrimitiveData (char *& classname, 
-                               ARRAY<double> & 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<double> & 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<double> & 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<double> & 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<double> & 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-11-25 10:11:30.000000000 +0300
-@@ -345,7 +345,7 @@
- void Brick :: 
- GetPrimitiveData (char *& classname, ARRAY<double> & 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-11-25 10:11:30.000000000 +0300
-@@ -77,11 +77,12 @@
- }
--void MeshOptimize2dSurfaces :: ProjectPoint (INDEX surfind, Point3d & p) const
-+bool MeshOptimize2dSurfaces :: ProjectPoint (INDEX surfind, Point3d & p) const
- {
-   Point<3> hp = p;
-   geometry.GetSurface(surfind)->Project (hp);
-   p = hp;
-+  return true;
- }
- void MeshOptimize2dSurfaces :: ProjectPoint2 (INDEX surfind, INDEX surfind2, 
-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-11-25 10:11:30.000000000 +0300
-@@ -45,7 +45,7 @@
-     MeshOptimize2dSurfaces (const CSGeometry & ageometry); 
-    
-     ///
--    virtual void ProjectPoint (INDEX surfind, Point3d & p) const;
-+    virtual bool ProjectPoint (INDEX surfind, Point3d & p) const;
-     ///
-     virtual void ProjectPoint2 (INDEX surfind, INDEX surfind2, Point3d & p) const;
-     ///
-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-11-25 10:11:30.000000000 +0300
-@@ -287,7 +287,7 @@
- void Polyhedra :: GetPrimitiveData (char *& classname, 
-                                   ARRAY<double> & 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-11-25 10:11:30.000000000 +0300
-@@ -215,7 +215,7 @@
- void Primitive :: GetPrimitiveData (char *& classname, 
-                                   ARRAY<double> & 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-11-25 10:11:30.000000000 +0300
-@@ -34,8 +34,14 @@
-   {
-     StopTimer (total_timer);
--    ofstream prof ("netgen.prof");
--    Print (prof);
-+    char* env;
-+    if ((env = getenv("NETGEN_PROF")) && !strcmp(env, "1")) {
-+      ofstream prof ("netgen.prof");
-+      Print (prof);
-+    }
-+    else if ((env = getenv("NETGEN_PROF")) && !strcmp(env, "0")) {
-+      Print (std::cout);
-+    }
-   }
-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-11-25 10:11:30.000000000 +0300
-@@ -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-11-25 10:11:30.000000000 +0300
-@@ -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-11-25 10:11:30.000000000 +0300
-@@ -25,6 +25,7 @@
- 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/include/mystdlib.h netgen-4.5_new/libsrc/include/mystdlib.h
---- netgen-4.5_orig/libsrc/include/mystdlib.h  2006-01-16 17:16:56.000000000 +0300
-+++ netgen-4.5_new/libsrc/include/mystdlib.h   2010-11-25 10:11:30.000000000 +0300
-@@ -25,6 +25,7 @@
- #include <cmath>\r
- #include <cctype>\r
- #include <ctime>\r
-+#include <cstring>\r
- #endif\r
\r
\r
-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-11-25 10:11:30.000000000 +0300
-@@ -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
-+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
- #
- lib = nginterface
- libpath = libsrc/interface
-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-11-25 10:11:30.000000000 +0300
-@@ -56,7 +56,8 @@
- void Ng_Exit ()
- {
--  ;
-+  delete testout;
-+  testout = NULL;
- }
-   
-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-11-25 10:11:30.000000000 +0300
-@@ -17,7 +17,7 @@
- void RegisterUserFormats (ARRAY<const char*> & 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-11-25 10:11:30.000000000 +0300
-@@ -14,6 +14,8 @@
- #include <assert.h>
-+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-11-25 10:11:30.000000000 +0300
-@@ -8,17 +8,14 @@
- LIBSRC_DIR=$(CPP_DIR)/libsrc
- LIB_DIR=$(CPP_DIR)/lib/$(MACHINE)
--#OCC_DIR=../../occ
--#OCCINC_DIR=$(OCC_DIR)/inc
--#OCCLIB_DIR=$(OCC_DIR)/lib
--# OCC_DIR=/opt/OpenCASCADE5.2/ros
--# OCC_DIR=/home/joachim/download/occ/Linux
--# OCCINC_DIR=$(OCC_DIR)/inc  -I$(OCC_DIR)/ros/inc
--# OCCLIB_DIR=$(OCC_DIR)/Linux/lib
-+OCC_DIR=$(CASROOT)
-+OCCINC_DIR=$(OCC_DIR)/inc
-+OCCLIB_DIR=$(OCC_DIR)/Linux/lib
- #
- include $(LIBSRC_DIR)/makefile.mach.$(MACHINE)
- #
--CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include -I$(OCCINC_DIR) 
-+CPLUSPLUSFLAGS1 = -c -fPIC -I$(LIBSRC_DIR)/include -I$(OCCINC_DIR) \
-+      -DOCCGEOMETRY -DOCC52 -DHAVE_IOSTREAM -DHAVE_LIMITS_H
- #
- ARFLAGS = r
- #
-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-11-25 10:11:30.000000000 +0300
-@@ -16,7 +16,7 @@
- #
- CFLAGS2 =
--CPLUSPLUSFLAGS2 = -O2 -I/usr/include/GL3.5 -DLINUX -DOPENGL \
-+CPLUSPLUSFLAGS2 = -O2 -I/usr/include/GL3.5 -DLINUX \
-       -ftemplate-depth-99 -finline-limit=10000 \
-       -Wdisabled-optimization  -funroll-loops  -DnoNGSOLVE
-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-11-25 10:11:30.000000000 +0300
-@@ -4,7 +4,7 @@
- #include <opti.hpp>
- #ifndef SMALLLIB
--#include <visual.hpp>
-+//#include <visual.hpp>
- #endif
- namespace netgen
-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-11-25 10:11:30.000000000 +0300
-@@ -32,17 +32,16 @@
-   ///
-   virtual void SelectSurfaceOfPoint (const Point3d & p,
-                                    const PointGeomInfo & gi);
--  ///
--  virtual void ProjectPoint (INDEX /* surfind */, Point3d & /* p */) const { };
-+
-+  /// project point on surface, returns true if success
-+  virtual bool ProjectPoint (INDEX /* surfind */, Point3d & /* p */) const { return false; }
-+  /// fast project point on surface using point geom info of a neighboring point
-+  /// if gi.trignum != 0,
-+  /// returns true if success, gi is updated
-+  virtual bool ProjectPoint (INDEX surfind, Point3d & p, PointGeomInfo& gi) const
-+  { gi.trignum = 1; return ProjectPoint (surfind, p); }
-   ///
-   virtual void ProjectPoint2 (INDEX /* surfind */, INDEX /* surfind2 */, Point3d & /* p */) const { };
--  /// liefert zu einem 3d-Punkt die geominfo (Dreieck) und liefert 1, wenn erfolgreich, 
--  /// 0, wenn nicht (Punkt ausserhalb von chart)
--  virtual int CalcPointGeomInfo(PointGeomInfo& gi, const Point3d& /*p3*/) const
--    { gi.trignum = 1; return 1;};
--
--  virtual int CalcPointGeomInfo(int /* surfind */, PointGeomInfo& gi, const Point3d& p3) const
--    { return CalcPointGeomInfo (gi, p3); }
-   ///
-   virtual void GetNormalVector(INDEX surfind, const Point3d & p, PointGeomInfo & gi, Vec3d & n) const;
-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-11-25 10:11:30.000000000 +0300
-@@ -1,4 +1,5 @@
- #include <mystdlib.h>
-+#include <float.h>
- #include "meshing.hpp"  
-@@ -774,7 +775,7 @@
-       frob /= 2;
-       double det = trans.Det();
--      if (det <= 0)
-+      if (det <= DBL_MIN)
-       err += 1e12;
-       else
-       err += frob * frob / det;
-@@ -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-11-25 10:11:30.000000000 +0300
-@@ -13,7 +13,7 @@
-     Classes for NETGEN
- */
--
-+class Mesh;
- enum ELEMENT_TYPE { 
-   SEGMENT = 1, SEGMENT3 = 2,
-   TRIG = 10, QUAD=11, TRIG6 = 12, QUAD6 = 13, QUAD8 = 14,
-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-11-25 10:11:30.000000000 +0300
-@@ -300,7 +300,7 @@
-   double Opti2SurfaceMinFunction :: 
-   FuncGrad (const Vector & x, Vector & grad) const
-   {
--    Vec3d n, vgrad;
-+    Vec3d vgrad;
-     Point3d pp1;
-     double g1x, g1y;
-     double badness, hbadness;
-@@ -308,8 +308,6 @@
-     vgrad = 0;
-     badness = 0;
--    meshthis -> GetNormalVector (surfi, sp1, gi1, n);
--
-     pp1 = sp1;
-     pp1.Add2 (x.Get(1), t1, x.Get(2), t2);
-@@ -360,7 +358,7 @@
-   double Opti2SurfaceMinFunction :: 
-   FuncDeriv (const Vector & x, const Vector & dir, double & deriv) const
-   {
--    Vec3d n, vgrad;
-+    Vec3d vgrad;
-     Point3d pp1;
-     double g1x, g1y;
-     double badness, hbadness;
-@@ -368,8 +366,6 @@
-     vgrad = 0;
-     badness = 0;
--    meshthis -> GetNormalVector (surfi, sp1, gi1, n);
--
-     pp1 = sp1;
-     pp1.Add2 (x.Get(1), t1, x.Get(2), t2);
-@@ -520,7 +516,7 @@
-     // from 2d:
-     int j, k, lpi, gpi;
--    Vec3d n, vgrad;
-+    Vec3d vgrad;
-     Point3d pp1;
-     Vec2d g1, vdir;
-     double badness, hbadness, hbad, hderiv;
-@@ -528,8 +524,6 @@
-     vgrad = 0;
-     badness = 0;
--    meshthis -> GetNormalVector (surfi, sp1, gi1, n);
--
-     pp1 = sp1;
-     pp1.Add2 (x.Get(1), t1, x.Get(2), t2);
-@@ -593,7 +587,7 @@
-     // from 2d:
-     int j, k, lpi, gpi;
--    Vec3d n, vgrad;
-+    Vec3d vgrad;
-     Point3d pp1;
-     Vec2d g1, vdir;
-     double badness, hbadness, hbad, hderiv;
-@@ -601,8 +595,6 @@
-     vgrad = 0;
-     badness = 0;
--    meshthis -> GetNormalVector (surfi, sp1, gi1, n);
--
-     pp1 = sp1;
-     pp1.Add2 (x.Get(1), t1, x.Get(2), t2);
-@@ -859,19 +851,21 @@
-         locelements.SetSize(0);
-         locrots.SetSize (0);
-         lochs.SetSize (0);
-+          ngi.trignum = 0;
-       
-         for (j = 0; j < elementsonpoint[pi].Size(); j++)
-           {
-             sei = elementsonpoint[pi][j];
-             const Element2d & bel = mesh[sei];
-             surfi = mesh.GetFaceDescriptor(bel.GetIndex()).SurfNr();
--          
-+
-             locelements.Append (sei);
-           
-             for (k = 1; k <= bel.GetNP(); k++)
-               if (bel.PNum(k) == pi)
-                 {
-                   locrots.Append (k);
-+                    ngi = bel.GeomInfoPi(k);
-                   break;
-                 }
-             
-@@ -942,7 +936,7 @@
-           }
-         
-         //optimizer loop (if not whole distance is not possible, move only a bit!!!!)
--        while (loci <= 5 && !moveisok)
-+          while (loci <= 5 && !moveisok)
-           {
-             loci ++;
-             mesh[pi].X() = origp.X() + (x.Get(1) * t1.X() + x.Get(2) * t2.X())*fact;
-@@ -951,11 +945,9 @@
-             fact = fact/2.;
--            ProjectPoint (surfi, mesh[pi]);
-+            moveisok = ProjectPoint (surfi, mesh[pi], ngi);
--            moveisok = CalcPointGeomInfo(surfi, ngi, mesh[pi]); 
--            // point lies on same chart in stlsurface
--          
-+              // point lies on same chart in stlsurface
-             if (moveisok)
-               {
-                 for (j = 0; j < locelements.Size(); j++)
-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-11-25 10:11:31.000000000 +0300
-@@ -29,10 +29,10 @@
- //  $Header$
- //using namespace std;
--#include "Partition_Inter2d.ixx"
--
- #include "utilities.h"
-+#include "Partition_Inter2d.ixx"
-+
- #include <BRepAdaptor_Curve.hxx>
- #include <BRepAlgo_AsDes.hxx>
- #include <BRepLib_MakeVertex.hxx>
-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-11-25 10:11:31.000000000 +0300
-@@ -29,13 +29,17 @@
- //  $Header$
- //using namespace std;
-+
-+#include "utilities.h"
-+
- #include "Partition_Inter2d.hxx"
- #include "Partition_Inter3d.ixx"
--#include "utilities.h"
- #include <BRepAlgo_AsDes.hxx>
- #include <BRepAlgo_Image.hxx>
- #include <BRepLib.hxx>
-+//using namespace std;
-+
- #include <BRepOffset_Tool.hxx>
- #include <BRep_Builder.hxx>
- #include <BRep_Tool.hxx>
-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-11-25 10:11:31.000000000 +0300
-@@ -29,12 +29,14 @@
- //  $Header$
- //using namespace std;
--#include <stdio.h>
--#include "Partition_Loop.ixx"
- #include "utilities.h"
-+#include <stdio.h>
-+
-+#include "Partition_Loop.ixx"
-+
- #include <BRep_Builder.hxx>
- #include <BRepAlgo_FaceRestrictor.hxx>
- #include <BRep_Tool.hxx>
-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-11-25 10:11:31.000000000 +0300
-@@ -12,9 +12,11 @@
- //  $Header$
- //using namespace std;
--#include "Partition_Loop2d.ixx"
-+
- #include "utilities.h"
-+
-+#include "Partition_Loop2d.ixx"
- #include <stdio.h>
- #include <BRepAdaptor_Curve2d.hxx>
-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-11-25 10:11:31.000000000 +0300
-@@ -10,6 +10,11 @@
- //  Module : GEOM
- //using namespace std;
-+
-+
-+
-+#include "utilities.h"
-+
- #include "Partition_Loop3d.ixx"
- #include <TopExp_Explorer.hxx>
-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-11-25 10:11:31.000000000 +0300
-@@ -29,14 +29,15 @@
- //  $Header$
- //using namespace std;
-+
-+#include "utilities.h"
-+
- #include "Partition_Inter2d.hxx"
- #include "Partition_Inter3d.hxx"
- #include "Partition_Loop2d.hxx"
- #include "Partition_Loop3d.hxx"
- #include "Partition_Spliter.ixx"
--#include "utilities.h"
--
- #include <Precision.hxx>
- #include <TopAbs_Orientation.hxx>
- #include <TopExp.hxx>
-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-11-25 10:11:30.000000000 +0300
-@@ -28,8 +28,8 @@
- #include <BRepAlgoAPI_Common.hxx>
- #include <BRepAlgoAPI_Fuse.hxx>
- #include <BRepAlgoAPI_Section.hxx>
--#include <BRepOffsetAPI_Sewing.hxx>
--#include <BRepAlgo_Sewing.hxx>
-+//#include <BRepOffsetAPI_Sewing.hxx>
-+//#include <BRepAlgo_Sewing.hxx>
- #include <BRepOffsetAPI_MakeOffsetShape.hxx>
- #include <ShapeFix_Shape.hxx>
- namespace netgen
-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-11-25 10:11:30.000000000 +0300
-@@ -28,7 +28,7 @@
-     return  Point<3> (p.X(), p.Y(), p.Z());
-   }
-  
--  void DivideEdge (TopoDS_Edge & edge,
-+  static void DivideEdge (TopoDS_Edge & edge,
-                  ARRAY<MeshPoint> & ps,
-                  ARRAY<double> & params,
-                  Mesh & mesh)
-@@ -49,23 +49,18 @@
-     hvalue[0] = 0;
-     pnt = c->Value(s0);
--    double olddist = 0;
--    double dist = 0;
--
--    for (int i = 1; i <= DIVIDEEDGESECTIONS; i++)
-+    int i;
-+    for (i = 1; i <= DIVIDEEDGESECTIONS; i++)
-       {
-       oldpnt = pnt;
-       pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0));
--      hvalue[i] = hvalue[i-1] +
--        1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
--        pnt.Distance(oldpnt);
-+      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;
--
--      olddist = dist;
--      dist = pnt.Distance(oldpnt);
-       }
-     //  nsubedges = int(ceil(hvalue[DIVIDEEDGESECTIONS]));
-@@ -74,13 +69,16 @@
-     ps.SetSize(nsubedges-1);
-     params.SetSize(nsubedges+1);
--    int i = 1;
-+    i = 1;
-     int i1 = 0;
-     do
-       {
-       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)
-   {
--    char * savetask = multithread.task;
-+    const char * savetask = multithread.task;
-     multithread.task = "Edge meshing";
-     (*testout) << "edge meshing" << endl;
-@@ -124,6 +122,7 @@
-     (*testout) << "nedges = " << nedges << endl;
-     double eps = 1e-6 * geom.GetBoundingBox().Diam();
-+    double eps2 = eps * eps;
-     for (int i = 1; i <= nvertices; i++)
-       {
-@@ -133,7 +132,7 @@
-       bool exists = 0;
-       if (merge_solids)
-         for (PointIndex pi = 1; pi <= mesh.GetNP(); pi++)
--          if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
-+          if ( Dist2 (mesh[pi], Point<3>(mp)) < eps2)
-             {
-               exists = 1;
-               break;
-@@ -163,6 +162,7 @@
-         {
-           TopoDS_Face face = TopoDS::Face(exp1.Current());
-           int facenr = geom.fmap.FindIndex(face);
-+            if ( facenr < 1 ) continue;
-           if (face2solid[0][facenr-1] == 0)
-             face2solid[0][facenr-1] = solidnr;
-@@ -184,6 +184,9 @@
-     int facenr = 0;
-     int edgenr = 0;
-     
-+    // EAP, IMP [SALOME platform 0013410].
-+    // take into account nb of already meshed edges
-+    edgenr = mesh.GetNSeg();
-     (*testout) << "faces = " << geom.fmap.Extent() << endl;
-     int curr = 0;
-@@ -232,6 +235,11 @@
-                   continue;
-                 }
-+                // EAP, IMP [SALOME platform 0013410].
-+                // Do not divide already meshed edges
-+                if ( geom.emap.FindIndex(edge) < 1 )
-+                  continue;
-+
-               if (geom.vmap.FindIndex(TopExp::FirstVertex (edge)) == 
-                   geom.vmap.FindIndex(TopExp::LastVertex (edge)))
-                 {
-@@ -276,8 +284,8 @@
-                   pnums.Last() = -1;
-                   for (PointIndex pi = 1; pi < first_ep; pi++)
-                     {
--                      if (Dist2 (mesh[pi], fp) < eps*eps) pnums[0] = pi;
--                      if (Dist2 (mesh[pi], lp) < eps*eps) pnums.Last() = pi;
-+                      if (Dist2 (mesh[pi], fp) < eps2) pnums[0] = pi;
-+                      if (Dist2 (mesh[pi], lp) < eps2) pnums.Last() = pi;
-                     }
-                 }
-               
-@@ -287,7 +295,7 @@
-                   bool exists = 0;
-                   int j;
-                   for (j = first_ep; j <= mesh.GetNP(); j++)
--                    if ((mesh.Point(j)-Point<3>(mp[i-1])).Length() < eps) 
-+                    if (Dist2(mesh.Point(j), Point<3>(mp[i-1])) < eps2)
-                       {
-                         exists = 1;
-                         break;
-@@ -394,7 +402,7 @@
-     int i, j, k;
-     int changed;
--    char * savetask = multithread.task;
-+    const char * savetask = multithread.task;
-     multithread.task = "Surface meshing";
-   
-     geom.facemeshstatus = 0;
-@@ -751,7 +759,7 @@
-     multithread.task = savetask;
-   }
--  double ComputeH (double kappa)
-+  static double ComputeH (double kappa)
-   {
-     double hret;
-     kappa *= mparam.curvaturesafety;
-@@ -779,7 +787,7 @@
-       double nq = n*q;
-     
-       Point<3> p = p0 + 0.5*n;
--      double lambda = (p-l.p0)*n / nq;
-+      double lambda = (fabs(nq) > 1e-10 ? (p-l.p0)*n / nq : -1);
-       if (lambda >= 0 && lambda <= 1)
-       {
-@@ -799,55 +807,55 @@
--  void RestrictHTriangle (gp_Pnt2d & par0, gp_Pnt2d & par1, gp_Pnt2d & par2,
--                        BRepLProp_SLProps * prop, Mesh & mesh, const double maxside, int depth, double h = 0)
-+  static void RestrictHTriangle (gp_Pnt2d & par0, gp_Pnt2d & par1, gp_Pnt2d & par2,
-+                        BRepAdaptor_Surface& surf, Mesh & mesh, const double maxside, int depth, double h = 0)
-   {
--
-+    BRepLProp_SLProps prop(surf, 2, 1e-5);
-     gp_Pnt2d parmid;
-     parmid.SetX(0.3*(par0.X()+par1.X()+par2.X()));
-     parmid.SetY(0.3*(par0.Y()+par1.Y()+par2.Y()));
-     
--    if (depth == 0)
-+    //if (depth == 0)
-       {
-       double curvature = 0;
--      prop->SetParameters (parmid.X(), parmid.Y());
--      if (!prop->IsCurvatureDefined())
-+      prop.SetParameters (parmid.X(), parmid.Y());
-+      if (!prop.IsCurvatureDefined())
-         {
-           (*testout) << "curvature not defined!" << endl;
-           return;
-         }
--      curvature = max(fabs(prop->MinCurvature()),
--                      fabs(prop->MaxCurvature()));
-+      curvature = max(fabs(prop.MinCurvature()),
-+                      fabs(prop.MaxCurvature()));
--      prop->SetParameters (par0.X(), par0.Y());
--      if (!prop->IsCurvatureDefined())
-+      prop.SetParameters (par0.X(), par0.Y());
-+      if (!prop.IsCurvatureDefined())
-         {
-           (*testout) << "curvature not defined!" << endl;
-           return;
-         }
--      curvature = max(curvature,max(fabs(prop->MinCurvature()),
--                                    fabs(prop->MaxCurvature())));
-+      curvature = max(curvature,max(fabs(prop.MinCurvature()),
-+                                    fabs(prop.MaxCurvature())));
--      prop->SetParameters (par1.X(), par1.Y());
--      if (!prop->IsCurvatureDefined())
-+      prop.SetParameters (par1.X(), par1.Y());
-+      if (!prop.IsCurvatureDefined())
-         {
-           (*testout) << "curvature not defined!" << endl;
-           return;
-         }
--      curvature = max(curvature,max(fabs(prop->MinCurvature()),
--                                    fabs(prop->MaxCurvature())));
-+      curvature = max(curvature,max(fabs(prop.MinCurvature()),
-+                                    fabs(prop.MaxCurvature())));
--      prop->SetParameters (par2.X(), par2.Y());
--      if (!prop->IsCurvatureDefined())
-+      prop.SetParameters (par2.X(), par2.Y());
-+      if (!prop.IsCurvatureDefined())
-         {
-           (*testout) << "curvature not defined!" << endl;
-           return;
-         }
--      curvature = max(curvature,max(fabs(prop->MinCurvature()),
--                                    fabs(prop->MaxCurvature())));
-+      curvature = max(curvature,max(fabs(prop.MinCurvature()),
-+                                    fabs(prop.MaxCurvature())));
-       //(*testout) << "curvature " << curvature << endl;
-@@ -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()));
--      RestrictHTriangle (pm0, pm1, pm2, prop, mesh, 0.5*maxside, depth+1, h);
--      RestrictHTriangle (par0, pm1, pm2, prop, mesh, 0.5*maxside, depth+1, h);
--      RestrictHTriangle (par1, pm0, pm2, prop, mesh, 0.5*maxside, depth+1, h);
--      RestrictHTriangle (par2, pm1, pm0, prop, mesh, 0.5*maxside, depth+1, h);
-+      RestrictHTriangle (pm0, pm1, pm2, surf, mesh, 0.5*maxside, depth+1, h);
-+      RestrictHTriangle (par0, pm1, pm2, surf, mesh, 0.5*maxside, depth+1, h);
-+      RestrictHTriangle (par1, pm0, pm2, surf, mesh, 0.5*maxside, depth+1, h);
-+      RestrictHTriangle (par2, pm1, pm0, surf, mesh, 0.5*maxside, depth+1, h);
-       }
-     else
-       {
-       gp_Pnt pnt;
-       Point3d p3d;
--      prop->SetParameters (parmid.X(), parmid.Y());
--      pnt = prop->Value();
-+      surf.D0(parmid.X(), parmid.Y(), pnt);
-       p3d = Point3d(pnt.X(), pnt.Y(), pnt.Z());
-       mesh.RestrictLocalH (p3d, h);
-       
--      prop->SetParameters (par0.X(), par0.Y());
--      pnt = prop->Value();
-+      surf.D0(par0.X(), par0.Y(), pnt);
-       p3d = Point3d(pnt.X(), pnt.Y(), pnt.Z());
-       mesh.RestrictLocalH (p3d, h);
--      prop->SetParameters (par1.X(), par1.Y());
--      pnt = prop->Value();
-+      surf.D0(par1.X(), par1.Y(), pnt);
-       p3d = Point3d(pnt.X(), pnt.Y(), pnt.Z());
-       mesh.RestrictLocalH (p3d, h);
--      prop->SetParameters (par2.X(), par2.Y());
--      pnt = prop->Value();
-+      surf.D0(par2.X(), par2.Y(), pnt);
-       p3d = Point3d(pnt.X(), pnt.Y(), pnt.Z());
-       mesh.RestrictLocalH (p3d, h);
--      (*testout) << "p = " << p3d << ", h = " << h << ", maxside = " << maxside << endl;
-+      //(*testout) << "p = " << p3d << ", h = " << h << ", maxside = " << maxside << endl;
-       /*
-         (*testout) << pnt.X() << " " << pnt.Y() << " " << pnt.Z() << endl;
--        prop->SetParameters (par0.X(), par0.Y());
--        pnt = prop->Value();
-+        prop.SetParameters (par0.X(), par0.Y());
-+        pnt = prop.Value();
-         (*testout) << pnt.X() << " " << pnt.Y() << " " << pnt.Z() << endl;
--        prop->SetParameters (par1.X(), par1.Y());
--        pnt = prop->Value();
-+        prop.SetParameters (par1.X(), par1.Y());
-+        pnt = prop.Value();
-         (*testout) << pnt.X() << " " << pnt.Y() << " " << pnt.Z() << endl;
--        prop->SetParameters (par2.X(), par2.Y());
--        pnt = prop->Value();
-+        prop.SetParameters (par2.X(), par2.Y());
-+        pnt = prop.Value();
-         (*testout) << pnt.X() << " " << pnt.Y() << " " << pnt.Z() << endl;
-       */
-       }
-@@ -970,7 +974,7 @@
-       if (mparam.uselocalh)
-         {
--          char * savetask = multithread.task;
-+          const char * savetask = multithread.task;
-           multithread.percent = 0;
-           mesh->SetLocalH (bb.PMin(), bb.PMax(), mparam.grading);
-@@ -1075,7 +1079,6 @@
-               if (triangulation.IsNull()) continue;
-             
-               BRepAdaptor_Surface sf(face, Standard_True);
--              BRepLProp_SLProps prop(sf, 2, 1e-5);
-               
-               int ntriangles = triangulation -> NbTriangles();
-               for (int j = 1; j <= ntriangles; j++)
-@@ -1096,7 +1099,7 @@
-                   maxside = max (maxside, p[1].Distance(p[2]));
-                   //cout << "\rFace " << i << " pos11 ntriangles " << ntriangles << " maxside " << maxside << flush;
--                  RestrictHTriangle (par[0], par[1], par[2], &prop, *mesh, maxside, 0);
-+                  RestrictHTriangle (par[0], par[1], par[2], sf, *mesh, maxside, 0);
-                   //cout << "\rFace " << i << " pos12 ntriangles " << ntriangles << flush;
-                 }
-             }
-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-11-25 10:11:31.000000000 +0300
-@@ -7,6 +7,8 @@
- #include "ShapeAnalysis_ShapeContents.hxx"
- #include "ShapeAnalysis_CheckSmallFace.hxx"
- #include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx"
-+#include <ShapeAnalysis_Surface.hxx>
-+#include <BRepTopAdaptor_FClass2d.hxx>
- #include "BRepAlgoAPI_Fuse.hxx"
- #include "BRepCheck_Analyzer.hxx"
- #include "BRepLib.hxx"
-@@ -16,11 +18,19 @@
- #include "Partition_Spliter.hxx"
- //#include "VrmlAPI.hxx"
- //#include "StlAPI.hxx"
-+#include <TopAbs_State.hxx>
- namespace netgen
- {
-+  OCCGeometry::~OCCGeometry()
-+  {
-+    NCollection_DataMap<int,BRepTopAdaptor_FClass2d*>::Iterator it(fclsmap);
-+    for (; it.More(); it.Next())
-+      delete it.Value();
-+  }
-+
-   void OCCGeometry :: PrintNrShapes ()
-   {
-     TopExp_Explorer e;
-@@ -947,13 +957,13 @@
-   void OCCGeometry :: BuildVisualizationMesh ()
-   {
--
--    cout << "Preparing visualization (deflection = " << vispar.occdeflection << ") ... " << flush;
-+    double vispar_occdeflection = 0.01;
-+    cout << "Preparing visualization (deflection = " << vispar_occdeflection << ") ... " << flush;
-     BRepTools::Clean (shape);
-     //WriteOCC_STL("test.stl");
--    BRepMesh_IncrementalMesh::BRepMesh_IncrementalMesh (shape, vispar.occdeflection, true);
-+    BRepMesh_IncrementalMesh (shape, vispar_occdeflection, true);
-     cout << "done" << endl;
-@@ -973,8 +983,27 @@
-   
-   }
-+  void OCCGeometry::GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
-+                                 BRepTopAdaptor_FClass2d*& cls) const
-+  {
-+    //MSV: organize caching projector in the map
-+    if (fprjmap.IsBound(surfi))
-+    {
-+      proj = fprjmap.Find(surfi);
-+      cls = fclsmap.Find(surfi);
-+    }
-+    else
-+    {
-+      const TopoDS_Face& aFace = TopoDS::Face(fmap(surfi));
-+      Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
-+      proj = new ShapeAnalysis_Surface(aSurf);
-+      fprjmap.Bind(surfi, proj);
-+      cls = new BRepTopAdaptor_FClass2d(aFace,Precision::Confusion());
-+      fclsmap.Bind(surfi, cls);
-+    }
-+  }
--  void OCCGeometry :: Project (int surfi, Point<3> & p) const
-+  bool OCCGeometry :: Project (int surfi, Point<3> & p, double& u, double& v) const
-   {
-     static int cnt = 0;
-     if (++cnt % 1000 == 0) cout << "Project cnt = " << cnt << endl;
-@@ -983,18 +1012,22 @@
-     //(*testout) << "before " << pnt.X() << " "<< pnt.Y() << " "<< pnt.Z() << " " << endl;
--    GeomAPI_ProjectPointOnSurf proj(pnt, BRep_Tool::Surface(TopoDS::Face(fmap(surfi))));
--    if (proj.NbPoints() == 0)
--      {
--      cout << "Projection fails" << endl;
--      }
--    else
--      {
--      pnt = proj.NearestPoint();
--      //(*testout) << "after " << pnt.X() << " "<< pnt.Y() << " "<< pnt.Z() << " " << endl;
-+    Handle(ShapeAnalysis_Surface) proj;
-+    BRepTopAdaptor_FClass2d *cls;
-+    GetFaceTools(surfi, proj, cls);
--      p = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
--      }
-+    gp_Pnt2d p2d = proj->ValueOfUV(pnt, Precision::Confusion());
-+    if (cls->Perform(p2d) == TopAbs_OUT)
-+    {
-+      //cout << "Projection fails" << endl;
-+      return false;
-+    }
-+    pnt = proj->Value(p2d);
-+    p2d.Coord(u, v);
-+    //(*testout) << "after " << pnt.X() << " "<< pnt.Y() << " "<< pnt.Z() << " " << endl;
-+
-+    p = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
-+    return true;
-   }
-@@ -1002,54 +1035,20 @@
-   {
-     gp_Pnt p(ap(0), ap(1), ap(2));
-   
--    Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
-+    Handle(ShapeAnalysis_Surface) proj;
-+    BRepTopAdaptor_FClass2d *cls;
-+    GetFaceTools(surfi, proj, cls);
-   
--    gp_Pnt x = surface->Value (u,v);
--  
--    if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
--  
--    gp_Vec du, dv;
--  
--    surface->D1(u,v,x,du,dv);
--  
--    int count = 0;
--  
--    gp_Pnt xold;
--    gp_Vec n;
--    double det, lambda, mu;
--  
--    do {
--      count++;
--  
--      n = du^dv;
--  
--      det = Det3 (n.X(), du.X(), dv.X(),
--                n.Y(), du.Y(), dv.Y(),
--                n.Z(), du.Z(), dv.Z());
--  
--      if (det < 1e-15) return false; 
--  
--      lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
--                   n.Y(), p.Y()-x.Y(), dv.Y(),
--                   n.Z(), p.Z()-x.Z(), dv.Z())/det;
--  
--      mu     = Det3 (n.X(), du.X(), p.X()-x.X(),
--                   n.Y(), du.Y(), p.Y()-x.Y(),
--                   n.Z(), du.Z(), p.Z()-x.Z())/det;
--    
--      u += lambda;
--      v += mu;
--  
--      xold = x;
--      surface->D1(u,v,x,du,dv);
--  
--    } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
--
--    //    (*testout) << "FastProject count: " << count << endl;
--  
--    if (count == 50) return false;
-+    gp_Pnt2d p2d = proj->NextValueOfUV(gp_Pnt2d(u,v), p, Precision::Confusion());
-+    if (cls->Perform(p2d) == TopAbs_OUT)
-+    {
-+      //cout << "Projection fails" << endl;
-+      return false;
-+    }
-   
--    ap = Point<3> (x.X(), x.Y(), x.Z());
-+    p = proj->Value(p2d);
-+    p2d.Coord(u, v);
-+    ap = Point<3> (p.X(), p.Y(), p.Z());
-   
-     return true;
-   }
-@@ -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-11-25 10:11:31.000000000 +0300
-@@ -15,8 +15,6 @@
- #include "Geom_Curve.hxx"
- #include "Geom2d_Curve.hxx"
- #include "Geom_Surface.hxx"
--#include "GeomAPI_ProjectPointOnSurf.hxx"
--#include "GeomAPI_ProjectPointOnCurve.hxx"
- #include "BRepTools.hxx"
- #include "TopExp.hxx"
- #include "BRepBuilderAPI_MakeVertex.hxx"
-@@ -41,8 +39,6 @@
- #include "Geom_Curve.hxx"
- #include "Geom2d_Curve.hxx"
- #include "Geom_Surface.hxx"
--#include "GeomAPI_ProjectPointOnSurf.hxx"
--#include "GeomAPI_ProjectPointOnCurve.hxx"
- #include "TopoDS_Wire.hxx"
- #include "BRepTools_WireExplorer.hxx"
- #include "BRepTools.hxx"
-@@ -69,7 +65,7 @@
- #include "IGESToBRep_Reader.hxx"
- #include "Interface_Static.hxx"
- #include "GeomAPI_ExtremaCurveCurve.hxx"
--#include "Standard_ErrorHandler.hxx"
-+//#include "Standard_ErrorHandler.hxx"
- #include "Standard_Failure.hxx"
- #include "ShapeUpgrade_ShellSewing.hxx"
- #include "ShapeFix_Shape.hxx"
-@@ -84,11 +80,15 @@
- #include "STEPControl_Writer.hxx"
- #include "StlAPI_Writer.hxx"
- #include "STEPControl_StepModelType.hxx"
-+#include <NCollection_DataMap.hxx>
-+
-+class Handle_ShapeAnalysis_Surface;
-+class BRepTopAdaptor_FClass2d;
- namespace netgen
- {
--#include "../visualization/vispar.hpp"
-+  //#include "../visualization/vispar.hpp"
-   //  class VisualizationParameters;
-   //  extern VisualizationParameters vispar;
-@@ -159,6 +159,8 @@
- class OCCGeometry
- {
-   Point<3> center;
-+  mutable NCollection_DataMap<int,Handle_ShapeAnalysis_Surface> fprjmap;
-+  mutable NCollection_DataMap<int,BRepTopAdaptor_FClass2d*> fclsmap;
- public:
-   TopoDS_Shape shape;
-@@ -189,6 +191,7 @@
-     vmap.Clear();
-   }
-+  ~OCCGeometry();
-   void BuildFMap();
-@@ -204,10 +207,12 @@
-   Point<3> Center()
-   { return center; }
--  void Project (int surfi, Point<3> & p) const;
-+  bool Project (int surfi, Point<3> & p, double& u, double& v) const;
-   bool FastProject (int surfi, Point<3> & ap, double& u, double& v) const;
-- 
-+  void GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
-+                    BRepTopAdaptor_FClass2d*& cls) const;
-+
-   OCCSurface GetSurface (int surfi)
-   {
-     cout << "OCCGeometry::GetSurface using PLANESPACE" << endl;
-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-11-25 10:11:31.000000000 +0300
-@@ -5,6 +5,8 @@
- #include <occgeom.hpp>
- #include <meshing.hpp>
- #include <GeomLProp_SLProps.hxx>
-+#include <GeomAPI_ProjectPointOnSurf.hxx>
-+#include <GeomAPI_ProjectPointOnCurve.hxx>
- namespace netgen
-@@ -411,11 +413,16 @@
-   }
--  void MeshOptimize2dOCCSurfaces :: ProjectPoint (INDEX surfind, Point3d & p) const
-+  bool MeshOptimize2dOCCSurfaces :: ProjectPoint (INDEX surfind, Point3d & p, PointGeomInfo& gi) const
-   {
-     Point<3> hp = p;
--    geometry.Project (surfind, hp);
-+    bool ok;
-+    if (gi.trignum > 0)
-+      ok = geometry.FastProject (surfind, hp, gi.u, gi.v);
-+    else
-+      ok = geometry.Project (surfind, hp, gi.u, gi.v);
-     p = hp;
-+    return ok;
-   }
-   void MeshOptimize2dOCCSurfaces :: ProjectPoint2 (INDEX surfind, INDEX surfind2, 
-@@ -506,38 +513,6 @@
-   }
--  int MeshOptimize2dOCCSurfaces :: 
--  CalcPointGeomInfo(int surfind, PointGeomInfo& gi, const Point3d& p) const
--  {
--    Standard_Real u,v;
--
--    gp_Pnt pnt(p.X(), p.Y(), p.Z());
--
--    Handle(Geom_Surface) occface;
--    occface = BRep_Tool::Surface(TopoDS::Face(geometry.fmap(surfind)));
--
--    GeomAPI_ProjectPointOnSurf proj(pnt, occface);
--
--    if (proj.NbPoints() < 1)
--      {
--      cout << "ERROR: OCCSurface :: GetNormalVector: GeomAPI_ProjectPointOnSurf failed!"
--           << endl;
--      cout << p << endl;
--      return 0;
--      }
-- 
--    proj.LowerDistanceParameters (u, v);  
--
--    gi.u = u;
--    gi.v = v;
--    return 1;
--  }
--
--
--
--
--
--
-   OCCRefinementSurfaces :: OCCRefinementSurfaces (const OCCGeometry & ageometry)
-     : Refinement(), geometry(ageometry)
-   {
-@@ -627,10 +602,11 @@
-       if (!geometry.FastProject (surfi, hnewp, u, v))
-         {
-           cout << "Fast projection to surface fails! Using OCC projection" << endl;
--          geometry.Project (surfi, hnewp);
-+            double u, v;
-+          geometry.Project (surfi, hnewp, u, v);
-         }
--      newgi.trignum = 1;
-+      newgi.trignum = surfi;
-       }
-   
-     newp = hnewp;
-@@ -653,14 +629,17 @@
-     hnewp = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
-     newp = hnewp;
-     newgi = ap1;
--  };
-+  }
-   void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi)
-   {
-     if (surfi > 0)
--      geometry.Project (surfi, p);
--  };
-+    {
-+      double u, v;
-+      geometry.Project (surfi, p, u, v);
-+    }
-+  }
-   void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi, PointGeomInfo & gi)
-   {
-@@ -668,9 +647,10 @@
-       if (!geometry.FastProject (surfi, p, gi.u, gi.v))
-       {
-         cout << "Fast projection to surface fails! Using OCC projection" << endl;
--        geometry.Project (surfi, p);
-+          double u, v;
-+        geometry.Project (surfi, p, u, v);
-       }
--  };
-+  }
-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-11-25 10:11:31.000000000 +0300
-@@ -151,7 +151,7 @@
-     MeshOptimize2dOCCSurfaces (const OCCGeometry & ageometry); 
-    
-     ///
--    virtual void ProjectPoint (INDEX surfind, Point3d & p) const;
-+    virtual bool ProjectPoint (INDEX surfind, Point3d & p, PointGeomInfo& gi) const;
-     ///
-     virtual void ProjectPoint2 (INDEX surfind, INDEX surfind2, Point3d & p) const;
-     ///
-@@ -159,9 +159,6 @@
-     ///
-     virtual void GetNormalVector(INDEX surfind, const Point3d & p, PointGeomInfo & gi, Vec3d & n) const;
--    
--  virtual int CalcPointGeomInfo(int surfind, PointGeomInfo& gi, const Point3d& p3) const;
--
- };
-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-11-25 10:11:31.000000000 +0300
-@@ -33,6 +33,7 @@
- #include <string>
- #include <iostream>
-+#include <iomanip>
- #include <cstdlib>
- // #include "SALOME_Log.hxx"
-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-11-25 10:11:31.000000000 +0300
-@@ -946,20 +946,23 @@
- }
--void MeshOptimizeSTLSurface :: ProjectPoint (INDEX surfind, Point3d & p) const
-+bool MeshOptimizeSTLSurface :: ProjectPoint (INDEX surfind, Point3d & p, PointGeomInfo& gi) const
- {
-   Point<3> hp = p;
--  if (!geom.Project (hp))
-+  if (gi.trignum > 0)
-+    ((STLGeometry&)geom).SelectChartOfTriangle (gi.trignum);
-+  if (!(gi.trignum = geom.Project (hp)))
-     {
-       PrintMessage(7,"project failed");
-       
--      if (!geom.ProjectOnWholeSurface(hp)) 
-+      if (!(gi.trignum = geom.ProjectOnWholeSurface(hp))) 
-       {
-         PrintMessage(7, "project on whole surface failed");
-       }
-     }
-   p = hp;
-   //  geometry.GetSurface(surfind)->Project (p);
-+  return gi.trignum > 0;
- }
- void MeshOptimizeSTLSurface :: ProjectPoint2 (INDEX surfind, INDEX surfind2, Point3d & p) const
-@@ -970,20 +973,6 @@
-   */
- }
--int  MeshOptimizeSTLSurface :: CalcPointGeomInfo(PointGeomInfo& gi, const Point3d& p3) const
--{
--  Point<3> hp = p3;
--  gi.trignum = geom.Project (hp);
--
--  if (gi.trignum)
--    {
--      return 1;
--    }
--
--  return 0;
--  
--}
--
- void MeshOptimizeSTLSurface :: GetNormalVector(INDEX surfind, const Point3d & p, Vec3d & n) const
- {
-   n = geom.GetChartNormalVector();
-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-11-25 10:11:31.000000000 +0300
-@@ -79,12 +79,10 @@
-     virtual void SelectSurfaceOfPoint (const Point3d & p,
-                                      const PointGeomInfo & gi);
-     ///
--    virtual void ProjectPoint (INDEX surfind, Point3d & p) const;
-+    virtual bool ProjectPoint (INDEX surfind, Point3d & p, PointGeomInfo& gi) const;
-     ///
-     virtual void ProjectPoint2 (INDEX surfind, INDEX surfind2, Point3d & p) const;
-     ///
--    virtual int CalcPointGeomInfo(PointGeomInfo& gi, const Point3d& p3) const;
--    ///
-     virtual void GetNormalVector(INDEX surfind, const Point3d & p, Vec3d & n) const;
- };
-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-11-25 10:11:31.000000000 +0300
-@@ -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-11-25 10:11:31.000000000 +0300
-@@ -0,0 +1,35 @@
-+#! /bin/sh
-+cp ngtcltk/ngnewdelete.* libsrc/interface/
-+
-+if test `uname -m` = "x86_64" ; then
-+ MACHINE=LINUX64
-+else
-+ MACHINE=LINUX
-+fi
-+export MACHINE
-+make -C libsrc/csg
-+make -C libsrc/general
-+make -C libsrc/geom2d
-+make -C libsrc/gprim
-+make -C libsrc/interface
-+make -C libsrc/linalg
-+make -C libsrc/meshing
-+make -C libsrc/opti
-+make -C libsrc/stlgeom
-+make -C libsrc/occ
-+
-+if [ ! -d install ] ; then
-+      mkdir install
-+fi
-+
-+cp -r lib install/
-+
-+if [ ! -d install/include ] ; then
-+      mkdir install/include
-+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
diff --git a/src/NETGEN/netgen45lib64.patch b/src/NETGEN/netgen45lib64.patch
deleted file mode 100755 (executable)
index 6a29138..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-diff -ur netgen-4.5.old/libsrc/makefile.inc netgen-4.5.new/libsrc/makefile.inc
---- netgen-4.5/libsrc/makefile.inc     2006-04-27 13:12:54.000000000 +0400
-+++ netgen-4.5/libsrc/makefile.inc     2006-09-05 14:16:32.000000000 +0400
-@@ -14,7 +14,7 @@
- #
- include $(LIBSRC_DIR)/makefile.mach.$(MACHINE)
- #
--CPLUSPLUSFLAGS1 = -c -fPIC -I$(LIBSRC_DIR)/include -I$(OCCINC_DIR) \
-+CPLUSPLUSFLAGS1 = -c -m64 -D_OCC64 -fPIC -I$(LIBSRC_DIR)/include -I$(OCCINC_DIR) \
-       -DOCCGEOMETRY -DOCC52 -DHAVE_IOSTREAM -DHAVE_LIMITS_H
- #
- ARFLAGS = r
-diff -ur netgen-4.5.old/libsrc/makefile.mach.LINUX64 netgen-4.5.new/libsrc/makefile.mach.LINUX64
---- netgen-4.5/libsrc/makefile.mach.LINUX64    2006-03-29 15:09:32.000000000 +0400
-+++ netgen-4.5/libsrc/makefile.mach.LINUX64    2006-09-07 15:48:39.000000000 +0400
-@@ -11,7 +11,7 @@
- #
- #
- CFLAGS2 =
--CPLUSPLUSFLAGS2 = -pg -march=nocona -O2 -DLINUX -DOPENGL \
-+CPLUSPLUSFLAGS2 = -pg -march=nocona -O2 -DLINUX \
-       -ftemplate-depth-99 -finline-limit=100000 \
-         -fforce-addr  -funroll-loops \
-       -DTRAFO  -DNGSOLVE -DnoADDON -DnoLAPACK -DnoFAST \
-@@ -23,7 +23,7 @@
- # 
- #  
--LINKFLAGS2 = -pg -L/usr/openwin/lib64 -L/usr/X11R6/lib64 -L/usr/lib/GL3.5 -L/usr/lib64
-+LINKFLAGS2 = -fPIC -pg -L/usr/openwin/lib64 -L/usr/X11R6/lib64 -L/usr/lib/GL3.5 -L/usr/lib64
- SYSLIB2 =  -lstdc++ 
-diff -ur netgen-4.5.old/Makefile netgen-4.5.new/Makefile
---- netgen-4.5/Makefile        2006-03-29 15:09:12.000000000 +0400
-+++ netgen-4.5/Makefile        2006-09-07 15:46:07.000000000 +0400
-@@ -72,7 +72,7 @@
- #
- #CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include  -DOPENGL
--CPLUSPLUSFLAGS1 = -c -I$(LIBSRC_DIR)/include -I$(OCCINC_DIR)  -I./ngsolve/include -Ilibsrc/interface -DOPENGL -I$(METISINC)
-+CPLUSPLUSFLAGS1 = -c -m64 -D_OCC64 -I$(LIBSRC_DIR)/include -I$(OCCINC_DIR)  -I./ngsolve/include -Ilibsrc/interface -I$(METISINC)
- LINKFLAGS1 =   -lGL -lGLU -lX11 -lXext -lXmu 
- #
diff --git a/src/NETGEN/netgen50ForSalome.patch b/src/NETGEN/netgen50ForSalome.patch
new file mode 100644 (file)
index 0000000..ae7b2ed
--- /dev/null
@@ -0,0 +1,897 @@
+diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/meshing/meshtype.cpp netgen-5.0.0.patched/libsrc/meshing/meshtype.cpp
+--- netgen-5.0.0.orig/libsrc/meshing/meshtype.cpp      2012-11-09 19:15:04.000000000 +0400
++++ netgen-5.0.0.patched/libsrc/meshing/meshtype.cpp   2013-02-21 17:46:13.000000000 +0400
+@@ -1,4 +1,5 @@
+ #include <mystdlib.h>
++#include <float.h> // to get DBL_MIN defined
+ #include "meshing.hpp"  
+@@ -666,7 +667,8 @@
+         double det = trans.Det();
+-        if (det <= 0)
++        // if (det <= 0)
++        if (det <= DBL_MIN) // avoid FPE
+           err += 1e12;
+         else
+           err += frob * frob / det;
+@@ -722,7 +724,8 @@
+             double det = trans(0,0)*trans(1,1)-trans(1,0)*trans(0,1);
+-            if (det <= 0)
++            // if (det <= 0)
++            if (det <= DBL_MIN)  // avoid FPE
+               {
+                 dd = 0;
+                 return 1e12;
+@@ -806,7 +809,8 @@
+           = dtrans(0,0) * trans(1,1) - trans(0,1) * dtrans(1,0)
+           + trans(0,0) * dtrans(1,1) - dtrans(0,1) * trans(1,0);
+-        if (det <= 0)
++        // if (det <= 0)
++        if (det <= DBL_MIN) // avoid FPE
+           err += 1e12;
+         else
+           {
+@@ -856,7 +860,8 @@
+         frob /= 2;
+         double det = trans.Det();
+-        if (det <= 0)
++        //if (det <= 0)
++        if (det <= DBL_MIN) // avoid FPE
+           err += 1e12;
+         else
+           err += frob * frob / det;
+@@ -1864,7 +1869,8 @@
+       case PYRAMID:
+         {
+           double noz = 1-p(2);
+-          if (noz == 0.0) noz = 1e-10;
++          //if (noz == 0.0) noz = 1e-10;
++          if (noz <= DBL_MIN) noz = 1e-10; // avoid FPE
+           double xi  = p(0) / noz;
+           double eta = p(1) / noz;
+@@ -2030,7 +2036,8 @@
+         double det = -trans.Det();
+       
+-        if (det <= 0)
++        //if (det <= 0)
++        if (det <= DBL_MIN) // avoid FPE
+           err += 1e12;
+         else
+           err += frob * frob * frob / det;
+@@ -2102,7 +2109,8 @@
+         ddet *= -1;
+       
+-        if (det <= 0)
++        //if (det <= 0)
++        if (det <= DBL_MIN) // avoid FPE
+           err += 1e12;
+         else
+           {
+@@ -2184,7 +2192,7 @@
+       
+         det *= -1;
+       
+-        if (det <= 0)
++        if (det <= DBL_MIN)
+           err += 1e12;
+         else
+           {
+@@ -2513,10 +2521,10 @@
+   MeshingParameters :: MeshingParameters ()
+   {
+-    optimize3d = "cmdmustm";
++    optimize3d = (char*)"cmdmustm"; // optimize3d = "cmdmustm";
+     //optimize3d = "cmdmstm";
+     optsteps3d = 3;
+-    optimize2d = "smsmsmSmSmSm";
++    optimize2d = (char*)"smsmsmSmSmSm"; // optimize2d = "smsmsmSmSmSm";
+     optsteps2d = 3;
+     opterrpow = 2;
+     blockfill = 1;
+diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/meshing/meshtype.hpp netgen-5.0.0.patched/libsrc/meshing/meshtype.hpp
+--- netgen-5.0.0.orig/libsrc/meshing/meshtype.hpp      2012-11-09 19:15:04.000000000 +0400
++++ netgen-5.0.0.patched/libsrc/meshing/meshtype.hpp   2013-02-21 17:46:13.000000000 +0400
+@@ -15,6 +15,7 @@
+     Classes for NETGEN
+   */
++class Mesh; // added due to compilation errors on some platforms
+   enum ELEMENT_TYPE { 
+diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/meshing/smoothing2.cpp netgen-5.0.0.patched/libsrc/meshing/smoothing2.cpp
+--- netgen-5.0.0.orig/libsrc/meshing/smoothing2.cpp    2012-11-09 19:15:04.000000000 +0400
++++ netgen-5.0.0.patched/libsrc/meshing/smoothing2.cpp 2013-02-25 11:20:05.000000000 +0400
+@@ -200,7 +200,8 @@
+     vgrad = 0;
+     badness = 0;
+-    ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
++    //normal already computed: ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
++    n = ld.normal;
+     pp1 = ld.sp1 + x(0) * ld.t1 + x(1) * ld.t2;
+     //  meshthis -> ProjectPoint (surfi, pp1);
+@@ -258,7 +259,8 @@
+     vgrad = 0;
+     badness = 0;
+-    ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
++    //normal already computed: ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
++    n = ld.normal;
+     pp1 = ld.sp1 + x(0) * ld.t1 + x(1) * ld.t2;
+@@ -417,7 +419,8 @@
+     vgrad = 0;
+     badness = 0;
+-    ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
++    //normal already computed: ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
++    n = ld.normal;
+     pp1 = ld.sp1 + x(0) * ld.t1 + x(1) * ld.t2;
+@@ -489,7 +492,8 @@
+     vgrad = 0;
+     badness = 0;
+-    ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
++    //normal already computed: ld.meshthis -> GetNormalVector (ld.surfi, ld.sp1, ld.gi1, n);
++    n = ld.normal;
+     // pp1 = sp1;
+     //    pp1.Add2 (x.Get(1), t1, x.Get(2), t2);
+@@ -916,7 +920,7 @@
+               {
+                 mesh[pi] = Point<3> (origp);
+               }
+-          
++            break; // exit as <fact> is not used anymore
+           }
+       }
+       }
+diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/Partition_Inter3d.cxx netgen-5.0.0.patched/libsrc/occ/Partition_Inter3d.cxx
+--- netgen-5.0.0.orig/libsrc/occ/Partition_Inter3d.cxx 2012-11-09 19:15:02.000000000 +0400
++++ netgen-5.0.0.patched/libsrc/occ/Partition_Inter3d.cxx      2013-02-25 13:51:48.000000000 +0400
+@@ -243,9 +243,11 @@
+       Standard_Integer i, nbExt = anExtPS.NbExt();
+       Extrema_POnSurf aPOnSurf;
+       for (i = 1; i <= nbExt; ++i )
+-      if (anExtPS.Value( i ) <= TolE)               // V6.3
+-        // if (anExtPS.SquareDistance( i ) <= TolE)   // V6.5
+-        {
++        // porting to OCCT6.5.1
++      //if (anExtPS.Value( i ) <= TolE)               // V6.3
++      // if (anExtPS.SquareDistance( i ) <= TolE)   // V6.5
++        if (anExtPS.SquareDistance( i ) <= TolE * TolE)
++      {
+           aPOnSurf = anExtPS.Point( i );
+           break;
+         }
+diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/Partition_Loop2d.cxx netgen-5.0.0.patched/libsrc/occ/Partition_Loop2d.cxx
+--- netgen-5.0.0.orig/libsrc/occ/Partition_Loop2d.cxx  2012-11-09 19:15:02.000000000 +0400
++++ netgen-5.0.0.patched/libsrc/occ/Partition_Loop2d.cxx       2013-02-25 13:48:15.000000000 +0400
+@@ -210,7 +210,7 @@
+     Cc->D1(uc, PC, CTg1);
+     if (!isForward) CTg1.Reverse();
+-    Standard_Real anglemin = 3 * PI, tolAng = 1.e-8;
++    Standard_Real anglemin = 3 * M_PI, tolAng = 1.e-8;
+     // select an edge whose first derivative is most left of CTg1
+     // ie an angle between Tg1 and CTg1 is least
+@@ -234,7 +234,7 @@
+       // -PI < angle < PI
+       Standard_Real angle = Tg1.Angle(CTg1);
+-      if (PI - Abs(angle) <= tolAng)
++      if (M_PI - Abs(angle) <= tolAng)
+       {
+         // an angle is too close to PI; assure that an angle sign really
+         // reflects an edge position: +PI - an edge is worst,
+diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/Partition_Spliter.cxx netgen-5.0.0.patched/libsrc/occ/Partition_Spliter.cxx
+--- netgen-5.0.0.orig/libsrc/occ/Partition_Spliter.cxx 2012-11-09 19:15:02.000000000 +0400
++++ netgen-5.0.0.patched/libsrc/occ/Partition_Spliter.cxx      2013-02-25 13:55:10.000000000 +0400
+@@ -1169,8 +1169,10 @@
+           for (; j<=nbj && ok; ++j) {
+             if (Extrema.IsMin(j)) {
+             hasMin = Standard_True;
+-            ok = Extrema.Value(j) <= tol;  // V6.3
++            // porting to OCCT6.5.1
++            //ok = Extrema.Value(j) <= tol;  // V6.3
+             // ok = Extrema.SquareDistance(j) <= tol;  // V6.5
++            ok = Extrema.SquareDistance(j) <= tol * tol;
+           }
+           }
+         }
+diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/occconstruction.cpp netgen-5.0.0.patched/libsrc/occ/occconstruction.cpp
+--- netgen-5.0.0.orig/libsrc/occ/occconstruction.cpp   2012-11-09 19:15:02.000000000 +0400
++++ netgen-5.0.0.patched/libsrc/occ/occconstruction.cpp        2013-02-21 17:46:13.000000000 +0400
+@@ -28,7 +28,7 @@
+ #include <BRepAlgoAPI_Common.hxx>
+ #include <BRepAlgoAPI_Fuse.hxx>
+ #include <BRepAlgoAPI_Section.hxx>
+-#include <BRepOffsetAPI_Sewing.hxx>
++//#include <BRepOffsetAPI_Sewing.hxx>
+ //#include <BRepAlgo_Sewing.hxx>
+ #include <BRepOffsetAPI_MakeOffsetShape.hxx>
+ #include <ShapeFix_Shape.hxx>
+diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/occgenmesh.cpp netgen-5.0.0.patched/libsrc/occ/occgenmesh.cpp
+--- netgen-5.0.0.orig/libsrc/occ/occgenmesh.cpp        2012-11-09 19:15:02.000000000 +0400
++++ netgen-5.0.0.patched/libsrc/occ/occgenmesh.cpp     2013-02-21 17:46:13.000000000 +0400
+@@ -57,6 +57,8 @@
++   
++   static // useless out of this file
+    double ComputeH (double kappa)
+    {
+       double hret;
+@@ -74,8 +76,7 @@
+    }
+-
+-
++   static // useless out of this file
+    void RestrictHTriangle (gp_Pnt2d & par0, gp_Pnt2d & par1, gp_Pnt2d & par2,
+                            BRepLProp_SLProps * prop, Mesh & mesh, int depth, double h = 0)
+    {
+@@ -171,8 +172,8 @@
+          if(h < 1e-4*maxside)
+             return;
+-
+-         if (h > 30) return;
++         // commented to restrict H on a large sphere for example
++         //if (h > 30) return;
+       }
+       if (h < maxside && depth < 10)
+@@ -231,6 +232,7 @@
++   static // useless out of this file
+    void DivideEdge (TopoDS_Edge & edge, Array<MeshPoint> & ps,
+                     Array<double> & params, Mesh & mesh)
+    {
+@@ -250,8 +252,8 @@
+       hvalue[0] = 0;
+       pnt = c->Value(s0);
+-      double olddist = 0;
+-      double dist = 0;
++      //double olddist = 0; -- useless variables
++      //double dist = 0;
+       int tmpVal = (int)(DIVIDEEDGESECTIONS);
+@@ -259,15 +261,19 @@
+       {
+          oldpnt = pnt;
+          pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0));
++         // -- no more than 1 segment per <edge length>/DIVIDEEDGESECTIONS
+          hvalue[i] = hvalue[i-1] +
+-            1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
+-            pnt.Distance(oldpnt);
++         //   1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
++         //   pnt.Distance(oldpnt);
++           min( 1.0,
++                1.0/mesh.GetH(Point3d(pnt.X(), pnt.Y(), pnt.Z()))*
++                pnt.Distance(oldpnt));
+          //(*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;
+-         olddist = dist;
+-         dist = pnt.Distance(oldpnt);
++         //olddist = dist; -- useless variables
++         //dist = pnt.Distance(oldpnt);
+       }
+       //  nsubedges = int(ceil(hvalue[DIVIDEEDGESECTIONS]));
+@@ -282,7 +288,10 @@
+       {
+          if (hvalue[i1]/hvalue[DIVIDEEDGESECTIONS]*nsubedges >= i)
+          {
+-            params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
++            // -- for nsubedges comparable to DIVIDEEDGESECTIONS
++            //params[i] = s0+(i1/double(DIVIDEEDGESECTIONS))*(s1-s0);
++            double d1 = i1 - (hvalue[i1] - i*hvalue[DIVIDEEDGESECTIONS]/nsubedges)/(hvalue[i1]-hvalue[i1-1]);
++            params[i] = s0+(d1/double(DIVIDEEDGESECTIONS))*(s1-s0);
+             pnt = c->Value(params[i]);
+             ps[i-1] = MeshPoint (Point3d(pnt.X(), pnt.Y(), pnt.Z()));
+             i++;
+@@ -326,6 +335,7 @@
+       (*testout) << "nedges = " << nedges << endl;
+       double eps = 1e-6 * geom.GetBoundingBox().Diam();
++      const double eps2 = eps * eps; // -- small optimization
+       for (int i = 1; i <= nvertices; i++)
+       {
+@@ -335,7 +345,8 @@
+          bool exists = 0;
+          if (merge_solids)
+             for (PointIndex pi = 1; pi <= mesh.GetNP(); pi++)
+-               if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)
++               //if ( Dist2 (mesh[pi], Point<3>(mp)) < eps*eps)              
++               if ( Dist2 (mesh[pi], Point<3>(mp)) < eps2 ) // -- small optimization
+                {
+                   exists = 1;
+                   break;
+@@ -365,6 +376,7 @@
+          {
+             TopoDS_Face face = TopoDS::Face(exp1.Current());
+             int facenr = geom.fmap.FindIndex(face);
++            if ( facenr < 1 ) continue; // -- to support SALOME sub-meshes
+             if (face2solid[0][facenr-1] == 0)
+                face2solid[0][facenr-1] = solidnr;
+@@ -384,6 +396,7 @@
+       int facenr = 0;
+       int edgenr = 0;
++      edgenr = mesh.GetNSeg(); // to support SALOME sub-meshes
+       (*testout) << "faces = " << geom.fmap.Extent() << endl;
+       int curr = 0;
+@@ -445,6 +458,7 @@
+                   //(*testout) << "ignoring degenerated edge" << endl;
+                   continue;
+                }
++               if ( geom.emap.FindIndex(edge) < 1 ) continue; // to support SALOME sub-meshes
+                if (geom.vmap.FindIndex(TopExp::FirstVertex (edge)) ==
+                   geom.vmap.FindIndex(TopExp::LastVertex (edge)))
+@@ -482,15 +496,64 @@
+                }
+                else
+                {
+-                  Point<3> fp = occ2ng (BRep_Tool::Pnt (TopExp::FirstVertex (edge)));
+-                  Point<3> lp = occ2ng (BRep_Tool::Pnt (TopExp::LastVertex (edge)));
++                 TopoDS_Iterator vIt( edge, false );
++                 TopoDS_Vertex v1 = TopoDS::Vertex( vIt.Value() ); vIt.Next();
++                 TopoDS_Vertex v2 = TopoDS::Vertex( vIt.Value() );
++                 if ( v1.Orientation() == TopAbs_REVERSED )
++                   std::swap( v1, v2 );
++                 const bool isClosedEdge = v1.IsSame( v2 );
++                 
++                  Point<3> fp = occ2ng (BRep_Tool::Pnt (v1));
++                  Point<3> lp = occ2ng (BRep_Tool::Pnt (v2));
++                  double tol2 = std::min( eps*eps, 1e-6 * Dist2( fp, lp ));
++                  if ( isClosedEdge )
++                    tol2 = BRep_Tool::Tolerance( v1 ) * BRep_Tool::Tolerance( v1 );
+                   pnums[0] = -1;
+                   pnums.Last() = -1;
+                   for (PointIndex pi = 1; pi < first_ep; pi++)
+                   {
+-                     if (Dist2 (mesh[pi], fp) < eps*eps) pnums[0] = pi;
+-                     if (Dist2 (mesh[pi], lp) < eps*eps) pnums.Last() = pi;
++                    if (Dist2 (mesh[pi], fp) < tol2) pnums[0] = pi;
++                    if (Dist2 (mesh[pi], lp) < tol2) pnums.Last() = pi;
++                  }
++                  if (( isClosedEdge && pnums[0] != pnums.Last() ) ||
++                      ( !isClosedEdge && pnums[0] == pnums.Last() ))
++                    pnums[0] = pnums.Last() = -1;
++                  if ( pnums[0] == -1 || pnums.Last() == -1 )
++                  {
++                    // take into account a possible large gap between a vertex and an edge curve
++                    // end and a large vertex tolerance covering the whole edge
++                    if ( pnums[0] == -1 )
++                    {
++                      double tol = BRep_Tool::Tolerance( v1 );
++                      for (PointIndex pi = 1; pi < first_ep; pi++)
++                        if (pi != pnums.Last() && Dist2 (mesh[pi], fp) < 2*tol*tol)
++                          pnums[0] = pi;
++
++                      if ( pnums[0] == -1 )
++                        pnums[0] = first_ep-1- nvertices + geom.vmap.FindIndex ( v1 );
++                    }
++                    if ( isClosedEdge )
++                    {
++                      pnums.Last() = pnums[0];
++                    }
++                    else
++                    {
++                      if ( pnums.Last() == -1 )
++                      {
++                        double tol = BRep_Tool::Tolerance( v2 );
++                        for (PointIndex pi = 1; pi < first_ep; pi++)
++                          if (pi != pnums[0] && Dist2 (mesh[pi], lp) < 2*tol*tol)
++                            pnums.Last() = pi;
++
++                        if ( pnums.Last() == -1 )
++                          pnums.Last() = first_ep-1-nvertices + geom.vmap.FindIndex ( v2 );
++                      }
++
++                      if ( Dist2( fp, mesh[PointIndex(pnums[0])]) >
++                           Dist2( lp, mesh[PointIndex(pnums.Last())]))
++                      std::swap( pnums[0], pnums.Last() );
++                    }
+                   }
+                }
+@@ -1458,3 +1521,4 @@
+ }
+ #endif
++
+diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/occgeom.cpp netgen-5.0.0.patched/libsrc/occ/occgeom.cpp
+--- netgen-5.0.0.orig/libsrc/occ/occgeom.cpp   2012-11-09 19:15:02.000000000 +0400
++++ netgen-5.0.0.patched/libsrc/occ/occgeom.cpp        2013-02-21 17:46:13.000000000 +0400
+@@ -8,6 +8,8 @@
+ #include "ShapeAnalysis_CheckSmallFace.hxx"
+ #include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx"
+ #include "ShapeAnalysis_Surface.hxx"
++#include <BRepTopAdaptor_FClass2d.hxx> // -- to optimize Project() and FastProject()
++#include <TopAbs_State.hxx>
+ #include "BRepAlgoAPI_Fuse.hxx"
+ #include "BRepCheck_Analyzer.hxx"
+ #include "BRepLib.hxx"
+@@ -16,10 +18,17 @@
+ #include "ShapeFix_FixSmallFace.hxx"
+ #include "Partition_Spliter.hxx"
+-
+ namespace netgen
+ {
+-   void OCCGeometry :: PrintNrShapes ()
++  // free data used to optimize Project() and FastProject()
++  OCCGeometry::~OCCGeometry()
++  {
++    NCollection_DataMap<int,BRepTopAdaptor_FClass2d*>::Iterator it(fclsmap);
++    for (; it.More(); it.Next())
++      delete it.Value();
++  }
++
++  void OCCGeometry :: PrintNrShapes ()
+    {
+       TopExp_Explorer e;
+       int count = 0;
+@@ -951,25 +960,58 @@
+    }
++   // returns a projector and a classifier for the given surface
++   void OCCGeometry::GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
++                                  BRepTopAdaptor_FClass2d*& cls) const
++   {
++     //MSV: organize caching projector in the map
++     if (fprjmap.IsBound(surfi))
++     {
++       proj = fprjmap.Find(surfi);
++       cls = fclsmap.Find(surfi);
++     }
++     else
++     {
++       const TopoDS_Face& aFace = TopoDS::Face(fmap(surfi));
++       Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
++       proj = new ShapeAnalysis_Surface(aSurf);
++       fprjmap.Bind(surfi, proj);
++       cls = new BRepTopAdaptor_FClass2d(aFace,Precision::Confusion());
++       fclsmap.Bind(surfi, cls);
++     }
++   }
+-
+-   void OCCGeometry :: Project (int surfi, Point<3> & p) const
++   // void OCCGeometry :: Project (int surfi, Point<3> & p) const
++   bool OCCGeometry :: Project (int surfi, Point<3> & p, double& u, double& v) const
+    {
+       static int cnt = 0;
+       if (++cnt % 1000 == 0) cout << "Project cnt = " << cnt << endl;
+       gp_Pnt pnt(p(0), p(1), p(2));
+-      double u,v;
+-      Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
+-      Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
+-      gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
+-      suval.Coord( u, v);
+-      pnt = thesurf->Value( u, v );
+-
+-
++      // -- Optimization: use cached projector and classifier
++      // double u,v;
++      // Handle( Geom_Surface ) thesurf = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
++      // Handle( ShapeAnalysis_Surface ) su = new ShapeAnalysis_Surface( thesurf );
++      // gp_Pnt2d suval = su->ValueOfUV ( pnt, BRep_Tool::Tolerance( TopoDS::Face(fmap(surfi)) ) );
++      // suval.Coord( u, v);
++      // pnt = thesurf->Value( u, v );  
++
++      Handle(ShapeAnalysis_Surface) proj;
++      BRepTopAdaptor_FClass2d *cls;
++      GetFaceTools(surfi, proj, cls);
++  
++      gp_Pnt2d p2d = proj->ValueOfUV(pnt, Precision::Confusion());
++      if (cls->Perform(p2d) == TopAbs_OUT)
++      {
++        return false;
++      }
++      pnt = proj->Value(p2d);
++      p2d.Coord(u, v);
++  
+       p = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
++      return true;
+    }
+@@ -979,54 +1021,69 @@
+    {
+       gp_Pnt p(ap(0), ap(1), ap(2));
+-      Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
+-
+-      gp_Pnt x = surface->Value (u,v);
+-
+-      if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
+-
+-      gp_Vec du, dv;
+-
+-      surface->D1(u,v,x,du,dv);
+-
+-      int count = 0;
+-
+-      gp_Pnt xold;
+-      gp_Vec n;
+-      double det, lambda, mu;
+-
+-      do {
+-         count++;
+-
+-         n = du^dv;
+-
+-         det = Det3 (n.X(), du.X(), dv.X(),
+-            n.Y(), du.Y(), dv.Y(),
+-            n.Z(), du.Z(), dv.Z());
+-
+-         if (det < 1e-15) return false;
+-
+-         lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
+-            n.Y(), p.Y()-x.Y(), dv.Y(),
+-            n.Z(), p.Z()-x.Z(), dv.Z())/det;
+-
+-         mu     = Det3 (n.X(), du.X(), p.X()-x.X(),
+-            n.Y(), du.Y(), p.Y()-x.Y(),
+-            n.Z(), du.Z(), p.Z()-x.Z())/det;
+-
+-         u += lambda;
+-         v += mu;
+-
+-         xold = x;
+-         surface->D1(u,v,x,du,dv);
+-
+-      } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
+-
+-      //    (*testout) << "FastProject count: " << count << endl;
+-
+-      if (count == 50) return false;
+-
+-      ap = Point<3> (x.X(), x.Y(), x.Z());
++      // -- Optimization: use cached projector and classifier
++      // Handle(Geom_Surface) surface = BRep_Tool::Surface(TopoDS::Face(fmap(surfi)));
++      // 
++      // gp_Pnt x = surface->Value (u,v);
++      // 
++      // if (p.SquareDistance(x) <= sqr(PROJECTION_TOLERANCE)) return true;
++      // 
++      // gp_Vec du, dv;
++      // 
++      // surface->D1(u,v,x,du,dv);
++      // 
++      // int count = 0;
++      // 
++      // gp_Pnt xold;
++      // gp_Vec n;
++      // double det, lambda, mu;
++      // 
++      // do {
++      //    count++;
++      // 
++      //    n = du^dv;
++      // 
++      //    det = Det3 (n.X(), du.X(), dv.X(),
++      //       n.Y(), du.Y(), dv.Y(),
++      //       n.Z(), du.Z(), dv.Z());
++      // 
++      //    if (det < 1e-15) return false;
++      // 
++      //    lambda = Det3 (n.X(), p.X()-x.X(), dv.X(),
++      //       n.Y(), p.Y()-x.Y(), dv.Y(),
++      //       n.Z(), p.Z()-x.Z(), dv.Z())/det;
++      // 
++      //    mu     = Det3 (n.X(), du.X(), p.X()-x.X(),
++      //       n.Y(), du.Y(), p.Y()-x.Y(),
++      //       n.Z(), du.Z(), p.Z()-x.Z())/det;
++      // 
++      //    u += lambda;
++      //    v += mu;
++      // 
++      //    xold = x;
++      //    surface->D1(u,v,x,du,dv);
++      // 
++      // } while (xold.SquareDistance(x) > sqr(PROJECTION_TOLERANCE) && count < 50);
++      // 
++      // //    (*testout) << "FastProject count: " << count << endl;
++      // 
++      // if (count == 50) return false;
++      // 
++      // ap = Point<3> (x.X(), x.Y(), x.Z());
++      Handle(ShapeAnalysis_Surface) proj;
++      BRepTopAdaptor_FClass2d *cls;
++      GetFaceTools(surfi, proj, cls);
++    
++      gp_Pnt2d p2d = proj->NextValueOfUV(gp_Pnt2d(u,v), p, Precision::Confusion());
++      if (cls->Perform(p2d) == TopAbs_OUT)
++      {
++        //cout << "Projection fails" << endl;
++        return false;
++      }
++    
++      p = proj->Value(p2d);
++      p2d.Coord(u, v);
++      ap = Point<3> (p.X(), p.Y(), p.Z());
+       return true;
+    }
+diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/occgeom.hpp netgen-5.0.0.patched/libsrc/occ/occgeom.hpp
+--- netgen-5.0.0.orig/libsrc/occ/occgeom.hpp   2012-11-09 19:15:02.000000000 +0400
++++ netgen-5.0.0.patched/libsrc/occ/occgeom.hpp        2013-02-21 17:46:13.000000000 +0400
+@@ -15,8 +15,8 @@
+ #include "Geom_Curve.hxx"
+ #include "Geom2d_Curve.hxx"
+ #include "Geom_Surface.hxx"
+-#include "GeomAPI_ProjectPointOnSurf.hxx"
+-#include "GeomAPI_ProjectPointOnCurve.hxx"
++// #include "GeomAPI_ProjectPointOnSurf.hxx"
++// #include "GeomAPI_ProjectPointOnCurve.hxx"
+ #include "BRepTools.hxx"
+ #include "TopExp.hxx"
+ #include "BRepBuilderAPI_MakeVertex.hxx"
+@@ -42,8 +42,8 @@
+ #include "Geom_Curve.hxx"
+ #include "Geom2d_Curve.hxx"
+ #include "Geom_Surface.hxx"
+-#include "GeomAPI_ProjectPointOnSurf.hxx"
+-#include "GeomAPI_ProjectPointOnCurve.hxx"
++// #include "GeomAPI_ProjectPointOnSurf.hxx"
++// #include "GeomAPI_ProjectPointOnCurve.hxx"
+ #include "TopoDS_Wire.hxx"
+ #include "BRepTools_WireExplorer.hxx"
+ #include "BRepTools.hxx"
+@@ -68,7 +68,7 @@
+ #include "IGESToBRep_Reader.hxx"
+ #include "Interface_Static.hxx"
+ #include "GeomAPI_ExtremaCurveCurve.hxx"
+-#include "Standard_ErrorHandler.hxx"
++//#include "Standard_ErrorHandler.hxx"
+ #include "Standard_Failure.hxx"
+ #include "ShapeUpgrade_ShellSewing.hxx"
+ #include "ShapeFix_Shape.hxx"
+@@ -80,6 +80,10 @@
+ #include "ShapeAnalysis.hxx"
+ #include "ShapeBuild_ReShape.hxx"
++// -- Optimization: to use cached projector and classifier
++#include <NCollection_DataMap.hxx>
++class Handle_ShapeAnalysis_Surface;
++class BRepTopAdaptor_FClass2d;
+ // Philippose - 29/01/2009
+ // OpenCascade XDE Support
+@@ -192,6 +196,9 @@
+    class OCCGeometry : public NetgenGeometry
+    {
+       Point<3> center;
++      // -- Optimization: to use cached projector and classifier
++      mutable NCollection_DataMap<int,Handle_ShapeAnalysis_Surface> fprjmap;
++      mutable NCollection_DataMap<int,BRepTopAdaptor_FClass2d*> fclsmap;
+    public:
+       TopoDS_Shape shape;
+@@ -247,6 +254,8 @@
+      virtual void Save (string filename) const;
++      ~OCCGeometry();      // -- to free cached projector and classifier
++
+       void BuildFMap();
+       Box<3> GetBoundingBox()
+@@ -266,9 +275,14 @@
+       Point<3> Center()
+       {  return center;}
+-      void Project (int surfi, Point<3> & p) const;
++      // void Project (int surfi, Point<3> & p) const; -- optimization
++      bool Project (int surfi, Point<3> & p, double& u, double& v) const;
+       bool FastProject (int surfi, Point<3> & ap, double& u, double& v) const;
++      // -- Optimization: to use cached projector and classifier
++      void GetFaceTools(int surfi, Handle(ShapeAnalysis_Surface)& proj,
++                        BRepTopAdaptor_FClass2d*& cls) const;
++
+       OCCSurface GetSurface (int surfi)
+       {
+          cout << "OCCGeometry::GetSurface using PLANESPACE" << endl;
+diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/occmeshsurf.cpp netgen-5.0.0.patched/libsrc/occ/occmeshsurf.cpp
+--- netgen-5.0.0.orig/libsrc/occ/occmeshsurf.cpp       2012-11-09 19:15:02.000000000 +0400
++++ netgen-5.0.0.patched/libsrc/occ/occmeshsurf.cpp    2013-02-25 13:27:49.000000000 +0400
+@@ -6,6 +6,7 @@
+ #include <meshing.hpp>
+ #include <GeomLProp_SLProps.hxx>
+ #include <ShapeAnalysis_Surface.hxx>
++#include <GeomAPI_ProjectPointOnCurve.hxx> // -- moved here from occgeom.hpp
+ namespace netgen
+@@ -434,23 +435,33 @@
+   void MeshOptimize2dOCCSurfaces :: ProjectPoint (INDEX surfind, Point<3> & p) const
+   {
+-    geometry.Project (surfind, p);
++    // geometry.Project (surfind, p); -- signature of Project() changed for optimization
++    double u, v;
++    geometry.Project (surfind, p, u, v);
+   }
+   int MeshOptimize2dOCCSurfaces :: ProjectPointGI (INDEX surfind, Point<3> & p, PointGeomInfo & gi) const
+   {
+-    double u = gi.u;
+-    double v = gi.v;
++    //double u = gi.u;
++    //double v = gi.v;
+     Point<3> hp = p;
+-    if (geometry.FastProject (surfind, hp, u, v))
+-      {
+-      p = hp;
+-      return 1;
+-      }
+-    ProjectPoint (surfind, p); 
+-    return CalcPointGeomInfo (surfind, gi, p); 
++    // -- u and v are computed by FastProject() and Project(), no need to call CalcPointGeomInfo()
++    // if (geometry.FastProject (surfind, hp, u, v))
++    //   {
++    //    p = hp;
++    //    return 1;
++    //   }
++    // ProjectPoint (surfind, p); 
++    // return CalcPointGeomInfo (surfind, gi, p); 
++    bool ok;
++    if (gi.trignum > 0)
++      ok = geometry.FastProject (surfind, hp, gi.u, gi.v);
++    else
++      ok = geometry.Project (surfind, hp, gi.u, gi.v);
++    p = hp;
++    return ok;
+   }
+@@ -680,7 +691,8 @@
+       if (!geometry.FastProject (surfi, hnewp, u, v))
+         {
+         //  cout << "Fast projection to surface fails! Using OCC projection" << endl;
+-          geometry.Project (surfi, hnewp);
++          // geometry.Project (surfi, hnewp); -- Project() changed for optimization
++          geometry.Project (surfi, hnewp, u, v);
+         }
+       newgi.trignum = 1;
+@@ -689,7 +701,7 @@
+       }
+   
+     newp = hnewp;
+-  }
++  }//; -- to compile with -Wall -pedantic
+   void OCCRefinementSurfaces :: 
+@@ -708,14 +720,18 @@
+     hnewp = Point<3> (pnt.X(), pnt.Y(), pnt.Z());
+     newp = hnewp;
+     newgi = ap1;
+-  };
++  }
+   void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi) const
+   {
+     if (surfi > 0)
+-      geometry.Project (surfi, p);
+-  };
++    // geometry.Project (surfi, p); -- Project() changed for optimization
++    {
++      double u, v;
++      geometry.Project (surfi, p, u, v);
++    }
++  }//; -- to compile with -Wall -pedantic
+   void OCCRefinementSurfaces :: ProjectToSurface (Point<3> & p, int surfi, PointGeomInfo & gi) const
+   {
+@@ -723,9 +739,10 @@
+       if (!geometry.FastProject (surfi, p, gi.u, gi.v))
+       {
+         cout << "Fast projection to surface fails! Using OCC projection" << endl;
+-        geometry.Project (surfi, p);
++          double u, v;
++        geometry.Project (surfi, p, u, v);
+       }
+-  };
++  }
+diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/occ/utilities.h netgen-5.0.0.patched/libsrc/occ/utilities.h
+--- netgen-5.0.0.orig/libsrc/occ/utilities.h   2012-11-09 19:15:02.000000000 +0400
++++ netgen-5.0.0.patched/libsrc/occ/utilities.h        2013-02-21 17:47:08.000000000 +0400
+@@ -33,6 +33,7 @@
+ #include <string>
+ #include <iostream>
++#include <iomanip>
+ #include <cstdlib>
+ // #include "SALOME_Log.hxx"
+diff -Naur --exclude=CVS netgen-5.0.0.orig/libsrc/stlgeom/stlgeommesh.cpp netgen-5.0.0.patched/libsrc/stlgeom/stlgeommesh.cpp
+--- netgen-5.0.0.orig/libsrc/stlgeom/stlgeommesh.cpp   2012-11-09 19:15:04.000000000 +0400
++++ netgen-5.0.0.patched/libsrc/stlgeom/stlgeommesh.cpp        2013-02-21 17:52:07.000000000 +0400
+@@ -1435,7 +1435,8 @@
+         /*
+         if (!optstring || strlen(optstring) == 0)
+           {
+-            mparam.optimize2d = "smcm";
++            //mparam.optimize2d = (char*)"smcm";
++              mparam.optimize2d = (char*)"smcm";
+           }
+         else
+           {
+@@ -1453,7 +1454,7 @@
+             mesh -> LoadLocalMeshSize (mparam.meshsizefilename);            
+             mesh -> CalcLocalHFromSurfaceCurvature (mparam.grading, 
+                                                     stlparam.resthsurfmeshcurvfac);
+-            mparam.optimize2d = "cmsmSm";
++            mparam.optimize2d = "(char*)cmsmSm";
+             STLSurfaceOptimization (*stlgeometry, *mesh, mparam);
+ #ifdef STAT_STREAM
+             (*statout) << GetTime() << " & ";
+@@ -1560,7 +1561,8 @@
+         /*
+         if (!optstring || strlen(optstring) == 0)
+           {
+-            mparam.optimize3d = "cmdmstm";
++              //mparam.optimize3d = "cmdmstm";
++            mparam.optimize3d = (char*)"cmdmstm";
+           }
+         else
+           {
+diff -Naur --exclude=CVS netgen-5.0.0.orig/nglib/nglib.h netgen-5.0.0.patched/nglib/nglib.h
+--- netgen-5.0.0.orig/nglib/nglib.h    2012-11-09 19:15:00.000000000 +0400
++++ netgen-5.0.0.patched/nglib/nglib.h 2013-02-21 17:47:08.000000000 +0400
+@@ -24,7 +24,7 @@
+ // Philippose - 14.02.2009
+ // Modifications for creating a DLL in Windows
+ #ifdef WIN32
+-   #ifdef NGLIB_EXPORTS || nglib_EXPORTS
++   #if defined NGLIB_EXPORTS || defined nglib_EXPORTS
+       #define DLL_HEADER   __declspec(dllexport)
+    #else
+       #define DLL_HEADER   __declspec(dllimport)
index a580ac972540acc11027e15acb679dac60ffc854..4b6c0b206de6b0c29e414102c028f597f052eb49 100644 (file)
@@ -87,11 +87,7 @@ libNETGENEngine_la_CPPFLAGS = \
        $(BOOST_CPPFLAGS) \
        -I$(top_builddir)/idl
 
-if ! NETGEN_NEW
-libNETGENEngine_la_LDFLAGS = ../NETGEN/libNETGEN.la
-else
 libNETGENEngine_la_LDFLAGS = $(NETGEN_LIBS)
-endif
 
 libNETGENEngine_la_LDFLAGS  += \
        ../../idl/libSalomeIDLNETGENPLUGIN.la \
index e430ad8cc23d6a7e3165b0d7141dba32ca4d6ff0..516ed54751db8ebce40cbab2f256a4d3af038649 100644 (file)
 #include <meshing.hpp>
 //#include <ngexception.hpp>
 namespace netgen {
+#ifdef NETGEN_V5
+  extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
+#else
   extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
+#endif
   //extern void OCCSetLocalMeshSize(OCCGeometry & geom, Mesh & mesh);
   extern MeshingParameters mparam;
   extern volatile multithreadt multithread;
@@ -88,11 +92,7 @@ using namespace std;
 #define nodeVec_ACCESS(index) ((SMDS_MeshNode*) nodeVec[index])
 #endif
 
-#ifdef NETGEN_NEW
 #define NGPOINT_COORDS(p) p(0),p(1),p(2)
-#else
-#define NGPOINT_COORDS(p) p.X(),p.Y(),p.Z()
-#endif
 
 // dump elements added to ng mesh
 //#define DUMP_SEGMENTS
@@ -522,12 +522,10 @@ void NETGENPlugin_Mesher::PrepareOCCgeometry(netgen::OCCGeometry&     occgeo,
   }
   occgeo.facemeshstatus.SetSize (occgeo.fmap.Extent());
   occgeo.facemeshstatus = 0;
-#ifdef NETGEN_NEW
   occgeo.face_maxh_modified.SetSize(occgeo.fmap.Extent());
   occgeo.face_maxh_modified = 0;
   occgeo.face_maxh.SetSize(occgeo.fmap.Extent());
   occgeo.face_maxh = netgen::mparam.maxh;
-#endif
 }
 
 //================================================================================
@@ -1765,11 +1763,7 @@ int NETGENPlugin_Mesher::FillSMesh(const netgen::OCCGeometry&          occgeo,
   {
     const netgen::Segment& seg = ngMesh.LineSegment(i);
     TopoDS_Edge aEdge;
-#ifdef NETGEN_NEW
     int pinds[3] = { seg.pnums[0], seg.pnums[1], seg.pnums[2] };
-#else
-    int pinds[3] = { seg.p1, seg.p2, seg.pmid };
-#endif
     int nbp = 0;
     double param2 = 0;
     for (int j=0; j < 3; ++j)
@@ -2118,19 +2112,23 @@ bool NETGENPlugin_Mesher::Compute()
     if ( _simpleHyp || ( mparams.minh == 0.0 && _fineness != NETGENPlugin_Hypothesis::UserDefined))
       mparams.minh = GetDefaultMinSize( _shape, mparams.maxh );
 
-#ifdef NETGEN_NEW
     // Local size on faces
     occgeo.face_maxh = mparams.maxh;
-#endif
 
     // Let netgen create ngMesh and calculate element size on not meshed shapes
+#ifndef NETGEN_V5
     char *optstr = 0;
+#endif
     int startWith = netgen::MESHCONST_ANALYSE;
     int endWith   = netgen::MESHCONST_ANALYSE;
     try
     {
       OCC_CATCH_SIGNALS;
+#ifdef NETGEN_V5
+      err = netgen::OCCGenerateMesh(occgeo, ngMesh, mparams, startWith, endWith);
+#else
       err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#endif
 #ifdef WITH_SMESH_CANCEL_COMPUTE
       if(netgen::multithread.terminate)
         return false;
@@ -2205,10 +2203,8 @@ bool NETGENPlugin_Mesher::Compute()
       internals.getInternalEdges( intOccgeo.fmap, intOccgeo.emap, intOccgeo.vmap, meshedSM );
       intOccgeo.boundingbox = occgeo.boundingbox;
       intOccgeo.shape = occgeo.shape;
-#ifdef NETGEN_NEW
       intOccgeo.face_maxh.SetSize(intOccgeo.fmap.Extent());
       intOccgeo.face_maxh = netgen::mparam.maxh;
-#endif
       netgen::Mesh *tmpNgMesh = NULL;
       try
       {
@@ -2217,7 +2213,11 @@ bool NETGENPlugin_Mesher::Compute()
         //OCCSetLocalMeshSize(intOccgeo, *ngMesh); it deletes ngMesh->localH
 
         // let netgen create a temporary mesh
+#ifdef NETGEN_V5
+        netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, mparams, startWith, endWith);
+#else
         netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, startWith, endWith, optstr);
+#endif
 #ifdef WITH_SMESH_CANCEL_COMPUTE
         if(netgen::multithread.terminate)
           return false;
@@ -2227,7 +2227,11 @@ bool NETGENPlugin_Mesher::Compute()
 
         // compute mesh on internal edges
         startWith = endWith = netgen::MESHCONST_MESHEDGES;
+#ifdef NETGEN_V5
+        err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, mparams, startWith, endWith);
+#else
         err = netgen::OCCGenerateMesh(intOccgeo, tmpNgMesh, startWith, endWith, optstr);
+#endif
         comment << text(err);
       }
       catch (Standard_Failure& ex)
@@ -2260,7 +2264,11 @@ bool NETGENPlugin_Mesher::Compute()
       try
       {
         OCC_CATCH_SIGNALS;
+#ifdef NETGEN_V5
+        err = netgen::OCCGenerateMesh(occgeo, ngMesh, mparams, startWith, endWith);
+#else
         err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#endif
 #ifdef WITH_SMESH_CANCEL_COMPUTE
         if(netgen::multithread.terminate)
           return false;
@@ -2364,7 +2372,11 @@ bool NETGENPlugin_Mesher::Compute()
       try
       {
         OCC_CATCH_SIGNALS;
+#ifdef NETGEN_V5
+        err = netgen::OCCGenerateMesh(occgeo, ngMesh, mparams, startWith, endWith);
+#else
         err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#endif
 #ifdef WITH_SMESH_CANCEL_COMPUTE
         if(netgen::multithread.terminate)
           return false;
@@ -2435,7 +2447,11 @@ bool NETGENPlugin_Mesher::Compute()
         }
         ngMesh->SetGlobalH (mparams.maxh);
         mparams.grading = 0.4;
+#ifdef NETGEN_V5
+        ngMesh->CalcLocalH(mparams.grading);
+#else
         ngMesh->CalcLocalH();
+#endif
       }
       // Care of vertices internal in solids and internal faces (issue 0020676)
       if ( internals.hasInternalVertexInSolid() || internals.hasInternalFaces() )
@@ -2454,7 +2470,11 @@ bool NETGENPlugin_Mesher::Compute()
       try
       {
         OCC_CATCH_SIGNALS;
+#ifdef NETGEN_V5
+        err = netgen::OCCGenerateMesh(occgeo, ngMesh, mparams, startWith, endWith);
+#else
         err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#endif
 #ifdef WITH_SMESH_CANCEL_COMPUTE
         if(netgen::multithread.terminate)
           return false;
@@ -2481,7 +2501,11 @@ bool NETGENPlugin_Mesher::Compute()
         try
         {
           OCC_CATCH_SIGNALS;
+#ifdef NETGEN_V5
+          err = netgen::OCCGenerateMesh(occgeo, ngMesh, mparams, startWith, endWith);
+#else
           err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#endif
 #ifdef WITH_SMESH_CANCEL_COMPUTE
           if(netgen::multithread.terminate)
             return false;
@@ -2652,10 +2676,16 @@ bool NETGENPlugin_Mesher::Evaluate(MapShapeNbElems& aResMap)
   // let netgen create ngMesh and calculate element size on not meshed shapes
   NETGENPlugin_NetgenLibWrapper ngLib;
   netgen::Mesh *ngMesh = NULL;
+#ifndef NETGEN_V5
   char *optstr = 0;
+#endif
   int startWith = netgen::MESHCONST_ANALYSE;
   int endWith   = netgen::MESHCONST_MESHEDGES;
+#ifdef NETGEN_V5
+  int err = netgen::OCCGenerateMesh(occgeo, ngMesh, mparams, startWith, endWith);
+#else
   int err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#endif
 #ifdef WITH_SMESH_CANCEL_COMPUTE
   if(netgen::multithread.terminate)
     return false;
@@ -3047,7 +3077,11 @@ void NETGENPlugin_ngMeshInfo::transferLocalH( netgen::Mesh* fromMesh,
 {
   if ( !fromMesh->LocalHFunctionGenerated() ) return;
   if ( !toMesh->LocalHFunctionGenerated() )
+#ifdef NETGEN_V5
+    toMesh->CalcLocalH(netgen::mparam.grading);
+#else
     toMesh->CalcLocalH();
+#endif
 
   const size_t size = sizeof( netgen::LocalH );
   _copyOfLocalH = new char[ size ];
index acb55cf6871b78e30e11a1f8897db12075d9f4f0..6602d6e3587d65e264c6e3d5142437ca9a80a66e 100644 (file)
@@ -63,7 +63,11 @@ namespace nglib {
 #include <meshing.hpp>
 //#include <meshtype.hpp>
 namespace netgen {
+#ifdef NETGEN_V5
+  extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
+#else
   extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
+#endif
   extern MeshingParameters mparam;
 }
 
@@ -251,9 +255,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh&         aMesh,
     netgen::mparam.quad = _hypQuadranglePreference ? 1 : 0;
     netgen::mparam.grading = 0.7; // very coarse mesh by default
   }
-#ifdef NETGEN_NEW
   occgeo.face_maxh = netgen::mparam.maxh;
-#endif
 
   // -------------------------
   // Make input netgen mesh
@@ -276,7 +278,9 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh&         aMesh,
   // Generate surface mesh
   // -------------------------
 
+#ifndef NETGEN_V5
   char *optstr = 0;
+#endif
   int startWith = MESHCONST_MESHSURFACE;
   int endWith   = MESHCONST_OPTSURFACE;
   int err = 1;
@@ -285,7 +289,11 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh&         aMesh,
 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
     OCC_CATCH_SIGNALS;
 #endif
+#ifdef NETGEN_V5
+    err = netgen::OCCGenerateMesh(occgeo, ngMesh, netgen::mparam, startWith, endWith);
+#else
     err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#endif
 #ifdef WITH_SMESH_CANCEL_COMPUTE
     if(netgen::multithread.terminate)
       return false;
@@ -322,11 +330,7 @@ bool NETGENPlugin_NETGEN_2D_ONLY::Compute(SMESH_Mesh&         aMesh,
   for ( int ngID = nbInputNodes + 1; ngID <= nbNodes; ++ngID )
   {
     const MeshPoint& ngPoint = ngMesh->Point( ngID );
-#ifdef NETGEN_NEW
     SMDS_MeshNode * node = meshDS->AddNode(ngPoint(0), ngPoint(1), ngPoint(2));
-#else
-    SMDS_MeshNode * node = meshDS->AddNode(ngPoint.X(), ngPoint.Y(), ngPoint.Z());
-#endif
     nodeVec[ ngID ] = node;
   }
 
index e693206fe551fd2798511870d3e75b96ee25df21..4b4586bfaf0864dc473029f0e7216a1260ab4e8a 100644 (file)
@@ -75,7 +75,11 @@ namespace nglib {
 #include <nglib.h>
 }
 namespace netgen {
+#ifdef NETGEN_V5
+  extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, MeshingParameters&, int, int);
+#else
   extern int OCCGenerateMesh (OCCGeometry&, Mesh*&, int, int, char*);
+#endif
   extern MeshingParameters mparam;
   extern volatile multithreadt multithread;
 }
@@ -345,7 +349,9 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh&                     aMesh,
   netgen::Mesh* ngMesh = (netgen::Mesh*)Netgen_mesh;
   int Netgen_NbOfNodes = Ng_GetNP(Netgen_mesh);
 
+#ifndef NETGEN_V5
   char *optstr = 0;
+#endif
   int startWith = netgen::MESHCONST_MESHVOLUME;
   int endWith   = netgen::MESHCONST_OPTVOLUME;
   int err = 1;
@@ -385,8 +391,13 @@ bool NETGENPlugin_NETGEN_3D::compute(SMESH_Mesh&                     aMesh,
 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
     OCC_CATCH_SIGNALS;
 #endif
+#ifdef NETGEN_V5
+    ngMesh->CalcLocalH(netgen::mparam.grading);
+    err = netgen::OCCGenerateMesh(occgeo, ngMesh, netgen::mparam, startWith, endWith);
+#else
     ngMesh->CalcLocalH();
     err = netgen::OCCGenerateMesh(occgeo, ngMesh, startWith, endWith, optstr);
+#endif
 #ifdef WITH_SMESH_CANCEL_COMPUTE
     if(netgen::multithread.terminate)
       return false;