ENH: add GeometricBoundaryField evaluateCoupled method (#2436)

- allows restricted evaluation to specific coupled patch types.
  Code relocated/refactored from redistributePar.

STYLE: ensure use of waitRequests() also corresponds to nonBlocking

ENH: additional copy/move construct GeometricField from DimensionedField

STYLE: processorPointPatch owner()/neighbour() as per processorPolyPatch

STYLE: orientedType with bool cast operator and noexcept
This commit is contained in:
Mark Olesen
2022-04-21 21:50:48 +02:00
parent 7bdd355ef7
commit b68193088c
36 changed files with 515 additions and 292 deletions

View File

@ -948,84 +948,10 @@ void correctCoupledBoundaryConditions(fvMesh& mesh)
mesh.objectRegistry::lookupClass<GeoField>() mesh.objectRegistry::lookupClass<GeoField>()
); );
forAllIters(flds, iter) for (const word& fldName : flds.sortedToc())
{ {
GeoField& fld = *iter(); GeoField& fld = *(flds[fldName]);
fld.boundaryFieldRef().template evaluateCoupled<CoupledPatchType>();
typename GeoField::Boundary& bfld = fld.boundaryFieldRef();
if
(
Pstream::defaultCommsType == Pstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
)
{
const label nReq = Pstream::nRequests();
forAll(bfld, patchi)
{
auto& pfld = bfld[patchi];
const auto& fvp = mesh.boundary()[patchi];
const auto* ppPtr = isA<CoupledPatchType>(fvp);
if (ppPtr && ppPtr->coupled())
{
pfld.initEvaluate(Pstream::defaultCommsType);
}
}
// Block for any outstanding requests
if
(
Pstream::parRun()
&& Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking
)
{
Pstream::waitRequests(nReq);
}
for (auto& pfld : bfld)
{
const auto& fvp = pfld.patch();
const auto* ppPtr = isA<CoupledPatchType>(fvp);
if (ppPtr && ppPtr->coupled())
{
pfld.evaluate(Pstream::defaultCommsType);
}
}
}
else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled)
{
const lduSchedule& patchSchedule =
fld.mesh().globalData().patchSchedule();
for (const auto& schedEval : patchSchedule)
{
const label patchi = schedEval.patch;
const auto& fvp = mesh.boundary()[patchi];
auto& pfld = bfld[patchi];
const auto* ppPtr = isA<CoupledPatchType>(fvp);
if (ppPtr && ppPtr->coupled())
{
if (schedEval.init)
{
pfld.initEvaluate(Pstream::commsTypes::scheduled);
}
else
{
pfld.evaluate(Pstream::commsTypes::scheduled);
}
}
}
}
else
{
FatalErrorInFunction
<< "Unsupported communications type "
<< Pstream::commsTypeNames[Pstream::defaultCommsType]
<< exit(FatalError);
}
} }
} }

View File

@ -41,16 +41,17 @@ namespace Foam
template<class Type> template<class Type>
void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld) void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
{ {
typename GeometricField<Type, fvPatchField, volMesh>:: auto& fldBf = fld.boundaryFieldRef();
Boundary& fldBf = fld.boundaryFieldRef();
const UPstream::commsTypes commsType(UPstream::defaultCommsType);
if if
( (
Pstream::defaultCommsType == Pstream::commsTypes::blocking commsType == UPstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking || commsType == UPstream::commsTypes::nonBlocking
) )
{ {
const label nReq = Pstream::nRequests(); const label startOfRequests = UPstream::nRequests();
forAll(fldBf, patchi) forAll(fldBf, patchi)
{ {
@ -62,18 +63,18 @@ void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
&& polyPatch::constraintType(tgtField.patch().patch().type()) && polyPatch::constraintType(tgtField.patch().patch().type())
) )
{ {
tgtField.initEvaluate(Pstream::defaultCommsType); tgtField.initEvaluate(commsType);
} }
} }
// Block for any outstanding requests // Wait for outstanding requests
if if
( (
Pstream::parRun() UPstream::parRun()
&& Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking && commsType == UPstream::commsTypes::nonBlocking
) )
{ {
Pstream::waitRequests(nReq); UPstream::waitRequests(startOfRequests);
} }
forAll(fldBf, patchi) forAll(fldBf, patchi)
@ -86,11 +87,11 @@ void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
&& polyPatch::constraintType(tgtField.patch().patch().type()) && polyPatch::constraintType(tgtField.patch().patch().type())
) )
{ {
tgtField.evaluate(Pstream::defaultCommsType); tgtField.evaluate(commsType);
} }
} }
} }
else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled) else if (commsType == UPstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = const lduSchedule& patchSchedule =
fld.mesh().globalData().patchSchedule(); fld.mesh().globalData().patchSchedule();
@ -109,11 +110,11 @@ void evaluateConstraintTypes(GeometricField<Type, fvPatchField, volMesh>& fld)
{ {
if (schedEval.init) if (schedEval.init)
{ {
tgtField.initEvaluate(Pstream::commsTypes::scheduled); tgtField.initEvaluate(commsType);
} }
else else
{ {
tgtField.evaluate(Pstream::commsTypes::scheduled); tgtField.evaluate(commsType);
} }
} }
} }

View File

@ -99,7 +99,6 @@ Foam::DimensionedField<Type, GeoMesh>::DimensionedField
mesh_(mesh), mesh_(mesh),
dimensions_(dims) dimensions_(dims)
{ {
//Info<<"Move construct dimensioned for " << io.name() << nl;
checkFieldSize(); checkFieldSize();
} }
@ -118,7 +117,6 @@ Foam::DimensionedField<Type, GeoMesh>::DimensionedField
mesh_(mesh), mesh_(mesh),
dimensions_(dims) dimensions_(dims)
{ {
//Info<<"Move construct dimensioned for " << io.name() << nl;
checkFieldSize(); checkFieldSize();
} }

