diff --git a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C index dfc2572961..788cfc4252 100644 --- a/applications/utilities/parallelProcessing/redistributePar/redistributePar.C +++ b/applications/utilities/parallelProcessing/redistributePar/redistributePar.C @@ -948,84 +948,10 @@ void correctCoupledBoundaryConditions(fvMesh& mesh) mesh.objectRegistry::lookupClass() ); - forAllIters(flds, iter) + for (const word& fldName : flds.sortedToc()) { - GeoField& fld = *iter(); - - 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(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(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(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); - } + GeoField& fld = *(flds[fldName]); + fld.boundaryFieldRef().template evaluateCoupled(); } } diff --git a/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H b/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H index f2b787754d..956f90daec 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H +++ b/applications/utilities/preProcessing/mapFieldsPar/MapVolFields.H @@ -41,16 +41,17 @@ namespace Foam template void evaluateConstraintTypes(GeometricField& fld) { - typename GeometricField:: - Boundary& fldBf = fld.boundaryFieldRef(); + auto& fldBf = fld.boundaryFieldRef(); + + const UPstream::commsTypes commsType(UPstream::defaultCommsType); if ( - Pstream::defaultCommsType == Pstream::commsTypes::blocking - || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking + commsType == UPstream::commsTypes::blocking + || commsType == UPstream::commsTypes::nonBlocking ) { - const label nReq = Pstream::nRequests(); + const label startOfRequests = UPstream::nRequests(); forAll(fldBf, patchi) { @@ -62,18 +63,18 @@ void evaluateConstraintTypes(GeometricField& fld) && polyPatch::constraintType(tgtField.patch().patch().type()) ) { - tgtField.initEvaluate(Pstream::defaultCommsType); + tgtField.initEvaluate(commsType); } } - // Block for any outstanding requests + // Wait for outstanding requests if ( - Pstream::parRun() - && Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking + UPstream::parRun() + && commsType == UPstream::commsTypes::nonBlocking ) { - Pstream::waitRequests(nReq); + UPstream::waitRequests(startOfRequests); } forAll(fldBf, patchi) @@ -86,11 +87,11 @@ void evaluateConstraintTypes(GeometricField& fld) && 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 = fld.mesh().globalData().patchSchedule(); @@ -109,11 +110,11 @@ void evaluateConstraintTypes(GeometricField& fld) { if (schedEval.init) { - tgtField.initEvaluate(Pstream::commsTypes::scheduled); + tgtField.initEvaluate(commsType); } else { - tgtField.evaluate(Pstream::commsTypes::scheduled); + tgtField.evaluate(commsType); } } } diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C index e7e9f06f83..81b415b7c3 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.C @@ -99,7 +99,6 @@ Foam::DimensionedField::DimensionedField mesh_(mesh), dimensions_(dims) { - //Info<<"Move construct dimensioned for " << io.name() << nl; checkFieldSize(); } @@ -118,7 +117,6 @@ Foam::DimensionedField::DimensionedField mesh_(mesh), dimensions_(dims) { - //Info<<"Move construct dimensioned for " << io.name() << nl; checkFieldSize(); } diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H index 6b6931051b..52c3ffd345 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/DimensionedField.H @@ -38,8 +38,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef DimensionedField_H -#define DimensionedField_H +#ifndef Foam_DimensionedField_H +#define Foam_DimensionedField_H #include "regIOobject.H" #include "Field.H" @@ -51,7 +51,7 @@ SourceFiles namespace Foam { -// Forward declarations +// Forward Declarations template class DimensionedField; template @@ -95,7 +95,7 @@ public: private: - // Private data + // Private Data //- Reference to mesh const Mesh& mesh_; diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C index bc3b9ef186..21f0336b2e 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C @@ -422,9 +422,9 @@ void Foam::GeometricBoundaryField::updateCoeffs() /// InfoInFunction << nl; ///} - forAll(*this, patchi) + for (auto& pfld : *this) { - this->operator[](patchi).updateCoeffs(); + pfld.updateCoeffs(); } } @@ -437,35 +437,37 @@ void Foam::GeometricBoundaryField::evaluate() /// InfoInFunction << nl; ///} + const UPstream::commsTypes commsType(UPstream::defaultCommsType); + if ( - Pstream::defaultCommsType == Pstream::commsTypes::blocking - || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking + commsType == UPstream::commsTypes::blocking + || 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 ( - Pstream::parRun() - && Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking + UPstream::parRun() + && 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 = bmesh_.mesh().globalData().patchSchedule(); @@ -473,16 +475,15 @@ void Foam::GeometricBoundaryField::evaluate() for (const auto& schedEval : patchSchedule) { const label patchi = schedEval.patch; + auto& pfld = (*this)[patchi]; if (schedEval.init) { - this->operator[](patchi) - .initEvaluate(Pstream::commsTypes::scheduled); + pfld.initEvaluate(commsType); } else { - this->operator[](patchi) - .evaluate(Pstream::commsTypes::scheduled); + pfld.evaluate(commsType); } } } @@ -490,7 +491,91 @@ void Foam::GeometricBoundaryField::evaluate() { FatalErrorInFunction << "Unsupported communications type " - << Pstream::commsTypeNames[Pstream::defaultCommsType] + << UPstream::commsTypeNames[commsType] + << exit(FatalError); + } +} + + +template class PatchField, class GeoMesh> +template +void Foam::GeometricBoundaryField::evaluateCoupled() +{ + ///if (GeometricField(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(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(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); } } @@ -593,10 +678,10 @@ void Foam::GeometricBoundaryField::writeEntries Ostream& os ) const { - forAll(*this, patchi) + for (const auto& pfld : *this) { - os.beginBlock(this->operator[](patchi).patch().name()); - os << this->operator[](patchi); + os.beginBlock(pfld.patch().name()); + os << pfld; os.endBlock(); } } diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.H index c484a500c8..e2b52abb9e 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.H @@ -114,22 +114,22 @@ public: ); //- Construct from a BoundaryMesh, reference to the internal field - //- and a PtrList> + //- and a PtrList> (to be cloned) GeometricBoundaryField ( const BoundaryMesh& bmesh, const DimensionedField& field, - const PtrList>& + const PtrList>& ptfl ); - //- Construct as copy setting the reference to the internal field + //- Construct as copy, setting the reference to the internal field GeometricBoundaryField ( const DimensionedField& field, const GeometricBoundaryField& 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 GeometricBoundaryField ( @@ -170,10 +170,14 @@ public: //- Evaluate boundary conditions void evaluate(); + //- Evaluate boundary conditions on a subset of coupled patches + template + void evaluateCoupled(); + //- Return a list of the patch types wordList types() const; - //- Return boundary field of cell values neighbouring the boundary + //- Return boundary field of values neighbouring the boundary GeometricBoundaryField boundaryInternalField() const; //- Return a list of pointers for each patch field with only those diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C index b93df0811c..ec8b662661 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C @@ -307,6 +307,88 @@ Foam::GeometricField::GeometricField } +template class PatchField, class GeoMesh> +Foam::GeometricField::GeometricField +( + const IOobject& io, + Internal&& diField, + const PtrList>& 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 PatchField, class GeoMesh> +Foam::GeometricField::GeometricField +( + const IOobject& io, + const tmp& tfield, + const PtrList>& 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 PatchField, class GeoMesh> +Foam::GeometricField::GeometricField +( + const Internal& diField, + const PtrList>& 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 PatchField, class GeoMesh> +Foam::GeometricField::GeometricField +( + Internal&& diField, + const PtrList>& 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 PatchField, class GeoMesh> Foam::GeometricField::GeometricField ( @@ -376,6 +458,52 @@ Foam::GeometricField::GeometricField } +template class PatchField, class GeoMesh> +Foam::GeometricField::GeometricField +( + const IOobject& io, + const Mesh& mesh, + const dimensionSet& ds, + Field&& iField, + const PtrList>& 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 PatchField, class GeoMesh> +Foam::GeometricField::GeometricField +( + const IOobject& io, + const Mesh& mesh, + const dimensionSet& ds, + const tmp>& tfield, + const PtrList>& 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 PatchField, class GeoMesh> Foam::GeometricField::GeometricField ( diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H index db89a75277..1fbf2ebe94 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H @@ -174,7 +174,7 @@ public: //- Construct given IOobject, mesh, dimensioned and patch type. // This assigns both dimensions and values. - // The internal name for the dimensioned\ has no influence. + // The name of the dimensioned\ has no influence. GeometricField ( const IOobject& io, @@ -185,7 +185,7 @@ public: //- Construct given IOobject, mesh, dimensioned and patch types. // This assigns both dimensions and values. - // The internal name for the dimensioned\ has no influence. + // The name of the dimensioned\ has no influence. GeometricField ( const IOobject& io, @@ -195,7 +195,7 @@ public: const wordList& actualPatchTypes = wordList() ); - //- Copy construct from components + //- Copy construct from internal field and a patch list to clone GeometricField ( const IOobject& io, @@ -203,6 +203,36 @@ public: const PtrList>& ptfl ); + //- Move construct from internal field and a patch list to clone + GeometricField + ( + const IOobject& io, + Internal&& diField, + const PtrList>& ptfl + ); + + //- Move construct from internal field and a patch list to clone + GeometricField + ( + const IOobject& io, + const tmp& tfield, + const PtrList>& ptfl + ); + + //- Copy construct from internal field and a patch list to clone + GeometricField + ( + const Internal& diField, + const PtrList>& ptfl + ); + + //- Move construct from internal field and a patch list to clone + GeometricField + ( + Internal&& diField, + const PtrList>& ptfl + ); + //- Copy construct from internal field, with specified patch type GeometricField ( @@ -233,6 +263,26 @@ public: const PtrList>& ptfl ); + //- Move construct from internal field and a patch list to clone + GeometricField + ( + const IOobject& io, + const Mesh& mesh, + const dimensionSet& ds, + Field&& iField, + const PtrList>& ptfl + ); + + //- Copy construct from components + GeometricField + ( + const IOobject& io, + const Mesh& mesh, + const dimensionSet& ds, + const tmp>& tiField, + const PtrList>& ptfl + ); + //- Construct and read given IOobject GeometricField ( @@ -268,7 +318,7 @@ public: const GeometricField& gf ); - //- Construct as copy of tmp resetting IO parameters + //- Construct from tmp\ resetting IO parameters GeometricField ( const IOobject& io, diff --git a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H index b634662092..61dbe49d53 100644 --- a/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H +++ b/src/OpenFOAM/fields/pointPatchFields/pointPatchField/pointPatchField.H @@ -95,8 +95,16 @@ class pointPatchField public: + //- The Field value_type typedef Type value_type; + + //- The internal field type associated with the patch field + typedef DimensionedField Internal; + + //- The patch type for the patch field typedef pointPatch Patch; + + //- Type for a \em calculated patch typedef calculatedPointPatchField Calculated; diff --git a/src/OpenFOAM/meshes/pointMesh/pointMesh.H b/src/OpenFOAM/meshes/pointMesh/pointMesh.H index 4fb0831867..16e9b92319 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointMesh.H +++ b/src/OpenFOAM/meshes/pointMesh/pointMesh.H @@ -32,8 +32,8 @@ Description \*---------------------------------------------------------------------------*/ -#ifndef pointMesh_H -#define pointMesh_H +#ifndef Foam_pointMesh_H +#define Foam_pointMesh_H #include "GeoMesh.H" #include "MeshObject.H" @@ -74,14 +74,19 @@ class pointMesh 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 ClassName("pointMesh"); - typedef pointMesh Mesh; - typedef pointBoundaryMesh BoundaryMesh; - - // Constructors //- Construct from polyMesh diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.C index 784572c414..f00bb8cbb4 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.C @@ -28,13 +28,11 @@ License #include "coupledPointPatch.H" #include "pointBoundaryMesh.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { -defineTypeNameAndDebug(coupledPointPatch, 0); + defineTypeNameAndDebug(coupledPointPatch, 0); } @@ -44,10 +42,4 @@ Foam::coupledPointPatch::coupledPointPatch(const pointBoundaryMesh& bm) {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::coupledPointPatch::~coupledPointPatch() -{} - - // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.H index 457062aa29..88a77c8f18 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/basic/coupled/coupledPointPatch.H @@ -35,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef coupledPointPatch_H -#define coupledPointPatch_H +#ifndef Foam_coupledPointPatch_H +#define Foam_coupledPointPatch_H #include "coupledPolyPatch.H" @@ -45,6 +45,7 @@ SourceFiles namespace Foam { +// Forward Declarations class pointBoundaryMesh; /*---------------------------------------------------------------------------*\ @@ -53,15 +54,6 @@ class pointBoundaryMesh; class coupledPointPatch { - // Private Member Functions - - //- No copy construct - coupledPointPatch(const coupledPointPatch&) = delete; - - //- No copy assignment - void operator=(const coupledPointPatch&) = delete; - - protected: // Protected Member Functions @@ -85,6 +77,12 @@ protected: virtual void updateMesh(PstreamBuffers&) = 0; + //- No copy construct + coupledPointPatch(const coupledPointPatch&) = delete; + + //- No copy assignment + void operator=(const coupledPointPatch&) = delete; + public: //- Runtime type information @@ -94,12 +92,11 @@ public: // Constructors //- Construct from components - coupledPointPatch(const pointBoundaryMesh& bm); + explicit coupledPointPatch(const pointBoundaryMesh& bm); //- Destructor - virtual ~coupledPointPatch(); - + virtual ~coupledPointPatch() = default; }; diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclicSlip/cyclicSlipPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclicSlip/cyclicSlipPointPatch.H index dbb531f391..7b8d8ec754 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclicSlip/cyclicSlipPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/cyclicSlip/cyclicSlipPointPatch.H @@ -74,9 +74,8 @@ public: {} - // Destructor - - virtual ~cyclicSlipPointPatch() = default; + //- Destructor + virtual ~cyclicSlipPointPatch() = default; // Member Functions diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C index 6a3018f31e..4542912bb8 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.C @@ -52,7 +52,7 @@ namespace Foam void Foam::processorPointPatch::initGeometry(PstreamBuffers& pBufs) { // 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. // 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_; -} - - // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H index de76a27dd3..df6a488b41 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processor/processorPointPatch.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2013 OpenFOAM Foundation + Copyright (C) 2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,7 +35,7 @@ Description patch they need to be identical on both sides with the normals pointing in opposite directions. This is achieved by calling the reverseFace 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. SourceFiles @@ -42,8 +43,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef processorPointPatch_H -#define processorPointPatch_H +#ifndef Foam_processorPointPatch_H +#define Foam_processorPointPatch_H #include "coupledFacePointPatch.H" #include "processorPolyPatch.H" @@ -61,7 +62,7 @@ class processorPointPatch : public coupledFacePointPatch { - // Private data + // Private Data const processorPolyPatch& procPolyPatch_; @@ -112,10 +113,10 @@ public: //- Destructor - virtual ~processorPointPatch(); + virtual ~processorPointPatch() = default; - // Member functions + // Member Functions //- Return message tag to use for communication virtual int tag() const @@ -147,16 +148,16 @@ public: return procPolyPatch_.neighbProcNo(); } - //- Is this a master patch - bool isMaster() const + //- Does the processor own the patch ? + bool owner() const { - return myProcNo() < neighbProcNo(); + return procPolyPatch_.owner(); } - //- Is this a slave patch - bool isSlave() const + //- Is the processor the patch neighbour ? + bool neighbour() const { - return !isMaster(); + return !owner(); } //- Return the underlying processorPolyPatch @@ -166,8 +167,10 @@ public: } //- Return mesh points in the correct order for the receiving side - const labelList& reverseMeshPoints() const; - + const labelList& reverseMeshPoints() const + { + return reverseMeshPoints_; + } }; diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processorCyclic/processorCyclicPointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processorCyclic/processorCyclicPointPatch.H index f943522bce..c24d032454 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processorCyclic/processorCyclicPointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/constraint/processorCyclic/processorCyclicPointPatch.H @@ -34,7 +34,7 @@ Description patch they need to be identical on both sides with the normals pointing in opposite directions. This is achieved by calling the reverseFace 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. SourceFiles @@ -42,8 +42,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef processorCyclicPointPatch_H -#define processorCyclicPointPatch_H +#ifndef Foam_processorCyclicPointPatch_H +#define Foam_processorCyclicPointPatch_H #include "processorPointPatch.H" #include "processorCyclicPolyPatch.H" @@ -61,10 +61,13 @@ class processorCyclicPointPatch : public processorPointPatch { - // Private data + // Private Data const processorCyclicPolyPatch& procCycPolyPatch_; + + // Private Member Functions + //- No copy construct processorCyclicPointPatch(const processorCyclicPointPatch&) = delete; @@ -87,13 +90,11 @@ public: ); - // Destructor - - virtual ~processorCyclicPointPatch(); + //- Destructor + virtual ~processorCyclicPointPatch(); - // Member functions - + // Member Functions //- Return message tag to use for communication virtual int tag() const diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.C b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.C index f7992fdd72..40ab33cdd9 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.C +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.C @@ -32,7 +32,7 @@ License namespace Foam { -defineTypeNameAndDebug(coupledFacePointPatch, 0); + defineTypeNameAndDebug(coupledFacePointPatch, 0); } @@ -50,10 +50,4 @@ Foam::coupledFacePointPatch::coupledFacePointPatch {} -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::coupledFacePointPatch::~coupledFacePointPatch() -{} - - // ************************************************************************* // diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H index 1cbd7345d1..e3701771b4 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/derived/coupled/coupledFacePointPatch.H @@ -35,8 +35,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef coupledFacePointPatch_H -#define coupledFacePointPatch_H +#ifndef Foam_coupledFacePointPatch_H +#define Foam_coupledFacePointPatch_H #include "coupledPointPatch.H" #include "facePointPatch.H" @@ -47,8 +47,6 @@ SourceFiles namespace Foam { -class pointBoundaryMesh; - /*---------------------------------------------------------------------------*\ Class coupledFacePointPatch Declaration \*---------------------------------------------------------------------------*/ @@ -58,12 +56,18 @@ class coupledFacePointPatch public facePointPatch, public coupledPointPatch { - // Private data + // Private Data const coupledPolyPatch& coupledPolyPatch_; - // Private Member Functions +protected: + + // Protected Member Functions + + //- Calculate mesh points + virtual void calcGeometry(PstreamBuffers&) = 0; + //- No copy construct coupledFacePointPatch(const coupledFacePointPatch&) = delete; @@ -72,14 +76,6 @@ class coupledFacePointPatch void operator=(const coupledFacePointPatch&) = delete; -protected: - - // Construction of demand-driven data - - //- Calculate mesh points - virtual void calcGeometry(PstreamBuffers&) = 0; - - public: //- Runtime type information @@ -97,7 +93,7 @@ public: //- Destructor - virtual ~coupledFacePointPatch(); + virtual ~coupledFacePointPatch() = default; }; diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H index 539f2901a0..efb6c47899 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/facePointPatch/facePointPatch.H @@ -32,12 +32,12 @@ Description SourceFiles facePointPatch.C - newPointPatch.C + facePointPatchNew.C \*---------------------------------------------------------------------------*/ -#ifndef facePointPatch_H -#define facePointPatch_H +#ifndef Foam_facePointPatch_H +#define Foam_facePointPatch_H #include "pointPatch.H" #include "polyPatch.H" @@ -61,7 +61,7 @@ class facePointPatch { protected: - // Protected data + // Protected Data //- Reference to the underlying polyPatch const polyPatch& polyPatch_; diff --git a/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H b/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H index fdd5fb42d5..22b6e19438 100644 --- a/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H +++ b/src/OpenFOAM/meshes/pointMesh/pointPatches/pointPatch/pointPatch.H @@ -68,6 +68,7 @@ class pointPatch //- Reference to boundary mesh const pointBoundaryMesh& boundaryMesh_; + protected: // Protected Member Functions @@ -152,10 +153,10 @@ public: //- Return mesh points virtual const labelList& meshPoints() const = 0; - //- Return mesh points + //- Return pointField of points in patch virtual const vectorField& localPoints() const = 0; - //- Return point normals + //- Return point unit normals virtual const vectorField& pointNormals() const = 0; //- Return the constraint type this pointPatch implements. diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.H b/src/OpenFOAM/meshes/polyMesh/polyMesh.H index 4a631d55a7..ac41ac9625 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.H @@ -306,9 +306,12 @@ private: public: - // Public typedefs + // Public Typedefs + //- The mesh type typedef polyMesh Mesh; + + //- The boundary type associated with the mesh typedef polyBoundaryMesh BoundaryMesh; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C index 6b62c55f54..771d2f3170 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C @@ -484,8 +484,8 @@ void Foam::cyclicPolyPatch::getCentresAndAnchors << endl; } - // Note: getCentresAndAnchors gets called on the slave side - // so separationVector is owner-slave points. + // Note: getCentresAndAnchors gets called on the neighbour side + // so separationVector is owner-neighbour points. half0Ctrs -= separationVector_; anchors0 -= separationVector_; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C index 06bff44cf7..f3989dc66a 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C @@ -358,7 +358,7 @@ bool Foam::processorCyclicPolyPatch::order // (ab)use the cyclicPolyPatch ordering: // - 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()); return cycPatch.order(pBufs, pp, faceMap, rotation); diff --git a/src/OpenFOAM/orientedType/orientedType.C b/src/OpenFOAM/orientedType/orientedType.C index f22f9636ef..0a04b1bfcc 100644 --- a/src/OpenFOAM/orientedType/orientedType.C +++ b/src/OpenFOAM/orientedType/orientedType.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2021 OpenCFD Ltd. + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -63,21 +63,21 @@ bool Foam::orientedType::checkType // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::orientedType::orientedType() +Foam::orientedType::orientedType() noexcept : oriented_(UNKNOWN) {} -Foam::orientedType::orientedType(const orientedType& ot) +Foam::orientedType::orientedType(const orientedType& ot) noexcept : 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; } diff --git a/src/OpenFOAM/orientedType/orientedType.H b/src/OpenFOAM/orientedType/orientedType.H index 608c7656f7..8cfebe9655 100644 --- a/src/OpenFOAM/orientedType/orientedType.H +++ b/src/OpenFOAM/orientedType/orientedType.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2021 OpenCFD Ltd. + Copyright (C) 2017-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,8 +34,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef orientedType_H -#define orientedType_H +#ifndef Foam_orientedType_H +#define Foam_orientedType_H #include "Enum.H" @@ -61,7 +61,7 @@ public: // Public Data Types //- Enumeration defining oriented flags - enum orientedOption + enum orientedOption : unsigned char { UNKNOWN = 0, ORIENTED = 1, @@ -84,14 +84,14 @@ public: // Constructors - //- Default construct as "UNKNOWN" - orientedType(); + //- Default construct as \c UNKNOWN + orientedType() noexcept; //- Copy construct - orientedType(const orientedType& ot); + orientedType(const orientedType& ot) noexcept; //- Construct from bool - explicit orientedType(const bool oriented); + explicit orientedType(const bool isOriented) noexcept; //- Construct from Istream explicit orientedType(Istream& is); @@ -112,19 +112,25 @@ public: //- Return the oriented flag orientedOption oriented() const noexcept; - //- Set the oriented flag - void setOriented(const bool oriented = true) noexcept; + //- Set the oriented flag: on/off + void setOriented(const bool on = true) noexcept; //- Read the "oriented" state from dictionary 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 bool writeEntry(Ostream& os) const; // 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); @@ -133,7 +139,9 @@ public: void operator/=(const orientedType& ot); 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 diff --git a/src/finiteArea/faMesh/faMesh.H b/src/finiteArea/faMesh/faMesh.H index 7d4bd4704d..3cdcc6811f 100644 --- a/src/finiteArea/faMesh/faMesh.H +++ b/src/finiteArea/faMesh/faMesh.H @@ -485,7 +485,10 @@ public: // Public Typedefs + //- The mesh type typedef faMesh Mesh; + + //- The boundary type associated with the mesh typedef faBoundaryMesh BoundaryMesh; diff --git a/src/finiteArea/faMesh/faPatches/faPatch/faPatch.H b/src/finiteArea/faMesh/faPatches/faPatch/faPatch.H index 35d19bd11c..73b55bf598 100644 --- a/src/finiteArea/faMesh/faPatches/faPatch/faPatch.H +++ b/src/finiteArea/faMesh/faPatches/faPatch/faPatch.H @@ -146,8 +146,10 @@ protected: public: + //- The boundary type associated with the patch typedef faBoundaryMesh BoundaryMesh; + //- Runtime type information TypeName("patch"); diff --git a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H index 3ec4c8a26c..a6cf3cb170 100644 --- a/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H +++ b/src/finiteArea/fields/faPatchFields/faPatchField/faPatchField.H @@ -101,7 +101,13 @@ class faPatchField public: + //- The internal field type associated with the patch field + typedef DimensionedField Internal; + + //- The patch type for the patch field typedef faPatch Patch; + + //- Type for a \em calculated patch typedef calculatedFaPatchField Calculated; diff --git a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H index ab434bc053..679bebca54 100644 --- a/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H +++ b/src/finiteArea/fields/faePatchFields/faePatchField/faePatchField.H @@ -45,8 +45,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef faePatchField_H -#define faePatchField_H +#ifndef Foam_faePatchField_H +#define Foam_faePatchField_H #include "faPatch.H" #include "DimensionedField.H" @@ -82,7 +82,7 @@ class faePatchField : public Field { - // Private data + // Private Data //- Reference to a patch const faPatch& patch_; @@ -93,7 +93,13 @@ class faePatchField public: + //- The internal field type associated with the patch field + typedef DimensionedField Internal; + + //- The patch type for the patch field typedef faPatch Patch; + + //- Type for a \em calculated patch typedef calculatedFaePatchField Calculated; diff --git a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H index ce9c89d4fd..4db51f93a4 100644 --- a/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H +++ b/src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019-2021 OpenCFD Ltd. + Copyright (C) 2019-2022 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -44,8 +44,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef fvPatchField_H -#define fvPatchField_H +#ifndef Foam_fvPatchField_H +#define Foam_fvPatchField_H #include "fvPatch.H" #include "DimensionedField.H" @@ -108,7 +108,13 @@ class fvPatchField public: + //- The internal field type associated with the patch field + typedef DimensionedField Internal; + + //- The patch type for the patch field typedef fvPatch Patch; + + //- Type for a \em calculated patch typedef calculatedFvPatchField Calculated; diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H index c65ee8877d..0ac5952136 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.H @@ -44,8 +44,8 @@ SourceFiles \*---------------------------------------------------------------------------*/ -#ifndef fvsPatchField_H -#define fvsPatchField_H +#ifndef Foam_fvsPatchField_H +#define Foam_fvsPatchField_H #include "fvPatch.H" #include "DimensionedField.H" @@ -78,7 +78,7 @@ class fvsPatchField : public Field { - // Private data + // Private Data //- Reference to patch const fvPatch& patch_; @@ -89,7 +89,13 @@ class fvsPatchField public: + //- The internal field type associated with the patch field + typedef DimensionedField Internal; + + //- The patch type for the patch field typedef fvPatch Patch; + + //- Type for a \em calculated patch typedef calculatedFvsPatchField Calculated; diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H index 4415f5b9a9..a8a7d09631 100644 --- a/src/finiteVolume/fvMesh/fvMesh.H +++ b/src/finiteVolume/fvMesh/fvMesh.H @@ -174,9 +174,12 @@ protected: public: - // Public typedefs + // Public Typedefs + //- The mesh type typedef fvMesh Mesh; + + //- The boundary type associated with the mesh typedef fvBoundaryMesh BoundaryMesh; diff --git a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H index 9f1a73a006..b184dd0ec6 100644 --- a/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H +++ b/src/finiteVolume/fvMesh/fvPatches/fvPatch/fvPatch.H @@ -113,6 +113,7 @@ public: public: + //- The boundary type associated with the patch typedef fvBoundaryMesh BoundaryMesh; friend class fvBoundaryMesh; diff --git a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C index a92364d0cc..43f77436c1 100644 --- a/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C +++ b/src/finiteVolume/interpolation/volPointInterpolation/volPointInterpolate.C @@ -89,13 +89,10 @@ void Foam::volPointInterpolation::addSeparated Pout<< "volPointInterpolation::addSeparated" << endl; } - typename GeometricField:: - Internal& pfi = pf.ref(); + auto& pfi = pf.ref(); + auto& pfbf = pf.boundaryFieldRef(); - typename GeometricField:: - Boundary& pfbf = pf.boundaryFieldRef(); - - const label nReq = Pstream::nRequests(); + const label startOfRequests = UPstream::nRequests(); forAll(pfbf, patchi) { @@ -110,8 +107,8 @@ void Foam::volPointInterpolation::addSeparated } } - // Block for any outstanding requests - Pstream::waitRequests(nReq); + // Wait for outstanding requests + UPstream::waitRequests(startOfRequests); forAll(pfbf, patchi) { diff --git a/src/functionObjects/field/mapFields/mapFieldsTemplates.C b/src/functionObjects/field/mapFields/mapFieldsTemplates.C index 54d268270e..c5e6968d96 100644 --- a/src/functionObjects/field/mapFields/mapFieldsTemplates.C +++ b/src/functionObjects/field/mapFields/mapFieldsTemplates.C @@ -36,17 +36,17 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes GeometricField& fld ) const { - typedef GeometricField VolFieldType; + auto& fldBf = fld.boundaryFieldRef(); - typename VolFieldType::Boundary& fldBf = fld.boundaryFieldRef(); + const UPstream::commsTypes commsType(UPstream::defaultCommsType); if ( - Pstream::defaultCommsType == Pstream::commsTypes::blocking - || Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking + commsType == UPstream::commsTypes::blocking + || commsType == UPstream::commsTypes::nonBlocking ) { - const label nReq = Pstream::nRequests(); + const label startOfRequests = UPstream::nRequests(); forAll(fldBf, patchi) { @@ -58,18 +58,18 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes && polyPatch::constraintType(tgtField.patch().patch().type()) ) { - tgtField.initEvaluate(Pstream::defaultCommsType); + tgtField.initEvaluate(commsType); } } - // Block for any outstanding requests + // Wait for outstanding requests if ( - Pstream::parRun() - && Pstream::defaultCommsType == Pstream::commsTypes::nonBlocking + UPstream::parRun() + && commsType == UPstream::commsTypes::nonBlocking ) { - Pstream::waitRequests(nReq); + UPstream::waitRequests(startOfRequests); } forAll(fldBf, patchi) @@ -82,11 +82,11 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes && 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 = fld.mesh().globalData().patchSchedule(); @@ -105,11 +105,11 @@ void Foam::functionObjects::mapFields::evaluateConstraintTypes { if (schedEval.init) { - tgtField.initEvaluate(Pstream::commsTypes::scheduled); + tgtField.initEvaluate(commsType); } else { - tgtField.evaluate(Pstream::commsTypes::scheduled); + tgtField.evaluate(commsType); } } } diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C index e8e889bd7c..688913f5dd 100644 --- a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMeshTemplates.C @@ -119,27 +119,31 @@ void Foam::dynamicOversetFvMesh::correctBoundaryConditions const bool typeOnly ) { - const label nReq = Pstream::nRequests(); + const label startOfRequests = UPstream::nRequests(); forAll(bfld, patchi) { if (typeOnly == (isA(bfld[patchi]) != nullptr)) { - bfld[patchi].initEvaluate(Pstream::defaultCommsType); + bfld[patchi].initEvaluate(UPstream::defaultCommsType); } } - // Block for any outstanding requests - if (Pstream::parRun()) + // Wait for outstanding requests + if + ( + UPstream::parRun() + && UPstream::defaultCommsType == UPstream::commsTypes::nonBlocking + ) { - Pstream::waitRequests(nReq); + UPstream::waitRequests(startOfRequests); } forAll(bfld, patchi) { if (typeOnly == (isA(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(); - const label nReq = Pstream::nRequests(); + const label startOfRequests = UPstream::nRequests(); forAll(bfld, patchi) { @@ -910,10 +914,14 @@ void Foam::dynamicOversetFvMesh::correctCoupledBoundaryConditions(GeoField& fld) } } - // Block for any outstanding requests - if (Pstream::parRun()) + // Wait for outstanding requests + if + ( + UPstream::parRun() + && UPstream::defaultCommsType == UPstream::commsTypes::nonBlocking + ) { - Pstream::waitRequests(nReq); + UPstream::waitRequests(startOfRequests); } forAll(bfld, patchi)