commit:     cd2b87a6861e69e0f984f8ba9a9f6520730bcc2b
Author:     Tiziano Müller <dev-zero <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  7 08:19:48 2016 +0000
Commit:     Tiziano Müller <dev-zero <AT> gentoo <DOT> org>
CommitDate: Thu Jul  7 08:19:48 2016 +0000
URL:        https://gitweb.gentoo.org/dev/dev-zero.git/commit/?id=cd2b87a6

sci-mathematics/netgen: need source files for freecad

 sci-mathematics/netgen/Manifest                    |   3 +
 .../netgen-5.x-compile-against-occ-6.5.x.patch     |  28 ++
 .../netgen/files/netgen-5.x-fedora-fixes.patch     | 223 +++++++++++
 .../netgen/files/netgen-5.x-includes-fixes.patch   |  29 ++
 .../netgen/files/netgen-5.x-makefiles-fixes.patch  | 412 +++++++++++++++++++++
 .../netgen/files/netgen-5.x-metis-fixes.patch      | 102 +++++
 .../netgen/files/netgen-5.x-missing-define.patch   |  38 ++
 .../files/netgen-5.x-occ-stl-api-change.patch      |  94 +++++
 .../files/netgen-5.x-parallelmetis4-fix.patch      |  36 ++
 sci-mathematics/netgen/files/netgen.desktop        |   8 +
 sci-mathematics/netgen/files/netgen.png            | Bin 0 -> 4220 bytes
 sci-mathematics/netgen/metadata.xml                |  14 +
 sci-mathematics/netgen/netgen-5.3.1-r1.ebuild      | 126 +++++++
 13 files changed, 1113 insertions(+)

diff --git a/sci-mathematics/netgen/Manifest b/sci-mathematics/netgen/Manifest
new file mode 100644
index 0000000..95e6b78
--- /dev/null
+++ b/sci-mathematics/netgen/Manifest
@@ -0,0 +1,3 @@
+DIST netgen-4.9.13.tar.gz 1829916 SHA256 
a5f188bb0fafc0536389314efb8fe6d294b93512b54f2b67c9a3e5431c3b0412 SHA512 
6cfe6ea799f37a35dc74112f5c370fd369277a55965769649c00632eba308061901fd7563fe7eb4b427b0702d39f4f004854da9f02f2e6f11ccd3a72e6b6afa3
 WHIRLPOOL 
e4a0dc3ca74241f77d3c389b30944ea59fe7b0035af18f343499f4f7f644568fd5b687590b249b25121614508496ff8270ca52e91c8a2997ac2792f301533b4c
+DIST netgen-5.0.0.tar.gz 1835004 SHA256 
c122aa41fe6cc7c491df5df40c1c2a5633ee96a36d363a630ff1c5c4e4921419 SHA512 
27f46feaa1cf9d269c4898c093cca404fdc5e5fbfc8c9684d0d2f2ec2f2f9af85dd8b3d3372044f63fca08e1a079fd042fbcdc7b9ca881c38a3cfe67586b34b4
 WHIRLPOOL 
98a1eb2455d767929a808145e2e55d7064a99e0e6e2c80e464736b6b30df750d03069fc6f04a2e3e0d876f5664b6a2138e5ea5e3a9ac99294756ba4187710963
+DIST netgen-5.3.1.tar.gz 1857185 SHA256 
cb97f79d8f4d55c00506ab334867285cde10873c8a8dc783522b47d2bc128bf9 SHA512 
6f5b5b8ab47fc3bf57281b26f26b13675aa719146c90a928eda3d704163e20a0a3baf27d520978ec6c4828ee6323eaef65deb851988eefef5d768a9ecad69fc8
 WHIRLPOOL 
da869ad1cbcd538ab56e6a1b0716a55bfdfc66dbe9e881f2b6a25c15e70e93d5560021eb331026e1228d3f9dfa97c94bfefb009f0927039f549aaabada18c60e