View File

@ -38,8 +38,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef DimensionedField_H #ifndef Foam_DimensionedField_H
#define DimensionedField_H #define Foam_DimensionedField_H
#include "regIOobject.H" #include "regIOobject.H"
#include "Field.H" #include "Field.H"
@ -51,7 +51,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward declarations // Forward Declarations
template<class Type, class GeoMesh> class DimensionedField; template<class Type, class GeoMesh> class DimensionedField;
template<class Type, class GeoMesh> template<class Type, class GeoMesh>
@ -95,7 +95,7 @@ public:
private: private:
// Private data // Private Data
//- Reference to mesh //- Reference to mesh
const Mesh& mesh_; const Mesh& mesh_;

View File

@ -422,9 +422,9 @@ void Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::updateCoeffs()
/// InfoInFunction << nl; /// InfoInFunction << nl;
///} ///}
forAll(*this, patchi) for (auto& pfld : *this)
{ {
this->operator[](patchi).updateCoeffs(); pfld.updateCoeffs();
} }
} }
@ -437,35 +437,37 @@ void Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::evaluate()
/// InfoInFunction << nl; /// InfoInFunction << nl;
///} ///}
const UPstream::commsTypes commsType(UPstream::defaultCommsType);
if if
( (
Pstream::defaultCommsType == Pstream::commsTypes::blocking commsType == UPstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking || commsType == UPstream::commsTypes::nonBlocking
) )
{ {
const label nReq = Pstream::nRequests(); const label startOfRequests = UPstream::nRequests();
forAll(*this, patchi) for (auto& pfld : *this)
{ {
this->operator[](patchi).initEvaluate(Pstream::defaultCommsType); pfld.initEvaluate(commsType);
} }
// Block for any outstanding requests // Wait for outstanding requests
if if
( (
Pstream::parRun() UPstream::parRun()
&& Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking && commsType == Pstream::commsTypes::nonBlocking
) )
{ {
Pstream::waitRequests(nReq); UPstream::waitRequests(startOfRequests);
} }
forAll(*this, patchi) for (auto& pfld : *this)
{ {
this->operator[](patchi).evaluate(Pstream::defaultCommsType); pfld.evaluate(commsType);
} }
} }
else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled) else if (commsType == UPstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = const lduSchedule& patchSchedule =
bmesh_.mesh().globalData().patchSchedule(); bmesh_.mesh().globalData().patchSchedule();
@ -473,16 +475,15 @@ void Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::evaluate()
for (const auto& schedEval : patchSchedule) for (const auto& schedEval : patchSchedule)
{ {
const label patchi = schedEval.patch; const label patchi = schedEval.patch;
auto& pfld = (*this)[patchi];
if (schedEval.init) if (schedEval.init)
{ {
this->operator[](patchi) pfld.initEvaluate(commsType);
.initEvaluate(Pstream::commsTypes::scheduled);
} }
else else
{ {
this->operator[](patchi) pfld.evaluate(commsType);
.evaluate(Pstream::commsTypes::scheduled);
} }
} }
} }
@ -490,7 +491,91 @@ void Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::evaluate()
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unsupported communications type " << "Unsupported communications type "
<< Pstream::commsTypeNames[Pstream::defaultCommsType] << UPstream::commsTypeNames[commsType]
<< exit(FatalError);
}
}
template<class Type, template<class> class PatchField, class GeoMesh>
template<class CoupledPatchType>
void Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::evaluateCoupled()
{
///if (GeometricField<Type, PatchField, GeoMesh::debug)
///{
/// InfoInFunction << nl;
///}
const UPstream::commsTypes commsType(UPstream::defaultCommsType);
if
(
commsType == UPstream::commsTypes::blocking
|| commsType == UPstream::commsTypes::nonBlocking
)
{
const label startOfRequests = UPstream::nRequests();
for (auto& pfld : *this)
{
const auto* cpp = isA<CoupledPatchType>(pfld.patch());
if (cpp && cpp->coupled())
{
pfld.initEvaluate(commsType);
}
}
// Wait for outstanding requests
if
(
UPstream::parRun()
&& commsType == UPstream::commsTypes::nonBlocking
)
{
UPstream::waitRequests(startOfRequests);
}
for (auto& pfld : *this)
{
const auto* cpp = isA<CoupledPatchType>(pfld.patch());
if (cpp && cpp->coupled())
{
pfld.evaluate(commsType);
}
}
}
else if (commsType == UPstream::commsTypes::scheduled)
{
const lduSchedule& patchSchedule =
bmesh_.mesh().globalData().patchSchedule();
for (const auto& schedEval : patchSchedule)
{
const label patchi = schedEval.patch;
auto& pfld = (*this)[patchi];
const auto* cpp = isA<CoupledPatchType>(pfld.patch());
if (cpp && cpp->coupled())
{
if (schedEval.init)
{
pfld.initEvaluate(commsType);
}
else
{
pfld.evaluate(commsType);
}
}
}
}
else
{
FatalErrorInFunction
<< "Unsupported communications type "
<< UPstream::commsTypeNames[commsType]
<< exit(FatalError); << exit(FatalError);
} }
} }
@ -593,10 +678,10 @@ void Foam::GeometricBoundaryField<Type, PatchField, GeoMesh>::writeEntries
Ostream& os Ostream& os
) const ) const
{ {
forAll(*this, patchi) for (const auto& pfld : *this)
{ {
os.beginBlock(this->operator[](patchi).patch().name()); os.beginBlock(pfld.patch().name());
os << this->operator[](patchi); os << pfld;
os.endBlock(); os.endBlock();
} }
} }

View File

