diff --git a/src/parallel/decompose/decompose/Make/files b/src/parallel/decompose/decompose/Make/files index 47689307fa..4435b3cb4f 100644 --- a/src/parallel/decompose/decompose/Make/files +++ b/src/parallel/decompose/decompose/Make/files @@ -1,15 +1,15 @@ -decompositionInformation.C -decompositionModel.C +decompositionInformation.cxx +decompositionModel.cxx -dimFieldDecomposer.C +dimFieldDecomposer.cxx -fvFieldDecomposer.C -fvFieldDecomposerCache.C +fvFieldDecomposer.cxx +fvFieldDecomposerCache.cxx -pointFieldDecomposer.C -pointFieldDecomposerCache.C +pointFieldDecomposer.cxx +pointFieldDecomposerCache.cxx -lagrangianFieldDecomposer.C -lagrangianFieldDecomposerCache.C +lagrangianFieldDecomposer.cxx +lagrangianFieldDecomposerCache.cxx LIB = $(FOAM_LIBBIN)/libdecompose diff --git a/src/parallel/decompose/decompose/decompositionInformation.C b/src/parallel/decompose/decompose/decompositionInformation.cxx similarity index 97% rename from src/parallel/decompose/decompose/decompositionInformation.C rename to src/parallel/decompose/decompose/decompositionInformation.cxx index 8b4a31b7b4..1a52035e55 100644 --- a/src/parallel/decompose/decompose/decompositionInformation.C +++ b/src/parallel/decompose/decompose/decompositionInformation.cxx @@ -55,7 +55,7 @@ void Foam::decompositionInformation::populate { const label ownProc = decomp[celli]; - labelList& subdist = distrib_[ownProc]; + labelUList& subdist = distrib_[ownProc]; // Number of cells ++subdist[ownProc]; @@ -80,7 +80,7 @@ void Foam::decompositionInformation::populate forAll(distrib_, ownProc) { - const labelList& subdist = distrib_[ownProc]; + const labelUList& subdist = distrib_[ownProc]; cellsCount[ownProc] = subdist[ownProc]; @@ -172,7 +172,7 @@ void Foam::decompositionInformation::printDetails(Ostream& os) const forAll(distrib_, ownProc) { - const labelList& subdist = distrib_[ownProc]; + const labelUList& subdist = distrib_[ownProc]; // First pass: label neighCount = 0; diff --git a/src/parallel/decompose/decompose/decompositionModel.C b/src/parallel/decompose/decompose/decompositionModel.cxx similarity index 100% rename from src/parallel/decompose/decompose/decompositionModel.C rename to src/parallel/decompose/decompose/decompositionModel.cxx diff --git a/src/parallel/decompose/decompose/dimFieldDecomposer.H b/src/parallel/decompose/decompose/dimFieldDecomposer.H index 01cd176339..8cd3a1ba8f 100644 --- a/src/parallel/decompose/decompose/dimFieldDecomposer.H +++ b/src/parallel/decompose/decompose/dimFieldDecomposer.H @@ -31,8 +31,8 @@ Description Dimensioned field decomposer. SourceFiles - dimFieldDecomposer.C - dimFieldDecomposerTemplates.C + dimFieldDecomposer.cxx + dimFieldDecomposer.txx \*---------------------------------------------------------------------------*/ @@ -40,7 +40,7 @@ SourceFiles #define Foam_dimFieldDecomposer_H #include "fvMesh.H" -#include "surfaceFields.H" +#include "DimensionedField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -59,10 +59,10 @@ class dimFieldDecomposer const fvMesh& procMesh_; //- Reference to face addressing - //UNUSED: const labelList& faceAddressing_; + //UNUSED: const labelUList& faceAddressing_; //- Reference to cell addressing - const labelList& cellAddressing_; + const labelUList& cellAddressing_; public: @@ -80,7 +80,7 @@ public: dimFieldDecomposer ( const fvMesh& procMesh, - const labelList& cellAddressing + const labelUList& cellAddressing ); //- Construct from components with API as per fvFieldDecomposer @@ -88,8 +88,8 @@ public: ( const fvMesh& completeMesh, //!< unused const fvMesh& procMesh, - const labelList& faceAddressing, //!< unused - const labelList& cellAddressing + const labelUList& faceAddressing, //!< unused + const labelUList& cellAddressing ); @@ -110,7 +110,7 @@ public: //- Decompose list of fields template - void decomposeFields(const PtrList& fields) const; + void decomposeFields(const UPtrList& fields) const; }; @@ -121,7 +121,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "dimFieldDecomposerTemplates.C" + #include "dimFieldDecomposer.txx" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/parallel/decompose/decompose/dimFieldDecomposer.C b/src/parallel/decompose/decompose/dimFieldDecomposer.cxx similarity index 93% rename from src/parallel/decompose/decompose/dimFieldDecomposer.C rename to src/parallel/decompose/decompose/dimFieldDecomposer.cxx index dbef4df61e..c83ad5e0f8 100644 --- a/src/parallel/decompose/decompose/dimFieldDecomposer.C +++ b/src/parallel/decompose/decompose/dimFieldDecomposer.cxx @@ -33,7 +33,7 @@ License Foam::dimFieldDecomposer::dimFieldDecomposer ( const fvMesh& procMesh, - const labelList& cellAddressing + const labelUList& cellAddressing ) : procMesh_(procMesh), @@ -45,8 +45,8 @@ Foam::dimFieldDecomposer::dimFieldDecomposer ( const fvMesh& /* unused: completeMesh */, const fvMesh& procMesh, - const labelList& /* unused: faceAddressing */, - const labelList& cellAddressing + const labelUList& /* unused: faceAddressing */, + const labelUList& cellAddressing ) : procMesh_(procMesh), diff --git a/src/parallel/decompose/decompose/dimFieldDecomposerTemplates.C b/src/parallel/decompose/decompose/dimFieldDecomposer.txx similarity index 98% rename from src/parallel/decompose/decompose/dimFieldDecomposerTemplates.C rename to src/parallel/decompose/decompose/dimFieldDecomposer.txx index 4ffa33ec85..14151a62c6 100644 --- a/src/parallel/decompose/decompose/dimFieldDecomposerTemplates.C +++ b/src/parallel/decompose/decompose/dimFieldDecomposer.txx @@ -54,7 +54,7 @@ Foam::dimFieldDecomposer::decomposeField template void Foam::dimFieldDecomposer::decomposeFields ( - const PtrList& fields + const UPtrList& fields ) const { for (const auto& fld : fields) diff --git a/src/parallel/decompose/decompose/fvFieldDecomposer.H b/src/parallel/decompose/decompose/fvFieldDecomposer.H index 5731951494..9f8895bdbd 100644 --- a/src/parallel/decompose/decompose/fvFieldDecomposer.H +++ b/src/parallel/decompose/decompose/fvFieldDecomposer.H @@ -31,9 +31,9 @@ Description Finite Volume volume and surface field decomposer. SourceFiles - fvFieldDecomposer.C - fvFieldDecomposerCache.C - fvFieldDecomposerTemplates.C + fvFieldDecomposer.cxx + fvFieldDecomposer.txx + fvFieldDecomposerCache.cxx \*---------------------------------------------------------------------------*/ @@ -42,6 +42,7 @@ SourceFiles #include "fvMesh.H" #include "fvPatchFieldMapper.H" +#include "volFields.H" #include "surfaceFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -62,6 +63,9 @@ public: // Public Classes + //- Internal caching for field reading + class fieldsCache; + //- Patch field decomposer class class patchFieldDecomposer : @@ -85,23 +89,23 @@ public: // Member Functions - label size() const + label size() const noexcept { return directAddressing_.size(); } - bool direct() const + bool direct() const noexcept { return true; } //- Are there unmapped values - bool hasUnmapped() const + bool hasUnmapped() const noexcept { return false; } - const labelUList& directAddressing() const + const labelUList& directAddressing() const noexcept { return directAddressing_; } @@ -139,23 +143,23 @@ public: // Member Functions - label size() const + label size() const noexcept { return directAddressing_.size(); } - bool direct() const + bool direct() const noexcept { return true; } //- Are there unmapped values - bool hasUnmapped() const + bool hasUnmapped() const noexcept { return false; } - const labelUList& directAddressing() const + const labelUList& directAddressing() const noexcept { return directAddressing_; } @@ -174,36 +178,36 @@ public: public: //- Construct given addressing - processorSurfacePatchFieldDecomposer + explicit processorSurfacePatchFieldDecomposer ( const labelUList& addressingSlice ); - // Member functions + // Member Functions - label size() const + label size() const noexcept { return addressing_.size(); } - bool direct() const + bool direct() const noexcept { return false; } //- Are there unmapped values - bool hasUnmapped() const + bool hasUnmapped() const noexcept { return false; } - const labelListList& addressing() const + const labelListList& addressing() const noexcept { return addressing_; } - const scalarListList& weights() const + const scalarListList& weights() const noexcept { return weights_; } @@ -218,13 +222,13 @@ private: const fvMesh& procMesh_; //- Reference to face addressing - const labelList& faceAddressing_; + const labelUList& faceAddressing_; //- Reference to cell addressing - const labelList& cellAddressing_; + const labelUList& cellAddressing_; //- Reference to boundary addressing - const labelList& boundaryAddressing_; + const labelUList& boundaryAddressing_; //- List of patch field decomposers PtrList patchFieldDecomposerPtrs_; @@ -248,10 +252,6 @@ private: public: - // Public Classes - class fieldsCache; - - // Static Data //- Output verbosity when writing @@ -263,11 +263,11 @@ public: //- Construct without mappers, added later with reset() fvFieldDecomposer ( - const Foam::zero, + Foam::zero, const fvMesh& procMesh, - const labelList& faceAddressing, - const labelList& cellAddressing, - const labelList& boundaryAddressing + const labelUList& faceAddressing, + const labelUList& cellAddressing, + const labelUList& boundaryAddressing ); //- Construct from components using information from the complete mesh @@ -275,24 +275,24 @@ public: ( const fvMesh& completeMesh, const fvMesh& procMesh, - const labelList& faceAddressing, - const labelList& cellAddressing, - const labelList& boundaryAddressing + const labelUList& faceAddressing, + const labelUList& cellAddressing, + const labelUList& boundaryAddressing ); //- Construct from components without the complete mesh fvFieldDecomposer ( // Information about the complete mesh - const List& boundaryRanges, + const UList& boundaryRanges, const labelUList& faceOwner, const labelUList& faceNeigbour, // Addressing for processor mesh const fvMesh& procMesh, - const labelList& faceAddressing, - const labelList& cellAddressing, - const labelList& boundaryAddressing + const labelUList& faceAddressing, + const labelUList& cellAddressing, + const labelUList& boundaryAddressing ); @@ -303,7 +303,7 @@ public: // Member Functions //- True if no mappers have been allocated - bool empty() const; + bool empty() const noexcept; //- Remove all mappers void clear(); @@ -314,7 +314,7 @@ public: //- Reset mapper using information about the complete mesh void reset ( - const List& boundaryRanges, + const UList& boundaryRanges, const labelUList& faceOwner, const labelUList& faceNeigbour ); @@ -349,7 +349,7 @@ public: //- Decompose list of fields template - void decomposeFields(const PtrList& fields) const; + void decomposeFields(const UPtrList& fields) const; }; @@ -359,21 +359,14 @@ public: class fvFieldDecomposer::fieldsCache { - // Private Data + class privateCache; + std::unique_ptr cache_; - class privateCache; + //- No copy construct + fieldsCache(const fieldsCache&) = delete; - //- All field and field-field types for lagrangian - std::unique_ptr cache_; - - - // Private Member Functions - - //- No copy construct - fieldsCache(const fieldsCache&) = delete; - - //- No copy assignment - void operator=(const fieldsCache&) = delete; + //- No copy assignment + void operator=(const fieldsCache&) = delete; public: @@ -391,10 +384,10 @@ public: // Member Functions //- No fields - bool empty() const; + bool empty() const noexcept; //- Total number of fields - label size() const; + label size() const noexcept; //- Clear out void clear(); @@ -423,7 +416,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "fvFieldDecomposerTemplates.C" + #include "fvFieldDecomposer.txx" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/parallel/decompose/decompose/fvFieldDecomposer.C b/src/parallel/decompose/decompose/fvFieldDecomposer.cxx similarity index 84% rename from src/parallel/decompose/decompose/fvFieldDecomposer.C rename to src/parallel/decompose/decompose/fvFieldDecomposer.cxx index 7a1c0116e2..9f573f91ea 100644 --- a/src/parallel/decompose/decompose/fvFieldDecomposer.C +++ b/src/parallel/decompose/decompose/fvFieldDecomposer.cxx @@ -135,22 +135,17 @@ processorSurfacePatchFieldDecomposer Foam::fvFieldDecomposer::fvFieldDecomposer ( - const Foam::zero, + Foam::zero, const fvMesh& procMesh, - const labelList& faceAddressing, - const labelList& cellAddressing, - const labelList& boundaryAddressing + const labelUList& faceAddressing, + const labelUList& cellAddressing, + const labelUList& boundaryAddressing ) : procMesh_(procMesh), faceAddressing_(faceAddressing), cellAddressing_(cellAddressing), - boundaryAddressing_(boundaryAddressing), - // Mappers - patchFieldDecomposerPtrs_(), - processorVolPatchFieldDecomposerPtrs_(), - processorSurfacePatchFieldDecomposerPtrs_(), - faceSign_() + boundaryAddressing_(boundaryAddressing) {} @@ -158,14 +153,14 @@ Foam::fvFieldDecomposer::fvFieldDecomposer ( const fvMesh& completeMesh, const fvMesh& procMesh, - const labelList& faceAddressing, - const labelList& cellAddressing, - const labelList& boundaryAddressing + const labelUList& faceAddressing, + const labelUList& cellAddressing, + const labelUList& boundaryAddressing ) : fvFieldDecomposer ( - zero{}, + Foam::zero{}, procMesh, faceAddressing, cellAddressing, @@ -178,19 +173,19 @@ Foam::fvFieldDecomposer::fvFieldDecomposer Foam::fvFieldDecomposer::fvFieldDecomposer ( - const List& boundaryRanges, + const UList& boundaryRanges, const labelUList& faceOwner, const labelUList& faceNeighbour, const fvMesh& procMesh, - const labelList& faceAddressing, - const labelList& cellAddressing, - const labelList& boundaryAddressing + const labelUList& faceAddressing, + const labelUList& cellAddressing, + const labelUList& boundaryAddressing ) : fvFieldDecomposer ( - zero{}, + Foam::zero{}, procMesh, faceAddressing, cellAddressing, @@ -203,7 +198,7 @@ Foam::fvFieldDecomposer::fvFieldDecomposer // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::fvFieldDecomposer::empty() const +bool Foam::fvFieldDecomposer::empty() const noexcept { return patchFieldDecomposerPtrs_.empty(); } @@ -220,17 +215,17 @@ void Foam::fvFieldDecomposer::clear() void Foam::fvFieldDecomposer::reset ( - const List& boundaryRanges, + const UList& boundaryRanges, const labelUList& faceOwner, const labelUList& faceNeighbour ) { - clear(); const label nMappers = procMesh_.boundary().size(); - patchFieldDecomposerPtrs_.resize(nMappers); - processorVolPatchFieldDecomposerPtrs_.resize(nMappers); - processorSurfacePatchFieldDecomposerPtrs_.resize(nMappers); - faceSign_.resize(nMappers); + + patchFieldDecomposerPtrs_.resize_null(nMappers); + processorVolPatchFieldDecomposerPtrs_.resize_null(nMappers); + processorSurfacePatchFieldDecomposerPtrs_.resize_null(nMappers); + faceSign_.resize_null(nMappers); forAll(boundaryAddressing_, patchi) { @@ -270,10 +265,7 @@ void Foam::fvFieldDecomposer::reset processorSurfacePatchFieldDecomposerPtrs_.set ( patchi, - new processorSurfacePatchFieldDecomposer - ( - static_cast(localPatchSlice) - ) + new processorSurfacePatchFieldDecomposer(localPatchSlice) ); faceSign_.set @@ -296,12 +288,12 @@ void Foam::fvFieldDecomposer::reset void Foam::fvFieldDecomposer::reset(const fvMesh& completeMesh) { - clear(); const label nMappers = procMesh_.boundary().size(); - patchFieldDecomposerPtrs_.resize(nMappers); - processorVolPatchFieldDecomposerPtrs_.resize(nMappers); - processorSurfacePatchFieldDecomposerPtrs_.resize(nMappers); - faceSign_.resize(nMappers); + + patchFieldDecomposerPtrs_.resize_null(nMappers); + processorVolPatchFieldDecomposerPtrs_.resize_null(nMappers); + processorSurfacePatchFieldDecomposerPtrs_.resize_null(nMappers); + faceSign_.resize_null(nMappers); forAll(boundaryAddressing_, patchi) { @@ -340,10 +332,7 @@ void Foam::fvFieldDecomposer::reset(const fvMesh& completeMesh) processorSurfacePatchFieldDecomposerPtrs_.set ( patchi, - new processorSurfacePatchFieldDecomposer - ( - static_cast(localPatchSlice) - ) + new processorSurfacePatchFieldDecomposer(localPatchSlice) ); faceSign_.set diff --git a/src/parallel/decompose/decompose/fvFieldDecomposerTemplates.C b/src/parallel/decompose/decompose/fvFieldDecomposer.txx similarity index 99% rename from src/parallel/decompose/decompose/fvFieldDecomposerTemplates.C rename to src/parallel/decompose/decompose/fvFieldDecomposer.txx index 9e5cfd727b..40f2699247 100644 --- a/src/parallel/decompose/decompose/fvFieldDecomposerTemplates.C +++ b/src/parallel/decompose/decompose/fvFieldDecomposer.txx @@ -295,7 +295,7 @@ Foam::fvFieldDecomposer::decomposeField template void Foam::fvFieldDecomposer::decomposeFields ( - const PtrList& fields + const UPtrList& fields ) const { for (const auto& fld : fields) diff --git a/src/parallel/decompose/decompose/fvFieldDecomposerCache.C b/src/parallel/decompose/decompose/fvFieldDecomposerCache.cxx similarity index 97% rename from src/parallel/decompose/decompose/fvFieldDecomposerCache.C rename to src/parallel/decompose/decompose/fvFieldDecomposerCache.cxx index 27bdee2aeb..08301abd39 100644 --- a/src/parallel/decompose/decompose/fvFieldDecomposerCache.C +++ b/src/parallel/decompose/decompose/fvFieldDecomposerCache.cxx @@ -119,7 +119,7 @@ public: static void decompose ( const fvFieldDecomposer& decomposer, - const PtrList& fields, + const UPtrList& fields, bool report ) { @@ -181,13 +181,13 @@ Foam::fvFieldDecomposer::fieldsCache::~fieldsCache() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::fvFieldDecomposer::fieldsCache::empty() const +bool Foam::fvFieldDecomposer::fieldsCache::empty() const noexcept { return (!cache_ || cache_->empty()); } -Foam::label Foam::fvFieldDecomposer::fieldsCache::size() const +Foam::label Foam::fvFieldDecomposer::fieldsCache::size() const noexcept { return (cache_ ? cache_->size() : label(0)); } diff --git a/src/parallel/decompose/decompose/lagrangianFieldDecomposer.H b/src/parallel/decompose/decompose/lagrangianFieldDecomposer.H index 66284c6fc8..01be977328 100644 --- a/src/parallel/decompose/decompose/lagrangianFieldDecomposer.H +++ b/src/parallel/decompose/decompose/lagrangianFieldDecomposer.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2022 OpenCFD Ltd. + Copyright (C) 2022-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -31,10 +31,9 @@ Description Lagrangian field decomposer. SourceFiles - lagrangianFieldDecomposer.C - lagrangianFieldDecomposerCache.C - lagrangianFieldDecomposerReadFields.C - lagrangianFieldDecomposerTemplates.C + lagrangianFieldDecomposer.cxx + lagrangianFieldDecomposer.txx + lagrangianFieldDecomposerCache.cxx \*---------------------------------------------------------------------------*/ @@ -92,13 +91,13 @@ public: //- Construct from components lagrangianFieldDecomposer ( - const polyMesh& mesh, //& lagrangianPositions, - const List*>& cellParticles + const UList*>& cellParticles ); @@ -125,7 +124,7 @@ public: // Member Functions - //- Decompose volume field + //- Decompose field template tmp> decomposeField ( @@ -133,6 +132,7 @@ public: const IOField& field ) const; + //- Decompose field-field template tmp>> decomposeFieldField ( @@ -141,18 +141,20 @@ public: ) const; + //- Decompose fields template void decomposeFields ( const word& cloudName, - const PtrList& fields + const UPtrList& fields ) const; + //- Decompose field-fields template void decomposeFieldFields ( const word& cloudName, - const PtrList& fields + const UPtrList& fields ) const; }; @@ -163,21 +165,14 @@ public: class lagrangianFieldDecomposer::fieldsCache { - // Private Data + class privateCache; + std::unique_ptr cache_; - class privateCache; + //- No copy construct + fieldsCache(const fieldsCache&) = delete; - //- All field and field-field types for lagrangian - std::unique_ptr cache_; - - - // Private Member Functions - - //- No copy construct - fieldsCache(const fieldsCache&) = delete; - - //- No copy assignment - void operator=(const fieldsCache&) = delete; + //- No copy assignment + void operator=(const fieldsCache&) = delete; public: @@ -188,7 +183,7 @@ public: fieldsCache(); //- Construct for given number of clouds - explicit fieldsCache(const label nClouds); + explicit fieldsCache(label nClouds); //- Destructor @@ -198,16 +193,16 @@ public: // Member Functions //- No clouds - bool empty() const; + bool empty() const noexcept; //- Number of clouds - label size() const; + label size() const noexcept; //- Clear out void clear(); //- Resize for the number of clouds - void resize(const label nClouds); + void resize(label nClouds); //- Read all fields and field-fields for given cloud and objects @@ -235,8 +230,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "lagrangianFieldDecomposerReadFields.C" - #include "lagrangianFieldDecomposerTemplates.C" + #include "lagrangianFieldDecomposer.txx" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/parallel/decompose/decompose/lagrangianFieldDecomposer.C b/src/parallel/decompose/decompose/lagrangianFieldDecomposer.cxx similarity index 94% rename from src/parallel/decompose/decompose/lagrangianFieldDecomposer.C rename to src/parallel/decompose/decompose/lagrangianFieldDecomposer.cxx index 46f3598d67..549faac857 100644 --- a/src/parallel/decompose/decompose/lagrangianFieldDecomposer.C +++ b/src/parallel/decompose/decompose/lagrangianFieldDecomposer.cxx @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -23,9 +24,6 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Description - Lagrangian field decomposer. - \*---------------------------------------------------------------------------*/ #include "lagrangianFieldDecomposer.H" @@ -36,11 +34,11 @@ Foam::lagrangianFieldDecomposer::lagrangianFieldDecomposer ( const polyMesh& mesh, const polyMesh& procMesh, - const labelList& faceProcAddressing, - const labelList& cellProcAddressing, + const labelUList& faceProcAddressing, + const labelUList& cellProcAddressing, const word& cloudName, const Cloud& lagrangianPositions, - const List*>& cellParticles + const UList*>& cellParticles ) : procMesh_(procMesh), diff --git a/src/parallel/decompose/decompose/lagrangianFieldDecomposerTemplates.C b/src/parallel/decompose/decompose/lagrangianFieldDecomposer.txx similarity index 67% rename from src/parallel/decompose/decompose/lagrangianFieldDecomposerTemplates.C rename to src/parallel/decompose/decompose/lagrangianFieldDecomposer.txx index 7df4964718..dfa14bc928 100644 --- a/src/parallel/decompose/decompose/lagrangianFieldDecomposerTemplates.C +++ b/src/parallel/decompose/decompose/lagrangianFieldDecomposer.txx @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2022 OpenCFD Ltd. + Copyright (C) 2022-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -31,6 +31,64 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +void Foam::lagrangianFieldDecomposer::readFields +( + const label cloudi, + const IOobjectList& lagrangianObjects, + PtrList>>& lagrangianFields +) +{ + // Lagrangian field objects + const UPtrList fieldObjects + ( + lagrangianObjects.csorted>() + ); + + + auto& cloudFields = + lagrangianFields.emplace_set(cloudi, fieldObjects.size()); + + forAll(fieldObjects, fieldi) + { + cloudFields.emplace_set(fieldi, fieldObjects[fieldi]); + } +} + + +template +void Foam::lagrangianFieldDecomposer::readFieldFields +( + const label cloudi, + const IOobjectList& lagrangianObjects, + PtrList>>>& lagrangianFields +) +{ + // Lagrangian field objects + UPtrList fieldObjects + ( + lagrangianObjects.cobjects>>() + ); + + // Lagrangian field-field objects + fieldObjects.push_back + ( + lagrangianObjects.cobjects>>() + ); + + Foam::sort(fieldObjects, nameOp()); + + + auto& cloudFields = + lagrangianFields.emplace_set(cloudi, fieldObjects.size()); + + forAll(fieldObjects, fieldi) + { + cloudFields.emplace_set(fieldi, fieldObjects[fieldi]); + } +} + + template Foam::tmp> Foam::lagrangianFieldDecomposer::decomposeField @@ -89,10 +147,10 @@ template void Foam::lagrangianFieldDecomposer::decomposeFields ( const word& cloudName, - const PtrList& fields + const UPtrList& fields ) const { - const bool existsOnProc = (particleIndices_.size() > 0); + const bool existsOnProc = (!particleIndices_.empty()); for (const GeoField& fld : fields) { @@ -105,10 +163,10 @@ template void Foam::lagrangianFieldDecomposer::decomposeFieldFields ( const word& cloudName, - const PtrList& fields + const UPtrList& fields ) const { - const bool existsOnProc = (particleIndices_.size() > 0); + const bool existsOnProc = (!particleIndices_.empty()); for (const GeoField& fld : fields) { diff --git a/src/parallel/decompose/decompose/lagrangianFieldDecomposerCache.C b/src/parallel/decompose/decompose/lagrangianFieldDecomposerCache.cxx similarity index 97% rename from src/parallel/decompose/decompose/lagrangianFieldDecomposerCache.C rename to src/parallel/decompose/decompose/lagrangianFieldDecomposerCache.cxx index 9edb3c1e79..79a9009d67 100644 --- a/src/parallel/decompose/decompose/lagrangianFieldDecomposerCache.C +++ b/src/parallel/decompose/decompose/lagrangianFieldDecomposerCache.cxx @@ -160,10 +160,7 @@ Foam::lagrangianFieldDecomposer::fieldsCache::fieldsCache() {} -Foam::lagrangianFieldDecomposer::fieldsCache::fieldsCache -( - const label nClouds -) +Foam::lagrangianFieldDecomposer::fieldsCache::fieldsCache(label nClouds) : cache_(new privateCache) { @@ -180,13 +177,13 @@ Foam::lagrangianFieldDecomposer::fieldsCache::~fieldsCache() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::lagrangianFieldDecomposer::fieldsCache::empty() const +bool Foam::lagrangianFieldDecomposer::fieldsCache::empty() const noexcept { return (!cache_ || cache_->empty()); } -Foam::label Foam::lagrangianFieldDecomposer::fieldsCache::size() const +Foam::label Foam::lagrangianFieldDecomposer::fieldsCache::size() const noexcept { return (cache_ ? cache_->size() : label(0)); } @@ -198,10 +195,7 @@ void Foam::lagrangianFieldDecomposer::fieldsCache::clear() } -void Foam::lagrangianFieldDecomposer::fieldsCache::resize -( - const label nClouds -) +void Foam::lagrangianFieldDecomposer::fieldsCache::resize(label nClouds) { if (cache_) { diff --git a/src/parallel/decompose/decompose/lagrangianFieldDecomposerReadFields.C b/src/parallel/decompose/decompose/lagrangianFieldDecomposerReadFields.C deleted file mode 100644 index 954636cba7..0000000000 --- a/src/parallel/decompose/decompose/lagrangianFieldDecomposerReadFields.C +++ /dev/null @@ -1,90 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | www.openfoam.com - \\/ M anipulation | -------------------------------------------------------------------------------- - Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2022-2023 OpenCFD Ltd. -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "lagrangianFieldDecomposer.H" -#include "IOobjectList.H" - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -void Foam::lagrangianFieldDecomposer::readFields -( - const label cloudi, - const IOobjectList& lagrangianObjects, - PtrList>>& lagrangianFields -) -{ - // List of lagrangian field objects - const UPtrList fieldObjects - ( - lagrangianObjects.csorted>() - ); - - auto& cloudFields = - lagrangianFields.emplace_set(cloudi, fieldObjects.size()); - - forAll(fieldObjects, fieldi) - { - cloudFields.emplace_set(fieldi, fieldObjects[fieldi]); - } -} - - -template -void Foam::lagrangianFieldDecomposer::readFieldFields -( - const label cloudi, - const IOobjectList& lagrangianObjects, - PtrList>>>& lagrangianFields -) -{ - // List of lagrangian field objects - UPtrList fieldObjects - ( - lagrangianObjects.cobjects>>() - ); - - fieldObjects.push_back - ( - lagrangianObjects.cobjects>>() - ); - - Foam::sort(fieldObjects, nameOp()); - - - auto& cloudFields = - lagrangianFields.emplace_set(cloudi, fieldObjects.size()); - - forAll(fieldObjects, fieldi) - { - cloudFields.emplace_set(fieldi, fieldObjects[fieldi]); - } -} - - -// ************************************************************************* // diff --git a/src/parallel/decompose/decompose/pointFieldDecomposer.H b/src/parallel/decompose/decompose/pointFieldDecomposer.H index b49ae3ce9f..c6567b2ca2 100644 --- a/src/parallel/decompose/decompose/pointFieldDecomposer.H +++ b/src/parallel/decompose/decompose/pointFieldDecomposer.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2021-2022 OpenCFD Ltd. + Copyright (C) 2021-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -31,9 +31,9 @@ Description Point field decomposer. SourceFiles - pointFieldDecomposer.C - pointFieldDecomposerCache.C - pointFieldDecomposerTemplates.C + pointFieldDecomposer.cxx + pointFieldDecomposer.txx + pointFieldDecomposerCache.cxx \*---------------------------------------------------------------------------*/ @@ -41,8 +41,8 @@ SourceFiles #define Foam_pointFieldDecomposer_H #include "pointMesh.H" -#include "pointPatchFieldMapperPatchRef.H" #include "pointFields.H" +#include "pointPatchFieldMapper.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -62,12 +62,15 @@ public: // Public Classes + //- Internal caching for field reading + class fieldsCache; + //- Point patch field decomposer class class patchFieldDecomposer : - public pointPatchFieldMapperPatchRef + public pointPatchFieldMapper { - // Private data + // Private Data labelList directAddressing_; @@ -83,28 +86,28 @@ public: ( const pointPatch& completeMeshPatch, const pointPatch& procMeshPatch, - const labelList& directAddr + const labelUList& directAddr ); - // Member functions + // Member Functions - label size() const + label size() const noexcept { return directAddressing_.size(); } - bool direct() const + bool direct() const noexcept { return true; } - bool hasUnmapped() const + bool hasUnmapped() const noexcept { return hasUnmapped_; } - const labelUList& directAddressing() const + const labelUList& directAddressing() const noexcept { return directAddressing_; } @@ -119,27 +122,22 @@ private: const pointMesh& procMesh_; //- Reference to point addressing - const labelList& pointAddressing_; + const labelUList& pointAddressing_; //- Reference to boundary addressing - const labelList& boundaryAddressing_; + const labelUList& boundaryAddressing_; //- List of patch field decomposers PtrList patchFieldDecomposerPtrs_; - // Private Member Functions - - //- No copy construct - pointFieldDecomposer(const pointFieldDecomposer&) = delete; - - //- No copy assignment - void operator=(const pointFieldDecomposer&) = delete; - public: - // Public Classes - class fieldsCache; + //- No copy construct + pointFieldDecomposer(const pointFieldDecomposer&) = delete; + + //- No copy assignment + void operator=(const pointFieldDecomposer&) = delete; // Constructors @@ -147,10 +145,10 @@ public: //- Construct without mappers, added later with reset() pointFieldDecomposer ( - const Foam::zero, + Foam::zero, const pointMesh& procMesh, - const labelList& pointAddressing, - const labelList& boundaryAddressing + const labelUList& pointAddressing, + const labelUList& boundaryAddressing ); //- Construct from components @@ -158,8 +156,8 @@ public: ( const pointMesh& completeMesh, const pointMesh& procMesh, - const labelList& pointAddressing, - const labelList& boundaryAddressing + const labelUList& pointAddressing, + const labelUList& boundaryAddressing ); @@ -170,7 +168,7 @@ public: // Member Functions //- True if no mappers have been allocated - bool empty() const; + bool empty() const noexcept; //- Remove all mappers void clear(); @@ -191,7 +189,7 @@ public: //- Decompose list of fields template - void decomposeFields(const PtrList& fields) const; + void decomposeFields(const UPtrList& fields) const; }; @@ -201,21 +199,14 @@ public: class pointFieldDecomposer::fieldsCache { - // Private Data + class privateCache; + std::unique_ptr cache_; - class privateCache; + //- No copy construct + fieldsCache(const fieldsCache&) = delete; - //- All field and field-field types for lagrangian - std::unique_ptr cache_; - - - // Private Member Functions - - //- No copy construct - fieldsCache(const fieldsCache&) = delete; - - //- No copy assignment - void operator=(const fieldsCache&) = delete; + //- No copy assignment + void operator=(const fieldsCache&) = delete; public: @@ -233,10 +224,10 @@ public: // Member Functions //- No fields - bool empty() const; + bool empty() const noexcept; //- Total number of fields - label size() const; + label size() const noexcept; //- Clear out void clear(); @@ -265,7 +256,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "pointFieldDecomposerTemplates.C" + #include "pointFieldDecomposer.txx" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/parallel/decompose/decompose/pointFieldDecomposer.C b/src/parallel/decompose/decompose/pointFieldDecomposer.cxx similarity index 82% rename from src/parallel/decompose/decompose/pointFieldDecomposer.C rename to src/parallel/decompose/decompose/pointFieldDecomposer.cxx index 4b1a29a1c5..a0ff0197a5 100644 --- a/src/parallel/decompose/decompose/pointFieldDecomposer.C +++ b/src/parallel/decompose/decompose/pointFieldDecomposer.cxx @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,21 +34,16 @@ Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer ( const pointPatch& completeMeshPatch, const pointPatch& procMeshPatch, - const labelList& directAddr + const labelUList& directAddr ) : - pointPatchFieldMapperPatchRef - ( - completeMeshPatch, - procMeshPatch - ), directAddressing_(procMeshPatch.size(), -1), hasUnmapped_(false) { // Create the inverse-addressing of the patch point labels. labelList pointMap(completeMeshPatch.boundaryMesh().mesh().size(), -1); - const labelList& completeMeshPatchPoints = completeMeshPatch.meshPoints(); + const labelUList& completeMeshPatchPoints = completeMeshPatch.meshPoints(); forAll(completeMeshPatchPoints, pointi) { @@ -57,7 +52,7 @@ Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer // Use the inverse point addressing to create the addressing table for this // patch - const labelList& procMeshPatchPoints = procMeshPatch.meshPoints(); + const labelUList& procMeshPatchPoints = procMeshPatch.meshPoints(); forAll(procMeshPatchPoints, pointi) { @@ -66,7 +61,7 @@ Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer } // Check that all the patch point addresses are set - if (directAddressing_.size() && min(directAddressing_) < 0) + if (directAddressing_.contains(-1)) { hasUnmapped_ = true; @@ -79,17 +74,15 @@ Foam::pointFieldDecomposer::patchFieldDecomposer::patchFieldDecomposer Foam::pointFieldDecomposer::pointFieldDecomposer ( - const Foam::zero, + Foam::zero, const pointMesh& procMesh, - const labelList& pointAddressing, - const labelList& boundaryAddressing + const labelUList& pointAddressing, + const labelUList& boundaryAddressing ) : procMesh_(procMesh), pointAddressing_(pointAddressing), - boundaryAddressing_(boundaryAddressing), - // Mappers - patchFieldDecomposerPtrs_() + boundaryAddressing_(boundaryAddressing) {} @@ -97,13 +90,13 @@ Foam::pointFieldDecomposer::pointFieldDecomposer ( const pointMesh& completeMesh, const pointMesh& procMesh, - const labelList& pointAddressing, - const labelList& boundaryAddressing + const labelUList& pointAddressing, + const labelUList& boundaryAddressing ) : pointFieldDecomposer ( - zero{}, + Foam::zero{}, procMesh, pointAddressing, boundaryAddressing @@ -115,7 +108,7 @@ Foam::pointFieldDecomposer::pointFieldDecomposer // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::pointFieldDecomposer::empty() const +bool Foam::pointFieldDecomposer::empty() const noexcept { return patchFieldDecomposerPtrs_.empty(); } @@ -132,9 +125,9 @@ void Foam::pointFieldDecomposer::reset const pointMesh& completeMesh ) { - clear(); const label nMappers = procMesh_.boundary().size(); - patchFieldDecomposerPtrs_.resize(nMappers); + + patchFieldDecomposerPtrs_.resize_null(nMappers); forAll(boundaryAddressing_, patchi) { diff --git a/src/parallel/decompose/decompose/pointFieldDecomposerTemplates.C b/src/parallel/decompose/decompose/pointFieldDecomposer.txx similarity index 98% rename from src/parallel/decompose/decompose/pointFieldDecomposerTemplates.C rename to src/parallel/decompose/decompose/pointFieldDecomposer.txx index cc2671e98f..73fc2d0029 100644 --- a/src/parallel/decompose/decompose/pointFieldDecomposerTemplates.C +++ b/src/parallel/decompose/decompose/pointFieldDecomposer.txx @@ -90,7 +90,7 @@ Foam::pointFieldDecomposer::decomposeField template void Foam::pointFieldDecomposer::decomposeFields ( - const PtrList& fields + const UPtrList& fields ) const { for (const auto& fld : fields) diff --git a/src/parallel/decompose/decompose/pointFieldDecomposerCache.C b/src/parallel/decompose/decompose/pointFieldDecomposerCache.cxx similarity index 97% rename from src/parallel/decompose/decompose/pointFieldDecomposerCache.C rename to src/parallel/decompose/decompose/pointFieldDecomposerCache.cxx index 69f683e600..21befb2608 100644 --- a/src/parallel/decompose/decompose/pointFieldDecomposerCache.C +++ b/src/parallel/decompose/decompose/pointFieldDecomposerCache.cxx @@ -101,7 +101,7 @@ public: static void decompose ( const pointFieldDecomposer& decomposer, - const PtrList& fields, + const UPtrList& fields, bool report ) { @@ -161,13 +161,13 @@ Foam::pointFieldDecomposer::fieldsCache::~fieldsCache() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::pointFieldDecomposer::fieldsCache::empty() const +bool Foam::pointFieldDecomposer::fieldsCache::empty() const noexcept { return (!cache_ || cache_->empty()); } -Foam::label Foam::pointFieldDecomposer::fieldsCache::size() const +Foam::label Foam::pointFieldDecomposer::fieldsCache::size() const noexcept { return (cache_ ? cache_->size() : label(0)); } diff --git a/src/parallel/reconstruct/reconstruct/Make/files b/src/parallel/reconstruct/reconstruct/Make/files index 2dbe299bfd..0c3e488e68 100644 --- a/src/parallel/reconstruct/reconstruct/Make/files +++ b/src/parallel/reconstruct/reconstruct/Make/files @@ -1,7 +1,7 @@ -processorMeshes.C -fvFieldReconstructor.C -pointFieldReconstructor.C -passivePositionParticleCloud.C -lagrangianReconstructor.C +processorMeshes.cxx +fvFieldReconstructor.cxx +pointFieldReconstructor.cxx +passivePositionParticleCloud.cxx +lagrangianReconstructor.cxx LIB = $(FOAM_LIBBIN)/libreconstruct diff --git a/src/parallel/reconstruct/reconstruct/fvFieldReconstructor.H b/src/parallel/reconstruct/reconstruct/fvFieldReconstructor.H index d950165ba6..b37f76620b 100644 --- a/src/parallel/reconstruct/reconstruct/fvFieldReconstructor.H +++ b/src/parallel/reconstruct/reconstruct/fvFieldReconstructor.H @@ -31,8 +31,8 @@ Description Finite volume reconstructor for volume and surface fields. SourceFiles - fvFieldReconstructor.C - fvFieldReconstructorTemplates.C + fvFieldReconstructor.cxx + fvFieldReconstructor.txx \*---------------------------------------------------------------------------*/ @@ -62,16 +62,16 @@ class fvFieldReconstructor fvMesh& mesh_; //- List of processor meshes - const PtrList& procMeshes_; + const UPtrList& procMeshes_; //- List of processor face addressing lists - const PtrList& faceProcAddressing_; + const UPtrList& faceProcAddressing_; //- List of processor cell addressing lists - const PtrList& cellProcAddressing_; + const UPtrList& cellProcAddressing_; //- List of processor boundary addressing lists - const PtrList& boundaryProcAddressing_; + const UPtrList& boundaryProcAddressing_; //- Number of fields reconstructed label nReconstructed_; @@ -144,10 +144,10 @@ public: fvFieldReconstructor ( fvMesh& mesh, - const PtrList& procMeshes, - const PtrList& faceProcAddressing, - const PtrList& cellProcAddressing, - const PtrList& boundaryProcAddressing + const UPtrList& procMeshes, + const UPtrList& faceProcAddressing, + const UPtrList& cellProcAddressing, + const UPtrList& boundaryProcAddressing ); @@ -165,7 +165,7 @@ public: reconstructField ( const IOobject& fieldObject, - const PtrList>& procFields + const UPtrList>& procFields ) const; //- Read and reconstruct volume internal field @@ -180,7 +180,7 @@ public: reconstructField ( const IOobject& fieldObject, - const PtrList>& + const UPtrList>& ) const; //- Read and reconstruct volume field @@ -195,7 +195,7 @@ public: reconstructField ( const IOobject& fieldObject, - const PtrList>& + const UPtrList>& ) const; //- Read and reconstruct surface field @@ -269,7 +269,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "fvFieldReconstructorTemplates.C" + #include "fvFieldReconstructor.txx" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/parallel/reconstruct/reconstruct/fvFieldReconstructor.C b/src/parallel/reconstruct/reconstruct/fvFieldReconstructor.cxx similarity index 95% rename from src/parallel/reconstruct/reconstruct/fvFieldReconstructor.C rename to src/parallel/reconstruct/reconstruct/fvFieldReconstructor.cxx index a4d3a54365..2db28ef2de 100644 --- a/src/parallel/reconstruct/reconstruct/fvFieldReconstructor.C +++ b/src/parallel/reconstruct/reconstruct/fvFieldReconstructor.cxx @@ -40,10 +40,10 @@ int Foam::fvFieldReconstructor::verbose_ = 1; Foam::fvFieldReconstructor::fvFieldReconstructor ( fvMesh& mesh, - const PtrList& procMeshes, - const PtrList& faceProcAddressing, - const PtrList& cellProcAddressing, - const PtrList& boundaryProcAddressing + const UPtrList& procMeshes, + const UPtrList& faceProcAddressing, + const UPtrList& cellProcAddressing, + const UPtrList& boundaryProcAddressing ) : mesh_(mesh), diff --git a/src/parallel/reconstruct/reconstruct/fvFieldReconstructorTemplates.C b/src/parallel/reconstruct/reconstruct/fvFieldReconstructor.txx similarity index 98% rename from src/parallel/reconstruct/reconstruct/fvFieldReconstructorTemplates.C rename to src/parallel/reconstruct/reconstruct/fvFieldReconstructor.txx index 1549abe4e7..cec57bf55f 100644 --- a/src/parallel/reconstruct/reconstruct/fvFieldReconstructorTemplates.C +++ b/src/parallel/reconstruct/reconstruct/fvFieldReconstructor.txx @@ -40,7 +40,7 @@ Foam::tmp> Foam::fvFieldReconstructor::reconstructField ( const IOobject& fieldObject, - const PtrList>& procFields + const UPtrList>& procFields ) const { // Create the internalField @@ -48,7 +48,7 @@ Foam::fvFieldReconstructor::reconstructField forAll(procMeshes_, proci) { - const DimensionedField& procField = procFields[proci]; + const auto& procField = procFields[proci]; // Set the cell values in the reconstructed field internalField.rmap @@ -77,7 +77,7 @@ Foam::tmp> Foam::fvFieldReconstructor::reconstructField ( const IOobject& fieldObject, - const PtrList>& procFields + const UPtrList>& procFields ) const { // Create the internalField @@ -255,7 +255,7 @@ Foam::tmp> Foam::fvFieldReconstructor::reconstructField ( const IOobject& fieldObject, - const PtrList>& procFields + const UPtrList>& procFields ) const { // Create the internalField diff --git a/src/parallel/reconstruct/reconstruct/lagrangianReconstructor.H b/src/parallel/reconstruct/reconstruct/lagrangianReconstructor.H index 05a9c9a682..1ffb7136f2 100644 --- a/src/parallel/reconstruct/reconstruct/lagrangianReconstructor.H +++ b/src/parallel/reconstruct/reconstruct/lagrangianReconstructor.H @@ -31,8 +31,8 @@ Description Reconstructor for lagrangian positions and fields SourceFiles - lagrangianReconstructor.C - lagrangianReconstructorTemplates.C + lagrangianReconstructor.cxx + lagrangianReconstructor.txx \*---------------------------------------------------------------------------*/ @@ -59,16 +59,16 @@ class lagrangianReconstructor // Private Data //- Mesh reference - const fvMesh& mesh_; + const polyMesh& mesh_; //- List of processor meshes - const PtrList& procMeshes_; + const UPtrList& procMeshes_; //- List of processor face addressing lists - const PtrList& faceProcAddressing_; + const UPtrList& faceProcAddressing_; //- List of processor cell addressing lists - const PtrList& cellProcAddressing_; + const UPtrList& cellProcAddressing_; // Private Member Functions @@ -93,10 +93,10 @@ public: //- Construct from components lagrangianReconstructor ( - const fvMesh& mesh, - const PtrList& procMeshes, - const PtrList& faceProcAddressing, - const PtrList& cellProcAddressing + const polyMesh& mesh, + const UPtrList& procMeshes, + const UPtrList& faceProcAddressing, + const UPtrList& cellProcAddressing ); @@ -166,7 +166,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "lagrangianReconstructorTemplates.C" + #include "lagrangianReconstructor.txx" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/parallel/reconstruct/reconstruct/lagrangianReconstructor.C b/src/parallel/reconstruct/reconstruct/lagrangianReconstructor.cxx similarity index 97% rename from src/parallel/reconstruct/reconstruct/lagrangianReconstructor.C rename to src/parallel/reconstruct/reconstruct/lagrangianReconstructor.cxx index 508110e840..dafa4ee78d 100644 --- a/src/parallel/reconstruct/reconstruct/lagrangianReconstructor.C +++ b/src/parallel/reconstruct/reconstruct/lagrangianReconstructor.cxx @@ -38,10 +38,10 @@ int Foam::lagrangianReconstructor::verbose_ = 1; Foam::lagrangianReconstructor::lagrangianReconstructor ( - const fvMesh& mesh, - const PtrList& procMeshes, - const PtrList& faceProcAddressing, - const PtrList& cellProcAddressing + const polyMesh& mesh, + const UPtrList& procMeshes, + const UPtrList& faceProcAddressing, + const UPtrList& cellProcAddressing ) : mesh_(mesh), diff --git a/src/parallel/reconstruct/reconstruct/lagrangianReconstructorTemplates.C b/src/parallel/reconstruct/reconstruct/lagrangianReconstructor.txx similarity index 100% rename from src/parallel/reconstruct/reconstruct/lagrangianReconstructorTemplates.C rename to src/parallel/reconstruct/reconstruct/lagrangianReconstructor.txx diff --git a/src/parallel/reconstruct/reconstruct/passivePositionParticleCloud.H b/src/parallel/reconstruct/reconstruct/passivePositionParticleCloud.H index a864a15c3a..dfb765270d 100644 --- a/src/parallel/reconstruct/reconstruct/passivePositionParticleCloud.H +++ b/src/parallel/reconstruct/reconstruct/passivePositionParticleCloud.H @@ -30,7 +30,7 @@ Description A Cloud of passive particles SourceFiles - passivePositionParticleCloud.C + passivePositionParticleCloud.cxx \*---------------------------------------------------------------------------*/ @@ -79,7 +79,7 @@ public: passivePositionParticleCloud ( const polyMesh& mesh, - const Foam::zero, + Foam::zero, const word& cloudName = cloud::defaultName ) : diff --git a/src/parallel/reconstruct/reconstruct/passivePositionParticleCloud.C b/src/parallel/reconstruct/reconstruct/passivePositionParticleCloud.cxx similarity index 100% rename from src/parallel/reconstruct/reconstruct/passivePositionParticleCloud.C rename to src/parallel/reconstruct/reconstruct/passivePositionParticleCloud.cxx diff --git a/src/parallel/reconstruct/reconstruct/pointFieldReconstructor.H b/src/parallel/reconstruct/reconstruct/pointFieldReconstructor.H index 3cac39a3c6..51fbb83430 100644 --- a/src/parallel/reconstruct/reconstruct/pointFieldReconstructor.H +++ b/src/parallel/reconstruct/reconstruct/pointFieldReconstructor.H @@ -31,8 +31,8 @@ Description Point field reconstructor. SourceFiles - pointFieldReconstructor.C - pointFieldReconstructorTemplates.C + pointFieldReconstructor.cxx + pointFieldReconstructor.txx \*---------------------------------------------------------------------------*/ @@ -41,7 +41,7 @@ SourceFiles #include "pointMesh.H" #include "pointFields.H" -#include "pointPatchFieldMapperPatchRef.H" +#include "pointPatchFieldMapper.H" #include "IOobjectList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -61,13 +61,13 @@ class pointFieldReconstructor const pointMesh& mesh_; //- List of processor meshes - const PtrList& procMeshes_; + const UPtrList& procMeshes_; //- List of processor point addressing lists - const PtrList& pointProcAddressing_; + const UPtrList& pointProcAddressing_; //- List of processor boundary addressing lists - const PtrList& boundaryProcAddressing_; + const UPtrList& boundaryProcAddressing_; //- Point patch addressing labelListListList patchPointAddressing_; @@ -100,7 +100,7 @@ public: // Constructors //- Construct given size - pointPatchFieldReconstructor(const label size) + explicit pointPatchFieldReconstructor(const label size) : size_(size) {} @@ -108,22 +108,22 @@ public: // Member functions - label size() const + label size() const noexcept { return size_; } - bool direct() const + bool direct() const noexcept { return true; } - bool hasUnmapped() const + bool hasUnmapped() const noexcept { return false; } - const labelUList& directAddressing() const + const labelUList& directAddressing() const noexcept { return labelUList::null(); } @@ -142,9 +142,9 @@ public: pointFieldReconstructor ( const pointMesh& mesh, - const PtrList& procMeshes, - const PtrList& pointProcAddressing, - const PtrList& boundaryProcAddressing + const UPtrList& procMeshes, + const UPtrList& pointProcAddressing, + const UPtrList& boundaryProcAddressing ); @@ -163,7 +163,7 @@ public: reconstructField ( const IOobject& fieldObject, - const PtrList>& + const UPtrList>& ) const; @@ -204,7 +204,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "pointFieldReconstructorTemplates.C" + #include "pointFieldReconstructor.txx" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/parallel/reconstruct/reconstruct/pointFieldReconstructor.C b/src/parallel/reconstruct/reconstruct/pointFieldReconstructor.cxx similarity index 76% rename from src/parallel/reconstruct/reconstruct/pointFieldReconstructor.C rename to src/parallel/reconstruct/reconstruct/pointFieldReconstructor.cxx index 05a7fe260e..e9d709b72b 100644 --- a/src/parallel/reconstruct/reconstruct/pointFieldReconstructor.C +++ b/src/parallel/reconstruct/reconstruct/pointFieldReconstructor.cxx @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation - Copyright (C) 2022 OpenCFD Ltd. + Copyright (C) 2022-2025 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -39,9 +39,9 @@ int Foam::pointFieldReconstructor::verbose_ = 1; Foam::pointFieldReconstructor::pointFieldReconstructor ( const pointMesh& mesh, - const PtrList& procMeshes, - const PtrList& pointProcAddressing, - const PtrList& boundaryProcAddressing + const UPtrList& procMeshes, + const UPtrList& pointProcAddressing, + const UPtrList& boundaryProcAddressing ) : mesh_(mesh), @@ -59,14 +59,14 @@ Foam::pointFieldReconstructor::pointFieldReconstructor { const pointMesh& procMesh = procMeshes_[proci]; - patchPointAddressing_[proci].setSize(procMesh.boundary().size()); + patchPointAddressing_[proci].resize(procMesh.boundary().size()); forAll(procMesh.boundary(), patchi) { if (boundaryProcAddressing_[proci][patchi] >= 0) { labelList& procPatchAddr = patchPointAddressing_[proci][patchi]; - procPatchAddr.setSize(procMesh.boundary()[patchi].size(), -1); + procPatchAddr.resize(procMesh.boundary()[patchi].size(), -1); const labelList& patchPointLabels = mesh_.boundary()[boundaryProcAddressing_[proci][patchi]] @@ -90,7 +90,7 @@ Foam::pointFieldReconstructor::pointFieldReconstructor ]; } - if (procPatchAddr.size() && min(procPatchAddr) < 0) + if (procPatchAddr.contains(-1)) { FatalErrorInFunction << "Incomplete patch point addressing" @@ -112,11 +112,23 @@ Foam::label Foam::pointFieldReconstructor::reconstructAllFields { label nTotal = 0; - nTotal += reconstructPointFields(objects, selected); - nTotal += reconstructPointFields(objects, selected); - nTotal += reconstructPointFields(objects, selected); - nTotal += reconstructPointFields(objects, selected); - nTotal += reconstructPointFields(objects, selected); + do + { + #undef doLocalCode + #define doLocalCode(Method) \ + { \ + nTotal += this->Method (objects, selected); \ + nTotal += this->Method (objects, selected); \ + nTotal += this->Method (objects, selected); \ + nTotal += this->Method (objects, selected); \ + nTotal += this->Method (objects, selected); \ + } + + doLocalCode(reconstructPointFields); + + #undef doLocalCode + } + while (false); return nTotal; } diff --git a/src/parallel/reconstruct/reconstruct/pointFieldReconstructorTemplates.C b/src/parallel/reconstruct/reconstruct/pointFieldReconstructor.txx similarity index 95% rename from src/parallel/reconstruct/reconstruct/pointFieldReconstructorTemplates.C rename to src/parallel/reconstruct/reconstruct/pointFieldReconstructor.txx index bc7b03167a..f62cb0a08e 100644 --- a/src/parallel/reconstruct/reconstruct/pointFieldReconstructorTemplates.C +++ b/src/parallel/reconstruct/reconstruct/pointFieldReconstructor.txx @@ -35,16 +35,17 @@ Foam::tmp> Foam::pointFieldReconstructor::reconstructField ( const IOobject& fieldObject, - const PtrList>& procFields + const UPtrList>& procFields ) const { typedef GeometricField fieldType; + typedef pointPatchField patchFieldType; // Create the internalField Field internalField(mesh_.size()); // Create the patch fields - PtrList> patchFields(mesh_.boundary().size()); + PtrList patchFields(mesh_.boundary().size()); forAll(procMeshes_, proci) @@ -75,11 +76,11 @@ Foam::pointFieldReconstructor::reconstructField patchFields.set ( curBPatch, - pointPatchField::New + patchFieldType::New ( procField.boundaryField()[patchi], mesh_.boundary()[curBPatch], - pointPatchField::Internal::null(), + patchFieldType::Internal::null(), pointPatchFieldReconstructor ( mesh_.boundary()[curBPatch].size() diff --git a/src/parallel/reconstruct/reconstruct/processorMeshes.H b/src/parallel/reconstruct/reconstruct/processorMeshes.H index d8da977c73..1abe940826 100644 --- a/src/parallel/reconstruct/reconstruct/processorMeshes.H +++ b/src/parallel/reconstruct/reconstruct/processorMeshes.H @@ -31,7 +31,7 @@ Description Container for processor mesh addressing. SourceFiles - processorMeshes.C + processorMeshes.cxx \*---------------------------------------------------------------------------*/ @@ -40,7 +40,6 @@ SourceFiles #include "PtrList.H" #include "fvMesh.H" -#include "IOobjectList.H" #include "labelIOList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -56,10 +55,11 @@ class processorMeshes { // Private Data + //- The (volume) mesh-region name const word meshName_; //- Processor databases - PtrList