Don't be quiet when loading a NAN-containing t-matrix

Former-commit-id: 71d3c1573b073e3edbd7693ca5848633be279998
This commit is contained in:
Marek Nečada 2019-06-19 12:47:31 +03:00
parent d8ebbd1f0a
commit 692f4ffe1f
2 changed files with 11 additions and 1 deletions

View File

@ -79,7 +79,9 @@ typedef unsigned long long qpms_uvswfi_t;
typedef enum { typedef enum {
QPMS_SUCCESS = 0, ///< Success. QPMS_SUCCESS = 0, ///< Success.
QPMS_ERROR = 1, ///< Unspecified error. QPMS_ERROR = 1, ///< Unspecified error.
QPMS_ENOMEM = 8 ///< Out of memory. QPMS_ENOMEM = 8, ///< Out of memory.
QPMS_NAN_ENCOUNTERED = 1024 ///< NaN value encountered in data processing.
} qpms_errno_t; } qpms_errno_t;

View File

@ -454,6 +454,14 @@ qpms_errno_t qpms_load_scuff_tmatrix(
"Could not open T-matrix file %s", path); "Could not open T-matrix file %s", path);
qpms_errno_t retval = qpms_errno_t retval =
qpms_read_scuff_tmatrix(f, bs, n, freqs, freqs_su, tmatrices_array, tmdata); qpms_read_scuff_tmatrix(f, bs, n, freqs, freqs_su, tmatrices_array, tmdata);
for (size_t i = 0; i < *n * bs->n * bs->n; ++i)
if(isnan(creal((*tmdata)[i])) || isnan(cimag((*tmdata)[i]))) {
QPMS_WARN("Encountered NAN in a loaded T-matrix");
retval |= QPMS_NAN_ENCOUNTERED;
break;
}
if(fclose(f)) qpms_pr_error_at_line(__FILE__, __LINE__, __func__, if(fclose(f)) qpms_pr_error_at_line(__FILE__, __LINE__, __func__,
"Could not close the T-matrix file %s (well, that's weird, " "Could not close the T-matrix file %s (well, that's weird, "
"since it's read only).", path); "since it's read only).", path);