diff --git a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C index 4443f6f7bac8583b949db7a2c546b7603169cf4d..8f2a7f014e794cc217e926a42d7c2ed35074edcc 100644 --- a/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C +++ b/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C @@ -504,24 +504,20 @@ template<class Type, template<class> class PatchField, class GeoMesh> Foam::LduInterfaceFieldPtrsList<Type> Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary::interfaces() const { - LduInterfaceFieldPtrsList<Type> interfaces(this->size()); + LduInterfaceFieldPtrsList<Type> list(this->size()); - forAll(interfaces, patchi) + forAll(list, patchi) { - if (isA<LduInterfaceField<Type>>(this->operator[](patchi))) + const LduInterfaceField<Type>* lduPtr = + isA<LduInterfaceField<Type>>(this->operator[](patchi)); + + if (lduPtr) { - interfaces.set - ( - patchi, - &refCast<const LduInterfaceField<Type>> - ( - this->operator[](patchi) - ) - ); + list.set(patchi, lduPtr); } } - return interfaces; + return list; } @@ -530,24 +526,20 @@ Foam::lduInterfaceFieldPtrsList Foam::GeometricField<Type, PatchField, GeoMesh>::Boundary:: scalarInterfaces() const { - lduInterfaceFieldPtrsList interfaces(this->size()); + lduInterfaceFieldPtrsList list(this->size()); - forAll(interfaces, patchi) + forAll(list, patchi) { - if (isA<lduInterfaceField>(this->operator[](patchi))) + const lduInterfaceField* lduPtr = + isA<lduInterfaceField>(this->operator[](patchi)); + + if (lduPtr) { - interfaces.set - ( - patchi, - &refCast<const lduInterfaceField> - ( - this->operator[](patchi) - ) - ); + list.set(patchi, lduPtr); } } - return interfaces; + return list; } diff --git a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.H b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.H index 10244511ffe474ccca813f893d681ba214be2a00..c37cd61aec852a29cf1a44e4f87e0118f9bc5ff3 100644 --- a/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.H +++ b/src/OpenFOAM/matrices/lduMatrix/lduAddressing/lduAddressing.H @@ -114,7 +114,7 @@ namespace Foam class lduAddressing { - // Private data + // Private Data //- Number of equations label size_; @@ -186,7 +186,7 @@ public: const label patchNo ) const = 0; - // Return patch field evaluation schedule + //- Return patch field evaluation schedule virtual const lduSchedule& patchSchedule() const = 0; //- Clear additional addressing diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H index adb90aa2fd9586752cf2ca5cfc49db1b7a2134a1..f2dc135005748d3b1220deb053701f75194fac5e 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndex.H @@ -123,12 +123,18 @@ public: //- Check for default constructed or global sum == 0 inline bool empty() const; + //- The number of processors covered by the offsets + inline label nProcs() const noexcept; + //- Global sum of localSizes inline label size() const; //- The local sizes labelList sizes() const; + //- The local starts + inline const labelUList localStarts() const; + //- Global max of localSizes inline label maxSize() const; diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H index 7dea5118a42b3c2220f240fc9ef98e6a7e9e0e39..5eb40f5c79e783db68633b8c55100a4c0bc44ebf 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalIndexI.H @@ -73,6 +73,13 @@ inline bool Foam::globalIndex::empty() const } +inline Foam::label Foam::globalIndex::nProcs() const noexcept +{ + const label len = (offsets_.size() - 1); + return (len < 1) ? 0 : len; +} + + inline const Foam::labelList& Foam::globalIndex::offsets() const noexcept { return offsets_; @@ -85,6 +92,16 @@ inline Foam::labelList& Foam::globalIndex::offsets() noexcept } +inline const Foam::labelUList Foam::globalIndex::localStarts() const +{ + const label len = (offsets_.size() - 1); + + if (len < 1) return labelUList::null(); + + return labelList::subList(offsets_, len); +} + + inline Foam::label Foam::globalIndex::size() const { return offsets_.empty() ? 0 : offsets_.last(); diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C index 0fa9493ecd571b2118e47bf55a989f2319e530bc..4920b30e521ade418c553a9d4ca225a63e5093ef 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.C @@ -307,6 +307,22 @@ void Foam::polyBoundaryMesh::calcGeometry() } +Foam::UPtrList<const Foam::labelUList> +Foam::polyBoundaryMesh::faceCells() const +{ + const polyPatchList& patches = *this; + + UPtrList<const labelUList> list(patches.size()); + + forAll(patches, patchi) + { + list.set(patchi, &patches[patchi].faceCells()); + } + + return list; +} + + const Foam::List<Foam::labelPairList>& Foam::polyBoundaryMesh::neighbourEdges() const { diff --git a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H index db50590500ec23a9441efbef8d4915f177de2427..8dcf87f41d21831b05b6e2170f26b115167c3709 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyBoundaryMesh/polyBoundaryMesh.H @@ -155,6 +155,9 @@ public: return mesh_; } + //- Return a list of faceCells for each patch + UPtrList<const labelUList> faceCells() const; + //- Per patch the edges on the neighbouring patch. // Is for every external edge the neighbouring patch and // neighbouring (external) patch edge label. Note that edge indices diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H index 4b5c2d4486c172099bce51a91428a9c83bb16e49..2dc4b2c00d305d66fa1b17177ab329f11fd040ae 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H @@ -311,7 +311,6 @@ public: // Member Functions - // Implicit treatment functions //- Return number of new internal of this polyPatch faces @@ -324,7 +323,7 @@ public: virtual const labelUList& nbrCells() const { NotImplemented - return faceCells(); + return labelUList::null(); } //- Return nbr patchID @@ -338,8 +337,7 @@ public: virtual refPtr<labelListList> mapCollocatedFaces() const { NotImplemented; - refPtr<labelListList> tMap(new labelListList(size())); - return tMap; + return nullptr; } //- Return implicit master diff --git a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C index 96fef01048adcc5dbc5d3daa7c1330bc125eb8ed..c40ff59d4e63a237cfdac13fa6d07ed5f01b282a 100644 --- a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C +++ b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.C @@ -142,23 +142,39 @@ void Foam::faBoundaryMesh::calcGeometry() } +Foam::UPtrList<const Foam::labelUList> +Foam::faBoundaryMesh::edgeFaces() const +{ + const faPatchList& patches = *this; + + UPtrList<const labelUList> list(patches.size()); + + forAll(list, patchi) + { + list.set(patchi, &patches[patchi].edgeFaces()); + } + + return list; +} + + Foam::lduInterfacePtrsList Foam::faBoundaryMesh::interfaces() const { - lduInterfacePtrsList interfaces(size()); + const faPatchList& patches = *this; - forAll(interfaces, patchi) + lduInterfacePtrsList list(patches.size()); + + forAll(list, patchi) { - if (isA<lduInterface>(this->operator[](patchi))) + const lduInterface* lduPtr = isA<lduInterface>(patches[patchi]); + + if (lduPtr) { - interfaces.set - ( - patchi, - &refCast<const lduInterface>(this->operator[](patchi)) - ); + list.set(patchi, lduPtr); } } - return interfaces; + return list; } diff --git a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H index 4bbd4016f6839a33105a2be80710e3ea0b4ebb71..b39d19aeffa57bcb9993c40a4f203dc50c717642 100644 --- a/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H +++ b/src/finiteArea/faMesh/faBoundaryMesh/faBoundaryMesh.H @@ -128,6 +128,9 @@ public: return mesh_; } + //- Return a list of edgeFaces for each patch + UPtrList<const labelUList> edgeFaces() const; + //- Return a list of pointers for each patch //- with only those pointing to interfaces being set lduInterfacePtrsList interfaces() const; diff --git a/src/finiteArea/faMesh/faMeshLduAddressing.H b/src/finiteArea/faMesh/faMeshLduAddressing.H index d83659cece268cd167ad020e1164cb93696e898b..28981c11c8b9466d9647e1a451a5151d403b95ea 100644 --- a/src/finiteArea/faMesh/faMeshLduAddressing.H +++ b/src/finiteArea/faMesh/faMeshLduAddressing.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016-2017 Wikki Ltd - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -58,16 +58,16 @@ class faMeshLduAddressing : public lduAddressing { - // Private data + // Private Data //- Lower as a subList of allOwner - labelList::subList lowerAddr_; + const labelList::subList lowerAddr_; //- Upper as a reference to neighbour const labelList& upperAddr_; //- Patch addressing as a list of sublists - List<const labelUList*> patchAddr_; + const UPtrList<const labelUList> patchAddr_; //- Patch field evaluation schedule const lduSchedule& patchSchedule_; @@ -99,14 +99,10 @@ public: ) ), upperAddr_(mesh.edgeNeighbour()), - patchAddr_(mesh.boundary().size()), + patchAddr_(mesh.boundary().edgeFaces()), patchSchedule_(mesh.globalData().patchSchedule()) - { - forAll(mesh.boundary(), patchI) - { - patchAddr_[patchI] = &mesh.boundary()[patchI].edgeFaces(); - } - } + {} + //- Destructor virtual ~faMeshLduAddressing() = default; @@ -115,31 +111,31 @@ public: // Member Functions //- Return number of interfaces - virtual label nPatches() const + virtual label nPatches() const noexcept { return patchAddr_.size(); } //- Return lower addressing (i.e. lower label = upper triangle) - virtual const labelUList& lowerAddr() const + virtual const labelUList& lowerAddr() const noexcept { return lowerAddr_; } //- Return upper addressing (i.e. upper label) - virtual const labelUList& upperAddr() const + virtual const labelUList& upperAddr() const noexcept { return upperAddr_; } //- Return patch addressing - virtual const labelUList& patchAddr(const label i) const + virtual const labelUList& patchAddr(const label patchi) const { - return *patchAddr_[i]; + return patchAddr_[patchi]; } - // Return patch field evaluation schedule - virtual const lduSchedule& patchSchedule() const + //- Return patch field evaluation schedule + virtual const lduSchedule& patchSchedule() const noexcept { return patchSchedule_; } diff --git a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C index 9b00d915b5a070184202663cf84a76da82869455..f39a55d2c339e75b340da4d5d7f509815895f247 100644 --- a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C +++ b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.C @@ -29,7 +29,6 @@ License #include "fvBoundaryMesh.H" #include "fvMesh.H" - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::fvBoundaryMesh::addPatches(const polyBoundaryMesh& basicBdry) @@ -131,23 +130,39 @@ void Foam::fvBoundaryMesh::movePoints() } +Foam::UPtrList<const Foam::labelUList> +Foam::fvBoundaryMesh::faceCells() const +{ + const fvPatchList& patches = *this; + + UPtrList<const labelUList> list(patches.size()); + + forAll(list, patchi) + { + list.set(patchi, &patches[patchi].faceCells()); + } + + return list; +} + + Foam::lduInterfacePtrsList Foam::fvBoundaryMesh::interfaces() const { - lduInterfacePtrsList interfaces(size()); + const fvPatchList& patches = *this; + + lduInterfacePtrsList list(patches.size()); - forAll(interfaces, patchi) + forAll(list, patchi) { - if (isA<lduInterface>(this->operator[](patchi))) + const lduInterface* lduPtr = isA<lduInterface>(patches[patchi]); + + if (lduPtr) { - interfaces.set - ( - patchi, - &refCast<const lduInterface>(this->operator[](patchi)) - ); + list.set(patchi, lduPtr); } } - return interfaces; + return list; } diff --git a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H index 569723b3a2a15efcd3e2682f0aa2fb5d513f8cd9..8eca50c33d9c7c33f0644322347a79fa92a9d364 100644 --- a/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H +++ b/src/finiteVolume/fvMesh/fvBoundaryMesh/fvBoundaryMesh.H @@ -91,8 +91,8 @@ public: // Constructors - //- Construct with zero size - fvBoundaryMesh(const fvMesh&); + //- Construct zero size with mesh reference + explicit fvBoundaryMesh(const fvMesh&); //- Construct from polyBoundaryMesh fvBoundaryMesh(const fvMesh&, const polyBoundaryMesh&); @@ -101,11 +101,14 @@ public: // Member Functions //- Return the mesh reference - const fvMesh& mesh() const + const fvMesh& mesh() const noexcept { return mesh_; } + //- Return a list of faceCells for each patch + UPtrList<const labelUList> faceCells() const; + //- Return a list of pointers for each patch //- with only those pointing to interfaces being set lduInterfacePtrsList interfaces() const; diff --git a/src/finiteVolume/fvMesh/fvMeshLduAddressing.H b/src/finiteVolume/fvMesh/fvMeshLduAddressing.H index 8dbae5b932240ceac36ba26e2fbc35237eafbf45..7c5d723afc44703f75ddc27fb004b2cdae2171ad 100644 --- a/src/finiteVolume/fvMesh/fvMeshLduAddressing.H +++ b/src/finiteVolume/fvMesh/fvMeshLduAddressing.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -53,7 +54,7 @@ class fvMeshLduAddressing : public lduAddressing { - // Private data + // Private Data //- Lower as a subList of allOwner const labelList::subList lowerAddr_; @@ -62,7 +63,7 @@ class fvMeshLduAddressing const labelList& upperAddr_; //- Patch addressing as a list of sublists - List<const labelUList*> patchAddr_; + const UPtrList<const labelUList> patchAddr_; //- Patch field evaluation schedule const lduSchedule& patchSchedule_; @@ -82,7 +83,7 @@ public: // Constructors //- Construct from components - fvMeshLduAddressing(const fvMesh& mesh) + explicit fvMeshLduAddressing(const fvMesh& mesh) : lduAddressing(mesh.nCells()), lowerAddr_ @@ -94,43 +95,37 @@ public: ) ), upperAddr_(mesh.faceNeighbour()), - patchAddr_(mesh.boundary().size()), + patchAddr_(mesh.boundary().faceCells()), patchSchedule_(mesh.globalData().patchSchedule()) - { - forAll(mesh.boundary(), patchi) - { - patchAddr_[patchi] = &mesh.boundary()[patchi].faceCells(); - } - } + {} //- Destructor - ~fvMeshLduAddressing() - {} + ~fvMeshLduAddressing() = default; // Member Functions //- Return lower addressing (i.e. lower label = upper triangle) - const labelUList& lowerAddr() const + const labelUList& lowerAddr() const noexcept { return lowerAddr_; } //- Return upper addressing (i.e. upper label) - const labelUList& upperAddr() const + const labelUList& upperAddr() const noexcept { return upperAddr_; } //- Return patch addressing - const labelUList& patchAddr(const label i) const + const labelUList& patchAddr(const label patchi) const { - return *patchAddr_[i]; + return patchAddr_[patchi]; } - // Return patch field evaluation schedule - const lduSchedule& patchSchedule() const + //- Return patch field evaluation schedule + const lduSchedule& patchSchedule() const noexcept { return patchSchedule_; } diff --git a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C index 8d1df08a541ad67f8099921713ba2cdea47eca0b..fbe53ba44e8236ecc009a6659a464940e2cf5af9 100644 --- a/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C +++ b/src/overset/dynamicOversetFvMesh/dynamicOversetFvMesh.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2014-2020 OpenCFD Ltd. + Copyright (C) 2014-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -275,7 +275,7 @@ bool Foam::dynamicOversetFvMesh::updateAddressing() const // Get addressing and interfaces of all interfaces - List<const labelUList*> patchAddr; + UPtrList<const labelUList> patchAddr; { const fvBoundaryMesh& fvp = boundary(); @@ -285,24 +285,24 @@ bool Foam::dynamicOversetFvMesh::updateAddressing() const allInterfaces_ = dynamicFvMesh::interfaces(); allInterfaces_.setSize(patchAddr.size()); - forAll(fvp, patchI) + forAll(fvp, patchi) { - patchAddr[patchI] = &fvp[patchI].faceCells(); + patchAddr.set(patchi, &fvp[patchi].faceCells()); } forAll(remoteStencilInterfaces_, i) { - label patchI = fvp.size()+i; + const label patchi = fvp.size()+i; const lduPrimitiveProcessorInterface& pp = remoteStencilInterfaces_[i]; - //Pout<< "at patch:" << patchI + //Pout<< "at patch:" << patchi // << " have procPatch:" << pp.type() // << " from:" << pp.myProcNo() // << " to:" << pp.neighbProcNo() // << " with fc:" << pp.faceCells().size() << endl; - patchAddr[patchI] = &pp.faceCells(); - allInterfaces_.set(patchI, &pp); + patchAddr.set(patchi, &pp.faceCells()); + allInterfaces_.set(patchi, &pp); } } const lduSchedule ps diff --git a/src/overset/fvMeshPrimitiveLduAddressing/fvMeshPrimitiveLduAddressing.C b/src/overset/fvMeshPrimitiveLduAddressing/fvMeshPrimitiveLduAddressing.C index 19ca032a080316380cb047c5480a4f50380e0558..5dcf0563ffaa1ecf7b99df1deba2306c370097e1 100644 --- a/src/overset/fvMeshPrimitiveLduAddressing/fvMeshPrimitiveLduAddressing.C +++ b/src/overset/fvMeshPrimitiveLduAddressing/fvMeshPrimitiveLduAddressing.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2015-2017 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -47,14 +47,9 @@ Foam::fvMeshPrimitiveLduAddressing::fvMeshPrimitiveLduAddressing ) ), upperAddr_(mesh.faceNeighbour()), - patchAddr_(mesh.boundary().size()), + patchAddr_(mesh.boundary().faceCells()), patchSchedule_(mesh.globalData().patchSchedule()) -{ - forAll(mesh.boundary(), patchi) - { - patchAddr_[patchi] = &mesh.boundary()[patchi].faceCells(); - } -} +{} Foam::fvMeshPrimitiveLduAddressing::fvMeshPrimitiveLduAddressing @@ -62,7 +57,7 @@ Foam::fvMeshPrimitiveLduAddressing::fvMeshPrimitiveLduAddressing const label nCells, labelList&& lowerAddr, labelList&& upperAddr, - const List<const labelUList*>& patchAddr, + const UPtrList<const labelUList>& patchAddr, const lduSchedule& ps ) : @@ -83,17 +78,15 @@ Foam::label Foam::fvMeshPrimitiveLduAddressing::triIndex const label b ) { - label own = min(a, b); - - label nbr = max(a, b); - - label startLabel = addr.ownerStartAddr()[own]; + const label own = min(a, b); + const label nbr = max(a, b); - label endLabel = addr.ownerStartAddr()[own + 1]; + const label begLabel = addr.ownerStartAddr()[own]; + const label endLabel = addr.ownerStartAddr()[own + 1]; const labelUList& neighbour = addr.upperAddr(); - for (label i = startLabel; i < endLabel; i++) + for (label i = begLabel; i < endLabel; ++i) { if (neighbour[i] == nbr) { diff --git a/src/overset/fvMeshPrimitiveLduAddressing/fvMeshPrimitiveLduAddressing.H b/src/overset/fvMeshPrimitiveLduAddressing/fvMeshPrimitiveLduAddressing.H index cd65ba9e9663d3c2d5a7f78df727bc2f66592cb4..a1822ab2559520a665d3d6911b5ad62458452bda 100644 --- a/src/overset/fvMeshPrimitiveLduAddressing/fvMeshPrimitiveLduAddressing.H +++ b/src/overset/fvMeshPrimitiveLduAddressing/fvMeshPrimitiveLduAddressing.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2015-2016 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -59,7 +59,7 @@ class fvMeshPrimitiveLduAddressing : public lduAddressing { - // Private data + // Private Data //- Lower (face to owner addressing) const labelList lowerAddr_; @@ -68,7 +68,7 @@ class fvMeshPrimitiveLduAddressing const labelList upperAddr_; //- Patch addressing as a list of sublists - List<const labelUList*> patchAddr_; + const UPtrList<const labelUList> patchAddr_; //- Patch field evaluation schedule const lduSchedule patchSchedule_; @@ -91,7 +91,7 @@ public: // Constructors //- Construct from mesh - fvMeshPrimitiveLduAddressing(const fvMesh& mesh); + explicit fvMeshPrimitiveLduAddressing(const fvMesh& mesh); //- Construct from components fvMeshPrimitiveLduAddressing @@ -99,7 +99,7 @@ public: const label nCells, labelList&& lowerAddr, labelList&& upperAddr, - const List<const labelUList*>& interfaces, + const UPtrList<const labelUList>& patchAddr, const lduSchedule& ps ); @@ -111,31 +111,32 @@ public: // Member Functions //- Return lower addressing (i.e. lower label = upper triangle) - virtual const labelUList& lowerAddr() const + virtual const labelUList& lowerAddr() const noexcept { return lowerAddr_; } //- Return upper addressing (i.e. upper label) - virtual const labelUList& upperAddr() const + virtual const labelUList& upperAddr() const noexcept { return upperAddr_; } - //- Return patch addressing - virtual const labelUList& patchAddr(const label i) const + //- Return patch addressing for given patch + virtual const labelUList& patchAddr(const label patchi) const { - return *patchAddr_[i]; + return patchAddr_[patchi]; } - // Return patch field evaluation schedule - virtual const lduSchedule& patchSchedule() const + //- Return patch field evaluation schedule + virtual const lduSchedule& patchSchedule() const noexcept { return patchSchedule_; } //- Given additional addressing (in the form of additional neighbour - // cells, i.e. like cellCells) + //- cells, i.e. like cellCells) + // // - add any additional faces // - sort in upper-triangular order // - construct cell-faces equivalent of given nbrCells @@ -159,8 +160,8 @@ public: labelListList& remoteFaceCells ); - //- Return off-diagonal index given owner and neighbour label. Return - // -1 if not found + //- Return off-diagonal index given owner and neighbour label. + // \return -1 if not found static label triIndex(const lduAddressing&, const label, const label); };