blob: 82c1cc21d93334b2adc0d40c372af1174971e21f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
|