├── NEWS ├── TODO ├── ChangeLog ├── ci └── conda │ ├── run_test.sh │ ├── build.sh │ ├── bld.bat │ └── meta.yaml ├── external_dependencies └── .gitignore ├── libsrc ├── include │ ├── csg.hpp │ ├── gprim.hpp │ ├── opti.hpp │ ├── linalg.hpp │ ├── myadt.hpp │ ├── occgeom.hpp │ ├── meshing.hpp │ ├── parallel.hpp │ ├── stlgeom.hpp │ ├── visual.hpp │ ├── geometry2d.hpp │ ├── acisgeom.hpp │ ├── incvis.hpp │ ├── inctcl.hpp │ ├── CMakeLists.txt │ ├── mystdlib.h │ ├── mydefs.hpp │ ├── incopengl.hpp │ └── parallelinterface.hpp ├── linalg │ ├── opti.hpp │ ├── CMakeLists.txt │ ├── linalg.hpp │ ├── polynomial.hpp │ └── linopt.cpp ├── csg │ ├── manifold.cpp │ ├── geoml.hpp │ ├── manifold.hpp │ ├── vscsg.hpp │ ├── triapprox.cpp │ ├── csg.hpp │ ├── CMakeLists.txt │ ├── curve2d.hpp │ ├── splinesurface.hpp~ │ ├── curve2d.cpp │ ├── gencyl.hpp │ ├── splinesurface.cpp │ └── triapprox.hpp ├── occ │ ├── Partition_Loop2d.ixx │ ├── Partition_Loop3d.ixx │ ├── Partition_Loop2d.jxx │ ├── CMakeLists.txt │ ├── Partition_Loop3d.jxx │ ├── vsocc.hpp │ ├── Partition_Loop.ixx │ ├── Partition_Inter3d.ixx │ ├── Partition_Spliter.ixx │ ├── Partition_Inter2d.ixx │ ├── Partition_Spliter.jxx │ ├── Partition_Loop.jxx │ ├── Partition_Inter2d.jxx │ └── Partition_Inter3d.jxx ├── meshing │ ├── specials.hpp │ ├── boundarylayer.hpp │ ├── validate.hpp │ ├── meshfunc.hpp │ ├── clusters.hpp │ ├── meshing.hpp │ ├── basegeom.cpp │ ├── meshfunc2d.cpp │ ├── global.hpp │ ├── basegeom.hpp │ └── CMakeLists.txt ├── CMakeLists.txt ├── visualization │ ├── visual_dummy.cpp │ ├── visual.hpp │ ├── CMakeLists.txt │ └── meshdoc.hpp ├── gprim │ ├── CMakeLists.txt │ ├── gprim.hpp │ └── splinegeometry.hpp ├── geom2d │ ├── CMakeLists.txt │ ├── vsgeom2d.hpp │ ├── geom2dpkg.cpp │ └── geom2dmesh.hpp ├── general │ ├── ngexception.cpp │ ├── parthreads.cpp │ ├── CMakeLists.txt │ ├── ngexception.hpp │ ├── autoptr.hpp │ ├── seti.hpp │ ├── sort.hpp │ ├── symbolta.cpp │ ├── seti.cpp │ ├── myadt.hpp │ ├── optmem.hpp │ ├── mpi_interface.cpp │ ├── spbita2d.hpp │ ├── ngpython.hpp │ ├── profiler.hpp │ ├── array.cpp │ └── sort.cpp ├── stlgeom │ ├── CMakeLists.txt │ ├── python_stl.cpp │ └── vsstl.hpp └── interface │ ├── CMakeLists.txt │ └── writedolfin.cpp ├── python ├── meshing.py ├── shaft.vol.gz ├── CMakeLists.txt ├── stl.py ├── __init__.py ├── gengeom.py ├── gengeom_curve.py ├── csg.py └── geom2d.py ├── AUTHORS ├── doc ├── ng4.pdf ├── CMakeLists.txt └── pictures │ ├── menufile.jpg │ ├── menumesh.jpg │ ├── menuview.jpg │ ├── main_window.jpg │ ├── menu_file.jpg │ ├── menu_help.jpg │ ├── menu_mesh.jpg │ ├── menu_solve.jpg │ ├── menu_view.jpg │ ├── screenshot.jpg │ ├── clippingplane.jpg │ ├── menu_geometry.jpg │ ├── menu_special.jpg │ ├── menugeometry.jpg │ ├── solutiondata.jpg │ ├── MeshingOptions1.jpg │ ├── menu_refinement.jpg │ ├── menurefinement.jpg │ ├── meshingoptions_1.jpg │ ├── meshingoptions_2.jpg │ ├── meshingoptions_3.jpg │ ├── meshingoptions_4.jpg │ ├── meshingoptions_5.jpg │ ├── meshingoptions_6.jpg │ ├── topologyexplorer.jpg │ ├── viewingoptions_1.jpg │ ├── viewingoptions_2.jpg │ ├── viewingoptions_3.jpg │ ├── viewingoptions_4.jpg │ ├── viewingoptions_5.jpg │ └── viewingoptions_6.jpg ├── netgen.icns ├── ng ├── Togl2.1 │ ├── ben.rgb │ ├── tree2.rgba │ ├── doc │ │ ├── README.txt │ │ └── header.js │ ├── pkgIndex.tcl.in │ ├── togl_ws.h.in │ ├── Xmu │ │ └── README.togl │ ├── image.h │ ├── overlay.tcl │ ├── README.stubs │ ├── toglStubLib.c │ ├── index.tcl │ ├── LICENSE │ ├── toglProcAddr.c │ ├── CMakeLists.txt │ └── aclocal.m4 ├── Togl-1.7 │ ├── ben.rgb │ ├── tree2.rgba │ ├── pkgIndex.tcl.in │ ├── togl_ws.h.in │ ├── aclocal.m4 │ ├── image.h │ ├── TODO │ ├── tclconfig │ │ └── README.txt │ ├── tkMacOSX.h │ ├── README.stubs │ ├── overlay.tcl │ ├── index.tcl │ ├── LICENSE │ └── .indent.pro ├── parallelfunc.hpp ├── acisgeom.tcl ├── netgen.ocf ├── stlgeom.tcl ├── onetcl.py ├── netgenpy.cpp ├── parameters.tcl └── CMakeLists.txt ├── windows ├── netgen.ico ├── CMakeLists.txt └── resource.h ├── config.h.cmake ├── tutorials ├── sphere.geo ├── torus.geo ├── ellipsoid.geo ├── ortho.geo ├── shell.geo ├── ellipticcyl.geo ├── cylinder.geo ├── cylsphere.geo ├── revolution.geo ├── cone.geo ├── cube.geo ├── twocyl.geo ├── sculpture.geo ├── boundarycondition.geo ├── cubemsphere.geo ├── cubemcyl.geo ├── sphereincube.geo ├── twobricks.geo ├── twocubes.geo ├── lshape3d.geo ├── test.dem ├── manyholes.geo ├── cubeandspheres.geo ├── manyholes2.geo ├── circle_on_cube.geo ├── boxcyl.geo ├── fichera.geo ├── CMakeLists.txt ├── period.geo ├── matrix.geo ├── square.in2d ├── cubeandring.geo ├── squarecircle.in2d ├── squarehole.in2d ├── extrusion.geo ├── lense.in2d └── trafo.geo ├── tests ├── build.sh ├── docker_15.10 └── docker_16.04 ├── .gitmodules ├── py_tutorials ├── CMakeLists.txt ├── mesh.py ├── cube.geo ├── exportNeutral.py ├── opengl_thread.py ├── merge.py ├── opengl.py └── csg_first_example.py ├── nglib ├── netgen.py ├── cube.surf ├── CMakeLists.txt └── ng_vol.cpp ├── cmake_modules ├── NetgenConfig.cmake.in ├── mic.cmake ├── check_submodules.cmake ├── cmake_uninstall.cmake.in ├── tkdnd_macosx.patch └── netgen_fixup.cmake ├── README.md └── rules └── makerlsfile.cpp /NEWS: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ci/conda/run_test.sh: -------------------------------------------------------------------------------- 1 | # Test step 2 | -------------------------------------------------------------------------------- /external_dependencies/.gitignore: -------------------------------------------------------------------------------- 1 | *.tar.gz 2 | -------------------------------------------------------------------------------- /libsrc/include/csg.hpp: -------------------------------------------------------------------------------- 1 | #include "../csg/csg.hpp" 2 | -------------------------------------------------------------------------------- /python/meshing.py: -------------------------------------------------------------------------------- 1 | from libngpy._meshing import * 2 | -------------------------------------------------------------------------------- /libsrc/include/gprim.hpp: -------------------------------------------------------------------------------- 1 | #include "../gprim/gprim.hpp" 2 | -------------------------------------------------------------------------------- /libsrc/include/opti.hpp: -------------------------------------------------------------------------------- 1 | #include "../linalg/opti.hpp" 2 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Joachim Schoeberl 2 | -------------------------------------------------------------------------------- /libsrc/include/linalg.hpp: -------------------------------------------------------------------------------- 1 | #include "../linalg/linalg.hpp" 2 | -------------------------------------------------------------------------------- /libsrc/include/myadt.hpp: -------------------------------------------------------------------------------- 1 | #include <../general/myadt.hpp> 2 | -------------------------------------------------------------------------------- /libsrc/include/occgeom.hpp: -------------------------------------------------------------------------------- 1 | #include "../occ/occgeom.hpp" 2 | -------------------------------------------------------------------------------- /libsrc/include/meshing.hpp: -------------------------------------------------------------------------------- 1 | #include <../meshing/meshing.hpp> 2 | -------------------------------------------------------------------------------- /libsrc/include/parallel.hpp: -------------------------------------------------------------------------------- 1 | #include "../parallel/parallel.hpp" 2 | -------------------------------------------------------------------------------- /libsrc/include/stlgeom.hpp: -------------------------------------------------------------------------------- 1 | #include <../stlgeom/stlgeom.hpp> 2 | -------------------------------------------------------------------------------- /libsrc/include/visual.hpp: -------------------------------------------------------------------------------- 1 | #include "../visualization/visual.hpp" 2 | -------------------------------------------------------------------------------- /libsrc/include/geometry2d.hpp: -------------------------------------------------------------------------------- 1 | #include "../geom2d/geometry2d.hpp" 2 | -------------------------------------------------------------------------------- /doc/ng4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/ng4.pdf -------------------------------------------------------------------------------- /netgen.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/netgen.icns -------------------------------------------------------------------------------- /doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INSTALL(FILES ng4.pdf DESTINATION doc COMPONENT netgen_doc) 2 | -------------------------------------------------------------------------------- /ng/Togl2.1/ben.rgb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/ng/Togl2.1/ben.rgb -------------------------------------------------------------------------------- /windows/netgen.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/windows/netgen.ico -------------------------------------------------------------------------------- /ng/Togl-1.7/ben.rgb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/ng/Togl-1.7/ben.rgb -------------------------------------------------------------------------------- /python/shaft.vol.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/python/shaft.vol.gz -------------------------------------------------------------------------------- /config.h.cmake: -------------------------------------------------------------------------------- 1 | #cmakedefine HAVE_DLFCN_H 1 2 | #define PACKAGE_VERSION "${NETGEN_VERSION}" 3 | -------------------------------------------------------------------------------- /libsrc/include/acisgeom.hpp: -------------------------------------------------------------------------------- 1 | #ifdef ACIS 2 | #include "../acisgeom/acisgeom.hpp" 3 | #endif 4 | -------------------------------------------------------------------------------- /libsrc/linalg/opti.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/libsrc/linalg/opti.hpp -------------------------------------------------------------------------------- /ng/Togl-1.7/tree2.rgba: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/ng/Togl-1.7/tree2.rgba -------------------------------------------------------------------------------- /ng/Togl2.1/tree2.rgba: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/ng/Togl2.1/tree2.rgba -------------------------------------------------------------------------------- /doc/pictures/menufile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/menufile.jpg -------------------------------------------------------------------------------- /doc/pictures/menumesh.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/menumesh.jpg -------------------------------------------------------------------------------- /doc/pictures/menuview.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/menuview.jpg -------------------------------------------------------------------------------- /doc/pictures/main_window.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/main_window.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_file.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/menu_file.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_help.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/menu_help.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_mesh.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/menu_mesh.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_solve.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/menu_solve.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_view.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/menu_view.jpg -------------------------------------------------------------------------------- /doc/pictures/screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/screenshot.jpg -------------------------------------------------------------------------------- /doc/pictures/clippingplane.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/clippingplane.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_geometry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/menu_geometry.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_special.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/menu_special.jpg -------------------------------------------------------------------------------- /doc/pictures/menugeometry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/menugeometry.jpg -------------------------------------------------------------------------------- /doc/pictures/solutiondata.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/solutiondata.jpg -------------------------------------------------------------------------------- /doc/pictures/MeshingOptions1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/MeshingOptions1.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_refinement.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/menu_refinement.jpg -------------------------------------------------------------------------------- /doc/pictures/menurefinement.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/menurefinement.jpg -------------------------------------------------------------------------------- /doc/pictures/meshingoptions_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/meshingoptions_1.jpg -------------------------------------------------------------------------------- /doc/pictures/meshingoptions_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/meshingoptions_2.jpg -------------------------------------------------------------------------------- /doc/pictures/meshingoptions_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/meshingoptions_3.jpg -------------------------------------------------------------------------------- /doc/pictures/meshingoptions_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/meshingoptions_4.jpg -------------------------------------------------------------------------------- /doc/pictures/meshingoptions_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/meshingoptions_5.jpg -------------------------------------------------------------------------------- /doc/pictures/meshingoptions_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/meshingoptions_6.jpg -------------------------------------------------------------------------------- /doc/pictures/topologyexplorer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/topologyexplorer.jpg -------------------------------------------------------------------------------- /doc/pictures/viewingoptions_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/viewingoptions_1.jpg -------------------------------------------------------------------------------- /doc/pictures/viewingoptions_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/viewingoptions_2.jpg -------------------------------------------------------------------------------- /doc/pictures/viewingoptions_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/viewingoptions_3.jpg -------------------------------------------------------------------------------- /doc/pictures/viewingoptions_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/viewingoptions_4.jpg -------------------------------------------------------------------------------- /doc/pictures/viewingoptions_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/viewingoptions_5.jpg -------------------------------------------------------------------------------- /doc/pictures/viewingoptions_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tpaviot/netgen/master/doc/pictures/viewingoptions_6.jpg -------------------------------------------------------------------------------- /tutorials/sphere.geo: -------------------------------------------------------------------------------- 1 | algebraic3d 2 | 3 | solid main = sphere (0, 0, 0; 1); 4 | 5 | tlo main; 6 | point (0, 0, 0); 7 | 8 | 9 | -------------------------------------------------------------------------------- /tutorials/torus.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## a torus 3 | # 4 | algebraic3d 5 | 6 | solid tor = torus ( 0, 0, 0; 1, 0, 0; 2 ; 1 ); 7 | 8 | tlo tor; 9 | -------------------------------------------------------------------------------- /tests/build.sh: -------------------------------------------------------------------------------- 1 | cd 2 | mkdir -p build/netgen 3 | cd build/netgen 4 | cmake ../../src/netgen -DUSE_CCACHE=ON 5 | make -j12 6 | make install 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external_dependencies/pybind11"] 2 | path = external_dependencies/pybind11 3 | url = https://github.com/pybind/pybind11.git 4 | -------------------------------------------------------------------------------- /libsrc/include/incvis.hpp: -------------------------------------------------------------------------------- 1 | // libraries for User interface: 2 | 3 | nicht mehr verwendet 4 | 5 | #include "inctcl.hpp" 6 | #include "incopengl.hpp" 7 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # dist_noinst_DATA = netgen.sln netgen.vcproj \ 2 | # postBuild_netgen.bat nglib.sln nglib.vcproj \ 3 | # postBuild_nglib.bat netgen.ico netgen.rc 4 | -------------------------------------------------------------------------------- /ng/Togl-1.7/pkgIndex.tcl.in: -------------------------------------------------------------------------------- 1 | # 2 | # Tcl package index file 3 | # 4 | package ifneeded @PACKAGE_NAME@ @PACKAGE_VERSION@ \ 5 | [list load [file join $dir @PKG_LIB_FILE@]] 6 | -------------------------------------------------------------------------------- /ng/Togl2.1/doc/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains the documentation of Togl, the Tk OpenGL widget. 2 | The documentation also doubles as the contents of the Togl home page. 3 | -------------------------------------------------------------------------------- /ng/Togl2.1/pkgIndex.tcl.in: -------------------------------------------------------------------------------- 1 | # 2 | # Tcl package index file 3 | # 4 | package ifneeded @PACKAGE_NAME@ @PACKAGE_VERSION@ \ 5 | [list load [file join $dir @PKG_LIB_FILE@]] 6 | -------------------------------------------------------------------------------- /tutorials/ellipsoid.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## An elliptic cylinder 3 | # 4 | algebraic3d 5 | 6 | solid test = ellipsoid (0, 0, 0; 2, 0, 0; 0, 1, 0; 0, 0, 1) -maxh=0.5; 7 | 8 | tlo test; 9 | -------------------------------------------------------------------------------- /ng/Togl-1.7/togl_ws.h.in: -------------------------------------------------------------------------------- 1 | #ifndef TOGL_WS_H 2 | # define TOGL_WS_H 3 | 4 | /* define windowing system togl is compiled with */ 5 | # define @TOGL_WINDOWINGSYSTEM@ 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /ng/Togl2.1/togl_ws.h.in: -------------------------------------------------------------------------------- 1 | #ifndef TOGL_WS_H 2 | # define TOGL_WS_H 3 | 4 | /* define windowing system togl is compiled with */ 5 | # define @TOGL_WINDOWINGSYSTEM@ 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /libsrc/include/inctcl.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #if TK_MAJOR_VERSION==8 && TK_MINOR_VERSION>=4 5 | #define tcl_const const 6 | #else 7 | #define tcl_const 8 | #endif 9 | -------------------------------------------------------------------------------- /tutorials/ortho.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## A cube 3 | # 4 | algebraic3d 5 | 6 | # cube consisting of 6 planes: 7 | 8 | solid cube = orthobrick (0, 0, 0; 1, 1, 1); 9 | 10 | tlo cube; 11 | 12 | -------------------------------------------------------------------------------- /py_tutorials/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install( FILES 2 | shaft.geo mesh.py exportNeutral.py 3 | DESTINATION share/netgen/py_tutorials 4 | COMPONENT netgen_tutorial 5 | ) 6 | -------------------------------------------------------------------------------- /python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install(FILES __init__.py meshing.py csg.py geom2d.py stl.py 2 | DESTINATION ${PYTHON_PACKAGES_INSTALL_DIR}/netgen 3 | COMPONENT netgen 4 | ) 5 | 6 | -------------------------------------------------------------------------------- /libsrc/csg/manifold.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace netgen 4 | { 5 | Manifold :: Manifold () 6 | { 7 | ; 8 | } 9 | 10 | Manifold :: ~Manifold () 11 | { 12 | ; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ng/Togl-1.7/aclocal.m4: -------------------------------------------------------------------------------- 1 | # 2 | # Include the TEA standard macro set 3 | # 4 | 5 | builtin(include,tclconfig/tcl.m4) 6 | 7 | # 8 | # Add here whatever m4 macros you want to define for your package 9 | # 10 | -------------------------------------------------------------------------------- /ng/Togl2.1/Xmu/README.togl: -------------------------------------------------------------------------------- 1 | The source code in this directory is a subset of the Jun 12, 1995 X11R6 Xmu 2 | library that is needed for the Togl widget. The Xmu library is no longer 3 | installed by default on many Linux systems. 4 | -------------------------------------------------------------------------------- /tutorials/shell.geo: -------------------------------------------------------------------------------- 1 | algebraic3d 2 | 3 | solid main = sphere (0, 0, 0; 1) 4 | and not sphere (0, 0, 0; 0.98); 5 | # or orthobrick (-0.4, -0.4, -0.4; 0.4, 0.4, 0.4); 6 | 7 | tlo main -maxh=0.02; 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /tutorials/ellipticcyl.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## An elliptic cylinder 3 | # 4 | algebraic3d 5 | 6 | solid cutcone = ellipticcylinder ( 0, 0, 0; 1, 0, 0; 0, 0.5, 0) 7 | and plane (0, 0, 0; 0, 0, -1) 8 | and plane (0, 0, 1; 0, 0, 1); 9 | 10 | tlo cutcone; 11 | -------------------------------------------------------------------------------- /tutorials/cylinder.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## a cylinder 3 | # 4 | algebraic3d 5 | 6 | # cut cylinder by planes: 7 | 8 | solid fincyl = cylinder ( 3, 0, 0; -1, 0, 0; 0.5 ) 9 | and plane (0, 0, 0; -1, 0, 0) 10 | and plane (2, 0, 0; 1, 0, 0); 11 | 12 | tlo fincyl; 13 | -------------------------------------------------------------------------------- /libsrc/occ/Partition_Loop2d.ixx: -------------------------------------------------------------------------------- 1 | // GEOM PARTITION : partition algorithm 2 | // 3 | // Copyright (C) 2003 CEA/DEN, EDF R&D 4 | // 5 | // 6 | // 7 | // File : Partition_Loop2d.ixx 8 | // Module : GEOM 9 | 10 | #include "Partition_Loop2d.jxx" 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /libsrc/occ/Partition_Loop3d.ixx: -------------------------------------------------------------------------------- 1 | // GEOM PARTITION : partition algorithm 2 | // 3 | // Copyright (C) 2003 CEA/DEN, EDF R&D 4 | // 5 | // 6 | // 7 | // File : Partition_Loop3d.ixx 8 | // Module : GEOM 9 | 10 | #include "Partition_Loop3d.jxx" 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /tests/docker_15.10: -------------------------------------------------------------------------------- 1 | FROM ubuntu:15.10 2 | MAINTAINER Matthias Hochsteger 3 | RUN apt-get update && apt-get -y install python3 libpython3-dev libxmu-dev libboost-python-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev ccache 4 | ADD . /root/src/netgen 5 | -------------------------------------------------------------------------------- /tests/docker_16.04: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | MAINTAINER Matthias Hochsteger 3 | RUN apt-get update && apt-get -y install python3 libpython3-dev libxmu-dev libboost-python-dev tk-dev tcl-dev cmake git g++ libglu1-mesa-dev ccache 4 | ADD . /root/src/netgen 5 | -------------------------------------------------------------------------------- /tutorials/cylsphere.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## Cylinder and Spehre 3 | # 4 | algebraic3d 5 | solid cyl = cylinder ( 3, 0, 0; -3, 0, 0; 0.5 ) 6 | and plane (-2, 0, 0; -1, 0, 0) 7 | and plane (2, 0, 0; 1, 0, 0); 8 | solid sp = sphere (0, 0, 0; 1); 9 | 10 | solid main = sp or cyl; 11 | 12 | tlo main; 13 | -------------------------------------------------------------------------------- /tutorials/revolution.geo: -------------------------------------------------------------------------------- 1 | algebraic3d 2 | 3 | curve2d testcurve=(7; 4 | 1,0; 5 | 1,1; 6 | 1.5,1.5; 7 | 2,3; 8 | 2.5,1.5; 9 | 3,1; 10 | 3,0; 11 | 3; 12 | 3,1,2,3; 13 | 3,3,4,5; 14 | 3,5,6,7); 15 | 16 | solid something = revolution(0,0,0;1,0,0;testcurve); 17 | 18 | tlo something; -------------------------------------------------------------------------------- /tutorials/cone.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## A cone 3 | # 4 | algebraic3d 5 | 6 | # Cone given by bottom circle and top circle 7 | # and cut by planes: 8 | 9 | solid cutcone = cone ( 0, 0, 0; 1; 3, 0, 0; 0.1 ) 10 | and plane (0, 0, 0; -1, 0, 0) 11 | and plane (3, 0, 0; 1, 0, 0); 12 | 13 | tlo cutcone; 14 | -------------------------------------------------------------------------------- /ng/Togl-1.7/image.h: -------------------------------------------------------------------------------- 1 | /* image.h */ 2 | 3 | #ifndef IMAGE_H 4 | # define IMAGE_H 5 | 6 | typedef struct _TK_RGBImageRec 7 | { 8 | int sizeX, sizeY, sizeZ; 9 | unsigned char *data; 10 | } TK_RGBImageRec; 11 | 12 | extern TK_RGBImageRec *tkRGBImageLoad(char *fileName); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /ci/conda/build.sh: -------------------------------------------------------------------------------- 1 | # Configure step 2 | cmake -G Ninja -DINSTALL_DIR=$PREFIX \ 3 | -DCMAKE_BUILD_TYPE=Release \ 4 | -DCMAKE_PREFIX_PATH=$PREFIX \ 5 | -DCMAKE_SYSTEM_PREFIX_PATH=$PREFIX \ 6 | . 7 | 8 | # Build step 9 | ninja 10 | 11 | # Install step 12 | ninja install 13 | 14 | # test 15 | ninja test -------------------------------------------------------------------------------- /ng/Togl2.1/image.h: -------------------------------------------------------------------------------- 1 | /* image.h */ 2 | 3 | #ifndef IMAGE_H 4 | # define IMAGE_H 5 | 6 | typedef struct _TK_RGBImageRec 7 | { 8 | int sizeX, sizeY, sizeZ; 9 | unsigned char *data; 10 | } TK_RGBImageRec; 11 | 12 | extern TK_RGBImageRec *tkRGBImageLoad(const char *fileName); 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /ng/parallelfunc.hpp: -------------------------------------------------------------------------------- 1 | das braucht keiner mehr 2 | 3 | 4 | 5 | #ifndef FILE_PARALLELFUNC 6 | #define FILE_PARALLELFUNC 7 | 8 | 9 | void ParallelRun(); 10 | 11 | void LoadPDEParallel ( const char* filename ); 12 | 13 | 14 | #ifdef NGSOLVE 15 | // void NGS_ParallelRun ( const string & message); 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /libsrc/meshing/specials.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_SPECIALS 2 | #define FILE_SPECIALS 3 | 4 | /* 5 | 6 | Very special implementations .. 7 | 8 | */ 9 | 10 | 11 | /// 12 | DLL_HEADER extern void CutOffAndCombine (Mesh & mesh, const Mesh & othermesh); 13 | 14 | DLL_HEADER extern void HelmholtzMesh (Mesh & mesh); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /libsrc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(general) 2 | add_subdirectory(gprim) 3 | add_subdirectory(linalg) 4 | add_subdirectory(include) 5 | add_subdirectory(meshing) 6 | # add_subdirectory(visualization) 7 | add_subdirectory(csg) 8 | add_subdirectory(geom2d) 9 | add_subdirectory(occ) 10 | add_subdirectory(stlgeom) 11 | add_subdirectory(interface) 12 | 13 | -------------------------------------------------------------------------------- /nglib/netgen.py: -------------------------------------------------------------------------------- 1 | import sys 2 | try: 3 | # Linux 4 | from libmesh import meshing 5 | from libgeom2d import geom2d 6 | from libcsg import csg 7 | except: 8 | # Windows 9 | from nglib import * 10 | 11 | sys.modules['netgen.meshing'] = meshing 12 | sys.modules['netgen.geom2d'] = geom2d 13 | sys.modules['netgen.csg'] = csg 14 | del sys 15 | 16 | -------------------------------------------------------------------------------- /py_tutorials/mesh.py: -------------------------------------------------------------------------------- 1 | from netgen.meshing import * 2 | from netgen.csg import * 3 | 4 | geo = CSGeometry("shaft.geo") 5 | 6 | param = MeshingParameters() 7 | param.maxh = 10 8 | print (param) 9 | 10 | m1 = GenerateMesh (geo, param) 11 | 12 | 13 | import exportNeutral 14 | exportNeutral.Export (m1, "shaft.mesh") 15 | 16 | 17 | 18 | Save (m1, "mesh.vol", geo) 19 | -------------------------------------------------------------------------------- /cmake_modules/NetgenConfig.cmake.in: -------------------------------------------------------------------------------- 1 | # - Config file for the NETGEN package 2 | # It defines the following variables 3 | # NETGEN_NGLIB_INCLUDE_PATH - include directory for NETGEN 4 | 5 | get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) 6 | 7 | set(PACKAGE_VERSION "@NETGEN_VERSION@") 8 | 9 | set(NETGEN_NGLIB_INCLUDE_PATH "${SELF_DIR}/../include/netgen") 10 | -------------------------------------------------------------------------------- /libsrc/linalg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library( la OBJECT 2 | densemat.cpp polynomial.cpp bfgs.cpp linopt.cpp linsearch.cpp 3 | ) 4 | 5 | set_target_properties(la PROPERTIES POSITION_INDEPENDENT_CODE ON ) 6 | 7 | install(FILES 8 | densemat.hpp linalg.hpp opti.hpp 9 | polynomial.hpp vector.hpp 10 | DESTINATION ${INCDIR}/linalg COMPONENT netgen_devel 11 | ) 12 | -------------------------------------------------------------------------------- /libsrc/visualization/visual_dummy.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include "../include/nginterface.h" 5 | 6 | void Ng_ClearSolutionData () { ; } 7 | void Ng_InitSolutionData (Ng_SolutionData * soldata) { ; } 8 | void Ng_SetSolutionData (Ng_SolutionData * soldata) { ; } 9 | void Ng_Redraw (bool blocking) { ; } 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /tutorials/cube.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## A cube 3 | # 4 | algebraic3d 5 | 6 | # cube consisting of 6 planes: 7 | 8 | solid cube = plane (0, 0, 0; 0, 0, -1) 9 | and plane (0, 0, 0; 0, -1, 0) 10 | and plane (0, 0, 0; -1, 0, 0) 11 | and plane (1, 1, 1; 0, 0, 1) 12 | and plane (1, 1, 1; 0, 1, 0) 13 | and plane (1, 1, 1; 1, 0, 0); 14 | 15 | tlo cube; 16 | 17 | -------------------------------------------------------------------------------- /py_tutorials/cube.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## A cube 3 | # 4 | algebraic3d 5 | 6 | # cube consisting of 6 planes: 7 | 8 | solid cube = plane (0, 0, 0; 0, 0, -1) 9 | and plane (0, 0, 0; 0, -1, 0) 10 | and plane (0, 0, 0; -1, 0, 0) 11 | and plane (1, 1, 1; 0, 0, 1) 12 | and plane (1, 1, 1; 0, 1, 0) 13 | and plane (1, 1, 1; 1, 0, 0); 14 | 15 | tlo cube; 16 | 17 | -------------------------------------------------------------------------------- /tutorials/twocyl.geo: -------------------------------------------------------------------------------- 1 | algebraic3d 2 | 3 | # 4 | # two intersecting cylinderes 5 | # 6 | 7 | solid cyl1 = cylinder ( 1, 0, 0; -1, 0, 0; 0.5 ) 8 | and plane (-1, 0, 0; -1, 0, 0) 9 | and plane (1, 0, 0; 1, 0, 0); 10 | solid cyl2 = cylinder ( 0, 1, 0.3; 0, -1, 0.3; 0.5 ) 11 | and plane (0, -1, 0; 0, -1, 0) 12 | and plane (0, 1, 0; 0, 1, 0); 13 | solid main = cyl1 or cyl2; 14 | 15 | 16 | tlo main; 17 | -------------------------------------------------------------------------------- /ci/conda/bld.bat: -------------------------------------------------------------------------------- 1 | mkdir build 2 | cd build 3 | 4 | REM Configure step 5 | cmake -G "Ninja" -DINSTALL_DIR="%LIBRARY_PREFIX%" ^ 6 | -DCMAKE_BUILD_TYPE=Release ^ 7 | -DINSTALL_DIR="%LIBRARY_PREFIX%" ^ 8 | -DCMAKE_SYSTEM_PREFIX_PATH="%LIBRARY_PREFIX%" ^ 9 | .. 10 | if errorlevel 1 exit 1 11 | 12 | REM Build step 13 | ninja 14 | if errorlevel 1 exit 1 15 | 16 | REM Install step 17 | ninja install 18 | if errorlevel 1 exit 1 -------------------------------------------------------------------------------- /ng/acisgeom.tcl: -------------------------------------------------------------------------------- 1 | if { [Ng_ACISCommand isACISavailable] == "yes" } { 2 | .ngmenu.geometry add command -label "ACIS Topology Explorer..." \ 3 | -command { acisdialog; } 4 | 5 | .ngmenu.geometry add command -label "ACIS combine all" \ 6 | -command { Ng_ACISCommand combineall } 7 | .ngmenu.geometry add command -label "ACIS Create CT" \ 8 | -command { Ng_ACISCommand createct } 9 | } 10 | 11 | 12 | -------------------------------------------------------------------------------- /python/stl.py: -------------------------------------------------------------------------------- 1 | import libngpy 2 | from libngpy._stl import * 3 | from libngpy._meshing import MeshingParameters 4 | 5 | 6 | def stl_meshing_func (geom, **args): 7 | if "mp" in args: 8 | return GenerateMesh (geom, args["mp"]) 9 | else: 10 | return GenerateMesh (geom, MeshingParameters (**args)) 11 | # return GenerateMesh (geom, MeshingParameters (**args)) 12 | 13 | STLGeometry.GenerateMesh = stl_meshing_func 14 | -------------------------------------------------------------------------------- /python/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | from sys import path 3 | from sys import platform as __platform 4 | 5 | if __platform.startswith('linux'): 6 | path.append(os.path.dirname(__file__) + '/../../..') 7 | if __platform.startswith('win'): 8 | path.append(os.path.dirname(__file__) + '/../../../bin') 9 | if __platform.startswith('darwin'): 10 | path.append(os.path.dirname(__file__) + '/../../../../../MacOS') 11 | 12 | import libngpy 13 | del path 14 | -------------------------------------------------------------------------------- /tutorials/sculpture.geo: -------------------------------------------------------------------------------- 1 | algebraic3d 2 | # 3 | # intersection of sphere and cylinders 4 | # motivated by a sculpture found in St. Gallen 5 | # 6 | 7 | solid cyls = cylinder ( -100, 0, 0; 200, 0, 0; 40 ) 8 | or cylinder ( 100, -100, 100; 100, 200, 100; 40) 9 | or cylinder ( 0, 100, -100; 0, 100, 200; 40); 10 | solid sculpture = sphere (50, 50, 50; 80) and not cyls 11 | and not sphere (50, 50, 50; 50); 12 | 13 | tlo sculpture -col=[0.5, 0.5, 0.5]; 14 | -------------------------------------------------------------------------------- /libsrc/include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install(FILES nginterface.h nginterface_v2.hpp DESTINATION ${INCDIR} COMPONENT netgen_devel) 2 | 3 | install(FILES 4 | acisgeom.hpp csg.hpp geometry2d.hpp gprim.hpp incopengl.hpp 5 | inctcl.hpp incvis.hpp linalg.hpp meshing.hpp myadt.hpp mydefs.hpp 6 | mystdlib.h nginterface_v2_impl.hpp occgeom.hpp 7 | opti.hpp parallel.hpp parallelinterface.hpp stlgeom.hpp visual.hpp 8 | DESTINATION ${INCDIR}/include COMPONENT netgen_devel 9 | ) 10 | 11 | -------------------------------------------------------------------------------- /tutorials/boundarycondition.geo: -------------------------------------------------------------------------------- 1 | algebraic3d 2 | 3 | solid p1 = plane (0.5, 0, 0; 1, 0, 0); 4 | 5 | # since surfaces of both bricks are identic they get the same bc id: 6 | solid brick1 = orthobrick (0,0,0; 1,1,1) and p1 -bc=1; 7 | solid brick2 = orthobrick (0,0,-1; 1,1,0) and p1 -bc=2; 8 | 9 | 10 | tlo brick1; 11 | tlo brick2; 12 | 13 | # override bc number: 14 | # all faces of solid p1 belonging to the boundary of tlo brick1 get bc=3 15 | 16 | boundarycondition p1 brick1 3; 17 | -------------------------------------------------------------------------------- /tutorials/cubemsphere.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## Cube minus Cylinder 3 | # 4 | algebraic3d 5 | 6 | solid cube = plane (0, 0, 0; 0, 0, -1) 7 | and plane (0, 0, 0; 0, -1, 0) 8 | and plane (0, 0, 0; -1, 0, 0) 9 | and plane (1, 1, 1; 0, 0, 1) 10 | and plane (1, 1, 1; 0, 1, 0) 11 | and plane (1, 1, 1; 1, 0, 0); 12 | solid sp = sphere (0.5, 0.5, 0; 0.001); 13 | 14 | # cut off small sphere: 15 | 16 | solid main = cube and not sp; 17 | 18 | tlo main; 19 | 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Netgen mesh generator 2 | 3 | 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 6.x supports scripting via a Python interface. Netgen is open source based on the LGPL license. It is available for Unix/Linux, Windows, and OSX. -------------------------------------------------------------------------------- /tutorials/cubemcyl.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## Cube minus Cylinder 3 | # 4 | algebraic3d 5 | 6 | solid cube = plane (0, 0, 0; 0, 0, -1) 7 | and plane (0, 0, 0; 0, -1, 0) 8 | and plane (0, 0, 0; -1, 0, 0) 9 | and plane (1, 1, 1; 0, 0, 1) 10 | and plane (1, 1, 1; 0, 1, 0) 11 | and plane (1, 1, 1; 1, 0, 0); 12 | solid cyl = cylinder (0.5, 0.5, 0; 0.5, 0.5, 1; 0.03); 13 | 14 | # cut off small cylinder from cube: 15 | 16 | solid main = cube and not cyl; 17 | 18 | tlo main; 19 | -------------------------------------------------------------------------------- /tutorials/sphereincube.geo: -------------------------------------------------------------------------------- 1 | algebraic3d 2 | # 3 | # Example with two sub-domains: 4 | # 5 | solid cube = plane (0, 0, 0; 0, 0, -1) 6 | and plane (0, 0, 0; 0, -1, 0) 7 | and plane (0, 0, 0; -1, 0, 0) 8 | and plane (1, 1, 1; 0, 0, 1) 9 | and plane (1, 1, 1; 0, 1, 0) 10 | and plane (1, 1, 1; 1, 0, 0); 11 | solid sph = sphere (0.5, 0.5, 0.5; 0.3); 12 | 13 | solid rest = cube and not sph; 14 | 15 | tlo rest -transparent -col=[0,0,1]; 16 | tlo sph -col=[1,0,0]; 17 | 18 | -------------------------------------------------------------------------------- /tutorials/twobricks.geo: -------------------------------------------------------------------------------- 1 | algebraic3d 2 | solid cube = plane (0, 0, 0; 0, 0, -1) 3 | and plane (0, 0, 0; 0, -1, 0) 4 | and plane (0, 0, 0; -1, 0, 0) 5 | and plane (1, 1, 1; 0, 0, 1) 6 | and plane (1, 1, 1; 0, 1, 0) 7 | and plane (1, 1, 1; 1, 0, 0); 8 | solid cutplane = plane (0.5, 0, 0; -1, 0, 0); 9 | 10 | solid right = cube and cutplane; 11 | solid left = cube and not cutplane; 12 | 13 | tlo right -col=[1,0,0] -material=copper; 14 | tlo left -col=[0,0,1]; 15 | 16 | -------------------------------------------------------------------------------- /tutorials/twocubes.geo: -------------------------------------------------------------------------------- 1 | algebraic3d 2 | 3 | # example with two sub-domains 4 | 5 | solid cube = plane (0, 0, 0; 0, 0, -1) 6 | and plane (0, 0, 0; 0, -1, 0) 7 | and plane (0, 0, 0; -1, 0, 0) 8 | and plane (1, 1, 1; 0, 0, 1) 9 | and plane (1, 1, 1; 0, 1, 0) 10 | and plane (1, 1, 1; 1, 0, 0); 11 | solid cutplane = plane (0.5, 0, 0; -1, 0, 0); 12 | 13 | solid right = cube and cutplane; 14 | solid left = cube and not cutplane; 15 | 16 | tlo right -col=[1,0,0]; 17 | tlo left -col=[0,0,1]; 18 | 19 | -------------------------------------------------------------------------------- /cmake_modules/mic.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_SYSTEM_NAME Linux) 2 | set(CMAKE_SYSTEM_PROCESSOR k1om) 3 | set(CMAKE_SYSTEM_VERSION 1) 4 | 5 | # specify the cross compiler 6 | set(CMAKE_C_COMPILER icc) 7 | set(CMAKE_CXX_COMPILER icpc) 8 | set(MPI_C_COMPILER mpiicc) 9 | set(_CMAKE_TOOLCHAIN_PREFIX x86_64-k1om-linux-) 10 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmic") 11 | set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -limf -lsvml -lirng -lintlc") 12 | 13 | # where is the target environment 14 | set(CMAKE_FIND_ROOT_PATH /usr/linux-k1om-4.7) 15 | 16 | -------------------------------------------------------------------------------- /tutorials/lshape3d.geo: -------------------------------------------------------------------------------- 1 | algebraic3d 2 | 3 | # 4 | ## 3D Lshape - domain 5 | # 6 | 7 | solid c1 = plane (-1, -1, 0; 0, 0, -1) 8 | and plane (-1, -1, 0; 0, -1, 0) 9 | and plane (-1, -1, 0; -1, 0, 0) 10 | and plane (1, 1, 1; 0, 0, 1) 11 | and plane (1, 1, 1; 0, 1, 0) 12 | and plane (1, 1, 1; 1, 0, 0); 13 | 14 | solid f1 = plane (0, 0, 0; -1, 0, 0); 15 | solid f2 = plane (0, 0, 0; 0, 1, 0); 16 | 17 | solid main = c1 and not (f1 and f2); 18 | 19 | tlo main; 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tutorials/test.dem: -------------------------------------------------------------------------------- 1 | # Demo file 2 | 3 | t = 0; 4 | 5 | camerapos (0 : -7,0,0; 1: -6,0,0; 10: -5,0,0); 6 | camerapos (10: -5,0,0; 11: -5,-5,0; 12: 0,-5,0); 7 | camerapos (12: 0,-5,0); 8 | 9 | camerapos (14: 0,-5,0; 15: 0,-4,0); 10 | camerapos (15: 0,-4,0; 16: 4,-4,0; 17: 4,0,0); 11 | camerapos (17: 4,0,0; 18: 4,4,0; 19: 0,4,0); 12 | camerapos (19: 0,4,0; 20: -4,4,0; 21: -4,0,0); 13 | 14 | camerapos (21: -4,0,0); 15 | camerapos (22: 0,-4,-4); 16 | camerapos (23: -4,0,-4); 17 | camerapos (24: -4,-4,-4); 18 | 19 | camerapos (25: -4,-4,-4; 30: 4,-4,-4; 35: 4,4,4); 20 | 21 | -------------------------------------------------------------------------------- /tutorials/manyholes.geo: -------------------------------------------------------------------------------- 1 | algebraic3d 2 | # 3 | ## CSG feature copy 4 | # 5 | 6 | 7 | # define a axis parallel brick: 8 | 9 | solid br = orthobrick (0, 0, 0; 10, 10, 1); 10 | 11 | # define reference cylinder: 12 | 13 | solid cyl1 = cylinder (0.5, 0.5, -1; 0.5, 0.5, 3; 0.2); 14 | 15 | 16 | # make copies: 17 | solid cylx = multitranslate (1, 0, 0; 9; cyl1); 18 | solid cyls = multitranslate (0, 1, 0; 9; cylx); 19 | 20 | solid main = br and not cyls; 21 | 22 | tlo main; 23 | 24 | # provide bounding-box for fastening bisection alg: 25 | 26 | boundingbox (-1, -1, -1; 11, 11, 2); 27 | -------------------------------------------------------------------------------- /tutorials/cubeandspheres.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## Cube and Spheres 3 | # 4 | algebraic3d 5 | 6 | # a cube 7 | solid cube = plane (0, 0, 0; 0, 0, -1) 8 | and plane (0, 0, 0; 0, -1, 0) 9 | and plane (0, 0, 0; -1, 0, 0) 10 | and plane (1, 1, 1; 0, 0, 1) 11 | and plane (1, 1, 1; 0, 1, 0) 12 | and plane (1, 1, 1; 1, 0, 0); 13 | 14 | # two shperes 15 | solid sph1 = sphere (0.5, 0.5, 0.5; 0.58); 16 | solid sph2 = sphere (0.5, 0.5, 0.5; 0.75); 17 | 18 | # cut cube with inner and outer sphere 19 | solid main = cube and sph2 and not sph1; 20 | 21 | tlo main; 22 | -------------------------------------------------------------------------------- /tutorials/manyholes2.geo: -------------------------------------------------------------------------------- 1 | algebraic3d 2 | # 3 | ## CSG feature copy 4 | # 5 | 6 | 7 | # define a axis parallel brick: 8 | 9 | solid br = orthobrick (0, 0, 0; 20, 20, 1); 10 | 11 | # define reference cylinder: 12 | 13 | solid cyl1 = cylinder (0.5, 0.5, -1; 0.5, 0.5, 3; 0.2); 14 | 15 | 16 | # make copies: 17 | solid cylx = multitranslate (1, 0, 0; 19; cyl1); 18 | solid cyls = multitranslate (0, 1, 0; 19; cylx); 19 | 20 | solid main = br and not cyls; 21 | 22 | tlo main; 23 | 24 | # provide bounding-box for fastening bisection alg: 25 | 26 | boundingbox (-1, -1, -1; 21, 21, 2); 27 | -------------------------------------------------------------------------------- /libsrc/gprim/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-DNGINTERFACE_EXPORTS) 2 | add_library(gprim OBJECT 3 | adtree.cpp geom2d.cpp geom3d.cpp geomfuncs.cpp 4 | geomtest3d.cpp transform3d.cpp spline.cpp splinegeometry.cpp 5 | ) 6 | 7 | set_target_properties( gprim PROPERTIES POSITION_INDEPENDENT_CODE ON ) 8 | 9 | install(FILES 10 | adtree.hpp geom2d.hpp geom3d.hpp geomfuncs.hpp geomobjects2.hpp 11 | geomobjects.hpp geomops2.hpp geomops.hpp geomtest3d.hpp gprim.hpp 12 | splinegeometry.hpp spline.hpp transform3d.hpp 13 | DESTINATION ${INCDIR}/gprim COMPONENT netgen_devel 14 | ) 15 | -------------------------------------------------------------------------------- /libsrc/occ/Partition_Loop2d.jxx: -------------------------------------------------------------------------------- 1 | // GEOM PARTITION : partition algorithm 2 | // 3 | // Copyright (C) 2003 CEA/DEN, EDF R&D 4 | // 5 | // 6 | // 7 | // File : Partition_Loop2d.jxx 8 | // Module : GEOM 9 | 10 | #ifndef _TopoDS_Face_HeaderFile 11 | #include 12 | #endif 13 | #ifndef _TopoDS_Edge_HeaderFile 14 | #include 15 | #endif 16 | #ifndef _TopTools_ListOfShape_HeaderFile 17 | #include 18 | #endif 19 | #ifndef _BRepAlgo_Image_HeaderFile 20 | #include 21 | #endif 22 | #ifndef _Partition_Loop2d_HeaderFile 23 | #include "Partition_Loop2d.hxx" 24 | #endif 25 | -------------------------------------------------------------------------------- /libsrc/csg/geoml.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_GEOML 2 | #define FILE_GEOML 3 | 4 | /* *************************************************************************/ 5 | /* File: geoml.hh */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 21. Jun. 98 */ 8 | /* *************************************************************************/ 9 | 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | #endif 17 | -------------------------------------------------------------------------------- /ng/Togl-1.7/TODO: -------------------------------------------------------------------------------- 1 | In no particular order: 2 | ----------------------- 3 | 4 | stubify C API. 5 | 6 | replace EPS support with TK photo image support 7 | 8 | Add command arguments for create, destroy, etc. so there would be a 9 | -createcommand option to the togl command (etc.) (and phase out 10 | Togl_*Func from the C API) 11 | 12 | multisampling support (can be worked-around by passing in a pixelformat) 13 | 14 | add vertical sync control 15 | 16 | update documention 17 | - update build instructions 18 | - update stereo documentation 19 | - separate Tcl API from C API 20 | - say togl hides window system dependent (glX/wgl/agl) calls 21 | -------------------------------------------------------------------------------- /tutorials/circle_on_cube.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## A cube 3 | # 4 | algebraic3d 5 | 6 | # cube consisting of 6 planes: 7 | 8 | solid cube = plane (0, 0, 0; 0, 0, -1) 9 | and plane (0, 0, 0; 0, -1, 0) 10 | and plane (0, 0, 0; -1, 0, 0) 11 | and plane (1, 1, 1; 0, 0, 1) 12 | and plane (1, 1, 1; 0, 1, 0) 13 | and plane (1, 1, 1; 1, 0, 0); 14 | 15 | 16 | solid top = plane (1,1,1; 0, 0, 1); 17 | solid cyl = top 18 | and plane (0,0,0; 0, 0, -1) 19 | and cylinder (0.5, 0.5, 0; 0.5, 0.5, 1; 0.2); 20 | 21 | 22 | tlo cube; 23 | 24 | # take just surface 'top' of solid 'cyl' 25 | tlo cyl top -col=[1,0,0]; 26 | 27 | 28 | -------------------------------------------------------------------------------- /nglib/cube.surf: -------------------------------------------------------------------------------- 1 | 8 2 | 0 0 0 3 | 1 0 0 4 | 1 1 1 5 | 1 0 1 6 | 0 1 1 7 | 0 0 1 8 | 0 1 0 9 | 1 1 0 10 | 12 11 | 2 1 7 12 | 8 2 7 13 | 6 1 2 14 | 4 6 2 15 | 4 3 5 16 | 5 6 4 17 | 8 3 4 18 | 8 4 2 19 | 5 3 8 20 | 7 5 8 21 | 1 6 5 22 | 7 1 5 23 | -------------------------------------------------------------------------------- /python/gengeom.py: -------------------------------------------------------------------------------- 1 | 2 | geom = SplineGeometry() 3 | 4 | # Define Points 5 | pi1 = geom.AppendPoint(0,0) 6 | pi2 = geom.AppendPoint(1,0) 7 | pi3 = geom.AppendPoint(1,1) 8 | pi4 = geom.AppendPoint(0,1) 9 | 10 | # Define Segments 11 | geom.AppendSegment([pi1,pi2]) 12 | geom.AppendSegment([pi2,pi3]) 13 | geom.AppendSegment([pi3,pi4]) 14 | geom.AppendSegment([pi4,pi1]) 15 | 16 | # Plot Geometry 17 | geom.Plot() 18 | 19 | # Plot Point Index 20 | geom.ShowPoints() 21 | # Plot Domain Numbers 22 | geom.ShowDomains() 23 | 24 | # Set Meshing Parameters 25 | mparam = MeshingParameters() 26 | mparam.maxh = 0.1 27 | 28 | mesh = geom.GenerateMesh(mparam) -------------------------------------------------------------------------------- /py_tutorials/exportNeutral.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | def Export (mesh, filename): 4 | """ export Netgen mesh to neutral format """ 5 | 6 | print ("export mesh in neutral format to file = ", filename) 7 | 8 | f = open (filename, 'w') 9 | 10 | points = mesh.Points() 11 | print (len(points), file=f) 12 | for p in points: 13 | print (p.p[0], p.p[1], p.p[2], file=f) 14 | 15 | 16 | volels = mesh.Elements3D(); 17 | print (len(volels), file=f) 18 | for el in volels: 19 | print (el.index, end=" ", file=f) 20 | for j in el.vertices: 21 | print (j.nr, end=" ", file=f) 22 | print(file=f) 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /cmake_modules/check_submodules.cmake: -------------------------------------------------------------------------------- 1 | execute_process(COMMAND git submodule status --recursive WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../" OUTPUT_VARIABLE git_status_output) 2 | string(REPLACE "\n" ";" git_status_output "${git_status_output}") 3 | foreach( a ${git_status_output}) 4 | if(NOT ${a} MATCHES " [a-f,0-9]* external_dependencies[.]*") 5 | message(WARNING 6 | "***************************************************************** 7 | WARNING: The git submodules are out of sync! Please run 8 | git submodule update --init --recursive 9 | in your source directory 10 | *****************************************************************") 11 | endif() 12 | endforeach() 13 | 14 | -------------------------------------------------------------------------------- /ci/conda/meta.yaml: -------------------------------------------------------------------------------- 1 | package: 2 | name: netgen 3 | version: 6.2 4 | 5 | source: 6 | path: ../.. 7 | 8 | build: 9 | 10 | build: 11 | script_env: 12 | - CC 13 | - CXX 14 | 15 | number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }} 16 | binary_relocation: false [osx] 17 | features: 18 | - vc9 [win and py27] 19 | - vc10 [win and py34] 20 | - vc14 [win and py35] 21 | 22 | requirements: 23 | build: 24 | - oce ==0.17.2 25 | - ninja 26 | - cmake 27 | - boost 28 | 29 | run: 30 | - oce ==0.17.2 31 | 32 | about: 33 | home: https://sourceforge.net/projects/netgen-mesher 34 | license: LGPL 35 | summary: Mesh generator. 36 | -------------------------------------------------------------------------------- /tutorials/boxcyl.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## Two cylinders on a box 3 | # 4 | algebraic3d 5 | 6 | #define box: 7 | 8 | solid box = plane (0, 0, 0.5; -1, 0, 0) 9 | and plane (0, 0, 0.5; 0, -1, 0) 10 | and plane (0, 0, 0.5; 0, 0, -1) 11 | and plane (2, 1.5, 1; 1, 0, 0) 12 | and plane (2, 1.5, 1; 0, 1, 0) 13 | and plane (2, 1.5, 1; 0, 0, 1); 14 | 15 | #define cylinders: 16 | 17 | solid cyls = (cylinder (0.5, 0.75, 0; 0.5, 0.75, 2; 0.3) 18 | or cylinder (1.5, 0.75, 0; 1.5, 0.75, 2; 0.3) ) 19 | and plane (0, 0, 0.7; 0, 0, -1) 20 | and plane (0, 0, 1.5; 0, 0, 1); 21 | 22 | #combine both: 23 | 24 | solid main = box or cyls; 25 | 26 | 27 | #define sub-domains: 28 | tlo main; 29 | 30 | singular edge box cyls; 31 | 32 | 33 | -------------------------------------------------------------------------------- /tutorials/fichera.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## Fichera Cube 3 | # 4 | algebraic3d 5 | solid c1 = plane (0, 0, 0; 0, 0, -1) 6 | and plane (0, 0, 0; 0, -1, 0) 7 | and plane (0, 0, 0; -1, 0, 0) 8 | and plane (1, 1, 1; 0, 0, 1) 9 | and plane (1, 1, 1; 0, 1, 0) 10 | and plane (1, 1, 1; 1, 0, 0) -bc=2; 11 | 12 | solid c2 = plane (-0.5, -0.5, -0.5; 0, 0, -1) 13 | and plane (-0.5, -0.5, -0.5; 0, -1, 0) 14 | and plane (-0.5, -0.5, -0.5; -1, 0, 0) 15 | and plane (0.5, 0.5, 0.5; 0, 0, 1) 16 | and plane (0.5, 0.5, 0.5; 0, 1, 0) 17 | and plane (0.5, 0.5, 0.5; 1, 0, 0); 18 | 19 | # cut off small cube 20 | 21 | solid main = c1 and not c2 -bc=1; 22 | 23 | tlo main; 24 | 25 | -------------------------------------------------------------------------------- /libsrc/occ/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-DNGINTERFACE_EXPORTS) 2 | add_library(occ ${NG_LIB_TYPE} 3 | Partition_Inter2d.cxx Partition_Inter3d.cxx 4 | Partition_Loop.cxx Partition_Loop2d.cxx Partition_Loop3d.cxx Partition_Spliter.cxx 5 | occconstruction.cpp occgenmesh.cpp occgeom.cpp occmeshsurf.cpp 6 | ) 7 | 8 | add_library(occvis ${NG_LIB_TYPE} vsocc.cpp) 9 | 10 | if(NOT WIN32) 11 | target_link_libraries( occ ${OCC_LIBRARIES} ${PYTHON_LIBRARIES}) 12 | target_link_libraries( occvis occ ) 13 | install( TARGETS occ occvis ${ng_install_dir}) 14 | endif(NOT WIN32) 15 | 16 | install(FILES 17 | occgeom.hpp occmeshsurf.hpp vsocc.hpp 18 | DESTINATION ${INCDIR}/occ COMPONENT netgen_devel 19 | ) 20 | -------------------------------------------------------------------------------- /libsrc/meshing/boundarylayer.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_BOUNDARYLAYER 2 | #define FILE_BOUNDARYLAYER 3 | 4 | 5 | /// 6 | DLL_HEADER extern void InsertVirtualBoundaryLayer (Mesh & mesh); 7 | 8 | /// Create a typical prismatic boundary layer on the given 9 | /// surfaces 10 | 11 | class BoundaryLayerParameters 12 | { 13 | public: 14 | // parameters by Philippose .. 15 | Array surfid; 16 | Array heights; 17 | Array new_matnrs; 18 | int prismlayers = 1; 19 | int bulk_matnr = 1; 20 | int new_matnr = 1; 21 | double hfirst = 0.01; 22 | double growthfactor = 1; 23 | bool optimize = true; 24 | }; 25 | 26 | DLL_HEADER extern void GenerateBoundaryLayer (Mesh & mesh, BoundaryLayerParameters & blp); 27 | 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /libsrc/csg/manifold.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_MANIFOLD 2 | #define FILE_MANIFOLD 3 | 4 | /**************************************************************************/ 5 | /* File: manifold.hh */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 7. Aug. 96 */ 8 | /**************************************************************************/ 9 | 10 | namespace netgen 11 | { 12 | 13 | 14 | /** 15 | Basis class for manifolds in 2d and 3d 16 | */ 17 | class Manifold 18 | { 19 | public: 20 | /// 21 | Manifold (); 22 | /// 23 | virtual ~Manifold (); 24 | }; 25 | 26 | } 27 | 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /tutorials/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install( FILES 2 | boxcyl.geo circle_on_cube.geo cone.geo cube.geo 3 | cubeandring.geo cubeandspheres.geo cubemcyl.geo cubemsphere.geo cylinder.geo 4 | cylsphere.geo ellipsoid.geo ellipticcyl.geo extrusion.geo fichera.geo lshape3d.geo 5 | manyholes.geo manyholes2.geo matrix.geo ortho.geo period.geo revolution.geo 6 | sculpture.geo shaft.geo shell.geo sphere.geo sphereincube.geo torus.geo trafo.geo 7 | twobricks.geo twocubes.geo twocyl.geo boundarycondition.geo 8 | hinge.stl part1.stl frame.step screw.step 9 | squarehole.in2d squarecircle.in2d square.in2d 10 | DESTINATION share/netgen 11 | COMPONENT netgen_tutorial 12 | ) 13 | -------------------------------------------------------------------------------- /libsrc/occ/Partition_Loop3d.jxx: -------------------------------------------------------------------------------- 1 | // GEOM PARTITION : partition algorithm 2 | // 3 | // Copyright (C) 2003 CEA/DEN, EDF R&D 4 | // 5 | // 6 | // 7 | // File : Partition_Loop3d.jxx 8 | // Module : GEOM 9 | 10 | #ifndef _TopoDS_Shape_HeaderFile 11 | #include 12 | #endif 13 | #ifndef _TopTools_ListOfShape_HeaderFile 14 | #include 15 | #endif 16 | #ifndef _TopTools_MapOfOrientedShape_HeaderFile 17 | #include 18 | #endif 19 | #ifndef _TopoDS_Edge_HeaderFile 20 | #include 21 | #endif 22 | #ifndef _TopoDS_Face_HeaderFile 23 | #include 24 | #endif 25 | #ifndef _gp_Vec_HeaderFile 26 | #include 27 | #endif 28 | #ifndef _Partition_Loop3d_HeaderFile 29 | #include "Partition_Loop3d.hxx" 30 | #endif 31 | -------------------------------------------------------------------------------- /libsrc/meshing/validate.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VALIDATE_HPP 2 | #define VALIDATE_HPP 3 | 4 | namespace netgen 5 | { 6 | 7 | void GetPureBadness(Mesh & mesh, Array & pure_badness, 8 | const BitArray & isnewpoint); 9 | double Validate(const Mesh & mesh, Array & bad_elements, 10 | const Array & pure_badness, 11 | double max_worsening, const bool uselocalworsening, 12 | Array * quality_loss = NULL); 13 | void RepairBisection(Mesh & mesh, Array & bad_elements, 14 | const BitArray & isnewpoint, const Refinement & refinement, 15 | const Array & pure_badness, 16 | double max_worsening, const bool uselocalworsening, 17 | const Array< Array* > & idmaps); 18 | 19 | } 20 | 21 | #endif // VALIDATE_HPP 22 | -------------------------------------------------------------------------------- /tutorials/period.geo: -------------------------------------------------------------------------------- 1 | ## 2 | ## Example with periodic boundary conditions 3 | ## by Joachim Schoeberl 4 | ## 5 | ## 6 | 7 | algebraic3d 8 | 9 | solid p1 = plane (0, 0, 0; 0, 0, -1); 10 | solid p2 = plane (1, 1, 1; 0, 0, 1); 11 | 12 | solid p3 = plane (0, 0, 0; 0, -1, 0); 13 | solid p4 = plane (1, 1, 1; 0, 1, 0); 14 | 15 | solid p5 = plane (0, 0, 0; -1, 0, 0); 16 | solid p6 = plane (1, 1, 1; 1, 0, 0); 17 | 18 | 19 | solid cube = p1 and p2 and p3 and p4 and p5 and p6; 20 | 21 | solid cyls = 22 | cylinder (0.5, 0.5, 0; 0.5, 0.5, 1; 0.3) 23 | or cylinder (0, 0.5, 0.2; 1, 0.5, 0.2; 0.1); 24 | solid matrix = cube and not cyls; 25 | solid inner = cube and cyls; 26 | 27 | tlo matrix -transparent; 28 | tlo inner -col=[1,0,0]; 29 | 30 | identify periodic p1 p2; 31 | identify periodic p3 p4; 32 | identify periodic p5 p6; 33 | 34 | -------------------------------------------------------------------------------- /libsrc/visualization/visual.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_VISUAL 2 | #define FILE_VISUAL 3 | 4 | /* *************************************************************************/ 5 | /* File: visual.hpp */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 02. Dec. 01 */ 8 | /* *************************************************************************/ 9 | 10 | /* 11 | 12 | Visualization 13 | 14 | */ 15 | 16 | #ifdef PARALLEL 17 | #define PARALLELGL 18 | #endif 19 | 20 | #include "../include/incopengl.hpp" 21 | 22 | #include "vispar.hpp" 23 | #include "soldata.hpp" 24 | #include "mvdraw.hpp" 25 | 26 | #include 27 | #include "vssolution.hpp" 28 | #include "meshdoc.hpp" 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /ng/Togl2.1/doc/header.js: -------------------------------------------------------------------------------- 1 | function displayHeader(pageTitle) 2 | { 3 | document.write("

" + pageTitle + "

"); 4 | } 5 | 6 | function NavigationBar() 7 | { 8 | document.write(""); 9 | document.write(" "); 10 | document.write(" "); 11 | document.write(" "); 12 | document.write(" "); 13 | document.write(" "); 14 | document.write(" "); 15 | document.write(" "); 16 | document.write(" "); 17 | document.write(" "); 18 | document.write("
IndexIntroDownload/InstallUsing ToglTcl APIC APIFAQ
"); 19 | document.write("
"); 20 | } 21 | -------------------------------------------------------------------------------- /libsrc/geom2d/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-DNGLIB_EXPORTS) 2 | add_library(geom2d ${NG_LIB_TYPE} genmesh2d.cpp geom2dmesh.cpp geometry2d.cpp python_geom2d.cpp ) 3 | if(APPLE) 4 | set_target_properties( geom2d PROPERTIES SUFFIX ".so") 5 | endif(APPLE) 6 | 7 | if(NOT WIN32) 8 | target_link_libraries(geom2d mesh ${PYTHON_LIBRARIES}) 9 | install( TARGETS geom2d ${ng_install_dir}) 10 | endif(NOT WIN32) 11 | 12 | if(USE_GUI) 13 | add_library(geom2dvis ${NG_LIB_TYPE} vsgeom2d.cpp) 14 | if(NOT WIN32) 15 | target_link_libraries(geom2dvis geom2d) 16 | install( TARGETS geom2dvis ${ng_install_dir}) 17 | endif(NOT WIN32) 18 | endif(USE_GUI) 19 | 20 | install(FILES 21 | geom2dmesh.hpp geometry2d.hpp spline2d.hpp 22 | splinegeometry2.hpp vsgeom2d.hpp 23 | DESTINATION ${INCDIR}/geom2d COMPONENT netgen_devel 24 | ) 25 | -------------------------------------------------------------------------------- /tutorials/matrix.geo: -------------------------------------------------------------------------------- 1 | # 2 | # a matrix with holes 3 | # 4 | algebraic3d 5 | 6 | solid holes = sphere (0.3, 0.4, 0.4; 0.1) 7 | or sphere (0.7, 0.2, 0.8; 0.15) 8 | or sphere (0.8, 0.5, 0.4; 0.11) 9 | or sphere (0.6, 0.2, 0.8; 0.13) 10 | or sphere (0.4, 0.3, 0.6; 0.14) 11 | or sphere (0.6, 0.3, 0.4; 0.16) 12 | or sphere (0.2, 0.8, 0.6; 0.17) 13 | or sphere (0.4, 0.6, 0.5; 0.2); 14 | 15 | solid cube = plane (0, 0, 0; 0, 0, -1) 16 | and plane (0, 0, 0; 0, -1, 0) 17 | and plane (0, 0, 0; -1, 0, 0) 18 | and plane (1, 1, 1; 0, 0, 1) 19 | and plane (1, 1, 1; 0, 1, 0) 20 | and plane (1, 1, 1; 1, 0, 0); 21 | 22 | solid rest = cube and not holes; 23 | 24 | # two sub-domains 25 | 26 | tlo holes -col=[1,0,0]; 27 | tlo rest -col=[0,0,1] -transparent; 28 | -------------------------------------------------------------------------------- /libsrc/general/ngexception.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /* File: ngexception.cpp */ 3 | /* Author: Joachim Schoeberl */ 4 | /* Date: 16. Jan. 02 */ 5 | /**************************************************************************/ 6 | 7 | #include 8 | 9 | namespace netgen 10 | { 11 | //using namespace netgen; 12 | 13 | 14 | 15 | NgException :: NgException (const string & s) 16 | : what(s) 17 | { 18 | ; 19 | } 20 | 21 | 22 | NgException :: ~NgException () 23 | { 24 | ; 25 | } 26 | 27 | /// append string to description 28 | void NgException :: Append (const string & s) 29 | { 30 | what += s; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /libsrc/linalg/linalg.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_LINALG 2 | #define FILE_LINALG 3 | 4 | /* *************************************************************************/ 5 | /* File: linalg.hpp */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 01. Oct. 94 */ 8 | /* *************************************************************************/ 9 | 10 | /* 11 | 12 | Data types for basic linear algebra 13 | 14 | The basic concepts include the data types 15 | 16 | Vector 17 | SparseMatrix 18 | DenseMatrix 19 | 20 | */ 21 | 22 | 23 | #include "../include/myadt.hpp" 24 | namespace netgen 25 | { 26 | #include "vector.hpp" 27 | #include "densemat.hpp" 28 | #include "polynomial.hpp" 29 | } 30 | #endif 31 | 32 | 33 | -------------------------------------------------------------------------------- /python/gengeom_curve.py: -------------------------------------------------------------------------------- 1 | 2 | geom = SplineGeometry() 3 | 4 | # Define Points 5 | pi1 = geom.AppendPoint(0,0) 6 | pi2 = geom.AppendPoint(1,0) 7 | pi3 = geom.AppendPoint(1,0.5) 8 | pi4 = geom.AppendPoint(1,1) 9 | pi5 = geom.AppendPoint(0.5,1) 10 | pi6 = geom.AppendPoint(0,1) 11 | 12 | # Define Segments 13 | geom.Append(Line(pi1,pi2)) 14 | geom.Append(Line(pi2,pi3)) 15 | geom.Append(Spline3(pi3,pi4,pi5)) 16 | geom.Append(Line(pi5,pi6)) 17 | geom.Append(Line(pi6,pi1)) 18 | 19 | # Plot Geometry 20 | geom.Plot() 21 | 22 | # Plot Point Index 23 | geom.ShowPoints() 24 | # Plot Domain Numbers 25 | geom.ShowDomains() 26 | 27 | # Hide point indices and domain numbers 28 | geom.ShowPoints(False) 29 | geom.ShowDomains(False) 30 | 31 | # Set Meshing Parameters 32 | mparam = MeshingParameters() 33 | mparam.maxh = 0.1 34 | 35 | mesh = geom.GenerateMesh(mparam) -------------------------------------------------------------------------------- /ng/netgen.ocf: -------------------------------------------------------------------------------- 1 | # Netgen Mesher 2 | # Boundary Condition Colour Profile 3 | # 4 | # Name: netgen.ocf 5 | # 6 | # Description: Netgen default colour 7 | # profile file for colour based automatic 8 | # assignment of boundary condition numbers 9 | # 10 | # Format: 11 | # [boundary_colours] (mandatory keyword) 12 | # 13 | # 14 | # 15 | # .... 16 | # .... 17 | # NOTE: 18 | # * Currently, the default Boundary 19 | # Condition number assigned to faces without 20 | # any colour defined is "1" 21 | # * Boundary Condition number "0" is invalid, 22 | # and should not be used 23 | 24 | boundary_colours 25 | 7 26 | 2 0.0000 0.0000 0.0000 27 | 3 1.0000 0.0000 0.0000 28 | 4 0.0000 0.0000 1.0000 29 | 5 1.0000 1.0000 0.0000 30 | 6 0.0000 1.0000 1.0000 31 | 7 1.0000 0.0000 1.0000 32 | 8 1.0000 1.0000 1.0000 33 | -------------------------------------------------------------------------------- /libsrc/stlgeom/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(stl ${NG_LIB_TYPE} 2 | meshstlsurface.cpp stlgeom.cpp stlgeomchart.cpp 3 | stlgeommesh.cpp stlline.cpp stltool.cpp stltopology.cpp python_stl.cpp 4 | ) 5 | 6 | if(NOT WIN32) 7 | target_link_libraries( stl mesh ${PYTHON_LIBRARIES}) 8 | target_link_libraries( stl ${PYTHON_LIBRARIES}) 9 | install( TARGETS stl ${ng_install_dir}) 10 | endif(NOT WIN32) 11 | 12 | if(USE_GUI) 13 | add_library(stlvis ${NG_LIB_TYPE} 14 | vsstl.cpp 15 | ) 16 | if(NOT WIN32) 17 | target_link_libraries( stlvis stl ) 18 | install( TARGETS stlvis ${ng_install_dir}) 19 | endif(NOT WIN32) 20 | endif(USE_GUI) 21 | 22 | install(FILES 23 | meshstlsurface.hpp stlgeom.hpp stlline.hpp 24 | stltool.hpp stltopology.hpp vsstl.hpp 25 | DESTINATION ${INCDIR}/stlgeom COMPONENT netgen_devel 26 | ) 27 | -------------------------------------------------------------------------------- /ng/stlgeom.tcl: -------------------------------------------------------------------------------- 1 | #if { [catch { load libstlvis[info sharedlibextension] Ng_STL } result ] } { 2 | # puts "cannot load stl" 3 | # puts "error: $result" 4 | #} 5 | 6 | 7 | .ngmenu.geometry add separator 8 | 9 | .ngmenu.geometry add command -label "STL Doctor..." \ 10 | -command { stldoctordialog; } 11 | 12 | .ngmenu.geometry add command -label "STL Info" \ 13 | -command { 14 | set notriangles 0 15 | set minx 0 16 | set maxx 0 17 | set miny 0 18 | set maxy 0 19 | set minz 0 20 | set maxz 0 21 | set trigscons 0 22 | Ng_STLInfo notriangles minx maxx miny maxy minz maxz trigscons 23 | set msgtext "NO STL-Triangles : $notriangles\nGeometry:\nX = $minx - $maxx\nY = $miny - $maxy\nZ = $minz - $maxz\nConsistency Check = $trigscons\n" 24 | set msgtext "$msgtext Status: [Ng_STLInfo status]" 25 | tk_messageBox -title "STL Info" -message $msgtext -type ok 26 | } 27 | 28 | -------------------------------------------------------------------------------- /libsrc/gprim/gprim.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_GPRIM 2 | #define FILE_GPRIM 3 | 4 | /* *************************************************************************/ 5 | /* File: gprim.hpp */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 14. Aug. 97 */ 8 | /* *************************************************************************/ 9 | 10 | 11 | #include 12 | #include 13 | 14 | 15 | 16 | 17 | #include "geomobjects.hpp" 18 | #include "geomops.hpp" 19 | #include "geomfuncs.hpp" 20 | 21 | #include "geom2d.hpp" 22 | #include "geom3d.hpp" 23 | 24 | #include "geomtest3d.hpp" 25 | #include "transform3d.hpp" 26 | 27 | #include "adtree.hpp" 28 | 29 | #include "spline.hpp" 30 | #include "splinegeometry.hpp" 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /tutorials/square.in2d: -------------------------------------------------------------------------------- 1 | # keyword for 2D geometry, version 2 2 | splinecurves2dv2 3 | 4 | 5 | # a global grading factor 6 | 2 7 | 8 | 9 | # the points (point number, x and y coordinates) 10 | points 11 | 1 0 0 -maxh=0.01 12 | 2 1 0 13 | 3 1 1 14 | 4 0 1 15 | 16 | 17 | # boundary curves consisting of 18 | # dl dr np p1 p1 flaglist 19 | # with 20 | # dl ... sub-domain nr on left side 21 | # dr ... sub-domain nr on right side 22 | # np ... curve is given by 2 (or 3) points 23 | # p1, p2 ... points defining the curve 24 | # flagslist 25 | segments 26 | 1 0 2 1 2 -bc=1 -maxh=0.1 27 | 1 0 2 2 3 -bc=1 28 | 1 0 2 3 4 -bc=1 29 | 1 0 2 4 1 -bc=2 30 | 31 | 32 | materials 33 | 1 domain1 -maxh=0.3 34 | 35 | 36 | -------------------------------------------------------------------------------- /python/csg.py: -------------------------------------------------------------------------------- 1 | import libngpy 2 | from libngpy._csg import * 3 | from libngpy._meshing import MeshingParameters 4 | from libngpy._meshing import Pnt 5 | from libngpy._meshing import Vec 6 | 7 | 8 | try: 9 | import libngpy.csgvis as csgvis 10 | from libngpy.csgvis import MouseMove 11 | CSGeometry.VS = csgvis.VS 12 | SetBackGroundColor = csgvis.SetBackGroundColor 13 | del csgvis 14 | 15 | def VS (obj): 16 | return obj.VS() 17 | 18 | except: 19 | pass 20 | 21 | 22 | def csg_meshing_func (geom, **args): 23 | if "mp" in args: 24 | return GenerateMesh (geom, args["mp"]) 25 | else: 26 | return GenerateMesh (geom, MeshingParameters (**args)) 27 | # return GenerateMesh (geom, MeshingParameters (**args)) 28 | 29 | CSGeometry.GenerateMesh = csg_meshing_func 30 | 31 | 32 | unit_cube = CSGeometry() 33 | unit_cube.Add (OrthoBrick(Pnt(0,0,0), Pnt(1,1,1))) 34 | 35 | -------------------------------------------------------------------------------- /tutorials/cubeandring.geo: -------------------------------------------------------------------------------- 1 | algebraic3d 2 | 3 | curve2d testcurve=(8; 4 | -0.5,1; 5 | -0.55,1.5; 6 | # -0.275,1.775; 7 | -0.5,2; 8 | 0,2.05; 9 | 0.5,2; 10 | 0.55,1.5; 11 | 0.5,1; 12 | 0,0.95; 13 | 4; 14 | 3,8,1,2; 15 | 3,2,3,4; 16 | 3,4,5,6; 17 | 3,6,7,8); 18 | 19 | #curve2d testcurve=(8; 20 | # -0.5,1; 21 | # -0.55,1.5; 22 | # -0.5,2; 23 | # 0,2.05; 24 | # 0.5,2; 25 | # 0.55,1.5; 26 | # 0.5,1; 27 | # 0,0.95; 28 | # 4; 29 | # 3,8,1,2; 30 | # 3,2,3,4; 31 | # 3,4,5,6; 32 | # 3,6,7,8); 33 | 34 | curve2d testcurve1=(4; 35 | -0.55,1.5; 36 | 0,2.05; 37 | 0.55,1.5; 38 | 0,0.95; 39 | 4; 40 | 2,1,2; 41 | 2,2,3; 42 | 2,3,4; 43 | 2,4,1); 44 | 45 | 46 | solid mytorus = revolution(0,0,0.5;1,0,0.5;testcurve); 47 | #solid mytorus = revolution(0,0,0.5;1,0,0.5;testcurve1); 48 | 49 | solid bbb = orthobrick(-4,-4,-4;4,4,0.1); 50 | 51 | solid brickandring = mytorus or bbb; 52 | 53 | 54 | tlo brickandring; 55 | 56 | -------------------------------------------------------------------------------- /libsrc/general/parthreads.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /* File: parthreads.cpp */ 3 | /* Author: Joachim Schoeberl */ 4 | /* Date: 01. Jun. 95 */ 5 | /**************************************************************************/ 6 | 7 | 8 | #include 9 | #include 10 | 11 | /* 12 | 13 | namespace netgen 14 | { 15 | using namespace netgen; 16 | 17 | #ifdef WIN32 18 | 19 | NgLock :: NgLock (NgMutex & mut) 20 | : sl(&mut.cs) 21 | { 22 | ; 23 | } 24 | 25 | void NgLock :: Lock () 26 | { 27 | sl.Lock(); 28 | } 29 | void NgLock :: UnLock () 30 | { 31 | sl.Unlock(); 32 | } 33 | 34 | 35 | #else 36 | 37 | #endif 38 | } 39 | 40 | */ 41 | -------------------------------------------------------------------------------- /ng/Togl-1.7/tclconfig/README.txt: -------------------------------------------------------------------------------- 1 | These files comprise the basic building blocks for a Tcl Extension 2 | Architecture (TEA) extension. For more information on TEA see: 3 | 4 | http://www.tcl.tk/doc/tea/ 5 | 6 | This package is part of the Tcl project at SourceForge, and latest 7 | sources should be available there: 8 | 9 | http://tcl.sourceforge.net/ 10 | 11 | This package is a freely available open source package. You can do 12 | virtually anything you like with it, such as modifying it, redistributing 13 | it, and selling it either in whole or in part. 14 | 15 | CONTENTS 16 | ======== 17 | The following is a short description of the files you will find in 18 | the sample extension. 19 | 20 | README.txt This file 21 | 22 | install-sh Program used for copying binaries and script files 23 | to their install locations. 24 | 25 | tcl.m4 Collection of Tcl autoconf macros. Included by a package's 26 | aclocal.m4 to define TEA_* macros. 27 | -------------------------------------------------------------------------------- /libsrc/visualization/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-DNGINTERFACE_EXPORTS) 2 | install(FILES soldata.hpp DESTINATION ${INCDIR} COMPONENT netgen_devel ) 3 | 4 | # AM_CPPFLAGS = $(MPI_INCLUDES) -I$(top_srcdir)/libsrc/include -DOPENGL -D$(TOGL_WINDOWINGSYSTEM) $(OCCFLAGS) $(TCL_INCLUDES) 5 | 6 | if(USE_GUI) 7 | set( LIB_VISUAL_SOURCES meshdoc.cpp mvdraw.cpp vsfieldlines.cpp vsmesh.cpp vssolution.cpp importsolution.cpp ) 8 | else(USE_GUI) 9 | set( LIB_VISUAL_SOURCES visual_dummy.cpp ) 10 | endif(USE_GUI) 11 | 12 | add_library(visual ${NG_LIB_TYPE} ${LIB_VISUAL_SOURCES}) 13 | 14 | if(NOT WIN32) 15 | target_link_libraries( visual ${PYTHON_LIBRARIES} ${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} ${TCL_LIBRARY} ) 16 | install( TARGETS visual ${ng_install_dir}) 17 | endif(NOT WIN32) 18 | 19 | install(FILES 20 | meshdoc.hpp mvdraw.hpp 21 | vispar.hpp visual.hpp vssolution.hpp 22 | DESTINATION ${INCDIR}/visualization COMPONENT netgen_devel 23 | ) 24 | -------------------------------------------------------------------------------- /libsrc/geom2d/vsgeom2d.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_VSGEOM2D 2 | #define FILE_VSGEOM2D 3 | 4 | /**************************************************************************/ 5 | /* File: vsgeom2d.hpp */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 05. Jan. 2011 */ 8 | /**************************************************************************/ 9 | 10 | namespace netgen 11 | { 12 | 13 | class DLL_HEADER VisualSceneGeometry2d : public VisualScene 14 | { 15 | const class SplineGeometry2d * geometry2d; 16 | public: 17 | VisualSceneGeometry2d (); 18 | virtual ~VisualSceneGeometry2d (); 19 | void SetGeometry (const class SplineGeometry2d * ageometry2d) { geometry2d = ageometry2d; } 20 | virtual void BuildScene (int zoomall = 0); 21 | virtual void DrawScene (); 22 | }; 23 | 24 | } 25 | 26 | 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /libsrc/general/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-DNGINTERFACE_EXPORTS) 2 | add_library(gen OBJECT 3 | array.cpp bitarray.cpp dynamicmem.cpp flags.cpp 4 | hashtabl.cpp mystring.cpp ngexception.cpp optmem.cpp parthreads.cpp 5 | profiler.cpp seti.cpp sort.cpp spbita2d.cpp symbolta.cpp table.cpp 6 | mpi_interface.cpp gzstream.cpp 7 | ) 8 | 9 | set_target_properties( gen PROPERTIES POSITION_INDEPENDENT_CODE ON ) 10 | 11 | install( FILES ngexception.hpp DESTINATION ${INCDIR} COMPONENT netgen_devel ) 12 | 13 | install(FILES 14 | archive_base.hpp array.hpp autodiff.hpp autoptr.hpp bitarray.hpp 15 | dynamicmem.hpp flags.hpp hashtabl.hpp mpi_interface.hpp myadt.hpp 16 | mysimd.hpp mystring.hpp netgenout.hpp ngexception.hpp ngpython.hpp 17 | optmem.hpp parthreads.hpp profiler.hpp seti.hpp sort.hpp 18 | spbita2d.hpp stack.hpp symbolta.hpp table.hpp template.hpp 19 | gzstream.h 20 | DESTINATION ${INCDIR}/general COMPONENT netgen_devel 21 | ) 22 | -------------------------------------------------------------------------------- /windows/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by netgen.rc and nglib.rc 4 | // 5 | #define _USE_DECLSPECS_FOR_SAL 0 6 | #define _USE_ATTRIBUTES_FOR_SAL 0 7 | #define VS_VERSION_INFO 1 8 | #define VFFF_ISSHAREDFILE 0x0001 9 | #define VFF_CURNEDEST 0x0001 10 | #define VIFF_FORCEINSTALL 0x0001 11 | #define VFF_FILEINUSE 0x0002 12 | #define VIFF_DONTDELETEOLD 0x0002 13 | #define VFF_BUFFTOOSMALL 0x0004 14 | #define VS_USER_DEFINED 100 15 | 16 | // Next default values for new objects 17 | // 18 | #ifdef APSTUDIO_INVOKED 19 | #ifndef APSTUDIO_READONLY_SYMBOLS 20 | #define _APS_NEXT_RESOURCE_VALUE 101 21 | #define _APS_NEXT_COMMAND_VALUE 40001 22 | #define _APS_NEXT_CONTROL_VALUE 1000 23 | #define _APS_NEXT_SYMED_VALUE 101 24 | #endif 25 | #endif 26 | -------------------------------------------------------------------------------- /libsrc/visualization/meshdoc.hpp: -------------------------------------------------------------------------------- 1 | namespace netgen 2 | 3 | { 4 | 5 | class VisualSceneMeshDoctor : public VisualScene 6 | { 7 | int filledlist; 8 | int outlinelist; 9 | int edgelist; 10 | 11 | int selelement, locpi; 12 | int selpoint, selpoint2; 13 | 14 | // for edgemarking: 15 | Array edgedist; 16 | int markedgedist; 17 | 18 | 19 | public: 20 | DLL_HEADER VisualSceneMeshDoctor (); 21 | DLL_HEADER virtual ~VisualSceneMeshDoctor (); 22 | 23 | DLL_HEADER virtual void BuildScene (int zoomall = 0); 24 | DLL_HEADER virtual void DrawScene (); 25 | DLL_HEADER virtual void MouseDblClick (int px, int py); 26 | 27 | DLL_HEADER void SetMarkEdgeDist (int dist); 28 | DLL_HEADER void ClickElement (int elnr); 29 | DLL_HEADER void UpdateTables (); 30 | DLL_HEADER int IsSegmentMarked (int segnr) const; 31 | }; 32 | 33 | class MeshDoctorParameters 34 | { 35 | public: 36 | int active; 37 | }; 38 | 39 | 40 | DLL_HEADER extern MeshDoctorParameters meshdoctor; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /libsrc/csg/vscsg.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_VSCSG 2 | #define FILE_VSCSG 3 | 4 | /**************************************************************************/ 5 | /* File: vscsg.hpp */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 05. Jan. 2011 */ 8 | /**************************************************************************/ 9 | 10 | namespace netgen 11 | { 12 | 13 | class DLL_HEADER VisualSceneGeometry : public VisualScene 14 | { 15 | class CSGeometry * geometry; 16 | Array trilists; 17 | int selsurf; 18 | public: 19 | VisualSceneGeometry (); 20 | virtual ~VisualSceneGeometry (); 21 | 22 | void SetGeometry (class CSGeometry * ageometry) { geometry = ageometry; } 23 | virtual void SelectSurface (int aselsurf); 24 | virtual void BuildScene (int zoomall = 0); 25 | virtual void DrawScene (); 26 | }; 27 | 28 | 29 | 30 | } 31 | 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /libsrc/include/mystdlib.h: -------------------------------------------------------------------------------- 1 | #ifndef FILE_MYSTDLIB 2 | #define FILE_MYSTDLIB 3 | 4 | #ifdef HAVE_CONFIG_H 5 | #include 6 | #endif 7 | 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #ifdef PARALLEL 33 | // #undef SEEK_SET 34 | // #undef SEEK_CUR 35 | // #undef SEEK_END 36 | #include 37 | #include // for usleep (only for parallel) 38 | #endif 39 | 40 | 41 | 42 | /* 43 | #ifdef METIS 44 | namespace metis { extern "C" { 45 | #include 46 | } } 47 | #endif 48 | */ 49 | 50 | 51 | 52 | #ifndef M_PI 53 | #define M_PI 3.14159265358979323846 54 | #endif 55 | 56 | 57 | using namespace std; 58 | 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /libsrc/general/ngexception.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_NGEXCEPTION 2 | #define FILE_NGEXCEPTION 3 | 4 | /**************************************************************************/ 5 | /* File: ngexception.hpp */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 16. Jan. 2002 */ 8 | /**************************************************************************/ 9 | 10 | namespace netgen 11 | { 12 | 13 | /// Base class for all ng exceptions 14 | class NgException 15 | { 16 | /// verbal description of exception 17 | string what; 18 | public: 19 | /// 20 | DLL_HEADER NgException (const string & s); 21 | /// 22 | DLL_HEADER virtual ~NgException (); 23 | 24 | /// append string to description 25 | DLL_HEADER void Append (const string & s); 26 | // void Append (const char * s); 27 | 28 | /// verbal description of exception 29 | const string & What() const { return what; } 30 | }; 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /libsrc/occ/vsocc.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_VSOCC 2 | #define FILE_VSOCC 3 | 4 | /**************************************************************************/ 5 | /* File: vsocc.hpp */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 05. Jan. 2011 */ 8 | /**************************************************************************/ 9 | 10 | namespace netgen 11 | { 12 | 13 | class VisualSceneOCCGeometry : public VisualScene 14 | { 15 | Array trilists; 16 | Array linelists; 17 | int selsurf; 18 | class OCCGeometry * occgeometry; 19 | public: 20 | VisualSceneOCCGeometry (); 21 | virtual ~VisualSceneOCCGeometry (); 22 | void SetGeometry (class OCCGeometry * ageom) { occgeometry = ageom; } 23 | 24 | virtual void BuildScene (int zoomall = 0); 25 | virtual void DrawScene (); 26 | virtual void MouseDblClick (int px, int py); 27 | }; 28 | 29 | 30 | 31 | } 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /libsrc/general/autoptr.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_AUTOPTR 2 | #define FILE_AUTOPTR 3 | 4 | /**************************************************************************/ 5 | /* File: autoptr.hpp */ 6 | /* Author: STL, Joachim Schoeberl */ 7 | /* Date: 29. Dec. 02 */ 8 | /**************************************************************************/ 9 | 10 | namespace netgen 11 | { 12 | 13 | /* 14 | template 15 | class AutoPtr 16 | { 17 | private: 18 | T * ptr; 19 | public: 20 | typedef T* pT; 21 | explicit AutoPtr (T * p = 0) { ptr = p; } 22 | ~AutoPtr () { delete ptr; } 23 | 24 | T & operator*() const { return *ptr; } 25 | T* operator->() const { return ptr; } 26 | T *& Ptr() { return ptr; } 27 | T * Ptr() const { return ptr; } 28 | void Reset(T * p = 0) { if (p != ptr) { delete ptr; ptr = p; } } 29 | operator bool () { return ptr != 0; } 30 | private: 31 | AutoPtr (AutoPtr &) { ; } 32 | AutoPtr & operator= (AutoPtr &) { ; } 33 | }; 34 | */ 35 | } 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /cmake_modules/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 3 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach(file ${files}) 8 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 9 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 10 | exec_program( 11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 12 | OUTPUT_VARIABLE rm_out 13 | RETURN_VALUE rm_retval 14 | ) 15 | if(NOT "${rm_retval}" STREQUAL 0) 16 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 17 | endif(NOT "${rm_retval}" STREQUAL 0) 18 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 19 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 20 | endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 21 | endforeach(file) 22 | -------------------------------------------------------------------------------- /libsrc/general/seti.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_SETI 2 | #define FILE_SETI 3 | 4 | 5 | /**************************************************************************/ 6 | /* File: seti.hh */ 7 | /* Author: Joachim Schoeberl */ 8 | /* Date: 20. Mar. 98 */ 9 | /**************************************************************************/ 10 | 11 | namespace netgen 12 | { 13 | 14 | /** 15 | Set of Integers 16 | */ 17 | class IndexSet 18 | { 19 | Array set; 20 | BitArray flags; 21 | public: 22 | IndexSet (int maxind); 23 | 24 | ~IndexSet (); 25 | /// increase range to maxind 26 | void SetMaxIndex (int maxind); 27 | int IsIn (int ind) const 28 | { 29 | return flags.Test (ind); 30 | } 31 | 32 | void Add (int ind) 33 | { 34 | if (!flags.Test(ind)) 35 | { 36 | set.Append (ind); 37 | flags.Set (ind); 38 | } 39 | } 40 | 41 | void Del (int ind); 42 | void Clear (); 43 | 44 | const Array & GetArray() { return set; } 45 | }; 46 | 47 | } 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /ng/Togl2.1/overlay.tcl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # the next line restarts using tclsh \ 3 | exec tclsh "$0" "$@" 4 | 5 | # $Id: overlay.tcl,v 1.7 2007/08/03 16:48:50 gregcouch Exp $ 6 | 7 | # Togl - a Tk OpenGL widget 8 | # Copyright (C) 1996 Brian Paul and Ben Bederson 9 | # Copyright (C) 2006-2007 Greg Couch 10 | # See the LICENSE file for copyright details. 11 | 12 | 13 | # A Tk/OpenGL widget demo using an overlay. 14 | 15 | # add parent directory to path to find Togl's pkgIndex in current directory 16 | if { [file exists pkgIndex.tcl] } { 17 | set auto_path [linsert $auto_path 0 ..] 18 | } 19 | # following load also loads Tk and Togl packages 20 | load [file dirname [info script]]/overlay[info sharedlibextension] 21 | 22 | proc setup {} { 23 | wm title . "Overlay demo" 24 | 25 | togl .win -width 200 -height 200 -rgba true -double false -overlay true -create create_cb -reshape reshape_cb -display display_cb -overlaydisplay overlay_display_cb 26 | button .btn -text Quit -command exit 27 | 28 | pack .win -expand true -fill both 29 | pack .btn -expand true -fill both 30 | } 31 | 32 | 33 | # Execution starts here! 34 | # Execution starts here! 35 | if { [info script] == $argv0 } { 36 | setup 37 | } 38 | -------------------------------------------------------------------------------- /libsrc/occ/Partition_Loop.ixx: -------------------------------------------------------------------------------- 1 | // GEOM PARTITION : partition algorithm 2 | // 3 | // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 4 | // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 5 | // 6 | // This library is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 2.1 of the License. 10 | // 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | // Lesser General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Lesser General Public 17 | // License along with this library; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | // 20 | // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 21 | // 22 | // 23 | // 24 | // File : Partition_Loop.ixx 25 | // Module : GEOM 26 | 27 | #include "Partition_Loop.jxx" 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /libsrc/occ/Partition_Inter3d.ixx: -------------------------------------------------------------------------------- 1 | // GEOM PARTITION : partition algorithm 2 | // 3 | // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 4 | // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 5 | // 6 | // This library is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 2.1 of the License. 10 | // 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | // Lesser General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Lesser General Public 17 | // License along with this library; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | // 20 | // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 21 | // 22 | // 23 | // 24 | // File : Partition_Inter3d.ixx 25 | // Module : GEOM 26 | 27 | #include "Partition_Inter3d.jxx" 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /libsrc/occ/Partition_Spliter.ixx: -------------------------------------------------------------------------------- 1 | // GEOM PARTITION : partition algorithm 2 | // 3 | // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 4 | // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 5 | // 6 | // This library is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 2.1 of the License. 10 | // 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | // Lesser General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Lesser General Public 17 | // License along with this library; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | // 20 | // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 21 | // 22 | // 23 | // 24 | // File : Partition_Spliter.ixx 25 | // Module : GEOM 26 | 27 | #include "Partition_Spliter.jxx" 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /libsrc/general/sort.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_SORT 2 | #define FILE_SORT 3 | 4 | /**************************************************************************/ 5 | /* File: sort.hh */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 07. Jan. 00 */ 8 | /**************************************************************************/ 9 | 10 | namespace netgen 11 | { 12 | 13 | // order(i) is sorted index of element i 14 | extern void Sort (const Array & values, 15 | Array & order); 16 | 17 | extern void QuickSort (const Array & values, 18 | Array & order); 19 | 20 | 21 | 22 | 23 | template 24 | inline void BubbleSort (int size, T * data) 25 | { 26 | T hv; 27 | for (int i = 0; i < size; i++) 28 | for (int j = i+1; j < size; j++) 29 | if (data[i] > data[j]) 30 | { 31 | hv = data[i]; 32 | data[i] = data[j]; 33 | data[j] = hv; 34 | } 35 | } 36 | 37 | template 38 | inline void BubbleSort (Array & data) 39 | { 40 | if(data.Size() > 0) 41 | BubbleSort (data.Size(), &data[data.Begin()]); 42 | } 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /libsrc/occ/Partition_Inter2d.ixx: -------------------------------------------------------------------------------- 1 | // GEOM PARTITION : partition algorithm 2 | // 3 | // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 4 | // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 5 | // 6 | // This library is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 2.1 of the License. 10 | // 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | // Lesser General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Lesser General Public 17 | // License along with this library; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | // 20 | // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 21 | // 22 | // 23 | // 24 | // File : Partition_Inter2d.ixx 25 | // Module : GEOM 26 | 27 | #include 28 | #include "Partition_Inter2d.jxx" 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /ng/Togl-1.7/tkMacOSX.h: -------------------------------------------------------------------------------- 1 | /* This file isn't installed by default */ 2 | /* 3 | * tkMacOSXInt.h -- 4 | * 5 | * Declarations of Macintosh specific exported variables and procedures. 6 | * 7 | * Copyright (c) 1995-1997 Sun Microsystems, Inc. 8 | * Copyright 2001, Apple Computer, Inc. 9 | * 10 | * See the file "license.terms" for information on usage and redistribution 11 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES. 12 | * 13 | * RCS: @(#) $Id: tkMacOSX.h,v 1.1 2005/04/22 02:00:07 gregcouch Exp $ 14 | */ 15 | 16 | #ifndef _TKMAC 17 | #define _TKMAC 18 | 19 | #include 20 | #include "tkInt.h" 21 | 22 | /* 23 | * Structures and function types for handling Netscape-type in process 24 | * embedding where Tk does not control the top-level 25 | */ 26 | 27 | typedef int (Tk_MacOSXEmbedRegisterWinProc) (int winID, Tk_Window window); 28 | typedef GWorldPtr (Tk_MacOSXEmbedGetGrafPortProc) (Tk_Window window); 29 | typedef int (Tk_MacOSXEmbedMakeContainerExistProc) (Tk_Window window); 30 | typedef void (Tk_MacOSXEmbedGetClipProc) (Tk_Window window, RgnHandle rgn); 31 | typedef void (Tk_MacOSXEmbedGetOffsetInParentProc) (Tk_Window window, Point *ulCorner); 32 | 33 | #include "tkPlatDecls.h" 34 | 35 | #endif /* _TKMAC */ 36 | -------------------------------------------------------------------------------- /py_tutorials/opengl_thread.py: -------------------------------------------------------------------------------- 1 | from netgen.csg import * 2 | import netgen.meshing as meshing 3 | import libvisual 4 | 5 | from OpenGL.GLUT import * 6 | 7 | # import Window class from other file 8 | from opengl_window import Window 9 | 10 | sp1 = Sphere (Pnt(0,0,0), 0.2) 11 | sp2 = Sphere (Pnt(0.5,0,0), 0.2) 12 | 13 | all = sp1+sp2 14 | 15 | geom = CSGeometry() 16 | geom.Add (all) 17 | 18 | 19 | param = meshing.MeshingParameters() 20 | param.maxh = 0.1 21 | m1 = GenerateMesh (geom, param) 22 | 23 | 24 | vis = VS(geom) 25 | 26 | 27 | # window callback functions 28 | def mydraw(): 29 | vis.Draw() 30 | glutSwapBuffers() 31 | 32 | def mymouse(xold, yold, x, y, mode): 33 | MouseMove(vis,xold,yold, x,y, mode) 34 | 35 | 36 | ########################################### 37 | glutInit("mainwin") 38 | 39 | # IMPORTANT: create window in the mainloop - thread! 40 | 41 | ## not working: 42 | #win_geom = Window( name=b"ngs", drawfunc=mydraw, mousefunc=mymouse) 43 | 44 | def runVisualization(): 45 | ## working: 46 | win_geom = Window( name=b"ngs", drawfunc=mydraw, mousefunc=mymouse) 47 | glutMainLoop() 48 | 49 | # create thread 50 | from threading import Thread 51 | thread = Thread(target = runVisualization) 52 | thread.start() 53 | thread.join() 54 | -------------------------------------------------------------------------------- /libsrc/meshing/meshfunc.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_MESHFUNC 2 | #define FILE_MESHFUNC 3 | 4 | /**************************************************************************/ 5 | /* File: meshfunc.hpp */ 6 | /* Author: Johannes Gerstmayr, Joachim Schoeberl */ 7 | /* Date: 26. Jan. 98 */ 8 | /**************************************************************************/ 9 | 10 | 11 | /* 12 | Functions for mesh-generations strategies 13 | */ 14 | 15 | class Mesh; 16 | // class CSGeometry; 17 | 18 | /// Build tet-mesh 19 | MESHING3_RESULT MeshVolume (MeshingParameters & mp, Mesh& mesh3d); 20 | 21 | /// Build mixed-element mesh 22 | // MESHING3_RESULT MeshMixedVolume (MeshingParameters & mp, Mesh& mesh3d); 23 | 24 | /// Optimize tet-mesh 25 | MESHING3_RESULT OptimizeVolume (MeshingParameters & mp, Mesh& mesh3d); 26 | // const CSGeometry * geometry = NULL); 27 | 28 | void RemoveIllegalElements (Mesh & mesh3d); 29 | 30 | 31 | enum MESHING_STEP { 32 | MESHCONST_ANALYSE = 1, 33 | MESHCONST_MESHEDGES = 2, 34 | MESHCONST_MESHSURFACE = 3, 35 | MESHCONST_OPTSURFACE = 4, 36 | MESHCONST_MESHVOLUME = 5, 37 | MESHCONST_OPTVOLUME = 6 38 | }; 39 | 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /ng/Togl-1.7/README.stubs: -------------------------------------------------------------------------------- 1 | This version of Togl is entirely free from 2 | dependencies on Tcl/Tk's internal functions. It uses the public stubs 3 | interface, witch means that the same binary works with any stubs-aware 4 | wish (i.e. version >= 8.1) 5 | 6 | It has been tested on Windows NT/2000 and Linux for several Tcl/Tk versions up 7 | to 8.4a3. I haven't been able to test the Mac port, it propably needs mending 8 | but I can't see why it shouldn't work in principle. 9 | 10 | Implementation wise, what differs from Togl 1.5 is that Togl_MakeWindowExist() 11 | is replaced by Togl_CreateWindow(), a function that gets registered in Tk as a callback for window creation. In Tk/Tk 8.4a3, there is a new public API call 12 | Tk_SetClassProcs() to register this callback, but for earlier versions of Tk 13 | one needs to do this using some pointer magic. 14 | There is a run-time check to determine which method to use, hence the 15 | same binary runs on all versions of Wish from 8.1 and up. For this to 16 | work you need to compile against the headers from Tcl/Tk 8.4a3 or later, or 17 | the binary will only work for Tcl/Tk 8.1-8.4a2. 18 | The tk8.4a3 public headers (tk8.4a3.h + tkDecls.h) are included for 19 | conveniance, and they are used if the flag -DUSE_LOCAL_TK_H is specified. 20 | 21 | Jonas Beskow, December 2001 -------------------------------------------------------------------------------- /ng/Togl2.1/README.stubs: -------------------------------------------------------------------------------- 1 | This version of Togl is entirely free from 2 | dependencies on Tcl/Tk's internal functions. It uses the public stubs 3 | interface, witch means that the same binary works with any stubs-aware 4 | wish (i.e. version >= 8.1) 5 | 6 | It has been tested on Windows NT/2000 and Linux for several Tcl/Tk versions up 7 | to 8.4a3. I haven't been able to test the Mac port, it propably needs mending 8 | but I can't see why it shouldn't work in principle. 9 | 10 | Implementation wise, what differs from Togl 1.5 is that Togl_MakeWindowExist() 11 | is replaced by Togl_CreateWindow(), a function that gets registered in Tk as a callback for window creation. In Tk/Tk 8.4a3, there is a new public API call 12 | Tk_SetClassProcs() to register this callback, but for earlier versions of Tk 13 | one needs to do this using some pointer magic. 14 | There is a run-time check to determine which method to use, hence the 15 | same binary runs on all versions of Wish from 8.1 and up. For this to 16 | work you need to compile against the headers from Tcl/Tk 8.4a3 or later, or 17 | the binary will only work for Tcl/Tk 8.1-8.4a2. 18 | The tk8.4a3 public headers (tk8.4a3.h + tkDecls.h) are included for 19 | conveniance, and they are used if the flag -DUSE_LOCAL_TK_H is specified. 20 | 21 | Jonas Beskow, December 2001 -------------------------------------------------------------------------------- /libsrc/csg/triapprox.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | 8 | namespace netgen 9 | { 10 | 11 | TriangleApproximation :: TriangleApproximation () 12 | { 13 | ; 14 | } 15 | 16 | int TriangleApproximation :: 17 | AddTriangle (const TATriangle & tri, bool invert) 18 | { 19 | trigs.Append (tri); 20 | if (invert) 21 | { 22 | trigs.Last()[1] = tri[2]; 23 | trigs.Last()[2] = tri[1]; 24 | } 25 | return trigs.Size()-1; 26 | } 27 | 28 | 29 | void TriangleApproximation :: RemoveUnusedPoints () 30 | { 31 | BitArray used(GetNP()); 32 | Array map (GetNP()); 33 | int i, j; 34 | int cnt = 0; 35 | 36 | used.Clear(); 37 | for (i = 0; i < GetNT(); i++) 38 | for (j = 0; j < 3; j++) 39 | used.Set (GetTriangle (i)[j]); 40 | 41 | for (i = 0; i < GetNP(); i++) 42 | if (used.Test(i)) 43 | map[i] = cnt++; 44 | 45 | for (i = 0; i < GetNT(); i++) 46 | for (j = 0; j < 3; j++) 47 | trigs[i][j] = map[trigs[i][j]]; 48 | 49 | for (i = 0; i < GetNP(); i++) 50 | if (used.Test(i)) 51 | { 52 | points[map[i]] = points[i]; 53 | normals[map[i]] = normals[i]; 54 | } 55 | 56 | points.SetSize (cnt); 57 | normals.SetSize (cnt); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /libsrc/csg/csg.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_CSG 2 | #define FILE_CSG 3 | 4 | /* *************************************************************************/ 5 | /* File: geoml.hpp */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 21. Jun. 98 */ 8 | /* *************************************************************************/ 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | // #include 15 | #include "../gprim/spline.hpp" 16 | #include "../gprim/splinegeometry.hpp" 17 | 18 | 19 | 20 | #include "surface.hpp" 21 | #include "solid.hpp" 22 | #include "identify.hpp" 23 | #include "singularref.hpp" 24 | #include "csgeom.hpp" 25 | #include "csgparser.hpp" 26 | 27 | #include "triapprox.hpp" 28 | #include "algprim.hpp" 29 | #include "splinesurface.hpp" 30 | #include "brick.hpp" 31 | #include "spline3d.hpp" 32 | #include "manifold.hpp" 33 | #include "curve2d.hpp" 34 | #include "explicitcurve2d.hpp" 35 | #include "gencyl.hpp" 36 | #include "polyhedra.hpp" 37 | #include "extrusion.hpp" 38 | #include "revolution.hpp" 39 | #include "specpoin.hpp" 40 | #include "edgeflw.hpp" 41 | #include "meshsurf.hpp" 42 | 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /libsrc/general/symbolta.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /* File: symbolta.cc */ 3 | /* Author: Joachim Schoeberl */ 4 | /* Date: 01. Jun. 95 */ 5 | /**************************************************************************/ 6 | 7 | /* 8 | Abstract data type Symbol Table 9 | */ 10 | 11 | #include 12 | #include 13 | 14 | 15 | #ifndef FILE_SYMBOLTABLECC 16 | #define FILE_SYMBOLTABLECC 17 | // necessary for SGI ???? 18 | 19 | 20 | namespace netgen 21 | { 22 | //using namespace netgen; 23 | 24 | BASE_SYMBOLTABLE :: BASE_SYMBOLTABLE () 25 | { 26 | ; 27 | } 28 | 29 | 30 | BASE_SYMBOLTABLE :: ~BASE_SYMBOLTABLE() 31 | { 32 | DelNames(); 33 | } 34 | 35 | 36 | void BASE_SYMBOLTABLE :: DelNames() 37 | { 38 | for (int i = 0; i < names.Size(); i++) 39 | delete [] names[i]; 40 | names.SetSize (0); 41 | } 42 | 43 | int BASE_SYMBOLTABLE :: Index (const char * name) const 44 | { 45 | if (!name) return 0; 46 | for (int i = 0; i < names.Size(); i++) 47 | if (strcmp (names[i], name) == 0) return i+1; 48 | return 0; 49 | } 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /libsrc/general/seti.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | 5 | namespace netgen 6 | { 7 | //using namespace netgen; 8 | 9 | IndexSet :: IndexSet (int maxind) 10 | { 11 | SetMaxIndex (maxind); 12 | } 13 | 14 | IndexSet :: ~IndexSet () 15 | { 16 | Clear(); 17 | } 18 | 19 | 20 | void IndexSet :: SetMaxIndex (int maxind) 21 | { 22 | if (maxind > flags.Size()) 23 | { 24 | flags.SetSize (2 * maxind); 25 | flags.Clear(); 26 | } 27 | } 28 | 29 | /* 30 | int IndexSet :: IsIn (int ind) const 31 | { 32 | return flags.Test (ind); 33 | } 34 | */ 35 | 36 | /* 37 | void IndexSet :: Add (int ind) 38 | { 39 | if (ind > flags.Size()) 40 | { 41 | cerr << "out of range" << endl; 42 | exit (1); 43 | } 44 | 45 | if (!flags.Test(ind)) 46 | { 47 | set.Append (ind); 48 | flags.Set (ind); 49 | } 50 | } 51 | */ 52 | 53 | void IndexSet :: Del (int ind) 54 | { 55 | for (int i = 1; i <= set.Size(); i++) 56 | if (set.Get(i) == ind) 57 | { 58 | set.DeleteElement (ind); 59 | break; 60 | } 61 | flags.Clear (ind); 62 | } 63 | 64 | void IndexSet :: Clear () 65 | { 66 | for (int i = 1; i <= set.Size(); i++) 67 | flags.Clear (set.Get(i)); 68 | set.SetSize (0); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /libsrc/meshing/clusters.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CLUSTERS 2 | #define CLUSTERS 3 | 4 | /**************************************************************************/ 5 | /* File: clusers.hh */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 28. Apr. 01 */ 8 | /**************************************************************************/ 9 | 10 | /* 11 | Anisotropic clusters 12 | 13 | nodes, edges, faces, elements 14 | */ 15 | 16 | 17 | class AnisotropicClusters 18 | { 19 | const Mesh & mesh; 20 | 21 | int nv, ned, nfa, ne; 22 | 23 | // connected nodes, nodes = vertices, edges, faces, elements 24 | Array cluster_reps; 25 | 26 | public: 27 | AnisotropicClusters (const Mesh & amesh); 28 | ~AnisotropicClusters(); 29 | 30 | void Update(TaskManager tm = &DummyTaskManager); 31 | 32 | int GetVertexRepresentant (int vnr) const 33 | { return cluster_reps.Get(vnr); } 34 | int GetEdgeRepresentant (int ednr) const 35 | { return cluster_reps.Get(nv+ednr); } 36 | int GetFaceRepresentant (int fnr) const 37 | { return cluster_reps.Get(nv+ned+fnr); } 38 | int GetElementRepresentant (int enr) const 39 | { return cluster_reps.Get(nv+ned+nfa+enr); } 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /libsrc/include/mydefs.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_MYDEFS 2 | #define FILE_MYDEFS 3 | 4 | /**************************************************************************/ 5 | /* File: mydefs.hh */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 10. Mar. 98 */ 8 | /**************************************************************************/ 9 | 10 | /* 11 | defines for graphics, testmodes, ... 12 | */ 13 | 14 | 15 | // #define DEBUG 16 | 17 | #ifdef WIN32 18 | #if NGINTERFACE_EXPORTS || NGLIB_EXPORTS || nglib_EXPORTS 19 | #define DLL_HEADER __declspec(dllexport) 20 | #else 21 | #define DLL_HEADER __declspec(dllimport) 22 | #endif 23 | #else 24 | #define DLL_HEADER 25 | #endif 26 | 27 | 28 | 29 | 30 | #ifndef __assume 31 | #ifdef __GNUC__ 32 | #define __assume(cond) if (!(cond)) __builtin_unreachable(); else; 33 | #else 34 | #define __assume(cond) 35 | #endif 36 | #endif 37 | 38 | 39 | 40 | 41 | // #define BASE0 42 | // #define DEBUG 43 | 44 | 45 | #define noDEMOVERSION 46 | #define noDEVELOP 47 | #define noSTEP 48 | #define noSOLIDGEOM 49 | 50 | #define noDEMOAPP 51 | #define noMODELLER 52 | 53 | #define noSTAT_STREAM 54 | #define noLOG_STREAM 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /rules/makerlsfile.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | #define maxlen 1000 8 | 9 | int main (int argc, char ** argv) 10 | { 11 | if (argc != 3) 12 | { 13 | cout << "use: makerlsfile infile outfile" << endl; 14 | exit(1); 15 | } 16 | 17 | 18 | char line[maxlen], infile[maxlen], outfile[maxlen];\ 19 | char ch; 20 | int i, j; 21 | 22 | /* 23 | cout << "infile: "; 24 | cin >> infile; 25 | cout << "outfile: "; 26 | cin >> outfile; 27 | */ 28 | 29 | ifstream inf (argv[1]); 30 | ofstream outf (argv[2]); 31 | 32 | outf << "const char * ngscript[] = {" << endl; 33 | while (inf.good()) 34 | { 35 | i = 0; 36 | 37 | inf.get(ch); 38 | while (ch != '\n' && inf.good() && i < maxlen) 39 | { 40 | if (ch == '\"') 41 | { 42 | line[i] = '\\'; 43 | line[i+1] = '\"'; 44 | i+= 2; 45 | } 46 | else if (ch == '\\') 47 | { 48 | line[i] = '\\'; 49 | line[i+1] = '\\'; 50 | i+= 2; 51 | } 52 | else 53 | { 54 | line[i] = ch; 55 | i++; 56 | } 57 | inf.get(ch); 58 | } 59 | line[i] = 0; 60 | cout << line << endl; 61 | outf << "\"" << line << "\\n\",\\" << endl; 62 | } 63 | outf << "0};" << endl; 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /tutorials/squarecircle.in2d: -------------------------------------------------------------------------------- 1 | # keyword for 2D geometry, version 2 2 | splinecurves2dv2 3 | 4 | 5 | # a global grading factor 6 | 2 7 | 8 | 9 | # the points (point number, x and y coordinates) 10 | points 11 | 1 0 0 12 | 2 1 0 13 | 3 1 1 14 | 4 0 1 15 | 5 0.5 0.4 16 | 6 0.6 0.4 17 | 7 0.6 0.5 18 | 8 0.6 0.6 19 | 9 0.5 0.6 20 | 10 0.4 0.6 21 | 11 0.4 0.5 22 | 12 0.4 0.4 23 | 24 | 25 | # boundary curves consisting of 26 | # dl dr np p1 p1 flaglist 27 | # with 28 | # dl ... sub-domain nr on left side 29 | # dr ... sub-domain nr on right side 30 | # np ... curve is given by 2 (or 3) points 31 | # p1, p2 ... points defining the curve 32 | 33 | # flagslist 34 | segments 35 | 1 0 2 1 2 -bc=1 36 | 1 0 2 2 3 -bc=1 37 | 1 0 2 3 4 -bc=1 38 | 1 0 2 4 1 -bc=1 39 | 2 1 3 5 6 7 -bc=2 40 | 2 1 3 7 8 9 -bc=2 41 | 2 1 3 9 10 11 -bc=2 42 | 2 1 3 11 12 5 -bc=2 43 | 44 | materials 45 | 1 domain1 -maxh=0.2 46 | 2 domain2 -maxh=0.05 47 | 48 | 49 | -------------------------------------------------------------------------------- /tutorials/squarehole.in2d: -------------------------------------------------------------------------------- 1 | # keyword for 2D geometry, version 2 2 | splinecurves2dv2 3 | 4 | 5 | # a global grading factor 6 | 2 7 | 8 | 9 | # the points (point number, x and y coordinates) 10 | points 11 | 1 0 0 12 | 2 1 0 13 | 3 1 1 14 | 4 0 1 15 | 5 0.5 0.4 16 | 6 0.6 0.4 17 | 7 0.6 0.5 18 | 8 0.6 0.6 19 | 9 0.5 0.6 20 | 10 0.4 0.6 21 | 11 0.4 0.5 22 | 12 0.4 0.4 23 | 24 | 25 | # boundary curves consisting of 26 | # dl dr np p1 p1 flaglist 27 | # with 28 | # dl ... sub-domain nr on left side 29 | # dr ... sub-domain nr on right side 30 | # np ... curve is given by 2 (or 3) points 31 | # p1, p2 ... points defining the curve 32 | 33 | # flagslist 34 | segments 35 | 1 0 2 1 2 -bc=1 36 | 1 0 2 2 3 -bc=1 37 | 1 0 2 3 4 -bc=1 38 | 1 0 2 4 1 -bc=1 39 | 0 1 3 5 6 7 -bc=2 -maxh=0.05 40 | 0 1 3 7 8 9 -bc=2 -maxh=0.05 41 | 0 1 3 9 10 11 -bc=2 -maxh=0.05 42 | 0 1 3 11 12 5 -bc=2 -maxh=0.05 43 | 44 | materials 45 | 1 domain1 -maxh=0.2 46 | 47 | 48 | -------------------------------------------------------------------------------- /cmake_modules/tkdnd_macosx.patch: -------------------------------------------------------------------------------- 1 | diff -Naur orig/tkdnd2.8/configure changed/tkdnd2.8/configure 2 | --- tkdnd2.8/configure 2015-05-13 19:24:32.000000000 +0200 3 | +++ tkdnd2.8/configure 2016-02-22 15:26:37.000000000 +0100 4 | @@ -6145,7 +6145,7 @@ 5 | 6 | 7 | 8 | - PKG_CFLAGS="$PKG_CFLAGS -DMAC_TK_COCOA -std=gnu99 -x objective-c -fobjc-gc" 9 | + PKG_CFLAGS="$PKG_CFLAGS -DMAC_TK_COCOA -std=gnu99 -x objective-c" 10 | 11 | 12 | 13 | diff -Naur orig/tkdnd2.8/configure.in changed/tkdnd2.8/configure.in 14 | --- tkdnd2.8/configure.in 2015-05-13 19:24:32.000000000 +0200 15 | +++ tkdnd2.8/configure.in 2016-02-22 15:26:44.000000000 +0100 16 | @@ -126,7 +126,7 @@ 17 | 18 | if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then 19 | TEA_ADD_SOURCES([macosx/macdnd.m]) 20 | - TEA_ADD_CFLAGS([-DMAC_TK_COCOA -std=gnu99 -x objective-c -fobjc-gc]) 21 | + TEA_ADD_CFLAGS([-DMAC_TK_COCOA -std=gnu99 -x objective-c]) 22 | TEA_ADD_LIBS([-framework Cocoa -framework Carbon]) 23 | fi 24 | 25 | diff -Naur orig/tkdnd2.8/macosx/macdnd.m changed/tkdnd2.8/macosx/macdnd.m 26 | --- tkdnd2.8/macosx/macdnd.m 2015-07-06 21:49:14.000000000 +0200 27 | +++ tkdnd2.8/macosx/macdnd.m 2016-02-22 15:27:04.000000000 +0100 28 | @@ -16,6 +16,7 @@ 29 | #import 30 | #import 31 | #import 32 | +#undef panic 33 | #import 34 | #import 35 | 36 | -------------------------------------------------------------------------------- /libsrc/general/myadt.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_MYADT 2 | #define FILE_MYADT 3 | 4 | /**************************************************************************/ 5 | /* File: myadt.hpp */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 01. Jun. 95 */ 8 | /**************************************************************************/ 9 | 10 | /* 11 | include for all abstract data types 12 | */ 13 | 14 | 15 | 16 | #include "../include/mystdlib.h" 17 | #include "../include/mydefs.hpp" 18 | 19 | 20 | #include "ngexception.hpp" 21 | #include "parthreads.hpp" 22 | // #include "moveablemem.hpp" 23 | #include "dynamicmem.hpp" 24 | 25 | #include "template.hpp" 26 | #include "array.hpp" 27 | #include "table.hpp" 28 | #include "hashtabl.hpp" 29 | 30 | 31 | #include "symbolta.hpp" 32 | #include "bitarray.hpp" 33 | #include "flags.hpp" 34 | #include "spbita2d.hpp" 35 | 36 | #include "seti.hpp" 37 | #include "optmem.hpp" 38 | #include "autoptr.hpp" 39 | #include "sort.hpp" 40 | #include "stack.hpp" 41 | #include "mystring.hpp" 42 | #include "profiler.hpp" 43 | 44 | #include "mpi_interface.hpp" 45 | #include "netgenout.hpp" 46 | #include "gzstream.h" 47 | #include "archive_base.hpp" 48 | 49 | #include "mysimd.hpp" 50 | 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /libsrc/include/incopengl.hpp: -------------------------------------------------------------------------------- 1 | #ifndef INCOPENGL_HPP___ 2 | #define INCOPENGL_HPP___ 3 | #define GL_GLEXT_PROTOTYPES 4 | 5 | #include 6 | 7 | # if defined(TOGL_AGL) || defined(TOGL_AGL_CLASSIC) || defined(TOGL_NSOPENGL) 8 | # include 9 | # include 10 | # else 11 | # include 12 | # include 13 | # endif 14 | 15 | 16 | #ifdef TOGL_X11 17 | // parallel 18 | #define GLX_GLXEXT_PROTOTYPES 19 | #include 20 | #include 21 | #endif 22 | 23 | #ifdef WIN32 24 | // part of OpenGL 1.2, but not in Microsoft's OpenGL 1.1 header: 25 | // GL version sould be checked at runtime 26 | #define GL_CLAMP_TO_EDGE 0x812F 27 | #define GL_ARRAY_BUFFER 0x8892 28 | #define GL_ELEMENT_ARRAY_BUFFER 0x8893 29 | #define GL_STATIC_DRAW 0x88E4 30 | typedef ptrdiff_t GLintptr; 31 | typedef ptrdiff_t GLsizeiptr; 32 | extern void (*glBindBuffer) (GLenum a, GLuint b); 33 | extern void (*glDeleteBuffers) (GLsizei a, const GLuint *b); 34 | extern void (*glGenBuffers) (GLsizei a, GLuint *b); 35 | extern void (*glBufferData) (GLenum a, GLsizeiptr b, const GLvoid *c, GLenum d); 36 | extern void (*glBufferSubData) (GLenum a, GLintptr b, GLsizeiptr c, const GLvoid *d); 37 | #endif 38 | DLL_HEADER void LoadOpenGLFunctionPointers(); 39 | #endif // INCOPENGL_HPP___ 40 | -------------------------------------------------------------------------------- /libsrc/geom2d/geom2dpkg.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "vsgeom2d.hpp" 7 | 8 | // extern "C" int Ng_CSG_Init (Tcl_Interp * interp); 9 | 10 | namespace netgen 11 | { 12 | 13 | 14 | // extern DLL_HEADER NetgenGeometry * ng_geometry; 15 | static VisualSceneGeometry2d vsgeom2d; 16 | 17 | 18 | 19 | 20 | 21 | class SplineGeometryVisRegister : public GeometryRegister 22 | { 23 | public: 24 | virtual NetgenGeometry * Load (string filename) const { return NULL; } 25 | virtual VisualScene * GetVisualScene (const NetgenGeometry * geom) const; 26 | }; 27 | 28 | 29 | VisualScene * SplineGeometryVisRegister :: GetVisualScene (const NetgenGeometry * geom) const 30 | { 31 | const SplineGeometry2d * geometry = dynamic_cast (geom); 32 | if (geometry) 33 | { 34 | vsgeom2d.SetGeometry (geometry); 35 | return &vsgeom2d; 36 | } 37 | return NULL; 38 | } 39 | 40 | 41 | } 42 | 43 | 44 | using namespace netgen; 45 | #ifdef WIN32 46 | extern "C" __declspec(dllexport) int Ng_geom2d_Init (Tcl_Interp * interp); 47 | #else 48 | extern "C" int Ng_geom2d_Init (Tcl_Interp * interp); 49 | #endif 50 | 51 | int Ng_geom2d_Init (Tcl_Interp * interp) 52 | { 53 | geometryregister.Append (new SplineGeometryVisRegister); 54 | return TCL_OK; 55 | } 56 | -------------------------------------------------------------------------------- /libsrc/meshing/meshing.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_MESHING 2 | #define FILE_MESHING 3 | 4 | 5 | 6 | #include "../include/myadt.hpp" 7 | #include "../include/gprim.hpp" 8 | #include "../include/linalg.hpp" 9 | #include "../include/opti.hpp" 10 | 11 | 12 | 13 | namespace netgen 14 | { 15 | // extern int printmessage_importance; 16 | 17 | // class CSGeometry; 18 | class NetgenGeometry; 19 | } 20 | 21 | 22 | #include "msghandler.hpp" 23 | #include "meshtype.hpp" 24 | #include "localh.hpp" 25 | #include "topology.hpp" 26 | #include "meshclass.hpp" 27 | #include "global.hpp" 28 | 29 | 30 | namespace netgen 31 | { 32 | #include "meshtool.hpp" 33 | #include "ruler2.hpp" 34 | #include "adfront2.hpp" 35 | #include "meshing2.hpp" 36 | #include "improve2.hpp" 37 | 38 | 39 | #include "geomsearch.hpp" 40 | #include "adfront3.hpp" 41 | #include "ruler3.hpp" 42 | 43 | #define _INCLUDE_MORE 44 | 45 | 46 | #include "meshing3.hpp" 47 | #include "improve3.hpp" 48 | 49 | #include "findip.hpp" 50 | #include "findip2.hpp" 51 | 52 | #include "curvedelems.hpp" 53 | #include "clusters.hpp" 54 | 55 | #include "meshfunc.hpp" 56 | 57 | #include "bisect.hpp" 58 | #include "hprefinement.hpp" 59 | #include "boundarylayer.hpp" 60 | #include "specials.hpp" 61 | } 62 | 63 | #include "validate.hpp" 64 | #include "basegeom.hpp" 65 | 66 | #ifdef PARALLEL 67 | #include "paralleltop.hpp" 68 | #endif 69 | 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /libsrc/general/optmem.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_OPTMEM 2 | #define FILE_OPTMEM 3 | 4 | /**************************************************************************/ 5 | /* File: optmem.hh */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 04. Apr. 97 */ 8 | /**************************************************************************/ 9 | 10 | namespace netgen 11 | { 12 | 13 | /** 14 | Optimized Memory allocation classes 15 | */ 16 | 17 | class BlockAllocator 18 | { 19 | private: 20 | /// 21 | unsigned size, blocks; 22 | /// 23 | void * freelist; 24 | /// 25 | Array bablocks; 26 | public: 27 | /// 28 | BlockAllocator (unsigned asize, unsigned ablocks = 100); 29 | /// 30 | ~BlockAllocator (); 31 | /// 32 | 33 | void * Alloc (); 34 | /* 35 | { 36 | if (!freelist) 37 | Alloc2(); 38 | 39 | void * p = freelist; 40 | // freelist = *(void**)freelist; 41 | freelist = *static_cast (freelist); 42 | 43 | return p; 44 | } 45 | */ 46 | 47 | 48 | /// 49 | void Free (void * p); 50 | /* 51 | { 52 | if (!bablocks.Size()) return; 53 | *(void**)p = freelist; 54 | freelist = p; 55 | } 56 | */ 57 | 58 | 59 | private: 60 | // void Alloc2 (); 61 | }; 62 | 63 | } 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /libsrc/interface/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-DNGINTERFACE_EXPORTS) 2 | add_library(interface ${NG_LIB_TYPE} 3 | # $ 4 | # $ 5 | # $ 6 | # $ 7 | # $ 8 | # $ 9 | nginterface.cpp nginterface_v2.cpp 10 | read_fnf_mesh.cpp readtetmesh.cpp readuser.cpp writeabaqus.cpp writediffpack.cpp 11 | writedolfin.cpp writeelmer.cpp writefeap.cpp writefluent.cpp writegmsh.cpp writejcm.cpp 12 | writepermas.cpp writetecplot.cpp writetet.cpp writetochnog.cpp writeuser.cpp 13 | wuchemnitz.cpp writegmsh2.cpp writeOpenFOAM15x.cpp 14 | ) 15 | 16 | # TARGET_LINK_LIBRARIES(interface ${MPI_CXX_LIBRARIES} ${PYTHON_LIBS}) 17 | # TARGET_LINK_LIBRARIES( interface ${LIBPTHREAD} ${OCC_LIBRARIES} ${LIBTOGL} ${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} ${TK_LIBRARY} ${TCL_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${X11_Xmu_LIB} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} ) 18 | if(NOT WIN32) 19 | target_link_libraries(interface mesh csg geom2d) 20 | if(USE_GUI) 21 | target_link_libraries(interface visual) 22 | endif(USE_GUI) 23 | install( TARGETS interface ${ng_install_dir}) 24 | endif(NOT WIN32) 25 | 26 | install(FILES 27 | writeuser.hpp 28 | DESTINATION ${INCDIR}/interface COMPONENT netgen_devel 29 | ) 30 | -------------------------------------------------------------------------------- /libsrc/include/parallelinterface.hpp: -------------------------------------------------------------------------------- 1 | gibt's nicht mehr 2 | 3 | 4 | #ifndef FILE_PARALLELINTERFACE 5 | #define FILE_PARALLELINTERFACE 6 | 7 | #ifdef PARALLEL 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | // this interface is 0-base !! 14 | 15 | 16 | int NgPar_GetLoc2Glob_VolEl ( int locnum ); 17 | 18 | // int NgPar_GetDistantNodeNums ( int nt, int locnum, int * procs, int * distnum); 19 | 20 | // number on distant processor 21 | 22 | // gibt anzahl an distant pnums zurueck 23 | // * pnums entspricht ARRAY 24 | int NgPar_GetDistantNodeNums ( int nodetype, int locnum, int * pnums ); 25 | int NgPar_GetNDistantNodeNums ( int nodetype, int locnum ); 26 | 27 | int NgPar_GetDistantPNum ( int proc, int locnum ) ; 28 | int NgPar_GetDistantEdgeNum ( int proc, int locnum ) ; 29 | int NgPar_GetDistantFaceNum ( int proc, int locnum ) ; 30 | int NgPar_GetDistantElNum ( int proc, int locnum ); 31 | 32 | bool NgPar_IsExchangeFace ( int fnr ) ; 33 | bool NgPar_IsExchangeVert ( int vnum ); 34 | bool NgPar_IsExchangeEdge ( int ednum ); 35 | bool NgPar_IsExchangeElement ( int elnum ); 36 | 37 | void NgPar_PrintParallelMeshTopology (); 38 | bool NgPar_IsElementInPartition ( int elnum, int dest ); 39 | 40 | bool NgPar_IsGhostFace ( int facenum ); 41 | bool NgPar_IsGhostEdge ( int edgenum ); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif 46 | 47 | #endif 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /libsrc/linalg/polynomial.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_POLYNOMIAL 2 | #define FILE_POLYNOMIAL 3 | 4 | /* *************************************************************************/ 5 | /* File: polynomial.hh */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 25. Nov. 99 */ 8 | /* *************************************************************************/ 9 | 10 | 11 | class QuadraticPolynomial1V 12 | { 13 | double c, cx, cxx; 14 | public: 15 | QuadraticPolynomial1V (double ac, double acx, double acxx); 16 | double Value (double x); 17 | double MaxUnitInterval (); 18 | }; 19 | 20 | class LinearPolynomial2V 21 | { 22 | double c, cx, cy; 23 | public: 24 | LinearPolynomial2V (double ac, double acx, double acy); 25 | friend class QuadraticPolynomial2V; 26 | }; 27 | 28 | 29 | class QuadraticPolynomial2V 30 | { 31 | double c, cx, cy, cxx, cxy, cyy; 32 | public: 33 | QuadraticPolynomial2V (); 34 | QuadraticPolynomial2V (double ac, double acx, double acy, 35 | double acxx, double acxy, double acyy); 36 | void Square (const LinearPolynomial2V & lp); 37 | void Add (double lam, const QuadraticPolynomial2V & qp); 38 | 39 | double Value (double x, double y); 40 | // double MinUnitSquare (); 41 | double MaxUnitSquare (); 42 | double MaxUnitTriangle (); 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /ng/Togl-1.7/overlay.tcl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # the next line restarts using wish \ 3 | exec wish "$0" "$@" 4 | 5 | # $Id: overlay.tcl,v 1.4 2001/12/20 13:59:31 beskow Exp $ 6 | 7 | # Togl - a Tk OpenGL widget 8 | # Copyright (C) 1996 Brian Paul and Ben Bederson 9 | # See the LICENSE file for copyright details. 10 | 11 | 12 | # $Log: overlay.tcl,v $ 13 | # Revision 1.4 2001/12/20 13:59:31 beskow 14 | # Improved error-handling in togl.c in case of window creation failure 15 | # Added pkgIndex target to makefile 16 | # Updated documentation to reflect stubs-interface (Togl.html + new README.stubs) 17 | # Added tk8.4a3 headers 18 | # Removed obsolete Tk internal headers 19 | # 20 | # Revision 1.3 2001/01/29 18:11:53 brianp 21 | # Jonas Beskow's changes to use Tcl/Tk stub interface 22 | # 23 | # Revision 1.2 1998/01/24 14:05:50 brianp 24 | # added quit button (Ben Bederson) 25 | # 26 | # Revision 1.1 1997/03/07 01:26:38 brianp 27 | # Initial revision 28 | # 29 | # 30 | 31 | 32 | # A Tk/OpenGL widget demo using an overlay. 33 | 34 | load [file dirname [info script]]/overlay[info sharedlibextension] 35 | 36 | proc setup {} { 37 | wm title . "Overlay demo" 38 | 39 | togl .win -width 200 -height 200 -rgba true -double false -overlay true 40 | button .btn -text Quit -command exit 41 | 42 | pack .win -expand true -fill both 43 | pack .btn -expand true -fill both 44 | } 45 | 46 | 47 | 48 | # Execution starts here! 49 | setup 50 | -------------------------------------------------------------------------------- /libsrc/stlgeom/python_stl.cpp: -------------------------------------------------------------------------------- 1 | 2 | #ifdef NG_PYTHON 3 | 4 | #include <../general/ngpython.hpp> 5 | #include 6 | 7 | #ifdef WIN32 8 | #define DLL_HEADER __declspec(dllexport) 9 | #else 10 | #define DLL_HEADER 11 | #endif 12 | 13 | using namespace netgen; 14 | namespace netgen 15 | { 16 | //extern shared_ptr mesh; 17 | extern shared_ptr ng_geometry; 18 | } 19 | 20 | 21 | DLL_HEADER void ExportSTL(py::module & m) 22 | { 23 | py::class_> (m,"STLGeometry") 24 | .def(py::init<>()) 25 | ; 26 | m.def("LoadSTLGeometry", FunctionPointer([] (const string & filename) 27 | { 28 | ifstream ist(filename); 29 | return shared_ptr(STLGeometry::Load(ist)); 30 | })); 31 | m.def("GenerateMesh", FunctionPointer([] (shared_ptr geo, MeshingParameters ¶m) 32 | { 33 | auto mesh = make_shared(); 34 | SetGlobalMesh(mesh); 35 | mesh->SetGeometry(geo); 36 | ng_geometry = geo; 37 | try 38 | { 39 | geo->GenerateMesh(mesh,param); 40 | } 41 | catch (NgException ex) 42 | { 43 | cout << "Caught NgException: " << ex.What() << endl; 44 | } 45 | return mesh; 46 | })) 47 | ; 48 | } 49 | 50 | PYBIND11_PLUGIN(libstl) { 51 | py::module m("stl", "pybind stl"); 52 | ExportSTL(m); 53 | return m.ptr(); 54 | } 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /py_tutorials/merge.py: -------------------------------------------------------------------------------- 1 | from netgen.meshing import * 2 | from netgen.csg import * 3 | 4 | from ngsolve import ngsglobals 5 | ngsglobals.msg_level = 2 6 | 7 | geo1 = CSGeometry() 8 | geo1.Add (OrthoBrick( Pnt(0,0,0), Pnt(1,1,1) )) 9 | m1 = geo1.GenerateMesh (maxh=0.1) 10 | m1.Refine() 11 | m1.Refine() 12 | 13 | 14 | geo2 = CSGeometry() 15 | geo2.Add (Sphere (Pnt(0.5,0.5,0.5), 0.1)) 16 | m2 = geo2.GenerateMesh (maxh=0.05) 17 | m2.Refine() 18 | m2.Refine() 19 | 20 | print ("********************") 21 | print ("** start merging **") 22 | print ("********************") 23 | 24 | mesh = Mesh() 25 | fd_outside = mesh.Add (FaceDescriptor(surfnr=1,domin=1)) 26 | fd_inside = mesh.Add (FaceDescriptor(surfnr=2,domin=2,domout=1)) 27 | 28 | 29 | pmap1 = { } 30 | for e in m1.Elements2D(): 31 | for v in e.vertices: 32 | if (v not in pmap1): 33 | pmap1[v] = mesh.Add (m1[v]) 34 | 35 | for e in m1.Elements2D(): 36 | mesh.Add (Element2D (fd_outside, [pmap1[v] for v in e.vertices])) 37 | 38 | 39 | 40 | pmap2 = { } 41 | for e in m2.Elements2D(): 42 | for v in e.vertices: 43 | if (v not in pmap2): 44 | pmap2[v] = mesh.Add (m2[v]) 45 | 46 | for e in m2.Elements2D(): 47 | mesh.Add (Element2D (fd_inside, [pmap2[v] for v in e.vertices])) 48 | 49 | 50 | print ("******************") 51 | print ("** merging done **") 52 | print ("******************") 53 | 54 | 55 | mesh.GenerateVolumeMesh() 56 | mesh.Save ("newmesh.vol") 57 | 58 | 59 | -------------------------------------------------------------------------------- /libsrc/general/mpi_interface.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /* File: mpi_interface.cpp */ 3 | /* Author: Joachim Schoeberl */ 4 | /* Date: 04. Apr. 97 */ 5 | /**************************************************************************/ 6 | 7 | #include 8 | #include 9 | 10 | 11 | namespace netgen 12 | { 13 | 14 | 15 | #ifdef PARALLEL 16 | 17 | void MyMPI_SendCmd (const char * cmd) 18 | { 19 | char buf[10000]; 20 | strcpy (buf, cmd); 21 | // MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD); 22 | 23 | for (int dest = 1; dest < ntasks; dest++) 24 | MPI_Send( &buf, 10000, MPI_CHAR, dest, MPI_TAG_CMD, MPI_COMM_WORLD); 25 | } 26 | 27 | string MyMPI_RecvCmd () 28 | { 29 | char buf[10000]; 30 | // MPI_Bcast (&buf, 100, MPI_CHAR, 0, MPI_COMM_WORLD); 31 | 32 | // VT_OFF(); 33 | MPI_Status status; 34 | int flag; 35 | do 36 | { 37 | MPI_Iprobe (0, MPI_TAG_CMD, MPI_COMM_WORLD, &flag, &status); 38 | if (!flag) 39 | { 40 | VT_TRACER ("sleep"); 41 | usleep (1000); 42 | } 43 | } 44 | while (!flag); 45 | // VT_ON(); 46 | 47 | MPI_Recv( &buf, 10000, MPI_CHAR, 0, MPI_TAG_CMD, MPI_COMM_WORLD, &status); 48 | 49 | return string(buf); 50 | } 51 | 52 | #endif 53 | 54 | 55 | } 56 | 57 | -------------------------------------------------------------------------------- /libsrc/general/spbita2d.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_SPBITA2D 2 | #define FILE_SPBITA2D 3 | 4 | /**************************************************************************/ 5 | /* File: spbita2d.hh */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 01. Jun. 95 */ 8 | /**************************************************************************/ 9 | 10 | /** 11 | Implementation of sparse 2 dimensional bitarray 12 | */ 13 | 14 | namespace netgen 15 | { 16 | 17 | class SPARSE_BIT_Array_2D 18 | { 19 | class linestruct { public: INDEX size; INDEX maxsize; INDEX * col; }; 20 | 21 | /// 22 | linestruct * lines; 23 | /// 24 | INDEX height, width; 25 | 26 | public: 27 | 28 | /// 29 | SPARSE_BIT_Array_2D (INDEX ah = 0, INDEX aw = 0); 30 | /// 31 | ~SPARSE_BIT_Array_2D (); 32 | 33 | /// 34 | void SetSize (INDEX ah, INDEX aw = 0); 35 | /// 36 | void DeleteElements (); 37 | 38 | /// 39 | int Get (INDEX i, INDEX j) const; 40 | 41 | /// 42 | INDEX Height () const { return height; } 43 | /// 44 | INDEX Width () const { return width; } 45 | 46 | /// 47 | void Set (INDEX i, INDEX j); 48 | /// 49 | int Test (INDEX i, INDEX j) const; 50 | 51 | /// 52 | INDEX BitsInLine (INDEX i) const { return lines[i-1].size; } 53 | /// 54 | INDEX GetIndex (INDEX i, INDEX nr) const { return lines[i-1].col[nr-1]; } 55 | }; 56 | 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /ng/Togl-1.7/index.tcl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # the next line restarts using wish \ 3 | exec wish "$0" "$@" 4 | 5 | # $Id: index.tcl,v 1.5 2001/12/20 13:59:31 beskow Exp $ 6 | 7 | # Togl - a Tk OpenGL widget 8 | # Copyright (C) 1996 Brian Paul and Ben Bederson 9 | # See the LICENSE file for copyright details. 10 | 11 | 12 | # $Log: index.tcl,v $ 13 | # Revision 1.5 2001/12/20 13:59:31 beskow 14 | # Improved error-handling in togl.c in case of window creation failure 15 | # Added pkgIndex target to makefile 16 | # Updated documentation to reflect stubs-interface (Togl.html + new README.stubs) 17 | # Added tk8.4a3 headers 18 | # Removed obsolete Tk internal headers 19 | # 20 | # Revision 1.4 2001/01/29 18:11:53 brianp 21 | # Jonas Beskow's changes to use Tcl/Tk stub interface 22 | # 23 | # Revision 1.3 1998/01/24 14:05:50 brianp 24 | # added quit button (Ben Bederson) 25 | # 26 | # Revision 1.2 1997/04/11 01:37:34 brianp 27 | # added a timer to rotate the triangles 28 | # 29 | # Revision 1.1 1996/10/23 23:18:11 brianp 30 | # Initial revision 31 | # 32 | 33 | 34 | # A Tk/OpenGL widget demo using color-index mode. 35 | 36 | load [file dirname [info script]]/index[info sharedlibextension] 37 | 38 | proc setup {} { 39 | wm title . "Color index demo" 40 | 41 | togl .win -width 200 -height 200 -rgba false -double true -privatecmap false -time 10 42 | button .btn -text Quit -command exit 43 | 44 | pack .win -expand true -fill both 45 | pack .btn -expand true -fill both 46 | } 47 | 48 | 49 | 50 | # Execution starts here! 51 | setup 52 | -------------------------------------------------------------------------------- /libsrc/meshing/basegeom.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "meshing.hpp" 3 | 4 | namespace netgen 5 | { 6 | 7 | DLL_HEADER GeometryRegisterArray geometryregister; 8 | //DLL_HEADER Array geometryregister; 9 | 10 | GeometryRegister :: ~GeometryRegister() 11 | { ; } 12 | 13 | 14 | 15 | 16 | 17 | int NetgenGeometry :: GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam) 18 | { 19 | if (!mesh) return 1; 20 | 21 | if (mparam.perfstepsstart <= MESHCONST_MESHVOLUME) 22 | { 23 | multithread.task = "Volume meshing"; 24 | 25 | MESHING3_RESULT res = 26 | MeshVolume (mparam, *mesh); 27 | 28 | if (res != MESHING3_OK) return 1; 29 | 30 | if (multithread.terminate) return 0; 31 | 32 | RemoveIllegalElements (*mesh); 33 | if (multithread.terminate) return 0; 34 | 35 | MeshQuality3d (*mesh); 36 | } 37 | 38 | 39 | if (multithread.terminate || mparam.perfstepsend <= MESHCONST_MESHVOLUME) 40 | return 0; 41 | 42 | 43 | if (mparam.perfstepsstart <= MESHCONST_OPTVOLUME) 44 | { 45 | multithread.task = "Volume optimization"; 46 | 47 | OptimizeVolume (mparam, *mesh); 48 | if (multithread.terminate) return 0; 49 | } 50 | 51 | return 0; 52 | } 53 | 54 | 55 | const Refinement & NetgenGeometry :: GetRefinement () const 56 | { 57 | return *new Refinement;; 58 | } 59 | 60 | 61 | void NetgenGeometry :: Save (string filename) const 62 | { 63 | throw NgException("Cannot save geometry - no geometry available"); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /libsrc/meshing/meshfunc2d.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "meshing.hpp" 3 | 4 | namespace netgen 5 | { 6 | 7 | DLL_HEADER void Optimize2d (Mesh & mesh, MeshingParameters & mp) 8 | { 9 | static int timer = NgProfiler::CreateTimer ("optimize2d"); 10 | NgProfiler::RegionTimer reg(timer); 11 | 12 | mesh.CalcSurfacesOfNode(); 13 | 14 | const char * optstr = mp.optimize2d.c_str(); 15 | int optsteps = mp.optsteps2d; 16 | 17 | for (int i = 1; i <= optsteps; i++) 18 | for (size_t j = 1; j <= strlen(optstr); j++) 19 | { 20 | if (multithread.terminate) break; 21 | switch (optstr[j-1]) 22 | { 23 | case 's': 24 | { // topological swap 25 | MeshOptimize2d meshopt; 26 | meshopt.SetMetricWeight (mp.elsizeweight); 27 | meshopt.EdgeSwapping (mesh, 0); 28 | break; 29 | } 30 | case 'S': 31 | { // metric swap 32 | MeshOptimize2d meshopt; 33 | meshopt.SetMetricWeight (mp.elsizeweight); 34 | meshopt.EdgeSwapping (mesh, 1); 35 | break; 36 | } 37 | case 'm': 38 | { 39 | MeshOptimize2d meshopt; 40 | meshopt.SetMetricWeight (mp.elsizeweight); 41 | meshopt.ImproveMesh(mesh, mp); 42 | break; 43 | } 44 | case 'c': 45 | { 46 | MeshOptimize2d meshopt; 47 | meshopt.SetMetricWeight (mp.elsizeweight); 48 | meshopt.CombineImprove(mesh); 49 | break; 50 | } 51 | default: 52 | cerr << "Optimization code " << optstr[j-1] << " not defined" << endl; 53 | } 54 | } 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /ng/Togl-1.7/LICENSE: -------------------------------------------------------------------------------- 1 | This software is copyrighted by Brian Paul (brian@mesa3d.org) 2 | and Benjamin Bederson (bederson@cs.umd.edu). The following 3 | terms apply to all files associated with the software unless explicitly 4 | disclaimed in individual files. 5 | 6 | The authors hereby grant permission to use, copy, modify, distribute, 7 | and license this software and its documentation for any purpose, provided 8 | that existing copyright notices are retained in all copies and that this 9 | notice is included verbatim in any distributions. No written agreement, 10 | license, or royalty fee is required for any of the authorized uses. 11 | Modifications to this software may be copyrighted by their authors 12 | and need not follow the licensing terms described here, provided that 13 | the new terms are clearly indicated on the first page of each file where 14 | they apply. 15 | 16 | IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 17 | FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 18 | ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 19 | DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 20 | POSSIBILITY OF SUCH DAMAGE. 21 | 22 | THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 23 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 24 | FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 25 | IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 26 | NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 27 | MODIFICATIONS. 28 | -------------------------------------------------------------------------------- /ng/Togl2.1/toglStubLib.c: -------------------------------------------------------------------------------- 1 | #ifndef USE_TCL_STUBS 2 | # define USE_TCL_STUBS 3 | #endif 4 | #undef USE_TCL_STUB_PROCS 5 | #ifndef USE_TK_STUBS 6 | # define USE_TK_STUBS 7 | #endif 8 | #undef USE_TK_STUB_PROCS 9 | 10 | #include "togl.h" 11 | 12 | const ToglStubs *toglStubsPtr; 13 | 14 | /* 15 | ** Ensure that Togl_InitStubs is built as an exported symbol. The other stub 16 | ** functions should be built as non-exported symbols. 17 | */ 18 | #undef TCL_STORAGE_CLASS 19 | #define TCL_STORAGE_CLASS DLLEXPORT 20 | 21 | /* 22 | * Togl_InitStubs -- 23 | * 24 | * Checks that the correct version of Togl is loaded and that it 25 | * supports stubs. It then initialises the stub table pointers. 26 | * 27 | * Results: 28 | * The actual version of Togl that satisfies the request, or 29 | * NULL to indicate that an error occurred. 30 | * 31 | * Side effects: 32 | * sets the stub table pointer. 33 | * 34 | */ 35 | 36 | #ifdef Togl_InitStubs 37 | # undef Togl_InitStubs 38 | #endif 39 | 40 | const char * 41 | Togl_InitStubs(Tcl_Interp *interp, const char *version, int exact) 42 | { 43 | const char *actualVersion; 44 | 45 | actualVersion = Tcl_PkgRequireEx(interp, "Togl", version, exact, 46 | (ClientData *) &toglStubsPtr); 47 | if (!actualVersion) { 48 | return NULL; 49 | } 50 | 51 | if (!toglStubsPtr) { 52 | Tcl_SetResult(interp, 53 | "This implementation of Togl does not support stubs", 54 | TCL_STATIC); 55 | return NULL; 56 | } 57 | 58 | return actualVersion; 59 | } 60 | -------------------------------------------------------------------------------- /ng/Togl2.1/index.tcl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # the next line restarts using tclsh \ 3 | exec tclsh "$0" "$@" 4 | 5 | # $Id: index.tcl,v 1.8 2007/08/03 16:48:50 gregcouch Exp $ 6 | 7 | # Togl - a Tk OpenGL widget 8 | # Copyright (C) 1996 Brian Paul and Ben Bederson 9 | # Copyright (C) 2006-2007 Greg Couch 10 | # See the LICENSE file for copyright details. 11 | 12 | 13 | # A Tk/OpenGL widget demo using color-index mode. 14 | 15 | package provide index 1.0 16 | 17 | # add parent directory to path to find Togl's pkgIndex in current directory 18 | if { [file exists pkgIndex.tcl] } { 19 | set auto_path [linsert $auto_path 0 ..] 20 | } 21 | # following load also loads Tk and Togl packages 22 | load [file dirname [info script]]/index[info sharedlibextension] 23 | 24 | # create ::index namespace 25 | namespace eval ::index { 26 | } 27 | 28 | proc ::index::setup {} { 29 | wm title . "Color index demo" 30 | 31 | togl .win -width 200 -height 200 -rgba false -double true -privatecmap false -time 10 -timer ::index::timer_cb -create ::index::create_cb -reshape ::index::reshape_cb -display ::index::display_cb 32 | button .photo -text "Take Photo" -command ::index::take_photo 33 | button .btn -text Quit -command exit 34 | 35 | pack .win -expand true -fill both 36 | pack .photo -expand true -fill both 37 | pack .btn -expand true -fill both 38 | } 39 | 40 | proc ::index::take_photo {} { 41 | image create photo img 42 | .win takephoto img 43 | img write image.ppm -format ppm 44 | } 45 | 46 | 47 | # Execution starts here! 48 | if { [info script] == $argv0 } { 49 | ::index::setup 50 | } 51 | -------------------------------------------------------------------------------- /libsrc/occ/Partition_Spliter.jxx: -------------------------------------------------------------------------------- 1 | // GEOM PARTITION : partition algorithm 2 | // 3 | // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 4 | // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 5 | // 6 | // This library is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 2.1 of the License. 10 | // 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | // Lesser General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Lesser General Public 17 | // License along with this library; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | // 20 | // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 21 | // 22 | // 23 | // 24 | // File : Partition_Spliter.jxx 25 | // Module : GEOM 26 | 27 | #ifndef _BRepAlgo_AsDes_HeaderFile 28 | #include 29 | #endif 30 | #ifndef _TopoDS_Shape_HeaderFile 31 | #include 32 | #endif 33 | #ifndef _TopTools_ListOfShape_HeaderFile 34 | #include 35 | #endif 36 | #ifndef _TopoDS_Edge_HeaderFile 37 | #include 38 | #endif 39 | #ifndef _Partition_Spliter_HeaderFile 40 | #include "Partition_Spliter.hxx" 41 | #endif 42 | -------------------------------------------------------------------------------- /libsrc/stlgeom/vsstl.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_VSSTL 2 | #define FILE_VSSTL 3 | 4 | /**************************************************************************/ 5 | /* File: vsstl.hpp */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 05. Jan. 2011 */ 8 | /**************************************************************************/ 9 | 10 | namespace netgen 11 | { 12 | 13 | class VisualSceneSTLGeometry : public VisualScene 14 | { 15 | Array trilists; 16 | class STLGeometry * stlgeometry; 17 | 18 | public: 19 | DLL_HEADER VisualSceneSTLGeometry (); 20 | DLL_HEADER virtual ~VisualSceneSTLGeometry (); 21 | DLL_HEADER void SetGeometry (class STLGeometry * astlgeometry) { stlgeometry = astlgeometry; } 22 | 23 | DLL_HEADER virtual void BuildScene (int zoomall = 0); 24 | DLL_HEADER virtual void DrawScene (); 25 | }; 26 | 27 | 28 | class VisualSceneSTLMeshing : public VisualScene 29 | { 30 | Array trilists; 31 | int selecttrig, nodeofseltrig; 32 | class STLGeometry * stlgeometry; 33 | 34 | public: 35 | DLL_HEADER VisualSceneSTLMeshing (); 36 | DLL_HEADER virtual ~VisualSceneSTLMeshing (); 37 | 38 | void SetGeometry (class STLGeometry * astlgeometry) { stlgeometry = astlgeometry; } 39 | 40 | virtual void BuildScene (int zoomall = 0); 41 | virtual void DrawScene (); 42 | virtual void MouseDblClick (int px, int py); 43 | 44 | int seltria; 45 | }; 46 | 47 | 48 | 49 | } 50 | 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /libsrc/occ/Partition_Loop.jxx: -------------------------------------------------------------------------------- 1 | // GEOM PARTITION : partition algorithm 2 | // 3 | // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 4 | // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 5 | // 6 | // This library is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 2.1 of the License. 10 | // 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | // Lesser General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Lesser General Public 17 | // License along with this library; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | // 20 | // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 21 | // 22 | // 23 | // 24 | // File : Partition_Loop.jxx 25 | // Module : GEOM 26 | 27 | #ifndef _TopoDS_Face_HeaderFile 28 | #include 29 | #endif 30 | #ifndef _TopoDS_Edge_HeaderFile 31 | #include 32 | #endif 33 | #ifndef _TopTools_ListOfShape_HeaderFile 34 | #include 35 | #endif 36 | #ifndef _TopTools_DataMapOfShapeShape_HeaderFile 37 | #include 38 | #endif 39 | #ifndef _Partition_Loop_HeaderFile 40 | #include "Partition_Loop.hxx" 41 | #endif 42 | -------------------------------------------------------------------------------- /libsrc/csg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-DNGINTERFACE_EXPORTS) 2 | add_library(csg ${NG_LIB_TYPE} 3 | algprim.cpp brick.cpp 4 | bspline2d.cpp csgeom.cpp csgparser.cpp curve2d.cpp edgeflw.cpp 5 | explicitcurve2d.cpp extrusion.cpp gencyl.cpp genmesh.cpp identify.cpp 6 | manifold.cpp meshsurf.cpp polyhedra.cpp revolution.cpp singularref.cpp 7 | solid.cpp specpoin.cpp spline3d.cpp surface.cpp triapprox.cpp zrefine.cpp 8 | python_csg.cpp splinesurface.cpp 9 | ) 10 | if(APPLE) 11 | set_target_properties( csg PROPERTIES SUFFIX ".so") 12 | endif(APPLE) 13 | 14 | if(NOT WIN32) 15 | target_link_libraries(csg mesh ${PYTHON_LIBRARIES}) 16 | target_link_libraries(csg ${PYTHON_LIBRARIES}) 17 | install( TARGETS csg ${ng_install_dir}) 18 | endif(NOT WIN32) 19 | 20 | 21 | if(USE_GUI) 22 | add_library(csgvis ${NG_LIB_TYPE} vscsg.cpp ) 23 | if(NOT WIN32) 24 | target_link_libraries(csgvis csg visual) 25 | if(APPLE) 26 | set_target_properties( csgvis PROPERTIES SUFFIX ".so") 27 | endif(APPLE) 28 | install( TARGETS csgvis ${ng_install_dir}) 29 | endif(NOT WIN32) 30 | endif(USE_GUI) 31 | 32 | install(FILES 33 | algprim.hpp brick.hpp csgeom.hpp csg.hpp csgparser.hpp 34 | curve2d.hpp edgeflw.hpp explicitcurve2d.hpp extrusion.hpp 35 | gencyl.hpp geoml.hpp identify.hpp manifold.hpp meshsurf.hpp 36 | polyhedra.hpp revolution.hpp singularref.hpp solid.hpp 37 | specpoin.hpp spline3d.hpp splinesurface.hpp surface.hpp 38 | triapprox.hpp vscsg.hpp 39 | DESTINATION ${INCDIR}/csg COMPONENT netgen_devel 40 | ) 41 | -------------------------------------------------------------------------------- /ng/Togl2.1/LICENSE: -------------------------------------------------------------------------------- 1 | This software is copyrighted by Brian Paul (brian@mesa3d.org), 2 | Benjamin Bederson (bederson@cs.umd.edu), and Greg Couch 3 | (gregcouch@users.sourceforge.net). The following terms apply to all 4 | files associated with the software unless explicitly disclaimed in 5 | individual files. 6 | 7 | The authors hereby grant permission to use, copy, modify, distribute, 8 | and license this software and its documentation for any purpose, provided 9 | that existing copyright notices are retained in all copies and that this 10 | notice is included verbatim in any distributions. No written agreement, 11 | license, or royalty fee is required for any of the authorized uses. 12 | Modifications to this software may be copyrighted by their authors 13 | and need not follow the licensing terms described here, provided that 14 | the new terms are clearly indicated on the first page of each file where 15 | they apply. 16 | 17 | IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY 18 | FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES 19 | ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY 20 | DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE 21 | POSSIBILITY OF SUCH DAMAGE. 22 | 23 | THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, 24 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, 25 | FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE 26 | IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE 27 | NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR 28 | MODIFICATIONS. 29 | -------------------------------------------------------------------------------- /tutorials/extrusion.geo: -------------------------------------------------------------------------------- 1 | algebraic3d 2 | 3 | curve2d procurve1=(8; 4 | -1,0; 5 | -0.7,0.7; 6 | 0,1; 7 | 0.7,0.7; 8 | 1,0; 9 | 0.7,-0.7; 10 | 0,-1; 11 | -0.7,-0.7; 12 | 4; 13 | 3,1,2,3; 14 | 3,3,4,5; 15 | 3,5,6,7; 16 | 3,7,8,1); 17 | 18 | curve2d procurve2=(4; 19 | 1,1; 20 | 1,-1; 21 | -1,-1; 22 | -1,1; 23 | 4; 24 | 2,1,2; 25 | 2,2,3; 26 | 2,3,4; 27 | 2,4,1); 28 | 29 | 30 | 31 | curve3d pathcurve1=(9; 32 | 0,0,0; 33 | 10,0,5; 34 | 10,10,10; 35 | 10,20,15; 36 | 0,20,20; 37 | -10,20,25; 38 | -10,10,30; 39 | -10,0,35; 40 | 0,0,40; 41 | 4; 42 | 3,1,2,3; 43 | 3,3,4,5; 44 | 3,5,6,7; 45 | 3,7,8,9); 46 | 47 | curve3d pathcurve2=(2; 48 | 0,0,0; 49 | 0,10,0; 50 | 1; 51 | 2,1,2); 52 | 53 | 54 | curve3d pathcurve3=(3; 55 | 0,0,0; 56 | 10,0,5; 57 | 10,10,10; 58 | 1; 59 | 3,1,2,3); 60 | 61 | curve3d pathcurve4=(9; 62 | 0,0,0; 63 | 10,0,0; 64 | 10,10,0; 65 | 10,20,0; 66 | 0,20,0; 67 | -10,20,0; 68 | -10,10,0; 69 | -10,0,0; 70 | 0,0,0; 71 | 4; 72 | 3,1,2,3; 73 | 3,3,4,5; 74 | 3,5,6,7; 75 | 3,7,8,9); 76 | 77 | 78 | solid p1 = plane(1,0,0;-1,0,0); 79 | solid p2 = plane(10,9,10;0,1,0); 80 | solid p3 = plane(0,1,0;0,-1,0); 81 | solid p4 = plane(0,9,0;0,1,0); 82 | 83 | solid ob1 = orthobrick(-1,-5,-5;1,5,45); 84 | 85 | solid ext = extrusion(pathcurve1;procurve2;0,0,1) and not ob1; 86 | 87 | #solid ext = extrusion(pathcurve4;procurve2;0,0,1); 88 | 89 | #solid ext = extrusion(pathcurve3;procurve1;0,0,1) and p1 and p2; 90 | 91 | #solid ext = extrusion(pathcurve2;procurve2;0,0,1) and p3 and p4; 92 | 93 | solid sp = sphere(0,0,0;4); 94 | 95 | solid comb = sp or ext; 96 | 97 | #tlo ext; 98 | 99 | tlo comb; -------------------------------------------------------------------------------- /libsrc/csg/curve2d.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_CURVE2D 2 | #define FILE_CURVE2D 3 | 4 | /**************************************************************************/ 5 | /* File: curve2d.hh */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 24. Jul. 96 */ 8 | /**************************************************************************/ 9 | 10 | namespace netgen 11 | { 12 | 13 | 14 | /* 15 | 16 | 2D Curve repesentation 17 | 18 | */ 19 | 20 | 21 | 22 | /// 23 | class Curve2d : public Manifold 24 | { 25 | public: 26 | /// 27 | virtual void Project (Point<2> & p) const = 0; 28 | /// 29 | virtual void NormalVector (const Point<2> & p, Vec<2> & n) const = 0; 30 | }; 31 | 32 | /// 33 | class CircleCurve2d : public Curve2d 34 | { 35 | /// 36 | Point<2> center; 37 | /// 38 | double rad; 39 | public: 40 | /// 41 | CircleCurve2d (const Point<2> & acenter, double arad); 42 | /// 43 | virtual void Project (Point<2> & p) const; 44 | /// 45 | virtual void NormalVector (const Point<2> & p, Vec<2> & n) const; 46 | }; 47 | 48 | /// 49 | class QuadraticCurve2d : public Curve2d 50 | { 51 | /// 52 | double cxx, cyy, cxy, cx, cy, c; 53 | public: 54 | /// 55 | QuadraticCurve2d (); 56 | /// 57 | void Read (istream & ist); 58 | /// 59 | virtual void Project (Point<2> & p) const; 60 | /// 61 | virtual void NormalVector (const Point<2> & p, Vec<2> & n) const; 62 | }; 63 | 64 | 65 | } 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /tutorials/lense.in2d: -------------------------------------------------------------------------------- 1 | splinecurves2dv2 2 | 5 3 | 4 | 5 | points 6 | 7 | 1 -1.0 -1.0 8 | 2 -1.0 1.0 9 | 3 0.0 1.0 10 | 4 1.0 1.0 11 | 5 1.0 -1.0 12 | 6 0.0 -1.0 13 | 14 | 15 | segments 16 | 0 1 2 6 1 -bc=1 17 | 0 1 2 1 2 -bc=1 18 | 0 1 2 2 3 -bc=1 19 | 20 | 21 | 0 2 2 3 4 -bc=1 22 | 0 2 2 4 5 -bc=1 23 | 0 2 2 5 6 -bc=1 24 | 25 | 26 | 27 | 28 | 1 3 bsplinepoints 21 4 29 | 0 -1.0000 30 | -0.0380 -0.9000 31 | -0.0720 -0.8000 32 | -0.1020 -0.7000 33 | -0.1280 -0.6000 34 | -0.1500 -0.5000 35 | -0.1680 -0.4000 36 | -0.1820 -0.3000 37 | -0.1920 -0.2000 38 | -0.1980 -0.1000 39 | -0.2000 0 40 | -0.1980 0.1000 41 | -0.1920 0.2000 42 | -0.1820 0.3000 43 | -0.1680 0.4000 44 | -0.1500 0.5000 45 | -0.1280 0.6000 46 | -0.1020 0.7000 47 | -0.0720 0.8000 48 | -0.0380 0.9000 49 | 0 1.0000 50 | -bc=2 -maxh=0.1 51 | 52 | 3 2 bsplinepoints 21 3 53 | 0 -1.0000 54 | 0.0380 -0.9000 55 | 0.0720 -0.8000 56 | 0.1020 -0.7000 57 | 0.1280 -0.6000 58 | 0.1500 -0.5000 59 | 0.1680 -0.4000 60 | 0.1820 -0.3000 61 | 0.1920 -0.2000 62 | 0.1980 -0.1000 63 | 0.2000 0 64 | 0.1980 0.1000 65 | 0.1920 0.2000 66 | 0.1820 0.3000 67 | 0.1680 0.4000 68 | 0.1500 0.5000 69 | 0.1280 0.6000 70 | 0.1020 0.7000 71 | 0.0720 0.8000 72 | 0.0380 0.9000 73 | 0 1.0000 74 | -bc=2 -maxh=0.1 75 | 76 | 77 | materials 78 | 1 domain1 -maxh=0.2 79 | 2 domain2 -maxh=0.2 80 | 3 domain3 -maxh=0.2 81 | -------------------------------------------------------------------------------- /libsrc/csg/splinesurface.hpp~: -------------------------------------------------------------------------------- 1 | #ifndef FILE_SPLINESURFACE 2 | #define FILE_SPLINESURFACE 3 | 4 | 5 | namespace netgen 6 | { 7 | class SplineSurface : public OneSurfacePrimitive 8 | { 9 | protected: 10 | Array> geompoints; 11 | Array*> splines; 12 | Array bcnames; 13 | 14 | public: 15 | SplineSurface(); 16 | virtual ~SplineSurface(); 17 | 18 | const Array*> & GetSplines() const { return splines; } 19 | int GetNSplines() const { return splines.Size(); } 20 | string GetSplineType(const int i) const { return splines[i]->GetType(); } 21 | SplineSeg<3> & GetSpline(const int i) { return *splines[i]; } 22 | const SplineSeg<3> & GetSpline(const int i) const { return *splines[i]; } 23 | int GetNP() const { return geompoints.Size(); } 24 | const GeomPoint<3> & GetPoint(int i) const { return geompoints[i]; } 25 | 26 | DLL_HEADER void AppendPoint(const Point<3> & p, const double reffac = 1., const bool hpref=false); 27 | void AppendSegment(SplineSeg<3>* spline, string* bcname); 28 | Array* CreatePlanes() const; 29 | 30 | virtual double CalcFunctionValue (const Point<3> & point) const; 31 | virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const; 32 | virtual double HesseNorm () const; 33 | virtual Point<3> GetSurfacePoint () const; 34 | virtual void CalcSpecialPoints(Array> & pts) const; 35 | 36 | virtual INSOLID_TYPE BoxInSolid(const BoxSphere<3> & box) const; 37 | 38 | 39 | virtual void Print (ostream & str) const; 40 | 41 | 42 | }; 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /ng/Togl-1.7/.indent.pro: -------------------------------------------------------------------------------- 1 | --blank-before-sizeof 2 | --blank-lines-after-declarations 3 | --blank-lines-after-procedures 4 | --blank-lines-before-block-comments 5 | --braces-after-struct-decl-line 6 | --braces-on-if-line 7 | --break-before-boolean-operator 8 | --case-brace-indentation0 9 | --case-indentation2 10 | --comment-line-length80 11 | --continuation-indentation8 12 | --cuddle-do-while 13 | --cuddle-else 14 | --declaration-indentation8 15 | --dont-line-up-parentheses 16 | --format-all-comments 17 | --format-first-column-comments 18 | --indent-level4 19 | --leave-optional-blank-lines 20 | --line-length80 21 | --no-space-after-function-call-names 22 | --no-space-after-parentheses 23 | --no-tabs 24 | --parameter-indentation8 25 | --preprocessor-indentation2 26 | --procnames-start-lines 27 | --space-after-cast 28 | --space-after-for 29 | --space-after-if 30 | --space-after-while 31 | --space-special-semicolon 32 | --start-left-side-of-comments 33 | --struct-brace-indentation0 34 | --tab-size8 35 | -T AGLContext 36 | -T CALLBACK 37 | -T ClientData 38 | -T Colormap 39 | -T Display 40 | -T GLXContext 41 | -T GLbitfield 42 | -T GLboolean 43 | -T GLenum 44 | -T GLfloat 45 | -T GLint 46 | -T GLuint 47 | -T HDC 48 | -T HGLRC 49 | -T HWND 50 | -T LPARAM 51 | -T PIXELFORMATDESCRIPTOR 52 | -T Tcl_Command 53 | -T Tcl_Interp 54 | -T TkClassCreateProc 55 | -T TkClassGeometryProc 56 | -T TkClassModalProc 57 | -T TkClassProcs 58 | -T TkWinColormap 59 | -T Tk_ConfigSpec 60 | -T Tk_Cursor 61 | -T Tk_Window 62 | -T Togl_Callback 63 | -T Togl_CmdProc 64 | -T UINT 65 | -T WPARAM 66 | -T WinFont 67 | -T Window 68 | -T XColor 69 | -T XEvent 70 | -T XVisualInfo 71 | -T TOGL_EXTERN 72 | -T Togl 73 | -------------------------------------------------------------------------------- /ng/onetcl.py: -------------------------------------------------------------------------------- 1 | import glob 2 | import functools 3 | 4 | # load all tcl files in current folder 5 | tclfiles = {} 6 | for fname in glob.glob('*.tcl'): 7 | tclfiles[fname] = open(fname,'r').read() 8 | 9 | # do a topological sorting (such that if a.tcl is including b.tcl, 10 | # a will come after b in the sorted list) 11 | fnames = list(tclfiles.keys()) 12 | fnames.sort(key=functools.cmp_to_key( lambda x,y: tclfiles[x].find('/'+y) )) 13 | 14 | # replace all occurences of 'source bla.tcl' with the code of bla.tcl 15 | for f in fnames: 16 | for g in fnames: 17 | if(tclfiles[f].find('/'+g) >= 0): 18 | tclfiles[f] = tclfiles[f].replace("source ${ngdir}/"+g, tclfiles[g]) 19 | 20 | # write a cpp file containing the result of ng.tcl 21 | onetclcpp = open("onetcl.cpp",'w') 22 | onetclcpp.write('const char * ngscript[] = {""'+'\n'); 23 | 24 | # make sure to remove comments (and if lines with comments end with '\' also the next line(s) ) 25 | skip_next = False # flag to indicate that the next line should be removed 26 | for line in tclfiles["ng.tcl"].split('\n'): 27 | line = line.strip() 28 | if len(line)==0: 29 | skip_next = False 30 | continue 31 | if skip_next: 32 | # skip as long as lines end with '\' 33 | skip_next = line[-1]=='\\' 34 | continue 35 | if(line.find('#')>-1): 36 | # comment found (not necessarily the whole line) 37 | skip_next = line[-1]=='\\' 38 | line = line[:line.find('#')] 39 | if len(line)>0: 40 | s = ',"' + line.replace('\\', r'\\').replace('"', r'\"') + '\\n"\n' 41 | onetclcpp.write(s) 42 | 43 | onetclcpp.write('};'+'\n'); 44 | onetclcpp.close(); 45 | -------------------------------------------------------------------------------- /cmake_modules/netgen_fixup.cmake: -------------------------------------------------------------------------------- 1 | include(BundleUtilities) 2 | function(netgen_fixup_bundle app libs dirs) 3 | message(STATUS "fixup_bundle") 4 | message(STATUS " app='${app}'") 5 | message(STATUS " libs='${libs}'") 6 | message(STATUS " dirs='${dirs}'") 7 | 8 | get_bundle_and_executable("${app}" bundle executable valid) 9 | if(valid) 10 | get_filename_component(exepath "${executable}" PATH) 11 | 12 | message(STATUS "fixup_bundle: preparing...") 13 | get_bundle_keys("${app}" "${libs}" "${dirs}" keys) 14 | 15 | message(STATUS "fixup_bundle: copying...") 16 | list(LENGTH keys n) 17 | math(EXPR n ${n}*2) 18 | 19 | set(i 0) 20 | foreach(key ${keys}) 21 | math(EXPR i ${i}+1) 22 | if(${${key}_COPYFLAG}) 23 | set(item "${${key}_ITEM}") 24 | if(item MATCHES "[^/]+\\.framework/") 25 | copy_resolved_framework_into_bundle("${${key}_RESOLVED_ITEM}" 26 | "${${key}_RESOLVED_EMBEDDED_ITEM}") 27 | else() 28 | copy_resolved_item_into_bundle("${${key}_RESOLVED_ITEM}" 29 | "${${key}_RESOLVED_EMBEDDED_ITEM}") 30 | endif() 31 | endif() 32 | endforeach() 33 | 34 | message(STATUS "fixup_bundle: fixing...") 35 | foreach(key ${keys}) 36 | math(EXPR i ${i}+1) 37 | message(STATUS "${i}/${n}: fixing up '${${key}_RESOLVED_EMBEDDED_ITEM}'") 38 | fixup_bundle_item("${${key}_RESOLVED_EMBEDDED_ITEM}" "${exepath}" "${dirs}") 39 | endforeach() 40 | 41 | message(STATUS "fixup_bundle: cleaning up...") 42 | clear_bundle_keys(keys) 43 | 44 | else() 45 | message(SEND_ERROR "error: fixup_bundle: not a valid bundle") 46 | endif() 47 | 48 | message(STATUS "fixup_bundle: done") 49 | endfunction() 50 | -------------------------------------------------------------------------------- /libsrc/general/ngpython.hpp: -------------------------------------------------------------------------------- 1 | #ifdef NG_PYTHON 2 | 3 | #include 4 | #include 5 | namespace py = pybind11; 6 | #include 7 | #include 8 | 9 | namespace pybind11 { 10 | template 11 | bool CheckCast( py::handle obj ) { 12 | try{ 13 | obj.cast(); 14 | return true; 15 | } 16 | catch (py::cast_error &e) { 17 | return false; 18 | } 19 | } 20 | 21 | 22 | template 23 | struct extract 24 | { 25 | py::handle obj; 26 | extract( py::handle aobj ) : obj(aobj) {} 27 | 28 | bool check() { return CheckCast(obj); } 29 | T operator()() { return obj.cast(); } 30 | }; 31 | } 32 | 33 | struct NGDummyArgument {}; 34 | 35 | inline void NOOP_Deleter(void *) { ; } 36 | 37 | namespace netgen 38 | { 39 | 40 | ////////////////////////////////////////////////////////////////////// 41 | // Lambda to function pointer conversion 42 | template 43 | struct function_traits 44 | : public function_traits {}; 45 | 46 | template 47 | struct function_traits { 48 | typedef ReturnType (*pointer)(Args...); 49 | typedef ReturnType return_type; 50 | }; 51 | 52 | template 53 | typename function_traits::pointer 54 | FunctionPointer (const Function& lambda) { 55 | return static_cast::pointer>(lambda); 56 | } 57 | 58 | 59 | template 60 | inline std::string ToString (const T& t) 61 | { 62 | std::stringstream ss; 63 | ss << t; 64 | return ss.str(); 65 | } 66 | 67 | } 68 | 69 | #endif 70 | 71 | -------------------------------------------------------------------------------- /tutorials/trafo.geo: -------------------------------------------------------------------------------- 1 | algebraic3d 2 | # 3 | # a transformer 4 | # 5 | solid core = 6 | plane (-8, 0, 0; -1, 0, 0) 7 | and plane ( 8, 0, 0; 1, 0, 0) 8 | and plane ( 0, -6, 0; 0, -1, 0) 9 | and plane ( 0, 6, 0; 0, 1, 0) 10 | and plane ( 0, 0, -1; 0, 0, -1) 11 | and plane ( 0, 0, 1; 0, 0, 1) 12 | and not 13 | ( plane (-6, 0, 0; -1, 0, 0) 14 | and plane (-1, 0, 0; 1, 0, 0) 15 | and plane ( 0, -4, 0; 0, -1, 0) 16 | and plane ( 0, 4, 0; 0, 1, 0) ) 17 | and not 18 | ( plane ( 6, 0, 0; 1, 0, 0) 19 | and plane ( 1, 0, 0; -1, 0, 0) 20 | and plane ( 0, -4, 0; 0, -1, 0) 21 | and plane ( 0, 4, 0; 0, 1, 0) ); 22 | 23 | solid coil1 = 24 | cylinder (-7, -3, 0;-7, 3, 0; 3) 25 | and not cylinder (-7, -3, 0;-7, 3, 0; 2) 26 | and plane (0, -3, 0; 0, -1, 0) 27 | and plane (0, 3, 0; 0, 1, 0); 28 | solid coil2 = 29 | cylinder ( 0, -3, 0; 0, 3, 0; 3) 30 | and not cylinder ( 0, -3, 0; 0, 3, 0; 2) 31 | and plane (0, -3, 0; 0, -1, 0) 32 | and plane (0, 3, 0; 0, 1, 0); 33 | solid coil3 = 34 | cylinder ( 7, -3, 0; 7, 3, 0; 3) 35 | and not cylinder ( 7, -3, 0; 7, 3, 0; 2) 36 | and plane (0, -3, 0; 0, -1, 0) 37 | and plane (0, 3, 0; 0, 1, 0); 38 | 39 | solid box = 40 | plane (-12, 0, 0; -1, 0, 0) 41 | and plane ( 12, 0, 0; 1, 0, 0) 42 | and plane ( 0, 8, 0; 0, 1, 0) 43 | and plane ( 0,-8, 0; 0, -1, 0) 44 | and plane ( 0, 0, 5; 0, 0, 1) 45 | and plane ( 0, 0, -5; 0, 0, -1); 46 | 47 | solid air = box and not core and not coil1 and not coil2 and not coil3; 48 | 49 | tlo coil1 -col=[0,1,0]; 50 | tlo coil2 -col=[0,1,0]; 51 | tlo coil3 -col=[0,1,0]; 52 | tlo air -col=[0,0,1] -transparent; 53 | tlo core -col=[1,1,0]; 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /libsrc/meshing/global.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_GLOBAL 2 | #define FILE_GLOBAL 3 | 4 | 5 | /**************************************************************************/ 6 | /* File: global.hh */ 7 | /* Author: Joachim Schoeberl */ 8 | /* Date: 01. Okt. 95 */ 9 | /**************************************************************************/ 10 | 11 | /* 12 | global functions and variables 13 | */ 14 | 15 | namespace netgen 16 | { 17 | 18 | /// 19 | DLL_HEADER extern double GetTime (); 20 | DLL_HEADER extern void ResetTime (); 21 | 22 | /// 23 | DLL_HEADER extern int testmode; 24 | 25 | /// calling parameters 26 | // extern Flags parameters; 27 | 28 | // extern DLL_HEADER MeshingParameters mparam; 29 | 30 | DLL_HEADER extern Array tets_in_qualclass; 31 | 32 | DLL_HEADER extern mutex tcl_todo_mutex; 33 | 34 | class DLL_HEADER multithreadt 35 | { 36 | public: 37 | int pause; 38 | int testmode; 39 | int redraw; 40 | int drawing; 41 | int terminate; 42 | int running; 43 | double percent; 44 | const char * task; 45 | bool demorunning; 46 | string * tcl_todo = new string(""); // tcl commands set from parallel thread 47 | multithreadt(); 48 | }; 49 | 50 | DLL_HEADER extern volatile multithreadt multithread; 51 | 52 | DLL_HEADER extern string ngdir; 53 | DLL_HEADER extern DebugParameters debugparam; 54 | DLL_HEADER extern bool verbose; 55 | 56 | DLL_HEADER extern int h_argc; 57 | DLL_HEADER extern char ** h_argv; 58 | 59 | 60 | DLL_HEADER extern weak_ptr global_mesh; 61 | DLL_HEADER void SetGlobalMesh (shared_ptr m); 62 | } 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /ng/netgenpy.cpp: -------------------------------------------------------------------------------- 1 | // a wrapper to load netgen-dll into python 2 | 3 | #include 4 | #include <../general/ngpython.hpp> 5 | 6 | #ifdef WIN32 7 | #define DLL_HEADER __declspec(dllimport) 8 | #else 9 | #define DLL_HEADER 10 | #endif 11 | 12 | 13 | void DLL_HEADER ExportNetgenMeshing(py::module &m); 14 | void DLL_HEADER ExportMeshVis(py::module &m); 15 | void DLL_HEADER ExportCSG(py::module &m); 16 | void DLL_HEADER ExportCSGVis(py::module &m); 17 | void DLL_HEADER ExportGeom2d(py::module &m); 18 | void DLL_HEADER ExportSTL(py::module &m); 19 | void DLL_HEADER ExportSTLVis(py::module &m); 20 | 21 | PYBIND11_PLUGIN(libngpy) 22 | { 23 | py::module ngpy("libngpy", "pybind netgen module"); 24 | py::module meshing = ngpy.def_submodule("_meshing", "pybind meshing module"); 25 | ExportNetgenMeshing(meshing); 26 | py::module csg = ngpy.def_submodule("_csg", "pybind csg module"); 27 | ExportCSG(csg); 28 | py::module geom2d = ngpy.def_submodule("_geom2d", "pybind geom2d module"); 29 | ExportGeom2d(geom2d); 30 | py::module stl = ngpy.def_submodule("_stl", "pybind stl module"); 31 | ExportSTL(stl); 32 | #ifdef OPENGL 33 | py::module meshvis = ngpy.def_submodule("meshvis", "pybind meshvis module"); 34 | ExportMeshVis(meshvis); 35 | py::module csgvis = ngpy.def_submodule("csgvis", "pybind csgvis module"); 36 | ExportCSGVis(csgvis); 37 | py::module stlvis = ngpy.def_submodule("stlvis", "pybind stlvis module"); 38 | ExportSTLVis(stlvis); 39 | #endif // OPENGL 40 | return ngpy.ptr(); 41 | } 42 | 43 | // Force linking libnglib to libnetgenpy 44 | namespace netgen 45 | { 46 | void MyBeep (int i); 47 | void MyDummyToForceLinkingNGLib() 48 | { 49 | MyBeep(0); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /libsrc/occ/Partition_Inter2d.jxx: -------------------------------------------------------------------------------- 1 | // GEOM PARTITION : partition algorithm 2 | // 3 | // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 4 | // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 5 | // 6 | // This library is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 2.1 of the License. 10 | // 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | // Lesser General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Lesser General Public 17 | // License along with this library; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | // 20 | // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 21 | // 22 | // 23 | // 24 | // File : Partition_Inter2d.jxx 25 | // Module : GEOM 26 | 27 | #include // netgen headers 28 | 29 | 30 | #ifndef _BRepAlgo_AsDes_HeaderFile 31 | #include 32 | #endif 33 | #ifndef _TopoDS_Face_HeaderFile 34 | #include 35 | #endif 36 | #ifndef _TopTools_MapOfShape_HeaderFile 37 | #include 38 | #endif 39 | #ifndef _TopoDS_Vertex_HeaderFile 40 | #include 41 | #endif 42 | #ifndef _TopTools_ListOfShape_HeaderFile 43 | #include 44 | #endif 45 | #ifndef _TopoDS_Edge_HeaderFile 46 | #include 47 | #endif 48 | #ifndef _Partition_Inter2d_HeaderFile 49 | #include "Partition_Inter2d.hxx" 50 | #endif 51 | -------------------------------------------------------------------------------- /libsrc/general/profiler.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_NG_PROFILER 2 | #define FILE_NG_PROFILER 3 | 4 | /**************************************************************************/ 5 | /* File: profiler.hpp */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 5. Jan. 2005 */ 8 | /**************************************************************************/ 9 | 10 | 11 | 12 | #ifdef VTRACE 13 | #include "vt_user.h" 14 | #else 15 | #define VT_USER_START(n) 16 | #define VT_USER_END(n) 17 | #define VT_TRACER(n) 18 | #endif 19 | 20 | namespace netgen 21 | { 22 | 23 | class NgProfiler 24 | { 25 | enum { SIZE = 1000 }; 26 | 27 | static long int tottimes[SIZE]; 28 | static long int starttimes[SIZE]; 29 | static long int counts[SIZE]; 30 | static string names[SIZE]; 31 | static int usedcounter[SIZE]; 32 | 33 | int total_timer; 34 | public: 35 | NgProfiler(); 36 | ~NgProfiler(); 37 | static int CreateTimer (const string & name); 38 | 39 | static void StartTimer (int nr) 40 | { 41 | starttimes[nr] = clock(); counts[nr]++; 42 | // VT_USER_START (const_cast (names[nr].c_str())); 43 | VT_USER_START ( (char * const) (names[nr].c_str())); 44 | } 45 | static void StopTimer (int nr) 46 | { 47 | tottimes[nr] += clock()-starttimes[nr]; 48 | VT_USER_END (const_cast (names[nr].c_str())); 49 | } 50 | 51 | //static void Print (ostream & ost); 52 | static void Print (FILE * prof); 53 | 54 | static void ClearTimers (); 55 | 56 | class RegionTimer 57 | { 58 | int nr; 59 | public: 60 | RegionTimer (int anr) : nr(anr) 61 | { StartTimer (nr); } 62 | ~RegionTimer () { StopTimer (nr); } 63 | }; 64 | }; 65 | 66 | } 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /libsrc/csg/curve2d.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | namespace netgen 7 | { 8 | CircleCurve2d :: CircleCurve2d (const Point<2> & acenter, double arad) 9 | { 10 | center = acenter; 11 | rad = arad; 12 | } 13 | 14 | void CircleCurve2d :: Project (Point<2> & p) const 15 | { 16 | Vec<2> v = p - center; 17 | v *= rad/v.Length(); 18 | p = center + v; 19 | } 20 | 21 | void CircleCurve2d :: NormalVector (const Point<2> & p, Vec<2> & n) const 22 | { 23 | n = p - center; 24 | n /= n.Length(); 25 | } 26 | 27 | 28 | 29 | 30 | 31 | 32 | QuadraticCurve2d :: QuadraticCurve2d () 33 | { 34 | cxx = cyy = cxy = cx = cy = c = 0; 35 | } 36 | 37 | void QuadraticCurve2d :: Read (istream & ist) 38 | { 39 | ist >> cxx >> cyy >> cxy >> cx >> cy >> c; 40 | } 41 | 42 | 43 | void QuadraticCurve2d :: Project (Point<2> & p) const 44 | { 45 | double f, x, y, gradx, grady, grad2; 46 | int its = 0; 47 | 48 | x = p(0); 49 | y = p(1); 50 | 51 | do 52 | { 53 | f = cxx * x * x + cyy * y * y + cxy * x * y + cx * x + cy * y + c; 54 | gradx = 2 * cxx * x + cxy * y + cx; 55 | grady = 2 * cyy * y + cxy * x + cy; 56 | grad2 = gradx * gradx + grady * grady; 57 | 58 | x -= f * gradx / grad2; 59 | y -= f * grady / grad2; 60 | 61 | // (*mycout) << "x = " << x << " y = " << y << " f = " << f << endl; 62 | its++; 63 | } 64 | while (fabs (f) > 1e-8 && its < 20); 65 | if (its >= 20) 66 | cerr << "QuadraticCurve2d::Project: many iterations, f = " << f << endl; 67 | p(0) = x; 68 | p(1) = y; 69 | } 70 | 71 | 72 | void QuadraticCurve2d :: NormalVector (const Point<2> & p, Vec<2> & n) const 73 | { 74 | n(0) = 2 * cxx * p(0) + cxy * p(1) + cx; 75 | n(1) = 2 * cyy * p(1) + cxy * p(0) + cy; 76 | n.Normalize(); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /libsrc/gprim/splinegeometry.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 4 | JS, Nov 2007 5 | 6 | 7 | The 2D/3D template-base classes should go into the libsrc/gprim directory 8 | 9 | in geom2d only 2D - Geometry classes (with material properties etc.) 10 | 11 | 12 | */ 13 | 14 | #include "spline.hpp" 15 | 16 | 17 | #ifndef _FILE_SPLINEGEOMETRY 18 | #define _FILE_SPLINEGEOMETRY 19 | 20 | namespace netgen 21 | { 22 | 23 | 24 | template < int D > 25 | class SplineGeometry 26 | { 27 | // protected: 28 | public: 29 | Array < GeomPoint > geompoints; 30 | Array < SplineSeg* > splines; 31 | 32 | DLL_HEADER ~SplineGeometry(); 33 | 34 | DLL_HEADER int Load (const Array & raw_data, const int startpos = 0); 35 | 36 | DLL_HEADER void GetRawData (Array & raw_data) const; 37 | 38 | 39 | const Array*> & GetSplines () const 40 | { return splines; } 41 | 42 | int GetNSplines (void) const { return splines.Size(); } 43 | string GetSplineType (const int i) const { return splines[i]->GetType(); } 44 | SplineSeg & GetSpline (const int i) {return *splines[i];} 45 | const SplineSeg & GetSpline (const int i) const {return *splines[i];} 46 | 47 | DLL_HEADER void GetBoundingBox (Box & box) const; 48 | Box GetBoundingBox () const 49 | { Box box; GetBoundingBox (box); return box; } 50 | 51 | int GetNP () const { return geompoints.Size(); } 52 | const GeomPoint & GetPoint(int i) const { return geompoints[i]; } 53 | 54 | // void SetGrading (const double grading); 55 | DLL_HEADER void AppendPoint (const Point & p, const double reffac = 1., const bool hpref = false); 56 | 57 | 58 | void AppendSegment(SplineSeg * spline) 59 | { 60 | splines.Append (spline); 61 | } 62 | }; 63 | 64 | 65 | 66 | } 67 | 68 | #endif // _FILE_SPLINEGEOMETRY 69 | -------------------------------------------------------------------------------- /libsrc/meshing/basegeom.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_BASEGEOM 2 | #define FILE_BASEGEOM 3 | 4 | /**************************************************************************/ 5 | /* File: basegeom.hpp */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 23. Aug. 09 */ 8 | /**************************************************************************/ 9 | 10 | 11 | struct Tcl_Interp; 12 | 13 | namespace netgen 14 | { 15 | 16 | class DLL_HEADER NetgenGeometry 17 | { 18 | public: 19 | virtual ~NetgenGeometry () { ; } 20 | 21 | virtual int GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam); 22 | 23 | virtual const Refinement & GetRefinement () const; 24 | 25 | virtual void Save (string filename) const; 26 | virtual void SaveToMeshFile (ostream & /* ost */) const { ; } 27 | }; 28 | 29 | 30 | 31 | 32 | 33 | class DLL_HEADER GeometryRegister 34 | { 35 | public: 36 | virtual ~GeometryRegister(); 37 | virtual NetgenGeometry * Load (string filename) const = 0; 38 | virtual NetgenGeometry * LoadFromMeshFile (istream & /* ist */) const { return NULL; } 39 | virtual class VisualScene * GetVisualScene (const NetgenGeometry * /* geom */) const 40 | { return NULL; } 41 | virtual void SetParameters (Tcl_Interp * /* interp */) { ; } 42 | }; 43 | 44 | class DLL_HEADER GeometryRegisterArray : public Array 45 | { 46 | public: 47 | virtual ~GeometryRegisterArray() 48 | { 49 | for (int i = 0; i < Size(); i++) 50 | delete (*this)[i]; 51 | } 52 | }; 53 | 54 | // extern DLL_HEADER Array geometryregister; 55 | extern DLL_HEADER GeometryRegisterArray geometryregister; 56 | } 57 | 58 | 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /libsrc/geom2d/geom2dmesh.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_GEOM2DMESH 2 | #define FILE_GEOM2DMESH 3 | 4 | /**************************************************************************/ 5 | /* File: geom2dmesh.hh */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 22. Jan. 01 */ 8 | /**************************************************************************/ 9 | 10 | 11 | namespace netgen 12 | { 13 | 14 | class Refinement2d : public Refinement 15 | { 16 | const class SplineGeometry2d & geometry; 17 | 18 | public: 19 | Refinement2d (const class SplineGeometry2d & ageometry); 20 | virtual ~Refinement2d (); 21 | 22 | virtual void PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint, 23 | int surfi, 24 | const PointGeomInfo & gi1, 25 | const PointGeomInfo & gi2, 26 | Point<3> & newp, PointGeomInfo & newgi) const; 27 | 28 | virtual void PointBetween (const Point<3> & p1, const Point<3> & p2, double secpoint, 29 | int surfi1, int surfi2, 30 | const EdgePointGeomInfo & ap1, 31 | const EdgePointGeomInfo & ap2, 32 | Point<3> & newp, EdgePointGeomInfo & newgi) const; 33 | 34 | 35 | virtual Vec<3> GetTangent (const Point<3> & p, int surfi1, int surfi2, 36 | const EdgePointGeomInfo & ap1) const; 37 | 38 | virtual Vec<3> GetNormal (const Point<3> & p, int surfi1, 39 | const PointGeomInfo & gi) const; 40 | 41 | virtual void ProjectToSurface (Point<3> & p, int surfi, const PointGeomInfo & /* gi */) const; 42 | 43 | virtual void ProjectToEdge (Point<3> & p, int surfi1, int surfi2, 44 | const EdgePointGeomInfo & egi) const; 45 | }; 46 | 47 | 48 | } 49 | 50 | 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /ng/parameters.tcl: -------------------------------------------------------------------------------- 1 | proc setgranularity { gran } { 2 | # 3 | # puts "set granularity $gran" 4 | # 5 | if {$gran == 6} { return } 6 | set gran [expr $gran - 1] 7 | # 8 | global options.curvaturesafety 9 | set surfcurvlist { 1 1.5 2 3 5 } 10 | set options.curvaturesafety [lindex $surfcurvlist $gran] 11 | 12 | global options.segmentsperedge 13 | set spelist { 0.3 0.5 1 2 3 } 14 | set options.segmentsperedge [lindex $spelist $gran] 15 | 16 | global stloptions.resthsurfcurvfac 17 | set surfcurvfaclist { 0.25 0.5 1 1.5 3 } 18 | set stloptions.resthsurfcurvfac [lindex $surfcurvfaclist $gran] 19 | 20 | global stloptions.resthchartdistfac 21 | set chartdistfaclist { 0.8 1 1.5 2 5 } 22 | set stloptions.resthchartdistfac [lindex $chartdistfaclist $gran] 23 | 24 | global stloptions.resthlinelengthfac 25 | set linelengthfaclist { 0.2 0.35 0.5 1.5 3 } 26 | set stloptions.resthlinelengthfac [lindex $linelengthfaclist $gran] 27 | 28 | global stloptions.resthcloseedgefac 29 | set closeedgefaclist { 0.5 1 2 3.5 5 } 30 | set stloptions.resthcloseedgefac [lindex $closeedgefaclist $gran] 31 | 32 | global stloptions.resthminedgelen 33 | set minedgelenlist { 0.002 0.02 0.2 1.0 2.0 5.0 10.0 } 34 | set stloptions.resthminedgelen [lindex $minedgelenlist $gran] 35 | 36 | global stloptions.resthedgeanglefac 37 | set edgeanglefaclist { 0.25 0.5 1 1.5 3 } 38 | set stloptions.resthedgeanglefac [lindex $edgeanglefaclist $gran] 39 | 40 | 41 | global stloptions.resthsurfmeshcurvfac 42 | set surfmeshcurvlist { 1 1.5 2 3 5 } 43 | set stloptions.resthsurfmeshcurvfac [lindex $surfmeshcurvlist $gran] 44 | 45 | 46 | global options.grading 47 | set gradinglist { 0.7 0.5 0.3 0.2 0.1 } 48 | set options.grading [lindex $gradinglist $gran] 49 | 50 | } 51 | -------------------------------------------------------------------------------- /ng/Togl2.1/toglProcAddr.c: -------------------------------------------------------------------------------- 1 | /* $Id */ 2 | 3 | /* vi:set sw=4: */ 4 | 5 | /* 6 | * Togl - a Tk OpenGL widget 7 | * 8 | * Copyright (C) 1996-2002 Brian Paul and Ben Bederson 9 | * Copyright (C) 2005-2009 Greg Couch 10 | * See the LICENSE file for copyright details. 11 | */ 12 | 13 | #include "togl.h" 14 | 15 | #if defined(TOGL_OSMESA) || defined(TOGL_WGL) 16 | /* nothing extra to include */ 17 | #elif defined(__APPLE__) 18 | # include 19 | #else 20 | # if !defined(TOGL_X11) || !defined(GLX_VERSION_1_4) 21 | # include 22 | # endif 23 | #endif 24 | 25 | Togl_FuncPtr 26 | Togl_GetProcAddr(const char *funcname) 27 | { 28 | #if defined(TOGL_OSMESA) 29 | return (Togl_FuncPtr) OSMesaGetProcAddress(funcname); 30 | #elif defined(TOGL_WGL) 31 | return (Togl_FuncPtr) wglGetProcAddress(funcname); 32 | #elif defined(__APPLE__) 33 | char buf[256]; 34 | 35 | snprintf(buf, sizeof buf - 1, "_%s", funcname); 36 | buf[sizeof buf - 1] = '\0'; 37 | if (NSIsSymbolNameDefined(buf)) { 38 | NSSymbol nssym; 39 | 40 | nssym = NSLookupAndBindSymbol(buf); 41 | if (nssym) 42 | return (Togl_FuncPtr) NSAddressOfSymbol(nssym); 43 | } 44 | return NULL; 45 | #else 46 | # if defined(TOGL_X11) && defined(GLX_VERSION_1_4) 47 | /* Strictly speaking, we can only call glXGetProcAddress if glXQueryVersion 48 | * says we're using version 1.4 or later. */ 49 | return (Togl_FuncPtr) glXGetProcAddress(funcname); 50 | # else 51 | /* Linux, IRIX, OSF/1, ? */ 52 | static void *dlHandle = NULL; 53 | 54 | if (dlHandle == NULL) 55 | dlHandle = dlopen(NULL, RTLD_LAZY); 56 | /* Strictly speaking, the following cast of a data pointer to a function 57 | * pointer is not legal in ISO C, but we don't have any choice. */ 58 | return (Togl_FuncPtr) dlsym(dlHandle, funcname); 59 | # endif 60 | #endif 61 | } 62 | -------------------------------------------------------------------------------- /libsrc/csg/gencyl.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_GENCYL 2 | #define FILE_GENCYL 3 | 4 | /**************************************************************************/ 5 | /* File: gencyl.hh */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 14. Oct. 96 */ 8 | /**************************************************************************/ 9 | 10 | namespace netgen 11 | { 12 | 13 | 14 | /* 15 | 16 | Generalized Cylinder 17 | 18 | */ 19 | 20 | 21 | /// 22 | class GeneralizedCylinder : public Surface 23 | { 24 | /// 25 | ExplicitCurve2d & crosssection; 26 | /// 27 | Point<3> planep; 28 | /// 29 | Vec<3> planee1, planee2, planee3; 30 | 31 | /// Vec<3> ex, ey, ez; 32 | Vec2d e2x, e2y; 33 | /// 34 | Point<3> cp; 35 | 36 | public: 37 | /// 38 | GeneralizedCylinder (ExplicitCurve2d & acrosssection, 39 | Point<3> ap, Vec<3> ae1, Vec<3> ae2); 40 | 41 | /// 42 | virtual void Project (Point<3> & p) const; 43 | 44 | /// 45 | virtual int BoxInSolid (const BoxSphere<3> & box) const; 46 | /// 0 .. no, 1 .. yes, 2 .. maybe 47 | 48 | virtual double CalcFunctionValue (const Point<3> & point) const; 49 | /// 50 | virtual void CalcGradient (const Point<3> & point, Vec<3> & grad) const; 51 | /// 52 | virtual void CalcHesse (const Point<3> & point, Mat<3> & hesse) const; 53 | /// 54 | virtual double HesseNorm () const; 55 | /// 56 | virtual double MaxCurvatureLoc (const Point<3> & c, double rad) const; 57 | /// 58 | virtual Point<3> GetSurfacePoint () const; 59 | /// 60 | virtual void Print (ostream & str) const; 61 | 62 | /// 63 | virtual void Reduce (const BoxSphere<3> & box); 64 | /// 65 | virtual void UnReduce (); 66 | }; 67 | 68 | } 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /ng/Togl2.1/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | if(APPLE) 3 | set(CMAKE_C_COMPILER "/usr/bin/gcc") 4 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -x objective-c") 5 | endif(APPLE) 6 | 7 | if(WIN32) 8 | add_definitions("-DBUILD_togl -DUNICODE -D_UNICODE -DTOGL_USE_FONTS=0 -DSTDC_HEADERS -DSTDC_HEADER") 9 | add_library(togl SHARED togl.c toglProcAddr.c toglStubInit.c) 10 | install(TARGETS togl DESTINATION ${ng_install_dir} COMPONENT netgen) 11 | else(WIN32) 12 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer -Wno-implicit-int") 13 | add_definitions("-DPACKAGE_NAME=\"Togl\" -DPACKAGE_TARNAME=\"togl\" -DPACKAGE_VERSION=\"2.1\" -DPACKAGE_STRING=\"Togl\ 2.1\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=0 -DHAVE_LIMITS_H=1 -DHAVE_SYS_PARAM_H=1 -DUSE_THREAD_ALLOC=1 -D_REENTRANT=1 -D_THREAD_SAFE=1 -DTCL_THREADS=1 -DMODULE_SCOPE=extern\ __attribute__\(\(__visibility__\(\"hidden\"\)\)\) -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_IS_LONG=1 -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1 -DAUTOSTEREOD=\"\"") 14 | 15 | include_directories(BEFORE "${TCL_INCLUDE_PATH}/tcl-private/generic" "${TCL_INCLUDE_PATH}/tcl-private/unix") 16 | include_directories(BEFORE "${TCL_INCLUDE_PATH}/tk-private/generic" "${TCL_INCLUDE_PATH}/tk-private/unix") 17 | include_directories(BEFORE "${TCL_INCLUDE_PATH}/tk-private/generic/ttk") 18 | include_directories(BEFORE "${TK_INCLUDE_PATH}/../PrivateHeaders") 19 | include_directories(BEFORE "${TCL_INCLUDE_PATH}") 20 | include_directories(BEFORE "${TK_INCLUDE_PATH}") 21 | 22 | add_library(togl togl.c toglProcAddr.c toglStubInit.c) 23 | target_link_libraries(togl -ldl) 24 | endif(WIN32) 25 | 26 | target_link_libraries(togl ${OPENGL_LIBRARIES} ${TK_LIBRARY} ${TCL_LIBRARY} ) 27 | set_target_properties(togl PROPERTIES POSITION_INDEPENDENT_CODE ON ) 28 | -------------------------------------------------------------------------------- /libsrc/csg/splinesurface.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | namespace netgen 5 | { 6 | void SplineSurface :: AppendPoint(const Point<3> & p, const double reffac, const bool hpref) 7 | { 8 | auto pp = Point<3>(p); 9 | geompoints.Append(GeomPoint<3>(pp,reffac)); 10 | geompoints.Last().hpref = hpref; 11 | } 12 | 13 | void SplineSurface :: AppendSegment(SplineSeg<3>* spline, string* bcname, double amaxh) 14 | { 15 | splines.Append(spline); 16 | bcnames.Append(bcname); 17 | maxh.Append(amaxh); 18 | } 19 | 20 | string* SplineSurface :: GetBCNameOf (Point<3> p1, Point<3> p2) const 21 | { 22 | 23 | double eps = 1e-5; 24 | for(int i=0; i(splines[i]->GetPoint(0)); 27 | Project(pp1); 28 | auto pp2 = Point<3>(splines[i]->GetPoint(1)); 29 | Project(pp2); 30 | if (((pp1-p1).Length()* SplineSurface :: CreateCuttingSurfaces() const 39 | { 40 | auto cuttings = new Array(); 41 | for (auto cut : *cuts) 42 | cuttings->Append(cut); 43 | for(int i = 0; i*>(spline); 47 | auto p1 = Point<3>(spline->GetPoint(0)); 48 | Project(p1); 49 | auto p2 = Point<3>(spline->GetPoint(1)); 50 | Project(p2); 51 | auto vec = Vec<3>(p2)-Vec<3>(p1); 52 | auto plane = new Plane(p1,-Cross(vec,baseprimitive->GetNormalVector(p1))); 53 | if(maxh[i]>0) 54 | { 55 | plane->SetMaxH(maxh[i]); 56 | } 57 | cuttings->Append(plane); 58 | } 59 | return cuttings; 60 | } 61 | 62 | void SplineSurface :: Print(ostream & str) const 63 | { 64 | str << "SplineSurface " << endl; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /libsrc/general/array.cpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_NGSTD_ArrayCPP 2 | #define FILE_NGSTD_ArrayCPP 3 | // necessary for SGI ???? 4 | 5 | /**************************************************************************/ 6 | /* File: array.cpp */ 7 | /* Author: Joachim Schoeberl */ 8 | /* Date: 01. Jun. 95 */ 9 | /**************************************************************************/ 10 | 11 | /* 12 | Abstract data type Array 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | 20 | namespace netgen 21 | { 22 | //using namespace netgen; 23 | 24 | #ifdef NONE 25 | void BASE_Array :: ReSize (int minsize, int elementsize) 26 | { 27 | cout << "resize, minsize = " << minsize << endl; 28 | 29 | if (inc == -1) 30 | throw Exception ("Try to resize fixed size array"); 31 | 32 | 33 | void * p; 34 | int nsize = (inc) ? allocsize + inc : 2 * allocsize; 35 | if (nsize < minsize) nsize = minsize; 36 | 37 | if (data) 38 | { 39 | p = new char [nsize * elementsize]; 40 | 41 | int mins = (nsize < actsize) ? nsize : actsize; 42 | memcpy (p, data, mins * elementsize); 43 | 44 | delete [] static_cast (data); 45 | data = p; 46 | } 47 | else 48 | { 49 | data = new char[nsize * elementsize]; 50 | } 51 | 52 | allocsize = nsize; 53 | cout << "resize done" << endl; 54 | } 55 | 56 | 57 | 58 | void BASE_Array :: RangeCheck (int i) const 59 | { 60 | if (i < 0 || i >= actsize) 61 | throw ArrayRangeException (); 62 | } 63 | 64 | void BASE_Array :: CheckNonEmpty () const 65 | { 66 | if (!actsize) 67 | { 68 | throw Exception ("Array should not be empty"); 69 | // cerr << "Array souldn't be empty"; 70 | } 71 | } 72 | #endif 73 | } 74 | #endif 75 | 76 | -------------------------------------------------------------------------------- /libsrc/occ/Partition_Inter3d.jxx: -------------------------------------------------------------------------------- 1 | // GEOM PARTITION : partition algorithm 2 | // 3 | // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 4 | // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 5 | // 6 | // This library is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 2.1 of the License. 10 | // 11 | // This library is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | // Lesser General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Lesser General Public 17 | // License along with this library; if not, write to the Free Software 18 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | // 20 | // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 21 | // 22 | // 23 | // 24 | // File : Partition_Inter3d.jxx 25 | // Module : GEOM 26 | 27 | #ifndef _BRepAlgo_AsDes_HeaderFile 28 | #include 29 | #endif 30 | #ifndef _TopTools_ListOfShape_HeaderFile 31 | #include 32 | #endif 33 | #ifndef _TopTools_DataMapOfShapeShape_HeaderFile 34 | #include 35 | #endif 36 | #ifndef _TopoDS_Face_HeaderFile 37 | #include 38 | #endif 39 | #ifndef _TopTools_MapOfShape_HeaderFile 40 | #include 41 | #endif 42 | #ifndef _TopoDS_Shape_HeaderFile 43 | #include 44 | #endif 45 | #ifndef _TopoDS_Vertex_HeaderFile 46 | #include 47 | #endif 48 | #ifndef _TopoDS_Edge_HeaderFile 49 | #include 50 | #endif 51 | #ifndef _Partition_Inter3d_HeaderFile 52 | #include "Partition_Inter3d.hxx" 53 | #endif 54 | -------------------------------------------------------------------------------- /libsrc/linalg/linopt.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include "opti.hpp" 6 | 7 | namespace netgen 8 | { 9 | 10 | void LinearOptimize (const DenseMatrix & a, const Vector & b, 11 | const Vector & c, Vector & x) 12 | 13 | { 14 | int i1, i2, i3, j; 15 | DenseMatrix m(3), inv(3); 16 | Vector rs(3), hx(3), res(a.Height()), res2(3); 17 | double f, fmin; 18 | int nrest; 19 | 20 | if (a.Width() != 3) 21 | { 22 | cerr << "LinearOptimize only implemented for 3 unknowns" << endl; 23 | return; 24 | } 25 | 26 | fmin = 1e10; 27 | x = 0; 28 | nrest = a.Height(); 29 | for (i1 = 1; i1 <= nrest; i1++) 30 | for (i2 = i1 + 1; i2 <= nrest; i2++) 31 | for (i3 = i2 + 1; i3 <= nrest; i3++) 32 | { 33 | for (j = 1; j <= 3; j++) 34 | { 35 | m.Elem(1, j) = a.Get(i1, j); 36 | m.Elem(2, j) = a.Get(i2, j); 37 | m.Elem(3, j) = a.Get(i3, j); 38 | } 39 | 40 | rs(0) = b(i1-1); 41 | rs(1) = b(i2-1); 42 | rs(2) = b(i3-1); 43 | 44 | if (fabs (m.Det()) < 1e-12) continue; 45 | 46 | CalcInverse (m, inv); 47 | inv.Mult (rs, hx); 48 | 49 | a.Residuum (hx, b, res); 50 | // m.Residuum (hx, rs, res2); 51 | f = c * hx; 52 | 53 | /* 54 | testout -> precision(12); 55 | (*testout) << "i = (" << i1 << "," << i2 << "," << i3 56 | << "), f = " << f << " x = " << x << " res = " << res 57 | << " resmin = " << res.Min() 58 | << " res2 = " << res2 << " prod = " << prod << endl; 59 | */ 60 | 61 | 62 | double rmin = res(0); 63 | for (int hi = 1; hi < res.Size(); hi++) 64 | if (res(hi) < rmin) rmin = res(hi); 65 | 66 | if ( (f < fmin) && rmin >= -1e-8) 67 | { 68 | fmin = f; 69 | x = hx; 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /ng/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(netgen_sources demoview.cpp ngappinit.cpp onetcl.cpp parallelfunc.cpp ngpkg.cpp ../libsrc/stlgeom/stlpkg.cpp ../libsrc/visualization/visualpkg.cpp ../libsrc/csg/csgpkg.cpp ../libsrc/geom2d/geom2dpkg.cpp ../libsrc/occ/occpkg.cpp ../libsrc/occ/vsocc.cpp) 2 | 3 | if(USE_GUI) 4 | if(WIN32) 5 | # add icon to netgen executable 6 | enable_language(RC) 7 | set(netgen_sources ${netgen_sources} ../windows/netgen.rc) 8 | endif(WIN32) 9 | 10 | add_executable(netgen ${netgen_sources}) 11 | target_link_libraries( netgen nglib ${ZLIB_LIBRARIES} ${LIBTOGL} ${TK_LIBRARY} ${TCL_LIBRARY} ${JPEG_LIBRARIES} ${FFMPEG_LIBRARIES} ${X11_X11_LIB} ${OCC_LIBRARIES}) 12 | if(NOT WIN32) 13 | target_link_libraries( netgen mesh stlvis stl geom2dvis interface geom2d csg stl visual csgvis ) 14 | endif(NOT WIN32) 15 | 16 | install(TARGETS netgen ${ng_install_dir}) 17 | if(APPLE) 18 | set_target_properties(netgen PROPERTIES OUTPUT_NAME netgen) 19 | endif(APPLE) 20 | 21 | endif(USE_GUI) 22 | 23 | if(USE_PYTHON) 24 | add_library(ngpy SHARED netgenpy.cpp) 25 | target_link_libraries( ngpy nglib ) 26 | if(APPLE) 27 | set_target_properties( ngpy PROPERTIES SUFFIX ".so") 28 | elseif(WIN32) 29 | set_target_properties( ngpy PROPERTIES SUFFIX ".pyd") 30 | set_target_properties( ngpy PROPERTIES OUTPUT_NAME "libngpy") 31 | endif() 32 | install(TARGETS ngpy ${ng_install_dir}) 33 | endif(USE_PYTHON) 34 | 35 | if(USE_GUI) 36 | install(FILES 37 | dialog.tcl menustat.tcl ngicon.tcl ng.tcl 38 | ngvisual.tcl sockets.tcl nghelp.tcl ngshell.tcl 39 | ngtesting.tcl parameters.tcl variables.tcl csgeom.tcl stlgeom.tcl 40 | occgeom.tcl acisgeom.tcl netgen.ocf 41 | DESTINATION ${ng_install_dir_bin} COMPONENT netgen) 42 | 43 | add_subdirectory(Togl2.1) 44 | install(FILES drawing.tcl DESTINATION ${ng_install_dir_bin} COMPONENT netgen) 45 | endif(USE_GUI) 46 | 47 | -------------------------------------------------------------------------------- /libsrc/csg/triapprox.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_TRIAPPROX 2 | #define FILE_TRIAPPROX 3 | 4 | /**************************************************************************/ 5 | /* File: triapprox.hh */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 2. Mar. 98 */ 8 | /**************************************************************************/ 9 | 10 | 11 | namespace netgen 12 | { 13 | 14 | /** 15 | Triangulated approxiamtion to true surface 16 | */ 17 | 18 | 19 | class TATriangle 20 | { 21 | int pi[3]; 22 | int surfind; 23 | public: 24 | TATriangle () { ; } 25 | 26 | TATriangle (int si, int pi1, int pi2, int pi3) 27 | { surfind = si; pi[0] = pi1; pi[1] = pi2; pi[2] = pi3; } 28 | 29 | int SurfaceIndex() const { return surfind; } 30 | int & SurfaceIndex() { return surfind; } 31 | 32 | int & operator[] (int i) { return pi[i]; } 33 | const int & operator[] (int i) const { return pi[i]; } 34 | }; 35 | 36 | 37 | class TriangleApproximation 38 | { 39 | Array > points; 40 | Array > normals; 41 | Array trigs; 42 | 43 | public: 44 | TriangleApproximation(); 45 | int GetNP () const { return points.Size(); } 46 | int GetNT () const { return trigs.Size(); } 47 | 48 | int AddPoint (const Point<3> & p) { points.Append (p); return points.Size()-1; } 49 | int AddNormal (const Vec<3> & n) { normals.Append (n); return normals.Size()-1; } 50 | int AddTriangle (const TATriangle & tri, bool invert = 0); 51 | 52 | const Point<3> & GetPoint (int i) const { return points[i]; } 53 | const TATriangle & GetTriangle (int i) const { return trigs[i]; } 54 | const Vec<3> & GetNormal (int i) const { return normals[i]; } 55 | 56 | void RemoveUnusedPoints (); 57 | 58 | friend class CSGeometry; 59 | }; 60 | 61 | } 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /py_tutorials/opengl.py: -------------------------------------------------------------------------------- 1 | from netgen.csg import * 2 | import netgen.meshing as meshing 3 | import libvisual 4 | 5 | from OpenGL.GLUT import * 6 | 7 | # import Window class from other file 8 | from opengl_window import Window 9 | 10 | sp1 = Sphere (Pnt(0,0,0), 0.2) 11 | sp2 = Sphere (Pnt(0.5,0,0), 0.2) 12 | all = sp1+sp2 13 | 14 | geom = CSGeometry() 15 | geom.Add (all) 16 | 17 | param = meshing.MeshingParameters() 18 | param.maxh = 0.1 19 | m1 = GenerateMesh (geom, param) 20 | 21 | vis = VS(geom) 22 | 23 | 24 | # window callback functions 25 | def mydraw(): 26 | vis.Draw() 27 | glutSwapBuffers() 28 | 29 | def mymouse(xold, yold, x, y, mode): 30 | MouseMove(vis,xold,yold, x,y, mode) 31 | 32 | # init glut and create window 33 | glutInit("mainwin") 34 | win_geom = Window( name=b"ngs", drawfunc=mydraw, mousefunc=mymouse) 35 | 36 | ########################################### 37 | # press ctrl+c to break loop 38 | while(True): 39 | for i in range(10000): 40 | glutMainLoopEvent() 41 | print('press ctrl+c to create second window!') 42 | 43 | ########################################### 44 | # create second window (transformation matrices are shared) 45 | vismesh = libvisual.meshvis.VS(m1) 46 | def mydraw2(): 47 | vismesh.Draw() 48 | glutSwapBuffers() 49 | 50 | win_mesh = Window( name=b"ngs2", drawfunc=mydraw2, mousefunc=mymouse) 51 | 52 | ########################################### 53 | # press ctrl+c to break loop 54 | try: 55 | while(True): 56 | for i in range(10000): 57 | glutMainLoopEvent() 58 | print('press ctrl+c to hide/destroy first window!') 59 | except: 60 | pass 61 | 62 | ########################################### 63 | 64 | ## BREAKS (on numericus) as soon as mouse touches remaining window ("Error of failed request: GLXBadContextTag") 65 | # glutDestroyWindow(win_geom.handle) 66 | 67 | ## WORKS 68 | glutHideWindow(win_geom.handle) 69 | 70 | try: 71 | while(True): 72 | glutMainLoopEvent() 73 | except: 74 | pass 75 | -------------------------------------------------------------------------------- /libsrc/general/sort.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************/ 2 | /* File: sort.cc */ 3 | /* Author: Joachim Schoeberl */ 4 | /* Date: 07. Jan. 00 */ 5 | /**************************************************************************/ 6 | 7 | /* 8 | Sorting 9 | */ 10 | 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | namespace netgen 17 | { 18 | 19 | void Sort (const Array & values, 20 | Array & order) 21 | { 22 | int n = values.Size(); 23 | int i, j; 24 | 25 | order.SetSize (n); 26 | 27 | for (i = 1; i <= n; i++) 28 | order.Elem(i) = i; 29 | for (i = 1; i <= n-1; i++) 30 | for (j = 1; j <= n-1; j++) 31 | if (values.Get(order.Elem(j)) > values.Get(order.Elem(j+1))) 32 | { 33 | Swap (order.Elem(j), order.Elem(j+1)); 34 | } 35 | } 36 | 37 | 38 | void QuickSortRec (const Array & values, 39 | Array & order, 40 | int left, int right) 41 | { 42 | int i, j; 43 | double midval; 44 | 45 | i = left; 46 | j = right; 47 | midval = values.Get(order.Get((i+j)/2)); 48 | 49 | do 50 | { 51 | while (values.Get(order.Get(i)) < midval) i++; 52 | while (midval < values.Get(order.Get(j))) j--; 53 | 54 | if (i <= j) 55 | { 56 | Swap (order.Elem(i), order.Elem(j)); 57 | i++; j--; 58 | } 59 | } 60 | while (i <= j); 61 | if (left < j) QuickSortRec (values, order, left, j); 62 | if (i < right) QuickSortRec (values, order, i, right); 63 | } 64 | 65 | void QuickSort (const Array & values, 66 | Array & order) 67 | { 68 | int i, n = values.Size(); 69 | order.SetSize (n); 70 | for (i = 1; i <= n; i++) 71 | order.Elem(i) = i; 72 | 73 | QuickSortRec (values, order, 1, order.Size()); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /py_tutorials/csg_first_example.py: -------------------------------------------------------------------------------- 1 | from netgen.csg import * 2 | import netgen.meshing as meshing 3 | 4 | #from OpenGL.GL import * 5 | #from OpenGL.GLU import * 6 | #from OpenGL.GLUT import * 7 | 8 | 9 | 10 | sp1 = Sphere (Pnt(0,0,0), 0.2) 11 | sp2 = Sphere (Pnt(0.5,0,0), 0.2) 12 | sp3 = Sphere (Pnt(0,0,0.5), 0.2) 13 | sp4 = Sphere (Pnt(0,0.2,0.7), 0.2) 14 | 15 | all = sp1+sp2+sp3+sp4 16 | 17 | 18 | geom = CSGeometry() 19 | geom.Add (all) 20 | 21 | 22 | 23 | #vis = VS(geom) 24 | # vis.Draw() 25 | 26 | 27 | #window = 0 # glut window number 28 | #width, height = 500, 500 29 | 30 | 31 | 32 | #def mydraw(): 33 | # glViewport(0, 0, width, height); 34 | # glMatrixMode(GL_PROJECTION); 35 | # glLoadIdentity(); 36 | # pnear = 0.1; 37 | # pfar = 10; 38 | # gluPerspective(20.0, 1.0*width / height, pnear, pfar); 39 | # glMatrixMode(GL_MODELVIEW); 40 | # glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) 41 | # glLoadIdentity() 42 | # gluLookAt (0, 0, 6, 0, 0, 0, 0, 1, 0); 43 | ## glBegin(GL_QUADS) 44 | ## glColor4d(0.0, 1.0, 0.0, 0.0); 45 | ## glVertex3d(0.0,0.0,0.7) 46 | ## glVertex3d(1.0,0.0,2.1) 47 | ## glColor4d(1.0, 1.0, 1.0, 0.0); 48 | ## glVertex3d(1.0,1.0,0.2) 49 | ## glVertex3d(0.0,1.0,0.5) 50 | ## glEnd() 51 | # vis.Draw() 52 | # glutSwapBuffers() 53 | 54 | #glutInit("mainwin") # initialize glut 55 | #glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH) 56 | #glutInitWindowSize(width, height) # set window size 57 | #glutInitWindowPosition(0, 0) # set window position 58 | #window = glutCreateWindow(b"ngs") # create window with title 59 | #glutDisplayFunc(vis.Draw) # set draw function callback 60 | #glutIdleFunc(mydraw) # draw all the time 61 | #glutMainLoop() 62 | 63 | param = meshing.MeshingParameters(maxh=0.2) 64 | mesh = GenerateMesh (geom, param) 65 | mesh.Save ("test.vol") 66 | -------------------------------------------------------------------------------- /python/geom2d.py: -------------------------------------------------------------------------------- 1 | from libngpy._geom2d import * 2 | from libngpy._meshing import * 3 | 4 | tmp_generate_mesh = SplineGeometry.GenerateMesh 5 | 6 | def geom2d_meshing_func (geom, **args): 7 | if "mp" in args: 8 | return tmp_generate_mesh (geom, args["mp"]) 9 | else: 10 | return tmp_generate_mesh (geom, MeshingParameters (**args)) 11 | 12 | 13 | SplineGeometry.GenerateMesh = geom2d_meshing_func 14 | 15 | 16 | unit_square = SplineGeometry() 17 | pnts = [ (0,0), (1,0), (1,1), (0,1) ] 18 | lines = [ (0,1,1,"bottom"), (1,2,2,"right"), (2,3,3,"top"), (3,0,4,"left") ] 19 | pnums = [unit_square.AppendPoint(*p) for p in pnts] 20 | for l1,l2,bc,bcname in lines: 21 | unit_square.Append( ["line", pnums[l1], pnums[l2]], bc=bcname) 22 | 23 | 24 | def MakeRectangle (geo, p1, p2, bc=None, bcs=None, **args): 25 | p1x, p1y = p1 26 | p2x, p2y = p2 27 | p1x,p2x = min(p1x,p2x), max(p1x, p2x) 28 | p1y,p2y = min(p1y,p2y), max(p1y, p2y) 29 | if not bcs: bcs=4*[bc] 30 | print ("bcs = ", bcs) 31 | pts = [geo.AppendPoint(*p) for p in [(p1x,p1y), (p2x, p1y), (p2x, p2y), (p1x, p2y)]] 32 | for p1,p2,bc in [(0,1,bcs[0]), (1, 2, bcs[1]), (2, 3, bcs[2]), (3, 0, bcs[3])]: 33 | geo.Append( ["line", pts[p1], pts[p2]], bc=bc, **args) 34 | 35 | def MakeCircle (geo, c, r, **args): 36 | cx,cy = c 37 | pts = [geo.AppendPoint(*p) for p in [(cx,cy-r), (cx+r,cy-r), (cx+r,cy), (cx+r,cy+r), \ 38 | (cx,cy+r), (cx-r,cy+r), (cx-r,cy), (cx-r,cy-r)]] 39 | for p1,p2,p3 in [(0,1,2), (2,3,4), (4, 5, 6), (6, 7, 0)]: 40 | geo.Append( ["spline3", pts[p1], pts[p2], pts[p3]], **args) 41 | 42 | 43 | SplineGeometry.AddCircle = lambda geo, c, r, **args : MakeCircle(geo, c, r, **args) 44 | SplineGeometry.AddRectangle = lambda geo, p1, p2, **args : MakeRectangle(geo, p1, p2, **args) 45 | SplineGeometry.AddSegment = lambda *args, **kwargs : SplineGeometry.Append(*args, **kwargs) 46 | SplineGeometry.AddPoint = lambda *args, **kwargs : SplineGeometry.AppendPoint(*args, **kwargs) 47 | 48 | 49 | __all__ = ['SplineGeometry', 'unit_square'] 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /libsrc/interface/writedolfin.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Write dolfin file 3 | // 4 | // by 5 | // Kent-Andre Mardal 6 | 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | namespace netgen 16 | { 17 | 18 | #include "writeuser.hpp" 19 | 20 | 21 | 22 | void WriteDolfinFormat (const Mesh & mesh, const string & filename) 23 | { 24 | cout << "start writing dolfin export" << endl; 25 | 26 | int np = mesh.GetNP(); 27 | int ne = mesh.GetNE(); 28 | // int nse = mesh.GetNSE(); 29 | int nsd = mesh.GetDimension(); 30 | // int invertsurf = mparam.inverttrigs; 31 | // int i, j; 32 | 33 | ofstream outfile (filename.c_str()); 34 | 35 | // char str[100]; 36 | outfile.precision(8); 37 | outfile.setf (ios::fixed, ios::floatfield); 38 | outfile.setf (ios::showpoint); 39 | 40 | if ( nsd == 3) { 41 | 42 | outfile << "" <"<" <"<"<"<"<"<"<"<"< 6 | #$ 7 | #$ 8 | #$ 9 | $ 10 | $ 11 | $ 12 | $ 13 | $ 14 | $ 15 | $ 16 | 17 | #$ 18 | #$ 19 | $ 20 | ) 21 | endif(WIN32) 22 | 23 | add_library(nglib SHARED nglib.cpp ${nglib_objects}) 24 | if(NOT WIN32) 25 | target_link_libraries( nglib mesh stl interface geom2d csg stl visual) 26 | if(USE_GUI) 27 | target_link_libraries( nglib stlvis geom2dvis csgvis ) 28 | endif(USE_GUI) 29 | endif(NOT WIN32) 30 | 31 | target_link_libraries( nglib ${OCC_LIBRARIES} ${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} ${TK_LIBRARY} ${TCL_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${X11_Xmu_LIB} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} ${ZLIB_LIBRARIES} ${OCC_LIBRARIES} ) 32 | 33 | if(USE_OCC AND NOT WIN32) 34 | target_link_libraries(nglib occ) 35 | endif(USE_OCC AND NOT WIN32) 36 | 37 | if(USE_PYTHON) 38 | target_link_libraries(nglib ${PYTHON_LIBRARIES}) 39 | endif(USE_PYTHON) 40 | 41 | # if(NOT WIN32) 42 | # add_executable(ng_vol ng_vol.cpp ${nglib_objects}) 43 | # target_link_libraries( ng_vol nglib ${OCC_LIBRARIES} ${MPI_CXX_LIBRARIES} ) 44 | # target_link_libraries( ng_vol nglib interface geom2d csg stl occ mesh ) 45 | # 46 | # add_executable(ng_stl ng_stl.cpp ${nglib_objects}) 47 | # target_link_libraries( ng_stl nglib ${OCC_LIBRARIES} ${OCC_OCAF_LIBRARIES} ${MPI_CXX_LIBRARIES} ) 48 | # target_link_libraries( ng_stl nglib interface geom2d csg stl occ mesh ) 49 | # 50 | # install(TARGETS nglib ng_vol ng_stl ${ng_install_dir}) 51 | # endif(NOT WIN32) 52 | 53 | install(TARGETS nglib ${ng_install_dir}) 54 | 55 | install(FILES nglib.h DESTINATION ${INCDIR} COMPONENT netgen_devel) -------------------------------------------------------------------------------- /nglib/ng_vol.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace std; 5 | 6 | namespace nglib { 7 | #include 8 | } 9 | 10 | int main (int argc, char ** argv) 11 | { 12 | using namespace nglib; 13 | 14 | cout << "Netgen Testing" << endl; 15 | 16 | if (argc < 2) 17 | { 18 | cerr << "use: ng_vol filename" << endl; 19 | return 1; 20 | } 21 | 22 | 23 | 24 | Ng_Mesh * mesh; 25 | 26 | Ng_Init(); 27 | 28 | // creates mesh structure 29 | mesh = Ng_NewMesh (); 30 | 31 | 32 | 33 | 34 | 35 | int i, np, nse, ne; 36 | double point[3]; 37 | int trig[3], tet[4]; 38 | 39 | 40 | // reads surface mesh from file 41 | ifstream in(argv[1]); 42 | 43 | in >> np; 44 | cout << "Reading " << np << " points..."; cout.flush(); 45 | for (i = 1; i <= np; i++) 46 | { 47 | in >> point[0] >> point[1] >> point[2]; 48 | Ng_AddPoint (mesh, point); 49 | } 50 | cout << "done" << endl; 51 | 52 | in >> nse; 53 | cout << "Reading " << nse << " faces..."; cout.flush(); 54 | for (i = 1; i <= nse; i++) 55 | { 56 | in >> trig[0] >> trig[1] >> trig[2]; 57 | Ng_AddSurfaceElement (mesh, NG_TRIG, trig); 58 | } 59 | cout << "done" << endl; 60 | 61 | 62 | // generate volume mesh 63 | Ng_Meshing_Parameters mp; 64 | mp.maxh = 1e6; 65 | mp.fineness = 1; 66 | mp.second_order = 0; 67 | 68 | cout << "start meshing" << endl; 69 | Ng_GenerateVolumeMesh (mesh, &mp); 70 | cout << "meshing done" << endl; 71 | 72 | // volume mesh output 73 | np = Ng_GetNP(mesh); 74 | cout << "Points: " << np << endl; 75 | 76 | for (i = 1; i <= np; i++) 77 | { 78 | Ng_GetPoint (mesh, i, point); 79 | cout << i << ": " << point[0] << " " << point[1] << " " << point[2] << endl; 80 | } 81 | 82 | ne = Ng_GetNE(mesh); 83 | cout << "Elements: " << ne << endl; 84 | for (i = 1; i <= ne; i++) 85 | { 86 | Ng_GetVolumeElement (mesh, i, tet); 87 | cout << i << ": " << tet[0] << " " << tet[1] 88 | << " " << tet[2] << " " << tet[3] << endl; 89 | } 90 | 91 | Ng_SaveMesh(mesh,"test.vol"); 92 | 93 | 94 | return 0; 95 | } 96 | -------------------------------------------------------------------------------- /ng/Togl2.1/aclocal.m4: -------------------------------------------------------------------------------- 1 | # 2 | # Include the TEA standard macro set 3 | # 4 | 5 | builtin(include,tclconfig/tcl.m4) 6 | 7 | # 8 | # Add here whatever m4 macros you want to define for your package 9 | # 10 | 11 | #------------------------------------------------------------------------ 12 | # TOGL_ENABLE_STUBS -- 13 | # 14 | # Specifiy if stubs should be used. 15 | # 16 | # Arguments: 17 | # none 18 | # 19 | # Results: 20 | # 21 | # Adds the following arguments to configure: 22 | # --enable-stubs 23 | # 24 | #------------------------------------------------------------------------ 25 | 26 | AC_DEFUN(TOGL_ENABLE_STUBS, [ 27 | AC_MSG_CHECKING([whether to link with stubs library]) 28 | AC_ARG_ENABLE(stubs, 29 | [ --enable-stubs build and link with stub libraries (--enable-stubs)], 30 | [tcl_ok=$enableval], [tcl_ok=yes]) 31 | 32 | if test "${enable_stubs+set}" = set; then 33 | enableval="$enable_stubs" 34 | tcl_ok=$enableval 35 | else 36 | tcl_ok=yes 37 | fi 38 | 39 | if test "$tcl_ok" = "yes" ; then 40 | AC_MSG_RESULT([stubs]) 41 | USE_STUBS=1 42 | else 43 | AC_MSG_RESULT([no stubs]) 44 | USE_STUBS=0 45 | fi 46 | ]) 47 | 48 | #------------------------------------------------------------------------ 49 | # TOGL_UNDEF_GET_PROC_ADDRESS -- 50 | # 51 | # Does defining GLX_GLXEXT_LEGACY interfer with including GL/glxext.h? 52 | # 53 | # Arguments: 54 | # none 55 | # 56 | # Results: 57 | # 58 | # defines TOGL_UNDEF_GET_PROC_ADDRESS 59 | # 60 | #------------------------------------------------------------------------ 61 | AC_DEFUN(TOGL_UNDEF_GET_PROC_ADDRESS, [ 62 | AC_MSG_CHECKING([if GLX_GLXEXT_LEGACY interfers with including GL/glxext.h]) 63 | AC_LANG_PUSH(C) 64 | ac_save_CFLAGS=$CFLAGS 65 | CFLAGS=$TK_XINCLUDES 66 | AC_COMPILE_IFELSE( 67 | [AC_LANG_SOURCE([[ 68 | #define GLX_GLXEXT_LEGACY 69 | #include 70 | #undef GLX_VERSION_1_3 71 | #undef GLX_VERSION_1_4 72 | #include 73 | int main() { return 0; } 74 | ]])], 75 | [AC_MSG_RESULT([no])], 76 | [AC_MSG_RESULT([yes]) 77 | AC_DEFINE(UNDEF_GET_PROC_ADDRESS, 1)]) 78 | CFLAGS=$ac_save_CFLAGS 79 | AC_LANG_POP() 80 | ]) 81 | -------------------------------------------------------------------------------- /libsrc/meshing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_definitions(-DNGINTERFACE_EXPORTS) 2 | if(NOT WIN32) 3 | set(mesh_object_libs 4 | $ 5 | $ 6 | $ 7 | ) 8 | endif(NOT WIN32) 9 | 10 | add_library(mesh ${NG_LIB_TYPE} 11 | adfront2.cpp adfront3.cpp bisect.cpp boundarylayer.cpp 12 | clusters.cpp curvedelems.cpp delaunay.cpp delaunay2d.cpp 13 | geomsearch.cpp global.cpp hprefinement.cpp improve2.cpp 14 | improve2gen.cpp improve3.cpp localh.cpp meshclass.cpp 15 | meshfunc.cpp meshfunc2d.cpp meshing2.cpp meshing3.cpp 16 | meshtool.cpp meshtype.cpp msghandler.cpp netrule2.cpp 17 | netrule3.cpp parser2.cpp parser3.cpp prism2rls.cpp 18 | pyramid2rls.cpp pyramidrls.cpp quadrls.cpp refine.cpp 19 | ruler2.cpp ruler3.cpp secondorder.cpp smoothing2.5.cpp 20 | smoothing2.cpp smoothing3.cpp specials.cpp tetrarls.cpp 21 | topology.cpp triarls.cpp validate.cpp bcfunctions.cpp 22 | parallelmesh.cpp paralleltop.cpp paralleltop.hpp basegeom.cpp 23 | python_mesh.cpp hexarls.cpp 24 | ${mesh_object_libs} 25 | ) 26 | 27 | if(APPLE) 28 | set_target_properties( mesh PROPERTIES SUFFIX ".so") 29 | endif(APPLE) 30 | 31 | if(NOT WIN32) 32 | target_link_libraries( mesh ${ZLIB_LIBRARIES} ${MPI_CXX_LIBRARIES} ${PYTHON_LIBRARIES} ${METIS_LIBRARY}) 33 | install( TARGETS mesh ${ng_install_dir}) 34 | endif(NOT WIN32) 35 | 36 | install(FILES 37 | adfront2.hpp adfront3.hpp basegeom.hpp bcfunctions.hpp bisect.hpp 38 | boundarylayer.hpp classifyhpel.hpp clusters.hpp curvedelems.hpp 39 | findip2.hpp findip.hpp geomsearch.hpp global.hpp hpref_hex.hpp 40 | hprefinement.hpp hpref_prism.hpp hpref_pyramid.hpp hpref_quad.hpp 41 | hpref_segm.hpp hpref_tet.hpp hpref_trig.hpp improve2.hpp improve3.hpp 42 | localh.hpp meshclass.hpp meshfunc.hpp meshing2.hpp meshing3.hpp 43 | meshing.hpp meshtool.hpp meshtype.hpp msghandler.hpp paralleltop.hpp 44 | ruler2.hpp ruler3.hpp specials.hpp topology.hpp validate.hpp 45 | DESTINATION ${INCDIR}/meshing COMPONENT netgen_devel 46 | ) 47 | --------------------------------------------------------------------------------