netgen-mesher 6.2.2504.post11.dev0__cp313-cp313-win_amd64.whl → 6.2.2506.post48.dev0__cp313-cp313-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 (153) hide show
  1. netgen/__init__.pyi +3 -3
  2. netgen/cmake/NetgenConfig.cmake +10 -9
  3. netgen/config/__init__.pyi +8 -8
  4. netgen/config/config.py +7 -7
  5. netgen/config/config.pyi +8 -8
  6. netgen/include/core/archive.hpp +18 -3
  7. netgen/include/core/array.hpp +20 -4
  8. netgen/include/core/autodiff.hpp +9 -11
  9. netgen/include/core/autodiffdiff.hpp +0 -2
  10. netgen/include/core/bitarray.hpp +1 -1
  11. netgen/include/core/flags.hpp +1 -1
  12. netgen/include/core/hashtable.hpp +1 -1
  13. netgen/include/core/memtracer.hpp +7 -7
  14. netgen/include/core/ngcore.hpp +5 -0
  15. netgen/include/core/ngcore_api.hpp +11 -0
  16. netgen/include/core/paje_trace.hpp +9 -8
  17. netgen/include/core/profiler.hpp +5 -5
  18. netgen/include/core/register_archive.hpp +8 -0
  19. netgen/include/core/simd.hpp +69 -1
  20. netgen/include/core/simd_arm64.hpp +205 -1
  21. netgen/include/core/simd_avx.hpp +72 -4
  22. netgen/include/core/simd_avx512.hpp +9 -0
  23. netgen/include/core/simd_generic.hpp +274 -8
  24. netgen/include/core/simd_math.hpp +178 -0
  25. netgen/include/core/simd_sse.hpp +11 -1
  26. netgen/include/core/statushandler.hpp +37 -0
  27. netgen/include/core/table.hpp +3 -2
  28. netgen/include/core/taskmanager.hpp +34 -1
  29. netgen/include/core/utils.hpp +3 -8
  30. netgen/include/include/netgen_version.hpp +4 -4
  31. netgen/include/meshing/basegeom.hpp +1 -4
  32. netgen/include/meshing/global.hpp +0 -17
  33. netgen/include/meshing/hpref_tet.hpp +41 -0
  34. netgen/include/meshing/hprefinement.hpp +2 -0
  35. netgen/include/meshing/meshtype.hpp +2 -1
  36. netgen/include/meshing/msghandler.hpp +9 -6
  37. netgen/include/meshing/topology.hpp +2 -2
  38. netgen/include/nginterface.h +3 -2
  39. netgen/include/occ/occ_utils.hpp +26 -0
  40. netgen/include/occ/occgeom.hpp +8 -0
  41. netgen/include/pybind11/attr.h +40 -8
  42. netgen/include/pybind11/buffer_info.h +14 -14
  43. netgen/include/pybind11/cast.h +553 -29
  44. netgen/include/pybind11/chrono.h +4 -1
  45. netgen/include/pybind11/conduit/README.txt +15 -0
  46. netgen/include/pybind11/conduit/pybind11_conduit_v1.h +116 -0
  47. netgen/include/pybind11/conduit/pybind11_platform_abi_id.h +87 -0
  48. netgen/include/pybind11/conduit/wrap_include_python_h.h +72 -0
  49. netgen/include/pybind11/critical_section.h +56 -0
  50. netgen/include/pybind11/detail/class.h +172 -97
  51. netgen/include/pybind11/detail/common.h +270 -189
  52. netgen/include/pybind11/detail/cpp_conduit.h +75 -0
  53. netgen/include/pybind11/detail/descr.h +55 -0
  54. netgen/include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h +39 -0
  55. netgen/include/pybind11/detail/exception_translation.h +71 -0
  56. netgen/include/pybind11/detail/function_record_pyobject.h +191 -0
  57. netgen/include/pybind11/detail/init.h +113 -9
  58. netgen/include/pybind11/detail/internals.h +479 -344
  59. netgen/include/pybind11/detail/native_enum_data.h +209 -0
  60. netgen/include/pybind11/detail/pybind11_namespace_macros.h +82 -0
  61. netgen/include/pybind11/detail/struct_smart_holder.h +378 -0
  62. netgen/include/pybind11/detail/type_caster_base.h +506 -133
  63. netgen/include/pybind11/detail/using_smart_holder.h +22 -0
  64. netgen/include/pybind11/detail/value_and_holder.h +90 -0
  65. netgen/include/pybind11/eigen/matrix.h +19 -10
  66. netgen/include/pybind11/eigen/tensor.h +15 -11
  67. netgen/include/pybind11/embed.h +50 -46
  68. netgen/include/pybind11/eval.h +11 -6
  69. netgen/include/pybind11/functional.h +58 -49
  70. netgen/include/pybind11/gil.h +34 -82
  71. netgen/include/pybind11/gil_safe_call_once.h +12 -1
  72. netgen/include/pybind11/gil_simple.h +37 -0
  73. netgen/include/pybind11/native_enum.h +67 -0
  74. netgen/include/pybind11/numpy.h +272 -93
  75. netgen/include/pybind11/pybind11.h +947 -265
  76. netgen/include/pybind11/pytypes.h +127 -21
  77. netgen/include/pybind11/stl/filesystem.h +23 -25
  78. netgen/include/pybind11/stl.h +277 -59
  79. netgen/include/pybind11/stl_bind.h +42 -7
  80. netgen/include/pybind11/subinterpreter.h +299 -0
  81. netgen/include/pybind11/trampoline_self_life_support.h +65 -0
  82. netgen/include/pybind11/typing.h +177 -4
  83. netgen/include/pybind11/warnings.h +75 -0
  84. netgen/include/visualization/mvdraw.hpp +48 -12
  85. netgen/include/visualization/vssolution.hpp +3 -1
  86. netgen/lib/libnggui.lib +0 -0
  87. netgen/lib/ngcore.lib +0 -0
  88. netgen/lib/nglib.lib +0 -0
  89. netgen/libnggui.dll +0 -0
  90. netgen/libngguipy.pyd +0 -0
  91. netgen/libngpy/_NgOCC.pyi +224 -139
  92. netgen/libngpy/_csg.pyi +26 -26
  93. netgen/libngpy/_geom2d.pyi +34 -25
  94. netgen/libngpy/_meshing.pyi +262 -111
  95. netgen/libngpy/_stl.pyi +3 -4
  96. netgen/libngpy.pyd +0 -0
  97. netgen/ngcore.dll +0 -0
  98. netgen/nglib.dll +0 -0
  99. netgen/read_gmsh.py +41 -0
  100. netgen/togl.dll +0 -0
  101. netgen/version.py +1 -1
  102. netgen/webgui.py +38 -2
  103. {netgen_mesher-6.2.2504.post11.dev0.dist-info → netgen_mesher-6.2.2506.post48.dev0.dist-info}/METADATA +2 -1
  104. {netgen_mesher-6.2.2504.post11.dev0.dist-info → netgen_mesher-6.2.2506.post48.dev0.dist-info}/RECORD +153 -132
  105. pyngcore/pyngcore.cp313-win_amd64.pyd +0 -0
  106. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/boundarycondition.geo +0 -0
  107. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/boxcyl.geo +0 -0
  108. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/circle_on_cube.geo +0 -0
  109. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cone.geo +0 -0
  110. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cube.geo +0 -0
  111. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cubeandring.geo +0 -0
  112. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cubeandspheres.geo +0 -0
  113. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cubemcyl.geo +0 -0
  114. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cubemsphere.geo +0 -0
  115. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cylinder.geo +0 -0
  116. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cylsphere.geo +0 -0
  117. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/doc/ng4.pdf +0 -0
  118. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/ellipsoid.geo +0 -0
  119. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/ellipticcyl.geo +0 -0
  120. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/extrusion.geo +0 -0
  121. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/fichera.geo +0 -0
  122. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/frame.step +0 -0
  123. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/hinge.stl +0 -0
  124. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/lshape3d.geo +0 -0
  125. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/manyholes.geo +0 -0
  126. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/manyholes2.geo +0 -0
  127. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/matrix.geo +0 -0
  128. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/ortho.geo +0 -0
  129. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/part1.stl +0 -0
  130. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/period.geo +0 -0
  131. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/py_tutorials/exportNeutral.py +0 -0
  132. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/py_tutorials/mesh.py +0 -0
  133. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/py_tutorials/shaft.geo +0 -0
  134. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/revolution.geo +0 -0
  135. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/screw.step +0 -0
  136. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/sculpture.geo +0 -0
  137. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/shaft.geo +0 -0
  138. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/shell.geo +0 -0
  139. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/sphere.geo +0 -0
  140. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/sphereincube.geo +0 -0
  141. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/square.in2d +0 -0
  142. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/squarecircle.in2d +0 -0
  143. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/squarehole.in2d +0 -0
  144. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/torus.geo +0 -0
  145. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/trafo.geo +0 -0
  146. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/twobricks.geo +0 -0
  147. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/twocubes.geo +0 -0
  148. {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/twocyl.geo +0 -0
  149. {netgen_mesher-6.2.2504.post11.dev0.dist-info → netgen_mesher-6.2.2506.post48.dev0.dist-info}/AUTHORS +0 -0
  150. {netgen_mesher-6.2.2504.post11.dev0.dist-info → netgen_mesher-6.2.2506.post48.dev0.dist-info}/LICENSE +0 -0
  151. {netgen_mesher-6.2.2504.post11.dev0.dist-info → netgen_mesher-6.2.2506.post48.dev0.dist-info}/WHEEL +0 -0
  152. {netgen_mesher-6.2.2504.post11.dev0.dist-info → netgen_mesher-6.2.2506.post48.dev0.dist-info}/entry_points.txt +0 -0
  153. {netgen_mesher-6.2.2504.post11.dev0.dist-info → netgen_mesher-6.2.2506.post48.dev0.dist-info}/top_level.txt +0 -0
@@ -94,10 +94,14 @@ namespace ngcore
94
94
  NGCORE_API void StartWorkers();
95
95
  NGCORE_API void StopWorkers();
96
96
 
97
- void SuspendWorkers(int asleep_usecs = 1000 )
97
+ bool IsSleeping() const { return sleep; }
98
+
99
+ int SuspendWorkers(int asleep_usecs = 1000 )
98
100
  {
101
+ int old_sleep_usecs = sleep_usecs;
99
102
  sleep_usecs = asleep_usecs;
100
103
  sleep = true;
104
+ return old_sleep_usecs;
101
105
  }
102
106
  void ResumeWorkers() { sleep = false; }
103
107
 
@@ -179,6 +183,35 @@ namespace ngcore
179
183
  }
