pTraits: Added nan (not-a-number) to floating point types

This commit is contained in:
Will Bainbridge
2023-11-15 13:23:39 +00:00
parent 7afc28270a
commit 4ce4b5b0f9
44 changed files with 156 additions and 129 deletions

View File

@ -137,10 +137,6 @@ void rDistributeTgtAddressing
List<DynamicList<label>>& tgtLocalSrcFaces
);
//- Return a primitive with all components set to NaN
template<class Type>
static Type NaN();
//- Interpolate with normalisation
template<class Type, class LabelList, class ScalarList>
static tmp<Field<Type>> interpolate

View File

@ -82,20 +82,6 @@ void Foam::patchToPatchTools::rDistributeListList
}
template<class Type>
Type Foam::patchToPatchTools::NaN()
{
Type result;
for (direction cmpt = 0; cmpt < pTraits<Type>::nComponents; cmpt++)
{
setComponent(result, cmpt) = Foam::NaN;
}
return result;
}
template<class Type, class LabelList, class ScalarList>
Foam::tmp<Foam::Field<Type>> Foam::patchToPatchTools::interpolate
(
@ -116,7 +102,10 @@ Foam::tmp<Foam::Field<Type>> Foam::patchToPatchTools::interpolate
otherMapPtr.valid() ? tLocalOtherFld() : otherFld;
// Allocate the result
tmp<Field<Type>> tFld(new Field<Type>(localOtherFaces.size(), NaN<Type>()));
tmp<Field<Type>> tFld
(
new Field<Type>(localOtherFaces.size(), pTraits<Type>::nan)
);
Field<Type>& fld = tFld.ref();
// Compute the result as a weighted sum
@ -163,7 +152,10 @@ Foam::tmp<Foam::Field<Type>> Foam::patchToPatchTools::interpolate
otherMapPtr.valid() ? tLocalOtherFld() : otherFld;
// Allocate the result
tmp<Field<Type>> tFld(new Field<Type>(localOtherFaces.size(), NaN<Type>()));
tmp<Field<Type>> tFld
(
new Field<Type>(localOtherFaces.size(), pTraits<Type>::nan)
);
Field<Type>& fld = tFld.ref();
// Compute the result as a weighted sum