Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Home

Joachim Schoeberl

NETGEN is an automatic 3d tetrahedral mesh generator. It accepts input from constructive solid geometry (CSG) or boundary representation (BRep) from STL file format. The connection to a geometry kernel allows the handling of IGES and STEP files. NETGEN contains modules for mesh optimization and hierarchical mesh refinement. Netgen is open source based on the LGPL license. It is available for Unix/Linux and Windows.

Screenshot thumbnail
Netgen mesh generated from STEP geometry import
Screenshot thumbnail
Simple transformer built with Netgen CSG modeler


Project Members:


  • Leyli Cecil
    Leyli Cecil
    2015-04-11

    The wiki is currently not user-editable, which rather defeats the purpose of having a wiki in the first place. Closed wikis run counter to the collaborative spirit enshrined in wiki culture.

    Consider opening the wiki to anonymous edits. Also consider migrating to Github, whose UI and workflow is somewhat less cluttered than that of SourceForge. Until then, I'll just leave this here.

    Compilation

    Largely thanks to an Autotools-based makefile, it is feasible but highly non-trivial to compile Netgen on your own. This is complicated by the need to explicitly specify the absolute paths of dependency directories, as detailed below.

    Ubuntu

    As of this writing (mid-2015), the version of Netgen officially provided by Ubuntu is painfully out of date (4.9.13). Since there sadly exists no PPA unofficially providing a more recent version, Ubuntu users are encouraged to manually compile Netgen. In order:

    • Install METIS, OpenMPI, and Togl, including development headers for the latter two.
      sudo apt-get install metis openmpi-bin libopenmpi-dev libtogl-dev
    • Download the newest stable release of Netgen.
    • Open a terminal window.
    • Change to the directory containing the downloaded tarball: e.g.,
      cd ~/Downloads
    • Extract that tarball into the current directory.
      tar -xvzf netgen-*.tar.gz
    • Remove that tarball.
      rm netgen-*.tar.gz
    • Change to the newly extracted directory.
      cd netgen-*
    • Add OpenMPI's headers directory to the ${CPPFLAGS} variable.
      CPPFLAGS="-I/usr/lib/openmpi/include/"
      export CPPFLAGS
    • Configure Netgen. To support Elmer and other high-level FEM frameworks, enable installation of the nglib.so shared library. (You want this.)
      ./configure --with-sysroot=/usr/lib/ --with-tcl=/usr/lib/tcl8.5/ --with-tk=/usr/lib/tk8.5/ --with-togl=/usr/lib/ --with-metis=/usr/lib/x86_64-linux-gnu/ --enable-nglib
    • Compile Netgen.
      make
    • Install Netgen.
      sudo make install
    • Add the following lines to your user-specific ~/.profile shell startup script.
      LD_LIBRARY_PATH=/opt/netgen/lib
      NETGENDIR=/opt/netgen/bin
      PATH="${PATH}:${NETGENDIR}"
      export LD_LIBRARY_PATH
      export NETGENDIR
      export PATH
    • If ~/.profile does not already exist, create such file and ensure that your preferred shell sources such file. For example, under zsh, add the following line to your user-specific ~/.zshrc shell script:
      source "${HOME}/.profile"
    • Source the newly modified ~/.profile.
      source ~/.profile
    • Run Netgen.
      netgen &!

    Ignored configure Options

    Attempting to enable the --enable-jpeglib option induces the following error from ./configure and has thus been omitted above:

    OCCFLAGS = -DOCCGEOMETRY -I/usr/share/oce-0.15/inc -I/usr/include/opencascade -D_OCC64 -DHAVE_IOSTREAM -DHAVE_LIMITS -DHAVE_LIMITS_H -DHAVE_IOMANIP
    OCCLIBS = -L/usr/share/oce-0.15/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
    checking for jpeg_start_compress in -ljpeg... no
    configure: error: no usable library libjpeg found
    

    Likewise, attempting to enable the --enable-occ option induces the following error from make and has thus been omitted above:

    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../.. -I../../libsrc/include -DOCCGEOMETRY -I/usr/share/oce-0.15/inc -I/usr/include/opencascade -D_OCC64 -DHAVE_IOSTREAM -DHAVE_LIMITS -DHAVE_LIMITS_H -DHAVE_IOMANIP -I/usr/include/tcl8.5 -I/usr/include/oce/ -I/usr/lib/openmpi/include/ -g -O2 -fopenmp -DPARALLEL -MT Partition_Loop2d.lo -MD -MP -MF .deps/Partition_Loop2d.Tpo -c Partition_Loop2d.cxx  -fPIC -DPIC -o .libs/Partition_Loop2d.o
    Partition_Loop2d.cxx: In function 'Standard_Boolean SelectEdge(const BRepAdaptor_Surface&, const TopoDS_Edge&, const TopoDS_Vertex&, TopoDS_Edge&, const TopTools_ListOfShape&)':
    Partition_Loop2d.cxx:213:34: error: 'PI' was not declared in this scope
         Standard_Real anglemin = 3 * PI, tolAng = 1.e-8;
                                      ^
    Partition_Loop2d.cxx:237:30: error: 'tolAng' was not declared in this scope
           if (PI - Abs(angle) <= tolAng)
                                  ^
    Partition_Loop2d.cxx:254:63: error: 'tolAng' was not declared in this scope
           Standard_Boolean isClose = ( Abs( angle - anglemin ) <= tolAng );
                                                                   ^
    Makefile:427: recipe for target 'Partition_Loop2d.lo' failed
    make[3]: *** [Partition_Loop2d.lo] Error 1
    make[3]: Leaving directory '/home/pietakio/tmp/netgen-5.3.1/libsrc/occ'
    Makefile:311: recipe for target 'all-recursive' failed
    make[2]: *** [all-recursive] Error 1
    make[2]: Leaving directory '/home/pietakio/tmp/netgen-5.3.1/libsrc'
    Makefile:354: recipe for target 'all-recursive' failed
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory '/home/pietakio/tmp/netgen-5.3.1'
    Makefile:285: recipe for target 'all' failed
    make: *** [all] Error 2
    

    Likewise, attempting to enable the --enable-ffmpeg option induces the following error from make and has thus been omitted above:

    Making all in ng
    make[2]: Entering directory '/home/pietakio/tmp/netgen-5.3.1/ng'
    g++ -DHAVE_CONFIG_H -I. -I..  -I../libsrc/include -I../libsrc/interface -DOPENGL -DTOGL_X11 -I"/usr/include/tcl8.5"  -DFFMPEG -D__STDC_CONSTANT_MACROS   -I/usr/include/oce/ -I/usr/lib/openmpi/include/  -g -O2 -fopenmp -MT ngpkg.o -MD -MP -MF .deps/ngpkg.Tpo -c -o ngpkg.o ngpkg.cpp
    ngpkg.cpp:60:32: fatal error: libavcodec/avcodec.h: No such file or directory
     #include <libavcodec/avcodec.h>
                                    ^
    compilation terminated.
    Makefile:462: recipe for target 'ngpkg.o' failed
    make[2]: *** [ngpkg.o] Error 1
    make[2]: Leaving directory '/home/pietakio/tmp/netgen-5.3.1/ng'
    Makefile:354: recipe for target 'all-recursive' failed
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory '/home/pietakio/tmp/netgen-5.3.1'
    Makefile:285: recipe for target 'all' failed
    make: *** [all] Error 2
    

    The latter error is probably correctable by installing all libav development headers (e.g., libavcodec-dev).

     
    Last edit: Leyli Cecil 2015-04-11