mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Propogated binary op for inter-region comms to region model
This commit is contained in:
@ -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
|
||||
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user