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.
Files changed (340) hide show
  1. netgen/NgOCC.py +7 -0
  2. netgen/__init__.py +114 -0
  3. netgen/__init__.pyi +22 -0
  4. netgen/__main__.py +53 -0
  5. netgen/cmake/NetgenConfig.cmake +79 -0
  6. netgen/cmake/netgen-targets-release.cmake +69 -0
  7. netgen/cmake/netgen-targets.cmake +146 -0
  8. netgen/config/__init__.py +1 -0
  9. netgen/config/__init__.pyi +52 -0
  10. netgen/config/__main__.py +4 -0
  11. netgen/config/config.py +68 -0
  12. netgen/config/config.pyi +54 -0
  13. netgen/csg.py +25 -0
  14. netgen/geom2d.py +178 -0
  15. netgen/gui.py +82 -0
  16. netgen/include/core/archive.hpp +1256 -0
  17. netgen/include/core/array.hpp +1760 -0
  18. netgen/include/core/autodiff.hpp +1131 -0
  19. netgen/include/core/autodiffdiff.hpp +733 -0
  20. netgen/include/core/bitarray.hpp +240 -0
  21. netgen/include/core/concurrentqueue.h +3619 -0
  22. netgen/include/core/exception.hpp +145 -0
  23. netgen/include/core/flags.hpp +199 -0
  24. netgen/include/core/hashtable.hpp +1281 -0
  25. netgen/include/core/localheap.hpp +318 -0
  26. netgen/include/core/logging.hpp +117 -0
  27. netgen/include/core/memtracer.hpp +221 -0
  28. netgen/include/core/mpi4py_pycapi.h +245 -0
  29. netgen/include/core/mpi_wrapper.hpp +643 -0
  30. netgen/include/core/ng_mpi.hpp +94 -0
  31. netgen/include/core/ng_mpi_generated_declarations.hpp +155 -0
  32. netgen/include/core/ng_mpi_native.hpp +25 -0
  33. netgen/include/core/ngcore.hpp +32 -0
  34. netgen/include/core/ngcore_api.hpp +152 -0
  35. netgen/include/core/ngstream.hpp +115 -0
  36. netgen/include/core/paje_trace.hpp +279 -0
  37. netgen/include/core/profiler.hpp +382 -0
  38. netgen/include/core/python_ngcore.hpp +457 -0
  39. netgen/include/core/ranges.hpp +109 -0
  40. netgen/include/core/register_archive.hpp +100 -0
  41. netgen/include/core/signal.hpp +82 -0
  42. netgen/include/core/simd.hpp +160 -0
  43. netgen/include/core/simd_arm64.hpp +407 -0
  44. netgen/include/core/simd_avx.hpp +394 -0
  45. netgen/include/core/simd_avx512.hpp +285 -0
  46. netgen/include/core/simd_generic.hpp +1053 -0
  47. netgen/include/core/simd_math.hpp +178 -0
  48. netgen/include/core/simd_sse.hpp +289 -0
  49. netgen/include/core/statushandler.hpp +37 -0
  50. netgen/include/core/symboltable.hpp +153 -0
  51. netgen/include/core/table.hpp +810 -0
  52. netgen/include/core/taskmanager.hpp +1161 -0
  53. netgen/include/core/type_traits.hpp +65 -0
  54. netgen/include/core/utils.hpp +385 -0
  55. netgen/include/core/version.hpp +102 -0
  56. netgen/include/core/xbool.hpp +47 -0
  57. netgen/include/csg/algprim.hpp +563 -0
  58. netgen/include/csg/brick.hpp +150 -0
  59. netgen/include/csg/csg.hpp +43 -0
  60. netgen/include/csg/csgeom.hpp +389 -0
  61. netgen/include/csg/csgparser.hpp +101 -0
  62. netgen/include/csg/curve2d.hpp +67 -0
  63. netgen/include/csg/edgeflw.hpp +112 -0
  64. netgen/include/csg/explicitcurve2d.hpp +113 -0
  65. netgen/include/csg/extrusion.hpp +185 -0
  66. netgen/include/csg/gencyl.hpp +70 -0
  67. netgen/include/csg/geoml.hpp +16 -0
  68. netgen/include/csg/identify.hpp +213 -0
  69. netgen/include/csg/manifold.hpp +29 -0
  70. netgen/include/csg/meshsurf.hpp +46 -0
  71. netgen/include/csg/polyhedra.hpp +121 -0
  72. netgen/include/csg/revolution.hpp +180 -0
  73. netgen/include/csg/singularref.hpp +84 -0
  74. netgen/include/csg/solid.hpp +295 -0
  75. netgen/include/csg/specpoin.hpp +194 -0
  76. netgen/include/csg/spline3d.hpp +99 -0
  77. netgen/include/csg/splinesurface.hpp +85 -0
  78. netgen/include/csg/surface.hpp +394 -0
  79. netgen/include/csg/triapprox.hpp +63 -0
  80. netgen/include/csg/vscsg.hpp +34 -0
  81. netgen/include/general/autodiff.hpp +356 -0
  82. netgen/include/general/autoptr.hpp +39 -0
  83. netgen/include/general/gzstream.h +121 -0
  84. netgen/include/general/hashtabl.hpp +1692 -0
  85. netgen/include/general/myadt.hpp +48 -0
  86. netgen/include/general/mystring.hpp +226 -0
  87. netgen/include/general/netgenout.hpp +205 -0
  88. netgen/include/general/ngarray.hpp +797 -0
  89. netgen/include/general/ngbitarray.hpp +149 -0
  90. netgen/include/general/ngpython.hpp +74 -0
  91. netgen/include/general/optmem.hpp +44 -0
  92. netgen/include/general/parthreads.hpp +138 -0
  93. netgen/include/general/seti.hpp +50 -0
  94. netgen/include/general/sort.hpp +47 -0
  95. netgen/include/general/spbita2d.hpp +59 -0
  96. netgen/include/general/stack.hpp +114 -0
  97. netgen/include/general/table.hpp +280 -0
  98. netgen/include/general/template.hpp +509 -0
  99. netgen/include/geom2d/csg2d.hpp +750 -0
  100. netgen/include/geom2d/geometry2d.hpp +280 -0
  101. netgen/include/geom2d/spline2d.hpp +234 -0
  102. netgen/include/geom2d/vsgeom2d.hpp +28 -0
  103. netgen/include/gprim/adtree.hpp +1392 -0
  104. netgen/include/gprim/geom2d.hpp +858 -0
  105. netgen/include/gprim/geom3d.hpp +749 -0
  106. netgen/include/gprim/geomfuncs.hpp +212 -0
  107. netgen/include/gprim/geomobjects.hpp +544 -0
  108. netgen/include/gprim/geomops.hpp +404 -0
  109. netgen/include/gprim/geomtest3d.hpp +101 -0
  110. netgen/include/gprim/gprim.hpp +33 -0
  111. netgen/include/gprim/spline.hpp +778 -0
  112. netgen/include/gprim/splinegeometry.hpp +73 -0
  113. netgen/include/gprim/transform3d.hpp +216 -0
  114. netgen/include/include/acisgeom.hpp +3 -0
  115. netgen/include/include/csg.hpp +1 -0
  116. netgen/include/include/geometry2d.hpp +1 -0
  117. netgen/include/include/gprim.hpp +1 -0
  118. netgen/include/include/incopengl.hpp +62 -0
  119. netgen/include/include/inctcl.hpp +13 -0
  120. netgen/include/include/incvis.hpp +6 -0
  121. netgen/include/include/linalg.hpp +1 -0
  122. netgen/include/include/meshing.hpp +1 -0
  123. netgen/include/include/myadt.hpp +1 -0
  124. netgen/include/include/mydefs.hpp +70 -0
  125. netgen/include/include/mystdlib.h +59 -0
  126. netgen/include/include/netgen_config.hpp +27 -0
  127. netgen/include/include/netgen_version.hpp +9 -0
  128. netgen/include/include/nginterface_v2_impl.hpp +395 -0
  129. netgen/include/include/ngsimd.hpp +1 -0
  130. netgen/include/include/occgeom.hpp +1 -0
  131. netgen/include/include/opti.hpp +1 -0
  132. netgen/include/include/parallel.hpp +1 -0
  133. netgen/include/include/stlgeom.hpp +1 -0
  134. netgen/include/include/visual.hpp +1 -0
  135. netgen/include/interface/rw_medit.hpp +11 -0
  136. netgen/include/interface/writeuser.hpp +80 -0
  137. netgen/include/linalg/densemat.hpp +414 -0
  138. netgen/include/linalg/linalg.hpp +29 -0
  139. netgen/include/linalg/opti.hpp +142 -0
  140. netgen/include/linalg/polynomial.hpp +47 -0
  141. netgen/include/linalg/vector.hpp +217 -0
  142. netgen/include/meshing/adfront2.hpp +274 -0
  143. netgen/include/meshing/adfront3.hpp +332 -0
  144. netgen/include/meshing/basegeom.hpp +370 -0
  145. netgen/include/meshing/bcfunctions.hpp +53 -0
  146. netgen/include/meshing/bisect.hpp +72 -0
  147. netgen/include/meshing/boundarylayer.hpp +113 -0
  148. netgen/include/meshing/classifyhpel.hpp +1984 -0
  149. netgen/include/meshing/clusters.hpp +46 -0
  150. netgen/include/meshing/curvedelems.hpp +274 -0
  151. netgen/include/meshing/delaunay2d.hpp +73 -0
  152. netgen/include/meshing/fieldlines.hpp +103 -0
  153. netgen/include/meshing/findip.hpp +198 -0
  154. netgen/include/meshing/findip2.hpp +103 -0
  155. netgen/include/meshing/geomsearch.hpp +69 -0
  156. netgen/include/meshing/global.hpp +54 -0
  157. netgen/include/meshing/hpref_hex.hpp +330 -0
  158. netgen/include/meshing/hpref_prism.hpp +3405 -0
  159. netgen/include/meshing/hpref_pyramid.hpp +154 -0
  160. netgen/include/meshing/hpref_quad.hpp +2082 -0
  161. netgen/include/meshing/hpref_segm.hpp +122 -0
  162. netgen/include/meshing/hpref_tet.hpp +4230 -0
  163. netgen/include/meshing/hpref_trig.hpp +848 -0
  164. netgen/include/meshing/hprefinement.hpp +366 -0
  165. netgen/include/meshing/improve2.hpp +178 -0
  166. netgen/include/meshing/improve3.hpp +151 -0
  167. netgen/include/meshing/localh.hpp +223 -0
  168. netgen/include/meshing/meshclass.hpp +1076 -0
  169. netgen/include/meshing/meshfunc.hpp +47 -0
  170. netgen/include/meshing/meshing.hpp +63 -0
  171. netgen/include/meshing/meshing2.hpp +163 -0
  172. netgen/include/meshing/meshing3.hpp +123 -0
  173. netgen/include/meshing/meshtool.hpp +90 -0
  174. netgen/include/meshing/meshtype.hpp +1930 -0
  175. netgen/include/meshing/msghandler.hpp +62 -0
  176. netgen/include/meshing/paralleltop.hpp +172 -0
  177. netgen/include/meshing/python_mesh.hpp +206 -0
  178. netgen/include/meshing/ruler2.hpp +172 -0
  179. netgen/include/meshing/ruler3.hpp +211 -0
  180. netgen/include/meshing/soldata.hpp +141 -0
  181. netgen/include/meshing/specials.hpp +17 -0
  182. netgen/include/meshing/surfacegeom.hpp +73 -0
  183. netgen/include/meshing/topology.hpp +1003 -0
  184. netgen/include/meshing/validate.hpp +21 -0
  185. netgen/include/meshing/visual_interface.hpp +71 -0
  186. netgen/include/mydefs.hpp +70 -0
  187. netgen/include/nginterface.h +474 -0
  188. netgen/include/nginterface_v2.hpp +406 -0
  189. netgen/include/nglib.h +697 -0
  190. netgen/include/nglib_occ.h +50 -0
  191. netgen/include/occ/occ_edge.hpp +47 -0
  192. netgen/include/occ/occ_face.hpp +52 -0
  193. netgen/include/occ/occ_solid.hpp +23 -0
  194. netgen/include/occ/occ_utils.hpp +376 -0
  195. netgen/include/occ/occ_vertex.hpp +30 -0
  196. netgen/include/occ/occgeom.hpp +659 -0
  197. netgen/include/occ/occmeshsurf.hpp +168 -0
  198. netgen/include/occ/vsocc.hpp +33 -0
  199. netgen/include/pybind11/LICENSE +29 -0
  200. netgen/include/pybind11/attr.h +722 -0
  201. netgen/include/pybind11/buffer_info.h +208 -0
  202. netgen/include/pybind11/cast.h +2361 -0
  203. netgen/include/pybind11/chrono.h +228 -0
  204. netgen/include/pybind11/common.h +2 -0
  205. netgen/include/pybind11/complex.h +74 -0
  206. netgen/include/pybind11/conduit/README.txt +15 -0
  207. netgen/include/pybind11/conduit/pybind11_conduit_v1.h +116 -0
  208. netgen/include/pybind11/conduit/pybind11_platform_abi_id.h +87 -0
  209. netgen/include/pybind11/conduit/wrap_include_python_h.h +72 -0
  210. netgen/include/pybind11/critical_section.h +56 -0
  211. netgen/include/pybind11/detail/class.h +823 -0
  212. netgen/include/pybind11/detail/common.h +1348 -0
  213. netgen/include/pybind11/detail/cpp_conduit.h +75 -0
  214. netgen/include/pybind11/detail/descr.h +226 -0
  215. netgen/include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h +39 -0
  216. netgen/include/pybind11/detail/exception_translation.h +71 -0
  217. netgen/include/pybind11/detail/function_record_pyobject.h +191 -0
  218. netgen/include/pybind11/detail/init.h +538 -0
  219. netgen/include/pybind11/detail/internals.h +799 -0
  220. netgen/include/pybind11/detail/native_enum_data.h +209 -0
  221. netgen/include/pybind11/detail/pybind11_namespace_macros.h +82 -0
  222. netgen/include/pybind11/detail/struct_smart_holder.h +378 -0
  223. netgen/include/pybind11/detail/type_caster_base.h +1591 -0
  224. netgen/include/pybind11/detail/typeid.h +65 -0
  225. netgen/include/pybind11/detail/using_smart_holder.h +22 -0
  226. netgen/include/pybind11/detail/value_and_holder.h +90 -0
  227. netgen/include/pybind11/eigen/common.h +9 -0
  228. netgen/include/pybind11/eigen/matrix.h +723 -0
  229. netgen/include/pybind11/eigen/tensor.h +521 -0
  230. netgen/include/pybind11/eigen.h +12 -0
  231. netgen/include/pybind11/embed.h +320 -0
  232. netgen/include/pybind11/eval.h +161 -0
  233. netgen/include/pybind11/functional.h +147 -0
  234. netgen/include/pybind11/gil.h +199 -0
  235. netgen/include/pybind11/gil_safe_call_once.h +102 -0
  236. netgen/include/pybind11/gil_simple.h +37 -0
  237. netgen/include/pybind11/iostream.h +265 -0
  238. netgen/include/pybind11/native_enum.h +67 -0
  239. netgen/include/pybind11/numpy.h +2312 -0
  240. netgen/include/pybind11/operators.h +202 -0
  241. netgen/include/pybind11/options.h +92 -0
  242. netgen/include/pybind11/pybind11.h +3645 -0
  243. netgen/include/pybind11/pytypes.h +2680 -0
  244. netgen/include/pybind11/stl/filesystem.h +114 -0
  245. netgen/include/pybind11/stl.h +666 -0
  246. netgen/include/pybind11/stl_bind.h +858 -0
  247. netgen/include/pybind11/subinterpreter.h +299 -0
  248. netgen/include/pybind11/trampoline_self_life_support.h +65 -0
  249. netgen/include/pybind11/type_caster_pyobject_ptr.h +61 -0
  250. netgen/include/pybind11/typing.h +298 -0
  251. netgen/include/pybind11/warnings.h +75 -0
  252. netgen/include/stlgeom/meshstlsurface.hpp +67 -0
  253. netgen/include/stlgeom/stlgeom.hpp +491 -0
  254. netgen/include/stlgeom/stlline.hpp +193 -0
  255. netgen/include/stlgeom/stltool.hpp +331 -0
  256. netgen/include/stlgeom/stltopology.hpp +419 -0
  257. netgen/include/stlgeom/vsstl.hpp +58 -0
  258. netgen/include/visualization/meshdoc.hpp +42 -0
  259. netgen/include/visualization/mvdraw.hpp +325 -0
  260. netgen/include/visualization/vispar.hpp +128 -0
  261. netgen/include/visualization/visual.hpp +28 -0
  262. netgen/include/visualization/visual_api.hpp +10 -0
  263. netgen/include/visualization/vssolution.hpp +399 -0
  264. netgen/lib/libnggui.lib +0 -0
  265. netgen/lib/ngcore.lib +0 -0
  266. netgen/lib/nglib.lib +0 -0
  267. netgen/lib/togl.lib +0 -0
  268. netgen/libnggui.dll +0 -0
  269. netgen/libngguipy.lib +0 -0
  270. netgen/libngguipy.pyd +0 -0
  271. netgen/libngpy/_NgOCC.pyi +1545 -0
  272. netgen/libngpy/__init__.pyi +7 -0
  273. netgen/libngpy/_csg.pyi +259 -0
  274. netgen/libngpy/_geom2d.pyi +323 -0
  275. netgen/libngpy/_meshing.pyi +1111 -0
  276. netgen/libngpy/_stl.pyi +131 -0
  277. netgen/libngpy.lib +0 -0
  278. netgen/libngpy.pyd +0 -0
  279. netgen/meshing.py +65 -0
  280. netgen/ngcore.dll +0 -0
  281. netgen/nglib.dll +0 -0
  282. netgen/occ.py +52 -0
  283. netgen/read_gmsh.py +259 -0
  284. netgen/read_meshio.py +22 -0
  285. netgen/stl.py +2 -0
  286. netgen/togl.dll +0 -0
  287. netgen/version.py +2 -0
  288. netgen/webgui.py +529 -0
  289. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/boundarycondition.geo +16 -0
  290. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/boxcyl.geo +32 -0
  291. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/circle_on_cube.geo +27 -0
  292. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cone.geo +13 -0
  293. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cube.geo +16 -0
  294. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cubeandring.geo +55 -0
  295. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cubeandspheres.geo +21 -0
  296. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cubemcyl.geo +18 -0
  297. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cubemsphere.geo +19 -0
  298. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cylinder.geo +12 -0
  299. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/cylsphere.geo +12 -0
  300. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/doc/ng4.pdf +0 -0
  301. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/ellipsoid.geo +8 -0
  302. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/ellipticcyl.geo +10 -0
  303. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/extrusion.geo +99 -0
  304. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/fichera.geo +24 -0
  305. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/frame.step +11683 -0
  306. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/hinge.stl +8486 -0
  307. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/lshape3d.geo +26 -0
  308. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/manyholes.geo +26 -0
  309. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/manyholes2.geo +26 -0
  310. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/matrix.geo +27 -0
  311. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/ortho.geo +11 -0
  312. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/part1.stl +2662 -0
  313. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/period.geo +33 -0
  314. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/py_tutorials/exportNeutral.py +26 -0
  315. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/py_tutorials/mesh.py +19 -0
  316. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/py_tutorials/shaft.geo +65 -0
  317. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/revolution.geo +18 -0
  318. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/screw.step +1694 -0
  319. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/sculpture.geo +13 -0
  320. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/shaft.geo +65 -0
  321. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/shell.geo +10 -0
  322. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/sphere.geo +8 -0
  323. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/sphereincube.geo +17 -0
  324. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/square.in2d +35 -0
  325. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/squarecircle.in2d +48 -0
  326. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/squarehole.in2d +47 -0
  327. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/torus.geo +8 -0
  328. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/trafo.geo +57 -0
  329. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/twobricks.geo +15 -0
  330. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/twocubes.geo +18 -0
  331. netgen_mesher-6.2.2506.post35.dev0.data/data/share/netgen/twocyl.geo +16 -0
  332. netgen_mesher-6.2.2506.post35.dev0.dist-info/METADATA +15 -0
  333. netgen_mesher-6.2.2506.post35.dev0.dist-info/RECORD +340 -0
  334. netgen_mesher-6.2.2506.post35.dev0.dist-info/WHEEL +5 -0
  335. netgen_mesher-6.2.2506.post35.dev0.dist-info/entry_points.txt +2 -0
  336. netgen_mesher-6.2.2506.post35.dev0.dist-info/licenses/AUTHORS +1 -0
  337. netgen_mesher-6.2.2506.post35.dev0.dist-info/licenses/LICENSE +504 -0
  338. netgen_mesher-6.2.2506.post35.dev0.dist-info/top_level.txt +2 -0
  339. pyngcore/__init__.py +1 -0
  340. pyngcore/pyngcore.cp314-win_amd64.pyd +0 -0
