diff --git a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C index 61a2f4d8546ce328101bb5b658d3626b8655be19..f4336bce92fe9da6d322c4ff1108b6fd8be6dce8 100644 --- a/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C +++ b/applications/utilities/mesh/advanced/refineWallLayer/refineWallLayer.C @@ -184,10 +184,6 @@ int main(int argc, char *argv[]) << endl; // Transfer DynamicLists to straight ones. - labelList cutEdges; - cutEdges.transfer(allCutEdges); - allCutEdges.clear(); - scalarField cutEdgeWeights; cutEdgeWeights.transfer(allCutEdgeWeights); allCutEdgeWeights.clear(); @@ -199,7 +195,7 @@ int main(int argc, char *argv[]) mesh, cutCells.toc(), // cells candidate for cutting labelList(0), // cut vertices - cutEdges, // cut edges + allCutEdges, // cut edges cutEdgeWeights // weight on cut edges ); diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposeMesh.C b/applications/utilities/parallelProcessing/decomposePar/decomposeMesh.C index 0d81b1aedd5699e504c5f8b8201a40413376c7df..55f5c965791d03fc4a8e63fc6b98e71804016a6c 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposeMesh.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposeMesh.C @@ -35,11 +35,8 @@ Description #include "IOstreams.H" #include "SLPtrList.H" #include "boolList.H" -#include "cellList.H" #include "primitiveMesh.H" -#include "cyclicFvPatch.H" -#include "fvPatchList.H" -#include "DynamicList.H" +#include "cyclicPolyPatch.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index bee2d17b25e9d29c46a07e0346d7413b4a75b55b..dd107c2f2fc537c11a465a32e35f1e24e00ccb33 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -33,7 +33,7 @@ License #include "OSspecific.H" #include "Map.H" #include "globalMeshData.H" - +#include "DynamicList.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C index 3030a3031676ea82a9280b3874d9ad5a38b7d527..7cf137cd0e2983cbb1c9a72603f65d3795c70bb4 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C +++ b/applications/utilities/postProcessing/dataConversion/foamToFieldview9/foamToFieldview9.C @@ -45,7 +45,6 @@ Description #include "IOobjectList.H" #include "boolList.H" #include "stringList.H" -#include "DynamicList.H" #include "cellModeller.H" #include "floatScalar.H" diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/internalWriter.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/internalWriter.C index bf1fb3b77529a78a9df2aecf1a3f751ae59a6617..1ac0d8b72993f4d8b2cbb3e0ff0650083d932a12 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/internalWriter.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/internalWriter.C @@ -27,9 +27,6 @@ License #include "internalWriter.H" #include "writeFuns.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from components diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriter.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriter.C index bbf24b1b17d5dc429182649e4c6ea9d9bb31d6c2..ea7da50a401c2c393144c40810774a75257a82f9 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriter.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/lagrangianWriter.C @@ -29,9 +29,6 @@ License #include "Cloud.H" #include "passiveParticle.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from components diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/writePatchGeom.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/writePatchGeom.C index 62b86618107c673bc1c37bf3e2f50a4ef575c3f8..6ad993e0aa1ded67015b98d05f961587328d4730 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/writePatchGeom.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/writePatchGeom.C @@ -78,6 +78,7 @@ void writePatchGeom writeFuns::write(pStream, binary, vertLabels); } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/writePointSet.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/writePointSet.C index ea7dbf43016ff8cac983764d9397cff5818163a6..9e495e073dd04188a50c17d6d76ed68bde239c1f 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/writePointSet.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/writePointSet.C @@ -103,6 +103,7 @@ void writePointSet writeFuns::write(pStream, binary, pointIDs); } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.C b/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.C index 8297002b82492fb1612d30270a46f5040a5ea110..24d1edea53c7311d316d6ec47ac7b0457c2b9b68 100644 --- a/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.C +++ b/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.C @@ -33,7 +33,7 @@ template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::DynamicList(Istream& is) : List<T>(is), - nextFree_(List<T>::size()) + allocSize_(List<T>::size()) {} @@ -44,9 +44,6 @@ Foam::Ostream& Foam::operator<< const Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>& DL ) { - const_cast<DynamicList<T, SizeInc, SizeMult, SizeDiv>&>(DL) - .setSize(DL.nextFree_); - os << static_cast<const List<T>&>(DL); return os; } @@ -60,7 +57,7 @@ Foam::Istream& Foam::operator>> ) { is >> static_cast<List<T>&>(DL); - DL.nextFree_ = DL.List<T>::size(); + DL.allocSize_ = DL.List<T>::size(); return is; } diff --git a/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H b/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H index a98be44fef14d423946f83ab79db4f09b2b40f52..684d393745aee8fc29c0282a7d4e69234f4a7638 100644 --- a/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H +++ b/src/OpenFOAM/containers/Lists/DynamicList/DynamicList.H @@ -81,24 +81,29 @@ class DynamicList { // Private data - //- Number of next free element - label nextFree_; + //- Allocated size for underlying List. + label allocSize_; public: + // Related types + + //- Declare friendship with the List class + friend class List<T>; + // Constructors //- Construct null inline DynamicList(); - //- Construct given size + //- Construct given size. explicit inline DynamicList(const label); - //- Construct from UList. nextFree_ set to size(). + //- Construct from UList. Size set to UList size. explicit inline DynamicList(const UList<T>&); - //- Construct from Istream. nextFree_ set to size(). + //- Construct from Istream. Size set to size of read list. explicit DynamicList(Istream&); @@ -106,22 +111,24 @@ public: // Access - //- Size of the active part of the list. - // Direct over-ride of list size member function - inline label size() const; + //- Size of the underlying storage. + inline label allocSize() const; // Edit //- Reset size of List. - void setSize(const label); + inline void setSize(const label); //- Reset size of List and value for new elements. - void setSize(const label, const T&); + inline void setSize(const label, const T&); - //- Clear the list, i.e. set next free to zero. + //- Clear the list, i.e. set the size to zero. // Allocated size does not change - void clear(); + inline void clear(); + + //- Clear the list and delete storage. + inline void clearStorage(); //- Shrink the List<T> to the number of elements used inline DynamicList<T, SizeInc, SizeMult, SizeDiv>& shrink(); @@ -130,11 +137,11 @@ public: // and annull the argument list. Is same as List::transfer except // checks that you're not changing the underlying list to something // smaller than nextFree_. - void transfer(List<T>&); + inline void transfer(List<T>&); //- Transfer the contents of the argument DynamicList into this // DynamicList and annull the argument list. - void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&); + inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&); // Member Operators @@ -152,9 +159,15 @@ public: //- Assignment of all entries to the given value inline void operator=(const T&); - //- Assignment to List<T> + //- Assignment from List<T> inline void operator=(const List<T>&); + //- Assignment from DynamicList<T> + inline void operator= + ( + const DynamicList<T, SizeInc, SizeMult, SizeDiv>& + ); + // IOstream operators diff --git a/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H b/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H index 8d451ccd7a110a0c678a0d46f75e8c78148e0b4e..d9a14a111183109cf8efc6cebf5a7732f6ed4ee6 100644 --- a/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H +++ b/src/OpenFOAM/containers/Lists/DynamicList/DynamicListI.H @@ -31,8 +31,10 @@ template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> inline Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::DynamicList() : List<T>(SizeInc), - nextFree_(0) -{} + allocSize_(SizeInc) +{ + List<T>::size() = 0; +} //- Construct given size @@ -43,8 +45,10 @@ inline Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::DynamicList ) : List<T>(s), - nextFree_(0) -{} + allocSize_(s) +{ + List<T>::size() = 0; +} //- Construct given size @@ -55,17 +59,17 @@ inline Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::DynamicList ) : List<T>(s), - nextFree_(s.size()) + allocSize_(s.size()) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> -inline Foam::label Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::size() +inline Foam::label Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::allocSize() const { - return nextFree_; + return allocSize_; } @@ -75,13 +79,14 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::setSize const label s ) { - if (s < nextFree_) + if (s < List<T>::size()) { - nextFree_ = s; + List<T>::size() = s; } else { - List<T>::setSize(s); + allocSize_ = s; + List<T>::setSize(allocSize_); } } @@ -93,14 +98,14 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::setSize const T& t ) { - if (s < nextFree_) + if (s < List<T>::size()) { - nextFree_ = s; + List<T>::size() = s; } else { - List<T>::setSize(s, t); - nextFree_ = s; + allocSize_ = s; + List<T>::setSize(allocSize_, t); } } @@ -108,7 +113,16 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::setSize template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::clear() { - nextFree_ = 0; + List<T>::size() = 0; +} + + +template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> +inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::clearStorage() +{ + List<T>::size() = allocSize_; // make List<T> consistent + List<T>::clear(); + allocSize_ = 0; } @@ -116,7 +130,8 @@ template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> inline Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>& Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::shrink() { - List<T>::setSize(nextFree_); + allocSize_ = List<T>::size(); + List<T>::setSize(allocSize_); return *this; } @@ -125,20 +140,20 @@ template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer(List<T>& l) { - if (l.size() < nextFree_) + if (l.size() < List<T>::size()) { FatalErrorIn ( "void DynamicList<T, SizeInc, SizeMult" ", SizeDiv>::transfer(List<T>&)" ) << "Cannot replace the underlying storage of this DynamicList" - << " of which " << nextFree_ << " elements are used" << nl + << " of which " << List<T>::size() << " elements are used" << nl << "with a List of size " << l.size() << abort(FatalError); } else { + allocSize_ = l.size(); List<T>::transfer(l); // take over storage - l.clear(); // set nextFree of l to 0 } } @@ -150,40 +165,40 @@ Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer DynamicList<T, SizeInc, SizeMult, SizeDiv>& l ) { + allocSize_ = l.allocSize(); List<T>::transfer(l); // take over storage - nextFree_ = l.size(); // take over used size - l.clear(); // set nextFree of l to 0 + l.allocSize_ = 0; } template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> -inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::append -( - const T& e -) +inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::append(const T& e) { - nextFree_++; + // Work on copy free index since gets overwritten by setSize + label nextFree = List<T>::size(); - if (nextFree_ > List<T>::size()) + nextFree++; + + if (nextFree > allocSize_) { - List<T>::setSize + allocSize_ = max ( - max - ( - nextFree_, - label(SizeMult*List<T>::size()/SizeDiv + SizeInc) - ) + nextFree, + label(SizeMult*allocSize_/SizeDiv + SizeInc) ); + List<T>::setSize(allocSize_); } - this->operator[](nextFree_ - 1) = e; + this->operator[](nextFree - 1) = e; + + List<T>::size() = nextFree; } template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> inline T Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::remove() { - if (nextFree_ == 0) + if (List<T>::size() == 0) { FatalErrorIn ( @@ -191,7 +206,7 @@ inline T Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::remove() ) << "List is empty" << abort(FatalError); } - return List<T>::operator[](--nextFree_); + return List<T>::operator[](--List<T>::size()); } @@ -203,20 +218,22 @@ inline T& Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator() const label i ) { - nextFree_ = max(nextFree_, i + 1); + label nextFree = List<T>::size(); - if (nextFree_ > List<T>::size()) + nextFree = max(nextFree, i + 1); + + if (nextFree > allocSize_) { - List<T>::setSize + allocSize_ = max ( - max - ( - nextFree_, - label(SizeMult*List<T>::size()/SizeDiv + SizeInc) - ) + nextFree, + label(SizeMult*allocSize_/SizeDiv + SizeInc) ); + List<T>::setSize(allocSize_); } + List<T>::size() = nextFree; + return this->operator[](i); } @@ -228,7 +245,7 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator= ) { List<T>::operator=(t); - nextFree_ = List<T>::size(); + allocSize_ = List<T>::size(); } @@ -239,7 +256,18 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator= ) { List<T>::operator=(l); - nextFree_ = l.size(); + allocSize_ = List<T>::size(); +} + + +template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> +inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator= +( + const DynamicList<T, SizeInc, SizeMult, SizeDiv>& l +) +{ + List<T>::operator=(l); + allocSize_ = l.allocSize(); } diff --git a/src/OpenFOAM/containers/Lists/List/List.C b/src/OpenFOAM/containers/Lists/List/List.C index 249d1fcf2b1783584c278b23d6fb8d341caf4656..21cc042050f2ed0436935667591f8ae10051a2e5 100644 --- a/src/OpenFOAM/containers/Lists/List/List.C +++ b/src/OpenFOAM/containers/Lists/List/List.C @@ -420,6 +420,23 @@ void List<T>::transfer(List<T>& a) } +// Transfer the contents of the argument DynamicList into this List +// and anull the argument list +template<class T> +template<unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> +void List<T>::transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>& a) +{ + if (this->v_) delete[] this->v_; + + this->size_ = a.size_; + this->v_ = a.v_; + + a.size_ = 0; + a.allocSize_ = 0; + a.v_ = 0; +} + + template<class T> void sort(List<T>& a) { diff --git a/src/OpenFOAM/containers/Lists/List/List.H b/src/OpenFOAM/containers/Lists/List/List.H index 3ee814a0f60501e79b39365d9e7f13d936196c5d..7269159ef7206dcc90a5494f0f77fbd6d79a0272 100644 --- a/src/OpenFOAM/containers/Lists/List/List.H +++ b/src/OpenFOAM/containers/Lists/List/List.H @@ -61,6 +61,8 @@ template<class T> Istream& operator>>(Istream&, List<T>&); template<class T, label Size> class FixedList; template<class T> class PtrList; template<class T> class SLList; +template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> + class DynamicList; template<class T> class IndirectList; template<class T> class BiIndirectList; @@ -156,6 +158,11 @@ public: // and annull the argument list. void transfer(List<T>&); + //- Transfer the contents of the argument List into this List + // and annull the argument list. + template<unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> + void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&); + //- Return subscript-checked element of UList. inline T& newElmt(const label); diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index df8d61fa21d34c5e95e0f1d4a5147025b6c019e3..8fdee370a05e9b06c5b7a8b1b67503ee4cb72063 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -397,13 +397,11 @@ void Foam::globalMeshData::calcSharedEdges() const sharedEdgeLabelsPtr_ = new labelList(); labelList& sharedEdgeLabels = *sharedEdgeLabelsPtr_; sharedEdgeLabels.transfer(dynSharedEdgeLabels); - dynSharedEdgeLabels.clear(); dynSharedEdgeAddr.shrink(); sharedEdgeAddrPtr_ = new labelList(); labelList& sharedEdgeAddr = *sharedEdgeAddrPtr_; sharedEdgeAddr.transfer(dynSharedEdgeAddr); - dynSharedEdgeAddr.clear(); if (debug) { diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraSearch.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraSearch.C index 453cdd63c932391ca6a7b8ce05ad54f5b384ec3b..ffad4f005f079941d13ecd3ad599760bb9601265 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraSearch.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatchExtra/PrimitivePatchExtraSearch.C @@ -102,8 +102,9 @@ void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::markZone break; } - changedFaces.transfer(newChangedFaces.shrink()); - newChangedFaces.clear(); + // New dynamiclist: can leave dynamicList unshrunk + //changedFaces.transfer(newChangedFaces.shrink()); + changedFaces.transfer(newChangedFaces); } } diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C index b60b366079fa843427c6ca77f35dea3be449780b..b64eda72663185c99075f13cfe4ea2dac81e9cff 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C @@ -441,11 +441,10 @@ void primitiveMesh::calcEdges(const bool doFaceEdges) const forAll(pe, pointI) { DynamicList<label>& pEdges = pe[pointI]; - inplaceRenumber(oldToNew, pEdges); pEdges.shrink(); + inplaceRenumber(oldToNew, pEdges); pointEdges[pointI].transfer(pEdges); Foam::sort(pointEdges[pointI]); - pEdges.clear(); } // faceEdges diff --git a/src/dynamicMesh/meshCut/cellLooper/hexCellLooper.C b/src/dynamicMesh/meshCut/cellLooper/hexCellLooper.C index dda1f3510dd66db33f2edec41ecdb71b9385091c..62a90ae797ff6c007c475cbf9234a23a88f0b8d4 100644 --- a/src/dynamicMesh/meshCut/cellLooper/hexCellLooper.C +++ b/src/dynamicMesh/meshCut/cellLooper/hexCellLooper.C @@ -29,7 +29,6 @@ License #include "polyMesh.H" #include "cellModeller.H" #include "mathematicalConstants.H" -#include "DynamicList.H" #include "plane.H" #include "ListOps.H" #include "meshTools.H" diff --git a/src/dynamicMesh/meshCut/meshModifiers/meshCutAndRemove/meshCutAndRemove.H b/src/dynamicMesh/meshCut/meshModifiers/meshCutAndRemove/meshCutAndRemove.H index ad8cdb46edd8ac1f0d607f2ae335ebf3f17a6252..4cc2e550b1e0a0c2d7ba20f2a9f9ddcb15e11ff5 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/meshCutAndRemove/meshCutAndRemove.H +++ b/src/dynamicMesh/meshCut/meshModifiers/meshCutAndRemove/meshCutAndRemove.H @@ -40,7 +40,6 @@ SourceFiles #include "boolList.H" #include "labelList.H" #include "typeInfo.H" -#include "DynamicList.H" #include "Map.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.H b/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.H index a4a4b04bbc8dd8bea02072790116d2fc0f5914ae..4a33ea2cccc357fa96a39400e5292508c2011b42 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.H +++ b/src/dynamicMesh/meshCut/meshModifiers/meshCutter/meshCutter.H @@ -113,10 +113,8 @@ SourceFiles #define meshCutter_H #include "edgeVertex.H" -#include "boolList.H" #include "labelList.H" #include "typeInfo.H" -#include "DynamicList.H" #include "Map.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/dynamicMesh/meshCut/meshModifiers/refinementIterator/refinementIterator.C b/src/dynamicMesh/meshCut/meshModifiers/refinementIterator/refinementIterator.C index b7d7655dfb665ec33b8af3b2cee54d6489a50760..f4dd69823cc595f33aa652f50bf7381934aeb5cb 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/refinementIterator/refinementIterator.C +++ b/src/dynamicMesh/meshCut/meshModifiers/refinementIterator/refinementIterator.C @@ -26,12 +26,10 @@ License #include "refinementIterator.H" #include "polyMesh.H" -#include "polyTopoChanger.H" #include "Time.H" #include "refineCell.H" #include "undoableMeshCutter.H" #include "polyTopoChange.H" -#include "DynamicList.H" #include "mapPolyMesh.H" #include "cellCuts.H" #include "OFstream.H" diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C index da3d062fc1b9098801f153747943ed5cc15afd5e..ef711f432fa15dfe7e86498385b487e059530d2f 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/edgeCollapser.C @@ -595,6 +595,7 @@ void Foam::edgeCollapser::updateMesh(const mapPolyMesh& map) { pointRegion_.setSize(mesh_.nPoints()); pointRegion_ = -1; + // Reset count, do not remove underlying storage pointRegionMaster_.clear(); freeRegions_.clear(); } diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/faceCollapser.H b/src/dynamicMesh/polyTopoChange/polyTopoChange/faceCollapser.H index d31a4054dd598c07e9c9ceba1d1b47f7d1ee1cf8..bd80ae1e772aeaef7d4024cc10de7edf06eecbb3 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/faceCollapser.H +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/faceCollapser.H @@ -54,7 +54,6 @@ SourceFiles #define faceCollapser_H #include "labelList.H" -#include "DynamicList.H" #include "point.H" #include "Map.H" #include "labelHashSet.H" diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChangeTemplates.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChangeTemplates.C index 682161c0cc0e3aa7f397aac90a2bb7c4db48e33e..f911802a44b9a1cf29212020cd4e441fcbfe3d89 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChangeTemplates.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/polyTopoChangeTemplates.C @@ -96,13 +96,5 @@ void Foam::polyTopoChange::renumberKey elems.transfer(newElems); } -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/edgeMesh/edgeMesh.C b/src/edgeMesh/edgeMesh.C index 27cb417b3ed4be7e3bbbef4df2dc27b519edf3b7..ffc32de9545123513107956e95fc190f46b411bf 100644 --- a/src/edgeMesh/edgeMesh.C +++ b/src/edgeMesh/edgeMesh.C @@ -156,7 +156,7 @@ label edgeMesh::regions(labelList& edgeRegion) const } } - edgesToVisit.transfer(newEdgesToVisit.shrink()); + edgesToVisit.transfer(newEdgesToVisit); } currentRegion++; diff --git a/src/meshTools/cellFeatures/cellFeatures.C b/src/meshTools/cellFeatures/cellFeatures.C index 247aa0cfd4160e09957ca0df8e9cb84cc2bbc0d8..498e154840c9b44b5113bad4048adc37d29963d2 100644 --- a/src/meshTools/cellFeatures/cellFeatures.C +++ b/src/meshTools/cellFeatures/cellFeatures.C @@ -371,7 +371,7 @@ void Foam::cellFeatures::calcSuperFaces() const { superFace.shrink(); - faces[superFaceI] = face(superFace); + faces[superFaceI].transfer(superFace); } } } diff --git a/src/meshTools/meshSearch/meshSearch.C b/src/meshTools/meshSearch/meshSearch.C index 8657f5c24214ff83dc2297cb5b309dff65b0eac9..68b6026f53a3ac908cc5eb5394f111143c8b9424 100644 --- a/src/meshTools/meshSearch/meshSearch.C +++ b/src/meshTools/meshSearch/meshSearch.C @@ -921,14 +921,7 @@ Foam::List<Foam::pointIndexHit> Foam::meshSearch::intersections hits.shrink(); - // Copy into straight list - List<pointIndexHit> allHits(hits.size()); - - forAll(hits, hitI) - { - allHits[hitI] = hits[hitI]; - } - return allHits; + return hits; } diff --git a/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C b/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C index 26174ee8a1602c7c59142ddd0cb36202828095fb..5abc758ad3db627f0406644c617a80215ed91649 100644 --- a/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C +++ b/src/meshTools/searchableSurface/distributedTriSurfaceMesh.C @@ -240,13 +240,10 @@ Foam::distributedTriSurfaceMesh::constructSegments { dynSendMap[procI].shrink(); sendMap[procI].transfer(dynSendMap[procI]); - dynSendMap[procI].clear(); } allSegments.transfer(dynAllSegments.shrink()); - dynAllSegments.clear(); allSegmentMap.transfer(dynAllSegmentMap.shrink()); - dynAllSegmentMap.clear(); } @@ -708,15 +705,11 @@ Foam::distributedTriSurfaceMesh::calcLocalQueries { dynSendMap[procI].shrink(); sendMap[procI].transfer(dynSendMap[procI]); - dynSendMap[procI].clear(); } allCentres.transfer(dynAllCentres.shrink()); - dynAllCentres.clear(); allRadiusSqr.transfer(dynAllRadiusSqr.shrink()); - dynAllRadiusSqr.clear(); allSegmentMap.transfer(dynAllSegmentMap.shrink()); - dynAllSegmentMap.clear(); } diff --git a/src/meshTools/searchableSurface/searchableBox.C b/src/meshTools/searchableSurface/searchableBox.C index 1858905d49b77759a9375bf3bf79e8597771bdc4..34e3faec99b2c04976ea4701d33d07696f49c2f4 100644 --- a/src/meshTools/searchableSurface/searchableBox.C +++ b/src/meshTools/searchableSurface/searchableBox.C @@ -484,7 +484,6 @@ void Foam::searchableBox::findLineAll hits.shrink(); info[pointI].transfer(hits); - hits.clear(); } else { diff --git a/src/meshTools/searchableSurface/triSurfaceMesh.C b/src/meshTools/searchableSurface/triSurfaceMesh.C index 8b4c1cccc8b7fbe959afa085829fd7196b5299fd..a51b3ff495d2e587c30532e0af71a26d27e34bb9 100644 --- a/src/meshTools/searchableSurface/triSurfaceMesh.C +++ b/src/meshTools/searchableSurface/triSurfaceMesh.C @@ -442,7 +442,6 @@ void Foam::triSurfaceMesh::findLineAll hits.shrink(); info[pointI].transfer(hits); - hits.clear(); } else { diff --git a/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.C b/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.C index 7f588b833564c9b005782d2f4cf5bda05fcd74ce..577d004982f6469a5743d41454bbee724d35f52e 100644 --- a/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.C +++ b/src/meshTools/triSurface/booleanOps/intersectedSurface/edgeSurface.C @@ -288,11 +288,9 @@ Foam::edgeSurface::edgeSurface // Transfer. allEdges.shrink(); - allEdges.clear(); edges_.transfer(allEdges); allParentEdges.shrink(); - allParentEdges.clear(); parentEdges_.transfer(allParentEdges); forAll(allFaceEdges, faceI) @@ -300,7 +298,6 @@ Foam::edgeSurface::edgeSurface DynamicList<label>& allFEdges = allFaceEdges[faceI]; allFEdges.shrink(); - allFEdges.clear(); faceEdges_[faceI].transfer(allFEdges); } diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersectionTemplates.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersectionTemplates.C index 7b349102b2c73a0d3e2e68b203e195cdec555cc2..fd06704ab1ccaa853eb39aa3f90547f96696f0de 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersectionTemplates.C +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/surfaceIntersectionTemplates.C @@ -40,7 +40,6 @@ void Foam::surfaceIntersection::transfer { dList.shrink(); lList.transfer(dList); - dList.clear(); } diff --git a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C index 9f858b95cd536582899d3637863f1f834dbd55f3..10662625f0a8afd55bb52daf62a78b8c98a55107 100644 --- a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C +++ b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C @@ -199,7 +199,6 @@ void Foam::surfaceFeatures::calcFeatPoints(const List<edgeStatus>& edgeStat) } featurePoints.shrink(); featurePoints_.transfer(featurePoints); - featurePoints.clear(); } diff --git a/src/meshTools/triSurface/triSurfaceSearch/triSurfaceSearch.H b/src/meshTools/triSurface/triSurfaceSearch/triSurfaceSearch.H index 5f4422c2d2b722f27cc7b4956ef8c69717f50aba..619632393b64dd983e69a76f14ac4dd7f3930376 100644 --- a/src/meshTools/triSurface/triSurfaceSearch/triSurfaceSearch.H +++ b/src/meshTools/triSurface/triSurfaceSearch/triSurfaceSearch.H @@ -36,7 +36,6 @@ SourceFiles #ifndef triSurfaceSearch_H #define triSurfaceSearch_H -#include "DynamicList.H" #include "pointField.H" #include "boolList.H" #include "pointIndexHit.H" diff --git a/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C b/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C index 0083917df65ec3a8535cbd2edf3294cdecef6c66..a8edd2d334e37c633287550b06d6e6889f2abda0 100644 --- a/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C +++ b/src/meshTools/triSurface/triSurfaceTools/triSurfaceTools.C @@ -300,11 +300,7 @@ Foam::triSurface Foam::triSurfaceTools::doRefine allPoints.transfer(newPoints); newPoints.clear(); - List<labelledTri> allFaces; - allFaces.transfer(newFaces); - newFaces.clear(); - - return triSurface(allFaces, surf.patches(), allPoints); + return triSurface(newFaces, surf.patches(), allPoints, true); } @@ -1988,7 +1984,7 @@ Foam::triSurface Foam::triSurfaceTools::greenRefine newFaces.shrink(); newPoints.setSize(newPointI); - return triSurface(newFaces, surf.patches(), newPoints); + return triSurface(newFaces, surf.patches(), newPoints, true); } diff --git a/src/sampling/cuttingPlane/cuttingPlane.C b/src/sampling/cuttingPlane/cuttingPlane.C index 472d30e7827f59297efc1f1442bc72c2020fd573..e1a0212ff04b10881fb684141f15fa1dccfa8448 100644 --- a/src/sampling/cuttingPlane/cuttingPlane.C +++ b/src/sampling/cuttingPlane/cuttingPlane.C @@ -154,7 +154,6 @@ Foam::labelList Foam::cuttingPlane::intersectEdges dynCuttingPoints.shrink(); cutPoints_.transfer(dynCuttingPoints); - dynCuttingPoints.clear(); return edgePoint; } diff --git a/src/sampling/sampledSet/midPoint/midPointSet.C b/src/sampling/sampledSet/midPoint/midPointSet.C index 37d4d45fc739c544b64f1b84a8605172c6126ce5..e69a379bacfd582b962a25845eac6ceff341b9f5 100644 --- a/src/sampling/sampledSet/midPoint/midPointSet.C +++ b/src/sampling/sampledSet/midPoint/midPointSet.C @@ -25,7 +25,6 @@ License \*---------------------------------------------------------------------------*/ #include "midPointSet.H" -#include "DynamicList.H" #include "polyMesh.H" #include "addToRunTimeSelectionTable.H" diff --git a/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C index b1399cc8adae71248b11c61785a876c701b59b36..1d8a37176d1224817355777cde63341fccc06a58 100644 --- a/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C +++ b/src/sampling/sampledSet/midPointAndFace/midPointAndFaceSet.C @@ -25,7 +25,6 @@ License \*---------------------------------------------------------------------------*/ #include "midPointAndFaceSet.H" -#include "DynamicList.H" #include "polyMesh.H" #include "addToRunTimeSelectionTable.H" diff --git a/src/thermophysicalModels/combustion/chemistryReaders/foamChemistryReader/foamChemistryReader.H b/src/thermophysicalModels/combustion/chemistryReaders/foamChemistryReader/foamChemistryReader.H index ac0d0651b1bd9c7e60d6a2009c109c8d4a253fc9..6ec766546ca45e6610bcea661ca47dd742b1a447 100644 --- a/src/thermophysicalModels/combustion/chemistryReaders/foamChemistryReader/foamChemistryReader.H +++ b/src/thermophysicalModels/combustion/chemistryReaders/foamChemistryReader/foamChemistryReader.H @@ -41,7 +41,6 @@ SourceFiles #include "typeInfo.H" #include "HashPtrTable.H" #include "SLPtrList.H" -#include "DynamicList.H" #include "labelList.H" #include "speciesTable.H" #include "atomicWeights.H" diff --git a/src/triSurface/triSurface/interfaces/AC3D/readAC.C b/src/triSurface/triSurface/interfaces/AC3D/readAC.C index 06afea1dba20b149eed43ce3dcea7f37afd8bac2..85974d52e19ca26f1b52aacf9bcd7b12d01965dc 100644 --- a/src/triSurface/triSurface/interfaces/AC3D/readAC.C +++ b/src/triSurface/triSurface/interfaces/AC3D/readAC.C @@ -339,11 +339,7 @@ bool triSurface::readAC(const fileName& ACfileName) allPoints.transfer(points); points.clear(); - List<labelledTri> allFaces; - allFaces.transfer(faces); - faces.clear(); - - *this = triSurface(allFaces, patches, allPoints); + *this = triSurface(faces, patches, allPoints, true); stitchTriangles(allPoints); diff --git a/src/triSurface/triSurface/interfaces/NAS/readNAS.C b/src/triSurface/triSurface/interfaces/NAS/readNAS.C index 1f4338ac1317eb6791e89d07aa75eb2b8a92578b..2ec15c67067bddfd525aa049a08b5ac3d6271382 100644 --- a/src/triSurface/triSurface/interfaces/NAS/readNAS.C +++ b/src/triSurface/triSurface/interfaces/NAS/readNAS.C @@ -350,7 +350,7 @@ bool triSurface::readNAS(const fileName& OBJfileName) points.clear(); // Create triSurface - *this = triSurface(faces, patches, allPoints); + *this = triSurface(faces, patches, allPoints, true); return true; } diff --git a/src/triSurface/triSurface/interfaces/OBJ/readOBJ.C b/src/triSurface/triSurface/interfaces/OBJ/readOBJ.C index 018fd4932f280473df3715b9806ff3549a9ecd40..6b522c4f0e1c57fcdc13a7dc553b0dd085e87742 100644 --- a/src/triSurface/triSurface/interfaces/OBJ/readOBJ.C +++ b/src/triSurface/triSurface/interfaces/OBJ/readOBJ.C @@ -195,14 +195,9 @@ bool triSurface::readOBJ(const fileName& OBJfileName) // Transfer DynamicLists to straight ones. pointField allPoints; allPoints.transfer(points); - points.clear(); - - List<labelledTri> allFaces; - allFaces.transfer(faces); - faces.clear(); // Create triSurface - *this = triSurface(allFaces, patches, allPoints); + *this = triSurface(faces, patches, allPoints, true); return true; }