ENH: Propogated binary op for inter-region comms to region model

This commit is contained in:
andy
2011-10-07 10:21:02 +01:00
parent 24b949f549
commit 385248c5bf
2 changed files with 83 additions and 0 deletions

View File

@ -231,6 +231,24 @@ public:
List<Type>& primaryFieldField
) const;
//- Convert a local region field to the primary region with op
template<class Type, class BinaryOp>
void toPrimary
(
const label regionPatchI,
List<Type>& regionField,
const BinaryOp& bop
) const;
//- Convert a primary region field to the local region with op
template<class Type, class BinaryOp>
void toRegion
(
const label regionPatchI,
List<Type>& primaryFieldField,
const BinaryOp& bop
) const;
// Evolution

View File

@ -77,4 +77,69 @@ void Foam::regionModels::regionModel::toRegion
}
template<class Type, class BinaryOp>
void Foam::regionModels::regionModel::toPrimary
(
const label regionPatchI,
List<Type>& regionField,
const BinaryOp& bop
) const
{
forAll(intCoupledPatchIDs_, i)
{
if (intCoupledPatchIDs_[i] == regionPatchI)
{
const mappedPatchBase& mpb =
refCast<const mappedPatchBase>
(
regionMesh().boundaryMesh()[regionPatchI]
);
mpb.reverseDistribute(regionField, bop);
return;
}
}
FatalErrorIn
(
"const void toPrimary"
"("
"const label, "
"List<Type>&, "
"const BinaryOp&"
") const"
) << "Region patch ID " << regionPatchI << " not found in region mesh"
<< abort(FatalError);
}
template<class Type, class BinaryOp>
void Foam::regionModels::regionModel::toRegion
(
const label regionPatchI,
List<Type>& primaryField,
const BinaryOp& bop
) const
{
forAll(intCoupledPatchIDs_, i)
{
if (intCoupledPatchIDs_[i] == regionPatchI)
{
const mappedPatchBase& mpb =
refCast<const mappedPatchBase>
(
regionMesh().boundaryMesh()[regionPatchI]
);
mpb.distribute(primaryField, bop);
return;
}
}
FatalErrorIn
(
"const void toRegion(const label, List<Type>&, const BinaryOp&) const"
) << "Region patch ID " << regionPatchI << " not found in region mesh"
<< abort(FatalError);
}
// ************************************************************************* //