diff --git a/.gitignore b/.gitignore index e7e541e..1161bf3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /netgen-5.1.tar.gz +/netgen-5.3.0.tar.gz diff --git a/netgen-5.1_build.patch b/netgen-5.1_build.patch deleted file mode 100644 index dcaf2a9..0000000 --- a/netgen-5.1_build.patch +++ /dev/null @@ -1,350 +0,0 @@ -diff -rupN netgen-5.1/configure.ac netgen-5.1-new/configure.ac ---- netgen-5.1/configure.ac 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/configure.ac 2014-06-13 17:43:14.000000000 +0200 -@@ -1,11 +1,11 @@ - AC_INIT([netgen],[5.1],[],[]) --AM_INIT_AUTOMAKE([-Wall -Werror foreign]) -+AM_INIT_AUTOMAKE([-Wall foreign]) - - AC_CONFIG_MACRO_DIR([m4]) - - AC_PREFIX_DEFAULT(["/opt/netgen"]) - -- -+AM_PROG_AR - - - -@@ -20,7 +20,6 @@ AC_OPENMP - CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS" - # LDFLAGS="$LDFLAGS $OPENMP_CXXFLAGS" - --AC_PROG_LIBTOOL - LT_INIT - - # OpenCASCADE configuration -@@ -34,15 +33,15 @@ AC_ARG_WITH([occ], - [AC_HELP_STRING([--with-occ=dir],[use OpenCascade installed in directory dir])], - [occdir=$withval] - [occon=true], -- [occdir=/opt/OpenCASCADE] -+ [occdir=/usr] - ) - - - - if test a$occon = atrue ; then - -- AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I$occdir/inc -I/usr/include/opencascade"]) -- AC_SUBST([OCCLIBS], ["-L$occdir/lib -lTKernel -lTKGeomBase -lTKMath -lTKG2d -lTKG3d -lTKXSBase -lTKOffset -lTKFillet -lTKShHealing -lTKMesh -lTKMeshVS -lTKTopAlgo -lTKGeomAlgo -lTKBool -lTKPrim -lTKBO -lTKIGES -lTKBRep -lTKSTEPBase -lTKSTEP -lTKSTL -lTKSTEPAttr -lTKSTEP209 -lTKXDESTEP -lTKXDEIGES -lTKXCAF -lTKLCAF -lFWOSPlugin"]) -+ AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I/usr/include/oce"]) -+ AC_SUBST([OCCLIBS], ["-lTKernel -lTKGeomBase -lTKMath -lTKG2d -lTKG3d -lTKXSBase -lTKOffset -lTKFillet -lTKShHealing -lTKMesh -lTKMeshVS -lTKTopAlgo -lTKGeomAlgo -lTKBool -lTKPrim -lTKBO -lTKIGES -lTKBRep -lTKSTEPBase -lTKSTEP -lTKSTL -lTKSTEPAttr -lTKSTEP209 -lTKXDESTEP -lTKXDEIGES -lTKXCAF -lTKLCAF -lFWOSPlugin"]) - - # -lTKDCAF - -@@ -88,18 +87,18 @@ AC_ARG_ENABLE([gui], - [AC_HELP_STRING([--disable-gui],[don't build netgen with GUI])], - [if test "$enableval" = yes; then ngguion=true; else ngguion=false; fi]) - --metisdir=/usr/local -+metisdir=/usr - AC_ARG_WITH([metis], - [AC_HELP_STRING([--with-metis=dir],[path to metis 5.x])], - [metisdir=$withval], -- [metisdir=/usr/local] -+ [metisdir=/usr] - ) - - AC_ARG_ENABLE([parallel], - [AC_HELP_STRING([--enable-parallel],[enable mpi parallelization])], -- [AC_SUBST([MPI_INCLUDES], "-I$metisdir/include -DMETIS")] -+ [AC_SUBST([MPI_INCLUDES], "-DMETIS")] - [CXXFLAGS="$CXXFLAGS -DPARALLEL"] -- [AC_SUBST([MPI_LIBS], "-L$metisdir/lib -lmetis")] -+ [AC_SUBST([MPI_LIBS], "-lmetis")] - ) - # -DVTRACE - # -lvt-hyb -diff -rupN netgen-5.1/libsrc/csg/Makefile.am netgen-5.1-new/libsrc/csg/Makefile.am ---- netgen-5.1/libsrc/csg/Makefile.am 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/csg/Makefile.am 2014-06-13 18:13:28.511538052 +0200 -@@ -8,25 +8,25 @@ revolution.hpp spline3d.hpp vscsg.hpp - AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include $(TCL_INCLUDES) - METASOURCES = AUTO - --lib_LTLIBRARIES = libcsg.la -+lib_LTLIBRARIES = libngcsg.la - - if NGGUI --lib_LTLIBRARIES += libcsgvis.la -+lib_LTLIBRARIES += libngcsgvis.la - endif - - --libcsg_la_SOURCES = algprim.cpp brick.cpp \ -+libngcsg_la_SOURCES = algprim.cpp brick.cpp \ - bspline2d.cpp csgeom.cpp csgparser.cpp curve2d.cpp edgeflw.cpp \ - explicitcurve2d.cpp extrusion.cpp gencyl.cpp genmesh.cpp identify.cpp \ - manifold.cpp meshsurf.cpp polyhedra.cpp revolution.cpp singularref.cpp \ - solid.cpp specpoin.cpp spline3d.cpp surface.cpp triapprox.cpp - - --libcsgvis_la_SOURCES = vscsg.cpp csgpkg.cpp -+libngcsgvis_la_SOURCES = vscsg.cpp csgpkg.cpp - - --libcsgvis_la_LIBADD = libcsg.la --libcsg_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la -+libngcsgvis_la_LIBADD = libngcsg.la -lGL $(MPI_LIBS) $(TCL_LIB_SPEC) -+libngcsg_la_LIBADD = $(top_builddir)/libsrc/meshing/libngmesh.la $(MPI_LIBS) - - # $(top_builddir)/libsrc/geom2d/libgeom2d.la - -diff -rupN netgen-5.1/libsrc/general/Makefile.am netgen-5.1-new/libsrc/general/Makefile.am ---- netgen-5.1/libsrc/general/Makefile.am 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/general/Makefile.am 2014-06-13 17:43:22.000000000 +0200 -@@ -6,8 +6,8 @@ include_HEADERS = ngexception.hpp - - AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_srcdir)/libsrc/include - METASOURCES = AUTO --noinst_LTLIBRARIES = libgen.la --libgen_la_SOURCES = array.cpp bitarray.cpp dynamicmem.cpp flags.cpp \ -+noinst_LTLIBRARIES = libnggen.la -+libnggen_la_SOURCES = array.cpp bitarray.cpp dynamicmem.cpp flags.cpp \ - hashtabl.cpp mystring.cpp ngexception.cpp optmem.cpp parthreads.cpp \ - profiler.cpp seti.cpp sort.cpp spbita2d.cpp symbolta.cpp table.cpp \ - mpi_interface.cpp gzstream.cpp -diff -rupN netgen-5.1/libsrc/geom2d/Makefile.am netgen-5.1-new/libsrc/geom2d/Makefile.am ---- netgen-5.1/libsrc/geom2d/Makefile.am 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/geom2d/Makefile.am 2014-06-13 18:11:24.815541707 +0200 -@@ -4,18 +4,18 @@ AM_CPPFLAGS = -I$(top_srcdir)/libsrc/inc - - METASOURCES = AUTO - --lib_LTLIBRARIES = libgeom2d.la -+lib_LTLIBRARIES = libnggeom2d.la - - if NGGUI --lib_LTLIBRARIES += libgeom2dvis.la -+lib_LTLIBRARIES += libnggeom2dvis.la - endif - - - --libgeom2d_la_SOURCES = genmesh2d.cpp geom2dmesh.cpp geometry2d.cpp --libgeom2d_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la -+libnggeom2d_la_SOURCES = genmesh2d.cpp geom2dmesh.cpp geometry2d.cpp -+libnggeom2d_la_LIBADD = $(top_builddir)/libsrc/meshing/libngmesh.la $(MPI_LIBS) - --libgeom2dvis_la_SOURCES = geom2dpkg.cpp vsgeom2d.cpp --libgeom2dvis_la_LIBADD = libgeom2d.la -+libnggeom2dvis_la_SOURCES = geom2dpkg.cpp vsgeom2d.cpp -+libnggeom2dvis_la_LIBADD = libnggeom2d.la -lGL $(MPI_LIBS) - - -diff -rupN netgen-5.1/libsrc/gprim/Makefile.am netgen-5.1-new/libsrc/gprim/Makefile.am ---- netgen-5.1/libsrc/gprim/Makefile.am 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/gprim/Makefile.am 2014-06-13 17:43:22.000000000 +0200 -@@ -2,6 +2,6 @@ noinst_HEADERS = adtree.hpp geom3d.hpp - - AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include - METASOURCES = AUTO --noinst_LTLIBRARIES = libgprim.la --libgprim_la_SOURCES = adtree.cpp geom2d.cpp geom3d.cpp geomfuncs.cpp \ -+noinst_LTLIBRARIES = libnggprim.la -+libnggprim_la_SOURCES = adtree.cpp geom2d.cpp geom3d.cpp geomfuncs.cpp \ - geomtest3d.cpp transform3d.cpp spline.cpp splinegeometry.cpp -diff -rupN netgen-5.1/libsrc/interface/Makefile.am netgen-5.1-new/libsrc/interface/Makefile.am ---- netgen-5.1/libsrc/interface/Makefile.am 2013-06-25 13:28:58.000000000 +0200 -+++ netgen-5.1-new/libsrc/interface/Makefile.am 2014-06-13 17:43:22.000000000 +0200 -@@ -2,8 +2,8 @@ noinst_HEADERS = writeuser.hpp - - AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include -I$(top_srcdir)/libsrc/interface $(MPI_INCLUDES) $(TCL_INCLUDES) -DOPENGL - METASOURCES = AUTO --lib_LTLIBRARIES = libinterface.la --libinterface_la_SOURCES = nginterface.cpp nginterface_v2.cpp \ -+lib_LTLIBRARIES = libnginterface.la -+libnginterface_la_SOURCES = nginterface.cpp nginterface_v2.cpp \ - read_fnf_mesh.cpp readtetmesh.cpp readuser.cpp writeabaqus.cpp writediffpack.cpp \ - writedolfin.cpp writeelmer.cpp writefeap.cpp writefluent.cpp writegmsh.cpp writejcm.cpp \ - writepermas.cpp writetecplot.cpp writetet.cpp writetochnog.cpp writeuser.cpp \ -diff -rupN netgen-5.1/libsrc/linalg/Makefile.am netgen-5.1-new/libsrc/linalg/Makefile.am ---- netgen-5.1/libsrc/linalg/Makefile.am 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/linalg/Makefile.am 2014-06-13 17:43:22.000000000 +0200 -@@ -1,8 +1,8 @@ - noinst_HEADERS = densemat.hpp linalg.hpp polynomial.hpp vector.hpp opti.hpp - AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include - METASOURCES = AUTO --noinst_LTLIBRARIES = libla.la --libla_la_SOURCES = densemat.cpp polynomial.cpp bfgs.cpp linopt.cpp linsearch.cpp -+noinst_LTLIBRARIES = libngla.la -+libngla_la_SOURCES = densemat.cpp polynomial.cpp bfgs.cpp linopt.cpp linsearch.cpp - - # vector.cpp - -diff -rupN netgen-5.1/libsrc/meshing/Makefile.am netgen-5.1-new/libsrc/meshing/Makefile.am ---- netgen-5.1/libsrc/meshing/Makefile.am 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/meshing/Makefile.am 2014-06-13 18:12:26.617539881 +0200 -@@ -15,9 +15,9 @@ clusters.hpp hprefinement.hpp improve3.h - - METASOURCES = AUTO - --lib_LTLIBRARIES = libmesh.la -+lib_LTLIBRARIES = libngmesh.la - --libmesh_la_SOURCES = adfront2.cpp adfront3.cpp bisect.cpp boundarylayer.cpp \ -+libngmesh_la_SOURCES = adfront2.cpp adfront3.cpp bisect.cpp boundarylayer.cpp \ - clusters.cpp curvedelems.cpp delaunay.cpp delaunay2d.cpp \ - geomsearch.cpp global.cpp hprefinement.cpp improve2.cpp \ - improve2gen.cpp improve3.cpp localh.cpp meshclass.cpp \ -@@ -30,8 +30,8 @@ libmesh_la_SOURCES = adfront2.cpp adfron - topology.cpp triarls.cpp validate.cpp zrefine.cpp bcfunctions.cpp \ - parallelmesh.cpp paralleltop.cpp paralleltop.hpp basegeom.cpp - --libmesh_la_LIBADD = $(top_builddir)/libsrc/linalg/libla.la \ -- $(top_builddir)/libsrc/gprim/libgprim.la \ -- $(top_builddir)/libsrc/general/libgen.la \ -- -lz -+libngmesh_la_LIBADD = $(top_builddir)/libsrc/linalg/libngla.la \ -+ $(top_builddir)/libsrc/gprim/libnggprim.la \ -+ $(top_builddir)/libsrc/general/libnggen.la \ -+ $(MPI_LIBS) -lz - -diff -rupN netgen-5.1/libsrc/occ/Makefile.am netgen-5.1-new/libsrc/occ/Makefile.am ---- netgen-5.1/libsrc/occ/Makefile.am 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/occ/Makefile.am 2014-06-13 18:13:54.508537284 +0200 -@@ -14,20 +14,20 @@ AM_CPPFLAGS = -I$(top_srcdir)/libsrc/inc - - METASOURCES = AUTO - --lib_LTLIBRARIES = libocc.la -+lib_LTLIBRARIES = libngocc.la - - if NGGUI --lib_LTLIBRARIES += liboccvis.la -+lib_LTLIBRARIES += libngoccvis.la - endif - - --libocc_la_SOURCES = Partition_Inter2d.cxx Partition_Inter3d.cxx \ -+libngocc_la_SOURCES = Partition_Inter2d.cxx Partition_Inter3d.cxx \ - Partition_Loop.cxx Partition_Loop2d.cxx Partition_Loop3d.cxx Partition_Spliter.cxx \ - occconstruction.cpp occgenmesh.cpp occgeom.cpp occmeshsurf.cpp - --libocc_la_LIBADD = $(OCCLIBS) -+libngocc_la_LIBADD = $(OCCLIBS) - --liboccvis_la_SOURCES = occpkg.cpp vsocc.cpp --liboccvis_la_LIBADD = libocc.la -+libngoccvis_la_SOURCES = occpkg.cpp vsocc.cpp -+libngoccvis_la_LIBADD = libngocc.la $(TCL_LIB_SPEC) - - -diff -rupN netgen-5.1/libsrc/stlgeom/Makefile.am netgen-5.1-new/libsrc/stlgeom/Makefile.am ---- netgen-5.1/libsrc/stlgeom/Makefile.am 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/stlgeom/Makefile.am 2014-06-13 18:13:43.511537609 +0200 -@@ -4,18 +4,18 @@ stltool.hpp stltopology.hpp vsstl.hpp - AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include $(TCL_INCLUDES) - METASOURCES = AUTO - --lib_LTLIBRARIES = libstl.la -+lib_LTLIBRARIES = libngstl.la - - if NGGUI --lib_LTLIBRARIES += libstlvis.la -+lib_LTLIBRARIES += libngstlvis.la - endif - --libstl_la_SOURCES = meshstlsurface.cpp stlgeom.cpp stlgeomchart.cpp \ -+libngstl_la_SOURCES = meshstlsurface.cpp stlgeom.cpp stlgeomchart.cpp \ - stlgeommesh.cpp stlline.cpp stltool.cpp stltopology.cpp - - --libstlvis_la_SOURCES = stlpkg.cpp vsstl.cpp --libstlvis_la_LIBADD = libstl.la --libstl_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la -+libngstlvis_la_SOURCES = stlpkg.cpp vsstl.cpp -+libngstlvis_la_LIBADD = libngstl.la -lGL $(MPI_LIBS) $(TCL_LIB_SPEC) -+libngstl_la_LIBADD = $(top_builddir)/libsrc/meshing/libngmesh.la $(MPI_LIBS) - # libstlvis_la_LIBADD = libstl.la $(top_builddir)/libsrc/linalg/libla.la - -diff -rupN netgen-5.1/libsrc/visualization/Makefile.am netgen-5.1-new/libsrc/visualization/Makefile.am ---- netgen-5.1/libsrc/visualization/Makefile.am 2013-06-25 13:28:58.000000000 +0200 -+++ netgen-5.1-new/libsrc/visualization/Makefile.am 2014-06-13 17:45:28.361587695 +0200 -@@ -7,11 +7,11 @@ AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_s - METASOURCES = AUTO - - if NGGUI --noinst_LTLIBRARIES = libvisual.la -+noinst_LTLIBRARIES = libngvisual.la - endif - - --libvisual_la_SOURCES = meshdoc.cpp mvdraw.cpp \ -+libngvisual_la_SOURCES = meshdoc.cpp mvdraw.cpp \ - vsfieldlines.cpp vsmesh.cpp vssolution.cpp importsolution.cpp - -- -+libngvisual_la_LIBADD = -lGL -diff -rupN netgen-5.1/ng/Makefile.am netgen-5.1-new/ng/Makefile.am ---- netgen-5.1/ng/Makefile.am 2013-06-25 13:28:57.000000000 +0200 -+++ netgen-5.1-new/ng/Makefile.am 2014-06-13 17:46:12.442586392 +0200 -@@ -16,20 +16,18 @@ MKL_LIBS = -L$(MKLROOT)/lib/intel64 -lm - endif - - --netgen_LDADD = $(top_builddir)/libsrc/visualization/libvisual.la \ -- $(top_builddir)/libsrc/csg/libcsgvis.la \ -- $(top_builddir)/libsrc/csg/libcsg.la \ -- $(top_builddir)/libsrc/interface/libinterface.la \ -- $(top_builddir)/libsrc/meshing/libmesh.la \ -- -L$(TK_BIN_DIR)/Togl1.7 $(TOGLLIBDIR) -lTogl $(LIBGLU) $(TK_LIB_SPEC) $(TCL_LIB_SPEC) $(MPI_LIBS) $(FFMPEG_LIBS) $(JPEGLIB_LIBS) $(PKG_LIBS) $(MKL_LIBS) -- --# --# $(top_builddir)/libsrc/occ/liboccvis.la --# $(top_builddir)/libsrc/occ/libocc.la --# $(top_builddir)/libsrc/stlgeom/libstlvis.la --# $(top_builddir)/libsrc/stlgeom/libstl.la --# $(top_builddir)/libsrc/geom2d/libgeom2d.la --# $(top_builddir)/libsrc/geom2d/libgeom2dvis.la -+netgen_LDADD = $(top_builddir)/libsrc/visualization/libngvisual.la \ -+ $(top_builddir)/libsrc/csg/libngcsgvis.la \ -+ $(top_builddir)/libsrc/csg/libngcsg.la \ -+ $(top_builddir)/libsrc/interface/libnginterface.la \ -+ $(top_builddir)/libsrc/meshing/libngmesh.la \ -+ $(top_builddir)/libsrc/occ/libngoccvis.la \ -+ $(top_builddir)/libsrc/occ/libngocc.la \ -+ $(top_builddir)/libsrc/stlgeom/libngstlvis.la \ -+ $(top_builddir)/libsrc/stlgeom/libngstl.la \ -+ $(top_builddir)/libsrc/geom2d/libnggeom2d.la \ -+ $(top_builddir)/libsrc/geom2d/libnggeom2dvis.la \ -+ -L$(TK_BIN_DIR)/Togl1.7 $(TOGLLIBDIR) -lTogl1.7 -ldl -lX11 $(LIBGLU) $(TK_LIB_SPEC) $(TCL_LIB_SPEC) $(MPI_LIBS) $(FFMPEG_LIBS) $(JPEGLIB_LIBS) $(PKG_LIBS) $(MKL_LIBS) - - - # add for static linkage of ngsolve: -diff -rupN netgen-5.1/nglib/Makefile.am netgen-5.1-new/nglib/Makefile.am ---- netgen-5.1/nglib/Makefile.am 2013-06-25 13:28:56.000000000 +0200 -+++ netgen-5.1-new/nglib/Makefile.am 2014-06-13 17:43:22.000000000 +0200 -@@ -8,15 +8,15 @@ lib_LTLIBRARIES = libnglib.la - libnglib_la_SOURCES = nglib.cpp - - libnglib_la_LIBADD = \ -- $(top_builddir)/libsrc/interface/libinterface.la \ -- $(top_builddir)/libsrc/geom2d/libgeom2d.la \ -- $(top_builddir)/libsrc/csg/libcsg.la \ -- $(top_builddir)/libsrc/stlgeom/libstl.la \ -- $(top_builddir)/libsrc/occ/libocc.la \ -- $(top_builddir)/libsrc/meshing/libmesh.la \ -+ $(top_builddir)/libsrc/interface/libnginterface.la \ -+ $(top_builddir)/libsrc/geom2d/libnggeom2d.la \ -+ $(top_builddir)/libsrc/csg/libngcsg.la \ -+ $(top_builddir)/libsrc/stlgeom/libngstl.la \ -+ $(top_builddir)/libsrc/occ/libngocc.la \ -+ $(top_builddir)/libsrc/meshing/libngmesh.la \ - $(OCCLIBS) $(MPI_LIBS) - --libnglib_la_LDFLAGS = -avoid-version -+libnglib_la_LDFLAGS = -version-info $(subst .,:,$(PACKAGE_VERSION)) - # -rdynamic - - diff --git a/netgen-5.1_fixes.patch b/netgen-5.1_fixes.patch deleted file mode 100644 index b1bb1a4..0000000 --- a/netgen-5.1_fixes.patch +++ /dev/null @@ -1,887 +0,0 @@ -diff -rupN netgen-5.1/libsrc/meshing/meshtype.cpp netgen-5.1-new/libsrc/meshing/meshtype.cpp ---- netgen-5.1/libsrc/meshing/meshtype.cpp 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/meshing/meshtype.cpp 2014-06-13 19:54:42.968358572 +0200 -@@ -1,4 +1,5 @@ - #include -+#include // to get DBL_MIN defined - - #include "meshing.hpp" - -@@ -666,7 +667,8 @@ namespace netgen - - 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 @@ namespace netgen - - 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 @@ namespace netgen - = 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 @@ namespace netgen - 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 @@ namespace netgen - 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 @@ namespace netgen - - 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 @@ namespace netgen - ddet *= -1; - - -- if (det <= 0) -+ //if (det <= 0) -+ if (det <= DBL_MIN) // avoid FPE - err += 1e12; - else - { -@@ -2184,7 +2192,7 @@ namespace netgen - - det *= -1; - -- if (det <= 0) -+ if (det <= DBL_MIN) - err += 1e12; - else - { -@@ -2513,10 +2521,10 @@ namespace netgen - - 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 -rupN netgen-5.1/libsrc/meshing/meshtype.hpp netgen-5.1-new/libsrc/meshing/meshtype.hpp ---- netgen-5.1/libsrc/meshing/meshtype.hpp 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/meshing/meshtype.hpp 2014-06-13 19:54:42.969358572 +0200 -@@ -15,6 +15,7 @@ namespace netgen - Classes for NETGEN - */ - -+class Mesh; // added due to compilation errors on some platforms - - - enum ELEMENT_TYPE { -diff -rupN netgen-5.1/libsrc/meshing/smoothing2.cpp netgen-5.1-new/libsrc/meshing/smoothing2.cpp ---- netgen-5.1/libsrc/meshing/smoothing2.cpp 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/meshing/smoothing2.cpp 2014-06-13 19:54:42.969358572 +0200 -@@ -361,7 +361,8 @@ namespace netgen - vgrad = 0; - double 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); -@@ -577,7 +578,8 @@ namespace netgen - 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; - -@@ -649,7 +651,8 @@ namespace netgen - 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); -@@ -1079,7 +1082,7 @@ namespace netgen - { - mesh[pi] = Point<3> (origp); - } -- -+ break; // exit as is not used anymore - } - } - } -diff -rupN netgen-5.1/libsrc/occ/occconstruction.cpp netgen-5.1-new/libsrc/occ/occconstruction.cpp ---- netgen-5.1/libsrc/occ/occconstruction.cpp 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/occ/occconstruction.cpp 2014-06-13 19:54:42.970358572 +0200 -@@ -28,7 +28,7 @@ - #include - #include - #include --#include -+//#include - //#include - #include - #include -diff -rupN netgen-5.1/libsrc/occ/occgenmesh.cpp netgen-5.1-new/libsrc/occ/occgenmesh.cpp ---- netgen-5.1/libsrc/occ/occgenmesh.cpp 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/occ/occgenmesh.cpp 2014-06-13 19:54:42.971358572 +0200 -@@ -57,6 +57,8 @@ namespace netgen - - - -+ -+ static // useless out of this file - double ComputeH (double kappa) - { - double hret; -@@ -74,8 +76,7 @@ namespace netgen - } - - -- -- -+ 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 @@ namespace netgen - 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 @@ namespace netgen - - - -+ static // useless out of this file - void DivideEdge (TopoDS_Edge & edge, Array & ps, - Array & params, Mesh & mesh) - { -@@ -250,8 +252,8 @@ namespace netgen - 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 @@ namespace netgen - { - oldpnt = pnt; - pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0)); -+ // -- no more than 1 segment per /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 @@ namespace netgen - { - 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 @@ namespace netgen - (*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 @@ namespace netgen - 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 @@ namespace netgen - { - 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 @@ namespace netgen - 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 @@ namespace netgen - //(*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 @@ namespace netgen - } - 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 @@ namespace netgen - } - - #endif -+ -diff -rupN netgen-5.1/libsrc/occ/occgeom.cpp netgen-5.1-new/libsrc/occ/occgeom.cpp ---- netgen-5.1/libsrc/occ/occgeom.cpp 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/occ/occgeom.cpp 2014-06-13 19:54:42.971358572 +0200 -@@ -8,6 +8,8 @@ - #include "ShapeAnalysis_CheckSmallFace.hxx" - #include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx" - #include "ShapeAnalysis_Surface.hxx" -+#include // -- to optimize Project() and FastProject() -+#include - #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::Iterator it(fclsmap); -+ for (; it.More(); it.Next()) -+ delete it.Value(); -+ } -+ -+ void OCCGeometry :: PrintNrShapes () - { - TopExp_Explorer e; - int count = 0; -@@ -951,25 +960,58 @@ namespace netgen - } - - -+ // 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 @@ namespace netgen - { - 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 -rupN netgen-5.1/libsrc/occ/occgeom.hpp netgen-5.1-new/libsrc/occ/occgeom.hpp ---- netgen-5.1/libsrc/occ/occgeom.hpp 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/occ/occgeom.hpp 2014-06-13 19:54:42.972358572 +0200 -@@ -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 -+class Handle_ShapeAnalysis_Surface; -+class BRepTopAdaptor_FClass2d; - - // Philippose - 29/01/2009 - // OpenCascade XDE Support -@@ -192,6 +196,9 @@ namespace netgen - class OCCGeometry : public NetgenGeometry - { - Point<3> center; -+ // -- Optimization: to use cached projector and classifier -+ mutable NCollection_DataMap fprjmap; -+ mutable NCollection_DataMap fclsmap; - - public: - TopoDS_Shape shape; -@@ -247,6 +254,8 @@ namespace netgen - virtual void Save (string filename) const; - - -+ ~OCCGeometry(); // -- to free cached projector and classifier -+ - void BuildFMap(); - - Box<3> GetBoundingBox() -@@ -266,9 +275,14 @@ namespace netgen - 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 -rupN netgen-5.1/libsrc/occ/occmeshsurf.cpp netgen-5.1-new/libsrc/occ/occmeshsurf.cpp ---- netgen-5.1/libsrc/occ/occmeshsurf.cpp 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/occ/occmeshsurf.cpp 2014-06-13 19:54:42.972358572 +0200 -@@ -6,6 +6,7 @@ - #include - #include - #include -+#include // -- moved here from occgeom.hpp - - - namespace netgen -@@ -434,23 +435,33 @@ namespace netgen - - 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 @@ namespace netgen - 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 @@ namespace netgen - } - - newp = hnewp; -- } -+ }//; -- to compile with -Wall -pedantic - - - void OCCRefinementSurfaces :: -@@ -708,14 +720,18 @@ namespace netgen - 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 @@ namespace netgen - 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 -rupN netgen-5.1/libsrc/occ/Partition_Inter3d.cxx netgen-5.1-new/libsrc/occ/Partition_Inter3d.cxx ---- netgen-5.1/libsrc/occ/Partition_Inter3d.cxx 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/occ/Partition_Inter3d.cxx 2014-06-13 19:54:42.969358572 +0200 -@@ -243,9 +243,11 @@ static void PutInBounds (const TopoDS_Fa - 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 -rupN netgen-5.1/libsrc/occ/Partition_Loop2d.cxx netgen-5.1-new/libsrc/occ/Partition_Loop2d.cxx ---- netgen-5.1/libsrc/occ/Partition_Loop2d.cxx 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/occ/Partition_Loop2d.cxx 2014-06-13 19:54:42.970358572 +0200 -@@ -210,7 +210,7 @@ static Standard_Boolean SelectEdge(cons - 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 @@ static Standard_Boolean SelectEdge(cons - // -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 -rupN netgen-5.1/libsrc/occ/Partition_Spliter.cxx netgen-5.1-new/libsrc/occ/Partition_Spliter.cxx ---- netgen-5.1/libsrc/occ/Partition_Spliter.cxx 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/occ/Partition_Spliter.cxx 2014-06-13 19:54:42.970358572 +0200 -@@ -1169,8 +1169,10 @@ static void findEqual (const TopTools_Li - 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 -rupN netgen-5.1/libsrc/occ/utilities.h netgen-5.1-new/libsrc/occ/utilities.h ---- netgen-5.1/libsrc/occ/utilities.h 2013-08-14 16:09:45.000000000 +0200 -+++ netgen-5.1-new/libsrc/occ/utilities.h 2014-06-13 19:54:42.972358572 +0200 -@@ -33,6 +33,7 @@ - - #include - #include -+#include - #include - // #include "SALOME_Log.hxx" - -diff -rupN netgen-5.1/libsrc/stlgeom/stlgeommesh.cpp netgen-5.1-new/libsrc/stlgeom/stlgeommesh.cpp ---- netgen-5.1/libsrc/stlgeom/stlgeommesh.cpp 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/stlgeom/stlgeommesh.cpp 2014-06-13 19:54:42.972358572 +0200 -@@ -1435,7 +1435,8 @@ int STLMeshingDummy (STLGeometry* stlgeo - /* - if (!optstring || strlen(optstring) == 0) - { -- mparam.optimize2d = "smcm"; -+ //mparam.optimize2d = (char*)"smcm"; -+ mparam.optimize2d = (char*)"smcm"; - } - else - { -@@ -1453,7 +1454,7 @@ int STLMeshingDummy (STLGeometry* stlgeo - 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 @@ int STLMeshingDummy (STLGeometry* stlgeo - /* - if (!optstring || strlen(optstring) == 0) - { -- mparam.optimize3d = "cmdmstm"; -+ //mparam.optimize3d = "cmdmstm"; -+ mparam.optimize3d = (char*)"cmdmstm"; - } - else - { -diff -rupN netgen-5.1/nglib/nglib.h netgen-5.1-new/nglib/nglib.h ---- netgen-5.1/nglib/nglib.h 2013-06-25 13:28:56.000000000 +0200 -+++ netgen-5.1-new/nglib/nglib.h 2014-06-13 19:54:42.973358572 +0200 -@@ -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) diff --git a/netgen-5.1_metis.patch b/netgen-5.1_metis.patch deleted file mode 100644 index fdbba54..0000000 --- a/netgen-5.1_metis.patch +++ /dev/null @@ -1,89 +0,0 @@ -diff -rupN netgen-5.1/libsrc/meshing/parallelmesh.cpp netgen-5.1-new/libsrc/meshing/parallelmesh.cpp ---- netgen-5.1/libsrc/meshing/parallelmesh.cpp 2013-06-25 13:28:59.000000000 +0200 -+++ netgen-5.1-new/libsrc/meshing/parallelmesh.cpp 2014-06-11 22:17:30.943733757 +0200 -@@ -14,7 +14,7 @@ namespace metis { - - #if METIS_VER_MAJOR >= 5 - #define METIS5 -- typedef idx_t idxtype; -+ typedef metis::idx_t idxtype; - #else - #define METIS4 - typedef idxtype idx_t; -@@ -794,10 +794,10 @@ namespace netgen - eptr.Append (eind.Size()); - Array epart(ne), npart(nn); - -- int nparts = ntasks-1; -- int edgecut; -+ metis::idx_t nparts = ntasks-1; -+ metis::idx_t edgecut; - -- int ncommon = 3; -+ metis::idx_t ncommon = 3; - METIS_PartMeshDual (&ne, &nn, &eptr[0], &eind[0], NULL, NULL, &ncommon, &nparts, - NULL, NULL, - &edgecut, &epart[0], &npart[0]); -@@ -922,11 +922,11 @@ namespace netgen - eptr.Append (eind.Size()); - Array epart(ne), npart(nn); - -- int nparts = ntasks-1; -- int edgecut; -+ metis::idx_t nparts = ntasks-1; -+ metis::idx_t edgecut; - - -- int ncommon = 3; -+ metis::idx_t ncommon = 3; - METIS_PartMeshDual (&ne, &nn, &eptr[0], &eind[0], &nwgt[0], NULL, &ncommon, &nparts, - NULL, NULL, - &edgecut, &epart[0], &npart[0]); -@@ -1159,7 +1159,7 @@ namespace netgen - - for ( int vert = 0; vert < nn; vert++ ) - { -- FlatArray array ( cnt[vert], &adjacency[ xadj[vert] ] ); -+ FlatArray array ( cnt[vert], &adjacency[ xadj[vert] ] ); - BubbleSort(array); - } - -@@ -1270,7 +1270,7 @@ namespace netgen - - for ( int el = 0; el < ne; el++ ) - { -- FlatArray array ( cnt[el], &adjacency[ xadj[el] ] ); -+ FlatArray array ( cnt[el], &adjacency[ xadj[el] ] ); - BubbleSort(array); - } - -@@ -1321,8 +1321,8 @@ namespace netgen - void Mesh :: PartDualHybridMesh2D ( ) - { - #ifdef METIS -- int ne = GetNSE(); -- int nv = GetNV(); -+ metis::idx_t ne = GetNSE(); -+ metis::idx_t nv = GetNV(); - - Array xadj(ne+1); - Array adjacency(ne*4); -@@ -1377,13 +1377,13 @@ namespace netgen - - idxtype *v_weights = NULL, *e_weights = NULL; - -- int weightflag = 0; -- int numflag = 0; -- int nparts = ntasks - 1; -+ metis::idx_t weightflag = 0; -+ metis::idx_t numflag = 0; -+ metis::idx_t nparts = ntasks - 1; - -- int options[5]; -+ metis::idx_t options[5]; - options[0] = 0; -- int edgecut; -+ metis::idx_t edgecut; - Array part(ne); - - for ( int el = 0; el < ne; el++ ) diff --git a/netgen-5.1_msc-ver.patch b/netgen-5.1_msc-ver.patch deleted file mode 100644 index 071d6a1..0000000 --- a/netgen-5.1_msc-ver.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff -rupN netgen-5.1/ng/ngpkg.cpp netgen-5.1-new/ng/ngpkg.cpp ---- netgen-5.1/ng/ngpkg.cpp 2013-06-25 13:28:57.000000000 +0200 -+++ netgen-5.1-new/ng/ngpkg.cpp 2014-06-13 17:24:10.691625446 +0200 -@@ -3115,13 +3115,11 @@ void PlayAnimFile(const char* name, int - extern "C" int Ng_Init (Tcl_Interp * interp); - extern "C" int Ng_CSG_Init (Tcl_Interp * interp); - --#ifdef _MSC_VER - extern "C" int Ng_stl_Init (Tcl_Interp * interp); - extern "C" int Ng_geom2d_Init (Tcl_Interp * interp); - #ifdef OCCGEOMETRY - extern "C" int Ng_occ_Init (Tcl_Interp * interp); - #endif --#endif - - - // extern "C" int Ng_Geom2d_Init (Tcl_Interp * interp); -@@ -3139,13 +3137,11 @@ void PlayAnimFile(const char* name, int - #endif - - Ng_CSG_Init(interp); --#ifdef _MSC_VER - Ng_stl_Init(interp); - Ng_geom2d_Init (interp); - #ifdef OCCGEOMETRY - Ng_occ_Init (interp); - #endif --#endif - - - // Ng_Geom2d_Init(interp); diff --git a/netgen-5.1_netgendir.patch b/netgen-5.1_netgendir.patch deleted file mode 100644 index 5fa01f1..0000000 --- a/netgen-5.1_netgendir.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -rupN netgen-5.1/ng/ngappinit.cpp netgen-5.1-new/ng/ngappinit.cpp ---- netgen-5.1/ng/ngappinit.cpp 2013-06-25 13:28:57.000000000 +0200 -+++ netgen-5.1-new/ng/ngappinit.cpp 2014-06-12 01:10:11.876427626 +0200 -@@ -146,9 +146,11 @@ int main(int argc, char ** argv) - - if (getenv ("NETGENDIR") && strlen (getenv ("NETGENDIR"))) - ngdir = getenv ("NETGENDIR"); -- else -- ngdir = "."; -- -+ else { -+ ngdir = "/usr/share/netgen-mesher"; -+ setenv("NETGENDIR", ngdir.c_str(), 1); -+ } -+ - verbose = parameters.GetDefineFlag ("V"); - - if (verbose) diff --git a/netgen-5.1_relative-includes.patch b/netgen-5.1_relative-includes.patch deleted file mode 100644 index 602f9a1..0000000 --- a/netgen-5.1_relative-includes.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -rupN netgen-5.1/libsrc/include/meshing.hpp netgen-5.1-new/libsrc/include/meshing.hpp ---- netgen-5.1/libsrc/include/meshing.hpp 2013-06-25 13:28:58.000000000 +0200 -+++ netgen-5.1-new/libsrc/include/meshing.hpp 2014-06-14 14:05:30.481877485 +0200 -@@ -1 +1 @@ --#include <../meshing/meshing.hpp> -+#include "../meshing/meshing.hpp" -diff -rupN netgen-5.1/libsrc/include/myadt.hpp netgen-5.1-new/libsrc/include/myadt.hpp ---- netgen-5.1/libsrc/include/myadt.hpp 2013-06-25 13:28:58.000000000 +0200 -+++ netgen-5.1-new/libsrc/include/myadt.hpp 2014-06-14 14:04:39.274878998 +0200 -@@ -1 +1 @@ --#include <../general/myadt.hpp> -+#include "../general/myadt.hpp" -diff -rupN netgen-5.1/libsrc/include/stlgeom.hpp netgen-5.1-new/libsrc/include/stlgeom.hpp ---- netgen-5.1/libsrc/include/stlgeom.hpp 2013-06-25 13:28:58.000000000 +0200 -+++ netgen-5.1-new/libsrc/include/stlgeom.hpp 2014-06-14 14:05:18.911877827 +0200 -@@ -1 +1 @@ --#include <../stlgeom/stlgeom.hpp> -+#include "../stlgeom/stlgeom.hpp" diff --git a/netgen-5.3.0_build.patch b/netgen-5.3.0_build.patch new file mode 100644 index 0000000..f93f963 --- /dev/null +++ b/netgen-5.3.0_build.patch @@ -0,0 +1,379 @@ +diff -rupN netgen-5.3.0/configure.ac netgen-5.3.0-new/configure.ac +--- netgen-5.3.0/configure.ac 2014-09-01 22:00:16.979140721 +0200 ++++ netgen-5.3.0-new/configure.ac 2014-09-01 22:00:31.803140104 +0200 +@@ -1,5 +1,5 @@ + AC_INIT([netgen],[5.3.0],[],[]) +-AM_INIT_AUTOMAKE([-Wall -Werror foreign]) ++AM_INIT_AUTOMAKE([-Wall foreign]) + + AC_CONFIG_MACRO_DIR([m4]) + +@@ -35,15 +35,15 @@ AC_ARG_WITH([occ], + [AC_HELP_STRING([--with-occ=dir],[use OpenCascade installed in directory dir])], + [occdir=$withval] + [occon=true], +- [occdir=/opt/OpenCASCADE] ++ [occdir=/usr] + ) + + + + if test a$occon = atrue ; then + +- AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I$occdir/inc -I/usr/include/opencascade"]) +- AC_SUBST([OCCLIBS], ["-L$occdir/lib -lTKernel -lTKGeomBase -lTKMath -lTKG2d -lTKG3d -lTKXSBase -lTKOffset -lTKFillet -lTKShHealing -lTKMesh -lTKMeshVS -lTKTopAlgo -lTKGeomAlgo -lTKBool -lTKPrim -lTKBO -lTKIGES -lTKBRep -lTKSTEPBase -lTKSTEP -lTKSTL -lTKSTEPAttr -lTKSTEP209 -lTKXDESTEP -lTKXDEIGES -lTKXCAF -lTKLCAF -lFWOSPlugin"]) ++ AC_SUBST([OCCFLAGS], ["-DOCCGEOMETRY -I/usr/include/oce"]) ++ AC_SUBST([OCCLIBS], ["-lTKernel -lTKGeomBase -lTKMath -lTKG2d -lTKG3d -lTKXSBase -lTKOffset -lTKFillet -lTKShHealing -lTKMesh -lTKMeshVS -lTKTopAlgo -lTKGeomAlgo -lTKBool -lTKPrim -lTKBO -lTKIGES -lTKBRep -lTKSTEPBase -lTKSTEP -lTKSTL -lTKSTEPAttr -lTKSTEP209 -lTKXDESTEP -lTKXDEIGES -lTKXCAF -lTKLCAF -lFWOSPlugin"]) + + # -lTKDCAF + +@@ -89,18 +89,18 @@ AC_ARG_ENABLE([gui], + [AC_HELP_STRING([--disable-gui],[don't build netgen with GUI])], + [if test "$enableval" = yes; then ngguion=true; else ngguion=false; fi]) + +-metisdir=/usr/local ++metisdir=/usr + AC_ARG_WITH([metis], + [AC_HELP_STRING([--with-metis=dir],[path to metis 5.x])], + [metisdir=$withval], +- [metisdir=/usr/local] ++ [metisdir=/usr] + ) + + AC_ARG_ENABLE([parallel], + [AC_HELP_STRING([--enable-parallel],[enable mpi parallelization])], +- [AC_SUBST([MPI_INCLUDES], "-I$metisdir/include -DMETIS")] ++ [AC_SUBST([MPI_INCLUDES], "-DMETIS")] + [CXXFLAGS="$CXXFLAGS -DPARALLEL"] +- [AC_SUBST([MPI_LIBS], "-L$metisdir/lib -lmetis")] ++ [AC_SUBST([MPI_LIBS], "-lmetis")] + ) + # -DVTRACE + # -lvt-hyb +diff -rupN netgen-5.3.0/libsrc/csg/Makefile.am netgen-5.3.0-new/libsrc/csg/Makefile.am +--- netgen-5.3.0/libsrc/csg/Makefile.am 2014-09-01 22:00:16.805140729 +0200 ++++ netgen-5.3.0-new/libsrc/csg/Makefile.am 2014-09-01 22:14:30.275072578 +0200 +@@ -8,24 +8,24 @@ revolution.hpp spline3d.hpp vscsg.hpp + AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include $(TCL_INCLUDES) + METASOURCES = AUTO + +-lib_LTLIBRARIES = libcsg.la ++lib_LTLIBRARIES = libngcsg.la + + +-libcsg_la_SOURCES = algprim.cpp brick.cpp \ ++libngcsg_la_SOURCES = algprim.cpp brick.cpp \ + bspline2d.cpp csgeom.cpp csgparser.cpp curve2d.cpp edgeflw.cpp \ + explicitcurve2d.cpp extrusion.cpp gencyl.cpp genmesh.cpp identify.cpp \ + manifold.cpp meshsurf.cpp polyhedra.cpp revolution.cpp singularref.cpp \ + solid.cpp specpoin.cpp spline3d.cpp surface.cpp triapprox.cpp + +-libcsg_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la ++libngcsg_la_LIBADD = $(top_builddir)/libsrc/meshing/libngmesh.la + + + + if NGGUI +-lib_LTLIBRARIES += libcsgvis.la ++lib_LTLIBRARIES += libngcsgvis.la + +-libcsgvis_la_SOURCES = vscsg.cpp csgpkg.cpp +-libcsgvis_la_LIBADD = libcsg.la ++libngcsgvis_la_SOURCES = vscsg.cpp csgpkg.cpp ++libngcsgvis_la_LIBADD = libngcsg.la + endif + + # $(top_builddir)/libsrc/geom2d/libgeom2d.la +diff -rupN netgen-5.3.0/libsrc/general/Makefile.am netgen-5.3.0-new/libsrc/general/Makefile.am +--- netgen-5.3.0/libsrc/general/Makefile.am 2014-09-01 22:00:16.662140735 +0200 ++++ netgen-5.3.0-new/libsrc/general/Makefile.am 2014-09-01 22:00:31.805140103 +0200 +@@ -4,8 +4,8 @@ include_HEADERS = ngexception.hpp + + AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_srcdir)/libsrc/include + METASOURCES = AUTO +-noinst_LTLIBRARIES = libgen.la +-libgen_la_SOURCES = array.cpp bitarray.cpp dynamicmem.cpp flags.cpp \ ++noinst_LTLIBRARIES = libnggen.la ++libnggen_la_SOURCES = array.cpp bitarray.cpp dynamicmem.cpp flags.cpp \ + hashtabl.cpp mystring.cpp ngexception.cpp optmem.cpp parthreads.cpp \ + profiler.cpp seti.cpp sort.cpp spbita2d.cpp symbolta.cpp table.cpp \ + mpi_interface.cpp gzstream.cpp +diff -rupN netgen-5.3.0/libsrc/geom2d/Makefile.am netgen-5.3.0-new/libsrc/geom2d/Makefile.am +--- netgen-5.3.0/libsrc/geom2d/Makefile.am 2014-09-01 22:00:16.844140727 +0200 ++++ netgen-5.3.0-new/libsrc/geom2d/Makefile.am 2014-09-01 22:00:31.805140103 +0200 +@@ -4,18 +4,18 @@ AM_CPPFLAGS = -I$(top_srcdir)/libsrc/inc + + METASOURCES = AUTO + +-lib_LTLIBRARIES = libgeom2d.la ++lib_LTLIBRARIES = libnggeom2d.la + + if NGGUI +-lib_LTLIBRARIES += libgeom2dvis.la ++lib_LTLIBRARIES += libnggeom2dvis.la + endif + + + +-libgeom2d_la_SOURCES = genmesh2d.cpp geom2dmesh.cpp geometry2d.cpp +-libgeom2d_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la ++libnggeom2d_la_SOURCES = genmesh2d.cpp geom2dmesh.cpp geometry2d.cpp ++libnggeom2d_la_LIBADD = $(top_builddir)/libsrc/meshing/libngmesh.la $(MPI_LIBS) + +-libgeom2dvis_la_SOURCES = geom2dpkg.cpp vsgeom2d.cpp +-libgeom2dvis_la_LIBADD = libgeom2d.la ++libnggeom2dvis_la_SOURCES = geom2dpkg.cpp vsgeom2d.cpp ++libnggeom2dvis_la_LIBADD = libnggeom2d.la -lGL $(MPI_LIBS) + + +diff -rupN netgen-5.3.0/libsrc/gprim/Makefile.am netgen-5.3.0-new/libsrc/gprim/Makefile.am +--- netgen-5.3.0/libsrc/gprim/Makefile.am 2014-09-01 22:00:16.746140731 +0200 ++++ netgen-5.3.0-new/libsrc/gprim/Makefile.am 2014-09-01 22:00:31.805140103 +0200 +@@ -2,6 +2,6 @@ noinst_HEADERS = adtree.hpp geom3d.hpp + + AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include + METASOURCES = AUTO +-noinst_LTLIBRARIES = libgprim.la +-libgprim_la_SOURCES = adtree.cpp geom2d.cpp geom3d.cpp geomfuncs.cpp \ ++noinst_LTLIBRARIES = libnggprim.la ++libnggprim_la_SOURCES = adtree.cpp geom2d.cpp geom3d.cpp geomfuncs.cpp \ + geomtest3d.cpp transform3d.cpp spline.cpp splinegeometry.cpp +diff -rupN netgen-5.3.0/libsrc/interface/Makefile.am netgen-5.3.0-new/libsrc/interface/Makefile.am +--- netgen-5.3.0/libsrc/interface/Makefile.am 2014-09-01 22:00:16.860140726 +0200 ++++ netgen-5.3.0-new/libsrc/interface/Makefile.am 2014-09-01 22:01:39.701137273 +0200 +@@ -2,14 +2,14 @@ noinst_HEADERS = writeuser.hpp + + AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include -I$(top_srcdir)/libsrc/interface $(MPI_INCLUDES) $(TCL_INCLUDES) -DOPENGL + METASOURCES = AUTO +-lib_LTLIBRARIES = libinterface.la +-libinterface_la_SOURCES = nginterface.cpp nginterface_v2.cpp \ ++lib_LTLIBRARIES = libnginterface.la ++libnginterface_la_SOURCES = nginterface.cpp nginterface_v2.cpp \ + read_fnf_mesh.cpp readtetmesh.cpp readuser.cpp writeabaqus.cpp writediffpack.cpp \ + writedolfin.cpp writeelmer.cpp writefeap.cpp writefluent.cpp writegmsh.cpp writejcm.cpp \ + writepermas.cpp writetecplot.cpp writetet.cpp writetochnog.cpp writeuser.cpp \ + wuchemnitz.cpp writegmsh2.cpp writeOpenFOAM15x.cpp + + +-libinterface_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la ++libinterface_la_LIBADD = $(top_builddir)/libsrc/meshing/libngmesh.la + + # libinterface_la_LDFLAGS = -rdynamic +diff -rupN netgen-5.3.0/libsrc/linalg/Makefile.am netgen-5.3.0-new/libsrc/linalg/Makefile.am +--- netgen-5.3.0/libsrc/linalg/Makefile.am 2014-09-01 22:00:16.694140733 +0200 ++++ netgen-5.3.0-new/libsrc/linalg/Makefile.am 2014-09-01 22:00:31.806140103 +0200 +@@ -1,8 +1,8 @@ + noinst_HEADERS = densemat.hpp linalg.hpp polynomial.hpp vector.hpp opti.hpp + AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include + METASOURCES = AUTO +-noinst_LTLIBRARIES = libla.la +-libla_la_SOURCES = densemat.cpp polynomial.cpp bfgs.cpp linopt.cpp linsearch.cpp ++noinst_LTLIBRARIES = libngla.la ++libngla_la_SOURCES = densemat.cpp polynomial.cpp bfgs.cpp linopt.cpp linsearch.cpp + + # vector.cpp + +diff -rupN netgen-5.3.0/libsrc/meshing/Makefile.am netgen-5.3.0-new/libsrc/meshing/Makefile.am +--- netgen-5.3.0/libsrc/meshing/Makefile.am 2014-09-01 22:00:16.905140725 +0200 ++++ netgen-5.3.0-new/libsrc/meshing/Makefile.am 2014-09-01 22:00:31.806140103 +0200 +@@ -15,9 +15,9 @@ clusters.hpp hprefinement.hpp improve3.h + + METASOURCES = AUTO + +-lib_LTLIBRARIES = libmesh.la ++lib_LTLIBRARIES = libngmesh.la + +-libmesh_la_SOURCES = adfront2.cpp adfront3.cpp bisect.cpp boundarylayer.cpp \ ++libngmesh_la_SOURCES = adfront2.cpp adfront3.cpp bisect.cpp boundarylayer.cpp \ + clusters.cpp curvedelems.cpp delaunay.cpp delaunay2d.cpp \ + geomsearch.cpp global.cpp hprefinement.cpp improve2.cpp \ + improve2gen.cpp improve3.cpp localh.cpp meshclass.cpp \ +@@ -30,8 +30,8 @@ libmesh_la_SOURCES = adfront2.cpp adfron + topology.cpp triarls.cpp validate.cpp zrefine.cpp bcfunctions.cpp \ + parallelmesh.cpp paralleltop.cpp paralleltop.hpp basegeom.cpp + +-libmesh_la_LIBADD = $(top_builddir)/libsrc/linalg/libla.la \ +- $(top_builddir)/libsrc/gprim/libgprim.la \ +- $(top_builddir)/libsrc/general/libgen.la \ +- -lz ++libngmesh_la_LIBADD = $(top_builddir)/libsrc/linalg/libngla.la \ ++ $(top_builddir)/libsrc/gprim/libnggprim.la \ ++ $(top_builddir)/libsrc/general/libnggen.la \ ++ $(MPI_LIBS) -lz + +diff -rupN netgen-5.3.0/libsrc/occ/Makefile.am netgen-5.3.0-new/libsrc/occ/Makefile.am +--- netgen-5.3.0/libsrc/occ/Makefile.am 2014-09-01 22:00:16.767140730 +0200 ++++ netgen-5.3.0-new/libsrc/occ/Makefile.am 2014-09-01 22:00:31.807140103 +0200 +@@ -14,20 +14,20 @@ AM_CPPFLAGS = -I$(top_srcdir)/libsrc/inc + + METASOURCES = AUTO + +-lib_LTLIBRARIES = libocc.la ++lib_LTLIBRARIES = libngocc.la + + if NGGUI +-lib_LTLIBRARIES += liboccvis.la ++lib_LTLIBRARIES += libngoccvis.la + endif + + +-libocc_la_SOURCES = Partition_Inter2d.cxx Partition_Inter3d.cxx \ ++libngocc_la_SOURCES = Partition_Inter2d.cxx Partition_Inter3d.cxx \ + Partition_Loop.cxx Partition_Loop2d.cxx Partition_Loop3d.cxx Partition_Spliter.cxx \ + occconstruction.cpp occgenmesh.cpp occgeom.cpp occmeshsurf.cpp + +-libocc_la_LIBADD = $(OCCLIBS) ++libngocc_la_LIBADD = $(OCCLIBS) + +-liboccvis_la_SOURCES = occpkg.cpp vsocc.cpp +-liboccvis_la_LIBADD = libocc.la ++libngoccvis_la_SOURCES = occpkg.cpp vsocc.cpp ++libngoccvis_la_LIBADD = libngocc.la $(TCL_LIB_SPEC) + + +diff -rupN netgen-5.3.0/libsrc/stlgeom/Makefile.am netgen-5.3.0-new/libsrc/stlgeom/Makefile.am +--- netgen-5.3.0/libsrc/stlgeom/Makefile.am 2014-09-01 22:00:16.711140733 +0200 ++++ netgen-5.3.0-new/libsrc/stlgeom/Makefile.am 2014-09-01 22:00:31.807140103 +0200 +@@ -4,18 +4,18 @@ stltool.hpp stltopology.hpp vsstl.hpp + AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include $(TCL_INCLUDES) + METASOURCES = AUTO + +-lib_LTLIBRARIES = libstl.la ++lib_LTLIBRARIES = libngstl.la + + if NGGUI +-lib_LTLIBRARIES += libstlvis.la ++lib_LTLIBRARIES += libngstlvis.la + endif + +-libstl_la_SOURCES = meshstlsurface.cpp stlgeom.cpp stlgeomchart.cpp \ ++libngstl_la_SOURCES = meshstlsurface.cpp stlgeom.cpp stlgeomchart.cpp \ + stlgeommesh.cpp stlline.cpp stltool.cpp stltopology.cpp + + +-libstlvis_la_SOURCES = stlpkg.cpp vsstl.cpp +-libstlvis_la_LIBADD = libstl.la +-libstl_la_LIBADD = $(top_builddir)/libsrc/meshing/libmesh.la ++libngstlvis_la_SOURCES = stlpkg.cpp vsstl.cpp ++libngstlvis_la_LIBADD = libngstl.la -lGL $(MPI_LIBS) $(TCL_LIB_SPEC) ++libngstl_la_LIBADD = $(top_builddir)/libsrc/meshing/libngmesh.la $(MPI_LIBS) + # libstlvis_la_LIBADD = libstl.la $(top_builddir)/libsrc/linalg/libla.la + +diff -rupN netgen-5.3.0/libsrc/visualization/Makefile.am netgen-5.3.0-new/libsrc/visualization/Makefile.am +--- netgen-5.3.0/libsrc/visualization/Makefile.am 2014-09-01 22:00:16.836140727 +0200 ++++ netgen-5.3.0-new/libsrc/visualization/Makefile.am 2014-09-01 22:00:31.807140103 +0200 +@@ -7,11 +7,11 @@ AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_s + METASOURCES = AUTO + + if NGGUI +-noinst_LTLIBRARIES = libvisual.la ++noinst_LTLIBRARIES = libngvisual.la + endif + + +-libvisual_la_SOURCES = meshdoc.cpp mvdraw.cpp \ ++libngvisual_la_SOURCES = meshdoc.cpp mvdraw.cpp \ + vsfieldlines.cpp vsmesh.cpp vssolution.cpp importsolution.cpp + +- ++libngvisual_la_LIBADD = -lGL +diff -rupN netgen-5.3.0/ng/Makefile.am netgen-5.3.0-new/ng/Makefile.am +--- netgen-5.3.0/ng/Makefile.am 2014-09-01 22:00:16.968140722 +0200 ++++ netgen-5.3.0-new/ng/Makefile.am 2014-09-01 22:00:31.808140103 +0200 +@@ -17,21 +17,18 @@ MKL_LIBS = -L$(MKLROOT)/lib/intel64 -lm + endif + # -lpardiso500-GNU472-X86-64 -lgfortran + +-netgen_LDADD = $(top_builddir)/libsrc/visualization/libvisual.la \ +- $(top_builddir)/libsrc/csg/libcsgvis.la \ +- $(top_builddir)/libsrc/csg/libcsg.la \ +- $(top_builddir)/libsrc/interface/libinterface.la \ +- $(top_builddir)/libsrc/meshing/libmesh.la \ +- -L$(TK_BIN_DIR)/Togl1.7 $(TOGLLIBDIR) -lTogl $(LIBGLU) $(TK_LIB_SPEC) $(TCL_LIB_SPEC) $(MPI_LIBS) $(FFMPEG_LIBS) $(JPEGLIB_LIBS) $(PKG_LIBS) $(MKL_LIBS) +- +- +-# +-# $(top_builddir)/libsrc/occ/liboccvis.la +-# $(top_builddir)/libsrc/occ/libocc.la +-# $(top_builddir)/libsrc/stlgeom/libstlvis.la +-# $(top_builddir)/libsrc/stlgeom/libstl.la +-# $(top_builddir)/libsrc/geom2d/libgeom2d.la +-# $(top_builddir)/libsrc/geom2d/libgeom2dvis.la ++netgen_LDADD = $(top_builddir)/libsrc/visualization/libngvisual.la \ ++ $(top_builddir)/libsrc/csg/libngcsgvis.la \ ++ $(top_builddir)/libsrc/csg/libngcsg.la \ ++ $(top_builddir)/libsrc/interface/libnginterface.la \ ++ $(top_builddir)/libsrc/meshing/libngmesh.la \ ++ $(top_builddir)/libsrc/occ/libngoccvis.la \ ++ $(top_builddir)/libsrc/occ/libngocc.la \ ++ $(top_builddir)/libsrc/stlgeom/libngstlvis.la \ ++ $(top_builddir)/libsrc/stlgeom/libngstl.la \ ++ $(top_builddir)/libsrc/geom2d/libnggeom2d.la \ ++ $(top_builddir)/libsrc/geom2d/libnggeom2dvis.la \ ++ -L$(TK_BIN_DIR)/Togl1.7 $(TOGLLIBDIR) -lTogl1.7 -ldl -lX11 $(LIBGLU) $(TK_LIB_SPEC) $(TCL_LIB_SPEC) $(MPI_LIBS) $(FFMPEG_LIBS) $(JPEGLIB_LIBS) $(PKG_LIBS) $(MKL_LIBS) + + + # add for static linkage of ngsolve: +diff -rupN netgen-5.3.0/nglib/Makefile.am netgen-5.3.0-new/nglib/Makefile.am +--- netgen-5.3.0/nglib/Makefile.am 2014-09-01 22:00:16.582140738 +0200 ++++ netgen-5.3.0-new/nglib/Makefile.am 2014-09-01 22:15:03.762008749 +0200 +@@ -8,15 +8,15 @@ lib_LTLIBRARIES = libnglib.la + libnglib_la_SOURCES = nglib.cpp + + libnglib_la_LIBADD = \ +- $(top_builddir)/libsrc/interface/libinterface.la \ +- $(top_builddir)/libsrc/geom2d/libgeom2d.la \ +- $(top_builddir)/libsrc/csg/libcsg.la \ +- $(top_builddir)/libsrc/stlgeom/libstl.la \ +- $(top_builddir)/libsrc/occ/libocc.la \ +- $(top_builddir)/libsrc/meshing/libmesh.la \ ++ $(top_builddir)/libsrc/interface/libnginterface.la \ ++ $(top_builddir)/libsrc/geom2d/libnggeom2d.la \ ++ $(top_builddir)/libsrc/csg/libngcsg.la \ ++ $(top_builddir)/libsrc/stlgeom/libngstl.la \ ++ $(top_builddir)/libsrc/occ/libngocc.la \ ++ $(top_builddir)/libsrc/meshing/libngmesh.la \ + $(OCCLIBS) $(MPI_LIBS) + +-libnglib_la_LDFLAGS = -avoid-version ++libnglib_la_LDFLAGS = -version-info $(subst .,:,$(PACKAGE_VERSION)) + # -rdynamic + + +@@ -25,24 +25,24 @@ bin_PROGRAMS = ng_vol ng_stl + + ng_vol_SOURCES = ng_vol.cpp + ng_vol_LDADD = libnglib.la \ +- $(top_builddir)/libsrc/interface/libinterface.la \ +- $(top_builddir)/libsrc/geom2d/libgeom2d.la \ +- $(top_builddir)/libsrc/csg/libcsg.la \ +- $(top_builddir)/libsrc/stlgeom/libstl.la \ +- $(top_builddir)/libsrc/occ/libocc.la \ +- $(top_builddir)/libsrc/meshing/libmesh.la \ ++ $(top_builddir)/libsrc/interface/libnginterface.la \ ++ $(top_builddir)/libsrc/geom2d/libnggeom2d.la \ ++ $(top_builddir)/libsrc/csg/libngcsg.la \ ++ $(top_builddir)/libsrc/stlgeom/libngstl.la \ ++ $(top_builddir)/libsrc/occ/libngocc.la \ ++ $(top_builddir)/libsrc/meshing/libngmesh.la \ + $(OCCLIBS) $(MPI_LIBS) + + + + ng_stl_SOURCES = ng_stl.cpp + ng_stl_LDADD = libnglib.la \ +- $(top_builddir)/libsrc/interface/libinterface.la \ +- $(top_builddir)/libsrc/geom2d/libgeom2d.la \ +- $(top_builddir)/libsrc/csg/libcsg.la \ +- $(top_builddir)/libsrc/stlgeom/libstl.la \ +- $(top_builddir)/libsrc/occ/libocc.la \ +- $(top_builddir)/libsrc/meshing/libmesh.la \ ++ $(top_builddir)/libsrc/interface/libnginterface.la \ ++ $(top_builddir)/libsrc/geom2d/libnggeom2d.la \ ++ $(top_builddir)/libsrc/csg/libngcsg.la \ ++ $(top_builddir)/libsrc/stlgeom/libngstl.la \ ++ $(top_builddir)/libsrc/occ/libngocc.la \ ++ $(top_builddir)/libsrc/meshing/libngmesh.la \ + $(OCCLIBS) $(MPI_LIBS) + + # ng_occ_SOURCES = ng_occ.cpp diff --git a/netgen-5.3.0_fixes.patch b/netgen-5.3.0_fixes.patch new file mode 100644 index 0000000..a1e146f --- /dev/null +++ b/netgen-5.3.0_fixes.patch @@ -0,0 +1,887 @@ +diff -rupN netgen-5.3.0/libsrc/meshing/meshtype.cpp netgen-5.3.0-new/libsrc/meshing/meshtype.cpp +--- netgen-5.3.0/libsrc/meshing/meshtype.cpp 2014-09-01 20:54:48.985249216 +0200 ++++ netgen-5.3.0-new/libsrc/meshing/meshtype.cpp 2014-09-01 20:55:10.298248328 +0200 +@@ -1,4 +1,5 @@ + #include ++#include // to get DBL_MIN defined + + #include "meshing.hpp" + +@@ -666,7 +667,8 @@ namespace netgen + + 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 @@ namespace netgen + + 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 @@ namespace netgen + = 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 @@ namespace netgen + 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 @@ namespace netgen + 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 @@ namespace netgen + + 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 @@ namespace netgen + ddet *= -1; + + +- if (det <= 0) ++ //if (det <= 0) ++ if (det <= DBL_MIN) // avoid FPE + err += 1e12; + else + { +@@ -2184,7 +2192,7 @@ namespace netgen + + det *= -1; + +- if (det <= 0) ++ if (det <= DBL_MIN) + err += 1e12; + else + { +@@ -2513,10 +2521,10 @@ namespace netgen + + 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 -rupN netgen-5.3.0/libsrc/meshing/meshtype.hpp netgen-5.3.0-new/libsrc/meshing/meshtype.hpp +--- netgen-5.3.0/libsrc/meshing/meshtype.hpp 2014-09-01 20:54:48.973249217 +0200 ++++ netgen-5.3.0-new/libsrc/meshing/meshtype.hpp 2014-09-01 20:55:10.298248328 +0200 +@@ -15,6 +15,7 @@ namespace netgen + Classes for NETGEN + */ + ++class Mesh; // added due to compilation errors on some platforms + + + enum ELEMENT_TYPE { +diff -rupN netgen-5.3.0/libsrc/meshing/smoothing2.cpp netgen-5.3.0-new/libsrc/meshing/smoothing2.cpp +--- netgen-5.3.0/libsrc/meshing/smoothing2.cpp 2014-09-01 20:54:49.063249213 +0200 ++++ netgen-5.3.0-new/libsrc/meshing/smoothing2.cpp 2014-09-01 20:55:10.299248328 +0200 +@@ -361,7 +361,8 @@ namespace netgen + vgrad = 0; + double 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); +@@ -577,7 +578,8 @@ namespace netgen + 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; + +@@ -649,7 +651,8 @@ namespace netgen + 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); +@@ -1079,7 +1082,7 @@ namespace netgen + { + mesh[pi] = Point<3> (origp); + } +- ++ break; // exit as is not used anymore + } + } + } +diff -rupN netgen-5.3.0/libsrc/occ/occconstruction.cpp netgen-5.3.0-new/libsrc/occ/occconstruction.cpp +--- netgen-5.3.0/libsrc/occ/occconstruction.cpp 2014-09-01 20:54:48.461249238 +0200 ++++ netgen-5.3.0-new/libsrc/occ/occconstruction.cpp 2014-09-01 20:55:10.299248328 +0200 +@@ -28,7 +28,7 @@ + #include + #include + #include +-#include ++//#include + //#include + #include + #include +diff -rupN netgen-5.3.0/libsrc/occ/occgenmesh.cpp netgen-5.3.0-new/libsrc/occ/occgenmesh.cpp +--- netgen-5.3.0/libsrc/occ/occgenmesh.cpp 2014-09-01 20:54:48.330249244 +0200 ++++ netgen-5.3.0-new/libsrc/occ/occgenmesh.cpp 2014-09-01 20:55:10.300248328 +0200 +@@ -57,6 +57,8 @@ namespace netgen + + + ++ ++ static // useless out of this file + double ComputeH (double kappa) + { + double hret; +@@ -74,8 +76,7 @@ namespace netgen + } + + +- +- ++ 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 @@ namespace netgen + 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 @@ namespace netgen + + + ++ static // useless out of this file + void DivideEdge (TopoDS_Edge & edge, Array & ps, + Array & params, Mesh & mesh) + { +@@ -250,8 +252,8 @@ namespace netgen + 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 @@ namespace netgen + { + oldpnt = pnt; + pnt = c->Value(s0+(i/double(DIVIDEEDGESECTIONS))*(s1-s0)); ++ // -- no more than 1 segment per /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 @@ namespace netgen + { + 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 @@ namespace netgen + (*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 @@ namespace netgen + 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 @@ namespace netgen + { + 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 @@ namespace netgen + 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 @@ namespace netgen + //(*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 @@ namespace netgen + } + 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() ); ++ } + } + } + +@@ -1465,3 +1528,4 @@ namespace netgen + } + + #endif ++ +diff -rupN netgen-5.3.0/libsrc/occ/occgeom.cpp netgen-5.3.0-new/libsrc/occ/occgeom.cpp +--- netgen-5.3.0/libsrc/occ/occgeom.cpp 2014-09-01 20:54:48.357249242 +0200 ++++ netgen-5.3.0-new/libsrc/occ/occgeom.cpp 2014-09-01 20:55:10.300248328 +0200 +@@ -8,6 +8,8 @@ + #include "ShapeAnalysis_CheckSmallFace.hxx" + #include "ShapeAnalysis_DataMapOfShapeListOfReal.hxx" + #include "ShapeAnalysis_Surface.hxx" ++#include // -- to optimize Project() and FastProject() ++#include + #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::Iterator it(fclsmap); ++ for (; it.More(); it.Next()) ++ delete it.Value(); ++ } ++ ++ void OCCGeometry :: PrintNrShapes () + { + TopExp_Explorer e; + int count = 0; +@@ -951,25 +960,58 @@ namespace netgen + } + + ++ // 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 @@ namespace netgen + { + 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 -rupN netgen-5.3.0/libsrc/occ/occgeom.hpp netgen-5.3.0-new/libsrc/occ/occgeom.hpp +--- netgen-5.3.0/libsrc/occ/occgeom.hpp 2014-09-01 20:54:48.429249239 +0200 ++++ netgen-5.3.0-new/libsrc/occ/occgeom.hpp 2014-09-01 20:55:10.300248328 +0200 +@@ -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 ++class Handle_ShapeAnalysis_Surface; ++class BRepTopAdaptor_FClass2d; + + // Philippose - 29/01/2009 + // OpenCascade XDE Support +@@ -192,6 +196,9 @@ namespace netgen + class OCCGeometry : public NetgenGeometry + { + Point<3> center; ++ // -- Optimization: to use cached projector and classifier ++ mutable NCollection_DataMap fprjmap; ++ mutable NCollection_DataMap fclsmap; + + public: + TopoDS_Shape shape; +@@ -247,6 +254,8 @@ namespace netgen + virtual void Save (string filename) const; + + ++ ~OCCGeometry(); // -- to free cached projector and classifier ++ + void BuildFMap(); + + Box<3> GetBoundingBox() +@@ -266,9 +275,14 @@ namespace netgen + 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 -rupN netgen-5.3.0/libsrc/occ/occmeshsurf.cpp netgen-5.3.0-new/libsrc/occ/occmeshsurf.cpp +--- netgen-5.3.0/libsrc/occ/occmeshsurf.cpp 2014-09-01 20:54:48.386249241 +0200 ++++ netgen-5.3.0-new/libsrc/occ/occmeshsurf.cpp 2014-09-01 20:55:10.304248328 +0200 +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include // -- moved here from occgeom.hpp + + + namespace netgen +@@ -434,23 +435,33 @@ namespace netgen + + 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 @@ namespace netgen + 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 @@ namespace netgen + } + + newp = hnewp; +- } ++ }//; -- to compile with -Wall -pedantic + + + void OCCRefinementSurfaces :: +@@ -708,14 +720,18 @@ namespace netgen + 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 @@ namespace netgen + 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 -rupN netgen-5.3.0/libsrc/occ/Partition_Inter3d.cxx netgen-5.3.0-new/libsrc/occ/Partition_Inter3d.cxx +--- netgen-5.3.0/libsrc/occ/Partition_Inter3d.cxx 2014-09-01 20:54:48.316249244 +0200 ++++ netgen-5.3.0-new/libsrc/occ/Partition_Inter3d.cxx 2014-09-01 20:58:56.691238891 +0200 +@@ -243,9 +243,11 @@ static void PutInBounds (const TopoDS_Fa + 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 -rupN netgen-5.3.0/libsrc/occ/Partition_Loop2d.cxx netgen-5.3.0-new/libsrc/occ/Partition_Loop2d.cxx +--- netgen-5.3.0/libsrc/occ/Partition_Loop2d.cxx 2014-09-01 20:54:48.419249240 +0200 ++++ netgen-5.3.0-new/libsrc/occ/Partition_Loop2d.cxx 2014-09-01 20:55:10.305248328 +0200 +@@ -210,7 +210,7 @@ static Standard_Boolean SelectEdge(cons + 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 @@ static Standard_Boolean SelectEdge(cons + // -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 -rupN netgen-5.3.0/libsrc/occ/Partition_Spliter.cxx netgen-5.3.0-new/libsrc/occ/Partition_Spliter.cxx +--- netgen-5.3.0/libsrc/occ/Partition_Spliter.cxx 2014-09-01 20:54:48.277249246 +0200 ++++ netgen-5.3.0-new/libsrc/occ/Partition_Spliter.cxx 2014-09-01 20:58:36.954239713 +0200 +@@ -1169,8 +1169,10 @@ static void findEqual (const TopTools_Li + for (; j<=nbj && ok; ++j) { + if (Extrema.IsMin(j)) { + hasMin = Standard_True; ++ // porting to OCCT6.5.1 + // ok = Extrema.Value(j) <= tol; // V6.3 +- ok = Extrema.SquareDistance(j) <= tol; // V6.5 ++ // ok = Extrema.SquareDistance(j) <= tol; // V6.5 ++ ok = Extrema.SquareDistance(j) <= tol * tol; + } + } + } +diff -rupN netgen-5.3.0/libsrc/occ/utilities.h netgen-5.3.0-new/libsrc/occ/utilities.h +--- netgen-5.3.0/libsrc/occ/utilities.h 2014-09-01 20:54:48.457249238 +0200 ++++ netgen-5.3.0-new/libsrc/occ/utilities.h 2014-09-01 20:55:10.306248327 +0200 +@@ -33,6 +33,7 @@ + + #include + #include ++#include + #include + // #include "SALOME_Log.hxx" + +diff -rupN netgen-5.3.0/libsrc/stlgeom/stlgeommesh.cpp netgen-5.3.0-new/libsrc/stlgeom/stlgeommesh.cpp +--- netgen-5.3.0/libsrc/stlgeom/stlgeommesh.cpp 2014-09-01 20:54:47.912249261 +0200 ++++ netgen-5.3.0-new/libsrc/stlgeom/stlgeommesh.cpp 2014-09-01 20:55:10.307248327 +0200 +@@ -1435,7 +1435,8 @@ int STLMeshingDummy (STLGeometry* stlgeo + /* + if (!optstring || strlen(optstring) == 0) + { +- mparam.optimize2d = "smcm"; ++ //mparam.optimize2d = (char*)"smcm"; ++ mparam.optimize2d = (char*)"smcm"; + } + else + { +@@ -1453,7 +1454,7 @@ int STLMeshingDummy (STLGeometry* stlgeo + 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 @@ int STLMeshingDummy (STLGeometry* stlgeo + /* + if (!optstring || strlen(optstring) == 0) + { +- mparam.optimize3d = "cmdmstm"; ++ //mparam.optimize3d = "cmdmstm"; ++ mparam.optimize3d = (char*)"cmdmstm"; + } + else + { +diff -rupN netgen-5.3.0/nglib/nglib.h netgen-5.3.0-new/nglib/nglib.h +--- netgen-5.3.0/nglib/nglib.h 2014-09-01 20:54:47.470249279 +0200 ++++ netgen-5.3.0-new/nglib/nglib.h 2014-09-01 20:55:10.307248327 +0200 +@@ -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) diff --git a/netgen-5.3.0_metis.patch b/netgen-5.3.0_metis.patch new file mode 100644 index 0000000..96ee961 --- /dev/null +++ b/netgen-5.3.0_metis.patch @@ -0,0 +1,94 @@ +diff -rupN netgen-5.3.0/libsrc/meshing/parallelmesh.cpp netgen-5.3.0-new/libsrc/meshing/parallelmesh.cpp +--- netgen-5.3.0/libsrc/meshing/parallelmesh.cpp 2014-09-01 20:54:48.987249216 +0200 ++++ netgen-5.3.0-new/libsrc/meshing/parallelmesh.cpp 2014-09-01 21:02:25.783230174 +0200 +@@ -14,7 +14,7 @@ namespace metis { + + #if METIS_VER_MAJOR >= 5 + #define METIS5 +- typedef idx_t idxtype; ++ typedef metis::idx_t idxtype; + #else + #define METIS4 + typedef idxtype idx_t; +@@ -794,10 +794,10 @@ namespace netgen + eptr.Append (eind.Size()); + Array epart(ne), npart(nn); + +- int nparts = ntasks-1; +- int edgecut; ++ metis::idx_t nparts = ntasks-1; ++ metis::idx_t edgecut; + +- int ncommon = 3; ++ metis::idx_t ncommon = 3; + METIS_PartMeshDual (&ne, &nn, &eptr[0], &eind[0], NULL, NULL, &ncommon, &nparts, + NULL, NULL, + &edgecut, &epart[0], &npart[0]); +@@ -1029,11 +1029,11 @@ namespace netgen + eptr.Append (eind.Size()); + Array epart(ne), npart(nn); + +- int nparts = ntasks-1; +- int edgecut; ++ metis::idx_t nparts = ntasks-1; ++ metis::idx_t edgecut; + + +- int ncommon = 3; ++ metis::idx_t ncommon = 3; + METIS_PartMeshDual (&ne, &nn, &eptr[0], &eind[0], &nwgt[0], NULL, &ncommon, &nparts, + NULL, NULL, + &edgecut, &epart[0], &npart[0]); +@@ -1266,7 +1266,7 @@ namespace netgen + + for ( int vert = 0; vert < nn; vert++ ) + { +- FlatArray array ( cnt[vert], &adjacency[ xadj[vert] ] ); ++ FlatArray array ( cnt[vert], &adjacency[ xadj[vert] ] ); + BubbleSort(array); + } + +@@ -1377,7 +1377,7 @@ namespace netgen + + for ( int el = 0; el < ne; el++ ) + { +- FlatArray array ( cnt[el], &adjacency[ xadj[el] ] ); ++ FlatArray array ( cnt[el], &adjacency[ xadj[el] ] ); + BubbleSort(array); + } + +@@ -1428,8 +1428,8 @@ namespace netgen + void Mesh :: PartDualHybridMesh2D ( ) + { + #ifdef METIS +- int ne = GetNSE(); +- int nv = GetNV(); ++ metis::idx_t ne = GetNSE(); ++ metis::idx_t nv = GetNV(); + + Array xadj(ne+1); + Array adjacency(ne*4); +@@ -1484,18 +1484,18 @@ namespace netgen + + idxtype *v_weights = NULL, *e_weights = NULL; + +- int weightflag = 0; +- // int numflag = 0; +- int nparts = ntasks - 1; ++ metis::idx_t weightflag = 0; ++ metis::idx_t numflag = 0; ++ metis::idx_t nparts = ntasks - 1; + +- int edgecut; ++ metis::idx_t edgecut; + Array part(ne); + + for ( int el = 0; el < ne; el++ ) + BubbleSort (adjacency.Range (xadj[el], xadj[el+1])); + + #ifdef METIS4 +- int options[5]; ++ metis::idx_t options[5]; + options[0] = 0; + METIS_PartGraphKway ( &ne, &xadj[0], &adjacency[0], v_weights, e_weights, &weightflag, + &numflag, &nparts, options, &edgecut, &part[0] ); diff --git a/netgen-5.3.0_msc-ver.patch b/netgen-5.3.0_msc-ver.patch new file mode 100644 index 0000000..f05c007 --- /dev/null +++ b/netgen-5.3.0_msc-ver.patch @@ -0,0 +1,31 @@ +diff -rupN netgen-5.3.0/ng/ngpkg.cpp netgen-5.3.0-new/ng/ngpkg.cpp +--- netgen-5.3.0/ng/ngpkg.cpp 2014-09-01 20:54:49.423249198 +0200 ++++ netgen-5.3.0-new/ng/ngpkg.cpp 2014-09-01 21:04:13.023225704 +0200 +@@ -3136,13 +3136,11 @@ void PlayAnimFile(const char* name, int + extern "C" int Ng_Init (Tcl_Interp * interp); + extern "C" int Ng_CSG_Init (Tcl_Interp * interp); + +-#ifdef _MSC_VER + extern "C" int Ng_stl_Init (Tcl_Interp * interp); + extern "C" int Ng_geom2d_Init (Tcl_Interp * interp); + #ifdef OCCGEOMETRY + extern "C" int Ng_occ_Init (Tcl_Interp * interp); + #endif +-#endif + + + // extern "C" int Ng_Geom2d_Init (Tcl_Interp * interp); +@@ -3160,13 +3158,11 @@ void PlayAnimFile(const char* name, int + #endif + + Ng_CSG_Init(interp); +-#ifdef _MSC_VER + Ng_stl_Init(interp); + Ng_geom2d_Init (interp); + #ifdef OCCGEOMETRY + Ng_occ_Init (interp); + #endif +-#endif + + + // Ng_Geom2d_Init(interp); diff --git a/netgen-5.3.0_netgendir.patch b/netgen-5.3.0_netgendir.patch new file mode 100644 index 0000000..29687f2 --- /dev/null +++ b/netgen-5.3.0_netgendir.patch @@ -0,0 +1,18 @@ +diff -rupN netgen-5.3.0/ng/ngappinit.cpp netgen-5.3.0-new/ng/ngappinit.cpp +--- netgen-5.3.0/ng/ngappinit.cpp 2014-09-01 20:54:49.511249194 +0200 ++++ netgen-5.3.0-new/ng/ngappinit.cpp 2014-09-01 21:03:21.679227844 +0200 +@@ -148,9 +148,11 @@ int main(int argc, char ** argv) + + if (getenv ("NETGENDIR") && strlen (getenv ("NETGENDIR"))) + ngdir = getenv ("NETGENDIR"); +- else +- ngdir = "."; +- ++ else { ++ ngdir = "/usr/share/netgen-mesher"; ++ setenv("NETGENDIR", ngdir.c_str(), 1); ++ } ++ + verbose = parameters.GetDefineFlag ("V"); + + if (verbose) diff --git a/netgen-5.3.0_relative-includes.patch b/netgen-5.3.0_relative-includes.patch new file mode 100644 index 0000000..602f9a1 --- /dev/null +++ b/netgen-5.3.0_relative-includes.patch @@ -0,0 +1,18 @@ +diff -rupN netgen-5.1/libsrc/include/meshing.hpp netgen-5.1-new/libsrc/include/meshing.hpp +--- netgen-5.1/libsrc/include/meshing.hpp 2013-06-25 13:28:58.000000000 +0200 ++++ netgen-5.1-new/libsrc/include/meshing.hpp 2014-06-14 14:05:30.481877485 +0200 +@@ -1 +1 @@ +-#include <../meshing/meshing.hpp> ++#include "../meshing/meshing.hpp" +diff -rupN netgen-5.1/libsrc/include/myadt.hpp netgen-5.1-new/libsrc/include/myadt.hpp +--- netgen-5.1/libsrc/include/myadt.hpp 2013-06-25 13:28:58.000000000 +0200 ++++ netgen-5.1-new/libsrc/include/myadt.hpp 2014-06-14 14:04:39.274878998 +0200 +@@ -1 +1 @@ +-#include <../general/myadt.hpp> ++#include "../general/myadt.hpp" +diff -rupN netgen-5.1/libsrc/include/stlgeom.hpp netgen-5.1-new/libsrc/include/stlgeom.hpp +--- netgen-5.1/libsrc/include/stlgeom.hpp 2013-06-25 13:28:58.000000000 +0200 ++++ netgen-5.1-new/libsrc/include/stlgeom.hpp 2014-06-14 14:05:18.911877827 +0200 +@@ -1 +1 @@ +-#include <../stlgeom/stlgeom.hpp> ++#include "../stlgeom/stlgeom.hpp" diff --git a/netgen-mesher.spec b/netgen-mesher.spec index 4e803d0..fb4bc4c 100644 --- a/netgen-mesher.spec +++ b/netgen-mesher.spec @@ -5,13 +5,13 @@ %global dconfigure %(printf %%s '%configure' | sed 's!\./configure!../configure!g') Name: netgen-mesher -Version: 5.1 -Release: 11%{?dist} +Version: 5.3.0 +Release: 1%{?dist} Summary: Automatic mesh generation tool License: LGPLv2 URL: http://sourceforge.net/projects/netgen-mesher/ -Source0: http://sourceforge.net/projects/netgen-mesher/files/netgen-mesher/5.1/netgen-%{version}.tar.gz +Source0: http://sourceforge.net/projects/netgen-mesher/files/netgen-mesher/5.3/netgen-%{version}.tar.gz Source1: netgen-mesher.png Source2: netgen-mesher.desktop # Fix various configure.ac and Makefiles issues: @@ -20,17 +20,17 @@ Source2: netgen-mesher.desktop # - Rename shared libaries, the original names are often way too generic # - Add missing libraries to LIBADD # - Fix nglib invalid soname -Patch0: netgen-5.1_build.patch +Patch0: netgen-5.3.0_build.patch # Some fixes to the code (taken from salome netgen plugin) -Patch1: netgen-5.1_fixes.patch +Patch1: netgen-5.3.0_fixes.patch # Fix build against recent metis -Patch2: netgen-5.1_metis.patch +Patch2: netgen-5.3.0_metis.patch # Set a default NETGENDIR appropriate for the fedora packaging -Patch3: netgen-5.1_netgendir.patch +Patch3: netgen-5.3.0_netgendir.patch # Remove some MSC_VER ifdefs (why are they there?) -Patch4: netgen-5.1_msc-ver.patch +Patch4: netgen-5.3.0_msc-ver.patch # Make some includes relative (needed for when headers are in -private subpackage) -Patch5: netgen-5.1_relative-includes.patch +Patch5: netgen-5.3.0_relative-includes.patch BuildRequires: autoconf automake libtool BuildRequires: tk-devel @@ -43,6 +43,7 @@ BuildRequires: mpich-devel BuildRequires: mesa-libGLU-devel BuildRequires: libXmu-devel BuildRequires: desktop-file-utils +BuildRequires: dos2unix Requires: %{name}-common = %{version}-%{release} Requires: %{name}-libs%{?_isa} = %{version}-%{release} @@ -141,7 +142,17 @@ Development files for Netgen compiled against mpich. ############################################################################### %prep -%autosetup -p1 -n netgen-%{version} +%setup -q -n netgen-%{version} + +# Convert line endings +find . -type f -exec dos2unix {} \; + +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 %build @@ -323,6 +334,9 @@ fi %changelog +* Mon Sep 01 2014 Sandro Mani - 5.3.0-1 +- Update to 5.3.0 + * Sun Aug 17 2014 Fedora Release Engineering - 5.1-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild diff --git a/sources b/sources index d96378b..e63efad 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -3e2d0779b2335db41aa4dc8d7f958563 netgen-5.1.tar.gz +a4eb6b7a8d2d3addced40823be47180f netgen-5.3.0.tar.gz