diff --git 
a/sci-mathematics/netgen/files/netgen-5.x-compile-against-occ-6.5.x.patch 
b/sci-mathematics/netgen/files/netgen-5.x-compile-against-occ-6.5.x.patch
new file mode 100644
index 0000000..ce581ce
--- /dev/null
+++ b/sci-mathematics/netgen/files/netgen-5.x-compile-against-occ-6.5.x.patch
@@ -0,0 +1,28 @@
+--- libsrc/occ/Partition_Spliter.cxx.old       2012-11-14 16:14:39.440625195 
+0100
++++ libsrc/occ/Partition_Spliter.cxx   2012-11-14 16:15:20.035646075 +0100
+@@ -1169,8 +1169,8 @@
+           for (; j<=nbj && ok; ++j) {
+             if (Extrema.IsMin(j)) {
+             hasMin = Standard_True;
+-            ok = Extrema.Value(j) <= tol;  // V6.3
+-            // ok = Extrema.SquareDistance(j) <= tol;  // V6.5
++            // ok = Extrema.Value(j) <= tol;  // V6.3
++            ok = Extrema.SquareDistance(j) <= tol;  // V6.5
+           }
+           }
+         }
+--- libsrc/occ/Partition_Inter3d.cxx.old       2012-11-14 16:13:11.149581085 
+0100
++++ libsrc/occ/Partition_Inter3d.cxx   2012-11-14 16:14:20.017615214 +0100
+@@ -243,9 +243,9 @@
+       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
+-        {
++      //      if (anExtPS.Value( i ) <= TolE)               // V6.3
++      if (anExtPS.SquareDistance( i ) <= TolE)   // V6.5
++      {
+           aPOnSurf = anExtPS.Point( i );
+           break;
+         }

diff --git a/sci-mathematics/netgen/files/netgen-5.x-fedora-fixes.patch 
b/sci-mathematics/netgen/files/netgen-5.x-fedora-fixes.patch
new file mode 100644
index 0000000..5cb399e
--- /dev/null
+++ b/sci-mathematics/netgen/files/netgen-5.x-fedora-fixes.patch
@@ -0,0 +1,223 @@
+diff -uwrN netgen-5.3.1/libsrc/meshing/meshtype.cpp 
netgen/libsrc/meshing/meshtype.cpp
+--- netgen-5.3.1/libsrc/meshing/meshtype.cpp   2016-02-20 21:55:59.226450843 
+0100
++++ netgen/libsrc/meshing/meshtype.cpp 2016-02-20 23:54:12.293646166 +0100
+@@ -1,4 +1,5 @@
+ #include <mystdlib.h>
++#include <float.h> // to get DBL_MIN defined
+ 
+ #include "meshing.hpp"  
+ 
+@@ -666,7 +667,8 @@
+ 
+         double det = trans.Det();
+ 
+-        if (det <= 0)
++        // if (det <= 0)
++        if (det <= DBL_MIN) // avoid FPE
+           err += 1e12;
+         else
+           err += frob * frob / det;
+@@ -722,7 +724,8 @@
+ 
+             double det = trans(0,0)*trans(1,1)-trans(1,0)*trans(0,1);
+ 
+-            if (det <= 0)
++            // if (det <= 0)
++            if (det <= DBL_MIN)  // avoid FPE
+               {
+                 dd = 0;
+                 return 1e12;
+@@ -806,7 +809,8 @@
+           = dtrans(0,0) * trans(1,1) - trans(0,1) * dtrans(1,0)
+           + trans(0,0) * dtrans(1,1) - dtrans(0,1) * trans(1,0);
+ 
+-        if (det <= 0)
++        // if (det <= 0)
++        if (det <= DBL_MIN) // avoid FPE
+           err += 1e12;
+         else
+           {
+@@ -856,7 +860,8 @@
+         frob /= 2;
+ 
+         double det = trans.Det();
+-        if (det <= 0)
++        //if (det <= 0)
++        if (det <= DBL_MIN) // avoid FPE
+           err += 1e12;
+         else
+           err += frob * frob / det;
+@@ -1864,7 +1869,8 @@
+       case PYRAMID:
+         {
+           double noz = 1-p(2);
+-          if (noz == 0.0) noz = 1e-10;
++          //if (noz == 0.0) noz = 1e-10;
++          if (noz <= DBL_MIN) noz = 1e-10; // avoid FPE
+ 
+           double xi  = p(0) / noz;
+           double eta = p(1) / noz;
+@@ -2513,10 +2519,10 @@
+ 
+   MeshingParameters :: MeshingParameters ()
+   {
+-    optimize3d = "cmdmustm";
++    optimize3d = (char*)"cmdmustm"; // optimize3d = "cmdmustm";
+     //optimize3d = "cmdmstm";
+     optsteps3d = 3;
+-    optimize2d = "smsmsmSmSmSm";
++    optimize2d = (char*)"smsmsmSmSmSm"; // optimize2d = "smsmsmSmSmSm";
+     optsteps2d = 3;
+     opterrpow = 2;
+     blockfill = 1;
+diff -uwrN netgen-5.3.1/libsrc/meshing/meshtype.hpp 
netgen/libsrc/meshing/meshtype.hpp
+--- netgen-5.3.1/libsrc/meshing/meshtype.hpp   2016-02-20 21:55:59.226450843 
+0100
++++ netgen/libsrc/meshing/meshtype.hpp 2016-02-20 23:54:12.295646166 +0100
+@@ -15,6 +15,7 @@
+     Classes for NETGEN
+   */
+ 
++class Mesh; // added due to compilation errors on some platforms
+ 
+ 
+   enum ELEMENT_TYPE { 
+diff -uwrN netgen-5.3.1/libsrc/meshing/smoothing2.cpp 
netgen/libsrc/meshing/smoothing2.cpp
+--- netgen-5.3.1/libsrc/meshing/smoothing2.cpp 2016-02-20 21:55:59.228450843 
+0100
++++ netgen/libsrc/meshing/smoothing2.cpp       2016-02-20 23:54:12.298646166 
+0100
+@@ -361,7 +361,8 @@
+     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 @@
+     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 @@
+     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);
+diff -uwrN netgen-5.3.1/libsrc/occ/occconstruction.cpp 
netgen/libsrc/occ/occconstruction.cpp
+--- netgen-5.3.1/libsrc/occ/occconstruction.cpp        2016-02-20 
21:53:44.420447131 +0100
++++ netgen/libsrc/occ/occconstruction.cpp      2016-02-20 23:54:12.299646166 
+0100
+@@ -28,7 +28,7 @@
+ #include <BRepAlgoAPI_Common.hxx>
+ #include <BRepAlgoAPI_Fuse.hxx>
+ #include <BRepAlgoAPI_Section.hxx>
+-#include <BRepOffsetAPI_Sewing.hxx>
++//#include <BRepOffsetAPI_Sewing.hxx>
+ //#include <BRepAlgo_Sewing.hxx>
+ #include <BRepOffsetAPI_MakeOffsetShape.hxx>
+ #include <ShapeFix_Shape.hxx>
+diff -uwrN netgen-5.3.1/libsrc/occ/occmeshsurf.cpp 
netgen/libsrc/occ/occmeshsurf.cpp
+--- netgen-5.3.1/libsrc/occ/occmeshsurf.cpp    2016-02-20 21:53:44.421447131 
+0100
++++ netgen/libsrc/occ/occmeshsurf.cpp  2016-02-20 23:54:12.310646166 +0100
+@@ -6,6 +6,7 @@
+ #include <meshing.hpp>
+ #include <GeomLProp_SLProps.hxx>
+ #include <ShapeAnalysis_Surface.hxx>
++#include <GeomAPI_ProjectPointOnCurve.hxx> // -- moved here from occgeom.hpp
+ 
+ 
+ namespace netgen
+@@ -689,7 +691,7 @@
+       }
+   
+     newp = hnewp;
+-  }
++  }//; -- to compile with -Wall -pedantic
+ 
+ 
+   void OCCRefinementSurfaces ::  
+ 
+ 
+diff -uwrN netgen-5.3.1/libsrc/occ/Partition_Inter3d.cxx 
netgen/libsrc/occ/Partition_Inter3d.cxx
+--- netgen-5.3.1/libsrc/occ/Partition_Inter3d.cxx      2016-02-20 
21:53:44.418447131 +0100
++++ netgen/libsrc/occ/Partition_Inter3d.cxx    2016-02-20 23:54:12.311646166 
+0100
+@@ -243,8 +243,10 @@
+       Standard_Integer i, nbExt = anExtPS.NbExt();
+       Extrema_POnSurf aPOnSurf;
+       for (i = 1; i <= nbExt; ++i )
++       // porting to OCCT6.5.1
+         // if (anExtPS.Value( i ) <= TolE)               // V6.3
+-        if (anExtPS.SquareDistance( i ) <= TolE)   // V6.5
++       // if (anExtPS.SquareDistance( i ) <= TolE)   // V6.5
++       if (anExtPS.SquareDistance( i ) <= TolE * TolE)
+         {
+           aPOnSurf = anExtPS.Point( i );
+           break;
+diff -uwrN netgen-5.3.1/libsrc/occ/Partition_Spliter.cxx 
netgen/libsrc/occ/Partition_Spliter.cxx
+--- netgen-5.3.1/libsrc/occ/Partition_Spliter.cxx      2016-02-20 
21:53:44.420447131 +0100
++++ netgen/libsrc/occ/Partition_Spliter.cxx    2016-02-20 23:54:12.313646166 
+0100
+@@ -1169,8 +1169,10 @@
+           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 -uwrN netgen-5.3.1/libsrc/occ/utilities.h netgen/libsrc/occ/utilities.h
+--- netgen-5.3.1/libsrc/occ/utilities.h        2016-02-20 21:53:44.421447131 
+0100
++++ netgen/libsrc/occ/utilities.h      2016-02-20 23:54:12.314646166 +0100
+@@ -33,6 +33,7 @@
+ 
+ #include <string>
+ #include <iostream>
++#include <iomanip>
+ #include <cstdlib>
+ // #include "SALOME_Log.hxx"
+ 
+diff -uwrN netgen-5.3.1/libsrc/stlgeom/stlgeommesh.cpp 
netgen/libsrc/stlgeom/stlgeommesh.cpp
+--- netgen-5.3.1/libsrc/stlgeom/stlgeommesh.cpp        2016-02-20 
21:55:59.234450844 +0100
++++ netgen/libsrc/stlgeom/stlgeommesh.cpp      2016-02-20 23:54:12.315646166 
+0100
+@@ -1435,7 +1435,8 @@
+         /*
+         if (!optstring || strlen(optstring) == 0)
+           {
+-            mparam.optimize2d = "smcm";
++            //mparam.optimize2d = (char*)"smcm";
++              mparam.optimize2d = (char*)"smcm";
+           }
+         else
+           {
+@@ -1453,7 +1454,7 @@
+             mesh -> LoadLocalMeshSize (mparam.meshsizefilename);            
+             mesh -> CalcLocalHFromSurfaceCurvature (mparam.grading, 
+                                                     
stlparam.resthsurfmeshcurvfac);
+-            mparam.optimize2d = "cmsmSm";
++            mparam.optimize2d = "(char*)cmsmSm";
+             STLSurfaceOptimization (*stlgeometry, *mesh, mparam);
+ #ifdef STAT_STREAM
+             (*statout) << GetTime() << " & ";
+@@ -1560,7 +1561,8 @@
+         /*
+         if (!optstring || strlen(optstring) == 0)
+           {
+-            mparam.optimize3d = "cmdmstm";
++              //mparam.optimize3d = "cmdmstm";
++            mparam.optimize3d = (char*)"cmdmstm";
+           }
+         else
+           {

diff --git a/sci-mathematics/netgen/files/netgen-5.x-includes-fixes.patch 
b/sci-mathematics/netgen/files/netgen-5.x-includes-fixes.patch
new file mode 100644
index 0000000..650b575
--- /dev/null
+++ b/sci-mathematics/netgen/files/netgen-5.x-includes-fixes.patch
@@ -0,0 +1,29 @@
+diff -uwrN -x.git netgen-5.3.1/libsrc/include/meshing.hpp 
netgen/libsrc/include/meshing.hpp
+--- netgen-5.3.1/libsrc/include/meshing.hpp    2016-02-21 20:12:55.885186643 
+0100
++++ netgen/libsrc/include/meshing.hpp  2016-02-21 20:09:26.275180871 +0100
+@@ -1 +1 @@
+-#include <../meshing/meshing.hpp>
++#include "../meshing/meshing.hpp"
+diff -uwrN -x.git netgen-5.3.1/libsrc/include/myadt.hpp 
netgen/libsrc/include/myadt.hpp
+--- netgen-5.3.1/libsrc/include/myadt.hpp      2016-02-21 20:12:55.886186643 
+0100
++++ netgen/libsrc/include/myadt.hpp    2016-02-21 20:09:26.275180871 +0100
+@@ -1 +1 @@
+-#include <../general/myadt.hpp>
++#include "../general/myadt.hpp"
+diff -uwrN -x.git netgen-5.3.1/libsrc/include/stlgeom.hpp 
netgen/libsrc/include/stlgeom.hpp
+--- netgen-5.3.1/libsrc/include/stlgeom.hpp    2016-02-21 20:12:55.886186643 
+0100
++++ netgen/libsrc/include/stlgeom.hpp  2016-02-21 20:09:26.275180871 +0100
+@@ -1 +1 @@
+-#include <../stlgeom/stlgeom.hpp>
++#include "../stlgeom/stlgeom.hpp"
+diff -uwrN -x.git netgen-5.3.1/libsrc/meshing/parallelmesh.cpp 
netgen/libsrc/meshing/parallelmesh.cpp
+--- netgen-5.3.1/libsrc/meshing/parallelmesh.cpp       2016-02-21 
20:12:55.888186643 +0100
++++ netgen/libsrc/meshing/parallelmesh.cpp     2016-02-21 20:09:26.276180871 
+0100
+@@ -1,6 +1,6 @@
+ #ifdef PARALLEL
+ 
+-#include <meshing.hpp>
++#include "meshing.hpp"
+ #include "paralleltop.hpp"
+ 
+ // #define METIS4

diff --git a/sci-mathematics/netgen/files/netgen-5.x-makefiles-fixes.patch 
b/sci-mathematics/netgen/files/netgen-5.x-makefiles-fixes.patch
new file mode 100644
index 0000000..b6c8fd4
--- /dev/null
+++ b/sci-mathematics/netgen/files/netgen-5.x-makefiles-fixes.patch
@@ -0,0 +1,412 @@
+diff -uwrN -x.git netgen-5.3.1/configure.ac netgen/configure.ac
+--- netgen-5.3.1/configure.ac  2016-02-21 21:40:41.852331652 +0100
++++ netgen/configure.ac        2016-02-21 21:39:31.355329711 +0100
+@@ -14,7 +14,6 @@
+ AC_DISABLE_STATIC
+ 
+ AC_LANG([C++])
+-AM_PROG_AR
+ AC_PROG_CXX
+ 
+ AC_OPENMP
+@@ -36,15 +35,15 @@
+         [AC_HELP_STRING([--with-occ=dir],[use OpenCascade installed in 
directory dir])],
+         [occdir=$withval] 
+       [occon=true],
+-      [occdir=/opt/OpenCASCADE]
++      [occdir=$CASROOT]
+         )
+ 
+ 
+ 
+ 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$occdir/inc"])
++      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
+ 
+@@ -90,18 +89,18 @@
+         [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 -uwrN -x.git netgen-5.3.1/libsrc/csg/Makefile.am 
netgen/libsrc/csg/Makefile.am
+--- netgen-5.3.1/libsrc/csg/Makefile.am        2016-02-21 21:40:41.852331652 
+0100
++++ netgen/libsrc/csg/Makefile.am      2016-02-21 21:39:31.355329711 +0100
+@@ -8,24 +8,24 @@
+ 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 -uwrN -x.git netgen-5.3.1/libsrc/general/Makefile.am 
netgen/libsrc/general/Makefile.am
+--- netgen-5.3.1/libsrc/general/Makefile.am    2016-02-21 21:40:41.852331652 
+0100
++++ netgen/libsrc/general/Makefile.am  2016-02-21 21:39:31.356329711 +0100
+@@ -4,8 +4,8 @@
+ 
+ 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 -uwrN -x.git netgen-5.3.1/libsrc/geom2d/Makefile.am 
netgen/libsrc/geom2d/Makefile.am
+--- netgen-5.3.1/libsrc/geom2d/Makefile.am     2016-02-21 21:40:41.852331652 
+0100
++++ netgen/libsrc/geom2d/Makefile.am   2016-02-21 21:39:31.356329711 +0100
+@@ -4,18 +4,18 @@
+ 
+ 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 -uwrN -x.git netgen-5.3.1/libsrc/gprim/Makefile.am 
netgen/libsrc/gprim/Makefile.am
+--- netgen-5.3.1/libsrc/gprim/Makefile.am      2016-02-21 21:40:41.853331652 
+0100
++++ netgen/libsrc/gprim/Makefile.am    2016-02-21 21:39:31.357329711 +0100
+@@ -2,6 +2,6 @@
+ 
+ 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 -uwrN -x.git netgen-5.3.1/libsrc/interface/Makefile.am 
netgen/libsrc/interface/Makefile.am
+--- netgen-5.3.1/libsrc/interface/Makefile.am  2016-02-21 21:40:41.853331652 
+0100
++++ netgen/libsrc/interface/Makefile.am        2016-02-21 21:39:31.357329711 
+0100
+@@ -2,14 +2,14 @@
+ 
+ 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
++libnginterface_la_LIBADD = $(top_builddir)/libsrc/meshing/libngmesh.la
+ 
+ # libinterface_la_LDFLAGS = -rdynamic
+diff -uwrN -x.git netgen-5.3.1/libsrc/linalg/Makefile.am 
netgen/libsrc/linalg/Makefile.am
+--- netgen-5.3.1/libsrc/linalg/Makefile.am     2016-02-21 21:40:41.853331652 
+0100
++++ netgen/libsrc/linalg/Makefile.am   2016-02-21 21:39:31.357329711 +0100
+@@ -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 -uwrN -x.git netgen-5.3.1/libsrc/meshing/Makefile.am 
netgen/libsrc/meshing/Makefile.am
+--- netgen-5.3.1/libsrc/meshing/Makefile.am    2016-02-21 21:40:41.853331652 
+0100
++++ netgen/libsrc/meshing/Makefile.am  2016-02-21 21:39:31.358329711 +0100
+@@ -15,9 +15,9 @@
+ 
+ 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 @@
+       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 -uwrN -x.git netgen-5.3.1/libsrc/occ/Makefile.am 
netgen/libsrc/occ/Makefile.am
+--- netgen-5.3.1/libsrc/occ/Makefile.am        2016-02-21 21:40:41.853331652 
+0100
++++ netgen/libsrc/occ/Makefile.am      2016-02-21 21:39:31.358329711 +0100
+@@ -14,20 +14,20 @@
+ 
+ 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 -uwrN -x.git netgen-5.3.1/libsrc/stlgeom/Makefile.am 
netgen/libsrc/stlgeom/Makefile.am
+--- netgen-5.3.1/libsrc/stlgeom/Makefile.am    2016-02-21 21:40:41.854331653 
+0100
++++ netgen/libsrc/stlgeom/Makefile.am  2016-02-21 21:39:31.359329711 +0100
+@@ -4,18 +4,18 @@
+ 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 -uwrN -x.git netgen-5.3.1/libsrc/visualization/Makefile.am 
netgen/libsrc/visualization/Makefile.am
+--- netgen-5.3.1/libsrc/visualization/Makefile.am      2016-02-21 
21:40:41.854331653 +0100
++++ netgen/libsrc/visualization/Makefile.am    2016-02-21 21:39:31.359329711 
+0100
+@@ -7,11 +7,11 @@
+ 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 -uwrN -x.git netgen-5.3.1/libsrc/visualization/Makefile.in 
netgen/libsrc/visualization/Makefile.in
+--- netgen-5.3.1/libsrc/visualization/Makefile.in      2016-02-21 
21:40:41.855331653 +0100
++++ netgen/libsrc/visualization/Makefile.in    2016-02-21 21:39:31.360329711 
+0100
+@@ -275,7 +275,7 @@
+ visual.hpp vssolution.hpp
+ 
+ include_HEADERS = soldata.hpp
+-AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_srcdir)/libsrc/include  -DOPENGL 
-D$(TOGL_WINDOWINGSYSTEM) $(OCCFLAGS) $(TCL_INCLUDES)
++AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_srcdir)/libsrc/include  -DOPENGL 
$(OCCFLAGS) $(TCL_INCLUDES)
+ METASOURCES = AUTO
+ @NGGUI_TRUE@noinst_LTLIBRARIES = libvisual.la
+ libvisual_la_SOURCES = meshdoc.cpp mvdraw.cpp \
+diff -uwrN -x.git netgen-5.3.1/ng/Makefile.am netgen/ng/Makefile.am
+--- netgen-5.3.1/ng/Makefile.am        2016-02-21 21:40:41.855331653 +0100
++++ netgen/ng/Makefile.am      2016-02-21 21:39:31.360329711 +0100
+@@ -1,6 +1,6 @@
+ include_HEADERS = 
+ 
+-AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include -I$(top_srcdir)/libsrc/interface 
-DOPENGL  -D$(TOGL_WINDOWINGSYSTEM)  $(TCL_INCLUDES) $(MPI_INCLUDES) 
$(FFMPEG_INCLUDES) $(JPEGLIB_INCLUDES) 
++AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include -I$(top_srcdir)/libsrc/interface 
-DOPENGL $(TCL_INCLUDES) $(MPI_INCLUDES) $(FFMPEG_INCLUDES) $(JPEGLIB_INCLUDES) 
+ 
+ 
+ if NGGUI
+@@ -17,21 +17,18 @@
+ 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 -uwrN -x.git netgen-5.3.1/ng/Makefile.in netgen/ng/Makefile.in
+--- netgen-5.3.1/ng/Makefile.in        2016-02-21 21:40:41.856331653 +0100
++++ netgen/ng/Makefile.in      2016-02-21 21:39:31.361329711 +0100
+@@ -302,7 +302,7 @@
+ include_HEADERS = 
+ AM_CPPFLAGS = -I$(top_srcdir)/libsrc/include \
+       -I$(top_srcdir)/libsrc/interface -DOPENGL \
+-      -D$(TOGL_WINDOWINGSYSTEM) $(TCL_INCLUDES) $(MPI_INCLUDES) \
++      $(TCL_INCLUDES) $(MPI_INCLUDES) \
+       $(FFMPEG_INCLUDES) $(JPEGLIB_INCLUDES) $(am__append_1)
+ netgen_SOURCES = demoview.cpp ngappinit.cpp onetcl.cpp parallelfunc.cpp 
ngpkg.cpp demoview.hpp parallelfunc.hpp togl_1_7.h
+ @NGMKL_TRUE@MKL_LIBS = -L$(MKLROOT)/lib/intel64  -lmkl_intel_lp64 
-lmkl_gnu_thread -lmkl_core -lmkl_def
+diff -uwrN -x.git netgen-5.3.1/nglib/Makefile.am netgen/nglib/Makefile.am
+--- netgen-5.3.1/nglib/Makefile.am     2016-02-21 21:40:41.856331653 +0100
++++ netgen/nglib/Makefile.am   2016-02-21 21:39:31.362329711 +0100
+@@ -8,15 +8,15 @@
+ 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 = -release $(PACKAGE_VERSION)
+ #  -rdynamic
+ 
+ 
+@@ -25,24 +25,24 @@
+ 
+ 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/sci-mathematics/netgen/files/netgen-5.x-metis-fixes.patch 
b/sci-mathematics/netgen/files/netgen-5.x-metis-fixes.patch
new file mode 100644
index 0000000..cf59613
--- /dev/null
+++ b/sci-mathematics/netgen/files/netgen-5.x-metis-fixes.patch
@@ -0,0 +1,102 @@
+--- netgen-5.3.1.ORIG/libsrc/meshing/parallelmesh.cpp  2014-08-29 
11:54:05.000000000 +0200
++++ netgen/libsrc/meshing/parallelmesh.cpp     2016-02-20 23:07:00.350568182 
+0100
+@@ -14,7 +14,7 @@
+ 
+ #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 @@
+     eptr.Append (eind.Size());
+     Array<idx_t> 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 @@
+     eptr.Append (eind.Size());
+     Array<idx_t> 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 @@
+ 
+     for ( int vert = 0; vert < nn; vert++ )
+       {
+-      FlatArray<int> array ( cnt[vert], &adjacency[ xadj[vert] ] );
++      FlatArray<metis::idx_t> array ( cnt[vert], &adjacency[ xadj[vert] ] );
+       BubbleSort(array);
+       }
+ 
+@@ -1318,7 +1318,7 @@
+     idxtype  *xadj, * adjacency, *v_weights = NULL, *e_weights = NULL;
+ 
+     int weightflag = 0;
+-    // int numflag = 0;
++    int numflag = 0;
+     int nparts = ntasks - 1;
+ 
+     int options[5];
+@@ -1377,7 +1377,7 @@
+ 
+     for ( int el = 0; el < ne; el++ )
+       {
+-      FlatArray<int> array ( cnt[el], &adjacency[ xadj[el] ] );
++      FlatArray<metis::idx_t> array ( cnt[el], &adjacency[ xadj[el] ] );
+       BubbleSort(array);
+       }
+ 
+@@ -1428,8 +1428,8 @@
+   void Mesh :: PartDualHybridMesh2D ( ) 
+   {
+ #ifdef METIS
+-    int ne = GetNSE();
+-    int nv = GetNV();
++    metis::idx_t ne = GetNSE();
++    metis::idx_t nv = GetNV();
+ 
+     Array<idxtype> xadj(ne+1);
+     Array<idxtype> adjacency(ne*4);
+@@ -1484,18 +1484,18 @@
+ 
+     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<idxtype> 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/sci-mathematics/netgen/files/netgen-5.x-missing-define.patch 
b/sci-mathematics/netgen/files/netgen-5.x-missing-define.patch
new file mode 100644
index 0000000..d9d8f99
--- /dev/null
+++ b/sci-mathematics/netgen/files/netgen-5.x-missing-define.patch
@@ -0,0 +1,38 @@
+--- a/libsrc/occ/Partition_Loop2d.cxx  2012-11-14 21:16:22.876287910 +0100
++++ b/libsrc/occ/Partition_Loop2d.cxx  2012-11-14 21:22:30.909650554 +0100
+@@ -13,6 +13,7 @@
+ 
+ //using namespace std;
+ #include <climits>
++#include <cmath>
+ #include "Partition_Loop2d.ixx"
+ 
+ #include "utilities.h"
+@@ -210,7 +211,7 @@
+     Cc->D1(uc, PC, CTg1);
+     if (!isForward) CTg1.Reverse();
+ 
+-    Standard_Real anglemin = 3 * PI, tolAng = 1.e-8;
++    Standard_Real anglemin = 3 * M_PI, tolAng = 1.e-8;
+ 
+     // select an edge whose first derivative is most left of CTg1
+     // ie an angle between Tg1 and CTg1 is least
+@@ -234,7 +235,7 @@
+       // -PI < angle < PI
+       Standard_Real angle = Tg1.Angle(CTg1);
+ 
+-      if (PI - Abs(angle) <= tolAng)
++      if (M_PI - Abs(angle) <= tolAng)
+       {
+         // an angle is too close to PI; assure that an angle sign really
+         // reflects an edge position: +PI - an edge is worst,
+--- a/configure.ac     2012-11-15 14:55:45.048938870 +0100
++++ b/configure.ac     2012-11-15 14:55:12.545923777 +0100
+@@ -14,6 +14,7 @@
+ AC_DISABLE_STATIC
+ 
+ AC_LANG([C++])
++AM_PROG_AR
+ AC_PROG_CXX
+ AC_PROG_LIBTOOL
+ LT_INIT

diff --git a/sci-mathematics/netgen/files/netgen-5.x-occ-stl-api-change.patch 
b/sci-mathematics/netgen/files/netgen-5.x-occ-stl-api-change.patch
new file mode 100644
index 0000000..0452d6b
--- /dev/null
+++ b/sci-mathematics/netgen/files/netgen-5.x-occ-stl-api-change.patch
@@ -0,0 +1,94 @@
+--- a/libsrc/occ/occgeom.cpp   2014-08-29 11:54:03.000000000 +0200
++++ b/libsrc/occ/occgeom.cpp   2016-02-12 21:14:49.258982206 +0100
+@@ -149,7 +149,7 @@
+ 
+          for (exp0.Init (shape, TopAbs_FACE); exp0.More(); exp0.Next())
+          {
+-            // Variable to hold the colour (if there exists one) of 
++            // Variable to hold the colour (if there exists one) of
+             // the current face being processed
+             Quantity_Color face_colour;
+ 
+@@ -190,7 +190,7 @@
+                rebuild->Replace(face, newface, Standard_False);
+             }
+ 
+-            // Set the original colour of the face to the newly created 
++            // Set the original colour of the face to the newly created
+             // face (after the healing process)
+             face = TopoDS::Face (exp0.Current());
+             face_colours->SetColor(face,face_colour,XCAFDoc_ColorSurf);
+@@ -815,11 +815,11 @@
+       face_maxh.SetSize (fmap.Extent());
+       face_maxh = mparam.maxh;
+ 
+-      // Philippose - 15/01/2010      
+-      face_maxh_modified.DeleteAll();      
+-      face_maxh_modified.SetSize(fmap.Extent());      
++      // Philippose - 15/01/2010
++      face_maxh_modified.DeleteAll();
++      face_maxh_modified.SetSize(fmap.Extent());
+       face_maxh_modified = 0;
+-      
++
+ 
+       // Philippose - 17/01/2009
+       face_sel_status.DeleteAll();
+@@ -845,7 +845,7 @@
+       cout << "Trying to sew faces ..." << flush;
+ 
+       BRepOffsetAPI_Sewing sewedObj(1);
+- 
++
+       for (int i = 1; i <= fmap.Extent(); i++)
+       {
+          TopoDS_Face face = TopoDS::Face (fmap(i));
+@@ -1038,9 +1038,6 @@
+    {
+       cout << "writing stl..."; cout.flush();
+       StlAPI_Writer writer;
+-      writer.RelativeMode() = Standard_False;
+-
+-      writer.SetDeflection(0.02);
+       writer.Write(shape,filename);
+ 
+       cout << "done" << endl;
+@@ -1109,7 +1106,7 @@
+       }
+ 
+ 
+-      // For the IGES Reader, all the shapes can be exported as one compund 
shape 
++      // For the IGES Reader, all the shapes can be exported as one compund 
shape
+       // using the "OneShape" member
+       occgeo->shape = reader.OneShape();
+       occgeo->face_colours = iges_colour_contents;
+@@ -1187,7 +1184,7 @@
+       }
+ 
+ 
+-      // For the STEP File Reader in OCC, the 1st Shape contains the entire 
++      // For the STEP File Reader in OCC, the 1st Shape contains the entire
+       // compound geometry as one shape
+       occgeo->shape = step_shape_contents->GetShape(step_shapes.Value(1));
+       occgeo->face_colours = step_colour_contents;
+@@ -1218,7 +1215,7 @@
+       }
+ 
+       // Philippose - 23/02/2009
+-      // Fixed a bug in the OpenCascade XDE Colour handling when 
++      // Fixed a bug in the OpenCascade XDE Colour handling when
+       // opening BREP Files, since BREP Files have no colour data.
+       // Hence, the face_colours Handle needs to be created as a NULL handle.
+       occgeo->face_colours = Handle_XCAFDoc_ColorTool();
+@@ -1236,9 +1233,9 @@
+   void OCCGeometry :: Save (string sfilename) const
+   {
+     const char * filename = sfilename.c_str();
+-    if (strlen(filename) < 4) 
++    if (strlen(filename) < 4)
+       throw NgException ("illegal filename");
+-    
++
+     if (strcmp (&filename[strlen(filename)-3], "igs") == 0)
+       {
+       IGESControl_Writer writer("millimeters", 1);

diff --git a/sci-mathematics/netgen/files/netgen-5.x-parallelmetis4-fix.patch 
b/sci-mathematics/netgen/files/netgen-5.x-parallelmetis4-fix.patch
new file mode 100644
index 0000000..0170fb8
--- /dev/null
+++ b/sci-mathematics/netgen/files/netgen-5.x-parallelmetis4-fix.patch
@@ -0,0 +1,36 @@
+diff -uwrN -x.git netgen-5.3.1/libsrc/meshing/parallelmesh.cpp 
netgen/libsrc/meshing/parallelmesh.cpp
+--- netgen-5.3.1/libsrc/meshing/parallelmesh.cpp       2016-02-22 
00:22:28.885598956 +0100
++++ netgen/libsrc/meshing/parallelmesh.cpp     2016-02-22 00:46:17.030638283 
+0100
+@@ -962,10 +962,15 @@
+   }
+   
+ 
+-#ifdef METIS5
++#ifdef METIS
+   void Mesh :: ParallelMetis (Array<int> & volume_weights , Array<int> & 
surface_weights, Array<int> & segment_weights)  
+   {
++
++      #ifdef METIS5
+     PrintMessage (3, "call metis 5 with weights ...");
++    #else
++    PrintMessage (3, "call metis 4 with weights ...");
++    #endif
+     
+     // cout << "segment_weights " << segment_weights << endl;
+     // cout << "surface_weights " << surface_weights << endl;
+@@ -1034,9 +1039,15 @@
+ 
+ 
+     metis::idx_t ncommon = 3;
++    #ifdef METIS5
+     METIS_PartMeshDual (&ne, &nn, &eptr[0], &eind[0], &nwgt[0], NULL, 
&ncommon, &nparts,
+                       NULL, NULL,
+                       &edgecut, &epart[0], &npart[0]);
++    #else
++    int numflag = 0;
++    METIS_PartMeshDual (&ne, &nn, &eptr[0], &eind[0], &numflag, &nparts,
++      &edgecut, &epart[0], &npart[0]);
++    #endif
+     /*
+     METIS_PartMeshNodal (&ne, &nn, &eptr[0], &eind[0], NULL, NULL, &nparts,
+                        NULL, NULL,

diff --git a/sci-mathematics/netgen/files/netgen.desktop 
b/sci-mathematics/netgen/files/netgen.desktop
new file mode 100644
index 0000000..714ba53
--- /dev/null
+++ b/sci-mathematics/netgen/files/netgen.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=Netgen
+Comment=3D modeling, Mesh generation.
+Exec=/usr/bin/netgen
+Icon=netgen
+Terminal=false
+Type=Application
+Categories=Graphics;

diff --git a/sci-mathematics/netgen/files/netgen.png 
b/sci-mathematics/netgen/files/netgen.png
new file mode 100644
index 0000000..cb2fd84
Binary files /dev/null and b/sci-mathematics/netgen/files/netgen.png differ

diff --git a/sci-mathematics/netgen/metadata.xml 
b/sci-mathematics/netgen/metadata.xml
new file mode 100644
index 0000000..7811ed6
--- /dev/null
+++ b/sci-mathematics/netgen/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+  <maintainer type="project">
+    <email>[email protected]</email>
+    <name>Gentoo Mathematics Project</name>
+  </maintainer>
+  <use>
+    <flag name="opencascade"> Enable OpenCASCADE support</flag>
+  </use>
+  <upstream>
+    <remote-id type="sourceforge">netgen-mesher</remote-id>
+  </upstream>
+</pkgmetadata>

diff --git a/sci-mathematics/netgen/netgen-5.3.1-r1.ebuild 
b/sci-mathematics/netgen/netgen-5.3.1-r1.ebuild
new file mode 100644
index 0000000..9ca14d2
--- /dev/null
+++ b/sci-mathematics/netgen/netgen-5.3.1-r1.ebuild
@@ -0,0 +1,126 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+inherit autotools eutils flag-o-matic multilib versionator
+
+MY_PN=${PN}-mesher
+MY_PV=$(get_version_component_range 1-2)
+DESCRIPTION="Automatic 3d tetrahedral mesh generator"
+HOMEPAGE="http://www.hpfem.jku.at/netgen/";
+SRC_URI="mirror://sourceforge/project/${MY_PN}/${MY_PN}/${MY_PV}/${P}.tar.gz"
+
+SLOT="0"
+LICENSE="LGPL-2.1"
+KEYWORDS="~amd64 ~x86"
+IUSE="-ffmpeg jpeg -mpi opencascade openmp source"
+
+DEPEND="
+       dev-lang/tcl:0
+       dev-lang/tk:0
+       dev-tcltk/tix
+       dev-tcltk/togl:1.7
+       virtual/opengl
+       x11-libs/libX11
+       x11-libs/libXmu
+       opencascade? ( sci-libs/opencascade:* )
+       ffmpeg? ( media-video/ffmpeg )
+       jpeg? ( virtual/jpeg:0= )
+       mpi? ( virtual/mpi || ( sci-libs/parmetis <sci-libs/metis-5.0 ) 
opencascade? ( sci-libs/hdf5[mpi] ) ) "
+RDEPEND="${DEPEND}"
+# Note, MPI has not be tested.
+
+PATCHES=(
+       # Adapted from 
http://sourceforge.net/projects/netgen-mesher/forums/forum/905307/topic/5422824
+       "${FILESDIR}"/${PN}-5.x-missing-define.patch
+       # Adapted from 
http://pkgs.fedoraproject.org/cgit/rpms/netgen-mesher.git/tree/netgen-5.3.0_metis.patch
+       "${FILESDIR}"/${PN}-5.x-metis-fixes.patch
+       "${FILESDIR}"/${PN}-5.x-occ-stl-api-change.patch
+       # Adapted from 
http://pkgs.fedoraproject.org/cgit/rpms/netgen-mesher.git/tree/netgen-5.3.1_build.patch
+       "${FILESDIR}"/${PN}-5.x-makefiles-fixes.patch
+       # Adapted from 
http://pkgs.fedoraproject.org/cgit/rpms/netgen-mesher.git/tree/netgen-5.3.0_fixes.patch
+       "${FILESDIR}"/${PN}-5.x-fedora-fixes.patch
+       "${FILESDIR}"/${PN}-5.x-includes-fixes.patch
+       "${FILESDIR}"/${PN}-5.x-parallelmetis4-fix.patch
+)
+
+src_prepare() {
+       default
+       if use mpi; then
+               export CC=mpicc
+               export CXX=mpic++
+               export FC=mpif90
+               export F90=mpif90
+               export F77=mpif77
+       fi
+       eautoreconf
+}
+
+src_configure() {
+       # This is not the most clever way to deal with these flags
+       # but --disable-xxx does not seem to work correcly, so...
+       local myconf=( --with-togl=/usr/$(get_libdir)/Togl1.7 )
+
+       myconf+=( $(use_enable openmp) )
+
+       if use opencascade; then
+               myconf+=( --enable-occ --with-occ=$CASROOT )
+               append-ldflags -L$CASROOT/$(get_libdir)
+       fi
+       if use mpi; then
+               ewarn 
"*************************************************************************"
+               ewarn ""
+               ewarn "MPI has not been tested, you should probably deactivate 
the mpi use flag"
+               ewarn ""
+               ewarn 
"*************************************************************************"
+               myconf+=( --enable-parallel )
+               append-cppflags -I/usr/include/metis
+               append-ldflags -L/usr/$(get_libdir)/openmpi/
+       fi
+       use ffmpeg && myconf+=( --enable-ffmpeg )
+       use jpeg && myconf+=( --enable-jpeglib )
+       append-cppflags -I/usr/include/togl-1.7
+
+       econf \
+               ${myconf[@]}
+
+       # This would be the more elegant way:
+#      econf \
+#              $(use_enable opencascade occ) \
+#              $(use_with opencascade "occ=$CASROOT") \
+#              $(use_enable mpi parallel) \
+#              $(use_enable ffmpeg) \
+#              $(use_enable jpeg jpeglib)
+}
+
+src_install() {
+       local NETGENDIR="/usr/share/netgen"
+
+       echo -e "NETGENDIR=${NETGENDIR} \nLDPATH=/usr/$(get_libdir)/Togl1.7" > 
./99netgen
+       doenvd 99netgen
+
+       default
+       mv "${D}"/usr/bin/{*.tcl,*.ocf} "${D}${NETGENDIR}" || die
+
+       # Install icon and .desktop for menu entry
+       doicon "${FILESDIR}"/${PN}.png
+       domenu "${FILESDIR}"/${PN}.desktop
+
+       prune_libtool_files
+
+       if use source ; then
+               emake clean
+               insinto "${NETGENDIR}"
+               doins -r libsrc
+       fi
+}
+
+pkg_postinst() {
+       elog "Please make sure to update your environment variables:"
+       elog "env-update && source /etc/profile"
+       elog "Netgen ebuild is still under development."
+       elog "Help us improve the ebuild in:"
+       elog "http://bugs.gentoo.org/show_bug.cgi?id=155424";
+}

Reply via email to