@@ -0,0 +1,1930 @@
1
+ #ifndef MESHTYPE
2
+ #define MESHTYPE
3
+
4
+
5
+ /**************************************************************************/
6
+ /* File: meshtype.hpp */
7
+ /* Author: Joachim Schoeberl */
8
+ /* Date: 01. Okt. 95 */
9
+ /**************************************************************************/
10
+
11
+ #include <variant>
12
+
13
+ #include <mydefs.hpp>
14
+ #include <general/template.hpp>
15
+ #include <core/mpi_wrapper.hpp>
16
+ #include <gprim/geom3d.hpp>
17
+ #include <linalg.hpp>
18
+
19
+ #include "core/exception.hpp"
20
+ #include "msghandler.hpp"
21
+
22
+ namespace netgen
23
+ {
24
+
25
+ /*
26
+ Classes for NETGEN
27
+ */
28
+
29
+
30
+ enum ELEMENT_TYPE : unsigned char {
31
+ SEGMENT = 1, SEGMENT3 = 2,
32
+ TRIG = 10, QUAD=11, TRIG6 = 12, QUAD6 = 13, QUAD8 = 14,
33
+ TET = 20, TET10 = 21,
34
+ PYRAMID = 22, PRISM = 23, PRISM12 = 24, PRISM15 = 27, PYRAMID13 = 28,
35
+ HEX = 25, HEX20 = 26, HEX7 = 29
36
+ };
37
+
38
+
39
+ using ELEMENT_EDGE = std::array<int,2>;
40
+ using ELEMENT_FACE = std::array<int,4>;
41
+
42
+
43
+ #define ELEMENT_MAXPOINTS 20
44
+ #define ELEMENT2D_MAXPOINTS 8
45
+
46
+
47
+ enum POINTTYPE : unsigned char { FIXEDPOINT = 1, EDGEPOINT = 2, SURFACEPOINT = 3, INNERPOINT = 4 };
48
+ enum ELEMENTTYPE { FREEELEMENT, FIXEDELEMENT };
49
+ enum OPTIMIZEGOAL { OPT_QUALITY, OPT_CONFORM, OPT_REST, OPT_WORSTCASE, OPT_LEGAL };
50
+
51
+
52
+ extern DLL_HEADER size_t timestamp;
53
+ inline size_t GetTimeStamp()
54
+ {
55
+ return timestamp;
56
+ }
57
+
58
+ inline size_t NextTimeStamp()
59
+ {
60
+ timestamp++;
61
+ return timestamp;
62
+ }
63
+
64
+ class PointGeomInfo
65
+ {
66
+ public:
67
+ int trignum; // for STL Meshing
68
+ double u, v; // for OCC Meshing
69
+
70
+ PointGeomInfo () = default;
71
+ PointGeomInfo (const PointGeomInfo&) = default;
72
+ PointGeomInfo (PointGeomInfo &&) = default;
73
+ PointGeomInfo & operator= (const PointGeomInfo&) = default;
74
+ PointGeomInfo & operator= (PointGeomInfo&&) = default;
75
+ };
76
+
77
+ inline ostream & operator<< (ostream & ost, const PointGeomInfo & gi)
78
+ {
79
+ return (ost << gi.trignum << " " << gi.u << " " << gi.v);
80
+ }
81
+
82
+ inline istream & operator>> (istream & ist, PointGeomInfo & gi)
83
+ {
84
+ return (ist >> gi.trignum >> gi.u >> gi.v);
85
+ }
86
+
87
+
88
+
89
+ class MultiPointGeomInfo
90
+ {
91
+ ArrayMem<PointGeomInfo, 100> mgi;
92
+ public:
93
+ int AddPointGeomInfo (const PointGeomInfo & gi);
94
+ void Init () { mgi.SetSize(0); }
95
+ void DeleteAll () { mgi.SetSize(0); }
96
+
97
+ int GetNPGI () const { return mgi.Size(); }
98
+ const PointGeomInfo & GetPGI (int i) const { return mgi[i-1]; }
99
+
100
+ MultiPointGeomInfo () = default;
101
+ MultiPointGeomInfo (const MultiPointGeomInfo&) = default;
102
+ MultiPointGeomInfo (MultiPointGeomInfo &&) = default;
103
+ MultiPointGeomInfo & operator= (const MultiPointGeomInfo&) = delete;
104
+ MultiPointGeomInfo & operator= (MultiPointGeomInfo&&) = default;
105
+ };
106
+
107
+
108
+ class EdgePointGeomInfo
109
+ {
110
+ public:
111
+ int edgenr;
112
+ int body; // for ACIS
113
+ double dist; // for 2d meshing
114
+ double u, v; // for OCC Meshing
115
+
116
+ public:
117
+ EdgePointGeomInfo ()
118
+ : edgenr(-1), body(0), dist(0.0), u(0.0), v(0.0) { ; }
119
+
120
+ EdgePointGeomInfo & operator= (const EdgePointGeomInfo & gi2) = default;
121
+ };
122
+
123
+ inline ostream & operator<< (ostream & ost, const EdgePointGeomInfo & gi)
124
+ {
125
+ ost << "epgi: edgnr=" << gi.edgenr << ", dist=" << gi.dist;
126
+ return ost;
127
+ }
128
+
129
+
130
+ template <typename T, typename TIndex, int BASE_>
131
+ class Index
132
+ {
133
+ public:
134
+ T i;
135
+
136
+ static constexpr int BASE = BASE_;
137
+ static constexpr TIndex Base() { return TIndex(BASE_); }
138
+
139
+ class t_invalid { public: constexpr t_invalid() = default; };
140
+ static constexpr t_invalid INVALID{};
141
+
142
+ typedef decltype( declval<T>()-declval<T>() ) T_diff;
143
+
144
+ public:
145
+ constexpr Index () = default;
146
+ constexpr Index (const Index& i2) = default;
147
+ constexpr Index (Index &&) = default;
148
+ Index & operator= (const Index&) = default;
149
+ Index & operator= (Index&&) = default;
150
+
151
+ // private:
152
+ constexpr Index (T ai) : i(ai)
153
+ {
154
+ #ifdef DEBUG
155
+ if (ai < BASE_)
156
+ cout << "illegal Index, use Index::INVALID instead" << endl;
157
+ #endif
158
+ }
159
+
160
+
161
+ /*
162
+ // didn't manage constexpr friend functions so far ???
163
+ friend auto operator+ (Index, int) -> TIndex;
164
+ friend TIndex operator+ (Index, size_t);
165
+ friend TIndex operator+ (int, Index);
166
+ friend TIndex operator+ (size_t, Index);
167
+ friend constexpr TIndex operator- (Index, int);
168
+ friend int operator- (Index, Index);
169
+ friend bool operator< (Index a, Index b);
170
+ friend bool operator> (Index a, Index b);
171
+ friend bool operator>= (Index a, Index b);
172
+ friend bool operator<= (Index a, Index b);
173
+ friend bool operator== (Index a, Index b);
174
+ friend bool operator!= (Index a, Index b);
175
+ */
176
+
177
+ public:
178
+ constexpr Index (t_invalid inv) : i(long(BASE)-1) { ; }
179
+ // protected:
180
+ constexpr operator T () const { return i; }
181
+ explicit constexpr operator T& () { return i; }
182
+ public:
183
+ TIndex operator++ (int) { TIndex hi{*this}; i++; return hi; }
184
+ TIndex operator-- (int) { TIndex hi(*this); i--; return hi; }
185
+ TIndex & operator++ () { i++; return static_cast<TIndex&>(*this); }
186
+ TIndex & operator-- () { i--; return static_cast<TIndex&>(*this); }
187
+
188
+ /*
189
+ constexpr TIndex operator+= (int add) { i += add; return TIndex{*this}; }
190
+ constexpr TIndex operator+= (size_t add) { i += add; return TIndex{*this}; }
191
+ constexpr TIndex operator-= (int add) { i -= add; return TIndex{*this}; }
192
+ constexpr TIndex operator-= (size_t add) { i -= add; return TIndex{*this}; }
193
+ */
194
+ constexpr TIndex operator+= (T_diff add) { i += add; return TIndex{*this}; }
195
+ constexpr TIndex operator-= (T_diff add) { i -= add; return TIndex{*this}; }
196
+
197
+ constexpr auto operator- (Index i2) const { return i-i2.i; }
198
+
199
+ // bool operator== (Index i2) const { return i==i2.i; }
200
+ // bool operator!= (Index i2) const { return i!=i2.i; }
201
+ void Invalidate() { i = long(TIndex::BASE)-1; }
202
+ bool IsValid() const { return i+1 != TIndex::BASE; }
203
+ // operator bool() const { return IsValid(); }
204
+
205
+ void DoArchive (Archive & ar) { ar & i; }
206
+ };
207
+
208
+
209
+ template <typename T, typename TIndex, int Base>
210
+ constexpr auto operator+ (Index<T,TIndex,Base> ind, int i) { Index<T,TIndex,Base> res(ind); return res += i; }
211
+ template <typename T, typename TIndex, int Base>
212
+ constexpr auto operator+ (Index<T,TIndex,Base> ind, size_t i) { Index<T,TIndex,Base> res(ind); return res += i; }
213
+ template <typename T, typename TIndex, int Base>
214
+ constexpr TIndex operator+ (int i, Index<T,TIndex,Base> ind) { return ind+i; } // Indexx<T,TIndex,Base> res(ind); return res += i;
215
+ template <typename T, typename TIndex, int Base>
216
+ inline TIndex operator+ (size_t i, Index<T,TIndex,Base> ind) { return ind+i; } // TIndex res(ind); res += i; return res; }
217
+
218
+ template <typename T, typename TIndex, int Base>
219
+ constexpr inline auto operator- (Index<T,TIndex,Base> ind, int i) { Index<T,TIndex,Base> res(ind); return res -= i; }
220
+ // template <typename T, typename TIndex, int Base>
221
+ // constexpr inline auto operator- (Index<T,TIndex,Base> pa, Index<T,TIndex,Base> pb) { return pa.i-pb.i; }
222
+
223
+ template <typename T, typename TIndex, int Base>
224
+ inline bool operator< (Index<T,TIndex,Base> a, Index<T,TIndex,Base> b) { return a-b < 0; }
225
+ template <typename T, typename TIndex, int Base>
226
+ inline bool operator> (Index<T,TIndex,Base> a, Index<T,TIndex,Base> b) { return a-b > 0; }
227
+ template <typename T, typename TIndex, int Base>
228
+ inline bool operator>= (Index<T,TIndex,Base> a, Index<T,TIndex,Base> b) { return a-b >= 0; }
229
+ template <typename T, typename TIndex, int Base>
230
+ inline bool operator<= (Index<T,TIndex,Base> a, Index<T,TIndex,Base> b) { return a-b <= 0; }
231
+
232
+ template <typename T, typename TIndex, int Base>
233
+ inline bool operator== (Index<T,TIndex,Base> a, Index<T,TIndex,Base> b) { return a.i == b.i; }
234
+ template <typename T, typename TIndex, int Base>
235
+ inline bool operator!= (Index<T,TIndex,Base> a, Index<T,TIndex,Base> b) { return a.i != b.i; }
236
+
237
+
238
+ template <typename T, typename TIndex, int Base>
239
+ inline void SetInvalid (Index<T,TIndex,Base> & id) { id.Invalidate(); }
240
+ template <typename T, typename TIndex, int Base>
241
+ inline bool IsInvalid (const Index<T,TIndex,Base> & id) { return !id.IsValid(); }
242
+
243
+
244
+
245
+ class PointIndex : public Index<int,PointIndex,1>
246
+ {
247
+ public:
248
+ using Index::Index;
249
+ template <int N> friend class PointIndices;
250
+ };
251
+
252
+ }
253
+
254
+ namespace ngcore
255
+ {
256
+ template<>
257
+ constexpr netgen::PointIndex IndexBASE<netgen::PointIndex> () { return netgen::PointIndex::Base(); }
258
+ }
259
+
260
+ namespace netgen
261
+ {
262
+
263
+ // input-output is 1-based
264
+ inline istream & operator>> (istream & ist, PointIndex & pi)
265
+ {
266
+ // int i; ist >> i; pi = PointIndex(i); return ist;
267
+ int i; ist >> i;
268
+ pi = IndexBASE<PointIndex>()+i-1;
269
+ return ist;
270
+ }
271
+
272
+ inline ostream & operator<< (ostream & ost, const PointIndex & pi)
273
+ {
274
+ // return (ost << int(pi));
275
+ int intpi = pi - IndexBASE<PointIndex>() + 1;
276
+ return (ost << intpi);
277
+ }
278
+
279
+
280
+
281
+ /*
282
+ PointIndices<2> etc are derived from historic INDEX_2 etc to be useable in old HASHTABLEs.
283
+ Will change to IVec<2> or std::array when INDEX_2 is not needed anymore
284
+ */
285
+
286
+ template <int N> class PointIndices;
287
+ template <> class PointIndices<2> : public INDEX_2
288
+ {
289
+ public:
290
+ PointIndices () = default;
291
+ constexpr PointIndices (const PointIndices&) = default;
292
+ constexpr PointIndices (PointIndices&&) = default;
293
+ PointIndices & operator= (const PointIndices&) = default;
294
+ PointIndices & operator= (PointIndices&&) = default;
295
+
296
+ constexpr PointIndices (INDEX_2 i2) : INDEX_2(i2) { ; }
297
+ constexpr PointIndices (PointIndex i1, PointIndex i2) : INDEX_2(i1,i2) { ; }
298
+ constexpr PointIndex operator[] (int i) const { return PointIndex(INDEX_2::operator[](i)); }
299
+ PointIndex & operator[] (int i) { return reinterpret_cast<PointIndex&>(INDEX_2::operator[](i)); }
300
+
301
+ template <typename ARCHIVE>
302
+ void DoArchive(ARCHIVE& ar) { ar.Do(&I1(), 2); }
303
+
304
+ PointIndex & I1 () { return (*this)[0]; }
305
+ PointIndex & I2 () { return (*this)[1]; }
306
+ PointIndex I1 () const { return (*this)[0]; }
307
+ PointIndex I2 () const { return (*this)[1]; }
308
+
309
+ using INDEX_2::Sort;
310
+ static PointIndices Sort(PointIndex i1, PointIndex i2) { return INDEX_2::Sort(i1, i2); }
311
+ template <size_t J>
312
+ PointIndex get() const { return PointIndex(INDEX_2::operator[](J)); }
313
+ };
314
+
315
+ template <> class PointIndices<3> : public INDEX_3
316
+ {
317
+ public:
318
+ PointIndices () = default;
319
+ PointIndices (const PointIndices&) = default;
320
+ PointIndices (PointIndices&&) = default;
321
+ PointIndices & operator= (const PointIndices&) = default;
322
+ PointIndices & operator= (PointIndices&&) = default;
323
+ constexpr PointIndices (INDEX_3 i3) : INDEX_3(i3) { ; }
324
+ constexpr PointIndices (PointIndex i1, PointIndex i2, PointIndex i3) : INDEX_3(i1,i2,i3) { ; }
325
+ PointIndex operator[] (int i) const { return PointIndex(INDEX_3::operator[](i)); }
326
+ PointIndex & operator[] (int i) { return reinterpret_cast<PointIndex&>(INDEX_3::operator[](i)); }
327
+
328
+ template <typename ARCHIVE>
329
+ void DoArchive(ARCHIVE& ar) { ar.Do(&I1(), 3); }
330
+
331
+ PointIndex & I1 () { return (*this)[0]; }
332
+ PointIndex & I2 () { return (*this)[1]; }
333
+ PointIndex & I3 () { return (*this)[2]; }
334
+ PointIndex I1 () const { return (*this)[0]; }
335
+ PointIndex I2 () const { return (*this)[1]; }
336
+ PointIndex I3 () const { return (*this)[2]; }
337
+
338
+ using INDEX_3::Sort;
339
+ static PointIndices Sort(PointIndex i1, PointIndex i2, PointIndex i3) { return INDEX_3::Sort(i1, i2, i3); }
340
+ template <size_t J>
341
+ PointIndex get() const { return PointIndex(INDEX_3::operator[](J)); }
342
+ };
343
+
344
+ template <> class PointIndices<4> : public INDEX_4
345
+ {
346
+ public:
347
+ PointIndices () = default;
348
+ PointIndices (INDEX_4 i4) : INDEX_4(i4) { ; }
349
+ PointIndices (PointIndex i1, PointIndex i2, PointIndex i3, PointIndex i4) : INDEX_4(i1,i2,i3,i4) { ; }
350
+ PointIndex operator[] (int i) const { return PointIndex(INDEX_4::operator[](i)); }
351
+ PointIndex & operator[] (int i) { return reinterpret_cast<PointIndex&>(INDEX_4::operator[](i)); }
352
+
353
+ template <typename ARCHIVE>
354
+ void DoArchive(ARCHIVE& ar) { ar.Do(&I1(), 4); }
355
+
356
+ PointIndex & I1 () { return (*this)[0]; }
357
+ PointIndex & I2 () { return (*this)[1]; }
358
+ PointIndex & I3 () { return (*this)[2]; }
359
+ PointIndex & I4 () { return (*this)[3]; }
360
+ PointIndex I1 () const { return (*this)[0]; }
361
+ PointIndex I2 () const { return (*this)[1]; }
362
+ PointIndex I3 () const { return (*this)[2]; }
363
+ PointIndex I4 () const { return (*this)[3]; }
364
+
365
+ using INDEX_4::Sort;
366
+ // static PointIndices Sort(PointIndex i1, PointIndex i2, PointIndex i3, PointIndex i4) { return INDEX_4::Sort(i1, i2, i3, i4); }
367
+ template <size_t J>
368
+ PointIndex get() const { return PointIndex(INDEX_4::operator[](J)); }
369
+ };
370
+
371
+
372
+ template <int N>
373
+ class SortedPointIndices : public PointIndices<N>
374
+ {
375
+ using PointIndices<N>::Sort;
376
+ public:
377
+ constexpr SortedPointIndices (PointIndices<N> pnts)
378
+ : PointIndices<N>(pnts.Sort()) { }
379
+
380
+ template <typename ...Pnts>
381
+ constexpr SortedPointIndices (Pnts ...pnts)
382
+ : PointIndices<N>(pnts...)
383
+ { Sort(); }
384
+ };
385
+
386
+ }
387
+
388
+
389
+
390
+ namespace ngcore
391
+ {
392
+
393
+ template <>
394
+ struct CHT_trait<netgen::PointIndex>
395
+ {
396
+ constexpr static inline netgen::PointIndex Invalid() { return netgen::PointIndex::INVALID; }
397
+ constexpr static inline size_t HashValue (const netgen::PointIndex & hash, size_t mask)
398
+ { return (hash-IndexBASE<netgen::PointIndex>()) & mask; }
399
+ };
400
+
401
+
402
+ template <>
403
+ struct CHT_trait<netgen::PointIndices<2>>
404
+ {
405
+ constexpr static inline netgen::PointIndices<2> Invalid() { return { netgen::PointIndex::INVALID, netgen::PointIndex::INVALID} ; }
406
+ constexpr static inline size_t HashValue (const netgen::PointIndices<2> & hash, size_t mask)
407
+ { return HashValue2(IVec<2>(hash[0]-IndexBASE<netgen::PointIndex>(),
408
+ hash[1]-IndexBASE<netgen::PointIndex>()), mask); }
409
+ };
410
+
411
+
412
+ template <>
413
+ struct CHT_trait<netgen::SortedPointIndices<2>>
414
+ {
415
+ constexpr static inline netgen::SortedPointIndices<2> Invalid() { return { netgen::PointIndex::INVALID, netgen::PointIndex::INVALID} ; }
416
+ constexpr static inline size_t HashValue (const netgen::SortedPointIndices<2> & hash, size_t mask)
417
+ // { return HashValue2(IVec<2,netgen::INDEX>(hash[0], hash[1]), mask); }
418
+ { return CHT_trait<netgen::PointIndices<2>>::HashValue (hash, mask); }
419
+ };
420
+
421
+
422
+ template <>
423
+ constexpr inline netgen::PointIndices<3> InvalidHash<netgen::PointIndices<3>> ()
424
+ { return netgen::PointIndices<3>{netgen::PointIndex::INVALID, netgen::PointIndex::INVALID, netgen::PointIndex::INVALID}; }
425
+
426
+ /*
427
+ template <>
428
+ constexpr inline netgen::SortedPointIndices<2> InvalidHash<netgen::SortedPointIndices<2>> ()
429
+ // { return InvalidHash<netgen::PointIndices<2>>(); }
430
+ { return CHT_trait<netgen::PointIndices<2>>::Invalid(); }
431
+ */
432
+ }
433
+
434
+
435
+ namespace std
436
+ {
437
+ // structured binding support
438
+ template <auto N>
439
+ struct tuple_size<netgen::PointIndices<N>> : std::integral_constant<std::size_t, N> {};
440
+ template<size_t N, auto M> struct tuple_element<N,netgen::PointIndices<M>> { using type = netgen::PointIndex; };
441
+ }
442
+
443
+ namespace netgen
444
+ {
445
+
446
+ class ElementIndex : public Index<int,ElementIndex,0>
447
+ {
448
+ public:
449
+ using Index::Index; // <int,ElementIndex,0>::Index;
450
+ };
451
+
452
+ inline istream & operator>> (istream & ist, ElementIndex & ei)
453
+ {
454
+ int i; ist >> i; ei = ElementIndex::Base()+i; return ist;
455
+ }
456
+
457
+ inline ostream & operator<< (ostream & ost, const ElementIndex & ei)
458
+ {
459
+ return ost << int(ei-ElementIndex::Base());
460
+ }
461
+
462
+
463
+ /*
464
+ // these should not be needed soon
465
+ inline bool operator== (Index<int,ElementIndex,0> ei1, int ei2) { return int(ei1) == int(ei2); };
466
+ inline bool operator< (size_t s, Index<int,ElementIndex,0> ei2) { return int(s) < int(ei2); };
467
+ inline bool operator< ( Index<int,ElementIndex,0> ei1, size_t s) { return int(ei1) < int(s); }; // should not need
468
+ inline bool operator< ( Index<int,ElementIndex,0> ei1, int s) { return int(ei1) < int(s); }; // should not need
469
+ inline bool operator>= (size_t s, Index<int,ElementIndex,0> ei2) { return int(s) >= int(ei2); };
470
+ */
471
+
472
+ class SurfaceElementIndex : public Index<int,SurfaceElementIndex,0>
473
+ {
474
+ public:
475
+ using Index::Index;
476
+ };
477
+
478
+
479
+ // these should not be needed soon
480
+ /*
481
+ inline bool operator== (Index<int, SurfaceElementIndex,0> ei1, int ei2) { return int(ei1) == int(ei2); };
482
+ inline bool operator== (int ei2, Index<int, SurfaceElementIndex,0> ei1) { return int(ei1) == int(ei2); };
483
+ inline bool operator!= (Index<int, SurfaceElementIndex,0> ei1, int ei2) { return int(ei1) != int(ei2); };
484
+ inline bool operator< (size_t s, Index<int, SurfaceElementIndex,0> ei2) { return int(s) < int(ei2); };
485
+ inline bool operator< (Index<int, SurfaceElementIndex,0> ei1, size_t s) { return int(ei1) < int(s); }; // should not need
486
+ inline bool operator< (Index<int, SurfaceElementIndex,0> ei1, int s) { return int(ei1) < int(s); }; // should not need
487
+ inline bool operator>= (size_t s, Index<int, SurfaceElementIndex,0> ei2) { return int(s) >= int(ei2); };
488
+ inline bool operator>= (Index<int, SurfaceElementIndex,0> ei1, int s) { return int(ei1) >= int(s); };
489
+ */
490
+
491
+ // inline void SetInvalid (SurfaceElementIndex & id) { id.Invalidate(); }
492
+ // inline bool IsInvalid (SurfaceElementIndex & id) { return !id.IsValid(); }
493
+
494
+ inline istream & operator>> (istream & ist, SurfaceElementIndex & pi)
495
+ {
496
+ int i; ist >> i; pi = i; return ist;
497
+ }
498
+
499
+ inline ostream & operator<< (ostream & ost, const SurfaceElementIndex & si)
500
+ {
501
+ return ost << (si-IndexBASE(si));
502
+ }
503
+
504
+
505
+ class SegmentIndex : public Index<int,SegmentIndex,0>
506
+ {
507
+ public:
508
+ using Index::Index;
509
+ };
510
+
511
+ // these should not be needed soon
512
+ /*
513
+ inline bool operator== (Index<int, SegmentIndex,0> ei1, int ei2) { return int(ei1) == int(ei2); };
514
+ inline bool operator< (size_t s, Index<int,SegmentIndex,0> ei2) { return int(s) < int(ei2); };
515
+ inline bool operator< (Index<int, SegmentIndex,0> ei1, size_t s) { return int(ei1) < int(s); };
516
+ inline bool operator< (Index<int, SegmentIndex,0> ei1, int s) { return int(ei1) < int(s); };
517
+ */
518
+
519
+ // inline void SetInvalid (SegmentIndex & id) { id = -1; }
520
+ // inline bool IsInvalid (SegmentIndex & id) { return id == -1; }
521
+
522
+
523
+ inline istream & operator>> (istream & ist, SegmentIndex & pi)
524
+ {
525
+ int i; ist >> i; pi = i; return ist;
526
+ }
527
+
528
+ inline ostream & operator<< (ostream & ost, const SegmentIndex & si)
529
+ {
530
+ return ost << (si - IndexBASE(si));
531
+ }
532
+
533
+
534
+
535
+
536
+ /**
537
+ Point in the mesh.
538
+ Contains layer (a new feature in 4.3 for overlapping meshes.
539
+ */
540
+ class MeshPoint : public Point<3>
541
+ {
542
+ double singular; // singular factor for hp-refinement
543
+ int layer;
544
+ POINTTYPE type;
545
+
546
+
547
+ public:
548
+ MeshPoint ()
549
+ {
550
+ ;
551
+ }
552
+
553
+ MeshPoint (const Point<3> & ap, int alayer = 1, POINTTYPE apt = INNERPOINT)
554
+ : Point<3> (ap), singular(0.), layer(alayer), type(apt)
555
+ {
556
+ ;
557
+ }
558
+
559
+ void SetPoint (const Point<3> & ap)
560
+ {
561
+ Point<3>::operator= (ap);
562
+ layer = 0;
563
+ singular = 0;
564
+ }
565
+
566
+ void Scale(double factor) { *testout << "before: " << x[0] << endl; x[0] *= factor; x[1] *= factor; x[2] *= factor; *testout << "after: " << x[0] << endl;}
567
+
568
+ int GetLayer() const { return layer; }
569
+
570
+ POINTTYPE Type() const { return type; }
571
+ void SetType(POINTTYPE at) { type = at; }
572
+
573
+ double Singularity() const { return singular; }
574
+ void Singularity(double s) { singular = s; }
575
+ bool IsSingular() const { return (singular != 0.0); }
576
+
577
+ #ifdef PARALLEL
578
+ static NG_MPI_Datatype MyGetMPIType ( );
579
+ #endif
580
+
581
+ void DoArchive (Archive & ar)
582
+ {
583
+ // ar & x[0] & x[1] & x[2] & layer & singular;
584
+ // ar.Do(&x[0], 3);
585
+ // ar & layer & singular;
586
+ // ar & (unsigned char&)(type);
587
+ ar.DoPacked (x[0], x[1], x[2], layer, singular, (unsigned char&)(type));
588
+ }
589
+ };
590
+
591
+ inline ostream & operator<<(ostream & s, const MeshPoint & pt)
592
+ {
593
+ return (s << Point<3> (pt));
594
+ }
595
+
596
+
597
+
598
+
599
+ // typedef NgArray<MeshPoint, PointIndex::BASE, PointIndex> T_POINTS;
600
+ typedef Array<MeshPoint, PointIndex> T_POINTS;
601
+
602
+
603
+
604
+ /**
605
+ Triangle element for surface mesh generation.
606
+ */
607
+ class Element2d
608
+ {
609
+ /// point numbers
610
+ PointIndex pnum[ELEMENT2D_MAXPOINTS];
611
+ /// geom info of points
612
+ PointGeomInfo geominfo[ELEMENT2D_MAXPOINTS];
613
+
614
+ /// surface nr
615
+ int index;
616
+ ///
617
+ ELEMENT_TYPE typ;
618
+ /// number of points
619
+ int8_t np;
620
+ bool refflag; // marked for refinement
621
+ bool badel:1;
622
+ bool strongrefflag:1;
623
+ bool deleted:1; // element is deleted
624
+
625
+ // Philippose - 08 August 2010
626
+ // Set a new property for each element, to
627
+ // control whether it is visible or not
628
+ bool visible:1; // element visible
629
+ bool is_curved; // element is (high order) curved
630
+ int8_t newest_vertex = -1; // from refinement via bisection
631
+ /// order for hp-FEM
632
+ unsigned int orderx:6;
633
+ unsigned int ordery:6;
634
+
635
+ /// a linked list for all segments in the same face
636
+ SurfaceElementIndex next;
637
+ ///
638
+ int hp_elnr;
639
+
640
+ public:
641
+ static auto GetDataLayout()
642
+ {
643
+ return std::map<string, int>({
644
+ { "pnum", offsetof(Element2d, pnum)},
645
+ { "index", offsetof(Element2d, index) },
646
+ { "np", offsetof(Element2d, np) },
647
+ { "refine", offsetof(Element2d, refflag) },
648
+ { "curved", offsetof(Element2d, is_curved)}
649
+ });
650
+ }
651
+
652
+ ///
653
+ DLL_HEADER Element2d ();
654
+ Element2d (const Element2d &) = default;
655
+ Element2d (Element2d &&) = default;
656
+ Element2d & operator= (const Element2d &) = default;
657
+ Element2d & operator= (Element2d &&) = default;
658
+ Element2d & operator= (initializer_list<PointIndex> list)
659
+ {
660
+ size_t cnt = 0;
661
+ for (auto val : list)
662
+ pnum[cnt++] = val;
663
+ return *this;
664
+ }
665
+ Element2d & operator= (initializer_list<std::tuple<PointIndex,PointGeomInfo>> list)
666
+ {
667
+ size_t cnt = 0;
668
+ for (auto val : list)
669
+ {
670
+ pnum[cnt] = get<0>(val);
671
+ geominfo[cnt++] = get<1>(val);
672
+ }
673
+ return *this;
674
+ }
675
+ ///
676
+ DLL_HEADER Element2d (int anp);
677
+ ///
678
+ DLL_HEADER Element2d (ELEMENT_TYPE type);
679
+ ///
680
+ DLL_HEADER Element2d (PointIndex pi1, PointIndex pi2, PointIndex pi3);
681
+ ///
682
+ DLL_HEADER Element2d (PointIndex pi1, PointIndex pi2, PointIndex pi3, PointIndex pi4);
683
+ ///
684
+ ELEMENT_TYPE GetType () const { return typ; }
685
+ ///
686
+ void SetType (ELEMENT_TYPE atyp)
687
+ {
688
+ typ = atyp;
689
+ switch (typ)
690
+ {
691
+ case TRIG: np = 3; break;
692
+ case QUAD: np = 4; break;
693
+ case TRIG6: np = 6; break;
694
+ case QUAD6: np = 6; break;
695
+ case QUAD8: np = 8; break;
696
+ default:
697
+ PrintSysError ("Element2d::SetType, illegal type ", int(typ));
698
+ }
699
+ is_curved = (np >= 4);
700
+ }
701
+ ///
702
+ int GetNP() const { return np; }
703
+ ///
704
+ int GetNV() const
705
+ {
706
+ if (typ == TRIG || typ == TRIG6)
707
+ return 3;
708
+ else
709
+ {
710
+ #ifdef DEBUG
711
+ if (typ != QUAD && typ != QUAD6 && typ != QUAD8)
712
+ PrintSysError ("element2d::GetNV not implemented for typ", int(typ));
713
+ #endif
714
+ return 4;
715
+ }
716
+ /*
717
+ switch (typ)
718
+ {
719
+ case TRIG:
720
+ case TRIG6: return 3;
721
+
722
+ case QUAD:
723
+ case QUAD8:
724
+ case QUAD6: return 4;
725
+ default:
726
+ #ifdef DEBUG
727
+ PrintSysError ("element2d::GetNV not implemented for typ", typ)
728
+ #endif
729
+ ;
730
+ }
731
+ return np;
732
+ */
733
+ }
734
+
735
+ ///
736
+ PointIndex & operator[] (int i) { return pnum[i]; }
737
+ ///
738
+ const PointIndex & operator[] (int i) const { return pnum[i]; }
739
+
740
+ auto PNums () const { return FlatArray<const PointIndex> (np, &pnum[0]); }
741
+ auto PNums () { return FlatArray<PointIndex> (np, &pnum[0]); }
742
+ template <int NP>
743
+ auto PNums() const { return FlatArray<const PointIndex> (NP, &pnum[0]); }
744
+ auto Vertices() const { return FlatArray<const PointIndex> (GetNV(), &pnum[0]); }
745
+
746
+ auto GeomInfo() const { return FlatArray<const PointGeomInfo> (np, &geominfo[0]); }
747
+ auto GeomInfo() { return FlatArray<PointGeomInfo> (np, &geominfo[0]); }
748
+
749
+ ///
750
+ PointIndex & PNum (int i) { return pnum[i-1]; }
751
+ ///
752
+ const PointIndex & PNum (int i) const { return pnum[i-1]; }
753
+ ///
754
+ PointIndex & PNumMod (int i) { return pnum[(i-1) % np]; }
755
+ ///
756
+ const PointIndex & PNumMod (int i) const { return pnum[(i-1) % np]; }
757
+ ///
758
+
759
+ ///
760
+ PointGeomInfo & GeomInfoPi (int i) { return geominfo[i-1]; }
761
+ ///
762
+ const PointGeomInfo & GeomInfoPi (int i) const { return geominfo[i-1]; }
763
+ ///
764
+ PointGeomInfo & GeomInfoPiMod (int i) { return geominfo[(i-1) % np]; }
765
+ ///
766
+ const PointGeomInfo & GeomInfoPiMod (int i) const { return geominfo[(i-1) % np]; }
767
+
768
+ auto & NewestVertex() { return newest_vertex; }
769
+ auto NewestVertex() const { return newest_vertex; }
770
+
771
+ void DoArchive (Archive & ar)
772
+ {
773
+ short _np, _typ;
774
+ bool _curved, _vis, _deleted;
775
+ if (ar.Output())
776
+ { _np = np; _typ = typ; _curved = is_curved;
777
+ _vis = visible; _deleted = deleted; }
778
+ // ar & _np & _typ & index & _curved & _vis & _deleted;
779
+ ar.DoPacked (_np, _typ, index, _curved, _vis, _deleted);
780
+ // ar & next; don't need
781
+ if (ar.Input())
782
+ { np = _np; typ = ELEMENT_TYPE(_typ); is_curved = _curved;
783
+ visible = _vis; deleted = _deleted; }
784
+ /*
785
+ for (size_t i = 0; i < np; i++)
786
+ ar & pnum[i];
787
+ */
788
+ static_assert(sizeof(int) == sizeof (PointIndex));
789
+ ar.Do( (int*)&pnum[0], np);
790
+ }
791
+
792
+ #ifdef PARALLEL
793
+ static NG_MPI_Datatype MyGetMPIType();
794
+ #endif
795
+
796
+
797
+ void SetIndex (int si) { index = si; }
798
+ ///
799
+ int GetIndex () const { return index; }
800
+
801
+ int GetOrder () const { return orderx; }
802
+ void SetOrder (int aorder) { orderx = ordery = aorder; }
803
+
804
+
805
+ void GetOrder (int & ox, int & oy) const { ox = orderx, oy =ordery;};
806
+ void GetOrder (int & ox, int & oy, int & oz) const { ox = orderx; oy = ordery; oz=0; }
807
+ void SetOrder (int ox, int oy, int /* oz */) { orderx = ox; ordery = oy;}
808
+ void SetOrder (int ox, int oy) { orderx = ox; ordery = oy;}
809
+
810
+ int GetHpElnr() const { return hp_elnr; }
811
+ void SetHpElnr(int _hp_elnr) { hp_elnr = _hp_elnr; }
812
+
813
+ ///
814
+ void GetBox (const T_POINTS & points, Box3d & box) const;
815
+ /// invert orientation
816
+ inline void Invert ();
817
+ ///
818
+ DLL_HEADER void Invert2 ();
819
+ /// first point number is smallest
820
+ inline void NormalizeNumbering ();
821
+ ///
822
+ void NormalizeNumbering2 ();
823
+
824
+ bool BadElement() const { return badel; }
825
+
826
+ // friend ostream & operator<<(ostream & s, const Element2d & el);
827
+ friend class Mesh;
828
+
829
+
830
+ /// get number of 'integration points'
831
+ int GetNIP () const;
832
+ void GetIntegrationPoint (int ip, Point<2> & p, double & weight) const;
833
+
834
+ void GetTransformation (int ip, const NgArray<Point<2>> & points,
835
+ class DenseMatrix & trans) const;
836
+ void GetTransformation (int ip, class DenseMatrix & pmat,
837
+ class DenseMatrix & trans) const;
838
+
839
+ void GetShape (const Point<2> & p, class Vector & shape) const;
840
+ DLL_HEADER void GetShapeNew (const Point<2> & p, class FlatVector & shape) const;
841
+ template <typename T>
842
+ DLL_HEADER void GetShapeNew (const Point<2,T> & p, TFlatVector<T> shape) const;
843
+ /// matrix 2 * np
844
+ DLL_HEADER void GetDShape (const Point<2> & p, class DenseMatrix & dshape) const;
845
+ template <typename T>
846
+ DLL_HEADER void GetDShapeNew (const Point<2,T> & p, class MatrixFixWidth<2,T> & dshape) const;
847
+
848
+ /// matrix 2 * np
849
+ void GetPointMatrix (const NgArray<Point<2>> & points,
850
+ class DenseMatrix & pmat) const;
851
+
852
+ void ComputeIntegrationPointData () const;
853
+
854
+
855
+ double CalcJacobianBadness (const NgArray<Point<2>> & points) const;
856
+ double CalcJacobianBadness (const T_POINTS & points,
857
+ const Vec<3> & n) const;
858
+ double CalcJacobianBadnessDirDeriv (const NgArray<Point<2>> & points,
859
+ int pi, Vec<2> & dir, double & dd) const;
860
+
861
+
862
+
863
+ void Delete ()
864
+ {
865
+ deleted = true;
866
+ // for (PointIndex & p : pnum) p.Invalidate();
867
+ }
868
+
869
+ bool IsDeleted () const
870
+ {
871
+ #ifdef DEBUG
872
+ if ((pnum[0]-IndexBASE<PointIndex>() < 0) && !deleted)
873
+ cerr << "Surfelement has illegal pnum, but not marked as deleted" << endl;
874
+ #endif
875
+ return deleted;
876
+ }
877
+
878
+ // Philippose - 08 August 2010
879
+ // Access functions for the new property: visible
880
+ void Visible(bool vis = true)
881
+ { visible = vis; }
882
+ bool IsVisible () const
883
+ { return visible; }
884
+
885
+ void SetRefinementFlag (bool rflag = true)
886
+ { refflag = rflag; }
887
+ bool TestRefinementFlag () const
888
+ { return refflag; }
889
+
890
+ void SetStrongRefinementFlag (bool rflag = true)
891
+ { strongrefflag = rflag; }
892
+ bool TestStrongRefinementFlag () const
893
+ { return strongrefflag; }
894
+
895
+
896
+ bool IsCurved () const { return is_curved; }
897
+ void SetCurved (bool acurved) { is_curved = acurved; }
898
+
899
+ SurfaceElementIndex NextElement() { return next; }
900
+
901
+ bool operator==(const Element2d & el2) const;
902
+
903
+ int HasFace(const Element2d& el) const;
904
+ };
905
+
906
+ DLL_HEADER ostream & operator<<(ostream & s, const Element2d & el);
907
+
908
+
909
+
910
+
911
+
912
+ class IntegrationPointData
913
+ {
914
+ public:
915
+ Point<3> p;
916
+ double weight;
917
+ Vector shape;
918
+ DenseMatrix dshape;
919
+ };
920
+
921
+
922
+
923
+
924
+
925
+
926
+
927
+
928
+ /**
929
+ Volume element
930
+ */
931
+ class Element
932
+ {
933
+ private:
934
+ /// point numbers
935
+ PointIndex pnum[ELEMENT_MAXPOINTS];
936
+ ///
937
+ ELEMENT_TYPE typ;
938
+ /// number of points (4..tet, 5..pyramid, 6..prism, 8..hex, 10..quad tet, 12..quad prism)
939
+ int8_t np;
940
+ int8_t newest_vertex = -1; // from refinement via bisection
941
+
942
+ /// sub-domain index
943
+ int index;
944
+ /// order for hp-FEM
945
+ unsigned int orderx:6;
946
+ unsigned int ordery:6;
947
+ unsigned int orderz:6;
948
+ /* unsigned int levelx:6;
949
+ unsigned int levely:6;
950
+ unsigned int levelz:6; */
951
+ /// stored shape-badness of element
952
+ float badness;
953
+ bool is_curved; // element is (high order) curved
954
+
955
+ class flagstruct {
956
+ public:
957
+ bool refflag; // mark element for refinement
958
+ bool marked:1; // marked for refinement
959
+ bool badel:1; // angles worse then limit
960
+ bool reverse:1; // for refinement a la Bey
961
+ bool illegal:1; // illegal, will be split or swapped
962
+ bool illegal_valid:1; // is illegal-flag valid ?
963
+ bool badness_valid:1; // is badness valid ?
964
+ bool strongrefflag:1;
965
+ bool deleted:1; // element is deleted, will be removed from array
966
+ bool fixed:1; // don't change element in optimization
967
+ };
968
+
969
+ flagstruct flags;
970
+ int hp_elnr;
971
+ public:
972
+
973
+ static auto GetDataLayout()
974
+ {
975
+ return std::map<string, int>({
976
+ { "pnum", offsetof(Element, pnum)},
977
+ { "index", offsetof(Element, index) },
978
+ { "np", offsetof(Element, np) },
979
+ { "refine", offsetof(Element, flags.refflag) },
980
+ { "curved", offsetof(Element, is_curved)}
981
+ });
982
+ }
983
+
984
+ ///
985
+ DLL_HEADER Element () = default;
986
+ Element (const Element &) = default;
987
+ Element (Element &&) = default;
988
+ Element & operator= (const Element &) = default;
989
+ Element & operator= (Element &&) = default;
990
+
991
+ ///
992
+ DLL_HEADER Element (int anp);
993
+ ///
994
+ DLL_HEADER Element (ELEMENT_TYPE type);
995
+ ///
996
+ // Element & operator= (const Element & el2);
997
+
998
+ const flagstruct& Flags() const { return flags; }
999
+ flagstruct& Flags() { return flags; }
1000
+
1001
+ ///
1002
+ DLL_HEADER void SetNP (int anp);
1003
+ ///
1004
+ DLL_HEADER void SetType (ELEMENT_TYPE atyp);
1005
+ ///
1006
+ int GetNP () const { return np; }
1007
+ ///
1008
+ uint8_t GetNV() const
1009
+ {
1010
+ // __assume(typ >= TET && typ <= PYRAMID13);
1011
+ switch (typ)
1012
+ {
1013
+ case TET:
1014
+ case TET10:
1015
+ return 4;
1016
+ case PRISM12:
1017
+ case PRISM15:
1018
+ case PRISM:
1019
+ return 6;
1020
+ case PYRAMID:
1021
+ case PYRAMID13:
1022
+ return 5;
1023
+ case HEX7:
1024
+ return 7;
1025
+ case HEX:
1026
+ case HEX20:
1027
+ return 8;
1028
+ default: // not a 3D element
1029
+ #ifdef DEBUG
1030
+ PrintSysError ("Element3d::GetNV not implemented for typ ", int(typ));
1031
+ #endif
1032
+ __assume(false);
1033
+ return -1;
1034
+ }
1035
+ }
1036
+
1037
+ DLL_HEADER bool operator==(const Element & el2) const;
1038
+
1039
+ // old style:
1040
+ int NP () const { return np; }
1041
+
1042
+ ///
1043
+ ELEMENT_TYPE GetType () const { return typ; }
1044
+
1045
+ ///
1046
+ PointIndex & operator[] (int i) { return pnum[i]; }
1047
+ ///
1048
+ const PointIndex & operator[] (int i) const { return pnum[i]; }
1049
+
1050
+ auto PNums () const { return FlatArray<const PointIndex> (np, &pnum[0]); }
1051
+ auto PNums () { return FlatArray<PointIndex> (np, &pnum[0]); }
1052
+ template <int NP>
1053
+ auto PNums() const { return FlatArray<const PointIndex> (NP, &pnum[0]); }
1054
+
1055
+ FlatArray<const PointIndex> Vertices() const { return { GetNV(), &pnum[0] }; }
1056
+
1057
+ ///
1058
+ PointIndex & PNum (int i) { return pnum[i-1]; }
1059
+ ///
1060
+ const PointIndex & PNum (int i) const { return pnum[i-1]; }
1061
+ ///
1062
+ PointIndex & PNumMod (int i) { return pnum[(i-1) % np]; }
1063
+ ///
1064
+ const PointIndex & PNumMod (int i) const { return pnum[(i-1) % np]; }
1065
+
1066
+ auto & NewestVertex() { return newest_vertex; }
1067
+ auto NewestVertex() const { return newest_vertex; }
1068
+
1069
+ void DoArchive (Archive & ar)
1070
+ {
1071
+ short _np, _typ;
1072
+ bool _curved;
1073
+ if (ar.Output())
1074
+ { _np = np; _typ = typ; _curved = is_curved; }
1075
+ // ar & _np & _typ & index & _curved;
1076
+ ar.DoPacked (_np, _typ, index, _curved);
1077
+
1078
+ if (ar.Input())
1079
+ {
1080
+ np = _np;
1081
+ typ = ELEMENT_TYPE(_typ);
1082
+ is_curved = _curved;
1083
+ flags.marked = 1;
1084
+ flags.badel = 0;
1085
+ flags.reverse = 0;
1086
+ flags.illegal = 0;
1087
+ flags.illegal_valid = 0;
1088
+ flags.badness_valid = 0;
1089
+ flags.refflag = 1;
1090
+ flags.strongrefflag = false;
1091
+ flags.deleted = 0;
1092
+ flags.fixed = 0;
1093
+ }
1094
+
1095
+ static_assert(sizeof(int) == sizeof (PointIndex));
1096
+ ar.Do( (int*)&pnum[0], np);
1097
+ }
1098
+
1099
+ #ifdef PARALLEL
1100
+ static NG_MPI_Datatype MyGetMPIType();
1101
+ #endif
1102
+
1103
+ ///
1104
+ void SetIndex (int si) { index = si; }
1105
+ ///
1106
+ int GetIndex () const { return index; }
1107
+
1108
+ int GetOrder () const { return orderx; }
1109
+ void SetOrder (const int aorder) ;
1110
+
1111
+ void GetOrder (int & ox, int & oy, int & oz) const { ox = orderx; oy = ordery; oz = orderz; }
1112
+ void SetOrder (const int ox, const int oy, const int oz);
1113
+ // void GetLevel (int & ox, int & oy, int & oz) const { ox = levelx; oy = levely; oz = levelz; }
1114
+ // void SetLevel (int ox, int oy, int oz) { levelx = ox; levely = oy; levelz = oz; }
1115
+
1116
+
1117
+ ///
1118
+ void GetBox (const T_POINTS & points, Box3d & box) const;
1119
+ /// Calculates Volume of element
1120
+ double Volume (const T_POINTS & points) const;
1121
+ ///
1122
+ DLL_HEADER void Print (ostream & ost) const;
1123
+ ///
1124
+ int GetNFaces () const
1125
+ {
1126
+ switch (typ)
1127
+ {
1128
+ case TET:
1129
+ case TET10: return 4;
1130
+ case PYRAMID: case PYRAMID13: return 5;
1131
+ case PRISM:
1132
+ case PRISM15:
1133
+ case PRISM12: return 5;
1134
+ case HEX7: return 6;
1135
+ case HEX: case HEX20:
1136
+ return 6;
1137
+ default:
1138
+ #ifdef DEBUG
1139
+ PrintSysError ("element3d::GetNFaces not implemented for typ", int(typ))
1140
+ #endif
1141
+ ;
1142
+ }
1143
+ return 0;
1144
+ }
1145
+ ///
1146
+ inline void GetFace (int i, Element2d & face) const;
1147
+ ///
1148
+ DLL_HEADER void GetFace2 (int i, Element2d & face) const;
1149
+ ///
1150
+ DLL_HEADER void Invert ();
1151
+
1152
+ int GetHpElnr() const { return hp_elnr; }
1153
+ void SetHpElnr(int _hp_elnr) { hp_elnr = _hp_elnr; }
1154
+
1155
+ /// split into 4 node tets
1156
+ void GetTets (NgArray<Element> & locels) const;
1157
+ /// split into 4 node tets, local point nrs
1158
+ void GetTetsLocal (NgArray<Element> & locels) const;
1159
+ /// returns coordinates of nodes
1160
+ // void GetNodesLocal (NgArray<Point<3> > & points) const;
1161
+ void GetNodesLocalNew (NgArray<Point<3> > & points) const;
1162
+
1163
+ /// split surface into 3 node trigs
1164
+ DLL_HEADER void GetSurfaceTriangles (NgArray<Element2d> & surftrigs) const;
1165
+
1166
+
1167
+ /// get number of 'integration points'
1168
+ int GetNIP () const;
1169
+ void GetIntegrationPoint (int ip, Point<3> & p, double & weight) const;
1170
+
1171
+ void GetTransformation (int ip, const T_POINTS & points,
1172
+ class DenseMatrix & trans) const;
1173
+ void GetTransformation (int ip, class DenseMatrix & pmat,
1174
+ class DenseMatrix & trans) const;
1175
+
1176
+ void GetShape (const Point<3> & p, class Vector & shape) const;
1177
+ // void GetShapeNew (const Point<3> & p, class FlatVector & shape) const;
1178
+ template <typename T>
1179
+ DLL_HEADER void GetShapeNew (const Point<3,T> & p, TFlatVector<T> shape) const;
1180
+ /// matrix 2 * np
1181
+ void GetDShape (const Point<3> & p, class DenseMatrix & dshape) const;
1182
+ template <typename T>
1183
+ void GetDShapeNew (const Point<3,T> & p, class MatrixFixWidth<3,T> & dshape) const;
1184
+ /// matrix 3 * np
1185
+ void GetPointMatrix (const T_POINTS & points,
1186
+ class DenseMatrix & pmat) const;
1187
+
1188
+ void ComputeIntegrationPointData () const;
1189
+
1190
+
1191
+ double CalcJacobianBadness (const T_POINTS & points) const;
1192
+ double CalcJacobianBadnessDirDeriv (const T_POINTS & points,
1193
+ int pi, Vec<3> & dir, double & dd) const;
1194
+ double CalcJacobianBadnessGradient (const T_POINTS & points,
1195
+ int pi, Vec<3> & grad) const;
1196
+
1197
+ ///
1198
+ // friend ostream & operator<<(ostream & s, const Element & el);
1199
+
1200
+ void SetRefinementFlag (bool rflag = 1)
1201
+ { flags.refflag = rflag; }
1202
+ int TestRefinementFlag () const
1203
+ { return flags.refflag; }
1204
+
1205
+ void SetStrongRefinementFlag (bool rflag = 1)
1206
+ { flags.strongrefflag = rflag; }
1207
+ int TestStrongRefinementFlag () const
1208
+ { return flags.strongrefflag; }
1209
+
1210
+ int Illegal () const
1211
+ {
1212
+ NETGEN_CHECK_SAME(flags.illegal_valid, true);
1213
+ return flags.illegal;
1214
+ }
1215
+ int IllegalValid () const
1216
+ { return flags.illegal_valid; }
1217
+ void SetIllegal (int aillegal)
1218
+ {
1219
+ flags.illegal = aillegal ? 1 : 0;
1220
+ flags.illegal_valid = 1;
1221
+ }
1222
+ void SetLegal (int alegal)
1223
+ {
1224
+ flags.illegal = alegal ? 0 : 1;
1225
+ flags.illegal_valid = 1;
1226
+ }
1227
+
1228
+ bool BadnessValid()
1229
+ { return flags.badness_valid; }
1230
+
1231
+ float GetBadness()
1232
+ {
1233
+ NETGEN_CHECK_SAME(flags.badness_valid, true);
1234
+ return badness;
1235
+ }
1236
+
1237
+ void SetBadness(float value)
1238
+ {
1239
+ badness = value;
1240
+ flags.badness_valid = 1;
1241
+ }
1242
+
1243
+ void Touch() {
1244
+ flags.illegal_valid = 0;
1245
+ flags.badness_valid = 0;
1246
+ }
1247
+
1248
+ void Delete () { flags.deleted = 1; }
1249
+ bool IsDeleted () const
1250
+ {
1251
+ #ifdef DEBUG
1252
+ if (pnum[0]-IndexBASE<PointIndex>() < 0 && !flags.deleted)
1253
+ cerr << "Volelement has illegal pnum, but not marked as deleted" << endl;
1254
+ #endif
1255
+
1256
+ return flags.deleted;
1257
+ }
1258
+
1259
+ bool IsCurved () const { return is_curved; }
1260
+ void SetCurved (bool acurved) { is_curved = acurved; }
1261
+
1262
+ };
1263
+
1264
+ ostream & operator<<(ostream & s, const Element & el);
1265
+
1266
+
1267
+
1268
+
1269
+
1270
+
1271
+ /**
1272
+ Edge segment.
1273
+ */
1274
+ class Segment
1275
+ {
1276
+ public:
1277
+ ///
1278
+ DLL_HEADER Segment();
1279
+ Segment (const Segment& other) = default;
1280
+
1281
+ // friend ostream & operator<<(ostream & s, const Segment & seg);
1282
+
1283
+ PointIndex pnums[3]; // p1, p2, pmid
1284
+
1285
+ int edgenr;
1286
+ ///
1287
+ double singedge_left;
1288
+ double singedge_right;
1289
+
1290
+ /// 0.. not first segment of segs, 1..first of class, 2..first of class, inverse
1291
+ unsigned int seginfo:2;
1292
+
1293
+ /// surface decoding index
1294
+ int si;
1295
+ /// co dim 2 decoding index
1296
+ int cd2i;
1297
+ /// domain number inner side
1298
+ int domin;
1299
+ /// domain number outer side
1300
+ int domout;
1301
+ /// top-level object number of surface
1302
+ int tlosurf;
1303
+ ///
1304
+ PointGeomInfo geominfo[2];
1305
+
1306
+ /// surfaces describing edge
1307
+ int surfnr1, surfnr2;
1308
+ ///
1309
+ EdgePointGeomInfo epgeominfo[2];
1310
+ ///
1311
+ // int pmid; // for second order
1312
+ ///
1313
+ int meshdocval;
1314
+
1315
+ bool is_curved;
1316
+ int hp_elnr;
1317
+ /*
1318
+ PointIndex operator[] (int i) const
1319
+ { return (i == 0) ? p1 : p2; }
1320
+
1321
+ PointIndex & operator[] (int i)
1322
+ { return (i == 0) ? p1 : p2; }
1323
+ */
1324
+
1325
+ Segment& operator=(const Segment & other) = default;
1326
+
1327
+
1328
+
1329
+ int GetNP() const
1330
+ {
1331
+ return pnums[2].IsValid() ? 3 : 2;
1332
+ }
1333
+
1334
+ auto PNums() const { return FlatArray<const PointIndex> (GetNP(), &pnums[0]); }
1335
+ auto PNums() { return FlatArray<PointIndex> (GetNP(), &pnums[0]); }
1336
+
1337
+ auto Vertices() const { return FlatArray<const PointIndex> (2, &pnums[0]); }
1338
+
1339
+ ELEMENT_TYPE GetType() const
1340
+ {
1341
+ return pnums[2].IsValid() ? SEGMENT3 : SEGMENT;
1342
+ }
1343
+
1344
+ PointIndex & operator[] (int i) { return pnums[i]; }
1345
+ const PointIndex & operator[] (int i) const { return pnums[i]; }
1346
+
1347
+
1348
+ bool IsCurved () const { return is_curved; }
1349
+ void SetCurved (bool acurved) { is_curved = acurved; }
1350
+
1351
+ void DoArchive (Archive & ar);
1352
+ #ifdef PARALLEL
1353
+ static NG_MPI_Datatype MyGetMPIType();
1354
+ #endif
1355
+
1356
+ };
1357
+
1358
+ ostream & operator<<(ostream & s, const Segment & seg);
1359
+
1360
+
1361
+ class Element0d
1362
+ {
1363
+ public:
1364
+ PointIndex pnum;
1365
+ string name;
1366
+ int index;
1367
+ Element0d () = default;
1368
+ Element0d (PointIndex _pnum, int _index)
1369
+ : pnum(_pnum), index(_index) { ; }
1370
+
1371
+ #ifdef PARALLEL
1372
+ static NG_MPI_Datatype MyGetMPIType();
1373
+ #endif
1374
+
1375
+ void DoArchive (Archive & ar);
1376
+ };
1377
+
1378
+ ostream & operator<<(ostream & s, const Element0d & el);
1379
+
1380
+ // class Surface;
1381
+ // class FaceDescriptor;
1382
+
1383
+ ///
1384
+ class FaceDescriptor
1385
+ {
1386
+ /// which surface, 0 if not available
1387
+ int surfnr;
1388
+ /// domain nr inside
1389
+ int domin;
1390
+ /// domain nr outside
1391
+ int domout;
1392
+ /// top level object number of surface
1393
+ int tlosurf;
1394
+ /// boundary condition property
1395
+ int bcprop;
1396
+ // Philippose - 06/07/2009
1397
+ // Add capability to store surface colours along with
1398
+ // other face data
1399
+ /// surface colour (Default: R=0.0 ; G=1.0 ; B=0.0)
1400
+ Vec<4> surfcolour;
1401
+
1402
+ ///
1403
+ // static string default_bcname;
1404
+ // string * bcname = &default_bcname;
1405
+ string bcname = "default";
1406
+ /// root of linked list
1407
+ SurfaceElementIndex firstelement;
1408
+
1409
+ double domin_singular;
1410
+ double domout_singular;
1411
+
1412
+ public:
1413
+ DLL_HEADER FaceDescriptor();
1414
+ DLL_HEADER FaceDescriptor(int surfnri, int domini, int domouti, int tlosurfi);
1415
+ DLL_HEADER FaceDescriptor(const Segment & seg);
1416
+ DLL_HEADER FaceDescriptor(const FaceDescriptor& other);
1417
+ DLL_HEADER ~FaceDescriptor() { ; }
1418
+
1419
+ DLL_HEADER int SegmentFits (const Segment & seg);
1420
+
1421
+ int SurfNr () const { return surfnr; }
1422
+ int DomainIn () const { return domin; }
1423
+ int DomainOut () const { return domout; }
1424
+ int TLOSurface () const { return tlosurf; }
1425
+ int BCProperty () const { return bcprop; }
1426
+
1427
+
1428
+ double DomainInSingular() const { return domin_singular; }
1429
+ double DomainOutSingular() const { return domout_singular; }
1430
+
1431
+ // Philippose - 06/07/2009
1432
+ // Get Surface colour
1433
+ Vec<4> SurfColour () const { return surfcolour; }
1434
+ /* DLL_HEADER */ const string & GetBCName () const { return bcname; }
1435
+ // string * BCNamePtr () { return bcname; }
1436
+ // const string * BCNamePtr () const { return bcname; }
1437
+ void SetSurfNr (int sn) { surfnr = sn; }
1438
+ void SetDomainIn (int di) { domin = di; }
1439
+ void SetDomainOut (int dom) { domout = dom; }
1440
+ void SetBCProperty (int bc) { bcprop = bc; }
1441
+ DLL_HEADER void SetBCName (string * bcn); // { bcname = bcn; }
1442
+ void SetBCName (const string & bcn) { bcname = bcn; }
1443
+ // Philippose - 06/07/2009
1444
+ // Set the surface colour
1445
+ void SetSurfColour (Vec<4> colour) { surfcolour = colour; }
1446
+
1447
+ void SetDomainInSingular (double v) { domin_singular = v; }
1448
+ void SetDomainOutSingular (double v) { domout_singular = v; }
1449
+
1450
+ SurfaceElementIndex FirstElement() { return firstelement; }
1451
+ // friend ostream & operator<<(ostream & s, const FaceDescriptor & fd);
1452
+ friend class Mesh;
1453
+
1454
+ void DoArchive (Archive & ar);
1455
+ };
1456
+
1457
+ ostream & operator<< (ostream & s, const FaceDescriptor & fd);
1458
+
1459
+
1460
+
1461
+ class EdgeDescriptor
1462
+ {
1463
+ int tlosurf;
1464
+ int surfnr[2];
1465
+ public:
1466
+ EdgeDescriptor ()
1467
+ : tlosurf(-1)
1468
+ { surfnr[0] = surfnr[1] = -1; }
1469
+
1470
+ int SurfNr (int i) const { return surfnr[i]; }
1471
+ void SetSurfNr (int i, int nr) { surfnr[i] = nr; }
1472
+
1473
+ int TLOSurface() const { return tlosurf; }
1474
+ void SetTLOSurface (int nr) { tlosurf = nr; }
1475
+ };
1476
+
1477
+
1478
+ struct BoundaryLayerParameters
1479
+ {
1480
+ std::variant<double, std::vector<double>> thickness;
1481
+ std::variant<string, int, std::vector<int>> domain;
1482
+ std::variant<string, int, std::vector<int>> boundary = ".*";
1483
+ std::optional<std::variant<string, std::map<string, string>>> new_material = nullopt;
1484
+ std::optional<std::variant<string, std::vector<int>>> project_boundaries = nullopt;
1485
+ bool outside = false;
1486
+ bool grow_edges = true;
1487
+ bool limit_growth_vectors = false; // automatic reduction of layer thickness to avoid intersections
1488
+ std::optional<bool> sides_keep_surfaceindex = nullopt; // !outside by default
1489
+ bool disable_curving = true; // disable curving affected boundaries/edges (could lead to self-intersecting volume elements)
1490
+ };
1491
+
1492
+
1493
+ ostream & operator<< (ostream & ost, const BoundaryLayerParameters & mp);
1494
+
1495
+ class DLL_HEADER MeshingParameters
1496
+ {
1497
+ public:
1498
+ /**
1499
+ 3d optimization strategy:
1500
+ // m .. move nodes
1501
+ // M .. move nodes, cheap functional
1502
+ // s .. swap faces
1503
+ // c .. combine elements
1504
+ // d .. divide elements
1505
+ // D .. divide and join opposite edges, remove element
1506
+ // p .. plot, no pause
1507
+ // P .. plot, Pause
1508
+ // h .. Histogramm, no pause
1509
+ // H .. Histogramm, pause
1510
+ */
1511
+ string optimize3d = "cmdDmustm";
1512
+ /// number of 3d optimization steps
1513
+ int optsteps3d = 3;
1514
+ /**
1515
+ 2d optimization strategy:
1516
+ // s .. swap, opt 6 lines/node
1517
+ // S .. swap, optimal elements
1518
+ // m .. move nodes
1519
+ // p .. plot, no pause
1520
+ // P .. plot, pause
1521
+ // c .. combine
1522
+ **/
1523
+ string optimize2d = "smcmSmcmSmcm";
1524
+ /// number of 2d optimization steps
1525
+ int optsteps2d = 3;
1526
+ /// power of error (to approximate max err optimization)
1527
+ double opterrpow = 2;
1528
+ /// do block filling ?
1529
+ bool blockfill = true;
1530
+ /// block filling up to distance
1531
+ double filldist = 0.1;
1532
+ /// radius of local environment (times h)
1533
+ double safety = 5;
1534
+ /// radius of active environment (times h)
1535
+ double relinnersafety = 3;
1536
+ /// use local h ?
1537
+ bool uselocalh = true;
1538
+ /// grading for local h
1539
+ double grading = 0.3;
1540
+ /// use delaunay for 3d meshing
1541
+ bool delaunay = true;
1542
+ /// use delaunay for 2d meshing
1543
+ bool delaunay2d = false;
1544
+ /// maximal mesh size
1545
+ double maxh = 1e10;
1546
+ /// minimal mesh size
1547
+ double minh = 0.0;
1548
+ /// file for meshsize
1549
+ string meshsizefilename = "";
1550
+ /// restrict h based on close edges
1551
+ optional<double> closeedgefac = nullopt;
1552
+ /// start surfacemeshing from everywhere in surface
1553
+ bool startinsurface = false;
1554
+ /// check overlapping surfaces (debug)
1555
+ bool checkoverlap = true;
1556
+ /// check overlapping surface mesh before volume meshing
1557
+ bool checkoverlappingboundary = true;
1558
+ /// check chart boundary (sometimes too restrictive)
1559
+ bool checkchartboundary = true;
1560
+ /// safety factor for curvatures (elements per radius)
1561
+ double curvaturesafety = 2;
1562
+ /// minimal number of segments per edge
1563
+ double segmentsperedge = 1;
1564
+ /// use parallel threads
1565
+ bool parthread = 0;
1566
+ /// weight of element size w.r.t element shape
1567
+ double elsizeweight = 0.2;
1568
+ /// init with default values
1569
+
1570
+ /// start at step
1571
+ int perfstepsstart = 0;
1572
+ /// end at step
1573
+ int perfstepsend = 6;
1574
+
1575
+
1576
+ /// from mp3:
1577
+ /// give up quality class, 2d meshing
1578
+ int giveuptol2d = 200;
1579
+ /// give up quality class, 3d meshing
1580
+ int giveuptol = 10;
1581
+ /// give up quality class for closing open quads, > 100 for
1582
+ /// free pyramids
1583
+ int giveuptolopenquads = 15;
1584
+ /// maximal outer steps
1585
+ int maxoutersteps = 10;
1586
+ /// class starting star-shape filling
1587
+ int starshapeclass = 5;
1588
+ /// if non-zero, baseelement must have baseelnp points
1589
+ int baseelnp = 0;
1590
+ /// quality tolerances are handled less careful
1591
+ int sloppy = 1;
1592
+
1593
+ /// limit for max element angle (150-180)
1594
+ double badellimit = 175;
1595
+
1596
+ bool check_impossible = false;
1597
+
1598
+ int only3D_domain_nr = 0;
1599
+
1600
+ ///
1601
+ bool secondorder = false;
1602
+ /// high order element curvature
1603
+ int elementorder = 1;
1604
+ /// quad-dominated surface meshing
1605
+ bool quad = false;
1606
+ ///
1607
+ bool try_hexes = false;
1608
+ ///
1609
+ bool inverttets = false;
1610
+ ///
1611
+ bool inverttrigs = false;
1612
+ ///
1613
+ bool autozrefine = false;
1614
+
1615
+ bool parallel_meshing = true;
1616
+ int nthreads = 4;
1617
+
1618
+ Flags geometrySpecificParameters;
1619
+
1620
+ Array<BoundaryLayerParameters> boundary_layers;
1621
+ ///
1622
+ MeshingParameters ();
1623
+ ///
1624
+ MeshingParameters (const MeshingParameters & mp2) = default;
1625
+ MeshingParameters (MeshingParameters && mp2) = default;
1626
+ MeshingParameters & operator= (const MeshingParameters & mp2) = default;
1627
+ MeshingParameters & operator= (MeshingParameters && mp2) = default;
1628
+ ///
1629
+ void Print (ostream & ost) const;
1630
+ ///
1631
+ // void CopyFrom(const MeshingParameters & other);
1632
+
1633
+ class MeshSizePoint
1634
+ {
1635
+ public:
1636
+ Point<3> pnt;
1637
+ double h;
1638
+ int layer = 1;
1639
+ MeshSizePoint (Point<3> pnt_, double h_, int layer_ = 1) : pnt(pnt_), h(h_), layer(layer_) { ; }
1640
+ MeshSizePoint () = default;
1641
+ MeshSizePoint (const MeshSizePoint &) = default;
1642
+ MeshSizePoint (MeshSizePoint &&) = default;
1643
+ MeshSizePoint & operator= (const MeshSizePoint &) = default;
1644
+ MeshSizePoint & operator= (MeshSizePoint &&) = default;
1645
+ };
1646
+ NgArray<MeshSizePoint> meshsize_points;
1647
+
1648
+ void (*render_function)(bool) = NULL;
1649
+ void Render(bool blocking = false) const
1650
+ {
1651
+ if (render_function)
1652
+ (*render_function)(blocking);
1653
+ }
1654
+ };
1655
+
1656
+ inline ostream & operator<< (ostream & ost, const MeshingParameters & mp)
1657
+ {
1658
+ mp.Print (ost);
1659
+ return ost;
1660
+ }
1661
+
1662
+ class DebugParameters
1663
+ {
1664
+ public:
1665
+ ///
1666
+ int debugoutput;
1667
+ /// use slow checks
1668
+ int slowchecks;
1669
+ ///
1670
+ int haltsuccess;
1671
+ ///
1672
+ int haltnosuccess;
1673
+ ///
1674
+ int haltlargequalclass;
1675
+ ///
1676
+ int haltsegment;
1677
+ ///
1678
+ int haltnode;
1679
+ ///
1680
+ PointIndex haltsegmentp1;
1681
+ ///
1682
+ PointIndex haltsegmentp2;
1683
+ ///
1684
+ int haltexistingline;
1685
+ ///
1686
+ int haltoverlap;
1687
+ ///
1688
+ int haltface;
1689
+ ///
1690
+ int haltfacenr;
1691
+ ///
1692
+ bool write_mesh_on_error;
1693
+ ///
1694
+ DebugParameters ();
1695
+ };
1696
+
1697
+
1698
+
1699
+
1700
+ inline void Element2d :: Invert()
1701
+ {
1702
+ if (typ == TRIG)
1703
+ Swap (PNum(2), PNum(3));
1704
+ else
1705
+ Invert2();
1706
+ }
1707
+
1708
+
1709
+
1710
+
1711
+ inline void Element2d :: NormalizeNumbering ()
1712
+ {
1713
+ if (GetNP() == 3)
1714
+ {
1715
+ if (PNum(1) < PNum(2) && PNum(1) < PNum(3))
1716
+ return;
1717
+ else
1718
+ {
1719
+ if (PNum(2) < PNum(3))
1720
+ {
1721
+ PointIndex pi1 = PNum(2);
1722
+ PNum(2) = PNum(3);
1723
+ PNum(3) = PNum(1);
1724
+ PNum(1) = pi1;
1725
+ }
1726
+ else
1727
+ {
1728
+ PointIndex pi1 = PNum(3);
1729
+ PNum(3) = PNum(2);
1730
+ PNum(2) = PNum(1);
1731
+ PNum(1) = pi1;
1732
+ }
1733
+ }
1734
+ }
1735
+ else
1736
+ NormalizeNumbering2();
1737
+ }
1738
+
1739
+
1740
+
1741
+ static const int gftetfacesa[4][3] =
1742
+ { { 1, 2, 3 },
1743
+ { 2, 0, 3 },
1744
+ { 0, 1, 3 },
1745
+ { 1, 0, 2 } };
1746
+
1747
+ inline void Element :: GetFace (int i, Element2d & face) const
1748
+ {
1749
+ if (typ == TET)
1750
+ {
1751
+ face.SetType(TRIG);
1752
+ face[0] = pnum[gftetfacesa[i-1][0]];
1753
+ face[1] = pnum[gftetfacesa[i-1][1]];
1754
+ face[2] = pnum[gftetfacesa[i-1][2]];
1755
+ }
1756
+ else
1757
+ GetFace2 (i, face);
1758
+ }
1759
+
1760
+
1761
+
1762
+ // typedef NgArray<PointIndex,PointIndex::BASE> idmap_type;
1763
+ typedef Array<PointIndex,PointIndex> idmap_type;
1764
+
1765
+
1766
+
1767
+ /**
1768
+ Identification of periodic surfaces, close surfaces, etc.
1769
+ */
1770
+ class Identifications
1771
+ {
1772
+ public:
1773
+ enum ID_TYPE : unsigned char { UNDEFINED = 1, PERIODIC = 2, CLOSESURFACES = 3, CLOSEEDGES = 4};
1774
+
1775
+
1776
+ private:
1777
+ class Mesh & mesh;
1778
+
1779
+ /// identify points (thin layers, periodic b.c.)
1780
+ // INDEX_2_HASHTABLE<int> identifiedpoints;
1781
+ ClosedHashTable<PointIndices<2>, int> identifiedpoints;
1782
+
1783
+ /// the same, with info about the id-nr
1784
+ // INDEX_3_HASHTABLE<int> identifiedpoints_nr;
1785
+ ClosedHashTable<std::tuple<PointIndices<2>, int>, int> identifiedpoints_nr;
1786
+
1787
+ /// sorted by identification nr
1788
+ TABLE<PointIndices<2>> idpoints_table;
1789
+
1790
+ NgArray<ID_TYPE> type;
1791
+
1792
+ /// number of identifications (or, actually used identifications ?)
1793
+ int maxidentnr;
1794
+ Array<string> names;
1795
+
1796
+ public:
1797
+ ///
1798
+ DLL_HEADER Identifications (class Mesh & amesh);
1799
+ ///
1800
+ DLL_HEADER ~Identifications ();
1801
+
1802
+ DLL_HEADER void Delete ();
1803
+
1804
+ /*
1805
+ Identify points pi1 and pi2, due to
1806
+ identification nr identnr
1807
+ */
1808
+ DLL_HEADER void Add (PointIndex pi1, PointIndex pi2, int identnr);
1809
+ void Add (PointIndex pi1, PointIndex pi2, string name, ID_TYPE type)
1810
+ {
1811
+ auto nr = GetNr(name);
1812
+ Add(pi1, pi2, nr);
1813
+ SetType(nr, type);
1814
+ }
1815
+
1816
+ int Get (PointIndex pi1, PointIndex pi2) const;
1817
+ int GetSymmetric (PointIndex pi1, PointIndex pi2) const;
1818
+
1819
+ bool Get (PointIndex pi1, PointIndex pi2, int identnr) const;
1820
+ bool GetSymmetric (PointIndex pi1, PointIndex pi2, int identnr) const;
1821
+
1822
+ // bool HasIdentifiedPoints() const { return identifiedpoints != nullptr; }
1823
+ ///
1824
+ auto & GetIdentifiedPoints ()
1825
+ {
1826
+ return identifiedpoints_nr;
1827
+ }
1828
+
1829
+ bool Used (PointIndex pi1, PointIndex pi2)
1830
+ {
1831
+ // return identifiedpoints.Used (INDEX_2 (pi1, pi2));
1832
+ return identifiedpoints.Used (PointIndices<2>(pi1, pi2));
1833
+ }
1834
+
1835
+ bool UsedSymmetric (PointIndex pi1, PointIndex pi2)
1836
+ {
1837
+ return
1838
+ identifiedpoints.Used (PointIndices<2>(pi1, pi2)) ||
1839
+ identifiedpoints.Used (PointIndices<2>(pi2, pi1));
1840
+ }
1841
+
1842
+ ///
1843
+ void GetMap (int identnr, idmap_type & identmap, bool symmetric = false) const;
1844
+ ///
1845
+ ID_TYPE GetType(int identnr) const
1846
+ {
1847
+ if(identnr <= type.Size())
1848
+ return type[identnr-1];
1849
+ else
1850
+ return UNDEFINED;
1851
+ }
1852
+ void SetType(int identnr, ID_TYPE t)
1853
+ {
1854
+ while(type.Size() < identnr)
1855
+ type.Append(UNDEFINED);
1856
+ type[identnr-1] = t;
1857
+ }
1858
+
1859
+ ///
1860
+ DLL_HEADER void GetPairs (int identnr, NgArray<INDEX_2> & identpairs) const;
1861
+ DLL_HEADER Array<INDEX_3> GetPairs () const;
1862
+ ///
1863
+ int GetMaxNr () const { return maxidentnr; }
1864
+
1865
+ int GetNr(string name)
1866
+ {
1867
+ if(!names.Contains(name))
1868
+ names.Append(name);
1869
+ return names.Pos(name)+1;
1870
+ }
1871
+ string GetName(int nr) const
1872
+ {
1873
+ if (nr <= names.Size())
1874
+ return names[nr - 1];
1875
+ else
1876
+ return "";
1877
+ }
1878
+ void SetName(int nr, string name)
1879
+ {
1880
+ while(names.Size() < nr)
1881
+ names.Append("");
1882
+ names[nr-1] = name;
1883
+ }
1884
+
1885
+ /// remove secondorder
1886
+ void SetMaxPointNr (int maxpnum);
1887
+
1888
+ void MapPoints(FlatArray<PointIndex, PointIndex> op2np);
1889
+
1890
+ DLL_HEADER void Print (ostream & ost) const;
1891
+
1892
+ void DoArchive (Archive & ar);
1893
+ };
1894
+ }
1895
+
1896
+
1897
+ #ifdef PARALLEL
1898
+ namespace ngcore
1899
+ {
1900
+ template <> struct MPI_typetrait<netgen::PointIndex> {
1901
+ static NG_MPI_Datatype MPIType () { return NG_MPI_INT; }
1902
+ };
1903
+
1904
+ template <> struct MPI_typetrait<netgen::ELEMENT_TYPE> {
1905
+ static NG_MPI_Datatype MPIType () { return NG_MPI_CHAR; }
1906
+ };
1907
+
1908
+ template <> struct MPI_typetrait<netgen::MeshPoint> {
1909
+ static NG_MPI_Datatype MPIType () { return netgen::MeshPoint::MyGetMPIType(); }
1910
+ };
1911
+
1912
+ template <> struct MPI_typetrait<netgen::Element> {
1913
+ static NG_MPI_Datatype MPIType () { return netgen::Element::MyGetMPIType(); }
1914
+ };
1915
+ template <> struct MPI_typetrait<netgen::Element2d> {
1916
+ static NG_MPI_Datatype MPIType () { return netgen::Element2d::MyGetMPIType(); }
1917
+ };
1918
+ template <> struct MPI_typetrait<netgen::Segment> {
1919
+ static NG_MPI_Datatype MPIType () { return netgen::Segment::MyGetMPIType(); }
1920
+ };
1921
+ template <> struct MPI_typetrait<netgen::Element0d> {
1922
+ static NG_MPI_Datatype MPIType () { return netgen::Element0d::MyGetMPIType(); }
1923
+ };
1924
+
1925
+ }
1926
+ #endif
1927
+
1928
+
1929
+ #endif
1930
+