@ -114,22 +114,22 @@ public:
); );
//- Construct from a BoundaryMesh, reference to the internal field //- Construct from a BoundaryMesh, reference to the internal field
//- and a PtrList<PatchField<Type>> //- and a PtrList<PatchField<Type>> (to be cloned)
GeometricBoundaryField GeometricBoundaryField
( (
const BoundaryMesh& bmesh, const BoundaryMesh& bmesh,
const DimensionedField<Type, GeoMesh>& field, const DimensionedField<Type, GeoMesh>& field,
const PtrList<PatchField<Type>>& const PtrList<PatchField<Type>>& ptfl
); );
//- Construct as copy setting the reference to the internal field //- Construct as copy, setting the reference to the internal field
GeometricBoundaryField GeometricBoundaryField
( (
const DimensionedField<Type, GeoMesh>& field, const DimensionedField<Type, GeoMesh>& field,
const GeometricBoundaryField<Type, PatchField, GeoMesh>& btf const GeometricBoundaryField<Type, PatchField, GeoMesh>& btf
); );
//- Construct as copy setting the reference to the internal field //- Construct as copy, setting the reference to the internal field
//- and resetting type of field for given patch IDs //- and resetting type of field for given patch IDs
GeometricBoundaryField GeometricBoundaryField
( (
@ -170,10 +170,14 @@ public:
//- Evaluate boundary conditions //- Evaluate boundary conditions
void evaluate(); void evaluate();
//- Evaluate boundary conditions on a subset of coupled patches
template<class CoupledPatchType>
void evaluateCoupled();
//- Return a list of the patch types //- Return a list of the patch types
wordList types() const; wordList types() const;
//- Return boundary field of cell values neighbouring the boundary //- Return boundary field of values neighbouring the boundary
GeometricBoundaryField boundaryInternalField() const; GeometricBoundaryField boundaryInternalField() const;
//- Return a list of pointers for each patch field with only those //- Return a list of pointers for each patch field with only those

View File

@ -307,6 +307,88 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
} }
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
(
const IOobject& io,
Internal&& diField,
const PtrList<PatchField<Type>>& ptfl
)
:
Internal(io, std::move(diField)),
timeIndex_(this->time().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(this->mesh().boundary(), *this, ptfl)
{
DebugInFunction
<< "Move construct from components" << nl << this->info() << endl;
readIfPresent();
}
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
(
const IOobject& io,
const tmp<Internal>& tfield,
const PtrList<PatchField<Type>>& ptfl
)
:
Internal(io, tfield),
timeIndex_(this->time().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(this->mesh().boundary(), *this, ptfl)
{
DebugInFunction
<< "Construct from tmp internalField" << nl << this->info() << endl;
readIfPresent();
}
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
(
const Internal& diField,
const PtrList<PatchField<Type>>& ptfl
)
:
Internal(diField),
timeIndex_(this->time().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(this->mesh().boundary(), *this, ptfl)
{
DebugInFunction
<< "Copy construct from components" << nl << this->info() << endl;
readIfPresent();
}
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
(
Internal&& diField,
const PtrList<PatchField<Type>>& ptfl
)
:
Internal(std::move(diField)),
timeIndex_(this->time().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(this->mesh().boundary(), *this, ptfl)
{
DebugInFunction
<< "Move construct from components" << nl << this->info() << endl;
readIfPresent();
}
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
( (
@ -376,6 +458,52 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
} }
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
(
const IOobject& io,
const Mesh& mesh,
const dimensionSet& ds,
Field<Type>&& iField,
const PtrList<PatchField<Type>>& ptfl
)
:
Internal(io, mesh, ds, std::move(iField)),
timeIndex_(this->time().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(mesh.boundary(), *this, ptfl)
{
DebugInFunction
<< "Move construct from components" << nl << this->info() << endl;
readIfPresent();
}
template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
(
const IOobject& io,
const Mesh& mesh,
const dimensionSet& ds,
const tmp<Field<Type>>& tfield,
const PtrList<PatchField<Type>>& ptfl
)
:
Internal(io, mesh, ds, tfield),
timeIndex_(this->time().timeIndex()),
field0Ptr_(nullptr),
fieldPrevIterPtr_(nullptr),
boundaryField_(mesh.boundary(), *this, ptfl)
{
DebugInFunction
<< "Construct from tmp internalField" << nl << this->info() << endl;
readIfPresent();
}
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField
( (

View File

@ -174,7 +174,7 @@ public:
//- Construct given IOobject, mesh, dimensioned<Type> and patch type. //- Construct given IOobject, mesh, dimensioned<Type> and patch type.
// This assigns both dimensions and values. // This assigns both dimensions and values.
// The internal name for the dimensioned\<Type\> has no influence. // The name of the dimensioned\<Type\> has no influence.
GeometricField GeometricField
( (
const IOobject& io, const IOobject& io,
@ -185,7 +185,7 @@ public:
//- Construct given IOobject, mesh, dimensioned<Type> and patch types. //- Construct given IOobject, mesh, dimensioned<Type> and patch types.
// This assigns both dimensions and values. // This assigns both dimensions and values.
// The internal name for the dimensioned\<Type\> has no influence. // The name of the dimensioned\<Type\> has no influence.
GeometricField GeometricField
( (
const IOobject& io, const IOobject& io,
@ -195,7 +195,7 @@ public:
const wordList& actualPatchTypes = wordList() const wordList& actualPatchTypes = wordList()
); );
//- Copy construct from components //- Copy construct from internal field and a patch list to clone
GeometricField GeometricField
( (
const IOobject& io, const IOobject& io,
@ -203,6 +203,36 @@ public:
const PtrList<PatchField<Type>>& ptfl const PtrList<PatchField<Type>>& ptfl
); );
//- Move construct from internal field and a patch list to clone
GeometricField
(
const IOobject& io,
Internal&& diField,
const PtrList<PatchField<Type>>& ptfl
);
//- Move construct from internal field and a patch list to clone
GeometricField
(
const IOobject& io,
const tmp<Internal>& tfield,
const PtrList<PatchField<Type>>& ptfl
);
//- Copy construct from internal field and a patch list to clone
GeometricField
(
const Internal& diField,
const PtrList<PatchField<Type>>& ptfl
);
//- Move construct from internal field and a patch list to clone
GeometricField
(
Internal&& diField,
const PtrList<PatchField<Type>>& ptfl
);
//- Copy construct from internal field, with specified patch type //- Copy construct from internal field, with specified patch type
GeometricField GeometricField
( (
@ -233,6 +263,26 @@ public:
const PtrList<PatchField<Type>>& ptfl const PtrList<PatchField<Type>>& ptfl
); );
//- Move construct from internal field and a patch list to clone
GeometricField
(
const IOobject& io,
const Mesh& mesh,
const dimensionSet& ds,
Field<Type>&& iField,
const PtrList<PatchField<Type>>& ptfl
);
//- Copy construct from components
GeometricField
(
const IOobject& io,
const Mesh& mesh,
const dimensionSet& ds,
const tmp<Field<Type>>& tiField,
const PtrList<PatchField<Type>>& ptfl
);
//- Construct and read given IOobject //- Construct and read given IOobject
GeometricField GeometricField
( (
@ -268,7 +318,7 @@ public:
const GeometricField<Type, PatchField, GeoMesh>& gf const GeometricField<Type, PatchField, GeoMesh>& gf
); );
//- Construct as copy of tmp<GeometricField> resetting IO parameters //- Construct from tmp\<GeometricField\> resetting IO parameters
GeometricField GeometricField
( (
const IOobject& io, const IOobject& io,

View File

@ -95,8 +95,16 @@ class pointPatchField
public: public:
//- The Field value_type
typedef Type value_type; typedef Type value_type;
//- The internal field type associated with the patch field
typedef DimensionedField<Type, pointMesh> Internal;
//- The patch type for the patch field
typedef pointPatch Patch; typedef pointPatch Patch;
//- Type for a \em calculated patch
typedef calculatedPointPatchField<Type> Calculated; typedef calculatedPointPatchField<Type> Calculated;

View File

@ -32,8 +32,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef pointMesh_H #ifndef Foam_pointMesh_H
#define pointMesh_H #define Foam_pointMesh_H
#include "GeoMesh.H" #include "GeoMesh.H"
#include "MeshObject.H" #include "MeshObject.H"
@ -74,14 +74,19 @@ class pointMesh
public: public:
// Public Typedefs
//- The mesh type
typedef pointMesh Mesh;
//- The boundary type associated with the mesh
typedef pointBoundaryMesh BoundaryMesh;
// Declare name of the class and its debug switch // Declare name of the class and its debug switch
ClassName("pointMesh"); ClassName("pointMesh");
typedef pointMesh Mesh;
typedef pointBoundaryMesh BoundaryMesh;
// Constructors // Constructors
//- Construct from polyMesh //- Construct from polyMesh

View File

@ -28,13 +28,11 @@ License
#include "coupledPointPatch.H" #include "coupledPointPatch.H"
#include "pointBoundaryMesh.H" #include "pointBoundaryMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(coupledPointPatch, 0); defineTypeNameAndDebug(coupledPointPatch, 0);
} }
@ -44,10 +42,4 @@ Foam::coupledPointPatch::coupledPointPatch(const pointBoundaryMesh& bm)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::coupledPointPatch::~coupledPointPatch()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef coupledPointPatch_H #ifndef Foam_coupledPointPatch_H
#define coupledPointPatch_H #define Foam_coupledPointPatch_H
#include "coupledPolyPatch.H" #include "coupledPolyPatch.H"
@ -45,6 +45,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
class pointBoundaryMesh; class pointBoundaryMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -53,15 +54,6 @@ class pointBoundaryMesh;
class coupledPointPatch class coupledPointPatch
{ {
// Private Member Functions
//- No copy construct
coupledPointPatch(const coupledPointPatch&) = delete;
//- No copy assignment
void operator=(const coupledPointPatch&) = delete;
protected: protected:
// Protected Member Functions // Protected Member Functions
@ -85,6 +77,12 @@ protected:
virtual void updateMesh(PstreamBuffers&) = 0; virtual void updateMesh(PstreamBuffers&) = 0;
//- No copy construct
coupledPointPatch(const coupledPointPatch&) = delete;
//- No copy assignment
void operator=(const coupledPointPatch&) = delete;
public: public:
//- Runtime type information //- Runtime type information
@ -94,12 +92,11 @@ public:
// Constructors // Constructors
//- Construct from components //- Construct from components
coupledPointPatch(const pointBoundaryMesh& bm); explicit coupledPointPatch(const pointBoundaryMesh& bm);
//- Destructor //- Destructor
virtual ~coupledPointPatch(); virtual ~coupledPointPatch() = default;
}; };

View File

@ -74,9 +74,8 @@ public:
{} {}
// Destructor //- Destructor
virtual ~cyclicSlipPointPatch() = default;
virtual ~cyclicSlipPointPatch() = default;
// Member Functions // Member Functions

View File

@ -52,7 +52,7 @@ namespace Foam
void Foam::processorPointPatch::initGeometry(PstreamBuffers& pBufs) void Foam::processorPointPatch::initGeometry(PstreamBuffers& pBufs)
{ {
// Algorithm: // Algorithm:
// Depending on whether the patch is a master or a slave, get the primitive // Depending on whether the patch is a owner or neighbour, get the primitive
// patch points and filter away the points from the global patch. // patch points and filter away the points from the global patch.
// Create the reversed patch and pick up its points // Create the reversed patch and pick up its points
@ -117,18 +117,4 @@ Foam::processorPointPatch::processorPointPatch
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::processorPointPatch::~processorPointPatch()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::labelList& Foam::processorPointPatch::reverseMeshPoints() const
{
return reverseMeshPoints_;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2013 OpenFOAM Foundation Copyright (C) 2011-2013 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -34,7 +35,7 @@ Description
patch they need to be identical on both sides with the normals pointing patch they need to be identical on both sides with the normals pointing
in opposite directions. This is achieved by calling the reverseFace in opposite directions. This is achieved by calling the reverseFace
function in the decomposition. It is therefore possible to re-create function in the decomposition. It is therefore possible to re-create
the ordering of patch points on the slave side by reversing all the the ordering of patch points on the neighbour side by reversing all the
patch faces of the owner. patch faces of the owner.
SourceFiles SourceFiles
@ -42,8 +43,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef processorPointPatch_H #ifndef Foam_processorPointPatch_H
#define processorPointPatch_H #define Foam_processorPointPatch_H
#include "coupledFacePointPatch.H" #include "coupledFacePointPatch.H"
#include "processorPolyPatch.H" #include "processorPolyPatch.H"
@ -61,7 +62,7 @@ class processorPointPatch
: :
public coupledFacePointPatch public coupledFacePointPatch
{ {
// Private data // Private Data
const processorPolyPatch& procPolyPatch_; const processorPolyPatch& procPolyPatch_;
@ -112,10 +113,10 @@ public:
//- Destructor //- Destructor
virtual ~processorPointPatch(); virtual ~processorPointPatch() = default;
// Member functions // Member Functions
//- Return message tag to use for communication //- Return message tag to use for communication
virtual int tag() const virtual int tag() const
@ -147,16 +148,16 @@ public:
return procPolyPatch_.neighbProcNo(); return procPolyPatch_.neighbProcNo();
} }
//- Is this a master patch //- Does the processor own the patch ?
bool isMaster() const bool owner() const
{ {
return myProcNo() < neighbProcNo(); return procPolyPatch_.owner();
} }
//- Is this a slave patch //- Is the processor the patch neighbour ?
bool isSlave() const bool neighbour() const
{ {
return !isMaster(); return !owner();
} }
//- Return the underlying processorPolyPatch //- Return the underlying processorPolyPatch
@ -166,8 +167,10 @@ public:
} }
//- Return mesh points in the correct order for the receiving side //- Return mesh points in the correct order for the receiving side
const labelList& reverseMeshPoints() const; const labelList& reverseMeshPoints() const
{
return reverseMeshPoints_;
}
}; };

View File

@ -34,7 +34,7 @@ Description
patch they need to be identical on both sides with the normals pointing patch they need to be identical on both sides with the normals pointing
in opposite directions. This is achieved by calling the reverseFace in opposite directions. This is achieved by calling the reverseFace
function in the decomposition. It is therefore possible to re-create function in the decomposition. It is therefore possible to re-create
the ordering of patch points on the slave side by reversing all the the ordering of patch points on the neighbour side by reversing all the
patch faces of the owner. patch faces of the owner.
SourceFiles SourceFiles
@ -42,8 +42,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef processorCyclicPointPatch_H #ifndef Foam_processorCyclicPointPatch_H
#define processorCyclicPointPatch_H #define Foam_processorCyclicPointPatch_H
#include "processorPointPatch.H" #include "processorPointPatch.H"
#include "processorCyclicPolyPatch.H" #include "processorCyclicPolyPatch.H"
@ -61,10 +61,13 @@ class processorCyclicPointPatch
: :
public processorPointPatch public processorPointPatch
{ {
// Private data // Private Data
const processorCyclicPolyPatch& procCycPolyPatch_; const processorCyclicPolyPatch& procCycPolyPatch_;
// Private Member Functions
//- No copy construct //- No copy construct
processorCyclicPointPatch(const processorCyclicPointPatch&) = delete; processorCyclicPointPatch(const processorCyclicPointPatch&) = delete;
@ -87,13 +90,11 @@ public:
); );
// Destructor //- Destructor
virtual ~processorCyclicPointPatch();
virtual ~processorCyclicPointPatch();
// Member functions // Member Functions
//- Return message tag to use for communication //- Return message tag to use for communication
virtual int tag() const virtual int tag() const

View File

@ -32,7 +32,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(coupledFacePointPatch, 0); defineTypeNameAndDebug(coupledFacePointPatch, 0);
} }
@ -50,10 +50,4 @@ Foam::coupledFacePointPatch::coupledFacePointPatch
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::coupledFacePointPatch::~coupledFacePointPatch()
{}
// ************************************************************************* // // ************************************************************************* //

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef coupledFacePointPatch_H #ifndef Foam_coupledFacePointPatch_H
#define coupledFacePointPatch_H #define Foam_coupledFacePointPatch_H
#include "coupledPointPatch.H" #include "coupledPointPatch.H"
#include "facePointPatch.H" #include "facePointPatch.H"
@ -47,8 +47,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
class pointBoundaryMesh;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class coupledFacePointPatch Declaration Class coupledFacePointPatch Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -58,12 +56,18 @@ class coupledFacePointPatch
public facePointPatch, public facePointPatch,
public coupledPointPatch public coupledPointPatch
{ {
// Private data // Private Data
const coupledPolyPatch& coupledPolyPatch_; const coupledPolyPatch& coupledPolyPatch_;
// Private Member Functions protected:
// Protected Member Functions
//- Calculate mesh points
virtual void calcGeometry(PstreamBuffers&) = 0;
//- No copy construct //- No copy construct
coupledFacePointPatch(const coupledFacePointPatch&) = delete; coupledFacePointPatch(const coupledFacePointPatch&) = delete;
@ -72,14 +76,6 @@ class coupledFacePointPatch
void operator=(const coupledFacePointPatch&) = delete; void operator=(const coupledFacePointPatch&) = delete;
protected:
// Construction of demand-driven data
//- Calculate mesh points
virtual void calcGeometry(PstreamBuffers&) = 0;
public: public:
//- Runtime type information //- Runtime type information
@ -97,7 +93,7 @@ public:
//- Destructor //- Destructor
virtual ~coupledFacePointPatch(); virtual ~coupledFacePointPatch() = default;
}; };

View File

@ -32,12 +32,12 @@ Description
SourceFiles SourceFiles
facePointPatch.C facePointPatch.C
newPointPatch.C facePointPatchNew.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef facePointPatch_H #ifndef Foam_facePointPatch_H
#define facePointPatch_H #define Foam_facePointPatch_H
#include "pointPatch.H" #include "pointPatch.H"
#include "polyPatch.H" #include "polyPatch.H"
@ -61,7 +61,7 @@ class facePointPatch
{ {
protected: protected:
// Protected data // Protected Data
//- Reference to the underlying polyPatch //- Reference to the underlying polyPatch
const polyPatch& polyPatch_; const polyPatch& polyPatch_;

View File

@ -68,6 +68,7 @@ class pointPatch
//- Reference to boundary mesh //- Reference to boundary mesh
const pointBoundaryMesh& boundaryMesh_; const pointBoundaryMesh& boundaryMesh_;
protected: protected:
// Protected Member Functions // Protected Member Functions
@ -152,10 +153,10 @@ public:
//- Return mesh points //- Return mesh points
virtual const labelList& meshPoints() const = 0; virtual const labelList& meshPoints() const = 0;
//- Return mesh points //- Return pointField of points in patch
virtual const vectorField& localPoints() const = 0; virtual const vectorField& localPoints() const = 0;
//- Return point normals //- Return point unit normals
virtual const vectorField& pointNormals() const = 0; virtual const vectorField& pointNormals() const = 0;
//- Return the constraint type this pointPatch implements. //- Return the constraint type this pointPatch implements.

View File

@ -306,9 +306,12 @@ private:
public: public:
// Public typedefs // Public Typedefs
//- The mesh type
typedef polyMesh Mesh; typedef polyMesh Mesh;
//- The boundary type associated with the mesh
typedef polyBoundaryMesh BoundaryMesh; typedef polyBoundaryMesh BoundaryMesh;

View File

@ -484,8 +484,8 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors
<< endl; << endl;
} }
// Note: getCentresAndAnchors gets called on the slave side // Note: getCentresAndAnchors gets called on the neighbour side
// so separationVector is owner-slave points. // so separationVector is owner-neighbour points.
half0Ctrs -= separationVector_; half0Ctrs -= separationVector_;
anchors0 -= separationVector_; anchors0 -= separationVector_;

View File

@ -358,7 +358,7 @@ bool Foam::processorCyclicPolyPatch::order
// (ab)use the cyclicPolyPatch ordering: // (ab)use the cyclicPolyPatch ordering:
// - owner side stores geometry // - owner side stores geometry
// - slave side does ordering according to owner side // - neighbour side does ordering according to owner side
cycPatch.neighbPatch().initOrder(pBufs, masterPtr()); cycPatch.neighbPatch().initOrder(pBufs, masterPtr());
return cycPatch.order(pBufs, pp, faceMap, rotation); return cycPatch.order(pBufs, pp, faceMap, rotation);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2021 OpenCFD Ltd. Copyright (C) 2017-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -63,21 +63,21 @@ bool Foam::orientedType::checkType
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::orientedType::orientedType() Foam::orientedType::orientedType() noexcept
: :
oriented_(UNKNOWN) oriented_(UNKNOWN)
{} {}
Foam::orientedType::orientedType(const orientedType& ot) Foam::orientedType::orientedType(const orientedType& ot) noexcept
: :
oriented_(ot.oriented_) oriented_(ot.oriented_)
{} {}
Foam::orientedType::orientedType(const bool oriented) Foam::orientedType::orientedType(const bool isOriented) noexcept
: :
oriented_(oriented ? ORIENTED : UNORIENTED) oriented_(isOriented ? ORIENTED : UNORIENTED)
{} {}
@ -103,9 +103,9 @@ Foam::orientedType::orientedOption Foam::orientedType::oriented() const noexcept
} }
void Foam::orientedType::setOriented(const bool oriented) noexcept void Foam::orientedType::setOriented(const bool on) noexcept
{ {
oriented_ = oriented ? ORIENTED : UNORIENTED; oriented_ = on ? ORIENTED : UNORIENTED;
} }
@ -221,7 +221,7 @@ void Foam::orientedType::operator/=(const scalar s)
} }
bool Foam::orientedType::operator()() const bool Foam::orientedType::operator()() const noexcept
{ {
return oriented_ == ORIENTED; return oriented_ == ORIENTED;
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2017-2021 OpenCFD Ltd. Copyright (C) 2017-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -34,8 +34,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef orientedType_H #ifndef Foam_orientedType_H
#define orientedType_H #define Foam_orientedType_H
#include "Enum.H" #include "Enum.H"
@ -61,7 +61,7 @@ public:
// Public Data Types // Public Data Types
//- Enumeration defining oriented flags //- Enumeration defining oriented flags
enum orientedOption enum orientedOption : unsigned char
{ {
UNKNOWN = 0, UNKNOWN = 0,
ORIENTED = 1, ORIENTED = 1,
@ -84,14 +84,14 @@ public:
// Constructors // Constructors
//- Default construct as "UNKNOWN" //- Default construct as \c UNKNOWN
orientedType(); orientedType() noexcept;
//- Copy construct //- Copy construct
orientedType(const orientedType& ot); orientedType(const orientedType& ot) noexcept;
//- Construct from bool //- Construct from bool
explicit orientedType(const bool oriented); explicit orientedType(const bool isOriented) noexcept;
//- Construct from Istream //- Construct from Istream
explicit orientedType(Istream& is); explicit orientedType(Istream& is);
@ -112,19 +112,25 @@ public:
//- Return the oriented flag //- Return the oriented flag
orientedOption oriented() const noexcept; orientedOption oriented() const noexcept;
//- Set the oriented flag //- Set the oriented flag: on/off
void setOriented(const bool oriented = true) noexcept; void setOriented(const bool on = true) noexcept;
//- Read the "oriented" state from dictionary //- Read the "oriented" state from dictionary
void read(const dictionary& dict); void read(const dictionary& dict);
//- Write the "oriented" flag entry (if ORIENTED) //- Write the "oriented" flag entry (if \c ORIENTED)
// \return True if entry was written // \return True if entry was written
bool writeEntry(Ostream& os) const; bool writeEntry(Ostream& os) const;
// Member Operators // Member Operators
//- True if type is \c ORIENTED
explicit operator bool() const noexcept
{
return (oriented_ == orientedOption::ORIENTED);
}
void operator=(const orientedType& ot); void operator=(const orientedType& ot);
void operator+=(const orientedType& ot); void operator+=(const orientedType& ot);
@ -133,7 +139,9 @@ public:
void operator/=(const orientedType& ot); void operator/=(const orientedType& ot);
void operator*=(const scalar s); void operator*=(const scalar s);
void operator/=(const scalar s); void operator/=(const scalar s);
bool operator()() const;
//- True if type is \c ORIENTED. Same as bool operator
bool operator()() const noexcept;
// IOstream Operators // IOstream Operators

View File

@ -485,7 +485,10 @@ public:
// Public Typedefs // Public Typedefs
//- The mesh type
typedef faMesh Mesh; typedef faMesh Mesh;
//- The boundary type associated with the mesh
typedef faBoundaryMesh BoundaryMesh; typedef faBoundaryMesh BoundaryMesh;

View File

@ -146,8 +146,10 @@ protected:
public: public:
//- The boundary type associated with the patch
typedef faBoundaryMesh BoundaryMesh; typedef faBoundaryMesh BoundaryMesh;
//- Runtime type information //- Runtime type information
TypeName("patch"); TypeName("patch");

View File

@ -101,7 +101,13 @@ class faPatchField
public: public:
//- The internal field type associated with the patch field
typedef DimensionedField<Type, areaMesh> Internal;
//- The patch type for the patch field
typedef faPatch Patch; typedef faPatch Patch;
//- Type for a \em calculated patch
typedef calculatedFaPatchField<Type> Calculated; typedef calculatedFaPatchField<Type> Calculated;

View File

@ -45,8 +45,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef faePatchField_H #ifndef Foam_faePatchField_H
#define faePatchField_H #define Foam_faePatchField_H
#include "faPatch.H" #include "faPatch.H"
#include "DimensionedField.H" #include "DimensionedField.H"
@ -82,7 +82,7 @@ class faePatchField
: :
public Field<Type> public Field<Type>
{ {
// Private data // Private Data
//- Reference to a patch //- Reference to a patch
const faPatch& patch_; const faPatch& patch_;
@ -93,7 +93,13 @@ class faePatchField
public: public:
//- The internal field type associated with the patch field
typedef DimensionedField<Type, edgeMesh> Internal;
//- The patch type for the patch field
typedef faPatch Patch; typedef faPatch Patch;
//- Type for a \em calculated patch
typedef calculatedFaePatchField<Type> Calculated; typedef calculatedFaePatchField<Type> Calculated;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -44,8 +44,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef fvPatchField_H #ifndef Foam_fvPatchField_H
#define fvPatchField_H #define Foam_fvPatchField_H
#include "fvPatch.H" #include "fvPatch.H"
#include "DimensionedField.H" #include "DimensionedField.H"
@ -108,7 +108,13 @@ class fvPatchField
public: public:
//- The internal field type associated with the patch field
typedef DimensionedField<Type, volMesh> Internal;
//- The patch type for the patch field
typedef fvPatch Patch; typedef fvPatch Patch;
//- Type for a \em calculated patch
typedef calculatedFvPatchField<Type> Calculated; typedef calculatedFvPatchField<Type> Calculated;

View File

@ -44,8 +44,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef fvsPatchField_H #ifndef Foam_fvsPatchField_H
#define fvsPatchField_H #define Foam_fvsPatchField_H
#include "fvPatch.H" #include "fvPatch.H"
#include "DimensionedField.H" #include "DimensionedField.H"
@ -78,7 +78,7 @@ class fvsPatchField
: :
public Field<Type> public Field<Type>
{ {
// Private data // Private Data
//- Reference to patch //- Reference to patch
const fvPatch& patch_; const fvPatch& patch_;
@ -89,7 +89,13 @@ class fvsPatchField
public: public:
//- The internal field type associated with the patch field
typedef DimensionedField<Type, surfaceMesh> Internal;
//- The patch type for the patch field
typedef fvPatch Patch; typedef fvPatch Patch;
//- Type for a \em calculated patch
typedef calculatedFvsPatchField<Type> Calculated; typedef calculatedFvsPatchField<Type> Calculated;

View File

@ -174,9 +174,12 @@ protected:
public: public:
// Public typedefs // Public Typedefs
//- The mesh type
typedef fvMesh Mesh; typedef fvMesh Mesh;
//- The boundary type associated with the mesh
typedef fvBoundaryMesh BoundaryMesh; typedef fvBoundaryMesh BoundaryMesh;

View File

@ -113,6 +113,7 @@ public:
public: public:
//- The boundary type associated with the patch
typedef fvBoundaryMesh BoundaryMesh; typedef fvBoundaryMesh BoundaryMesh;
friend class fvBoundaryMesh; friend class fvBoundaryMesh;

View File

@ -89,13 +89,10 @@ void Foam::volPointInterpolation::addSeparated
Pout<< "volPointInterpolation::addSeparated" << endl; Pout<< "volPointInterpolation::addSeparated" << endl;
} }
typename GeometricField<Type, pointPatchField, pointMesh>:: auto& pfi = pf.ref();
Internal& pfi = pf.ref(); auto& pfbf = pf.boundaryFieldRef();
typename GeometricField<Type, pointPatchField, pointMesh>:: const label startOfRequests = UPstream::nRequests();
Boundary& pfbf = pf.boundaryFieldRef();
const label nReq = Pstream::nRequests();
forAll(pfbf, patchi) forAll(pfbf, patchi)
{ {
@ -110,8 +107,8 @@ void Foam::volPointInterpolation::addSeparated
} }
} }
// Block for any outstanding requests // Wait for outstanding requests
Pstream::waitRequests(nReq); UPstream::waitRequests(startOfRequests);
forAll(pfbf, patchi) forAll(pfbf, patchi)
{ {

View File

@ -36,17 +36,17 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes
GeometricField<Type, fvPatchField, volMesh>& fld GeometricField<Type, fvPatchField, volMesh>& fld
) const ) const
{ {
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType; auto& fldBf = fld.boundaryFieldRef();
typename VolFieldType::Boundary& fldBf = fld.boundaryFieldRef(); const UPstream::commsTypes commsType(UPstream::defaultCommsType);
if if
( (
Pstream::defaultCommsType == Pstream::commsTypes::blocking commsType == UPstream::commsTypes::blocking
|| Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking || commsType == UPstream::commsTypes::nonBlocking
) )
{ {
const label nReq = Pstream::nRequests(); const label startOfRequests = UPstream::nRequests();
forAll(fldBf, patchi) forAll(fldBf, patchi)
{ {
@ -58,18 +58,18 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes
&& polyPatch::constraintType(tgtField.patch().patch().type()) && polyPatch::constraintType(tgtField.patch().patch().type())
) )
{ {
tgtField.initEvaluate(Pstream::defaultCommsType); tgtField.initEvaluate(commsType);
} }
} }
// Block for any outstanding requests // Wait for outstanding requests
if if
( (
Pstream::parRun() UPstream::parRun()
&& Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking && commsType == UPstream::commsTypes::nonBlocking
) )
{ {
Pstream::waitRequests(nReq); UPstream::waitRequests(startOfRequests);
} }
forAll(fldBf, patchi) forAll(fldBf, patchi)
@ -82,11 +82,11 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes
&& polyPatch::constraintType(tgtField.patch().patch().type()) && polyPatch::constraintType(tgtField.patch().patch().type())
) )
{ {
tgtField.evaluate(Pstream::defaultCommsType); tgtField.evaluate(commsType);
} }
} }
} }
else if (Pstream::defaultCommsType == Pstream::commsTypes::scheduled) else if (commsType == UPstream::commsTypes::scheduled)
{ {
const lduSchedule& patchSchedule = const lduSchedule& patchSchedule =
fld.mesh().globalData().patchSchedule(); fld.mesh().globalData().patchSchedule();
@ -105,11 +105,11 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes
{ {
if (schedEval.init) if (schedEval.init)
{ {
tgtField.initEvaluate(Pstream::commsTypes::scheduled); tgtField.initEvaluate(commsType);
} }
else else
{ {
tgtField.evaluate(Pstream::commsTypes::scheduled); tgtField.evaluate(commsType);
} }
} }
} }

View File

@ -119,27 +119,31 @@ void Foam::dynamicOversetFvMesh::correctBoundaryConditions
const bool typeOnly const bool typeOnly
) )
{ {
const label nReq = Pstream::nRequests(); const label startOfRequests = UPstream::nRequests();
forAll(bfld, patchi) forAll(bfld, patchi)
{ {
if (typeOnly == (isA<PatchType>(bfld[patchi]) != nullptr)) if (typeOnly == (isA<PatchType>(bfld[patchi]) != nullptr))
{ {
bfld[patchi].initEvaluate(Pstream::defaultCommsType); bfld[patchi].initEvaluate(UPstream::defaultCommsType);
} }
} }
// Block for any outstanding requests // Wait for outstanding requests
if (Pstream::parRun()) if
(
UPstream::parRun()
&& UPstream::defaultCommsType == UPstream::commsTypes::nonBlocking
)
{ {
Pstream::waitRequests(nReq); UPstream::waitRequests(startOfRequests);
} }
forAll(bfld, patchi) forAll(bfld, patchi)
{ {
if (typeOnly == (isA<PatchType>(bfld[patchi]) != nullptr)) if (typeOnly == (isA<PatchType>(bfld[patchi]) != nullptr))
{ {
bfld[patchi].evaluate(Pstream::defaultCommsType); bfld[patchi].evaluate(UPstream::defaultCommsType);
} }
} }
} }
@ -899,7 +903,7 @@ void Foam::dynamicOversetFvMesh::correctCoupledBoundaryConditions(GeoField& fld)
{ {
typename GeoField::Boundary& bfld = fld.boundaryFieldRef(); typename GeoField::Boundary& bfld = fld.boundaryFieldRef();
const label nReq = Pstream::nRequests(); const label startOfRequests = UPstream::nRequests();
forAll(bfld, patchi) forAll(bfld, patchi)
{ {
@ -910,10 +914,14 @@ void Foam::dynamicOversetFvMesh::correctCoupledBoundaryConditions(GeoField& fld)
} }
} }
// Block for any outstanding requests // Wait for outstanding requests
if (Pstream::parRun()) if
(
UPstream::parRun()
&& UPstream::defaultCommsType == UPstream::commsTypes::nonBlocking
)
{ {
Pstream::waitRequests(nReq); UPstream::waitRequests(startOfRequests);
} }
forAll(bfld, patchi) forAll(bfld, patchi)