netgen-mesher 6.2.2506.post35.dev0__cp314-cp314-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- netgen/NgOCC.py +7 -0
- netgen/__init__.py +114 -0
- netgen/__init__.pyi +22 -0
- netgen/__main__.py +53 -0
- netgen/cmake/NetgenConfig.cmake +79 -0
- netgen/cmake/netgen-targets-release.cmake +69 -0
- netgen/cmake/netgen-targets.cmake +146 -0
- netgen/config/__init__.py +1 -0
- netgen/config/__init__.pyi +52 -0
- netgen/config/__main__.py +4 -0
- netgen/config/config.py +68 -0
- netgen/config/config.pyi +54 -0
- netgen/csg.py +25 -0
- netgen/geom2d.py +178 -0
- netgen/gui.py +82 -0
- netgen/include/core/archive.hpp +1256 -0
- netgen/include/core/array.hpp +1760 -0
- netgen/include/core/autodiff.hpp +1131 -0
- netgen/include/core/autodiffdiff.hpp +733 -0
- netgen/include/core/bitarray.hpp +240 -0
- netgen/include/core/concurrentqueue.h +3619 -0
- netgen/include/core/exception.hpp +145 -0
- netgen/include/core/flags.hpp +199 -0
- netgen/include/core/hashtable.hpp +1281 -0
- netgen/include/core/localheap.hpp +318 -0
- netgen/include/core/logging.hpp +117 -0
- netgen/include/core/memtracer.hpp +221 -0
- netgen/include/core/mpi4py_pycapi.h +245 -0
- netgen/include/core/mpi_wrapper.hpp +643 -0
- netgen/include/core/ng_mpi.hpp +94 -0
- netgen/include/core/ng_mpi_generated_declarations.hpp +155 -0
- netgen/include/core/ng_mpi_native.hpp +25 -0
- netgen/include/core/ngcore.hpp +32 -0
- netgen/include/core/ngcore_api.hpp +152 -0
- netgen/include/core/ngstream.hpp +115 -0
- netgen/include/core/paje_trace.hpp +279 -0
- netgen/include/core/profiler.hpp +382 -0
- netgen/include/core/python_ngcore.hpp +457 -0
- netgen/include/core/ranges.hpp +109 -0
- netgen/include/core/register_archive.hpp +100 -0
- netgen/include/core/signal.hpp +82 -0
- netgen/include/core/simd.hpp +160 -0
- netgen/include/core/simd_arm64.hpp +407 -0
- netgen/include/core/simd_avx.hpp +394 -0
- netgen/include/core/simd_avx512.hpp +285 -0
- netgen/include/core/simd_generic.hpp +1053 -0
- netgen/include/core/simd_math.hpp +178 -0
- netgen/include/core/simd_sse.hpp +289 -0
- netgen/include/core/statushandler.hpp +37 -0
- netgen/include/core/symboltable.hpp +153 -0
- netgen/include/core/table.hpp +810 -0
- netgen/include/core/taskmanager.hpp +1161 -0
- netgen/include/core/type_traits.hpp +65 -0
- netgen/include/core/utils.hpp +385 -0
- netgen/include/core/version.hpp +102 -0
- netgen/include/core/xbool.hpp +47 -0
- netgen/include/csg/algprim.hpp +563 -0
- netgen/include/csg/brick.hpp +150 -0
- netgen/include/csg/csg.hpp +43 -0
- netgen/include/csg/csgeom.hpp +389 -0
- netgen/include/csg/csgparser.hpp +101 -0
- netgen/include/csg/curve2d.hpp +67 -0
- netgen/include/csg/edgeflw.hpp +112 -0
- netgen/include/csg/explicitcurve2d.hpp +113 -0
- netgen/include/csg/extrusion.hpp +185 -0
- netgen/include/csg/gencyl.hpp +70 -0
- netgen/include/csg/geoml.hpp +16 -0
- netgen/include/csg/identify.hpp +213 -0
- netgen/include/csg/manifold.hpp +29 -0
- netgen/include/csg/meshsurf.hpp +46 -0
- netgen/include/csg/polyhedra.hpp +121 -0
- netgen/include/csg/revolution.hpp +180 -0
- netgen/include/csg/singularref.hpp +84 -0
- netgen/include/csg/solid.hpp +295 -0
- netgen/include/csg/specpoin.hpp +194 -0
- netgen/include/csg/spline3d.hpp +99 -0
- netgen/include/csg/splinesurface.hpp +85 -0
- netgen/include/csg/surface.hpp +394 -0
- netgen/include/csg/triapprox.hpp +63 -0
- netgen/include/csg/vscsg.hpp +34 -0
- netgen/include/general/autodiff.hpp +356 -0
- netgen/include/general/autoptr.hpp +39 -0
- netgen/include/general/gzstream.h +121 -0
- netgen/include/general/hashtabl.hpp +1692 -0
- netgen/include/general/myadt.hpp +48 -0
- netgen/include/general/mystring.hpp +226 -0
- netgen/include/general/netgenout.hpp +205 -0
- netgen/include/general/ngarray.hpp +797 -0
- netgen/include/general/ngbitarray.hpp +149 -0
- netgen/include/general/ngpython.hpp +74 -0
- netgen/include/general/optmem.hpp +44 -0
- netgen/include/general/parthreads.hpp +138 -0
- netgen/include/general/seti.hpp +50 -0
- netgen/include/general/sort.hpp +47 -0
- netgen/include/general/spbita2d.hpp +59 -0
- netgen/include/general/stack.hpp +114 -0
- netgen/include/general/table.hpp +280 -0
- netgen/include/general/template.hpp +509 -0
- netgen/include/geom2d/csg2d.hpp +750 -0
- netgen/include/geom2d/geometry2d.hpp +280 -0
- netgen/include/geom2d/spline2d.hpp +234 -0
- netgen/include/geom2d/vsgeom2d.hpp +28 -0
- netgen/include/gprim/adtree.hpp +1392 -0
- netgen/include/gprim/geom2d.hpp +858 -0
- netgen/include/gprim/geom3d.hpp +749 -0
- netgen/include/gprim/geomfuncs.hpp +212 -0
- netgen/include/gprim/geomobjects.hpp +544 -0
- netgen/include/gprim/geomops.hpp +404 -0
- netgen/include/gprim/geomtest3d.hpp +101 -0
- netgen/include/gprim/gprim.hpp +33 -0
- netgen/include/gprim/spline.hpp +778 -0
- netgen/include/gprim/splinegeometry.hpp +73 -0
- netgen/include/gprim/transform3d.hpp +216 -0
- netgen/include/include/acisgeom.hpp +3 -0
- netgen/include/include/csg.hpp +1 -0
- netgen/include/include/geometry2d.hpp +1 -0
- netgen/include/include/gprim.hpp +1 -0
- netgen/include/include/incopengl.hpp +62 -0
- netgen/include/include/inctcl.hpp +13 -0
- netgen/include/include/incvis.hpp +6 -0
- netgen/include/include/linalg.hpp +1 -0
- netgen/include/include/meshing.hpp +1 -0
- netgen/include/include/myadt.hpp +1 -0
- netgen/include/include/mydefs.hpp +70 -0
- netgen/include/include/mystdlib.h +59 -0
- netgen/include/include/netgen_config.hpp +27 -0
- netgen/include/include/netgen_version.hpp +9 -0
- netgen/include/include/nginterface_v2_impl.hpp +395 -0
- netgen/include/include/ngsimd.hpp +1 -0
- netgen/include/include/occgeom.hpp +1 -0
- netgen/include/include/opti.hpp +1 -0
- netgen/include/include/parallel.hpp +1 -0
- netgen/include/include/stlgeom.hpp +1 -0
- netgen/include/include/visual.hpp +1 -0
- netgen/include/interface/rw_medit.hpp +11 -0
- netgen/include/interface/writeuser.hpp +80 -0
- netgen/include/linalg/densemat.hpp +414 -0
- netgen/include/linalg/linalg.hpp +29 -0
- netgen/include/linalg/opti.hpp +142 -0
- netgen/include/linalg/polynomial.hpp +47 -0
- netgen/include/linalg/vector.hpp +217 -0
- netgen/include/meshing/adfront2.hpp +274 -0
- netgen/include/meshing/adfront3.hpp +332 -0
- netgen/include/meshing/basegeom.hpp +370 -0
- netgen/include/meshing/bcfunctions.hpp +53 -0
- netgen/include/meshing/bisect.hpp +72 -0
- netgen/include/meshing/boundarylayer.hpp +113 -0
- netgen/include/meshing/classifyhpel.hpp +1984 -0
- netgen/include/meshing/clusters.hpp +46 -0
- netgen/include/meshing/curvedelems.hpp +274 -0
- netgen/include/meshing/delaunay2d.hpp +73 -0
- netgen/include/meshing/fieldlines.hpp +103 -0
- netgen/include/meshing/findip.hpp +198 -0
- netgen/include/meshing/findip2.hpp +103 -0
- netgen/include/meshing/geomsearch.hpp +69 -0
- netgen/include/meshing/global.hpp +54 -0
- netgen/include/meshing/hpref_hex.hpp +330 -0
- netgen/include/meshing/hpref_prism.hpp +3405 -0
- netgen/include/meshing/hpref_pyramid.hpp +154 -0
- netgen/include/meshing/hpref_quad.hpp +2082 -0
- netgen/include/meshing/hpref_segm.hpp +122 -0
- netgen/include/meshing/hpref_tet.hpp +4230 -0
- netgen/include/meshing/hpref_trig.hpp +848 -0
- netgen/include/meshing/hprefinement.hpp +366 -0
- netgen/include/meshing/improve2.hpp +178 -0
- netgen/include/meshing/improve3.hpp +151 -0
- netgen/include/meshing/localh.hpp +223 -0
- netgen/include/meshing/meshclass.hpp +1076 -0
- netgen/include/meshing/meshfunc.hpp +47 -0
- netgen/include/meshing/meshing.hpp +63 -0
- netgen/include/meshing/meshing2.hpp +163 -0
- netgen/include/meshing/meshing3.hpp +123 -0
- netgen/include/meshing/meshtool.hpp +90 -0
- netgen/include/meshing/meshtype.hpp +1930 -0
- netgen/include/meshing/msghandler.hpp +62 -0
- netgen/include/meshing/paralleltop.hpp +172 -0
- netgen/include/meshing/python_mesh.hpp +206 -0
- netgen/include/meshing/ruler2.hpp +172 -0
- netgen/include/meshing/ruler3.hpp +211 -0
- netgen/include/meshing/soldata.hpp +141 -0
- netgen/include/meshing/specials.hpp +17 -0
- netgen/include/meshing/surfacegeom.hpp +73 -0
- netgen/include/meshing/topology.hpp +1003 -0
- netgen/include/meshing/validate.hpp +21 -0
- netgen/include/meshing/visual_interface.hpp +71 -0
- netgen/include/mydefs.hpp +70 -0
- netgen/include/nginterface.h +474 -0
- netgen/include/nginterface_v2.hpp +406 -0
- netgen/include/nglib.h +697 -0
- netgen/include/nglib_occ.h +50 -0
- netgen/include/occ/occ_edge.hpp +47 -0
- netgen/include/occ/occ_face.hpp +52 -0
- netgen/include/occ/occ_solid.hpp +23 -0
- netgen/include/occ/occ_utils.hpp +376 -0
- netgen/include/occ/occ_vertex.hpp +30 -0
- netgen/include/occ/occgeom.hpp +659 -0
- netgen/include/occ/occmeshsurf.hpp +168 -0
- netgen/include/occ/vsocc.hpp +33 -0
- netgen/include/pybind11/LICENSE +29 -0
- netgen/include/pybind11/attr.h +722 -0
- netgen/include/pybind11/buffer_info.h +208 -0
- netgen/include/pybind11/cast.h +2361 -0
- netgen/include/pybind11/chrono.h +228 -0
- netgen/include/pybind11/common.h +2 -0
- netgen/include/pybind11/complex.h +74 -0
- netgen/include/pybind11/conduit/README.txt +15 -0
- netgen/include/pybind11/conduit/pybind11_conduit_v1.h +116 -0
- netgen/include/pybind11/conduit/pybind11_platform_abi_id.h +87 -0
- netgen/include/pybind11/conduit/wrap_include_python_h.h +72 -0
- netgen/include/pybind11/critical_section.h +56 -0
- netgen/include/pybind11/detail/class.h +823 -0
- netgen/include/pybind11/detail/common.h +1348 -0
- netgen/include/pybind11/detail/cpp_conduit.h +75 -0
- netgen/include/pybind11/detail/descr.h +226 -0
- netgen/include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h +39 -0
- netgen/include/pybind11/detail/exception_translation.h +71 -0
- netgen/include/pybind11/detail/function_record_pyobject.h +191 -0
- netgen/include/pybind11/detail/init.h +538 -0
- netgen/include/pybind11/detail/internals.h +799 -0
- netgen/include/pybind11/detail/native_enum_data.h +209 -0
- netgen/include/pybind11/detail/pybind11_namespace_macros.h +82 -0
- netgen/include/pybind11/detail/struct_smart_holder.h +378 -0
- netgen/include/pybind11/detail/type_caster_base.h +1591 -0
- netgen/include/pybind11/detail/typeid.h +65 -0
- netgen/include/pybind11/detail/using_smart_holder.h +22 -0
- netgen/include/pybind11/detail/value_and_holder.h +90 -0
- netgen/include/pybind11/eigen/common.h +9 -0
- netgen/include/pybind11/eigen/matrix.h +723 -0
- netgen/include/pybind11/eigen/tensor.h +521 -0
- netgen/include/pybind11/eigen.h +12 -0
- netgen/include/pybind11/embed.h +320 -0
- netgen/include/pybind11/eval.h +161 -0
- netgen/include/pybind11/functional.h +147 -0
- netgen/include/pybind11/gil.h +199 -0
- netgen/include/pybind11/gil_safe_call_once.h +102 -0
- netgen/include/pybind11/gil_simple.h +37 -0
- netgen/include/pybind11/iostream.h +265 -0
- netgen/include/pybind11/native_enum.h +67 -0
- netgen/include/pybind11/numpy.h +2312 -0
- netgen/include/pybind11/operators.h +202 -0
- netgen/include/pybind11/options.h +92 -0
- netgen/include/pybind11/pybind11.h +3645 -0
- netgen/include/pybind11/pytypes.h +2680 -0
- netgen/include/pybind11/stl/filesystem.h +114 -0
- netgen/include/pybind11/stl.h +666 -0
- netgen/include/pybind11/stl_bind.h +858 -0
- netgen/include/pybind11/subinterpreter.h +299 -0
- netgen/include/pybind11/trampoline_self_life_support.h +65 -0
- netgen/include/pybind11/type_caster_pyobject_ptr.h +61 -0
- netgen/include/pybind11/typing.h +298 -0
- netgen/include/pybind11/warnings.h +75 -0
- netgen/include/stlgeom/meshstlsurface.hpp +67 -0
- netgen/include/stlgeom/stlgeom.hpp +491 -0
- netgen/include/stlgeom/stlline.hpp +193 -0
- netgen/include/stlgeom/stltool.hpp +331 -0
- netgen/include/stlgeom/stltopology.hpp +419 -0
- netgen/include/stlgeom/vsstl.hpp +58 -0
- netgen/include/visualization/meshdoc.hpp +42 -0
- netgen/include/visualization/mvdraw.hpp +325 -0
- netgen/include/visualization/vispar.hpp +128 -0
- netgen/include/visualization/visual.hpp +28 -0
- netgen/include/visualization/visual_api.hpp +10 -0
- netgen/include/visualization/vssolution.hpp +399 -0
- netgen/lib/libnggui.lib +0 -0
- netgen/lib/ngcore.lib +0 -0
- netgen/lib/nglib.lib +0 -0
- netgen/lib/togl.lib +0 -0
- netgen/libnggui.dll +0 -0
- netgen/libngguipy.lib +0 -0
- netgen/libngguipy.pyd +0 -0
- netgen/libngpy/_NgOCC.pyi +1545 -0
- netgen/libngpy/__init__.pyi +7 -0
- netgen/libngpy/_csg.pyi +259 -0
- netgen/libngpy/_geom2d.pyi +323 -0
- netgen/libngpy/_meshing.pyi +1111 -0
- netgen/libngpy/_stl.pyi +131 -0
- netgen/libngpy.lib +0 -0
- netgen/libngpy.pyd +0 -0
- netgen/meshing.py +65 -0
- netgen/ngcore.dll +0 -0
- netgen/nglib.dll +0 -0
- netgen/occ.py +52 -0
- netgen/read_gmsh.py +259 -0
- netgen/read_meshio.py +22 -0
- netgen/stl.py +2 -0
- netgen/togl.dll +0 -0
- netgen/version.py +2 -0
- netgen/webgui.py +529 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/boundarycondition.geo +16 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/boxcyl.geo +32 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/circle_on_cube.geo +27 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cone.geo +13 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cube.geo +16 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cubeandring.geo +55 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cubeandspheres.geo +21 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cubemcyl.geo +18 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cubemsphere.geo +19 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cylinder.geo +12 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cylsphere.geo +12 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/doc/ng4.pdf +0 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/ellipsoid.geo +8 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/ellipticcyl.geo +10 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/extrusion.geo +99 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/fichera.geo +24 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/frame.step +11683 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/hinge.stl +8486 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/lshape3d.geo +26 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/manyholes.geo +26 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/manyholes2.geo +26 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/matrix.geo +27 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/ortho.geo +11 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/part1.stl +2662 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/period.geo +33 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/py_tutorials/exportNeutral.py +26 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/py_tutorials/mesh.py +19 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/py_tutorials/shaft.geo +65 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/revolution.geo +18 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/screw.step +1694 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/sculpture.geo +13 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/shaft.geo +65 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/shell.geo +10 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/sphere.geo +8 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/sphereincube.geo +17 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/square.in2d +35 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/squarecircle.in2d +48 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/squarehole.in2d +47 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/torus.geo +8 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/trafo.geo +57 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/twobricks.geo +15 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/twocubes.geo +18 -0
- netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/twocyl.geo +16 -0
- netgen_mesher-6.2.2506.post35.dev0.dist-info/METADATA +15 -0
- netgen_mesher-6.2.2506.post35.dev0.dist-info/RECORD +340 -0
- netgen_mesher-6.2.2506.post35.dev0.dist-info/WHEEL +5 -0
- netgen_mesher-6.2.2506.post35.dev0.dist-info/entry_points.txt +2 -0
- netgen_mesher-6.2.2506.post35.dev0.dist-info/licenses/AUTHORS +1 -0
- netgen_mesher-6.2.2506.post35.dev0.dist-info/licenses/LICENSE +504 -0
- netgen_mesher-6.2.2506.post35.dev0.dist-info/top_level.txt +2 -0
- pyngcore/__init__.py +1 -0
- pyngcore/pyngcore.cp314-win_amd64.pyd +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#ifndef NETGEN_CORE_TYPE_TRAITS_HPP
|
|
2
|
+
#define NETGEN_CORE_TYPE_TRAITS_HPP
|
|
3
|
+
|
|
4
|
+
#include <memory>
|
|
5
|
+
#include <type_traits>
|
|
6
|
+
|
|
7
|
+
namespace ngcore
|
|
8
|
+
{
|
|
9
|
+
namespace detail
|
|
10
|
+
{
|
|
11
|
+
template<bool... b> struct _BoolArray{};
|
|
12
|
+
|
|
13
|
+
template<bool ... vals>
|
|
14
|
+
constexpr bool all_of_tmpl = std::is_same<_BoolArray<vals...>, _BoolArray<(vals || true)...>>::value; // NOLINT
|
|
15
|
+
|
|
16
|
+
template<typename T>
|
|
17
|
+
struct is_any_pointer_impl : std::false_type {};
|
|
18
|
+
|
|
19
|
+
// check if second template argument is tuple of base classes to first
|
|
20
|
+
// template argument, return constexpr bool
|
|
21
|
+
template<typename T, typename Tuple>
|
|
22
|
+
constexpr bool is_base_of_tuple = false;
|
|
23
|
+
|
|
24
|
+
template<typename T, typename... Ts>
|
|
25
|
+
constexpr bool is_base_of_tuple<T, std::tuple<Ts...>> =
|
|
26
|
+
all_of_tmpl<std::is_base_of<Ts, T>::value...>;
|
|
27
|
+
|
|
28
|
+
template<typename T>
|
|
29
|
+
struct is_any_pointer_impl<T*> : std::true_type {};
|
|
30
|
+
|
|
31
|
+
template<typename T>
|
|
32
|
+
struct is_any_pointer_impl<std::shared_ptr<T>> : std::true_type {};
|
|
33
|
+
|
|
34
|
+
template<typename T>
|
|
35
|
+
struct is_any_pointer_impl<std::unique_ptr<T>> : std::true_type {};
|
|
36
|
+
|
|
37
|
+
template<typename T>
|
|
38
|
+
constexpr bool is_any_pointer = is_any_pointer_impl<T>::value;
|
|
39
|
+
} // namespace detail
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
// Type trait to check if a class implements a 'range_type Range()' function
|
|
43
|
+
namespace detail
|
|
44
|
+
{
|
|
45
|
+
template<typename T>
|
|
46
|
+
struct has_Range
|
|
47
|
+
{
|
|
48
|
+
private:
|
|
49
|
+
template<typename T2>
|
|
50
|
+
static constexpr auto check(T2*) ->
|
|
51
|
+
std::enable_if_t<!std::is_same_v<decltype(std::declval<T2>().Range()), void>, std::true_type>
|
|
52
|
+
{ std::true_type(); }
|
|
53
|
+
template<typename>
|
|
54
|
+
static constexpr std::false_type check(...);
|
|
55
|
+
using type = decltype(check<T>(nullptr)); // NOLINT
|
|
56
|
+
public:
|
|
57
|
+
NGCORE_API static constexpr bool value = type::value;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
template<typename T>
|
|
61
|
+
constexpr bool has_range = detail::has_Range<T>::value;
|
|
62
|
+
|
|
63
|
+
} // namespace ngcore
|
|
64
|
+
|
|
65
|
+
#endif // NETGEN_CORE_TYPE_TRAITS_HPP
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
#ifndef NETGEN_CORE_UTILS_HPP
|
|
2
|
+
#define NETGEN_CORE_UTILS_HPP
|
|
3
|
+
|
|
4
|
+
#include <atomic>
|
|
5
|
+
#include <chrono>
|
|
6
|
+
#include <filesystem>
|
|
7
|
+
#include <map>
|
|
8
|
+
#include <ostream>
|
|
9
|
+
#include <optional>
|
|
10
|
+
#include <sstream>
|
|
11
|
+
#include <string>
|
|
12
|
+
|
|
13
|
+
#include "ngcore_api.hpp" // for NGCORE_API and CPU arch macros
|
|
14
|
+
|
|
15
|
+
#if defined(__APPLE__) && defined(NETGEN_ARCH_ARM64)
|
|
16
|
+
#include <mach/mach_time.h>
|
|
17
|
+
#endif
|
|
18
|
+
|
|
19
|
+
#ifdef NETGEN_ARCH_AMD64
|
|
20
|
+
#ifdef WIN32
|
|
21
|
+
#include <intrin.h> // for __rdtsc() CPU time step counter
|
|
22
|
+
#else
|
|
23
|
+
#include <x86intrin.h> // for __rdtsc() CPU time step counter
|
|
24
|
+
#endif // WIN32
|
|
25
|
+
#endif // NETGEN_ARCH_AMD64
|
|
26
|
+
|
|
27
|
+
namespace ngcore
|
|
28
|
+
{
|
|
29
|
+
// MPI rank, nranks TODO: Rename
|
|
30
|
+
// [[deprecated("don't use global id/ntasks")]]
|
|
31
|
+
extern NGCORE_API int id;
|
|
32
|
+
// [[deprecated("don't use global id/ntasks")]]
|
|
33
|
+
extern NGCORE_API int ntasks;
|
|
34
|
+
|
|
35
|
+
NGCORE_API std::string Demangle(const char* typeinfo);
|
|
36
|
+
|
|
37
|
+
template<typename T>
|
|
38
|
+
std::string GetName(const T& obj)
|
|
39
|
+
{ return Demangle(typeid(obj).name()); }
|
|
40
|
+
|
|
41
|
+
#if defined(__GNUC__)
|
|
42
|
+
inline bool likely (bool x) { return bool(__builtin_expect(long(x), 1L)); }
|
|
43
|
+
inline bool unlikely (bool x) { return bool(__builtin_expect(long(x), 0L)); }
|
|
44
|
+
#else
|
|
45
|
+
inline bool likely (bool x) { return x; }
|
|
46
|
+
inline bool unlikely (bool x) { return x; }
|
|
47
|
+
#endif
|
|
48
|
+
|
|
49
|
+
using TClock = std::chrono::system_clock;
|
|
50
|
+
extern NGCORE_API const std::chrono::time_point<TClock> wall_time_start;
|
|
51
|
+
|
|
52
|
+
// Time in seconds since program start
|
|
53
|
+
inline double WallTime () noexcept
|
|
54
|
+
{
|
|
55
|
+
std::chrono::time_point<TClock> now = TClock::now();
|
|
56
|
+
std::chrono::duration<double> elapsed_seconds = now-wall_time_start;
|
|
57
|
+
return elapsed_seconds.count();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// High precision clock counter register
|
|
61
|
+
using TTimePoint = size_t;
|
|
62
|
+
extern NGCORE_API double seconds_per_tick;
|
|
63
|
+
|
|
64
|
+
inline TTimePoint GetTimeCounter() noexcept
|
|
65
|
+
{
|
|
66
|
+
#if defined(NETGEN_ARCH_AMD64)
|
|
67
|
+
return __rdtsc();
|
|
68
|
+
#elif defined(NETGEN_ARCH_ARM64)
|
|
69
|
+
unsigned long long tics;
|
|
70
|
+
__asm __volatile("mrs %0, CNTVCT_EL0" : "=&r" (tics));
|
|
71
|
+
return tics;
|
|
72
|
+
#elif defined(__EMSCRIPTEN__) || (defined(_MSC_VER) && defined(_M_ARM64))
|
|
73
|
+
return std::chrono::high_resolution_clock::now().time_since_epoch().count();
|
|
74
|
+
#else
|
|
75
|
+
#warning "Unsupported CPU architecture"
|
|
76
|
+
return 0;
|
|
77
|
+
#endif
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
template <class T>
|
|
81
|
+
inline std::string ToString (const T& t)
|
|
82
|
+
{
|
|
83
|
+
std::stringstream ss;
|
|
84
|
+
ss << t;
|
|
85
|
+
return ss.str();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
inline std::string ToLower( const std::string & s )
|
|
89
|
+
{
|
|
90
|
+
std::string res;
|
|
91
|
+
res.reserve(s.size());
|
|
92
|
+
|
|
93
|
+
for(auto & c : s)
|
|
94
|
+
res.push_back(tolower(c));
|
|
95
|
+
|
|
96
|
+
return res;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
inline std::string ToLower( const std::filesystem::path & p )
|
|
100
|
+
{
|
|
101
|
+
return ToLower(p.string());
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
template <class T>
|
|
107
|
+
void SaveBin (std::ostream & ost, const T & val)
|
|
108
|
+
{
|
|
109
|
+
const char * cp = reinterpret_cast<const char*> (&val);
|
|
110
|
+
for (unsigned j = 0; j < sizeof(T); j++)
|
|
111
|
+
ost.put(cp[j]);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
template <class T>
|
|
116
|
+
void LoadBin (std::istream & ist, T & val)
|
|
117
|
+
{
|
|
118
|
+
char * cp = reinterpret_cast<char*> (&val);
|
|
119
|
+
for (unsigned j = 0; j < sizeof(T); j++)
|
|
120
|
+
ist.get(cp[j]);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
template<typename T1, typename T2>
|
|
125
|
+
std::ostream& operator << (std::ostream& ost, const std::map<T1,T2>& map)
|
|
126
|
+
{
|
|
127
|
+
for(auto& val : map)
|
|
128
|
+
ost << "\n" << val.first << ": " << val.second;
|
|
129
|
+
return ost;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
template <class T>
|
|
133
|
+
NETGEN_INLINE void Swap (T & a, T & b)
|
|
134
|
+
{
|
|
135
|
+
T temp = std::move(a);
|
|
136
|
+
a = std::move(b);
|
|
137
|
+
b = std::move(temp);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
/// min of 2 values
|
|
142
|
+
template <class T>
|
|
143
|
+
NETGEN_INLINE T min2 (T a, T b)
|
|
144
|
+
{
|
|
145
|
+
return (a < b) ? a : b;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/// max of 2 values
|
|
149
|
+
template <class T>
|
|
150
|
+
NETGEN_INLINE T max2 (T a, T b)
|
|
151
|
+
{
|
|
152
|
+
return (a > b) ? a : b;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/// min of 3 values
|
|
156
|
+
template <class T>
|
|
157
|
+
NETGEN_INLINE T min3 (T a, T b, T c)
|
|
158
|
+
{
|
|
159
|
+
return (a < b) ? (a < c) ? a : c
|
|
160
|
+
: (b < c) ? b : c;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/// max of 3 values
|
|
164
|
+
template <class T>
|
|
165
|
+
NETGEN_INLINE T max3 (T a, T b, T c)
|
|
166
|
+
{
|
|
167
|
+
///
|
|
168
|
+
return (a > b) ? ((a > c) ? a : c)
|
|
169
|
+
: ((b > c) ? b : c);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
/// sign of value (+1, 0, -1)
|
|
174
|
+
template <class T>
|
|
175
|
+
NETGEN_INLINE int sgn (T a)
|
|
176
|
+
{
|
|
177
|
+
return (a > 0) ? 1 : ( ( a < 0) ? -1 : 0 );
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/// square element
|
|
181
|
+
template <class T>
|
|
182
|
+
NETGEN_INLINE constexpr T sqr (const T a)
|
|
183
|
+
{
|
|
184
|
+
return a * a;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/// element to the third power
|
|
188
|
+
template <class T>
|
|
189
|
+
NETGEN_INLINE T pow3 (const T a)
|
|
190
|
+
{
|
|
191
|
+
return a * a * a;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
NETGEN_INLINE double IfPos (double a, double b, double c) { return a>0 ? b : c; }
|
|
197
|
+
NETGEN_INLINE double IfZero (double a, double b, double c) { return a==0. ? b : c; }
|
|
198
|
+
|
|
199
|
+
// checks if string starts with sequence
|
|
200
|
+
inline bool StartsWith(const std::string& str, const std::string& start)
|
|
201
|
+
{
|
|
202
|
+
if(start.size() > str.size())
|
|
203
|
+
return false;
|
|
204
|
+
return std::equal(start.begin(), start.end(), str.begin());
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// checks if string ends with sequence
|
|
208
|
+
inline bool EndsWith(const std::string& str, const std::string& end)
|
|
209
|
+
{
|
|
210
|
+
if(end.size() > str.size())
|
|
211
|
+
return false;
|
|
212
|
+
return std::equal(end.rbegin(), end.rend(), str.rbegin());
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
template<typename T>
|
|
216
|
+
NETGEN_INLINE std::atomic<T> & AsAtomic (T & d)
|
|
217
|
+
{
|
|
218
|
+
return reinterpret_cast<std::atomic<T>&> (d);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
NETGEN_INLINE double AtomicAdd( double & sum, double val )
|
|
222
|
+
{
|
|
223
|
+
std::atomic<double> & asum = AsAtomic(sum);
|
|
224
|
+
double current = asum.load();
|
|
225
|
+
while (!asum.compare_exchange_weak(current, current + val))
|
|
226
|
+
;
|
|
227
|
+
return current;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
template<typename T>
|
|
231
|
+
NETGEN_INLINE T AtomicMin( T & minval, T val )
|
|
232
|
+
{
|
|
233
|
+
std::atomic<T> & aminval = AsAtomic(minval);
|
|
234
|
+
T current = aminval.load();
|
|
235
|
+
while (!aminval.compare_exchange_weak(current, std::min(current, val)))
|
|
236
|
+
;
|
|
237
|
+
return current;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
template<typename T>
|
|
241
|
+
NETGEN_INLINE T AtomicMax( T & maxval, T val )
|
|
242
|
+
{
|
|
243
|
+
std::atomic<T> & amaxval = AsAtomic(maxval);
|
|
244
|
+
T current = amaxval.load();
|
|
245
|
+
while (!amaxval.compare_exchange_weak(current, std::max(current, val)))
|
|
246
|
+
;
|
|
247
|
+
return current;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
template <int N> using IC = std::integral_constant<int,N>; // needed for Iterate
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
namespace detail {
|
|
257
|
+
template <typename T, typename Enable = int>
|
|
258
|
+
struct IsIC_trait {
|
|
259
|
+
static constexpr auto check() { return false; }
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
template <typename T>
|
|
263
|
+
struct IsIC_trait<T, std::enable_if_t<std::is_same_v<T, IC<T::value>> == true, int> > {
|
|
264
|
+
static constexpr auto check() { return true; }
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
template <typename T>
|
|
269
|
+
constexpr bool is_IC() {
|
|
270
|
+
return detail::IsIC_trait<T>::check();
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
template <int NUM, typename FUNC>
|
|
277
|
+
NETGEN_INLINE void Iterate (FUNC f)
|
|
278
|
+
{
|
|
279
|
+
if constexpr (NUM > 1) Iterate<NUM-1> (f);
|
|
280
|
+
if constexpr (NUM >= 1) f(IC<NUM-1>());
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
template <int NUM, typename FUNC>
|
|
285
|
+
NETGEN_INLINE void Switch (size_t nr, FUNC f)
|
|
286
|
+
{
|
|
287
|
+
if (NUM-1 == nr) f(IC<NUM-1>());
|
|
288
|
+
if constexpr (NUM > 1) Switch<NUM-1> (nr, f);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
namespace detail
|
|
294
|
+
{
|
|
295
|
+
template<typename T>
|
|
296
|
+
struct IndexTypeHelper
|
|
297
|
+
{
|
|
298
|
+
private:
|
|
299
|
+
template<typename T2>
|
|
300
|
+
static constexpr auto check(T2* t) -> typename T2::index_type { return *t; }
|
|
301
|
+
static constexpr size_t check(...);
|
|
302
|
+
|
|
303
|
+
public:
|
|
304
|
+
using type = decltype(check((T*) nullptr)); // NOLINT
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
} // namespace detail
|
|
308
|
+
|
|
309
|
+
// Get index type of object. If object has a typedef index_type it is this type, else size_t
|
|
310
|
+
template<typename T>
|
|
311
|
+
using index_type = typename detail::IndexTypeHelper<T>::type;
|
|
312
|
+
|
|
313
|
+
class MyMutex
|
|
314
|
+
{
|
|
315
|
+
std::atomic<bool> m;
|
|
316
|
+
public:
|
|
317
|
+
MyMutex() { m.store(false, std::memory_order_relaxed); }
|
|
318
|
+
void lock()
|
|
319
|
+
{
|
|
320
|
+
bool should = false;
|
|
321
|
+
while (!m.compare_exchange_weak(should, true))
|
|
322
|
+
{
|
|
323
|
+
should = false;
|
|
324
|
+
#ifdef NETGEN_ARCH_AMD64
|
|
325
|
+
_mm_pause();
|
|
326
|
+
#endif // NETGEN_ARCH_AMD64
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
void unlock()
|
|
330
|
+
{
|
|
331
|
+
m = false;
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
class MyLock
|
|
336
|
+
{
|
|
337
|
+
MyMutex & mutex;
|
|
338
|
+
public:
|
|
339
|
+
MyLock (MyMutex & amutex) : mutex(amutex) { mutex.lock(); }
|
|
340
|
+
~MyLock () { mutex.unlock(); }
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
NGCORE_API int GetCompiledSIMDSize();
|
|
344
|
+
NGCORE_API bool IsRangeCheckEnabled();
|
|
345
|
+
|
|
346
|
+
NGCORE_API std::filesystem::path GetTempFilename();
|
|
347
|
+
|
|
348
|
+
NGCORE_API void* GetRawSymbol( std::string func_name );
|
|
349
|
+
|
|
350
|
+
template <typename TFunc>
|
|
351
|
+
TFunc GetSymbol( std::string func_name )
|
|
352
|
+
{
|
|
353
|
+
return reinterpret_cast<TFunc>(GetRawSymbol(func_name));
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// Class to handle/load shared libraries
|
|
357
|
+
class NGCORE_API SharedLibrary
|
|
358
|
+
{
|
|
359
|
+
std::filesystem::path lib_name;
|
|
360
|
+
std::optional<std::filesystem::path> directory_to_delete = std::nullopt;
|
|
361
|
+
void *lib = nullptr;
|
|
362
|
+
|
|
363
|
+
public:
|
|
364
|
+
SharedLibrary() = default;
|
|
365
|
+
SharedLibrary(const std::filesystem::path & lib_name_, std::optional<std::filesystem::path> directory_to_delete_ = std::nullopt, bool global = false );
|
|
366
|
+
|
|
367
|
+
SharedLibrary(const SharedLibrary &) = delete;
|
|
368
|
+
SharedLibrary & operator =(const SharedLibrary &) = delete;
|
|
369
|
+
|
|
370
|
+
~SharedLibrary();
|
|
371
|
+
|
|
372
|
+
template <typename TFunc>
|
|
373
|
+
TFunc GetSymbol( std::string func_name )
|
|
374
|
+
{
|
|
375
|
+
return reinterpret_cast<TFunc>(GetRawSymbol(func_name));
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
void Load( const std::filesystem::path & lib_name_, bool global = true);
|
|
379
|
+
void Unload();
|
|
380
|
+
void* GetRawSymbol( std::string func_name );
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
} // namespace ngcore
|
|
384
|
+
|
|
385
|
+
#endif // NETGEN_CORE_UTILS_HPP
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#ifndef NETGEN_CORE_VERSION_HPP
|
|
2
|
+
#define NETGEN_CORE_VERSION_HPP
|
|
3
|
+
|
|
4
|
+
#include <ostream>
|
|
5
|
+
#include <string>
|
|
6
|
+
#include <tuple>
|
|
7
|
+
|
|
8
|
+
#include "ngcore_api.hpp"
|
|
9
|
+
|
|
10
|
+
namespace ngcore
|
|
11
|
+
{
|
|
12
|
+
class VersionInfo
|
|
13
|
+
{
|
|
14
|
+
private:
|
|
15
|
+
size_t mayor_{}, minor_{}, release{}, patch{};
|
|
16
|
+
std::string git_hash{};
|
|
17
|
+
public:
|
|
18
|
+
VersionInfo() = default;
|
|
19
|
+
VersionInfo(std::string vstring)
|
|
20
|
+
{
|
|
21
|
+
minor_ = release = patch = 0;
|
|
22
|
+
git_hash = "";
|
|
23
|
+
if(vstring.substr(0,1) == "v")
|
|
24
|
+
vstring = vstring.substr(1,vstring.size()-1);
|
|
25
|
+
auto dot = vstring.find('.');
|
|
26
|
+
mayor_ = std::stoi(vstring.substr(0,dot));
|
|
27
|
+
if(dot == size_t(-1)) vstring = "";
|
|
28
|
+
else vstring = vstring.substr(dot+1, vstring.size()-dot-1);
|
|
29
|
+
if(!vstring.empty())
|
|
30
|
+
{
|
|
31
|
+
dot = vstring.find('.');
|
|
32
|
+
minor_ = std::stoi(vstring.substr(0,dot));
|
|
33
|
+
if (dot == size_t(-1)) vstring = "";
|
|
34
|
+
else vstring = vstring.substr(dot+1, vstring.size()-dot-1);
|
|
35
|
+
if(!vstring.empty())
|
|
36
|
+
{
|
|
37
|
+
dot = vstring.find('-');
|
|
38
|
+
release = std::stoi(vstring.substr(0,dot));
|
|
39
|
+
if(dot == size_t(-1)) vstring = "";
|
|
40
|
+
else vstring = vstring.substr(dot+1,vstring.size()-dot-1);
|
|
41
|
+
if(!vstring.empty())
|
|
42
|
+
{
|
|
43
|
+
dot = vstring.find('-');
|
|
44
|
+
patch = std::stoi(vstring.substr(0,dot));
|
|
45
|
+
if(dot == size_t(-1)) vstring = "";
|
|
46
|
+
else vstring = vstring.substr(dot+1, vstring.size()-dot-1);
|
|
47
|
+
if(!vstring.empty())
|
|
48
|
+
git_hash = vstring;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
VersionInfo(const char* cstr) : VersionInfo(std::string(cstr)) { }
|
|
54
|
+
|
|
55
|
+
std::string to_string() const
|
|
56
|
+
{ std::string vstring = "v" + std::to_string(mayor_);
|
|
57
|
+
if(minor_ || release || patch || !git_hash.empty())
|
|
58
|
+
{
|
|
59
|
+
vstring += "." + std::to_string(minor_);
|
|
60
|
+
if(release || patch || !git_hash.empty())
|
|
61
|
+
{
|
|
62
|
+
vstring += "." + std::to_string(release);
|
|
63
|
+
if(patch || !git_hash.empty())
|
|
64
|
+
{
|
|
65
|
+
vstring += "-" + std::to_string(patch);
|
|
66
|
+
if(!git_hash.empty())
|
|
67
|
+
vstring += "-" + git_hash;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return vstring;
|
|
72
|
+
}
|
|
73
|
+
bool operator <(const VersionInfo& other) const
|
|
74
|
+
{
|
|
75
|
+
return std::tie(mayor_, minor_, release, patch) <
|
|
76
|
+
std::tie(other.mayor_, other.minor_, other.release, other.patch);
|
|
77
|
+
}
|
|
78
|
+
bool operator ==(const VersionInfo& other) const
|
|
79
|
+
{
|
|
80
|
+
return mayor_ == other.mayor_ && minor_ == other.minor_ && release == other.release
|
|
81
|
+
&& patch == other.patch;
|
|
82
|
+
}
|
|
83
|
+
bool operator !=(const VersionInfo& other) const
|
|
84
|
+
{
|
|
85
|
+
return !(*this==other);
|
|
86
|
+
}
|
|
87
|
+
bool operator >(const VersionInfo& other) const { return other < (*this); }
|
|
88
|
+
bool operator <=(const VersionInfo& other) const { return !((*this) > other); }
|
|
89
|
+
bool operator >=(const VersionInfo& other) const { return !((*this) < other); }
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
inline std::ostream& operator << (std::ostream& ost, const VersionInfo& version)
|
|
93
|
+
{
|
|
94
|
+
return ost << version.to_string();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
NGCORE_API const VersionInfo& GetLibraryVersion(const std::string& library);
|
|
98
|
+
NGCORE_API const std::map<std::string, VersionInfo>& GetLibraryVersions();
|
|
99
|
+
NGCORE_API void SetLibraryVersion(const std::string& library, const VersionInfo& version);
|
|
100
|
+
} // namespace ngcore
|
|
101
|
+
|
|
102
|
+
#endif // NETGEN_CORE_VERSION_HPP
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|