fvPatchField: Rationalised autoMap

This commit is contained in:
Henry Weller
2019-05-03 13:06:45 +01:00
parent 722e2f5673
commit b8e15e24b1

View File

@ -210,59 +210,7 @@ void Foam::fvPatchField<Type>::autoMap
const fvPatchFieldMapper& mapper
)
{
Field<Type>& f = *this;
if (!this->size() && !mapper.distributed())
{
f.setSize(mapper.size());
if (f.size())
{
f = this->patchInternalField();
}
}
else
{
// Map all faces provided with mapping data
mapper(*this, *this);
// For unmapped faces set to internal field value (zero-gradient)
if (mapper.hasUnmapped())
{
Field<Type> pif(this->patchInternalField());
if
(
mapper.direct()
&& notNull(mapper.directAddressing())
&& mapper.directAddressing().size()
)
{
const labelList& mapAddressing = mapper.directAddressing();
forAll(mapAddressing, i)
{
if (mapAddressing[i] < 0)
{
f[i] = pif[i];
}
}
}
else if (!mapper.direct() && mapper.addressing().size())
{
const labelListList& mapAddressing = mapper.addressing();
forAll(mapAddressing, i)
{
const labelList& localAddrs = mapAddressing[i];
if (!localAddrs.size())
{
f[i] = pif[i];
}
}
}
}
}
mapper(*this, *this);
}