summaryrefslogtreecommitdiffstats
path: root/contrib/python/contourpy/src/util.cpp
diff options
context:
space:
mode:
authorzverevgeny <[email protected]>2025-05-13 19:00:02 +0300
committerzverevgeny <[email protected]>2025-05-13 19:13:54 +0300
commit92e06374736aa28637dc0e706455b65c8268a5e6 (patch)
tree3df370c199ae25d308e542f02af20f43eab78f8a /contrib/python/contourpy/src/util.cpp
parentdc63d5794da99c2ebe3f32914d0351d9707660b0 (diff)
Import matplotlib
commit_hash:d59c2338025ef8fd1e1f961ed9d8d5fd52d0bd96
Diffstat (limited to 'contrib/python/contourpy/src/util.cpp')
-rw-r--r--contrib/python/contourpy/src/util.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/contrib/python/contourpy/src/util.cpp b/contrib/python/contourpy/src/util.cpp
new file mode 100644
index 00000000000..82c1cc21d93
--- /dev/null
+++ b/contrib/python/contourpy/src/util.cpp
@@ -0,0 +1,30 @@
+#include "util.h"
+#include <cmath>
+#include <thread>
+
+namespace contourpy {
+
+bool Util::_nan_loaded = false;
+
+double Util::nan = 0.0;
+
+void Util::ensure_nan_loaded()
+{
+ if (!_nan_loaded) {
+ auto numpy = py::module_::import("numpy");
+ nan = numpy.attr("nan").cast<double>();
+ _nan_loaded = true;
+ }
+}
+
+index_t Util::get_max_threads()
+{
+ return static_cast<index_t>(std::thread::hardware_concurrency());
+}
+
+bool Util::is_nan(double value)
+{
+ return std::isnan(value);
+}
+
+} // namespace contourpy