Skip to content
Snippets Groups Projects
Commit 385248c5 authored by andy's avatar andy
Browse files

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

parent 24b949f5
Branches
Tags
No related merge requests found
......@@ -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);
}
// ************************************************************************* //
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment