├── .clang-format ├── .gitignore ├── .gitlab-ci.yml ├── .gitmodules ├── AUTHORS ├── CLA.pdf ├── CMakeLists.txt ├── CONTRIBUTING.md ├── ChangeLog ├── INSTALL ├── LICENSE ├── NEWS ├── README.md ├── TODO ├── cmake ├── NetgenConfig.cmake.in ├── SuperBuild.cmake ├── check_submodules.cmake ├── cmake_modules │ ├── FindFFMPEG.cmake │ └── FindMETIS.cmake ├── cmake_uninstall.cmake.in ├── external_projects │ ├── catch.cmake │ ├── cgns.cmake │ ├── metis.cmake │ ├── spdlog.cmake │ ├── tcltk.cmake │ ├── tkdnd_macosx.patch │ └── zlib.cmake ├── generate_version_file.cmake ├── mic.cmake ├── netgen_fixup.cmake └── tk_macosx.patch ├── depcomp ├── doc ├── CMakeLists.txt ├── element_types.tex ├── ng4.pdf ├── ng4.tex └── pictures │ ├── MeshingOptions1.jpg │ ├── clippingplane.jpg │ ├── main_window.jpg │ ├── menu_file.jpg │ ├── menu_geometry.jpg │ ├── menu_help.jpg │ ├── menu_mesh.jpg │ ├── menu_refinement.jpg │ ├── menu_solve.jpg │ ├── menu_special.jpg │ ├── menu_view.jpg │ ├── menufile.jpg │ ├── menugeometry.jpg │ ├── menumesh.jpg │ ├── menurefinement.jpg │ ├── menuview.jpg │ ├── meshingoptions_1.jpg │ ├── meshingoptions_2.jpg │ ├── meshingoptions_3.jpg │ ├── meshingoptions_4.jpg │ ├── meshingoptions_5.jpg │ ├── meshingoptions_6.jpg │ ├── screenshot.jpg │ ├── solutiondata.jpg │ ├── topologyexplorer.jpg │ ├── viewingoptions_1.jpg │ ├── viewingoptions_2.jpg │ ├── viewingoptions_3.jpg │ ├── viewingoptions_4.jpg │ ├── viewingoptions_5.jpg │ └── viewingoptions_6.jpg ├── external_dependencies └── .gitignore ├── libsrc ├── CMakeLists.txt ├── core │ ├── .clang-tidy │ ├── CMakeLists.txt │ ├── _get_glibcxx_use_cxx11_abi.cpp │ ├── _get_gxx_abi.cpp │ ├── archive.cpp │ ├── archive.hpp │ ├── array.hpp │ ├── autodiff.hpp │ ├── autodiffdiff.hpp │ ├── bitarray.cpp │ ├── bitarray.hpp │ ├── concurrentqueue.h │ ├── exception.cpp │ ├── exception.hpp │ ├── flags.cpp │ ├── flags.hpp │ ├── generate_mpi_sources.py │ ├── hashtable.hpp │ ├── localheap.cpp │ ├── localheap.hpp │ ├── logging.cpp │ ├── logging.hpp │ ├── memtracer.hpp │ ├── mpi4py_pycapi.h │ ├── mpi_wrapper.hpp │ ├── ng_mpi.cpp │ ├── ng_mpi.hpp │ ├── ng_mpi_generated_declarations.hpp │ ├── ng_mpi_generated_dummy_init.hpp │ ├── ng_mpi_generated_init.hpp │ ├── ng_mpi_native.hpp │ ├── ng_mpi_wrapper.cpp │ ├── ngcore.hpp │ ├── ngcore_api.hpp │ ├── ngstream.hpp │ ├── paje_trace.cpp │ ├── paje_trace.hpp │ ├── profiler.cpp │ ├── profiler.hpp │ ├── python_ngcore.cpp │ ├── python_ngcore.hpp │ ├── python_ngcore_export.cpp │ ├── ranges.hpp │ ├── register_archive.hpp │ ├── signal.hpp │ ├── simd.hpp │ ├── simd_arm64.hpp │ ├── simd_avx.hpp │ ├── simd_avx512.hpp │ ├── simd_generic.hpp │ ├── simd_sse.hpp │ ├── symboltable.hpp │ ├── table.cpp │ ├── table.hpp │ ├── taskmanager.cpp │ ├── taskmanager.hpp │ ├── type_traits.hpp │ ├── utils.cpp │ ├── utils.hpp │ ├── version.cpp │ ├── version.hpp │ └── xbool.hpp ├── csg │ ├── CMakeLists.txt │ ├── algprim.cpp │ ├── algprim.hpp │ ├── brick.cpp │ ├── brick.hpp │ ├── bspline2d.cpp │ ├── csg.hpp │ ├── csgeom.cpp │ ├── csgeom.hpp │ ├── csgparser.cpp │ ├── csgparser.hpp │ ├── csgpkg.cpp │ ├── curve2d.cpp │ ├── curve2d.hpp │ ├── edgeflw.cpp │ ├── edgeflw.hpp │ ├── explicitcurve2d.cpp │ ├── explicitcurve2d.hpp │ ├── extrusion.cpp │ ├── extrusion.hpp │ ├── gencyl.cpp │ ├── gencyl.hpp │ ├── genmesh.cpp │ ├── geoml.hpp │ ├── identify.cpp │ ├── identify.hpp │ ├── manifold.cpp │ ├── manifold.hpp │ ├── meshsurf.cpp │ ├── meshsurf.hpp │ ├── polyhedra.cpp │ ├── polyhedra.hpp │ ├── python_csg.cpp │ ├── revolution.cpp │ ├── revolution.hpp │ ├── singularref.cpp │ ├── singularref.hpp │ ├── solid.cpp │ ├── solid.hpp │ ├── specpoin.cpp │ ├── specpoin.hpp │ ├── spline3d.cpp │ ├── spline3d.hpp │ ├── splinesurface.cpp │ ├── splinesurface.hpp │ ├── surface.cpp │ ├── surface.hpp │ ├── triapprox.cpp │ ├── triapprox.hpp │ ├── vscsg.cpp │ ├── vscsg.hpp │ └── zrefine.cpp ├── general │ ├── CMakeLists.txt │ ├── autodiff.hpp │ ├── autoptr.hpp │ ├── dynamicmem.cpp │ ├── dynamicmem.hpp │ ├── gzstream.cpp │ ├── gzstream.h │ ├── hashtabl.cpp │ ├── hashtabl.hpp │ ├── myadt.hpp │ ├── mystring.cpp │ ├── mystring.hpp │ ├── netgenout.hpp │ ├── ngarray.hpp │ ├── ngbitarray.cpp │ ├── ngbitarray.hpp │ ├── ngpython.hpp │ ├── optmem.cpp │ ├── optmem.hpp │ ├── parthreads.cpp │ ├── parthreads.hpp │ ├── seti.cpp │ ├── seti.hpp │ ├── sort.cpp │ ├── sort.hpp │ ├── spbita2d.cpp │ ├── spbita2d.hpp │ ├── stack.hpp │ ├── table.cpp │ ├── table.hpp │ └── template.hpp ├── geom2d │ ├── CMakeLists.txt │ ├── csg2d.cpp │ ├── csg2d.hpp │ ├── genmesh2d.cpp │ ├── geom2dpkg.cpp │ ├── geometry2d.cpp │ ├── geometry2d.hpp │ ├── python_geom2d.cpp │ ├── spline2d.hpp │ ├── vsgeom2d.cpp │ └── vsgeom2d.hpp ├── gprim │ ├── CMakeLists.txt │ ├── adtree.cpp │ ├── adtree.hpp │ ├── geom2d.cpp │ ├── geom2d.hpp │ ├── geom3d.cpp │ ├── geom3d.hpp │ ├── geomfuncs.cpp │ ├── geomfuncs.hpp │ ├── geomobjects.hpp │ ├── geomops.hpp │ ├── geomtest3d.cpp │ ├── geomtest3d.hpp │ ├── gprim.hpp │ ├── spline.cpp │ ├── spline.hpp │ ├── splinegeometry.cpp │ ├── splinegeometry.hpp │ ├── transform3d.cpp │ └── transform3d.hpp ├── include │ ├── CMakeLists.txt │ ├── acisgeom.hpp │ ├── csg.hpp │ ├── geometry2d.hpp │ ├── gprim.hpp │ ├── incopengl.hpp │ ├── inctcl.hpp │ ├── incvis.hpp │ ├── linalg.hpp │ ├── meshing.hpp │ ├── myadt.hpp │ ├── mydefs.hpp │ ├── mystdlib.h │ ├── nginterface.h │ ├── nginterface_v2.hpp │ ├── nginterface_v2_impl.hpp │ ├── ngsimd.hpp │ ├── occgeom.hpp │ ├── opti.hpp │ ├── parallel.hpp │ ├── stlgeom.hpp │ └── visual.hpp ├── interface │ ├── CMakeLists.txt │ ├── nginterface.cpp │ ├── nginterface_v2.cpp │ ├── read_fnf_mesh.cpp │ ├── readtetmesh.cpp │ ├── readuser.cpp │ ├── rw_cgns.cpp │ ├── rw_medit.cpp │ ├── rw_medit.hpp │ ├── writeOpenFOAM15x.cpp │ ├── writeabaqus.cpp │ ├── writediffpack.cpp │ ├── writedolfin.cpp │ ├── writeelmer.cpp │ ├── writefeap.cpp │ ├── writefluent.cpp │ ├── writegmsh.cpp │ ├── writegmsh2.cpp │ ├── writejcm.cpp │ ├── writepermas.cpp │ ├── writetecplot.cpp │ ├── writetet.cpp │ ├── writetochnog.cpp │ ├── writeuser.cpp │ ├── writeuser.hpp │ └── wuchemnitz.cpp ├── linalg │ ├── CMakeLists.txt │ ├── bfgs.cpp │ ├── densemat.cpp │ ├── densemat.hpp │ ├── linalg.hpp │ ├── linopt.cpp │ ├── linsearch.cpp │ ├── opti.hpp │ ├── polynomial.cpp │ ├── polynomial.hpp │ └── vector.hpp ├── meshing │ ├── CMakeLists.txt │ ├── adfront2.cpp │ ├── adfront2.hpp │ ├── adfront3.cpp │ ├── adfront3.hpp │ ├── basegeom.cpp │ ├── basegeom.hpp │ ├── bcfunctions.cpp │ ├── bcfunctions.hpp │ ├── bisect.cpp │ ├── bisect.hpp │ ├── boundarylayer.cpp │ ├── boundarylayer.hpp │ ├── boundarylayer2d.cpp │ ├── boundarylayer_interpolate.cpp │ ├── boundarylayer_limiter.hpp │ ├── classifyhpel.hpp │ ├── clusters.cpp │ ├── clusters.hpp │ ├── curvedelems.cpp │ ├── curvedelems.hpp │ ├── debugging.cpp │ ├── debugging.hpp │ ├── delaunay.cpp │ ├── delaunay2d.cpp │ ├── delaunay2d.hpp │ ├── fieldlines.cpp │ ├── fieldlines.hpp │ ├── findip.hpp │ ├── findip2.hpp │ ├── geomsearch.cpp │ ├── geomsearch.hpp │ ├── global.cpp │ ├── global.hpp │ ├── hpref_hex.hpp │ ├── hpref_prism.hpp │ ├── hpref_pyramid.hpp │ ├── hpref_quad.hpp │ ├── hpref_segm.hpp │ ├── hpref_tet.hpp │ ├── hpref_trig.hpp │ ├── hprefinement.cpp │ ├── hprefinement.hpp │ ├── improve2.cpp │ ├── improve2.hpp │ ├── improve2gen.cpp │ ├── improve3.cpp │ ├── improve3.hpp │ ├── localh.cpp │ ├── localh.hpp │ ├── meshclass.cpp │ ├── meshclass.hpp │ ├── meshfunc.cpp │ ├── meshfunc.hpp │ ├── meshfunc2d.cpp │ ├── meshing.hpp │ ├── meshing2.cpp │ ├── meshing2.hpp │ ├── meshing3.cpp │ ├── meshing3.hpp │ ├── meshtool.cpp │ ├── meshtool.hpp │ ├── meshtype.cpp │ ├── meshtype.hpp │ ├── msghandler.cpp │ ├── msghandler.hpp │ ├── netrule2.cpp │ ├── netrule3.cpp │ ├── parallelmesh.cpp │ ├── paralleltop.cpp │ ├── paralleltop.hpp │ ├── parser2.cpp │ ├── parser3.cpp │ ├── python_mesh.cpp │ ├── python_mesh.hpp │ ├── refine.cpp │ ├── ruler2.cpp │ ├── ruler2.hpp │ ├── ruler3.cpp │ ├── ruler3.hpp │ ├── secondorder.cpp │ ├── smoothing2.5.cpp │ ├── smoothing2.cpp │ ├── smoothing3.cpp │ ├── soldata.hpp │ ├── specials.cpp │ ├── specials.hpp │ ├── surfacegeom.cpp │ ├── surfacegeom.hpp │ ├── topology.cpp │ ├── topology.hpp │ ├── validate.cpp │ ├── validate.hpp │ ├── visual_interface.cpp │ └── visual_interface.hpp ├── occ │ ├── CMakeLists.txt │ ├── Partition_Inter2d.cxx │ ├── Partition_Inter2d.hxx │ ├── Partition_Inter2d.ixx │ ├── Partition_Inter2d.jxx │ ├── Partition_Inter3d.cxx │ ├── Partition_Inter3d.hxx │ ├── Partition_Inter3d.ixx │ ├── Partition_Inter3d.jxx │ ├── Partition_Loop.cxx │ ├── Partition_Loop.hxx │ ├── Partition_Loop.ixx │ ├── Partition_Loop.jxx │ ├── Partition_Loop2d.cxx │ ├── Partition_Loop2d.hxx │ ├── Partition_Loop2d.ixx │ ├── Partition_Loop2d.jxx │ ├── Partition_Loop3d.cxx │ ├── Partition_Loop3d.hxx │ ├── Partition_Loop3d.ixx │ ├── Partition_Loop3d.jxx │ ├── Partition_Spliter.cxx │ ├── Partition_Spliter.hxx │ ├── Partition_Spliter.ixx │ ├── Partition_Spliter.jxx │ ├── occ_edge.cpp │ ├── occ_edge.hpp │ ├── occ_face.cpp │ ├── occ_face.hpp │ ├── occ_solid.hpp │ ├── occ_utils.cpp │ ├── occ_utils.hpp │ ├── occ_vertex.cpp │ ├── occ_vertex.hpp │ ├── occconstruction.cpp │ ├── occgenmesh.cpp │ ├── occgeom.cpp │ ├── occgeom.hpp │ ├── occmeshsurf.cpp │ ├── occmeshsurf.hpp │ ├── occpkg.cpp │ ├── python_occ.cpp │ ├── python_occ_basic.cpp │ ├── python_occ_shapes.cpp │ ├── utilities.h │ ├── vsocc.cpp │ └── vsocc.hpp ├── stlgeom │ ├── CMakeLists.txt │ ├── meshstlsurface.cpp │ ├── meshstlsurface.hpp │ ├── python_stl.cpp │ ├── stlgeom.cpp │ ├── stlgeom.hpp │ ├── stlgeomchart.cpp │ ├── stlgeommesh.cpp │ ├── stlline.cpp │ ├── stlline.hpp │ ├── stlpkg.cpp │ ├── stltool.cpp │ ├── stltool.hpp │ ├── stltopology.cpp │ ├── stltopology.hpp │ ├── vsstl.cpp │ └── vsstl.hpp └── visualization │ ├── CMakeLists.txt │ ├── importsolution.cpp │ ├── meshdoc.cpp │ ├── meshdoc.hpp │ ├── mvdraw.cpp │ ├── mvdraw.hpp │ ├── vispar.hpp │ ├── visual.hpp │ ├── visual_api.hpp │ ├── visualpkg.cpp │ ├── vsfieldlines.cpp │ ├── vsmesh.cpp │ ├── vssolution.cpp │ └── vssolution.hpp ├── mkinstalldirs ├── netgen.icns ├── ng ├── CMakeLists.txt ├── Togl2.1 │ ├── CMakeLists.txt │ ├── LICENSE │ ├── Makefile.in │ ├── README.bin │ ├── README.stubs │ ├── Togl.py │ ├── Xmu │ │ ├── CmapAlloc.c │ │ ├── CrCmap.c │ │ ├── DelCmap.c │ │ ├── LookupCmap.c │ │ ├── README.togl │ │ ├── StdCmap.c │ │ └── StdCmap.h │ ├── aclocal.m4 │ ├── ben.rgb │ ├── configure │ ├── configure.in │ ├── doc │ │ ├── README.txt │ │ ├── capi.html │ │ ├── download.html │ │ ├── faq.html │ │ ├── header.js │ │ ├── index.html │ │ ├── stereo.html │ │ ├── tclapi.html │ │ ├── upgrading.html │ │ └── using.html │ ├── double.c │ ├── double.tcl │ ├── gears.c │ ├── gears.tcl │ ├── gl │ │ ├── glext.h │ │ ├── glxext.h │ │ └── wglext.h │ ├── image.c │ ├── image.h │ ├── index.c │ ├── index.tcl │ ├── multisample.tcl │ ├── overlay.c │ ├── overlay.tcl │ ├── pbuffer.c │ ├── pbuffer.tcl │ ├── pkgIndex.tcl.in │ ├── stereo.c │ ├── stereo.tcl │ ├── tclconfig │ │ ├── install-sh │ │ └── tcl.m4 │ ├── texture.c │ ├── texture.tcl │ ├── togl.c │ ├── togl.decls │ ├── togl.h │ ├── toglAGL.c │ ├── toglDecls.h │ ├── toglFont.c │ ├── toglGLX.c │ ├── toglNSOpenGL.c │ ├── toglProcAddr.c │ ├── toglStubInit.c │ ├── toglStubLib.c │ ├── toglWGL.c │ ├── togl_ws.h.in │ ├── toglpy.h │ └── tree2.rgba ├── acisgeom.tcl ├── csgeom.tcl ├── demoview.cpp ├── demoview.hpp ├── dialog.tcl ├── drawing.tcl ├── drawing_togl17.tcl ├── encoding.hpp ├── fonts.hpp ├── gui.cpp ├── menustat.tcl ├── netgen.ocf ├── netgenpy.cpp ├── ng.tcl ├── ng_acis.hpp ├── ngappinit.cpp ├── ngguipy.cpp ├── nghelp.tcl ├── ngicon.tcl ├── ngpkg.cpp ├── ngshell.tcl ├── ngtcl.cpp ├── ngtesting.tcl ├── ngvisual.tcl ├── occgeom.tcl ├── onetcl.cpp ├── onetcl.py ├── parallelfunc.cpp ├── parallelfunc.hpp ├── parameters.tcl ├── sockets.tcl ├── stlgeom.tcl └── variables.tcl ├── nglib ├── CMakeLists.txt ├── cube.surf ├── hinge.stl ├── netgen.py ├── ng_occ.cpp ├── ng_stl.cpp ├── ng_vol.cpp ├── nglib.cpp ├── nglib.h ├── nglib_occ.cpp ├── nglib_occ.h └── parallelfunc.cpp ├── py_tutorials ├── CMakeLists.txt ├── csg2d.py ├── csg_first_example.py ├── cube.geo ├── exportNeutral.py ├── merge.py ├── mesh.py ├── opengl.py ├── opengl_thread.py ├── opengl_window.py └── shaft.geo ├── python ├── .gitignore ├── CMakeLists.txt ├── NgOCC.py ├── __init__.py ├── __main__.py ├── config │ ├── __init__.py │ ├── __main__.py │ └── config_template.py ├── csg.py ├── gengeom.py ├── gengeom_curve.py ├── geom2d.py ├── gui.py ├── init_geom2d.py ├── meshing.py ├── occ.py ├── pymesh.vol ├── pyngcore │ └── __init__.py ├── read_gmsh.py ├── read_meshio.py ├── shaft.vol.gz ├── stl.py ├── version_template.py └── webgui.py ├── rules ├── CMakeLists.txt ├── hexrules.rls ├── makerlsfile.cpp ├── prismrules2.rls ├── prisms.rls ├── pyramidrules.rls ├── pyramidrules2.rls ├── quadrules.rls ├── tetrules.rls └── triarules.rls ├── setup.py ├── tests ├── CMakeLists.txt ├── build_debug.sh ├── build_guidelines.sh ├── build_mpi.sh ├── build_ngsolve.sh ├── build_nospdlog.sh ├── build_pip.ps1 ├── build_pip.sh ├── build_pip_mac.sh ├── catch │ ├── CMakeLists.txt │ ├── archive.cpp │ ├── array.cpp │ ├── main.cpp │ ├── ranges.cpp │ ├── symboltable.cpp │ ├── utils.cpp │ └── version.cpp ├── dockerfile ├── dockerfile_mpi ├── pytest │ ├── CMakeLists.txt │ ├── compare_results.py │ ├── conftest.py │ ├── geofiles │ │ └── plane.stl │ ├── meshes.py │ ├── results.json │ ├── test_array.py │ ├── test_bitarray.py │ ├── test_boundarylayer.py │ ├── test_csg.py │ ├── test_csg2d.py │ ├── test_geom2d.py │ ├── test_meshclass.py │ ├── test_mpi4py.py │ ├── test_nonnative_master │ ├── test_occ.py │ ├── test_occ_identifications.py │ ├── test_pickling.py │ ├── test_savemesh.py │ ├── test_splinegeo_tensordomainmeshing.py │ └── test_tutorials.py └── utils.py ├── tutorials ├── CMakeLists.txt ├── boundarycondition.geo ├── boxcyl.geo ├── circle_on_cube.geo ├── cone.geo ├── cube.geo ├── cubeandring.geo ├── cubeandspheres.geo ├── cubemcyl.geo ├── cubemsphere.geo ├── cylinder.geo ├── cylsphere.geo ├── ellipsoid.geo ├── ellipticcone.geo ├── ellipticcyl.geo ├── extrusion.geo ├── fichera.geo ├── frame.step ├── hinge.stl ├── lense.in2d ├── lshape3d.geo ├── manyholes.geo ├── manyholes2.geo ├── matrix.geo ├── ortho.geo ├── part1.stl ├── period.geo ├── revolution.geo ├── screw.step ├── sculpture.geo ├── shaft.geo ├── shell.geo ├── sphere.geo ├── sphereincube.geo ├── square.in2d ├── squarecircle.in2d ├── squarehole.in2d ├── test.dem ├── torus.geo ├── trafo.geo ├── twobricks.geo ├── twocubes.geo └── twocyl.geo └── windows ├── .gitignore ├── CMakeLists.txt ├── netgen.ico ├── netgen.rc.template └── resource.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.whl 2 | dist 3 | build 4 | *.vol.gz 5 | *.vol 6 | *.ini 7 | __pycache__ 8 | *.json 9 | *.zip 10 | .cache 11 | *.patch 12 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external_dependencies/pybind11"] 2 | path = external_dependencies/pybind11 3 | url = https://github.com/ngsolve/pybind11.git 4 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Joachim Schoeberl 2 | -------------------------------------------------------------------------------- /CLA.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/CLA.pdf -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 2 | # How to Contribute 3 | 4 | ## Reporting issues 5 | 6 | If you have a problem using Netgen/NGSolve consider asking a question in our [forum](https://ngsolve.org/forum). 7 | 8 | If you found a bug create an issue in the [Github Issue Tracker](https://github.com/NGSolve/netgen/issues). Please be as specific as possible, issues with a reproducible minimal failing example will get more attention than unspecific one liners :) 9 | 10 | ## Contributing patches 11 | 12 | We love and want to encourage community engagement and will review and accept patches and contributions to this project. There are just a few steps to follow: 13 | 14 | On your first contribution, to clear any legal questions, we ask you to sign our [Contributor License Agreement](CLA.pdf). Generally you have to sign this only once for Netgen or NGSolve. Please send the signed agreement to . 15 | 16 | Place a pull request on GitHub. From there we will pull it into our internal testing environment and, if approved, merge it into the main codebase. 17 | 18 | If you have any questions feel free to ask on the [forum](https://ngsolve.org/forum). 19 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/ChangeLog -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/NEWS -------------------------------------------------------------------------------- /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. 4 | 5 | Find the Open Source Community on https://ngsolve.org 6 | Support & Services: https://cerbsim.com 7 | 8 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/TODO -------------------------------------------------------------------------------- /cmake/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 | -------------------------------------------------------------------------------- /cmake/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 | -------------------------------------------------------------------------------- /cmake/external_projects/catch.cmake: -------------------------------------------------------------------------------- 1 | include (ExternalProject) 2 | find_program(GIT_EXECUTABLE git) 3 | ExternalProject_Add( 4 | project_catch 5 | PREFIX ${CMAKE_BINARY_DIR}/catch 6 | GIT_REPOSITORY https://github.com/catchorg/Catch2.git 7 | GIT_TAG v2.13.7 8 | TIMEOUT 10 9 | UPDATE_COMMAND "" # ${GIT_EXECUTABLE} pull 10 | CONFIGURE_COMMAND "" 11 | BUILD_COMMAND "" 12 | INSTALL_COMMAND "" 13 | LOG_DOWNLOAD ON 14 | ) 15 | 16 | # Expose required variable (CATCH_INCLUDE_DIR) to parent scope 17 | ExternalProject_Get_Property(project_catch source_dir) 18 | set(CATCH_INCLUDE_DIR ${source_dir}/single_include CACHE INTERNAL "Path to include folder for Catch") 19 | -------------------------------------------------------------------------------- /cmake/external_projects/cgns.cmake: -------------------------------------------------------------------------------- 1 | if(WIN32) 2 | 3 | ExternalProject_Add(project_win_cgns 4 | URL ${CGNS_DOWNLOAD_URL_WIN} 5 | UPDATE_COMMAND "" # Disable update 6 | BUILD_IN_SOURCE 1 7 | CONFIGURE_COMMAND "" 8 | BUILD_COMMAND "" 9 | INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${CMAKE_INSTALL_PREFIX} 10 | LOG_DOWNLOAD 1 11 | ) 12 | 13 | list(APPEND NETGEN_DEPENDENCIES project_win_cgns) 14 | endif(WIN32) 15 | 16 | if(APPLE) 17 | ExternalProject_Add(project_mac_cgns 18 | URL ${CGNS_DOWNLOAD_URL_MAC} 19 | UPDATE_COMMAND "" # Disable update 20 | BUILD_IN_SOURCE 1 21 | CONFIGURE_COMMAND "" 22 | BUILD_COMMAND "" 23 | INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory . ${CMAKE_INSTALL_PREFIX} 24 | LOG_DOWNLOAD 1 25 | ) 26 | 27 | list(APPEND NETGEN_DEPENDENCIES project_mac_cgns) 28 | list(APPEND NETGEN_CMAKE_ARGS "-DCGNS_INCLUDE_DIR=${CMAKE_INSTALL_PREFIX}/Contents/Resources/include") 29 | list(APPEND NETGEN_CMAKE_ARGS "-DCGNS_LIBRARY=${CMAKE_INSTALL_PREFIX}/Contents/MacOS/libcgns.dylib") 30 | endif(APPLE) 31 | -------------------------------------------------------------------------------- /cmake/external_projects/metis.cmake: -------------------------------------------------------------------------------- 1 | set(METIS_SRC_DIR ${CMAKE_CURRENT_BINARY_DIR}/dependencies/src/project_metis) 2 | set(METIS_DIR ${CMAKE_CURRENT_BINARY_DIR}/dependencies/metis) 3 | 4 | ExternalProject_Add(project_metis 5 | PREFIX ${CMAKE_CURRENT_BINARY_DIR}/dependencies 6 | URL https://bitbucket.org/petsc/pkg-metis/get/v5.1.0-p12.tar.gz 7 | URL_MD5 6cd66f75f88dfa2cf043de011f85d8bc 8 | DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies 9 | CMAKE_ARGS 10 | -DCMAKE_POLICY_VERSION_MINIMUM=3.5 11 | -DGKLIB_PATH=${METIS_SRC_DIR}/GKlib 12 | -DCMAKE_INSTALL_PREFIX=${METIS_DIR} 13 | -DCMAKE_POSITION_INDEPENDENT_CODE=ON 14 | -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} 15 | -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} 16 | UPDATE_COMMAND "" # Disable update 17 | BUILD_IN_SOURCE 1 18 | ) 19 | 20 | set_vars( NETGEN_CMAKE_ARGS METIS_DIR ) 21 | 22 | list(APPEND NETGEN_DEPENDENCIES project_metis) 23 | -------------------------------------------------------------------------------- /cmake/external_projects/spdlog.cmake: -------------------------------------------------------------------------------- 1 | include(ExternalProject) 2 | find_program(GIT_EXECUTABLE git) 3 | 4 | ExternalProject_Add( 5 | project_spdlog 6 | PREFIX ${CMAKE_BINARY_DIR}/spdlog 7 | GIT_REPOSITORY https://github.com/gabime/spdlog.git 8 | GIT_TAG v1.2.1 9 | TIMEOUT 01 10 | UPDATE_COMMAND "" 11 | CONFIGURE_COMMAND "" 12 | BUILD_COMMAND "" 13 | INSTALL_COMMAND "" 14 | LOG_DOWNLOAD ON 15 | ) 16 | 17 | ExternalProject_Get_Property(project_spdlog source_dir) 18 | set(SPDLOG_INCLUDE_DIR ${source_dir}/include) 19 | -------------------------------------------------------------------------------- /cmake/external_projects/zlib.cmake: -------------------------------------------------------------------------------- 1 | if(WIN32) 2 | 3 | ExternalProject_Add(project_win_zlib 4 | URL ${ZLIB_DOWNLOAD_URL_WIN} 5 | UPDATE_COMMAND "" # Disable update 6 | BUILD_IN_SOURCE 1 7 | CONFIGURE_COMMAND "" 8 | BUILD_COMMAND "" 9 | INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory lib ${CMAKE_INSTALL_PREFIX}/${NG_INSTALL_DIR_LIB} 10 | COMMAND ${CMAKE_COMMAND} -E copy_directory bin ${CMAKE_INSTALL_PREFIX}/${NG_INSTALL_DIR_BIN} 11 | COMMAND ${CMAKE_COMMAND} -E copy_directory include ${CMAKE_INSTALL_PREFIX}/${NG_INSTALL_DIR_INCLUDE} 12 | LOG_DOWNLOAD 1 13 | ) 14 | 15 | 16 | list(APPEND NETGEN_DEPENDENCIES project_win_zlib) 17 | endif(WIN32) 18 | 19 | -------------------------------------------------------------------------------- /cmake/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 | -------------------------------------------------------------------------------- /cmake/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 | -------------------------------------------------------------------------------- /doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | INSTALL(FILES ng4.pdf DESTINATION ${NG_INSTALL_DIR_RES}/${NG_INSTALL_SUFFIX}/doc COMPONENT netgen_doc) 2 | -------------------------------------------------------------------------------- /doc/ng4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/ng4.pdf -------------------------------------------------------------------------------- /doc/pictures/MeshingOptions1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/MeshingOptions1.jpg -------------------------------------------------------------------------------- /doc/pictures/clippingplane.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/clippingplane.jpg -------------------------------------------------------------------------------- /doc/pictures/main_window.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/main_window.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_file.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/menu_file.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_geometry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/menu_geometry.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_help.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/menu_help.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_mesh.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/menu_mesh.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_refinement.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/menu_refinement.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_solve.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/menu_solve.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_special.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/menu_special.jpg -------------------------------------------------------------------------------- /doc/pictures/menu_view.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/menu_view.jpg -------------------------------------------------------------------------------- /doc/pictures/menufile.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/menufile.jpg -------------------------------------------------------------------------------- /doc/pictures/menugeometry.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/menugeometry.jpg -------------------------------------------------------------------------------- /doc/pictures/menumesh.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/menumesh.jpg -------------------------------------------------------------------------------- /doc/pictures/menurefinement.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/menurefinement.jpg -------------------------------------------------------------------------------- /doc/pictures/menuview.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/menuview.jpg -------------------------------------------------------------------------------- /doc/pictures/meshingoptions_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/meshingoptions_1.jpg -------------------------------------------------------------------------------- /doc/pictures/meshingoptions_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/meshingoptions_2.jpg -------------------------------------------------------------------------------- /doc/pictures/meshingoptions_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/meshingoptions_3.jpg -------------------------------------------------------------------------------- /doc/pictures/meshingoptions_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/meshingoptions_4.jpg -------------------------------------------------------------------------------- /doc/pictures/meshingoptions_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/meshingoptions_5.jpg -------------------------------------------------------------------------------- /doc/pictures/meshingoptions_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/meshingoptions_6.jpg -------------------------------------------------------------------------------- /doc/pictures/screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/screenshot.jpg -------------------------------------------------------------------------------- /doc/pictures/solutiondata.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/solutiondata.jpg -------------------------------------------------------------------------------- /doc/pictures/topologyexplorer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/topologyexplorer.jpg -------------------------------------------------------------------------------- /doc/pictures/viewingoptions_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/viewingoptions_1.jpg -------------------------------------------------------------------------------- /doc/pictures/viewingoptions_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/viewingoptions_2.jpg -------------------------------------------------------------------------------- /doc/pictures/viewingoptions_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/viewingoptions_3.jpg -------------------------------------------------------------------------------- /doc/pictures/viewingoptions_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/viewingoptions_4.jpg -------------------------------------------------------------------------------- /doc/pictures/viewingoptions_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/viewingoptions_5.jpg -------------------------------------------------------------------------------- /doc/pictures/viewingoptions_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/doc/pictures/viewingoptions_6.jpg -------------------------------------------------------------------------------- /external_dependencies/.gitignore: -------------------------------------------------------------------------------- 1 | *.tar.gz 2 | -------------------------------------------------------------------------------- /libsrc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(core) 2 | add_subdirectory(general) 3 | add_subdirectory(gprim) 4 | add_subdirectory(linalg) 5 | add_subdirectory(include) 6 | add_subdirectory(meshing) 7 | if(USE_OCC) 8 | add_subdirectory(occ) 9 | endif(USE_OCC) 10 | if(USE_STLGEOM) 11 | add_subdirectory(stlgeom) 12 | endif(USE_STLGEOM) 13 | if(USE_GUI) 14 | add_subdirectory(visualization) 15 | endif(USE_GUI) 16 | if(USE_INTERFACE) 17 | add_subdirectory(interface) 18 | endif(USE_INTERFACE) 19 | if(USE_CSG) 20 | add_subdirectory(csg) 21 | endif(USE_CSG) 22 | if(USE_GEOM2D) 23 | add_subdirectory(geom2d) 24 | endif(USE_GEOM2D) 25 | -------------------------------------------------------------------------------- /libsrc/core/.clang-tidy: -------------------------------------------------------------------------------- 1 | Checks: '*,-cppcoreguidelines-avoid-non-const-global-variables,-llvmlibc-restrict-system-libc-headers,-clang-analyzer-alpha.*,-*braces-around-statements,-fuchsia-*,-google-runtime-references,-readability-implicit-bool-conversion,-google-explicit-constructor,-hicpp-explicit-conversions,-google-runtime-int,-llvm-header-guard,-modernize-pass-by-value,-cppcoreguidelines-non-private-member-variables-in-classes,-misc-non-private-member-variables-in-classes,-readability-magic-numbers,-cppcoreguidelines-avoid-magic-numbers' 2 | CheckOptions: 3 | - key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor 4 | value: 1 5 | - key: cppcoreguidelines-macro-usage.AllowedRegexp 6 | value: NGCORE_*|NETGEN_*|NG_EXCEPTION* 7 | 8 | WarningsAsErrors: '*' 9 | -------------------------------------------------------------------------------- /libsrc/core/_get_glibcxx_use_cxx11_abi.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | #ifdef _GLIBCXX_USE_CXX11_ABI 5 | if(_GLIBCXX_USE_CXX11_ABI) 6 | std::cout << 1; 7 | else 8 | std::cout << 0; 9 | #else // _GLIBCXX_USE_CXX11_ABI 10 | std::cout << 0; 11 | #endif // _GLIBCXX_USE_CXX11_ABI 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /libsrc/core/_get_gxx_abi.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | if (__GXX_ABI_VERSION >= 2000 || __GXX_ABI_VERSION < 1000) return 1; 5 | std::cout << (__GXX_ABI_VERSION % 100); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /libsrc/core/archive.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "archive.hpp" 3 | #include "register_archive.hpp" 4 | #include "version.hpp" 5 | 6 | #ifndef WIN32 7 | #include 8 | #endif 9 | 10 | namespace ngcore 11 | { 12 | // clang-tidy should ignore this static object 13 | // static std::map type_register; // NOLINT 14 | 15 | auto& GetTypeRegister() 16 | { 17 | static std::map type_register; 18 | return type_register; 19 | } 20 | 21 | const detail::ClassArchiveInfo& Archive :: GetArchiveRegister(const std::string& classname) 22 | { 23 | // if(type_register == nullptr) type_register = 24 | // std::make_unique>(); 25 | return GetTypeRegister()[classname]; 26 | } 27 | void Archive :: SetArchiveRegister(const std::string& classname, const detail::ClassArchiveInfo& info) 28 | { 29 | // if(type_register == nullptr) type_register = 30 | // std::make_unique>(); 31 | GetTypeRegister()[classname] = info; 32 | } 33 | bool Archive :: IsRegistered(const std::string& classname) 34 | { 35 | // if(type_register == nullptr) type_register = 36 | // std::make_unique>(); 37 | return GetTypeRegister().count(classname) != 0; 38 | } 39 | 40 | #ifdef NETGEN_PYTHON 41 | pybind11::object CastAnyToPy(const std::any& a) 42 | { 43 | auto info = Archive::GetArchiveRegister(Demangle(a.type().name())); 44 | return info.anyToPyCaster(a); 45 | } 46 | #endif // NETGEN_PYTHON 47 | 48 | } // namespace ngcore 49 | -------------------------------------------------------------------------------- /libsrc/core/logging.cpp: -------------------------------------------------------------------------------- 1 | #include "logging.hpp" 2 | 3 | #include 4 | 5 | namespace ngcore 6 | { 7 | std::ostream* testout = new std::ostream(nullptr); // NOLINT 8 | 9 | level::level_enum Logger::global_level = level::warn; 10 | 11 | void Logger::log(level::level_enum level, std::string && s) 12 | { 13 | if(level>=global_level) 14 | std::clog << s << '\n'; 15 | } 16 | 17 | } //namespace ngcore 18 | 19 | namespace spdlog 20 | { 21 | class logger 22 | { 23 | public: 24 | logger() = default; 25 | }; 26 | } // namespace spdlog 27 | 28 | namespace ngcore 29 | { 30 | 31 | // Dummy functions if no spdlog is available 32 | 33 | std::shared_ptr GetLogger(const std::string& /*unused*/) 34 | { 35 | return std::make_shared(std::make_shared()); 36 | } 37 | 38 | void SetLoggingLevel(level::level_enum level, const std::string& /*unused*/) 39 | { 40 | Logger::SetGlobalLoggingLevel(level); 41 | } 42 | 43 | void AddFileSink(const std::string& /*unused*/, level::level_enum /*unused*/, 44 | const std::string& /*unused*/) 45 | {} 46 | void AddConsoleSink(level::level_enum /*unused*/, const std::string& /*unused*/) {} 47 | void ClearLoggingSinks(const std::string& /*unused*/) {} 48 | void FlushOnLoggingLevel(level::level_enum /*unused*/, const std::string& /*unused*/) {} 49 | } //namespace ngcore 50 | -------------------------------------------------------------------------------- /libsrc/core/ng_mpi_native.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NG_MPI_NATIVE_HPP 2 | #define NG_MPI_NATIVE_HPP 3 | 4 | #include 5 | 6 | #include "mpi_wrapper.hpp" 7 | #include "ng_mpi.hpp" 8 | 9 | namespace ngcore { 10 | 11 | MPI_Comm NG_MPI_Native(NG_MPI_Comm comm) { 12 | return reinterpret_cast(comm.value); 13 | } 14 | 15 | MPI_Comm NG_MPI_Native(NgMPI_Comm comm) { 16 | return reinterpret_cast(static_cast(comm).value); 17 | } 18 | 19 | } // namespace ngcore 20 | 21 | #endif // NG_MPI_NATIVE_HPP 22 | -------------------------------------------------------------------------------- /libsrc/core/ngcore.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NETGEN_CORE_NGCORE_HPP 2 | #define NETGEN_CORE_NGCORE_HPP 3 | 4 | #include "archive.hpp" 5 | #include "array.hpp" 6 | #include "bitarray.hpp" 7 | #include "exception.hpp" 8 | #include "flags.hpp" 9 | #include "table.hpp" 10 | #include "hashtable.hpp" 11 | #include "localheap.hpp" 12 | #include "logging.hpp" 13 | // #include "mpi_wrapper.hpp" 14 | #include "profiler.hpp" 15 | #include "signal.hpp" 16 | #include "simd.hpp" 17 | #include "autodiff.hpp" 18 | #include "autodiffdiff.hpp" 19 | #include "symboltable.hpp" 20 | #include "taskmanager.hpp" 21 | #include "version.hpp" 22 | #include "xbool.hpp" 23 | #include "ngstream.hpp" 24 | #include "utils.hpp" 25 | #include "ranges.hpp" 26 | 27 | #endif // NETGEN_CORE_NGCORE_HPP 28 | -------------------------------------------------------------------------------- /libsrc/core/version.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include "exception.hpp" 5 | #include "version.hpp" 6 | 7 | namespace ngcore 8 | { 9 | // clang-tidy should ignore this static object 10 | static std::map library_versions; // NOLINT 11 | 12 | const VersionInfo& GetLibraryVersion(const std::string& library) 13 | { return library_versions[library]; } 14 | 15 | const std::map& GetLibraryVersions() 16 | { return library_versions; } 17 | 18 | void SetLibraryVersion(const std::string& library, const VersionInfo& version) 19 | { 20 | if(library_versions.count(library) && (library_versions[library] != version)) 21 | throw Exception("Failed to set library version for " + library + " to " + version.to_string() + ": version already set to " + library_versions[library].to_string()); 22 | library_versions[library] = version; 23 | } 24 | 25 | static bool dummy = [](){ 26 | SetLibraryVersion("netgen", NETGEN_VERSION); 27 | return true; 28 | }(); 29 | } // namespace ngcore 30 | -------------------------------------------------------------------------------- /libsrc/core/xbool.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NETGEN_CORE_XBOOL_HPP 2 | #define NETGEN_CORE_XBOOL_HPP 3 | 4 | /**************************************************************************/ 5 | /* File: xbool.hpp */ 6 | /* Author: Joachim Schoeberl */ 7 | /* Date: 14. Nov. 07 */ 8 | /**************************************************************************/ 9 | 10 | 11 | namespace ngcore 12 | { 13 | // an extended bool with values false/maybe/true 14 | 15 | enum TMAYBE { maybe }; 16 | 17 | class xbool 18 | { 19 | uint8_t state; 20 | 21 | public: 22 | xbool (bool b) : state(b ? 2 : 0) { ; } 23 | xbool (TMAYBE /* x */) : state(1) { ; } 24 | xbool () = default; 25 | xbool (const xbool &) = default; 26 | 27 | xbool & operator= (bool b) { state = b ? 2 : 0; return *this; } 28 | xbool & operator= (TMAYBE /* x */) { state = 1; return *this; } 29 | 30 | bool IsTrue () const { return state == 2; } 31 | bool IsMaybe () const { return state == 1; } 32 | bool IsFalse () const { return state == 0; } 33 | bool IsMaybeTrue() const { return state >= 1; } 34 | bool IsMaybeFalse() const { return state <= 1; } 35 | friend ostream & operator<< (ostream & ost, xbool xb); 36 | }; 37 | 38 | 39 | static char output[] = "0?1"; 40 | inline ostream & operator<< (ostream & ost, xbool xb) 41 | { 42 | return ost << output[xb.state]; 43 | } 44 | 45 | } // namespace ngcore 46 | 47 | #endif // NETGEN_CORE_XBOOL_HPP 48 | -------------------------------------------------------------------------------- /libsrc/csg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nglib PRIVATE 2 | algprim.cpp brick.cpp 3 | bspline2d.cpp csgeom.cpp csgparser.cpp curve2d.cpp edgeflw.cpp 4 | explicitcurve2d.cpp extrusion.cpp gencyl.cpp genmesh.cpp identify.cpp 5 | manifold.cpp meshsurf.cpp polyhedra.cpp revolution.cpp singularref.cpp 6 | solid.cpp specpoin.cpp spline3d.cpp surface.cpp triapprox.cpp zrefine.cpp 7 | python_csg.cpp splinesurface.cpp 8 | ) 9 | 10 | if(USE_GUI) 11 | target_sources(nggui PRIVATE vscsg.cpp csgpkg.cpp) 12 | endif(USE_GUI) 13 | 14 | install(FILES 15 | algprim.hpp brick.hpp csgeom.hpp csg.hpp csgparser.hpp 16 | curve2d.hpp edgeflw.hpp explicitcurve2d.hpp extrusion.hpp 17 | gencyl.hpp geoml.hpp identify.hpp manifold.hpp meshsurf.hpp 18 | polyhedra.hpp revolution.hpp singularref.hpp solid.hpp 19 | specpoin.hpp spline3d.hpp splinesurface.hpp surface.hpp 20 | triapprox.hpp vscsg.hpp 21 | DESTINATION ${NG_INSTALL_DIR_INCLUDE}/csg COMPONENT netgen_devel 22 | ) 23 | -------------------------------------------------------------------------------- /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 | // #include 14 | #include "../gprim/spline.hpp" 15 | #include "../gprim/splinegeometry.hpp" 16 | 17 | 18 | 19 | #include "surface.hpp" 20 | #include "solid.hpp" 21 | #include "identify.hpp" 22 | #include "singularref.hpp" 23 | #include "splinesurface.hpp" 24 | #include "csgeom.hpp" 25 | #include "csgparser.hpp" 26 | 27 | #include "triapprox.hpp" 28 | #include "algprim.hpp" 29 | #include "brick.hpp" 30 | #include "spline3d.hpp" 31 | #include "manifold.hpp" 32 | #include "curve2d.hpp" 33 | #include "explicitcurve2d.hpp" 34 | #include "gencyl.hpp" 35 | #include "polyhedra.hpp" 36 | #include "extrusion.hpp" 37 | #include "revolution.hpp" 38 | #include "specpoin.hpp" 39 | #include "edgeflw.hpp" 40 | #include "meshsurf.hpp" 41 | 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /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/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 representation 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libsrc/csg/meshsurf.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | 7 | 8 | namespace netgen 9 | { 10 | /* 11 | Meshing2Surfaces :: Meshing2Surfaces (const Surface & asurface) 12 | : surface(asurface) 13 | { 14 | ; 15 | } 16 | */ 17 | Meshing2Surfaces :: Meshing2Surfaces (const CSGeometry& geo, 18 | const Surface & asurf, 19 | const MeshingParameters & mp, 20 | const Box<3> & abb) 21 | : Meshing2(geo, mp, abb), surface(asurf), mparam (mp) 22 | { 23 | ; 24 | } 25 | 26 | 27 | void Meshing2Surfaces :: DefineTransformation (const Point<3> & p1, const Point<3> & p2, 28 | const PointGeomInfo * geominfo1, 29 | const PointGeomInfo * geominfo2) 30 | { 31 | ((Surface&)surface).DefineTangentialPlane (p1, p2); 32 | } 33 | 34 | void Meshing2Surfaces :: TransformToPlain (const Point<3> & locpoint, 35 | const MultiPointGeomInfo & geominfo, 36 | Point<2> & planepoint, 37 | double h, int & zone) 38 | { 39 | surface.ToPlane (locpoint, planepoint, h, zone); 40 | } 41 | 42 | int Meshing2Surfaces :: TransformFromPlain (const Point<2> & planepoint, 43 | Point<3> & locpoint, 44 | PointGeomInfo & gi, 45 | double h) 46 | { 47 | surface.FromPlane (planepoint, locpoint, h); 48 | gi.trignum = 1; 49 | return 0; 50 | } 51 | 52 | 53 | 54 | double Meshing2Surfaces :: CalcLocalH (const Point<3> & p, double gh) const 55 | { 56 | return surface.LocH (p, 3, 1, mparam, gh); 57 | /* 58 | double loch = mesh.lochfunc->GetH(p); 59 | if (gh < loch) loch = gh; 60 | return loch; 61 | */ 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /libsrc/csg/meshsurf.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_MESHSURF 2 | #define FILE_MESHSURF 3 | 4 | namespace netgen 5 | { 6 | 7 | /// 8 | class Meshing2Surfaces : public Meshing2 9 | { 10 | /// 11 | const Surface & surface; 12 | 13 | /// should be movec to base ... 14 | const MeshingParameters & mparam; 15 | public: 16 | /// 17 | // Meshing2Surfaces (const Surface & asurf); 18 | /// 19 | Meshing2Surfaces (const CSGeometry& geo, 20 | const Surface & asurf, 21 | const MeshingParameters & mp, 22 | const Box<3> & aboundingbox); 23 | 24 | protected: 25 | /// 26 | void DefineTransformation(const Point<3> & p1, 27 | const Point<3> & p2, 28 | const PointGeomInfo * geominfo1, 29 | const PointGeomInfo * geominfo2) override; 30 | /// 31 | void TransformToPlain(const Point<3> & locpoint, 32 | const MultiPointGeomInfo & geominfo, 33 | Point<2> & plainpoint, 34 | double h, int & zone) override; 35 | /// 36 | int TransformFromPlain(const Point<2>& plainpoint, 37 | Point<3>& locpoint, 38 | PointGeomInfo & gi, 39 | double h) override; 40 | /// 41 | double CalcLocalH(const Point<3> & p, double gh) const override; 42 | }; 43 | } 44 | 45 | #endif 46 | 47 | -------------------------------------------------------------------------------- /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 | NgBitArray used(GetNP()); 32 | NgArray 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/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 approximation 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 | NgArray > points; 40 | NgArray > normals; 41 | NgArray 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 | -------------------------------------------------------------------------------- /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 NGGUI_API VisualSceneGeometry : public VisualScene 14 | { 15 | class CSGeometry * geometry; 16 | NgArray 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/general/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nglib PRIVATE 2 | gzstream.cpp 3 | hashtabl.cpp 4 | mystring.cpp 5 | ngbitarray.cpp 6 | optmem.cpp 7 | parthreads.cpp 8 | seti.cpp 9 | sort.cpp 10 | spbita2d.cpp 11 | table.cpp 12 | ) 13 | 14 | # dynamicmem.cpp 15 | 16 | install(FILES 17 | ngarray.hpp autodiff.hpp autoptr.hpp ngbitarray.hpp 18 | hashtabl.hpp myadt.hpp 19 | mystring.hpp netgenout.hpp ngpython.hpp 20 | optmem.hpp parthreads.hpp seti.hpp sort.hpp 21 | spbita2d.hpp stack.hpp table.hpp template.hpp 22 | gzstream.h 23 | DESTINATION ${NG_INSTALL_DIR_INCLUDE}/general COMPONENT netgen_devel 24 | ) 25 | # dynamicmem.hpp 26 | -------------------------------------------------------------------------------- /libsrc/general/autoptr.hpp: -------------------------------------------------------------------------------- 1 | braucht man nicht mehr 2 | 3 | #ifndef FILE_AUTOPTR 4 | #define FILE_AUTOPTR 5 | 6 | /**************************************************************************/ 7 | /* File: autoptr.hpp */ 8 | /* Author: STL, Joachim Schoeberl */ 9 | /* Date: 29. Dec. 02 */ 10 | /**************************************************************************/ 11 | 12 | namespace netgen 13 | { 14 | 15 | /* 16 | template 17 | class AutoPtr 18 | { 19 | private: 20 | T * ptr; 21 | public: 22 | typedef T* pT; 23 | explicit AutoPtr (T * p = 0) { ptr = p; } 24 | ~AutoPtr () { delete ptr; } 25 | 26 | T & operator*() const { return *ptr; } 27 | T* operator->() const { return ptr; } 28 | T *& Ptr() { return ptr; } 29 | T * Ptr() const { return ptr; } 30 | void Reset(T * p = 0) { if (p != ptr) { delete ptr; ptr = p; } } 31 | operator bool () { return ptr != 0; } 32 | private: 33 | AutoPtr (AutoPtr &) { ; } 34 | AutoPtr & operator= (AutoPtr &) { ; } 35 | }; 36 | */ 37 | } 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /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 | #include "../include/mystdlib.h" 16 | #include "../include/mydefs.hpp" 17 | 18 | 19 | #include 20 | namespace netgen 21 | { 22 | using namespace ngcore; 23 | using NgException = Exception; 24 | } 25 | #include "parthreads.hpp" 26 | // #include "moveablemem.hpp" 27 | // #include "dynamicmem.hpp" 28 | 29 | #include "template.hpp" 30 | #include "ngarray.hpp" 31 | #include "table.hpp" 32 | #include "hashtabl.hpp" 33 | 34 | 35 | #include "ngbitarray.hpp" 36 | #include "spbita2d.hpp" 37 | 38 | #include "seti.hpp" 39 | #include "optmem.hpp" 40 | // #include "autoptr.hpp" 41 | #include "sort.hpp" 42 | #include "stack.hpp" 43 | #include "mystring.hpp" 44 | 45 | // #include "mpi_interface.hpp" 46 | #include "netgenout.hpp" 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /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 | #include 11 | 12 | #include "ngarray.hpp" 13 | 14 | namespace netgen 15 | { 16 | 17 | /** 18 | Optimized Memory allocation classes 19 | */ 20 | 21 | class BlockAllocator 22 | { 23 | private: 24 | /// 25 | unsigned size, blocks; 26 | /// 27 | void * freelist; 28 | /// 29 | NgArray bablocks; 30 | mutex block_allocator_mutex; 31 | public: 32 | /// 33 | DLL_HEADER BlockAllocator (unsigned asize, unsigned ablocks = 100); 34 | /// 35 | DLL_HEADER ~BlockAllocator (); 36 | /// 37 | DLL_HEADER void * Alloc (); 38 | /// 39 | DLL_HEADER void Free (void * p); 40 | }; 41 | 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | NgArray set; 20 | NgBitArray 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 NgArray & GetArray() { return set; } 45 | }; 46 | 47 | } 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /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 NgArray & values, 15 | NgArray & order); 16 | 17 | extern void QuickSort (const NgArray & values, 18 | NgArray & 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 (NgArray & data) 39 | { 40 | if(data.Size() > 0) 41 | // BubbleSort (data.Size(), &data[data.Begin()]); 42 | BubbleSort (data.Size(), &data[*data.Range().begin()]); 43 | } 44 | 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libsrc/geom2d/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nglib PRIVATE 2 | csg2d.cpp 3 | genmesh2d.cpp 4 | geometry2d.cpp 5 | python_geom2d.cpp 6 | ) 7 | 8 | if(USE_GUI) 9 | target_sources(nggui PRIVATE vsgeom2d.cpp geom2dpkg.cpp) 10 | endif(USE_GUI) 11 | 12 | install(FILES 13 | geometry2d.hpp spline2d.hpp 14 | vsgeom2d.hpp csg2d.hpp 15 | DESTINATION ${NG_INSTALL_DIR_INCLUDE}/geom2d COMPONENT netgen_devel 16 | ) 17 | -------------------------------------------------------------------------------- /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 (const filesystem::path & 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/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 NGGUI_API 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/gprim/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nglib PRIVATE 2 | adtree.cpp 3 | geom2d.cpp 4 | geom3d.cpp 5 | geomfuncs.cpp 6 | geomtest3d.cpp 7 | spline.cpp 8 | splinegeometry.cpp 9 | transform3d.cpp 10 | ) 11 | 12 | install(FILES 13 | adtree.hpp geom2d.hpp geom3d.hpp geomfuncs.hpp 14 | geomobjects.hpp geomops.hpp geomtest3d.hpp gprim.hpp 15 | splinegeometry.hpp spline.hpp transform3d.hpp 16 | DESTINATION ${NG_INSTALL_DIR_INCLUDE}/gprim COMPONENT netgen_devel 17 | ) 18 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 DLL_HEADER SplineGeometry 26 | { 27 | // protected: 28 | public: 29 | NgArray < GeomPoint > geompoints; 30 | NgArray < SplineSeg* > splines; 31 | 32 | SplineGeometry() : geompoints{}, splines{} { ; } 33 | virtual ~SplineGeometry(); 34 | 35 | int Load (const NgArray & raw_data, const int startpos = 0); 36 | 37 | virtual void DoArchive(Archive& ar) 38 | { 39 | ar & geompoints & splines; 40 | } 41 | 42 | void GetRawData (NgArray & raw_data) const; 43 | 44 | 45 | const NgArray*> & GetSplines () const 46 | { return splines; } 47 | 48 | int GetNSplines (void) const { return splines.Size(); } 49 | string GetSplineType (const int i) const { return splines[i]->GetType(); } 50 | SplineSeg & GetSpline (const int i) {return *splines[i];} 51 | const SplineSeg & GetSpline (const int i) const {return *splines[i];} 52 | 53 | void GetBoundingBox (Box & box) const; 54 | Box GetBoundingBox () const 55 | { Box box; GetBoundingBox (box); return box; } 56 | 57 | int GetNP () const { return geompoints.Size(); } 58 | const GeomPoint & GetPoint(int i) const { return geompoints[i]; } 59 | 60 | // void SetGrading (const double grading); 61 | void AppendPoint (const Point & p, const double reffac = 1., const bool hpref = false); 62 | 63 | void AppendSegment(SplineSeg * spline) 64 | { 65 | splines.Append (spline); 66 | } 67 | }; 68 | 69 | 70 | 71 | } 72 | 73 | #endif // _FILE_SPLINEGEOMETRY 74 | -------------------------------------------------------------------------------- /libsrc/include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install(FILES nginterface.h nginterface_v2.hpp mydefs.hpp DESTINATION ${NG_INSTALL_DIR_INCLUDE} 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 ngsimd.hpp 7 | opti.hpp parallel.hpp stlgeom.hpp visual.hpp 8 | DESTINATION ${NG_INSTALL_DIR_INCLUDE}/include COMPONENT netgen_devel 9 | ) 10 | 11 | -------------------------------------------------------------------------------- /libsrc/include/acisgeom.hpp: -------------------------------------------------------------------------------- 1 | #ifdef ACIS 2 | #include "../acisgeom/acisgeom.hpp" 3 | #endif 4 | -------------------------------------------------------------------------------- /libsrc/include/csg.hpp: -------------------------------------------------------------------------------- 1 | #include "../csg/csg.hpp" 2 | -------------------------------------------------------------------------------- /libsrc/include/geometry2d.hpp: -------------------------------------------------------------------------------- 1 | #include "../geom2d/geometry2d.hpp" 2 | -------------------------------------------------------------------------------- /libsrc/include/gprim.hpp: -------------------------------------------------------------------------------- 1 | #include "../gprim/gprim.hpp" 2 | -------------------------------------------------------------------------------- /libsrc/include/inctcl.hpp: -------------------------------------------------------------------------------- 1 | #ifdef WIN32 2 | #define WIN32_LEAN_AND_MEAN 3 | #include 4 | #endif 5 | 6 | #include 7 | #include 8 | 9 | #if TK_MAJOR_VERSION==8 && TK_MINOR_VERSION>=4 10 | #define tcl_const const 11 | #else 12 | #define tcl_const 13 | #endif 14 | -------------------------------------------------------------------------------- /libsrc/include/incvis.hpp: -------------------------------------------------------------------------------- 1 | // libraries for User interface: 2 | 3 | nicht mehr verwendet 4 | 5 | #include "inctcl.hpp" 6 | #include "incopengl.hpp" 7 | -------------------------------------------------------------------------------- /libsrc/include/linalg.hpp: -------------------------------------------------------------------------------- 1 | #include "../linalg/linalg.hpp" 2 | -------------------------------------------------------------------------------- /libsrc/include/meshing.hpp: -------------------------------------------------------------------------------- 1 | #include <../meshing/meshing.hpp> 2 | -------------------------------------------------------------------------------- /libsrc/include/myadt.hpp: -------------------------------------------------------------------------------- 1 | #include <../general/myadt.hpp> 2 | -------------------------------------------------------------------------------- /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 | #include 15 | #define PACKAGE_VERSION "6.2-dev" 16 | 17 | // #define DEBUG 18 | 19 | #if defined(nglib_EXPORTS) 20 | #define DLL_HEADER NGCORE_API_EXPORT 21 | #else 22 | #define DLL_HEADER NGCORE_API_IMPORT 23 | #endif 24 | 25 | 26 | 27 | 28 | #ifndef __assume 29 | #ifdef __GNUC__ 30 | #define __assume(cond) if (!(cond)) __builtin_unreachable(); else; 31 | #else 32 | #define __assume(cond) 33 | #endif 34 | #endif 35 | 36 | 37 | #ifndef NG_INLINE 38 | #ifdef __INTEL_COMPILER 39 | #ifdef WIN32 40 | #define NG_INLINE __forceinline inline 41 | #else 42 | #define NG_INLINE __forceinline inline 43 | #endif 44 | #else 45 | #ifdef __GNUC__ 46 | #define NG_INLINE __attribute__ ((__always_inline__)) inline 47 | #define VLA 48 | #else 49 | #define NG_INLINE inline 50 | #endif 51 | #endif 52 | #endif 53 | 54 | 55 | // #define BASE0 56 | // #define DEBUG 57 | 58 | 59 | #define noDEMOVERSION 60 | #define noDEVELOP 61 | #define noSTEP 62 | #define noSOLIDGEOM 63 | 64 | #define noDEMOAPP 65 | #define noMODELLER 66 | 67 | #define noSTAT_STREAM 68 | #define noLOG_STREAM 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /libsrc/include/mystdlib.h: -------------------------------------------------------------------------------- 1 | #ifndef FILE_MYSTDLIB 2 | #define FILE_MYSTDLIB 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | 30 | #ifndef M_PI 31 | #define M_PI 3.14159265358979323846 32 | #endif 33 | 34 | /*** Windows headers ***/ 35 | #ifdef _MSC_VER 36 | # define WIN32_LEAN_AND_MEAN 37 | # ifndef NO_PARALLEL_THREADS 38 | # ifdef MSVC_EXPRESS 39 | # else 40 | // # include 41 | // # include 42 | # endif // MSVC_EXPRESS 43 | # endif 44 | // # include 45 | # undef WIN32_LEAN_AND_MEAN 46 | // # include 47 | #else // Not using MC VC++ 48 | #endif 49 | 50 | 51 | // using namespace std; 52 | namespace netgen 53 | { 54 | using namespace std; 55 | } 56 | 57 | 58 | #endif 59 | 60 | -------------------------------------------------------------------------------- /libsrc/include/ngsimd.hpp: -------------------------------------------------------------------------------- 1 | #include <../general/ngsimd.hpp> 2 | -------------------------------------------------------------------------------- /libsrc/include/occgeom.hpp: -------------------------------------------------------------------------------- 1 | #include "../occ/occgeom.hpp" 2 | -------------------------------------------------------------------------------- /libsrc/include/opti.hpp: -------------------------------------------------------------------------------- 1 | #include "../linalg/opti.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/interface/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nglib PRIVATE writeuser.cpp 2 | nginterface.cpp nginterface_v2.cpp 3 | read_fnf_mesh.cpp readtetmesh.cpp readuser.cpp writeabaqus.cpp writediffpack.cpp 4 | writedolfin.cpp writeelmer.cpp writefeap.cpp writefluent.cpp writegmsh.cpp writejcm.cpp 5 | writepermas.cpp writetecplot.cpp writetet.cpp writetochnog.cpp 6 | wuchemnitz.cpp writegmsh2.cpp writeOpenFOAM15x.cpp rw_cgns.cpp rw_medit.cpp 7 | ) 8 | 9 | install(FILES 10 | writeuser.hpp rw_medit.hpp 11 | DESTINATION ${NG_INSTALL_DIR_INCLUDE}/interface COMPONENT netgen_devel 12 | ) 13 | -------------------------------------------------------------------------------- /libsrc/interface/rw_medit.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "writeuser.hpp" 3 | 4 | namespace netgen 5 | { 6 | DLL_HEADER void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename, map, int> & index_map); 7 | DLL_HEADER void ReadMeditFormat (Mesh & mesh, const filesystem::path & filename); 8 | 9 | DLL_HEADER void WriteMeditFormat (const Mesh & mesh, const filesystem::path & filename, map, int> & index_map); 10 | DLL_HEADER void WriteMeditFormat (const Mesh & mesh, const filesystem::path & filename); 11 | } // namespace netgen 12 | -------------------------------------------------------------------------------- /libsrc/linalg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nglib PRIVATE 2 | bfgs.cpp 3 | densemat.cpp 4 | linopt.cpp 5 | linsearch.cpp 6 | polynomial.cpp 7 | ) 8 | 9 | install(FILES 10 | densemat.hpp linalg.hpp opti.hpp 11 | polynomial.hpp vector.hpp 12 | DESTINATION ${NG_INSTALL_DIR_INCLUDE}/linalg COMPONENT netgen_devel 13 | ) 14 | -------------------------------------------------------------------------------- /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 | #include "vector.hpp" 25 | #include "densemat.hpp" 26 | #include "polynomial.hpp" 27 | #endif 28 | 29 | 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libsrc/linalg/opti.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/libsrc/linalg/opti.hpp -------------------------------------------------------------------------------- /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 | namespace netgen 11 | { 12 | 13 | class QuadraticPolynomial1V 14 | { 15 | double c, cx, cxx; 16 | public: 17 | QuadraticPolynomial1V (double ac, double acx, double acxx); 18 | double Value (double x); 19 | double MaxUnitInterval (); 20 | }; 21 | 22 | class LinearPolynomial2V 23 | { 24 | double c, cx, cy; 25 | public: 26 | LinearPolynomial2V (double ac, double acx, double acy); 27 | friend class QuadraticPolynomial2V; 28 | }; 29 | 30 | 31 | class QuadraticPolynomial2V 32 | { 33 | double c, cx, cy, cxx, cxy, cyy; 34 | public: 35 | QuadraticPolynomial2V (); 36 | QuadraticPolynomial2V (double ac, double acx, double acy, 37 | double acxx, double acxy, double acyy); 38 | void Square (const LinearPolynomial2V & lp); 39 | void Add (double lam, const QuadraticPolynomial2V & qp); 40 | 41 | double Value (double x, double y); 42 | // double MinUnitSquare (); 43 | double MaxUnitSquare (); 44 | double MaxUnitTriangle (); 45 | }; 46 | } // namespace netgen 47 | #endif 48 | -------------------------------------------------------------------------------- /libsrc/meshing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nglib PRIVATE 2 | adfront2.cpp adfront3.cpp bisect.cpp boundarylayer.cpp 3 | clusters.cpp curvedelems.cpp delaunay.cpp delaunay2d.cpp 4 | geomsearch.cpp global.cpp hprefinement.cpp improve2.cpp 5 | improve2gen.cpp improve3.cpp localh.cpp meshclass.cpp 6 | meshfunc.cpp meshfunc2d.cpp meshing2.cpp meshing3.cpp 7 | meshtool.cpp meshtype.cpp msghandler.cpp netrule2.cpp 8 | netrule3.cpp parser2.cpp parser3.cpp refine.cpp 9 | ruler2.cpp ruler3.cpp secondorder.cpp smoothing2.5.cpp 10 | smoothing2.cpp smoothing3.cpp specials.cpp 11 | topology.cpp validate.cpp bcfunctions.cpp 12 | parallelmesh.cpp paralleltop.cpp basegeom.cpp 13 | python_mesh.cpp surfacegeom.cpp 14 | debugging.cpp fieldlines.cpp visual_interface.cpp 15 | boundarylayer2d.cpp boundarylayer_interpolate.cpp 16 | ) 17 | 18 | target_link_libraries( nglib PRIVATE $ $ ) 19 | 20 | install(FILES 21 | adfront2.hpp adfront3.hpp basegeom.hpp bcfunctions.hpp bisect.hpp 22 | boundarylayer.hpp classifyhpel.hpp clusters.hpp curvedelems.hpp 23 | findip2.hpp findip.hpp geomsearch.hpp global.hpp hpref_hex.hpp 24 | hprefinement.hpp hpref_prism.hpp hpref_pyramid.hpp hpref_quad.hpp 25 | hpref_segm.hpp hpref_tet.hpp hpref_trig.hpp improve2.hpp improve3.hpp 26 | localh.hpp meshclass.hpp meshfunc.hpp meshing2.hpp meshing3.hpp 27 | meshing.hpp meshtool.hpp meshtype.hpp msghandler.hpp paralleltop.hpp 28 | ruler2.hpp ruler3.hpp specials.hpp topology.hpp validate.hpp 29 | python_mesh.hpp surfacegeom.hpp delaunay2d.hpp 30 | fieldlines.hpp soldata.hpp visual_interface.hpp 31 | DESTINATION ${NG_INSTALL_DIR_INCLUDE}/meshing COMPONENT netgen_devel 32 | ) 33 | -------------------------------------------------------------------------------- /libsrc/meshing/bisect.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NETGEN_BISECT_HPP 2 | #define NETGEN_BISECT_HPP 3 | 4 | #include 5 | #include 6 | #include "basegeom.hpp" 7 | #include "meshclass.hpp" 8 | 9 | namespace netgen 10 | { 11 | 12 | class BisectionOptions 13 | { 14 | public: 15 | const char * outfilename; 16 | const char * mlfilename; 17 | const char * refinementfilename; 18 | const char * femcode; 19 | int maxlevel; 20 | int usemarkedelements; 21 | bool refine_hp = false; 22 | bool refine_p = false; 23 | bool onlyonce = false; 24 | NgTaskManager task_manager = &DummyTaskManager; 25 | NgTracer tracer = &DummyTracer; 26 | DLL_HEADER BisectionOptions (); 27 | }; 28 | 29 | class ZRefinementOptions 30 | { 31 | public: 32 | int minref; 33 | DLL_HEADER ZRefinementOptions(); 34 | }; 35 | 36 | 37 | 38 | DLL_HEADER extern void BisectTetsCopyMesh (Mesh &, const NetgenGeometry *, 39 | BisectionOptions & opt); 40 | 41 | DLL_HEADER extern void ZRefinement (Mesh &, const class NetgenGeometry *, 42 | ZRefinementOptions & opt); 43 | 44 | 45 | 46 | 47 | 48 | class DLL_HEADER Refinement 49 | { 50 | const NetgenGeometry& geo; 51 | 52 | public: 53 | Refinement (const NetgenGeometry& ageo) : geo(ageo) {} 54 | virtual ~Refinement () {} 55 | 56 | void Refine (Mesh & mesh) const; 57 | void Refine (Mesh & mesh); 58 | void Bisect (Mesh & mesh, class BisectionOptions & opt, NgArray * quality_loss = NULL) const; 59 | 60 | void MakeSecondOrder (Mesh & mesh) const; 61 | void MakeSecondOrder (Mesh & mesh); 62 | 63 | void ValidateSecondOrder (Mesh & mesh); 64 | void ValidateRefinedMesh (Mesh & mesh, 65 | NgArray & parents); 66 | 67 | virtual void LocalizeEdgePoints(Mesh & /* mesh */) const {;} 68 | }; 69 | 70 | } // namespace netgen 71 | 72 | #endif // NETGEN_BISECT_HPP 73 | -------------------------------------------------------------------------------- /libsrc/meshing/clusters.hpp: -------------------------------------------------------------------------------- 1 | #ifndef NETGEN_CLUSTERS_HPP 2 | #define NETGEN_CLUSTERS_HPP 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 | #include "meshclass.hpp" 17 | 18 | namespace netgen 19 | { 20 | 21 | class AnisotropicClusters 22 | { 23 | const Mesh & mesh; 24 | 25 | int nv, ned, nfa, ne; 26 | 27 | // connected nodes, nodes = vertices, edges, faces, elements 28 | NgArray cluster_reps; 29 | 30 | public: 31 | AnisotropicClusters (const Mesh & amesh); 32 | ~AnisotropicClusters(); 33 | 34 | void Update(); 35 | 36 | int GetVertexRepresentant (int vnr) const 37 | { return cluster_reps.Get(vnr); } 38 | int GetEdgeRepresentant (int ednr) const 39 | { return cluster_reps.Get(nv+ednr); } 40 | int GetFaceRepresentant (int fnr) const 41 | { return cluster_reps.Get(nv+ned+fnr); } 42 | int GetElementRepresentant (int enr) const 43 | { return cluster_reps.Get(nv+ned+nfa+enr); } 44 | }; 45 | } // namespace netgen 46 | #endif // NETGEN_CLUSTERS_HPP 47 | -------------------------------------------------------------------------------- /libsrc/meshing/debugging.hpp: -------------------------------------------------------------------------------- 1 | #include "meshfunc.hpp" 2 | 3 | 4 | namespace netgen 5 | { 6 | unique_ptr GetOpenElements( const Mesh & m, int dom = 0, bool only_quads = false ); 7 | 8 | unique_ptr FilterMesh( const Mesh & m, FlatArray points, FlatArray sels = Array{}, FlatArray els = Array{} ); 9 | 10 | // Checks if the mesh is valid. This is called automatically on various places if debugparam.slowchecks is set 11 | void CheckMesh( const Mesh & m, MESHING_STEP meshing_step ); 12 | 13 | // Sometimes during SwapImprove we discover topological errors in the mesh. For instance, an edge is adjacent to 8 tets around it, but 14 | // the 8 "other" points of the tets don't form a closed path around the edge. Instead there are 2 sets of 4 points/tets each, which are not connected. 15 | // This function checks for such errors and returns true if any are found. 16 | void CheckElementsAroundEdges( const Mesh & m ); 17 | } 18 | -------------------------------------------------------------------------------- /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 | #include 11 | #include "meshing3.hpp" 12 | #include "meshtype.hpp" 13 | 14 | namespace netgen 15 | { 16 | /* 17 | Functions for mesh-generations strategies 18 | */ 19 | 20 | class Mesh; 21 | // class CSGeometry; 22 | 23 | /// Build tet-mesh 24 | DLL_HEADER MESHING3_RESULT MeshVolume (const MeshingParameters & mp, Mesh& mesh3d); 25 | 26 | /// Build mixed-element mesh 27 | // MESHING3_RESULT MeshMixedVolume (MeshingParameters & mp, Mesh& mesh3d); 28 | 29 | /// Optimize tet-mesh 30 | DLL_HEADER MESHING3_RESULT OptimizeVolume (const MeshingParameters & mp, Mesh& mesh3d); 31 | // const CSGeometry * geometry = NULL); 32 | 33 | DLL_HEADER void RemoveIllegalElements (Mesh & mesh3d, int domain = 0); 34 | DLL_HEADER void ConformToFreeSegments (Mesh & mesh3d, int domain); 35 | 36 | 37 | enum MESHING_STEP { 38 | MESHCONST_ANALYSE = 1, 39 | MESHCONST_MESHEDGES = 2, 40 | MESHCONST_MESHSURFACE = 3, 41 | MESHCONST_OPTSURFACE = 4, 42 | MESHCONST_MESHVOLUME = 5, 43 | MESHCONST_OPTVOLUME = 6 44 | }; 45 | } // namespace netgen 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /libsrc/meshing/meshing.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_MESHING 2 | #define FILE_MESHING 3 | 4 | #include "../include/myadt.hpp" 5 | #include "../include/gprim.hpp" 6 | #include "../include/linalg.hpp" 7 | #include "../include/opti.hpp" 8 | 9 | 10 | namespace netgen 11 | { 12 | // extern int printmessage_importance; 13 | 14 | // class CSGeometry; 15 | using namespace std; 16 | class NetgenGeometry; 17 | } 18 | 19 | 20 | // #include "msghandler.hpp" 21 | // #include "meshtype.hpp" 22 | // #include "localh.hpp" 23 | // #include "topology.hpp" 24 | // #include "meshclass.hpp" 25 | // #include "global.hpp" 26 | 27 | #include "meshtool.hpp" 28 | 29 | #include "ruler2.hpp" 30 | #include "adfront2.hpp" 31 | 32 | 33 | #include "meshing2.hpp" 34 | #include "improve2.hpp" 35 | 36 | 37 | #include "geomsearch.hpp" 38 | #include "adfront3.hpp" 39 | #include "ruler3.hpp" 40 | 41 | #include "findip.hpp" 42 | #include "findip2.hpp" 43 | 44 | #include "meshing3.hpp" 45 | #include "improve3.hpp" 46 | 47 | #include "curvedelems.hpp" 48 | #include "clusters.hpp" 49 | #include "meshfunc.hpp" 50 | 51 | #include "bisect.hpp" 52 | #include "hprefinement.hpp" 53 | 54 | #include "specials.hpp" 55 | #include "validate.hpp" 56 | #include "basegeom.hpp" 57 | #include "surfacegeom.hpp" 58 | 59 | #include "paralleltop.hpp" 60 | 61 | 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /libsrc/meshing/specials.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_SPECIALS 2 | #define FILE_SPECIALS 3 | 4 | /* 5 | 6 | Very special implementations .. 7 | 8 | */ 9 | 10 | namespace netgen { 11 | /// 12 | DLL_HEADER extern void CutOffAndCombine (Mesh & mesh, const Mesh & othermesh); 13 | 14 | DLL_HEADER extern void HelmholtzMesh (Mesh & mesh); 15 | 16 | } // namespace netgen 17 | #endif 18 | -------------------------------------------------------------------------------- /libsrc/meshing/validate.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VALIDATE_HPP 2 | #define VALIDATE_HPP 3 | 4 | namespace netgen 5 | { 6 | 7 | void GetPureBadness(Mesh & mesh, NgArray & pure_badness, 8 | const TBitArray & isnewpoint); 9 | double Validate(const Mesh & mesh, NgArray & bad_elements, 10 | const NgArray & pure_badness, 11 | double max_worsening, const bool uselocalworsening, 12 | NgArray * quality_loss = NULL); 13 | void RepairBisection(Mesh & mesh, NgArray & bad_elements, 14 | const TBitArray & isnewpoint, const Refinement & refinement, 15 | const NgArray & pure_badness, 16 | double max_worsening, const bool uselocalworsening, 17 | const NgArray< idmap_type* > & idmaps); 18 | 19 | } 20 | 21 | #endif // VALIDATE_HPP 22 | -------------------------------------------------------------------------------- /libsrc/meshing/visual_interface.cpp: -------------------------------------------------------------------------------- 1 | #include "visual_interface.hpp" 2 | #include "../include/nginterface.h" 3 | 4 | void (*Ptr_Ng_ClearSolutionData) () = nullptr; 5 | void (*Ptr_Ng_InitSolutionData) (Ng_SolutionData*) = nullptr; 6 | void (*Ptr_Ng_SetSolutionData) (Ng_SolutionData*) = nullptr; 7 | void (*Ptr_Ng_Redraw) (bool blocking) = nullptr; 8 | 9 | void Ng_ClearSolutionData () { if(Ptr_Ng_ClearSolutionData) Ptr_Ng_ClearSolutionData(); } 10 | void Ng_InitSolutionData (Ng_SolutionData * soldata) { if(Ptr_Ng_InitSolutionData) Ptr_Ng_InitSolutionData(soldata); } 11 | void Ng_SetSolutionData (Ng_SolutionData * soldata) { if(Ptr_Ng_SetSolutionData) Ptr_Ng_SetSolutionData(soldata); } 12 | void Ng_Redraw (bool blocking) { if(Ptr_Ng_Redraw) Ptr_Ng_Redraw(blocking); } 13 | 14 | namespace netgen 15 | { 16 | void (*Ptr_Ng_Tcl_SetResult)(Tcl_Interp *interp, char *result, Tcl_FreeProc *freeProc) = nullptr; 17 | void (*Ptr_Ng_Tcl_CreateCommand)(Tcl_Interp *interp, 18 | const char *cmdName, Tcl_CmdProc *proc) = nullptr; 19 | void (*Ptr_Render)(bool) = nullptr; 20 | void (*Ptr_UpdateVisSurfaceMeshData)(int, 21 | shared_ptr>>, 22 | shared_ptr>, 23 | shared_ptr>> 24 | ) = nullptr; 25 | } // namespace netgen 26 | 27 | -------------------------------------------------------------------------------- /libsrc/occ/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nglib PRIVATE 2 | Partition_Inter2d.cxx Partition_Inter3d.cxx 3 | Partition_Loop.cxx Partition_Loop2d.cxx Partition_Loop3d.cxx Partition_Spliter.cxx 4 | occgenmesh.cpp occgeom.cpp occmeshsurf.cpp python_occ.cpp 5 | python_occ_basic.cpp python_occ_shapes.cpp 6 | occ_face.cpp occ_edge.cpp occ_vertex.cpp occ_utils.cpp 7 | ) 8 | 9 | if(USE_GUI) 10 | target_sources(nggui PRIVATE vsocc.cpp occpkg.cpp) 11 | endif(USE_GUI) 12 | 13 | install(FILES 14 | occgeom.hpp occmeshsurf.hpp vsocc.hpp occ_utils.hpp 15 | occ_vertex.hpp occ_edge.hpp occ_face.hpp occ_solid.hpp 16 | DESTINATION ${NG_INSTALL_DIR_INCLUDE}/occ COMPONENT netgen_devel 17 | ) 18 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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_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/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_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/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_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/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 | -------------------------------------------------------------------------------- /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/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/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/occ/occ_edge.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_OCC_EDGE_INCLUDED 2 | #define FILE_OCC_EDGE_INCLUDED 3 | 4 | 5 | // #pragma clang diagnostic push 6 | // #pragma clang diagnostic ignored "-Wdeprecated-declarations" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | // #pragma clang diagnostic pop 16 | 17 | #include "occ_vertex.hpp" 18 | #include "meshing.hpp" 19 | 20 | namespace netgen 21 | { 22 | class OCCEdge : public GeometryEdge 23 | { 24 | public: 25 | TopoDS_Edge edge; 26 | Handle(Geom_Curve) curve; 27 | double s0, s1; 28 | GProp_GProps props; 29 | 30 | public: 31 | OCCEdge(TopoDS_Shape edge_, GeometryVertex & start_, GeometryVertex & end_); 32 | 33 | auto Shape() const { return edge; } 34 | 35 | double GetLength() const override; 36 | Point<3> GetCenter() const override; 37 | Point<3> GetPoint(double t) const override; 38 | double CalcStep(double t, double sag) const override; 39 | void ProjectPoint(Point<3>& p, EdgePointGeomInfo* gi) const override; 40 | Vec<3> GetTangent(double t) const override; 41 | bool IsDegenerated(double) const override { 42 | return BRep_Tool::Degenerated(edge); 43 | } 44 | }; 45 | } 46 | 47 | #endif // FILE_OCCEDGE_INCLUDED 48 | -------------------------------------------------------------------------------- /libsrc/occ/occ_face.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_OCC_FACE_INCLUDED 2 | #define FILE_OCC_FACE_INCLUDED 3 | 4 | // #pragma clang diagnostic push 5 | // #pragma clang diagnostic ignored "-Wdeprecated-declarations" 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | // #pragma clang diagnostic pop 13 | 14 | #include "occ_vertex.hpp" 15 | #include "meshing.hpp" 16 | 17 | namespace netgen 18 | { 19 | class OCCFace : public GeometryFace 20 | { 21 | TopoDS_Face face; 22 | GProp_GProps props; 23 | Box<3> bbox; 24 | 25 | Handle( Geom_Surface ) surface; 26 | Handle( ShapeAnalysis_Surface ) shape_analysis; 27 | double tolerance; 28 | 29 | public: 30 | OCCFace(TopoDS_Shape dshape); 31 | 32 | const TopoDS_Face Shape() const { return face; } 33 | 34 | Point<3> GetCenter() const override; 35 | virtual size_t GetNBoundaries() const override; 36 | virtual Array GetBoundary(const Mesh& mesh) const override; 37 | virtual PointGeomInfo Project(Point<3>& p) const override; 38 | virtual bool ProjectPointGI(Point<3>& p, PointGeomInfo& gi) const override; 39 | virtual Point<3> GetPoint(const PointGeomInfo& gi) const override; 40 | virtual void CalcEdgePointGI(const GeometryEdge& edge, 41 | double t, 42 | EdgePointGeomInfo& egi) const override; 43 | virtual Box<3> GetBoundingBox() const override; 44 | 45 | virtual double GetCurvature(const PointGeomInfo& gi) const override; 46 | 47 | virtual void RestrictH(Mesh& mesh, const MeshingParameters& mparam) const override; 48 | virtual Vec<3> GetNormal(const Point<3>& p, const PointGeomInfo* gi = nullptr) const override; 49 | }; 50 | } 51 | 52 | #endif // FILE_OCC_FACE_INCLUDED 53 | -------------------------------------------------------------------------------- /libsrc/occ/occ_solid.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_OCC_SOLID_INCLUDED 2 | #define FILE_OCC_SOLID_INCLUDED 3 | 4 | #include 5 | #include 6 | 7 | #include "meshing.hpp" 8 | 9 | namespace netgen 10 | { 11 | class OCCSolid : public GeometrySolid 12 | { 13 | TopoDS_Solid solid; 14 | 15 | public: 16 | OCCSolid(TopoDS_Shape dshape) 17 | : solid(TopoDS::Solid(dshape)) 18 | { } 19 | TopoDS_Solid& GetShape() { return solid; } 20 | }; 21 | } 22 | 23 | #endif // FILE_OCC_SOLID_INCLUDED 24 | -------------------------------------------------------------------------------- /libsrc/occ/occ_vertex.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "occ_vertex.hpp" 5 | 6 | namespace netgen 7 | { 8 | 9 | OCCVertex::OCCVertex( TopoDS_Shape s ) 10 | : vertex(TopoDS::Vertex(s)) 11 | { 12 | p = occ2ng(vertex); 13 | } 14 | 15 | Point<3> OCCVertex::GetPoint() const 16 | { 17 | return p; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /libsrc/occ/occ_vertex.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FILE_OCC_VERTEX_INCLUDED 2 | #define FILE_OCC_VERTEX_INCLUDED 3 | 4 | // #pragma clang diagnostic push 5 | // #pragma clang diagnostic ignored "-Wdeprecated-declarations" 6 | 7 | #include 8 | #include 9 | 10 | // #pragma clang diagnostic pop 11 | 12 | #include "meshing.hpp" 13 | #include "occ_utils.hpp" 14 | 15 | namespace netgen 16 | { 17 | class OCCVertex : public GeometryVertex 18 | { 19 | TopoDS_Vertex vertex; 20 | Point<3> p; 21 | 22 | public: 23 | OCCVertex( ) = default; 24 | OCCVertex( TopoDS_Shape s ); 25 | ~OCCVertex() {} 26 | Point<3> GetPoint() const override; 27 | }; 28 | } 29 | 30 | #endif // FILE_OCC_VERTEX_INCLUDED 31 | -------------------------------------------------------------------------------- /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 | NgArray trilists; 16 | NgArray 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/stlgeom/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nglib PRIVATE 2 | meshstlsurface.cpp stlgeom.cpp stlgeomchart.cpp 3 | stlgeommesh.cpp stlline.cpp stltool.cpp stltopology.cpp python_stl.cpp 4 | ) 5 | 6 | if(USE_GUI) 7 | target_sources(nggui PRIVATE vsstl.cpp stlpkg.cpp) 8 | endif(USE_GUI) 9 | 10 | install(FILES 11 | meshstlsurface.hpp stlgeom.hpp stlline.hpp 12 | stltool.hpp stltopology.hpp vsstl.hpp 13 | DESTINATION ${NG_INSTALL_DIR_INCLUDE}/stlgeom COMPONENT netgen_devel 14 | ) 15 | -------------------------------------------------------------------------------- /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 NGGUI_API VisualSceneSTLGeometry : public VisualScene 14 | { 15 | NgArray trilists; 16 | class STLGeometry * stlgeometry; 17 | 18 | public: 19 | VisualSceneSTLGeometry (); 20 | virtual ~VisualSceneSTLGeometry (); 21 | void SetGeometry (class STLGeometry * astlgeometry) { stlgeometry = astlgeometry; } 22 | 23 | virtual void BuildScene (int zoomall = 0); 24 | virtual void DrawScene (); 25 | }; 26 | 27 | 28 | class NGGUI_API VisualSceneSTLMeshing : public VisualScene 29 | { 30 | NgArray trilists; 31 | int selecttrig, nodeofseltrig; 32 | class STLGeometry * stlgeometry; 33 | 34 | public: 35 | VisualSceneSTLMeshing (); 36 | virtual ~VisualSceneSTLMeshing (); 37 | 38 | void SetGeometry (class STLGeometry * astlgeometry) 39 | { 40 | stlgeometry = astlgeometry; 41 | stlgeometry->SetSelectTrig(selecttrig); 42 | stlgeometry->SetNodeOfSelTrig(nodeofseltrig); 43 | } 44 | 45 | virtual void BuildScene (int zoomall = 0); 46 | virtual void DrawScene (); 47 | virtual void MouseDblClick (int px, int py); 48 | 49 | int seltria; 50 | }; 51 | 52 | 53 | 54 | } 55 | 56 | 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /libsrc/visualization/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nggui PRIVATE 2 | importsolution.cpp 3 | meshdoc.cpp 4 | mvdraw.cpp 5 | vsfieldlines.cpp 6 | vsmesh.cpp 7 | vssolution.cpp 8 | visualpkg.cpp 9 | ) 10 | target_link_libraries( nggui PUBLIC "$" ${OPENGL_LIBRARIES} nglib) 11 | 12 | install(FILES 13 | meshdoc.hpp mvdraw.hpp visual_api.hpp 14 | vispar.hpp visual.hpp vssolution.hpp 15 | DESTINATION ${NG_INSTALL_DIR_INCLUDE}/visualization COMPONENT netgen_devel 16 | ) 17 | -------------------------------------------------------------------------------- /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 | PointIndex selpoint, selpoint2; 13 | 14 | // for edgemarking: 15 | Array edgedist; 16 | int markedgedist; 17 | 18 | 19 | public: 20 | NGGUI_API VisualSceneMeshDoctor (); 21 | NGGUI_API virtual ~VisualSceneMeshDoctor (); 22 | 23 | NGGUI_API virtual void BuildScene (int zoomall = 0); 24 | NGGUI_API virtual void DrawScene (); 25 | NGGUI_API virtual void MouseDblClick (int px, int py); 26 | 27 | NGGUI_API void SetMarkEdgeDist (int dist); 28 | NGGUI_API void ClickElement (int elnr); 29 | NGGUI_API void UpdateTables (); 30 | NGGUI_API int IsSegmentMarked (int segnr) const; 31 | }; 32 | 33 | class MeshDoctorParameters 34 | { 35 | public: 36 | int active; 37 | }; 38 | 39 | 40 | NGGUI_API extern MeshDoctorParameters meshdoctor; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /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 | #include "visual_api.hpp" 17 | #include "../include/incopengl.hpp" 18 | 19 | #include "../meshing/visual_interface.hpp" 20 | #include "../meshing/soldata.hpp" 21 | #include "vispar.hpp" 22 | #include "mvdraw.hpp" 23 | 24 | #include 25 | #include "vssolution.hpp" 26 | #include "meshdoc.hpp" 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /libsrc/visualization/visual_api.hpp: -------------------------------------------------------------------------------- 1 | #ifndef VISUAL_API_HPP_INCLUDED 2 | #define VISUAL_API_HPP_INCLUDED 3 | 4 | #ifdef nggui_EXPORTS 5 | #define NGGUI_API NGCORE_API_EXPORT 6 | #else 7 | #define NGGUI_API NGCORE_API_IMPORT 8 | #endif 9 | 10 | #endif // VISUAL_API_HPP_INCLUDED 11 | -------------------------------------------------------------------------------- /netgen.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/netgen.icns -------------------------------------------------------------------------------- /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 | set(TOGL_LIBRARY_TYPE SHARED) 9 | else(WIN32) 10 | set(TOGL_LIBRARY_TYPE STATIC) 11 | endif(WIN32) 12 | 13 | add_library(togl ${TOGL_LIBRARY_TYPE} togl.c toglProcAddr.c toglStubInit.c) 14 | target_link_libraries( togl PUBLIC $) 15 | 16 | target_compile_definitions(togl PRIVATE -DBUILD_togl=1 -DSTDC_HEADERS=1) 17 | 18 | if(WIN32) 19 | target_compile_definitions(togl PRIVATE -DUNICODE -D_UNICODE -DTOGL_USE_FONTS=0 -DSTDC_HEADER) 20 | else(WIN32) 21 | target_compile_options(togl PRIVATE -fomit-frame-pointer -Wno-implicit-int) 22 | target_compile_definitions(togl PRIVATE -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 -D_LARGEFILE64_SOURCE=1 -DTCL_WIDE_INT_IS_LONG=1) 23 | 24 | include_directories(BEFORE "${TCL_INCLUDE_PATH}/tcl-private/generic" "${TCL_INCLUDE_PATH}/tcl-private/unix") 25 | include_directories(BEFORE "${TK_INCLUDE_PATH}/tk-private/generic" "${TK_INCLUDE_PATH}/tk-private/unix" "${TK_INCLUDE_PATH}/tk-private") 26 | include_directories(BEFORE "${TCL_INCLUDE_PATH}/tk-private/generic/ttk") 27 | include_directories(BEFORE "${TK_INCLUDE_PATH}/../PrivateHeaders") 28 | include_directories(BEFORE "${TCL_INCLUDE_PATH}") 29 | include_directories(BEFORE "${TK_INCLUDE_PATH}") 30 | 31 | endif(WIN32) 32 | 33 | target_include_directories(togl PUBLIC ${OPENGL_INCLUDE_DIR}) 34 | target_link_libraries(togl PUBLIC ${OPENGL_LIBRARY}) 35 | set_target_properties(togl PROPERTIES POSITION_INDEPENDENT_CODE ON ) 36 | install(TARGETS togl DESTINATION ${NG_INSTALL_DIR} COMPONENT netgen) 37 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 probably 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 | convenience, and they are used if the flag -DUSE_LOCAL_TK_H is specified. 20 | 21 | Jonas Beskow, December 2001 -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ng/Togl2.1/ben.rgb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/ng/Togl2.1/ben.rgb -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 14 | 15 | 16 | #include "togl.h" 17 | 18 | #if defined(TOGL_OSMESA) || defined(TOGL_WGL) 19 | /* nothing extra to include */ 20 | #elif defined(__APPLE__) 21 | # include 22 | #else 23 | # if !defined(TOGL_X11) || !defined(GLX_VERSION_1_4) 24 | # include 25 | # endif 26 | #endif 27 | 28 | Togl_FuncPtr 29 | Togl_GetProcAddr(const char *funcname) 30 | { 31 | #if defined(TOGL_OSMESA) 32 | return (Togl_FuncPtr) OSMesaGetProcAddress(funcname); 33 | #elif defined(TOGL_WGL) 34 | return (Togl_FuncPtr) wglGetProcAddress(funcname); 35 | #elif defined(__APPLE__) 36 | char buf[256]; 37 | 38 | snprintf(buf, sizeof buf - 1, "_%s", funcname); 39 | buf[sizeof buf - 1] = '\0'; 40 | if (NSIsSymbolNameDefined(buf)) { 41 | NSSymbol nssym; 42 | 43 | nssym = NSLookupAndBindSymbol(buf); 44 | if (nssym) 45 | return (Togl_FuncPtr) NSAddressOfSymbol(nssym); 46 | } 47 | return NULL; 48 | #else 49 | # if defined(TOGL_X11) && defined(GLX_VERSION_1_4) 50 | /* Strictly speaking, we can only call glXGetProcAddress if glXQueryVersion 51 | * says we're using version 1.4 or later. */ 52 | return (Togl_FuncPtr) glXGetProcAddress(funcname); 53 | # else 54 | /* Linux, IRIX, OSF/1, ? */ 55 | static void *dlHandle = NULL; 56 | 57 | if (dlHandle == NULL) 58 | dlHandle = dlopen(NULL, RTLD_LAZY); 59 | /* Strictly speaking, the following cast of a data pointer to a function 60 | * pointer is not legal in ISO C, but we don't have any choice. */ 61 | return (Togl_FuncPtr) dlsym(dlHandle, funcname); 62 | # endif 63 | #endif 64 | } 65 | -------------------------------------------------------------------------------- /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/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/tree2.rgba: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/ng/Togl2.1/tree2.rgba -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ng/gui.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using std::string; 7 | using std::endl; 8 | using std::cout; 9 | using std::cerr; 10 | 11 | namespace netgen 12 | { 13 | NGCORE_API_EXPORT Flags parameters; 14 | } 15 | 16 | NGCORE_API_EXPORT bool nodisplay = false; 17 | 18 | extern "C" int Ng_Init (Tcl_Interp * interp); 19 | extern "C" int Ng_Vis_Init (Tcl_Interp * interp); 20 | extern "C" void Ng_TclCmd(string); 21 | 22 | // tcl package dynamic load 23 | extern "C" int NGCORE_API_EXPORT Gui_Init (Tcl_Interp * interp) 24 | { 25 | Tcl_InitStubs( interp, TCL_VERSION, 0 ); 26 | Tk_InitStubs( interp, TK_VERSION, 0 ); 27 | if (Ng_Init(interp) == TCL_ERROR) { 28 | cerr << "Problem in Ng_Init: " << endl; 29 | cout << "result = " << Tcl_GetStringResult (interp) << endl; 30 | return TCL_ERROR; 31 | } 32 | 33 | if (!nodisplay && Ng_Vis_Init(interp) == TCL_ERROR) { 34 | cerr << "Problem in Ng_Vis_Init: " << endl; 35 | cout << "result = " << Tcl_GetStringResult (interp) << endl; 36 | return TCL_ERROR; 37 | } 38 | 39 | return TCL_OK; 40 | } 41 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ng/netgenpy.cpp: -------------------------------------------------------------------------------- 1 | // a wrapper to load netgen-dll into python 2 | 3 | #include 4 | #include <../general/ngpython.hpp> 5 | #include 6 | 7 | void NGCORE_API_IMPORT ExportNetgenMeshing(py::module &m); 8 | void NGCORE_API_IMPORT ExportCSG(py::module &m); 9 | void NGCORE_API_IMPORT ExportGeom2d(py::module &m); 10 | void NGCORE_API_IMPORT ExportSTL(py::module &m); 11 | #ifdef OCCGEOMETRY 12 | void NGCORE_API_IMPORT ExportNgOCC(py::module &m); 13 | #endif // OCCGEOMETRY 14 | 15 | PYBIND11_MODULE(libngpy, ngpy) 16 | { 17 | py::module::import("pyngcore"); 18 | py::module meshing = ngpy.def_submodule("_meshing", "pybind meshing module"); 19 | ExportNetgenMeshing(meshing); 20 | py::module csg = ngpy.def_submodule("_csg", "pybind csg module"); 21 | ExportCSG(csg); 22 | py::module geom2d = ngpy.def_submodule("_geom2d", "pybind geom2d module"); 23 | ExportGeom2d(geom2d); 24 | py::module stl = ngpy.def_submodule("_stl", "pybind stl module"); 25 | ExportSTL(stl); 26 | #ifdef OCCGEOMETRY 27 | py::module NgOCC = ngpy.def_submodule("_NgOCC", "pybind NgOCC module"); 28 | ExportNgOCC(NgOCC); 29 | #endif // OCCGEOMETRY 30 | } 31 | -------------------------------------------------------------------------------- /ng/ngguipy.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include <../general/ngpython.hpp> 3 | #include 4 | 5 | void NGCORE_API_IMPORT ExportMeshVis(py::module &m); 6 | void NGCORE_API_IMPORT ExportCSGVis(py::module &m); 7 | void NGCORE_API_IMPORT ExportSTLVis(py::module &m); 8 | namespace netgen 9 | { 10 | std::vector NGCORE_API_IMPORT Snapshot( int w, int h ); 11 | } 12 | 13 | PYBIND11_MODULE(libngguipy, ngpy) 14 | { 15 | py::module::import("pyngcore"); 16 | py::module meshvis = ngpy.def_submodule("meshvis", "pybind meshvis module"); 17 | ExportMeshVis(meshvis); 18 | py::module csgvis = ngpy.def_submodule("csgvis", "pybind csgvis module"); 19 | ExportCSGVis(csgvis); 20 | py::module stlvis = ngpy.def_submodule("stlvis", "pybind stlvis module"); 21 | ExportSTLVis(stlvis); 22 | ngpy.def("Snapshot", netgen::Snapshot); 23 | } 24 | -------------------------------------------------------------------------------- /ng/ngtcl.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "../libsrc/meshing/visual_interface.hpp" 4 | 5 | 6 | static void Impl_Ng_Tcl_SetResult(Tcl_Interp *interp, char *result, Tcl_FreeProc *freeProc) 7 | { 8 | Tcl_SetResult(interp, result, freeProc); 9 | } 10 | 11 | static void Impl_Ng_Tcl_CreateCommand(Tcl_Interp *interp, const char *cmdName, Tcl_CmdProc *proc) 12 | { 13 | Tcl_CreateCommand(interp, cmdName, proc, nullptr, nullptr); 14 | } 15 | 16 | static bool dummy_init_pointers = [](){ 17 | netgen::Ptr_Ng_Tcl_SetResult = Impl_Ng_Tcl_SetResult; 18 | netgen::Ptr_Ng_Tcl_CreateCommand = Impl_Ng_Tcl_CreateCommand; 19 | return true; 20 | }(); 21 | -------------------------------------------------------------------------------- /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 occurrences 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('#include \n'); 23 | onetclcpp.write('DLL_HEADER const char * ngscript[] = {""'+'\n'); 24 | 25 | # make sure to remove comments (and if lines with comments end with '\' also the next line(s) ) 26 | skip_next = False # flag to indicate that the next line should be removed 27 | for line in tclfiles["ng.tcl"].split('\n'): 28 | line = line.strip() 29 | if len(line)==0: 30 | skip_next = False 31 | continue 32 | if skip_next: 33 | # skip as long as lines end with '\' 34 | skip_next = line[-1]=='\\' 35 | continue 36 | if(line.find('#')>-1): 37 | # comment found (not necessarily the whole line) 38 | skip_next = line[-1]=='\\' 39 | line = line[:line.find('#')] 40 | if len(line)>0: 41 | s = ',"' + line.replace('\\', r'\\').replace('"', r'\"') + '\\n"\n' 42 | onetclcpp.write(s) 43 | 44 | onetclcpp.write(', nullptr\n'); 45 | onetclcpp.write('};\n'); 46 | onetclcpp.close(); 47 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /nglib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(nglib PRIVATE nglib.cpp) 2 | 3 | if(USE_OCC) 4 | target_sources(nglib PRIVATE nglib_occ.cpp) 5 | install(FILES nglib_occ.h DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel) 6 | endif(USE_OCC) 7 | 8 | target_link_libraries(nglib PUBLIC ngcore PRIVATE ${ZLIB_LIBRARIES}) 9 | 10 | if(EMSCRIPTEN) 11 | target_include_directories(nglib PRIVATE $) 12 | target_link_libraries(nglib PRIVATE $>) 13 | else(EMSCRIPTEN) 14 | target_link_libraries( nglib PRIVATE ${CMAKE_THREAD_LIBS_INIT} ${JPEG_LIBRARIES} ${MKL_LIBRARIES} occ_libs netgen_cgns ) 15 | endif(EMSCRIPTEN) 16 | 17 | install(TARGETS nglib netgen_cgns ${NG_INSTALL_DIR}) 18 | install(FILES nglib.h DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel) 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | install( FILES 2 | shaft.geo mesh.py exportNeutral.py 3 | DESTINATION ${NG_INSTALL_DIR_RES}/${NG_INSTALL_SUFFIX}/py_tutorials 4 | COMPONENT netgen_tutorial 5 | ) 6 | -------------------------------------------------------------------------------- /py_tutorials/csg2d.py: -------------------------------------------------------------------------------- 1 | from random import random, seed 2 | from ngsolve import Draw, Mesh 3 | 4 | import netgen 5 | from pyngcore import * 6 | from netgen.geom2d import * 7 | 8 | seed(4) 9 | 10 | g = CSG2d() 11 | outer = Rectangle((0, 0), (1, 1), "outer","outer") 12 | inner = Solid2d() 13 | 14 | for i in range(30): 15 | cx = random() 16 | cy = random() 17 | r = 0.03+0.05*random() 18 | print("Add Circle", i, cx, cy, r, flush = True) 19 | circle = Circle((cx, cy), r, "circle"+str(i), "circle"+str(i)) 20 | inner += circle 21 | outer -= circle 22 | 23 | 24 | g.Add(inner) 25 | g.Add(outer) 26 | geo = g.GenerateSplineGeometry() 27 | 28 | m = geo.GenerateMesh(maxh=0.1) 29 | 30 | try: 31 | from ngsolve import Draw, Mesh 32 | Draw(geo) 33 | mesh = Mesh(m) 34 | mesh.Curve(3) 35 | Draw(mesh) 36 | except: 37 | pass 38 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 p in el.points: 21 | print (p.nr, end=" ", file=f) 22 | print(file=f) 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /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 | m1.SecondOrder() 12 | 13 | import exportNeutral 14 | exportNeutral.Export (m1, "shaft.mesh") 15 | 16 | 17 | 18 | Save (m1, "mesh.vol", geo) 19 | 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /python/.gitignore: -------------------------------------------------------------------------------- 1 | version.py 2 | -------------------------------------------------------------------------------- /python/NgOCC.py: -------------------------------------------------------------------------------- 1 | 2 | import logging 3 | logger = logging.getLogger(__name__) 4 | 5 | logger.warning("This module is deprecated and just a wrapper for netgen.occ, import netgen.occ instead") 6 | 7 | from .occ import * 8 | -------------------------------------------------------------------------------- /python/__main__.py: -------------------------------------------------------------------------------- 1 | import importlib.util, threading, sys, os 2 | 3 | def _py_handler(f): 4 | spec = importlib.util.spec_from_file_location(os.path.basename(f), os.path.abspath(f)) 5 | module = importlib.util.module_from_spec(spec) 6 | spec.loader.exec_module(module) 7 | return module 8 | 9 | def _geo_handler(f): 10 | from netgen.csg import CSGeometry 11 | print("load", f) 12 | geo = CSGeometry(f) 13 | geo.Draw() 14 | 15 | def _step_handler(f): 16 | from netgen.occ import OCCGeometry 17 | print("load", f) 18 | geo = OCCGeometry(f) 19 | geo.Draw() 20 | 21 | def _stl_handler(f): 22 | from netgen.stl import STLGeometry 23 | print("load", f) 24 | geo = STLGeometry(f) 25 | geo.Draw() 26 | 27 | _file_handler = {} 28 | _file_handler['.py'] = _py_handler 29 | _file_handler['.geo'] = _geo_handler 30 | _file_handler['.step'] = _step_handler 31 | _file_handler['.stl'] = _stl_handler 32 | 33 | def handle_arguments(): 34 | import __main__ 35 | import os.path 36 | argv = sys.argv 37 | if len(argv)>1: 38 | _, ext = os.path.splitext(argv[1]) 39 | if ext in _file_handler: 40 | _file_handler[ext](argv[1]) 41 | 42 | def main(): 43 | import netgen 44 | # Use Redraw without event handling 45 | netgen.Redraw = netgen._Redraw 46 | 47 | from .gui import win 48 | th = threading.Thread(target=handle_arguments) 49 | th.start() 50 | win.tk.mainloop() 51 | 52 | if __name__ == "__main__": 53 | sys.exit(main()) 54 | -------------------------------------------------------------------------------- /python/config/__init__.py: -------------------------------------------------------------------------------- 1 | from .config import * 2 | -------------------------------------------------------------------------------- /python/config/__main__.py: -------------------------------------------------------------------------------- 1 | from .config import get_cmake_dir 2 | 3 | if __name__ == '__main__': 4 | print(get_cmake_dir()) 5 | -------------------------------------------------------------------------------- /python/csg.py: -------------------------------------------------------------------------------- 1 | from .libngpy._csg import * 2 | from .libngpy._meshing import Pnt, Vec, Trafo 3 | from .meshing import meshsize 4 | 5 | try: 6 | from . import csgvis 7 | from .csgvis import MouseMove 8 | CSGeometry.VS = csgvis.VS 9 | SetBackGroundColor = csgvis.SetBackGroundColor 10 | del csgvis 11 | 12 | def VS (obj): 13 | return obj.VS() 14 | except: 15 | pass 16 | 17 | unit_cube = CSGeometry() 18 | p1 = Plane(Pnt(0,0,0),Vec(-1,0,0)).bc("back") 19 | p2 = Plane(Pnt(1,1,1),Vec(1,0,0)).bc("front") 20 | p3 = Plane(Pnt(0,0,0),Vec(0,-1,0)).bc("left") 21 | p4 = Plane(Pnt(1,1,1),Vec(0,1,0)).bc("right") 22 | p5 = Plane(Pnt(0,0,0),Vec(0,0,-1)).bc("bottom") 23 | p6 = Plane(Pnt(1,1,1),Vec(0,0,1)).bc("top") 24 | unit_cube.Add (p1*p2*p3*p4*p5*p6, col=(0,0,1)) 25 | 26 | -------------------------------------------------------------------------------- /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) -------------------------------------------------------------------------------- /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) -------------------------------------------------------------------------------- /python/occ.py: -------------------------------------------------------------------------------- 1 | """ Netgen OCC documentation 2 | 3 | This module provides the Netgen OCCGeometry class, as well as Python wrappers 4 | for OpenCascade functionality. This allows the construction from scratch, as well as 5 | editing geometries imported via STEP format. 6 | 7 | Most of the classes are directly py-wrapped from the OCCT classes. 8 | For more detailed documentation consult the OCCT docs, a good starting point is 9 | https://dev.opencascade.org/doc/refman/html/class_b_rep_builder_a_p_i___make_shape.html 10 | """ 11 | 12 | from .config import USE_OCC 13 | if not USE_OCC: 14 | raise ImportError("Netgen was not built with Opencascade support") 15 | 16 | from .libngpy._NgOCC import * 17 | from .meshing import meshsize, IdentificationType 18 | 19 | 20 | gp_Ax3 = Axes 21 | gp_Ax1 = Axis 22 | 23 | Translation = gp_Trsf.Translation 24 | Rotation = gp_Trsf.Rotation 25 | Mirror = gp_Trsf.Mirror 26 | 27 | 28 | def Rectangle(l,w): return WorkPlane().Rectangle(l,w) 29 | def MoveTo(x,y): return WorkPlane().MoveTo(x,y) 30 | def LineTo(x,y): return WorkPlane().LineTo(x,y) 31 | def Line(l): return WorkPlane().Line(l) 32 | 33 | 34 | unit_square_shape = WorkPlane().Line(1, name="bottom").Rotate(90) \ 35 | .Line(1, name="right").Rotate(90) \ 36 | .Line(1, name="top").Rotate(90) \ 37 | .Line(1, name="left").Rotate(90).Face() 38 | 39 | unit_square = OCCGeometry(unit_square_shape, dim=2) 40 | 41 | 42 | 43 | uc_shape = Box((0,0,0),(1,1,1)) 44 | uc_shape.faces.Max(X).name = "front" 45 | uc_shape.faces.Min(X).name = "back" 46 | uc_shape.faces.Max(Y).name = "right" 47 | uc_shape.faces.Min(Y).name = "left" 48 | uc_shape.faces.Max(Z).name = "top" 49 | uc_shape.faces.Min(Z).name = "bottom" 50 | 51 | unit_cube = OCCGeometry(uc_shape) 52 | 53 | -------------------------------------------------------------------------------- /python/pyngcore/__init__.py: -------------------------------------------------------------------------------- 1 | from .pyngcore import * 2 | -------------------------------------------------------------------------------- /python/read_meshio.py: -------------------------------------------------------------------------------- 1 | from netgen.meshing import * 2 | 3 | def ReadViaMeshIO(filename): 4 | import meshio 5 | import numpy as np 6 | 7 | # print ("reading via meshio:", filename) 8 | 9 | m = meshio.read(filename) 10 | pts = m.points 11 | 12 | mesh = Mesh(dim=pts.shape[1]) 13 | # mesh.AddPoints ( np.asarray(pts, dtype=np.float64) ) # needed for correct little/big endian 14 | mesh.AddPoints ( pts ) 15 | 16 | fd = mesh.Add (FaceDescriptor(bc=1)) 17 | for cb in m.cells: 18 | # mesh.AddElements(dim=cb.dim, index=1, data=np.asarray(cb.data, dtype=np.int32), base=0) 19 | mesh.AddElements(dim=cb.dim, index=1, data=cb.data, base=0) 20 | 21 | return mesh 22 | 23 | -------------------------------------------------------------------------------- /python/shaft.vol.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/python/shaft.vol.gz -------------------------------------------------------------------------------- /python/stl.py: -------------------------------------------------------------------------------- 1 | from netgen.libngpy._stl import * 2 | from .meshing import meshsize 3 | -------------------------------------------------------------------------------- /python/version_template.py: -------------------------------------------------------------------------------- 1 | __version__ = "@NETGEN_VERSION_PYTHON@" 2 | __package_name__ = "@NETGEN_PYTHON_PACKAGE_NAME@" 3 | -------------------------------------------------------------------------------- /rules/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # this file is included from the parent directory (otherwise generated source files are not recognized properly by cmake) 2 | 3 | # generate .cpp files containing the string of the .rls meshing rule files 4 | if(EMSCRIPTEN) 5 | add_custom_command(OUTPUT makerls 6 | COMMAND g++ ${CMAKE_CURRENT_SOURCE_DIR}/rules/makerlsfile.cpp -o ${CMAKE_CURRENT_BINARY_DIR}/makerls 7 | ) 8 | set(rules_command ${CMAKE_BINARY_DIR}/makerls) 9 | else(EMSCRIPTEN) 10 | add_executable(makerls rules/makerlsfile.cpp) 11 | if(USE_CCACHE) 12 | set_target_properties(makerls PROPERTIES RULE_LAUNCH_COMPILE "") 13 | endif(USE_CCACHE) 14 | set(rules_command makerls) 15 | endif() 16 | 17 | set(rules 18 | hexrules 19 | prismrules2 20 | pyramidrules 21 | pyramidrules2 22 | quadrules 23 | tetrules 24 | triarules 25 | ) 26 | 27 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/rules/) 28 | 29 | foreach(rule ${rules}) 30 | list(APPEND rules_sources ${CMAKE_CURRENT_BINARY_DIR}/rules/rule_${rule}.cpp) 31 | set(rule_file ${CMAKE_CURRENT_SOURCE_DIR}/rules/${rule}.rls) 32 | set(rule_cpp ${CMAKE_CURRENT_BINARY_DIR}/rules/rule_${rule}.cpp) 33 | 34 | add_custom_command(OUTPUT ${rule_cpp} 35 | COMMAND ${rules_command} ${rule_file} ${rule_cpp} ${rule} 36 | DEPENDS makerls ${rule_file} 37 | ) 38 | endforeach() 39 | 40 | target_sources(nglib PRIVATE ${rules_sources}) 41 | -------------------------------------------------------------------------------- /rules/makerlsfile.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | #define maxlen 1000 9 | 10 | int main (int argc, char ** argv) 11 | { 12 | if (argc != 4) 13 | { 14 | cout << "use: makerlsfile infile outfile rulename" << endl; 15 | exit(1); 16 | } 17 | 18 | 19 | char line[maxlen]; // , infile[maxlen], outfile[maxlen]; 20 | char ch; 21 | int i; 22 | 23 | /* 24 | cout << "infile: "; 25 | cin >> infile; 26 | cout << "outfile: "; 27 | cin >> outfile; 28 | */ 29 | 30 | ifstream inf (argv[1]); 31 | ofstream outf (argv[2]); 32 | string rulename = argv[3]; 33 | 34 | outf << "namespace netgen" << endl << '{' << endl; 35 | outf << "const char * " << rulename << "[] = {" << endl; 36 | while (inf.good()) 37 | { 38 | i = 0; 39 | 40 | inf.get(ch); 41 | while (ch != '\n' && inf.good() && i < maxlen) 42 | { 43 | if (ch == '\"') 44 | { 45 | line[i] = '\\'; 46 | line[i+1] = '\"'; 47 | i+= 2; 48 | } 49 | else if (ch == '\\') 50 | { 51 | line[i] = '\\'; 52 | line[i+1] = '\\'; 53 | i+= 2; 54 | } 55 | else 56 | { 57 | line[i] = ch; 58 | i++; 59 | } 60 | inf.get(ch); 61 | } 62 | line[i] = 0; 63 | // cout << line << endl; 64 | outf << "\"" << line << "\\n\",\\" << endl; 65 | } 66 | outf << "0};" << endl; 67 | outf << '}' << endl; 68 | return 0; 69 | } 70 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(catch) 2 | add_subdirectory(pytest) 3 | 4 | # this code goes here, because tests is the last add_subdirectory (otherwise it gets executed too early) 5 | if(APPLE AND BUILD_FOR_CONDA) 6 | install(CODE "execute_process(COMMAND sh -c \"codesign --force -s - netgen/*.so netgen/*.dylib pyngcore/*.so\" WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX})") 7 | endif(APPLE AND BUILD_FOR_CONDA) 8 | -------------------------------------------------------------------------------- /tests/build_debug.sh: -------------------------------------------------------------------------------- 1 | cd 2 | mkdir -p build/netgen 3 | cd build/netgen 4 | cmake \ 5 | -DCMAKE_CXX_FLAGS="-Og -Wall -Wno-sign-compare -DDebug" \ 6 | -DUSE_CCACHE=ON \ 7 | -DCMAKE_BUILD_TYPE=DEBUG \ 8 | -DENABLE_UNIT_TESTS=ON \ 9 | -DUSE_OCC=ON \ 10 | -DCHECK_RANGE=ON \ 11 | -DUSE_CGNS=ON \ 12 | -DCMAKE_INSTALL_PREFIX=/usr \ 13 | ../../src/netgen 14 | make -j12 15 | make install 16 | -------------------------------------------------------------------------------- /tests/build_guidelines.sh: -------------------------------------------------------------------------------- 1 | cd 2 | mkdir -p build/netgen 3 | cd build/netgen 4 | cmake ../../src/netgen -DUSE_CCACHE=ON -DENABLE_CPP_CORE_GUIDELINES_CHECK=ON -DCMAKE_CXX_COMPILER=clang++ \ 5 | -DCMAKE_C_COMPILER=clang 6 | make -j12 7 | make install 8 | 9 | -------------------------------------------------------------------------------- /tests/build_mpi.sh: -------------------------------------------------------------------------------- 1 | cd 2 | mkdir -p build/netgen 3 | cd build/netgen 4 | cmake ../../src/netgen \ 5 | -DCHECK_RANGE=ON \ 6 | -DUSE_CCACHE=ON \ 7 | -DUSE_MPI=ON \ 8 | -DUSE_OCC=OFF \ 9 | -DENABLE_UNIT_TESTS=ON 10 | make -j12 11 | make install 12 | -------------------------------------------------------------------------------- /tests/build_ngsolve.sh: -------------------------------------------------------------------------------- 1 | cd ~/src 2 | git clone https://github.com/NGSolve/ngsolve.git 3 | mkdir -p ~/build/ngsolve 4 | cd ~/build/ngsolve 5 | cmake \ 6 | -DCHECK_RANGE=ON \ 7 | -DUSE_MKL=ON \ 8 | -DUSE_CCACHE=ON \ 9 | -DNETGEN_DIR=/opt/netgen \ 10 | -DCMAKE_BUILD_TYPE=DEBUG \ 11 | ~/src/ngsolve 12 | make -j12 13 | make install 14 | -------------------------------------------------------------------------------- /tests/build_nospdlog.sh: -------------------------------------------------------------------------------- 1 | cd 2 | mkdir -p build/netgen 3 | cd build/netgen 4 | cmake ../../src/netgen -DUSE_CCACHE=ON -DUSE_SPDLOG=OFF -DCMAKE_CXX_COMPILER=clang++ \ 5 | -DCMAKE_C_COMPILER=clang 6 | make -j12 7 | make install 8 | 9 | -------------------------------------------------------------------------------- /tests/build_pip.ps1: -------------------------------------------------------------------------------- 1 | if (test-path _skbuild) { 2 | cmd.exe /c rd /s /q _skbuild 3 | } 4 | if (test-path dist) { 5 | cmd.exe /c rd /s /q dist 6 | } 7 | 8 | $env:NETGEN_CCACHE = 1 9 | $env:NETGEN_ARCH = 'avx2' 10 | 11 | $pydir=$args[0] 12 | & $pydir\python.exe --version 13 | & $pydir\python.exe -m pip install packaging requests 14 | & $pydir\python.exe tests\utils.py --check-pip 15 | if ($LASTEXITCODE -ne 0) { 16 | exit 0 17 | } 18 | & $pydir\python.exe -m pip install scikit-build wheel numpy twine pybind11-stubgen 19 | & $pydir\python.exe -m pip install --upgrade netgen-occt==7.8.1 netgen-occt-devel==7.8.1 20 | & $pydir\python setup.py bdist_wheel -G"Visual Studio 17 2022" 21 | & $pydir\python -m twine upload dist\*.whl 22 | -------------------------------------------------------------------------------- /tests/build_pip.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | ulimit -n 1024000 # lower open file limit, seems to affect performance 3 | yum -y update 4 | yum -y install ninja-build fontconfig-devel tk-devel tcl-devel libXmu-devel mesa-libGLU-devel openmpi-devel mpich-devel 5 | 6 | mkdir -p /opt/openmpi/include /opt/mpich/include 7 | cp -a /usr/include/openmpi-x86_64/* /opt/openmpi/include/ 8 | cp -a /usr/include/mpich-x86_64/* /opt/mpich/include/ 9 | 10 | curl https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/c/ccache-3.7.7-1.el8.x86_64.rpm -o ccache.rpm 11 | dnf -y install ccache.rpm 12 | 13 | rm -rf wheelhouse 14 | export NETGEN_CCACHE=1 15 | 16 | for pyversion in 313 312 311 310 39 17 | do 18 | export PYDIR="/opt/python/cp${pyversion}-cp${pyversion}/bin" 19 | echo $PYDIR 20 | $PYDIR/pip install requests packaging 21 | $PYDIR/python3 ./tests/utils.py --check-pip || continue 22 | $PYDIR/pip install -U pytest-check numpy wheel scikit-build pybind11-stubgen netgen-occt==7.8.1 netgen-occt-devel==7.8.1 23 | $PYDIR/pip install -i https://pypi.anaconda.org/mpi4py/simple/ --pre mpi4py 24 | 25 | rm -rf _skbuild 26 | NETGEN_ARCH=avx2 $PYDIR/pip wheel . 27 | mkdir -p wheelhouse 28 | rename linux_x86_64 manylinux_2_17_x86_64.manylinux2014_x86_64 netgen_mesher*-cp${pyversion}-*.whl 29 | mv netgen_mesher*-cp${pyversion}-*.whl wheelhouse/ 30 | 31 | $PYDIR/pip install wheelhouse/netgen_mesher*-cp${pyversion}-*.whl 32 | $PYDIR/python3 -c 'import netgen' 33 | $PYDIR/pip install -U twine 34 | $PYDIR/twine upload --skip-existing wheelhouse/netgen_mesher*-cp${pyversion}*manylinux*.whl 35 | #cd ../tests/pytest 36 | #$PYDIR/python3 -m pytest 37 | done 38 | 39 | -------------------------------------------------------------------------------- /tests/build_pip_mac.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | 3 | rm -rf _skbuild dist 4 | 5 | export PYDIR=/Library/Frameworks/Python.framework/Versions/$1/bin 6 | export PATH=$PYDIR:/Applications/CMake.app/Contents/bin:$PATH 7 | export NETGEN_CCACHE=1 8 | 9 | $PYDIR/python3 --version 10 | $PYDIR/python3 -m pip install packaging requests 11 | $PYDIR/python3 tests/utils.py --check-pip || exit 0 12 | $PYDIR/python3 -m pip install --user numpy twine scikit-build wheel pybind11-stubgen 13 | $PYDIR/python3 -m pip install --user -U netgen-occt==7.8.1 netgen-occt-devel==7.8.1 14 | 15 | export CMAKE_OSX_ARCHITECTURES='arm64;x86_64' 16 | export NETGEN_ARCH='avx2' 17 | $PYDIR/python3 setup.py bdist_wheel --plat-name macosx-10.15-universal2 -j10 18 | $PYDIR/python3 -m twine upload dist/*.whl 19 | -------------------------------------------------------------------------------- /tests/catch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | if(ENABLE_UNIT_TESTS) 3 | add_custom_target(unit_tests) 4 | 5 | # Build catch_main test object 6 | include_directories(${CATCH_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../../libsrc/include ${SPDLOG_INCLUDE_DIR}) 7 | add_library(catch_main STATIC main.cpp) 8 | set_target_properties(catch_main PROPERTIES CXX_STANDARD 17) 9 | add_dependencies(unit_tests catch_main) 10 | add_dependencies(catch_main project_catch) 11 | 12 | # ensure the test targets are built before testing 13 | add_test(NAME unit_tests_built COMMAND ${CMAKE_COMMAND} --build . --target unit_tests --config ${CMAKE_BUILD_TYPE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../.. ) 14 | 15 | macro(add_unit_test name sources) 16 | add_executable(test_${name} ${sources} ) 17 | target_link_libraries(test_${name} ngcore catch_main nglib) 18 | 19 | add_dependencies(unit_tests test_${name}) 20 | add_test(NAME unit_${name} COMMAND test_${name}) 21 | set_tests_properties(unit_${name} PROPERTIES DEPENDS unit_tests_built) 22 | 23 | if(ENABLE_CPP_CORE_GUIDELINES_CHECK) 24 | set_target_properties(test_${name} PROPERTIES CXX_CLANG_TIDY "${DO_CLANG_TIDY}") 25 | endif(ENABLE_CPP_CORE_GUIDELINES_CHECK) 26 | endmacro() 27 | 28 | add_unit_test(archive archive.cpp) 29 | # RegisterForArchive needs Python.h if built with Python 30 | target_link_libraries(test_archive netgen_python) 31 | add_unit_test(array array.cpp) 32 | add_unit_test(ranges ranges.cpp) 33 | add_unit_test(symboltable symboltable.cpp) 34 | add_unit_test(utils utils.cpp) 35 | add_unit_test(version version.cpp) 36 | 37 | endif(ENABLE_UNIT_TESTS) 38 | -------------------------------------------------------------------------------- /tests/catch/main.cpp: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_MAIN 2 | #define DO_NOT_USE_WMAIN 3 | #include 4 | -------------------------------------------------------------------------------- /tests/catch/ranges.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | using namespace ngcore; 8 | 9 | TEST_CASE("ranges") 10 | { 11 | Array a { 3, -1, 10, -5 }; 12 | Array positive { 3, 10 }; 13 | int i = 0; 14 | for(auto pos_val : a | filter([](auto val) { return val >= 0; })) 15 | { 16 | CHECK(pos_val == positive[i++]); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/catch/symboltable.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include <../core/ngcore.hpp> 4 | using namespace ngcore; 5 | using namespace std; 6 | 7 | TEST_CASE("Symboltable") 8 | { 9 | SymbolTable table; 10 | CHECK_THROWS_AS(table["test"], RangeException); 11 | table.Set("first", 1); 12 | CHECK(table["first"] == 1); 13 | table["first"] = 2; 14 | CHECK(table["first"] == 2); 15 | auto index = table.Index("first"); 16 | CHECK(index == 0); 17 | CHECK(table[index] == 2); 18 | table[index] = 3; 19 | CHECK(table["first"] == 3); 20 | #ifndef NDEBUG 21 | int a; 22 | CHECK_THROWS_AS(a = table[5], RangeException); 23 | CHECK_THROWS_AS(table.GetName(5), RangeException); 24 | #endif 25 | CHECK(table.Used("first")); 26 | CHECK(!table.Used("second")); 27 | SymbolTable another; 28 | another.Set("first", 1); 29 | another.Set("second", 2); 30 | table.Update(another); 31 | CHECK(table["first"] == 1); 32 | CHECK(table["second"] == 2); 33 | std::stringstream s; 34 | s << table; 35 | CHECK(s.str() == "first : 1\nsecond : 2\n"); 36 | auto ss = std::make_shared(); 37 | BinaryOutArchive ao(ss); 38 | ao & table; 39 | ao.FlushBuffer(); 40 | BinaryInArchive ai(ss); 41 | SymbolTable read; 42 | ai & read; 43 | for(size_t i = 0; i is special because of vector is special... 51 | SymbolTable btable; 52 | btable.Set("true", true); 53 | btable.Set("false", false); 54 | CHECK(btable[0]); 55 | CHECK(!btable[1]); 56 | CHECK(btable["true"]); 57 | CHECK(!btable["false"]); 58 | ao & btable; 59 | ao.FlushBuffer(); 60 | SymbolTable bread; 61 | ai & bread; 62 | CHECK(bread["true"]); 63 | CHECK(!bread["false"]); 64 | } 65 | -------------------------------------------------------------------------------- /tests/catch/utils.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | using namespace ngcore; 5 | using namespace std; 6 | 7 | 8 | uint64_t shuffle(uint64_t N, uint64_t i) { 9 | // Shuffle the numbers using multiplication with a prime number to force many updates of min, max 10 | constexpr uint64_t P = 101; 11 | return (N/2 + i*P) % N; 12 | } 13 | 14 | void testThreading(int n_threads) 15 | { 16 | TaskManager::SetNumThreads(n_threads); 17 | n_threads = EnterTaskManager(); 18 | 19 | constexpr uint64_t N = 100000; 20 | 21 | 22 | SECTION( "atomic operations" ) { 23 | uint64_t i_min = 2*N; 24 | uint64_t i_max = 0; 25 | uint64_t i_sum = 0; 26 | 27 | double d_min = 1e100; 28 | double d_max = 0.0; 29 | double d_sum = 0.0; 30 | 31 | ParallelFor( Range(N), [&] (uint64_t i) { 32 | AtomicMin(i_min, shuffle(N,i)); 33 | }); 34 | REQUIRE( i_min==0 ); 35 | 36 | ParallelFor( Range(N), [&] (uint64_t i) { 37 | AtomicMax(i_max, shuffle(N,i)); 38 | }); 39 | REQUIRE( i_max==N-1 ); 40 | 41 | ParallelFor( Range(N), [&] (uint64_t i) { 42 | AsAtomic(i_sum) += i; 43 | }); 44 | REQUIRE( i_sum==N*(N-1)/2 ); 45 | 46 | ParallelFor( Range(N), [&] (double i) { 47 | AtomicMin(d_min, static_cast(shuffle(N,i))); 48 | }); 49 | REQUIRE( d_min==0 ); 50 | 51 | ParallelFor( Range(N), [&] (double i) { 52 | AtomicMax(d_max, static_cast(shuffle(N,i))); 53 | }); 54 | REQUIRE( d_max==N-1 ); 55 | 56 | ParallelFor( Range(N), [&] (double i) { 57 | AtomicAdd(d_sum, i); 58 | }); 59 | REQUIRE( d_sum==N*(N-1)/2 ); 60 | 61 | } 62 | ExitTaskManager(n_threads); 63 | } 64 | 65 | TEST_CASE("Threading - 1 Thread") { testThreading(1); } 66 | TEST_CASE("Threading - 2 Thread") { testThreading(2); } 67 | TEST_CASE("Threading - 8 Thread") { testThreading(8); } 68 | -------------------------------------------------------------------------------- /tests/catch/version.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include <../core/ngcore.hpp> 4 | using namespace ngcore; 5 | using namespace std; 6 | 7 | 8 | TEST_CASE("Version") 9 | { 10 | VersionInfo v("v6.2.1811-3-asdf"); 11 | CHECK(v.to_string() == "v6.2.1811-3-asdf"); 12 | VersionInfo v2("6.2"); 13 | CHECK(v2.to_string() == "v6.2"); 14 | CHECK(v < "v7"); 15 | CHECK(v >= "6.2"); 16 | CHECK(v > "6.2.1811"); 17 | CHECK(v < "6.2.1811-5"); 18 | CHECK(v == "v6.2.1811-3"); 19 | } 20 | -------------------------------------------------------------------------------- /tests/dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | MAINTAINER Matthias Hochsteger 4 | RUN apt-get update && apt-get -y install \ 5 | ccache \ 6 | clang occt-misc \ 7 | clang-tidy \ 8 | cmake \ 9 | g++ \ 10 | git \ 11 | libcgns-dev \ 12 | libglu1-mesa-dev \ 13 | libhdf5-dev \ 14 | libocct-ocaf-dev \ 15 | libocct-visualization-dev \ 16 | libocct-data-exchange-dev \ 17 | libocct-draw-dev \ 18 | libpython3-dev \ 19 | libtbb-dev \ 20 | libxi-dev \ 21 | libxmu-dev \ 22 | occt-misc \ 23 | python3 \ 24 | python3-distutils \ 25 | python3-numpy \ 26 | python3-pip \ 27 | python3-pytest \ 28 | python3-tk \ 29 | tcl-dev \ 30 | tk-dev 31 | 32 | RUN python3 -m pip install pytest-check pybind11-stubgen 33 | ADD . /root/src/netgen 34 | -------------------------------------------------------------------------------- /tests/dockerfile_mpi: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | ENV DEBIAN_FRONTEND=noninteractive 3 | MAINTAINER Matthias Hochsteger 4 | RUN apt-get update && apt-get -y install \ 5 | ccache \ 6 | clang \ 7 | clang-tidy \ 8 | cmake \ 9 | g++ \ 10 | gfortran \ 11 | git \ 12 | libglu1-mesa-dev \ 13 | libopenmpi-dev \ 14 | libpython3-dev \ 15 | libxmu-dev \ 16 | openmpi-bin \ 17 | python3 \ 18 | python3-distutils \ 19 | python3-mpi4py \ 20 | python3-numpy \ 21 | python3-pip \ 22 | python3-tk \ 23 | tcl-dev \ 24 | tk-dev 25 | 26 | RUN python3 -m pip install pytest-mpi pytest-check pytest pybind11-stubgen 27 | ADD . /root/src/netgen 28 | -------------------------------------------------------------------------------- /tests/pytest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(USE_PYTHON) 2 | add_test(NAME pytest COMMAND ${Python3_EXECUTABLE} -m pytest WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 3 | add_custom_target(pytest ${Python3_EXECUTABLE} -m pytest WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 4 | set_tests_properties ( pytest PROPERTIES TIMEOUT 1800 ) 5 | if(USE_MPI AND USE_MPI4PY) 6 | add_test(NAME pytest-mpi COMMAND ${MPIEXEC_EXECUTABLE} --allow-run-as-root -np 4 ${Python3_EXECUTABLE} -m pytest --with-mpi test_mpi4py.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 7 | endif(USE_MPI AND USE_MPI4PY) 8 | endif(USE_PYTHON) 9 | -------------------------------------------------------------------------------- /tests/pytest/conftest.py: -------------------------------------------------------------------------------- 1 | """ 2 | Pytest configuration file to run slow test only if pytest is started with option --runslow or if 3 | environment variable RUN_SLOW_TESTS is set. 4 | """ 5 | 6 | import pytest, os 7 | 8 | def pytest_addoption(parser): 9 | parser.addoption("--runslow", action="store_true", default=False, help="run slow tests") 10 | 11 | def pytest_configure(config): 12 | config.addinivalue_line("markers", "slow: mark test as slow to run") 13 | 14 | 15 | def pytest_collection_modifyitems(config, items): 16 | import platform 17 | 18 | run_slow_tests = config.getoption("--runslow") 19 | 20 | # gitlab-ci: run slow tests only on Linux 21 | if platform.system()=='Linux' and 'RUN_SLOW_TESTS' in os.environ and os.environ['RUN_SLOW_TESTS']: 22 | run_slow_tests = True 23 | 24 | if not run_slow_tests: 25 | skip_slow = pytest.mark.skip(reason="need --runslow option to run") 26 | for item in items: 27 | if "slow" in item.keywords: 28 | item.add_marker(skip_slow) 29 | -------------------------------------------------------------------------------- /tests/pytest/meshes.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | @pytest.fixture 4 | def unit_mesh_2d(): 5 | import netgen.geom2d as g2d 6 | return g2d.unit_square.GenerateMesh(maxh=0.2) 7 | 8 | @pytest.fixture 9 | def unit_mesh_3d(): 10 | import netgen.csg as csg 11 | return csg.unit_cube.GenerateMesh(maxh=0.2) 12 | -------------------------------------------------------------------------------- /tests/pytest/test_array.py: -------------------------------------------------------------------------------- 1 | import netgen 2 | from pyngcore import * 3 | from numpy import sort, array 4 | 5 | def test_array_numpy(): 6 | a = Array_I_S(5) 7 | a[:] = 0 8 | a[3:] = 2 9 | assert(sum(a) == 4) 10 | a[1] = 5 11 | b = sort(a) 12 | assert(all(b == array([0,0,2,2,5]))) 13 | assert(all(a == array([0,5,0,2,2]))) 14 | a.NumPy().sort() 15 | assert(all(a == array([0,0,2,2,5]))) 16 | 17 | def test_mesh_elements_numpy_array_access(): 18 | from netgen.csg import unit_cube 19 | mesh = unit_cube.GenerateMesh() 20 | np_els = mesh.Elements3D().NumPy() 21 | vol_nodes = np_els["nodes"] 22 | indices = np_els["index"] 23 | nps = np_els["np"] 24 | for nodes, el, index, np in zip(vol_nodes, mesh.Elements3D(), indices, nps): 25 | for n1, n2 in zip(nodes, el.vertices): 26 | assert n1 == n2 27 | for n in nodes[len(el.vertices):]: 28 | assert n == 0 29 | assert el.index == index 30 | assert len(el.vertices) == np 31 | 32 | if __name__ == "__main__": 33 | test_array_numpy() 34 | test_mesh_elements_numpy_array_access() 35 | -------------------------------------------------------------------------------- /tests/pytest/test_bitarray.py: -------------------------------------------------------------------------------- 1 | import netgen 2 | from pyngcore import BitArray 3 | 4 | def test_bitarray(): 5 | a = BitArray(498) 6 | assert len(a) == 498 7 | 8 | a.Set() 9 | for b in a: 10 | assert b == True 11 | 12 | a.Clear(23) 13 | assert a[22] == True 14 | assert a[23] == False 15 | assert a[24] == True 16 | 17 | a.Clear() 18 | for b in a: 19 | assert b == False 20 | 21 | a.Set(23) 22 | assert a[22] == False 23 | assert a[23] == True 24 | assert a[24] == False 25 | 26 | a.Clear() 27 | a[100:200:9] = True 28 | for i in range(len(a)): 29 | assert a[i] == bool(100<=i and i<200 and i%9==100%9) 30 | 31 | ac = ~a 32 | 33 | for b,bc in zip(a,ac): 34 | assert b == (not bc) 35 | 36 | 37 | -------------------------------------------------------------------------------- /tests/pytest/test_csg.py: -------------------------------------------------------------------------------- 1 | from netgen.csg import * 2 | 3 | def create_2_polyhedra(): 4 | geo = CSGeometry() 5 | first = Polyhedron([(0,0,0), (0,1,0), (3,1,0), (3,0,0), 6 | (0,1,1), (3,1,1), (3,0,1), (0,0,1)], 7 | [(0,1,2,3), (1,4,5,2), (2,5,6,3), (3,6,7,0), 8 | (0,7,4,1), (7,6,5,4)]) 9 | # TODO: height = 0.1 not working! 10 | height = 0.3 11 | second = Polyhedron([(0,0,1), (0,1,1), (3,1,1), (3,0,1), 12 | (0,1,1+height), (3,1,1+height), 13 | (3,0,1+height), (0,0,1+height)], 14 | [(0,1,2,3), (1,4,5,2), (2,5,6,3), (3,6,7,0), 15 | (0,7,4,1), (7,6,5,4)]) 16 | 17 | geo.Add(first) 18 | geo.Add(second) 19 | mesh = geo.GenerateMesh() 20 | return mesh 21 | 22 | def test_2_polyhedra(): 23 | create_2_polyhedra() 24 | 25 | 26 | if __name__ == "__main__": 27 | from ngsolve import Mesh, Draw 28 | mesh = Mesh(create_2_polyhedra()) 29 | Draw(mesh) 30 | -------------------------------------------------------------------------------- /tests/pytest/test_geom2d.py: -------------------------------------------------------------------------------- 1 | from netgen.geom2d import SplineGeometry 2 | 3 | 4 | def test_leftdom_equals_rightdom(): 5 | geo = SplineGeometry() 6 | pnts = [(0,0), (1,0), (2,0), (2,1), (1,1), (0,1)] 7 | gp = [geo.AppendPoint(*p) for p in pnts] 8 | lines = [(0,1,0), (1,2,0), (2,3,0), (3,4,0), (4,5,0), (5,0,0), (1,4,1)] 9 | for p1, p2, rd in lines: 10 | geo.Append(["line", p1, p2], leftdomain=1, rightdomain=rd) 11 | 12 | mesh = geo.GenerateMesh() 13 | 14 | -------------------------------------------------------------------------------- /tests/pytest/test_mpi4py.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | import netgen.meshing 3 | 4 | mpi4py = pytest.importorskip("mpi4py") 5 | _ = pytest.importorskip("pytest_mpi") 6 | 7 | @pytest.mark.mpi 8 | def test_mpi4py(): 9 | comm = mpi4py.MPI.COMM_WORLD 10 | 11 | if comm.rank==0: 12 | from netgen.csg import unit_cube 13 | m = unit_cube.GenerateMesh(maxh=0.1) 14 | m.Save("mpimesh") 15 | 16 | comm.Barrier() 17 | 18 | mesh = netgen.meshing.Mesh(3, comm) 19 | mesh.Load("mpimesh.vol.gz") 20 | 21 | if comm.rank==0: 22 | assert mesh.ne==0 23 | -------------------------------------------------------------------------------- /tests/pytest/test_occ.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | import math 3 | from pytest import approx 4 | from pytest_check import check 5 | 6 | def check_volume(shape, volume, dim=3): 7 | from netgen.occ import OCCGeometry 8 | geo = OCCGeometry(shape, dim=dim) 9 | 10 | m = geo.GenerateMesh() 11 | assert len(m.Elements2D()) > 0 12 | assert len(m.Elements1D()) > 0 13 | if dim==3: 14 | assert len(m.Elements3D()) > 0 15 | 16 | ngs = pytest.importorskip("ngsolve") 17 | mesh = ngs.Mesh(m) 18 | mesh.Curve(5) 19 | with check: assert ngs.Integrate(1.0, mesh) == approx(volume) 20 | 21 | def test_rect_with_two_holes(): 22 | occ = pytest.importorskip("netgen.occ") 23 | 24 | face = occ.WorkPlane().Rectangle(7,4) \ 25 | .Circle(2,2,1).Reverse() \ 26 | .Circle(5,2,1).Reverse().Face() 27 | check_volume(face, 7*4-2*math.pi, 2) 28 | 29 | def test_unit_square(): 30 | occ = pytest.importorskip("netgen.occ") 31 | check_volume(occ.unit_square.shape, 1, dim=2) 32 | 33 | def test_box_and_cyl(): 34 | occ = pytest.importorskip("netgen.occ") 35 | box = occ.Box(occ.Pnt(0,0,0), occ.Pnt(1,1,1)) 36 | check_volume(box, 1) 37 | r = 0.3 38 | h = 0.5 39 | vcyl = r*r*math.pi*h 40 | cyl = occ.Cylinder(occ.Pnt(1,0.5,0.5), occ.X, r=r, h=h) 41 | check_volume(cyl, vcyl) 42 | fused = box+cyl 43 | check_volume(fused, 1+vcyl) 44 | 45 | def test_internal_face(): 46 | occ = pytest.importorskip("netgen.occ") 47 | box = occ.Box((0,0,0), (3, 1, 10)) 48 | 49 | face = occ.WorkPlane(occ.Axes((1.5,0,0), occ.X, occ.Y)).Rectangle(1, 6).Face() 50 | 51 | shape = occ.Glue([box, face]) 52 | geo = occ.OCCGeometry(shape) 53 | mesh = geo.GenerateMesh(maxh=0.5) 54 | assert any(mesh.Elements2D().NumPy()['index'] == 8) 55 | 56 | -------------------------------------------------------------------------------- /tests/pytest/test_savemesh.py: -------------------------------------------------------------------------------- 1 | 2 | from netgen.csg import * 3 | from netgen import meshing 4 | import filecmp 5 | import difflib 6 | from math import sqrt, cos, sin 7 | 8 | def CreateQuad(): 9 | base = Plane(Pnt(0,0,0),Vec(0,0,1)) 10 | surface = SplineSurface(base) 11 | pts = [(-0.2,-0.2,0),(-0.2,0.2,0),(0.2,0.2,0),(0.2,-0.2,0)] 12 | geopts = [surface.AddPoint(*p) for p in pts] 13 | for p1,p2,bc in [(0,1,"wire"), (1, 2,"contact"),(2,3,"wire"),(3,0,"wire")]: 14 | surface.AddSegment(geopts[p1],geopts[p2],bc) 15 | return surface 16 | 17 | Cross = lambda a,b: [a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-b[0]*a[1]] 18 | 19 | 20 | def CreateGeo(): 21 | geo = CSGeometry() 22 | air = OrthoBrick(Pnt(-1,-1,-1),Pnt(1,1,1)) 23 | geo.Add(air.mat("air")) 24 | surface = CreateQuad() 25 | geo.AddSplineSurface(surface) 26 | return geo 27 | 28 | def test_BBNDsave(): 29 | mesh = CreateGeo().GenerateMesh(maxh=0.4,perfstepsend = meshing.MeshingStep.MESHSURFACE) 30 | for i in range(2): 31 | mesh.GenerateVolumeMesh(only3D_domain_nr=i+1,maxh=0.4) 32 | mesh.SetGeometry(None) 33 | mesh.Save("test.vol") 34 | mesh2 = meshing.Mesh() 35 | mesh2.Load("test.vol") 36 | mesh2.Save("test2.vol") 37 | with open("test.vol","r") as f: 38 | first = f.readlines() 39 | with open("test2.vol","r") as f: 40 | second = f.readlines() 41 | # exclude the face colours section (because they aren't in the same order) 42 | for i,line in enumerate(first): 43 | if line[0:12] == "face_colours": 44 | first = first[0:i] 45 | second = second[0:i] 46 | break 47 | diff = difflib.context_diff(first,second) 48 | print("File diff:") 49 | l = list(diff) 50 | print(*l) 51 | assert len(l)==0 52 | 53 | -------------------------------------------------------------------------------- /tests/pytest/test_splinegeo_tensordomainmeshing.py: -------------------------------------------------------------------------------- 1 | from netgen.geom2d import * 2 | 3 | def test_tensordomainmeshing(): 4 | geo = SplineGeometry() 5 | w = 10 6 | h = 0.01 7 | 8 | p = [ (0, 0), (w, 0), (w, h), (0, h) ] 9 | p = [geo.AppendPoint(*px) for px in p] 10 | 11 | l0 = geo.Append ( ["line", p[0], p[1]], leftdomain=1, rightdomain=0 ) 12 | l1 = geo.Append ( ["line", p[1], p[2]], leftdomain=1, rightdomain=0) 13 | geo.Append ( ["line", p[3], p[2]], leftdomain=0, rightdomain=1, copy=l0 ) 14 | geo.Append ( ["line", p[0], p[3]], leftdomain=0, rightdomain=1, copy=l1 ) 15 | 16 | geo._SetDomainTensorMeshing(1, True) 17 | 18 | mesh = geo.GenerateMesh(maxh=1) 19 | 20 | for el in mesh.Elements2D(): 21 | print(el.vertices) 22 | assert len(el.vertices) == 4 23 | -------------------------------------------------------------------------------- /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 ${NG_INSTALL_DIR_RES}/${NG_INSTALL_SUFFIX} 11 | COMPONENT netgen_tutorial 12 | ) 13 | -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 spheres 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/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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /tutorials/ellipticcone.geo: -------------------------------------------------------------------------------- 1 | # 2 | ## An elliptic cone 3 | # 4 | 5 | # An elliptic cone, given by the point c = (c x , c y , c z ) at the base of the cone along the main axis, 6 | # the vectors v and w of the long and short axis of the ellipse, respectively, 7 | # the height of the cone, h, and ratio of base long axis length to top long axis length, r: 8 | # ellipticcone (c x , c y , c z ; v x , v y , v z ; w x , w y , w z; h; r) 9 | 10 | # Note: The elliptic cone has to be truncated by planes similar to a cone or an elliptic cylinder. 11 | # When r =1, the truncated elliptic cone becomes an elliptic cylinder. 12 | # When r tends to zero, the truncated elliptic cone tends to a full elliptic cone. 13 | # However, when r = 0, the top part becomes a point(tip) and meshing fails! 14 | 15 | algebraic3d 16 | 17 | solid cutcone = ellipticcone ( 0, 0, 0; 5, 0, 0; 0, 2, 0; 5; 0.5) 18 | and plane (0, 0, 0; 0, 0, -1) 19 | and plane (0, 0, 5; 0, 0, 1); 20 | 21 | tlo cutcone; 22 | -------------------------------------------------------------------------------- /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/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; -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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/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/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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | netgen.rc 2 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file( 2 | "${CMAKE_CURRENT_SOURCE_DIR}/netgen.rc.template" 3 | "${CMAKE_CURRENT_SOURCE_DIR}/netgen.rc" 4 | IMMEDIATE @ONLY) 5 | -------------------------------------------------------------------------------- /windows/netgen.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NGSolve/netgen/16cc8cd73f130063b8fce3fbe3ac6d20fc1ccf46/windows/netgen.ico -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------