180
184
  };
181
185
 
186
+ class SuspendTaskManager
187
+ {
188
+ int old_sleep_usecs = 0;
189
+ bool old_sleep = false;
190
+ TaskManager * tm = nullptr;
191
+
192
+ public:
193
+ SuspendTaskManager(int asleep_usecs=1000)
194
+ : tm(task_manager)
195
+ {
196
+ if(!tm)
197
+ return;
198
+
199
+ old_sleep = tm->IsSleeping();
200
+ old_sleep_usecs = tm->SuspendWorkers(asleep_usecs);
201
+ }
202
+
203
+ ~SuspendTaskManager()
204
+ {
205
+ if(!tm)
206
+ return;
207
+
208
+ if(old_sleep) // restore old sleep time
209
+ tm->SuspendWorkers(old_sleep_usecs);
210
+ else
211
+ tm->ResumeWorkers();
212
+ }
213
+ };
214
+
182
215
  NETGEN_INLINE int TasksPerThread (int tpt)
183
216
  {
184
217
  // return task_manager ? tpt*task_manager->GetNumThreads() : 1;
@@ -63,18 +63,13 @@ namespace ngcore
63
63
 
64
64
  inline TTimePoint GetTimeCounter() noexcept
65
65
  {
66
- #if defined(__APPLE__) && defined(NETGEN_ARCH_ARM64)
67
- return mach_absolute_time();
68
- #elif defined(NETGEN_ARCH_AMD64)
66
+ #if defined(NETGEN_ARCH_AMD64)
69
67
  return __rdtsc();
70
- #elif defined(NETGEN_ARCH_ARM64) && defined(__GNUC__)
71
- // __GNUC__ is also defined by CLANG. Use inline asm to read Generic Timer
68
+ #elif defined(NETGEN_ARCH_ARM64)
72
69
  unsigned long long tics;
73
70
  __asm __volatile("mrs %0, CNTVCT_EL0" : "=&r" (tics));
74
71
  return tics;
75
- #elif defined(__EMSCRIPTEN__)
76
- return std::chrono::high_resolution_clock::now().time_since_epoch().count();
77
- #elif defined(_MSC_VER) && defined(_M_ARM64)
72
+ #elif defined(__EMSCRIPTEN__) || (defined(_MSC_VER) && defined(_M_ARM64))
78
73
  return std::chrono::high_resolution_clock::now().time_since_epoch().count();
79
74
  #else
80
75
  #warning "Unsupported CPU architecture"
@@ -1,9 +1,9 @@
1
1
  #ifndef NETGEN_VERSION_HPP_INCLUDED
2
2
  #define NETGEN_VERSION_HPP_INCLUDED
3
- #define NETGEN_VERSION "6.2.2504-11-gfea644ae"
3
+ #define NETGEN_VERSION "6.2.2506-48-g8263c0bc"
4
4
  #define NETGEN_VERSION_MAJOR 6
5
5
  #define NETGEN_VERSION_MINOR 2
6
- #define NETGEN_VERSION_PATCH 2504
7
- #define NETGEN_VERSION_TWEAK 11
8
- #define NETGEN_VERSION_HASH "gfea644ae"
6
+ #define NETGEN_VERSION_PATCH 2506
7
+ #define NETGEN_VERSION_TWEAK 48
8
+ #define NETGEN_VERSION_HASH "g8263c0bc"
9
9
  #endif // NETGEN_VERSION_HPP_INCLUDED
@@ -42,10 +42,7 @@ namespace netgen
42
42
  string GetName() const { return name ? *name : "default"; }
43
43
  Vec<4> GetColor() { return col ? *col : Vec<4>{0., 1., 0., 1.}; }
44
44
 
45
- void DoArchive(Archive& ar)
46
- {
47
- ar & name & col & maxh & hpref & layer;
48
- }
45
+ void DoArchive(Archive& ar);
49
46
  };
50
47
 
51
48
  class GeometryShape;
@@ -31,23 +31,6 @@ namespace netgen
31
31
 
32
32
  DLL_HEADER extern mutex tcl_todo_mutex;
33
33
 
34
- class DLL_HEADER multithreadt
35
- {
36
- public:
37
- int pause;
38
- int testmode;
39
- int redraw;
40
- int drawing;
41
- int terminate;
42
- int running;
43
- double percent;
44
- const char * task;
45
- bool demorunning;
46
- string * tcl_todo = new string(""); // tcl commands set from parallel thread
47
- multithreadt();
48
- };
49
-
50
- DLL_HEADER extern volatile multithreadt multithread;
51
34
 
52
35
  class DebugParameters;
53
36
  class Mesh;
@@ -4184,6 +4184,47 @@ HPRef_Struct reftet_3f_0e_0v =
4184
4184
 
4185
4185
 
4186
4186
 
4187
+
4188
+ // HP_TET_ALFELD
4189
+ int reftet_Alfeld_splitedges[][3] =
4190
+ {
4191
+ { 0, 0, 0 }
4192
+ };
4193
+ int reftet_Alfeld_splitfaces[][4] =
4194
+ {
4195
+ { 0, 0, 0, 0 }
4196
+ };
4197
+
4198
+ int reftet_Alfeld_splitelements[][5] =
4199
+ {
4200
+ { 1, 2, 3, 4, 5},
4201
+ { 0 }
4202
+ };
4203
+
4204
+ HPREF_ELEMENT_TYPE reftet_Alfeld_newelstypes[] =
4205
+ {
4206
+ HP_TET, HP_TET, HP_TET, HP_TET,
4207
+ HP_NONE,
4208
+ };
4209
+
4210
+ int reftet_Alfeld_newels[][8] =
4211
+ {
4212
+ { 1, 2, 3, 5 },
4213
+ { 1, 4, 2, 5 },
4214
+ { 1, 3, 4, 5 },
4215
+ { 3, 2, 4, 5 }
4216
+ };
4217
+ HPRef_Struct reftet_Alfeld =
4218
+ {
4219
+ HP_TET,
4220
+ reftet_Alfeld_splitedges,
4221
+ reftet_Alfeld_splitfaces,
4222
+ reftet_Alfeld_splitelements,
4223
+ reftet_Alfeld_newelstypes,
4224
+ reftet_Alfeld_newels
4225
+ };
4226
+
4227
+
4187
4228
  /*
4188
4229
 
4189
4230
  */
@@ -189,6 +189,8 @@ enum HPREF_ELEMENT_TYPE {
189
189
 
190
190
  HP_TET_3F_0E_0V = 700, // 3 singular faces, no additional points or edges NEW done
191
191
 
192
+ HP_TET_ALFELD,
193
+
192
194
  HP_PRISM = 1000,
193
195
  HP_PRISM_SINGEDGE,
194
196
  HP_PRISM_SINGEDGE_V12,
@@ -903,7 +903,7 @@ namespace netgen
903
903
  int HasFace(const Element2d& el) const;
904
904
  };
905
905
 
906
- ostream & operator<<(ostream & s, const Element2d & el);
906
+ DLL_HEADER ostream & operator<<(ostream & s, const Element2d & el);
907
907
 
908
908
 
909
909
 
@@ -1334,6 +1334,7 @@ namespace netgen
1334
1334
  auto PNums() const { return FlatArray<const PointIndex> (GetNP(), &pnums[0]); }
1335
1335
  auto PNums() { return FlatArray<PointIndex> (GetNP(), &pnums[0]); }
1336
1336
 
1337
+ auto Vertices() const { return FlatArray<const PointIndex> (2, &pnums[0]); }
1337
1338
 
1338
1339
  ELEMENT_TYPE GetType() const
1339
1340
  {
@@ -45,13 +45,16 @@ namespace netgen
45
45
  const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8="");
46
46
  extern DLL_HEADER void PrintTime(const MyStr& s1="", const MyStr& s2="", const MyStr& s3="", const MyStr& s4="",
47
47
  const MyStr& s5="", const MyStr& s6="", const MyStr& s7="", const MyStr& s8="");
48
- extern DLL_HEADER void SetStatMsg(const MyStr& s);
49
48
 
50
- extern DLL_HEADER void PushStatus(const MyStr& s);
51
- extern DLL_HEADER void PushStatusF(const MyStr& s);
52
- extern DLL_HEADER void PopStatus();
53
- extern DLL_HEADER void SetThreadPercent(double percent);
54
- extern DLL_HEADER void GetStatus(MyStr & s, double & percentage);
49
+
50
+
51
+
52
+ inline void PushStatusF(const std::string& s)
53
+ {
54
+ PushStatus (s);
55
+ PrintFnStart(s);
56
+ }
57
+
55
58
  }
56
59
 
57
60
 
@@ -390,7 +390,7 @@ inline short int MeshTopology :: GetNEdges (ELEMENT_TYPE et)
390
390
  // default:
391
391
  // cerr << "Ng_ME_GetNEdges, illegal element type " << et << endl;
392
392
  }
393
- return -99;
393
+ return 0;
394
394
  }
395
395
 
396
396
 
@@ -431,7 +431,7 @@ inline short int MeshTopology :: GetNFaces (ELEMENT_TYPE et)
431
431
  return 6;
432
432
 
433
433
  default:
434
- return -99;
434
+ return 0;
435
435
  // default:
436
436
  // cerr << "Ng_ME_GetNVertices, illegal element type " << et << endl;
437
437
  }
@@ -353,10 +353,11 @@ extern "C" {
353
353
 
354
354
  DLL_HEADER void RunParallel ( void * (*fun)(void *), void * in);
355
355
 
356
- DLL_HEADER void Ng_PushStatus (const char * str);
356
+ #define NG_STATUS_USES_STD_STRING
357
+ DLL_HEADER void Ng_PushStatus (const std::string& str);
357
358
  DLL_HEADER void Ng_PopStatus ();
358
359
  DLL_HEADER void Ng_SetThreadPercentage (double percent);
359
- DLL_HEADER void Ng_GetStatus (char ** str, double & percent);
360
+ DLL_HEADER void Ng_GetStatus (std::string& str, double & percent);
360
361
 
361
362
  DLL_HEADER void Ng_SetTerminate(void);
362
363
  DLL_HEADER void Ng_UnSetTerminate(void);
@@ -71,6 +71,20 @@ namespace netgen
71
71
  return gp_Pnt(p(0), p(1), p(2));
72
72
  }
