![]() |
OpenPFC
0.1.4
Phase Field Crystal simulation framework
|
NaN detection and debugging utilities. More...
#include <cmath>#include <iostream>#include <mpi.h>#include <vector>
Go to the source code of this file.
Macros | |
| #define | CHECK_AND_ABORT_IF_NAN(value) |
| #define | CHECK_AND_ABORT_IF_NANS(vec) |
Functions | |
| template<typename T > | |
| bool | pfc::utils::hasNaNs (const std::vector< T > &vec) |
| template<typename T > | |
| void | pfc::utils::abortIfNaN (T value, const char *filename, int line) |
| template<typename T > | |
| void | pfc::utils::abortIfNaNs (const std::vector< T > &vec, const char *filename, int line) |
NaN detection and debugging utilities.
This header provides macros and functions for detecting NaN (Not-a-Number) values in floating-point computations, useful for debugging numerical issues.
Key features:
NaN checks are disabled by default for performance. Enable with: cmake -DNAN_CHECK_ENABLED=ON
| void pfc::utils::abortIfNaNs | ( | const std::vector< T > & | vec, |
| const char * | filename, | ||
| int | line | ||
| ) |
Checks if there are any NaNs in a vector of floats and aborts the MPI application if NaNs are detected. Prints an error message indicating the process rank where NaNs were found before aborting.
| vec | The vector of floats to check. |


| bool pfc::utils::hasNaNs | ( | const std::vector< T > & | vec | ) |
Checks if there are any NaNs in a vector of floats.
| vec | The vector of floats to check. |

