71template<
class T>
class UList;
83 static bool switchFpe_;
87 static bool switchNan_;
90 static bool sigActive_;
93 static bool nanActive_;
99 static void sigHandler(
int);
102 template<
class FloatType>
103 inline static void fill_with_NaN(FloatType* buf,
size_t count)
108 std::numeric_limits<FloatType>::signaling_NaN();
114 std::fill_n(buf, count, val);
150 bool old(nanActive_);
157 static void set(
bool verbose=
false);
160 static void unset(
bool verbose=
false);
170 reinterpret_cast<Foam::scalar*
>(buf),
171 (count/
sizeof(Foam::scalar))
178 static void fillNan(
char* buf,
size_t count)
182 reinterpret_cast<Foam::scalar*
>(buf),
183 (count/
sizeof(Foam::scalar))
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Helper to locally ignore SIGFPE handling.
ignore()
Constructor deactivates any previously active SIGFPE handler.
ignore(const ignore &)=delete
No copy construct.
~ignore()
Destructor restores the original state of SIGFPE handler.
ignore(ignore &&)=delete
No move construct.
void operator=(const ignore &)=delete
No copy assignment.
void operator=(ignore &&)=delete
No move assignment.
void reset()
Restore the original state of SIGFPE handler.
void restore()
Same as reset().
static void unset(bool verbose=false)
Deactivate SIGFPE handler and NaN memory initialisation.
static void set(bool verbose=false)
Activate SIGFPE handler when FOAM_SIGFPE is enabled. Activate fill memory with signaling_NaN when FOA...
~sigFpe()
Destructor calls unset() to deactivate the FPE signal handler as required.
static void fillNan(UList< double > &list)
Fill data block with (double) signaling_NaN values.
static bool requested()
Check if SIGFPE signals handler is to be enabled.
static void fillNan(UList< float > &list)
Fill data block with (float) signaling_NaN values.
static bool nanActive(bool on) noexcept
Set NaN memory initialisation on/off.
static bool nanActive() noexcept
True if NaN memory initialisation is currently active.
static bool active() noexcept
True if SIGFPE handling is currently active.
static void fillNan(char *buf, size_t count)
Fill data block with signaling_NaN values. Does a reinterpret to Foam::scalar.
static void fillNan_if(void *buf, size_t count)
Fill data block with signaling_NaN values if nanActive(). Does a reinterpret to Foam::scalar.
sigFpe()
Constructor calls set() to activate the FPE signal handler if it was was not previously activate and ...
Typedefs for float/double/scalar without requiring scalar.H.