73
73
 
74
+ inline void CheckValidPropertyType(const TopoDS_Shape & shape)
75
+ {
76
+ switch (shape.ShapeType())
77
+ {
78
+ case TopAbs_SOLID:
79
+ case TopAbs_FACE:
80
+ case TopAbs_EDGE:
81
+ case TopAbs_VERTEX:
82
+ break;
83
+ default:
84
+ throw Exception("Cannot query properties of compound shapes - setting properties sets property on all highest dimension subshape type");
85
+ }
86
+ }
87
+
74
88
  DLL_HEADER Box<3> GetBoundingBox( const TopoDS_Shape & shape );
75
89
 
76
90
  struct OCCIdentification
@@ -152,6 +166,10 @@ namespace netgen
152
166
  {
153
167
  return SubShapes(TopAbs_SOLID);
154
168
  }
169
+ ListOfShapes Shells() const
170
+ {
171
+ return SubShapes(TopAbs_SHELL);
172
+ }
155
173
  ListOfShapes Faces() const
156
174
  {
157
175
  return SubShapes(TopAbs_FACE);
@@ -199,6 +217,14 @@ namespace netgen
199
217
  return sub;
200
218
  }
201
219
 
220
+ inline ListOfShapes GetShells(const TopoDS_Shape & shape)
221
+ {
222
+ ListOfShapes sub;
223
+ for (TopExp_Explorer e(shape, TopAbs_SHELL); e.More(); e.Next())
224
+ sub.push_back(e.Current());
225
+ return sub;
226
+ }
227
+
202
228
  inline ListOfShapes GetFaces(const TopoDS_Shape & shape)
