ENH: add missing construct GeometricField from primitive field (tmp)

ENH: improvements for GeometricBoundaryField evaluation

- early termination from evaluate_if() and evaluateCoupled().

- evaluateCoupled() now forwards to evaluate_if() and receives
  additional handling for a 'void' parameter type.

BREAKING: extra template parameter for overset correctBoundaryCondition

- the true/false flag as a template parameter instead of as an
  argument to use 'if constexpr' code
This commit is contained in:
Mark Olesen
2025-05-28 09:22:05 +02:00
parent 1d6c77f8f4
commit d6e6450834
18 changed files with 362 additions and 470 deletions

View File

@ -39,79 +39,17 @@ License
// GeometricField<Type, fvPatchField, volMesh>& fld
//) const
//{
// auto& fldBf = fld.boundaryFieldRef();
//
// const UPstream::commsTypes commsType = UPstream::defaultCommsType;
// const label startOfRequests = UPstream::nRequests();
//
// if
// fld.boundaryFieldRef().evaluate_if
// (
// commsType == UPstream::commsTypes::blocking
// || commsType == UPstream::commsTypes::nonBlocking
// )
// {
// forAll(fldBf, patchi)
// [](const auto& pfld) -> bool
// {
// fvPatchField<Type>& tgtField = fldBf[patchi];
//
// if
// return
// (
// tgtField.type() == tgtField.patch().patch().type()
// && polyPatch::constraintType(tgtField.patch().patch().type())
// )
// {
// tgtField.initEvaluate(commsType);
// }
// pfld.type() == pfld.patch().patch().type()
// && polyPatch::constraintType(pfld.patch().patch().type())
// );
// }
//
// // Wait for outstanding requests
// if (commsType == UPstream::commsTypes::nonBlocking)
// {
// UPstream::waitRequests(startOfRequests);
// }
//
// forAll(fldBf, patchi)
// {
// fvPatchField<Type>& tgtField = fldBf[patchi];
//
// if
// (
// tgtField.type() == tgtField.patch().patch().type()
// && polyPatch::constraintType(tgtField.patch().patch().type())
// )
// {
// tgtField.evaluate(commsType);
// }
// }
// }
// else if (commsType == UPstream::commsTypes::scheduled)
// {
// const lduSchedule& patchSchedule =
// fld.mesh().globalData().patchSchedule();
//
// for (const auto& schedEval : patchSchedule)
// {
// const label patchi = schedEval.patch;
//
// fvPatchField<Type>& tgtField = fldBf[patchi];
//
// if
// (
// tgtField.type() == tgtField.patch().patch().type()
// && polyPatch::constraintType(tgtField.patch().patch().type())
// )
// {
// if (schedEval.init)
// {
// tgtField.initEvaluate(commsType);
// }
// else
// {
// tgtField.evaluate(commsType);
// }
// }
// }
// }
// );
//}
template<class Type>

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2025 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -36,72 +36,18 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes
GeometricField<Type, fvPatchField, volMesh>& fld
) const
{
auto& bfld = fld.boundaryFieldRef();
const UPstream::commsTypes commsType = UPstream::defaultCommsType;
if
fld.boundaryFieldRef().evaluate_if
(
commsType == UPstream::commsTypes::buffered
|| commsType == UPstream::commsTypes::nonBlocking
)
{
const label startOfRequests = UPstream::nRequests();
for (auto& pfld : bfld)
[](const auto& pfld) -> bool
{
if
return
(
pfld.type() == pfld.patch().patch().type()
&& polyPatch::constraintType(pfld.patch().patch().type())
)
{
pfld.initEvaluate(commsType);
}
}
// Wait for outstanding requests (non-blocking)
UPstream::waitRequests(startOfRequests);
for (auto& pfld : bfld)
{
if
(
pfld.type() == pfld.patch().patch().type()
&& polyPatch::constraintType(pfld.patch().patch().type())
)
{
pfld.evaluate(commsType);
}
}
}
else if (commsType == UPstream::commsTypes::scheduled)
{
const lduSchedule& patchSchedule =
fld.mesh().globalData().patchSchedule();
for (const auto& schedEval : patchSchedule)
{
const label patchi = schedEval.patch;
auto& pfld = bfld[patchi];
if
(
pfld.type() == pfld.patch().patch().type()
&& polyPatch::constraintType(pfld.patch().patch().type())
)
{
if (schedEval.init)
{
pfld.initEvaluate(commsType);
}
else
{
pfld.evaluate(commsType);
}
}
}
}
);
},
UPstream::defaultCommsType
);
}