Named constant for failed vswf index remap

This commit is contained in:
Marek Nečada 2022-06-23 19:42:55 +03:00
parent 1659588196
commit 6b89feed70
3 changed files with 7 additions and 3 deletions

View File

@ -882,7 +882,9 @@ qpms_errno_t qpms_tmatrix_axialsym_fill(
// R now contains -T^T.
for(size_t i1 = 0; i1 < bspec->n; ++i1)
for(size_t i2 = 0; i2 < bspec->n; ++i2) {
if (reindex[i1] == ~(size_t) 0 && reindex[i2] == ~(size_t) 0) QPMS_WTF;
if (reindex[i1] == QPMS_VSWF_SET_REINDEX_UNMAPPED &&
reindex[i2] == QPMS_VSWF_SET_REINDEX_UNMAPPED)
QPMS_WTF;
const size_t it = i1 * bspec->n + i2;
const size_t iQR = reindex[i1] + reindex[i2] * bspecQR->n;
t->m[it] = -R[iQR];

View File

@ -134,7 +134,7 @@ size_t *qpms_vswf_set_reindex(const qpms_vswf_set_spec_t *small, const qpms_vswf
if(big_pairs[bi].ui == small_pairs[si].ui)
r[small_pairs[si].i_orig] = big_pairs[bi].i_orig;
else
r[small_pairs[si].i_orig] = ~(size_t)0;
r[small_pairs[si].i_orig] = QPMS_VSWF_SET_REINDEX_UNMAPPED;
}
free(small_pairs);

View File

@ -65,12 +65,14 @@ static inline ssize_t qpms_vswf_set_spec_find_uvswfi(const qpms_vswf_set_spec_t
* It's not lossless if the two bspecs contain different combinations of waves.
*
* Preferably, big->ilist contains everything small->ilist does.
* If small->ilist[i] is not found in big->ilist, r[i] will be set to ~(size_t)0.
* If small->ilist[i] is not found in big->ilist, r[i] will be set to
* \ref QPMS_VSWF_SET_REINDEX_UNMAPPED = ~(size_t)0.
*
* Discard with free() after use.
*/
size_t *qpms_vswf_set_reindex(const qpms_vswf_set_spec_t *small, const qpms_vswf_set_spec_t *big);
static const size_t QPMS_VSWF_SET_REINDEX_UNMAPPED = ~(size_t)0;
/// Evaluates a set of VSWF basis functions at a given point.
/** The list of basis wave indices is specified in \a setspec;