203
229
  {
204
230
  ListOfShapes sub;
@@ -146,6 +146,14 @@ namespace netgen
146
146
 
147
147
  static ShapeProperties& GetProperties(const TopoDS_Shape& shape)
148
148
  {
149
+ try
150
+ {
151
+ CheckValidPropertyType(shape);
152
+ }
153
+ catch(Exception& e)
154
+ {
155
+ cerr << "WARNING: " << e.what() << endl;
156
+ }
149
157
  auto index = OCCGeometry::global_shape_property_indices.FindIndex(shape);
150
158
  if(index > 0)
151
159
  return OCCGeometry::global_shape_properties
@@ -12,6 +12,7 @@
12
12
 
13
13
  #include "detail/common.h"
14
14
  #include "cast.h"
15
+ #include "trampoline_self_life_support.h"
15
16
 
16
17
  #include <functional>
17
18
 
@@ -81,6 +82,10 @@ struct dynamic_attr {};
81
82
  /// Annotation which enables the buffer protocol for a type
82
83
  struct buffer_protocol {};
83
84
 
85
+ /// Annotation which enables releasing the GIL before calling the C++ destructor of wrapped
86
+ /// instances (pybind/pybind11#1446).
87
+ struct release_gil_before_calling_cpp_dtor {};
88
+
84
89
  /// Annotation which requests that a special metaclass is created for a type
85
90
  struct metaclass {
86
91
  handle value;
@@ -188,6 +193,7 @@ struct argument_record {
188
193
 
189
194
  /// Internal data structure which holds metadata about a bound function (signature, overloads,
190
195
  /// etc.)
196
+ #define PYBIND11_DETAIL_FUNCTION_RECORD_ABI_ID "v1" // PLEASE UPDATE if the struct is changed.
191
197
  struct function_record {
192
198
  function_record()
193
199
  : is_constructor(false), is_new_style_constructor(false), is_stateless(false),
@@ -267,12 +273,18 @@ struct function_record {
267
273
  /// Pointer to next overload
268
274
  function_record *next = nullptr;
269
275
  };
276
+ // The main purpose of this macro is to make it easy to pin-point the critically related code
277
+ // sections.
278
+ #define PYBIND11_ENSURE_PRECONDITION_FOR_FUNCTIONAL_H_PERFORMANCE_OPTIMIZATIONS(...) \
279
+ static_assert( \
280
+ __VA_ARGS__, \
281
+ "Violation of precondition for pybind11/functional.h performance optimizations!")
270
282
 
271
283
  /// Special data structure which (temporarily) holds metadata about a bound class
272
284
  struct type_record {
273
285
  PYBIND11_NOINLINE type_record()
274
286
  : multiple_inheritance(false), dynamic_attr(false), buffer_protocol(false),
275
- default_holder(true), module_local(false), is_final(false) {}
287
+ module_local(false), is_final(false), release_gil_before_calling_cpp_dtor(false) {}
276
288
 
277
289
  /// Handle to the parent scope
278
290
  handle scope;
@@ -301,6 +313,12 @@ struct type_record {
301
313
  /// Function pointer to class_<..>::dealloc
302
314
  void (*dealloc)(detail::value_and_holder &) = nullptr;
303
315
 
316
+ /// Function pointer for casting alias class (aka trampoline) pointer to
317
+ /// trampoline_self_life_support pointer. Sidesteps cross-DSO RTTI issues
318
+ /// on platforms like macOS (see PR #5728 for details).
319
+ get_trampoline_self_life_support_fn get_trampoline_self_life_support
320
+ = [](void *) -> trampoline_self_life_support * { return nullptr; };
321
+
304
322
  /// List of base classes of the newly created type
305
323
  list bases;
306
324
 
@@ -322,15 +340,17 @@ struct type_record {
322
340
  /// Does the class implement the buffer protocol?
323
341
  bool buffer_protocol : 1;
324
342
 
325
- /// Is the default (unique_ptr) holder type used?
326
- bool default_holder : 1;
327
-
328
343
  /// Is the class definition local to the module shared object?
329
344
  bool module_local : 1;
330
345
 
331
346
  /// Is the class inheritable from python classes?
332
347
  bool is_final : 1;
333
348
 
349
+ /// Solves pybind/pybind11#1446
350
+ bool release_gil_before_calling_cpp_dtor : 1;
351
+
352
+ holder_enum_t holder_enum_v = holder_enum_t::undefined;
353
+
334
354
  PYBIND11_NOINLINE void add_base(const std::type_info &base, void *(*caster)(void *) ) {
335
355
  auto *base_info = detail::get_type_info(base, false);
336
356
  if (!base_info) {
@@ -340,18 +360,22 @@ struct type_record {
340
360
  + "\" referenced unknown base type \"" + tname + "\"");
341
361
  }
342
362
 
343
- if (default_holder != base_info->default_holder) {
363
+ // SMART_HOLDER_BAKEIN_FOLLOW_ON: Refine holder compatibility checks.
364
+ bool this_has_unique_ptr_holder = (holder_enum_v == holder_enum_t::std_unique_ptr);
365
+ bool base_has_unique_ptr_holder
366
+ = (base_info->holder_enum_v == holder_enum_t::std_unique_ptr);
367
+ if (this_has_unique_ptr_holder != base_has_unique_ptr_holder) {
344
368
  std::string tname(base.name());
345
369
  detail::clean_type_id(tname);
346
370
  pybind11_fail("generic_type: type \"" + std::string(name) + "\" "
347
- + (default_holder ? "does not have" : "has")
371
+ + (this_has_unique_ptr_holder ? "does not have" : "has")
348
372
  + " a non-default holder type while its base \"" + tname + "\" "
349
- + (base_info->default_holder ? "does not" : "does"));
373
+ + (base_has_unique_ptr_holder ? "does not" : "does"));
350
374
  }
351
375
 
352
376
  bases.append((PyObject *) base_info->type);
353
377
 
354
- #if PY_VERSION_HEX < 0x030B0000
378
+ #ifdef PYBIND11_BACKWARD_COMPATIBILITY_TP_DICTOFFSET
355
379
  dynamic_attr |= base_info->type->tp_dictoffset != 0;
356
380
  #else
357
381
  dynamic_attr |= (base_info->type->tp_flags & Py_TPFLAGS_MANAGED_DICT) != 0;
@@ -603,6 +627,14 @@ struct process_attribute<module_local> : process_attribute_default<module_local>
603
627
  static void init(const module_local &l, type_record *r) { r->module_local = l.value; }
604
628
  };
605
629
 
630
+ template <>
631
+ struct process_attribute<release_gil_before_calling_cpp_dtor>
632
+ : process_attribute_default<release_gil_before_calling_cpp_dtor> {
633
+ static void init(const release_gil_before_calling_cpp_dtor &, type_record *r) {
634
+ r->release_gil_before_calling_cpp_dtor = true;
635
+ }
636
+ };
637
+
606
638
  /// Process a 'prepend' attribute, putting this at the beginning of the overload chain
607
639
  template <>
608
640
  struct process_attribute<prepend> : process_attribute_default<prepend> {
@@ -102,22 +102,22 @@ struct buffer_info {
102
102
  template <typename T>
103
103
  buffer_info(const T *ptr, ssize_t size, bool readonly = true)
104
104
  : buffer_info(
105
- const_cast<T *>(ptr), sizeof(T), format_descriptor<T>::format(), size, readonly) {}
105
+ const_cast<T *>(ptr), sizeof(T), format_descriptor<T>::format(), size, readonly) {}
106
106
 
107
107
  explicit buffer_info(Py_buffer *view, bool ownview = true)
108
108
  : buffer_info(
109
- view->buf,
110
- view->itemsize,
111
- view->format,
112
- view->ndim,
113
- {view->shape, view->shape + view->ndim},
114
- /* Though buffer::request() requests PyBUF_STRIDES, ctypes objects
115
- * ignore this flag and return a view with NULL strides.
116
- * When strides are NULL, build them manually. */
117
- view->strides
118
- ? std::vector<ssize_t>(view->strides, view->strides + view->ndim)
119
- : detail::c_strides({view->shape, view->shape + view->ndim}, view->itemsize),
120
- (view->readonly != 0)) {
109
+ view->buf,
110
+ view->itemsize,
111
+ view->format,
112
+ view->ndim,
113
+ {view->shape, view->shape + view->ndim},
114
+ /* Though buffer::request() requests PyBUF_STRIDES, ctypes objects
115
+ * ignore this flag and return a view with NULL strides.
116
+ * When strides are NULL, build them manually. */
117
+ view->strides
118
+ ? std::vector<ssize_t>(view->strides, view->strides + view->ndim)
119
+ : detail::c_strides({view->shape, view->shape + view->ndim}, view->itemsize),
120
+ (view->readonly != 0)) {
121
121
  // NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
122
122
  this->m_view = view;
123
123
  // NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
@@ -176,7 +176,7 @@ private:
176
176
  detail::any_container<ssize_t> &&strides_in,
177
177
  bool readonly)
178
178
  : buffer_info(
179
- ptr, itemsize, format, ndim, std::move(shape_in), std::move(strides_in), readonly) {}
179
+ ptr, itemsize, format, ndim, std::move(shape_in), std::move(strides_in), readonly) {}
180
180
 
181
181
  Py_buffer *m_view = nullptr;
182
182
  bool ownview = false;