dynamicList update

This commit is contained in:
mattijs
2008-09-17 11:59:50 +01:00
41 changed files with 146 additions and 151 deletions

View File

@ -184,10 +184,6 @@ int main(int argc, char *argv[])
<< endl; << endl;
// Transfer DynamicLists to straight ones. // Transfer DynamicLists to straight ones.
labelList cutEdges;
cutEdges.transfer(allCutEdges);
allCutEdges.clear();
scalarField cutEdgeWeights; scalarField cutEdgeWeights;
cutEdgeWeights.transfer(allCutEdgeWeights); cutEdgeWeights.transfer(allCutEdgeWeights);
allCutEdgeWeights.clear(); allCutEdgeWeights.clear();
@ -199,7 +195,7 @@ int main(int argc, char *argv[])
mesh, mesh,
cutCells.toc(), // cells candidate for cutting cutCells.toc(), // cells candidate for cutting
labelList(0), // cut vertices labelList(0), // cut vertices
cutEdges, // cut edges allCutEdges, // cut edges
cutEdgeWeights // weight on cut edges cutEdgeWeights // weight on cut edges
); );

View File

@ -35,11 +35,8 @@ Description
#include "IOstreams.H" #include "IOstreams.H"
#include "SLPtrList.H" #include "SLPtrList.H"
#include "boolList.H" #include "boolList.H"
#include "cellList.H"
#include "primitiveMesh.H" #include "primitiveMesh.H"
#include "cyclicFvPatch.H" #include "cyclicPolyPatch.H"
#include "fvPatchList.H"
#include "DynamicList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -33,7 +33,7 @@ License
#include "OSspecific.H" #include "OSspecific.H"
#include "Map.H" #include "Map.H"
#include "globalMeshData.H" #include "globalMeshData.H"
#include "DynamicList.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -45,7 +45,6 @@ Description
#include "IOobjectList.H" #include "IOobjectList.H"
#include "boolList.H" #include "boolList.H"
#include "stringList.H" #include "stringList.H"
#include "DynamicList.H"
#include "cellModeller.H" #include "cellModeller.H"
#include "floatScalar.H" #include "floatScalar.H"

View File

@ -27,9 +27,6 @@ License
#include "internalWriter.H" #include "internalWriter.H"
#include "writeFuns.H" #include "writeFuns.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components // Construct from components

View File

@ -29,9 +29,6 @@ License
#include "Cloud.H" #include "Cloud.H"
#include "passiveParticle.H" #include "passiveParticle.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components // Construct from components

View File

@ -78,6 +78,7 @@ void writePatchGeom
writeFuns::write(pStream, binary, vertLabels); writeFuns::write(pStream, binary, vertLabels);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -103,6 +103,7 @@ void writePointSet
writeFuns::write(pStream, binary, pointIDs); writeFuns::write(pStream, binary, pointIDs);
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -33,7 +33,7 @@ template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::DynamicList(Istream& is) Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::DynamicList(Istream& is)
: :
List<T>(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 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); os << static_cast<const List<T>&>(DL);
return os; return os;
} }
@ -60,7 +57,7 @@ Foam::Istream& Foam::operator>>
) )
{ {
is >> static_cast<List<T>&>(DL); is >> static_cast<List<T>&>(DL);
DL.nextFree_ = DL.List<T>::size(); DL.allocSize_ = DL.List<T>::size();
return is; return is;
} }

View File

@ -81,24 +81,29 @@ class DynamicList
{ {
// Private data // Private data
//- Number of next free element //- Allocated size for underlying List.
label nextFree_; label allocSize_;
public: public:
// Related types
//- Declare friendship with the List class
friend class List<T>;
// Constructors // Constructors
//- Construct null //- Construct null
inline DynamicList(); inline DynamicList();
//- Construct given size //- Construct given size.
explicit inline DynamicList(const label); 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>&); 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&); explicit DynamicList(Istream&);
@ -106,22 +111,24 @@ public:
// Access // Access
//- Size of the active part of the list. //- Size of the underlying storage.
// Direct over-ride of list size member function inline label allocSize() const;
inline label size() const;
// Edit // Edit
//- Reset size of List. //- Reset size of List.
void setSize(const label); inline void setSize(const label);
//- Reset size of List and value for new elements. //- 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 // 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 //- Shrink the List<T> to the number of elements used
inline DynamicList<T, SizeInc, SizeMult, SizeDiv>& shrink(); inline DynamicList<T, SizeInc, SizeMult, SizeDiv>& shrink();
@ -130,11 +137,11 @@ public:
// and annull the argument list. Is same as List::transfer except // and annull the argument list. Is same as List::transfer except
// checks that you're not changing the underlying list to something // checks that you're not changing the underlying list to something
// smaller than nextFree_. // smaller than nextFree_.
void transfer(List<T>&); inline void transfer(List<T>&);
//- Transfer the contents of the argument DynamicList into this //- Transfer the contents of the argument DynamicList into this
// DynamicList and annull the argument list. // DynamicList and annull the argument list.
void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&); inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&);
// Member Operators // Member Operators
@ -152,9 +159,15 @@ public:
//- Assignment of all entries to the given value //- Assignment of all entries to the given value
inline void operator=(const T&); inline void operator=(const T&);
//- Assignment to List<T> //- Assignment from List<T>
inline void operator=(const List<T>&); inline void operator=(const List<T>&);
//- Assignment from DynamicList<T>
inline void operator=
(
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
// IOstream operators // IOstream operators

View File

@ -31,8 +31,10 @@ template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::DynamicList() inline Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::DynamicList()
: :
List<T>(SizeInc), List<T>(SizeInc),
nextFree_(0) allocSize_(SizeInc)
{} {
List<T>::size() = 0;
}
//- Construct given size //- Construct given size
@ -43,8 +45,10 @@ inline Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::DynamicList
) )
: :
List<T>(s), List<T>(s),
nextFree_(0) allocSize_(s)
{} {
List<T>::size() = 0;
}
//- Construct given size //- Construct given size
@ -55,17 +59,17 @@ inline Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::DynamicList
) )
: :
List<T>(s), List<T>(s),
nextFree_(s.size()) allocSize_(s.size())
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> 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 const
{ {
return nextFree_; return allocSize_;
} }
@ -75,13 +79,14 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::setSize
const label s const label s
) )
{ {
if (s < nextFree_) if (s < List<T>::size())
{ {
nextFree_ = s; List<T>::size() = s;
} }
else 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 const T& t
) )
{ {
if (s < nextFree_) if (s < List<T>::size())
{ {
nextFree_ = s; List<T>::size() = s;
} }
else else
{ {
List<T>::setSize(s, t); allocSize_ = s;
nextFree_ = 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> template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::clear() 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>& inline Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>&
Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::shrink() Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::shrink()
{ {
List<T>::setSize(nextFree_); allocSize_ = List<T>::size();
List<T>::setSize(allocSize_);
return *this; return *this;
} }
@ -125,20 +140,20 @@ template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline void inline void
Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer(List<T>& l) Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer(List<T>& l)
{ {
if (l.size() < nextFree_) if (l.size() < List<T>::size())
{ {
FatalErrorIn FatalErrorIn
( (
"void DynamicList<T, SizeInc, SizeMult" "void DynamicList<T, SizeInc, SizeMult"
", SizeDiv>::transfer(List<T>&)" ", SizeDiv>::transfer(List<T>&)"
) << "Cannot replace the underlying storage of this DynamicList" ) << "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); << "with a List of size " << l.size() << abort(FatalError);
} }
else else
{ {
allocSize_ = l.size();
List<T>::transfer(l); // take over storage 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 DynamicList<T, SizeInc, SizeMult, SizeDiv>& l
) )
{ {
allocSize_ = l.allocSize();
List<T>::transfer(l); // take over storage List<T>::transfer(l); // take over storage
nextFree_ = l.size(); // take over used size l.allocSize_ = 0;
l.clear(); // set nextFree of l to 0
} }
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::append inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::append(const T& e)
(
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*allocSize_/SizeDiv + SizeInc)
nextFree_,
label(SizeMult*List<T>::size()/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> template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline T Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::remove() inline T Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::remove()
{ {
if (nextFree_ == 0) if (List<T>::size() == 0)
{ {
FatalErrorIn FatalErrorIn
( (
@ -191,7 +206,7 @@ inline T Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::remove()
) << "List is empty" << abort(FatalError); ) << "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 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*allocSize_/SizeDiv + SizeInc)
nextFree_,
label(SizeMult*List<T>::size()/SizeDiv + SizeInc)
)
); );
List<T>::setSize(allocSize_);
} }
List<T>::size() = nextFree;
return this->operator[](i); return this->operator[](i);
} }
@ -228,7 +245,7 @@ inline void Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::operator=
) )
{ {
List<T>::operator=(t); 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); 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();
} }

View File

@ -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> template<class T>
void sort(List<T>& a) void sort(List<T>& a)
{ {

View File

@ -61,6 +61,8 @@ template<class T> Istream& operator>>(Istream&, List<T>&);
template<class T, label Size> class FixedList; template<class T, label Size> class FixedList;
template<class T> class PtrList; template<class T> class PtrList;
template<class T> class SLList; 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 IndirectList;
template<class T> class BiIndirectList; template<class T> class BiIndirectList;
@ -156,6 +158,11 @@ public:
// and annull the argument list. // and annull the argument list.
void transfer(List<T>&); 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. //- Return subscript-checked element of UList.
inline T& newElmt(const label); inline T& newElmt(const label);

View File

@ -397,13 +397,11 @@ void Foam::globalMeshData::calcSharedEdges() const
sharedEdgeLabelsPtr_ = new labelList(); sharedEdgeLabelsPtr_ = new labelList();
labelList& sharedEdgeLabels = *sharedEdgeLabelsPtr_; labelList& sharedEdgeLabels = *sharedEdgeLabelsPtr_;
sharedEdgeLabels.transfer(dynSharedEdgeLabels); sharedEdgeLabels.transfer(dynSharedEdgeLabels);
dynSharedEdgeLabels.clear();
dynSharedEdgeAddr.shrink(); dynSharedEdgeAddr.shrink();
sharedEdgeAddrPtr_ = new labelList(); sharedEdgeAddrPtr_ = new labelList();
labelList& sharedEdgeAddr = *sharedEdgeAddrPtr_; labelList& sharedEdgeAddr = *sharedEdgeAddrPtr_;
sharedEdgeAddr.transfer(dynSharedEdgeAddr); sharedEdgeAddr.transfer(dynSharedEdgeAddr);
dynSharedEdgeAddr.clear();
if (debug) if (debug)
{ {

View File

@ -102,8 +102,9 @@ void Foam::PrimitivePatchExtra<Face, ListType, PointField, PointType>::markZone
break; break;
} }
changedFaces.transfer(newChangedFaces.shrink()); // New dynamiclist: can leave dynamicList unshrunk
newChangedFaces.clear(); //changedFaces.transfer(newChangedFaces.shrink());
changedFaces.transfer(newChangedFaces);
} }
} }

View File

@ -441,11 +441,10 @@ void primitiveMesh::calcEdges(const bool doFaceEdges) const
forAll(pe, pointI) forAll(pe, pointI)
{ {
DynamicList<label>& pEdges = pe[pointI]; DynamicList<label>& pEdges = pe[pointI];
inplaceRenumber(oldToNew, pEdges);
pEdges.shrink(); pEdges.shrink();
inplaceRenumber(oldToNew, pEdges);
pointEdges[pointI].transfer(pEdges); pointEdges[pointI].transfer(pEdges);
Foam::sort(pointEdges[pointI]); Foam::sort(pointEdges[pointI]);
pEdges.clear();
} }
// faceEdges // faceEdges

View File

@ -29,7 +29,6 @@ License
#include "polyMesh.H" #include "polyMesh.H"
#include "cellModeller.H" #include "cellModeller.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
#include "DynamicList.H"
#include "plane.H" #include "plane.H"
#include "ListOps.H" #include "ListOps.H"
#include "meshTools.H" #include "meshTools.H"

View File

@ -40,7 +40,6 @@ SourceFiles
#include "boolList.H" #include "boolList.H"
#include "labelList.H" #include "labelList.H"
#include "typeInfo.H" #include "typeInfo.H"
#include "DynamicList.H"
#include "Map.H" #include "Map.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -113,10 +113,8 @@ SourceFiles
#define meshCutter_H #define meshCutter_H
#include "edgeVertex.H" #include "edgeVertex.H"
#include "boolList.H"
#include "labelList.H" #include "labelList.H"
#include "typeInfo.H" #include "typeInfo.H"
#include "DynamicList.H"
#include "Map.H" #include "Map.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -26,12 +26,10 @@ License
#include "refinementIterator.H" #include "refinementIterator.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "polyTopoChanger.H"
#include "Time.H" #include "Time.H"
#include "refineCell.H" #include "refineCell.H"
#include "undoableMeshCutter.H" #include "undoableMeshCutter.H"
#include "polyTopoChange.H" #include "polyTopoChange.H"
#include "DynamicList.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "cellCuts.H" #include "cellCuts.H"
#include "OFstream.H" #include "OFstream.H"

View File

@ -595,6 +595,7 @@ void Foam::edgeCollapser::updateMesh(const mapPolyMesh& map)
{ {
pointRegion_.setSize(mesh_.nPoints()); pointRegion_.setSize(mesh_.nPoints());
pointRegion_ = -1; pointRegion_ = -1;
// Reset count, do not remove underlying storage
pointRegionMaster_.clear(); pointRegionMaster_.clear();
freeRegions_.clear(); freeRegions_.clear();
} }

View File

@ -54,7 +54,6 @@ SourceFiles
#define faceCollapser_H #define faceCollapser_H
#include "labelList.H" #include "labelList.H"
#include "DynamicList.H"
#include "point.H" #include "point.H"
#include "Map.H" #include "Map.H"
#include "labelHashSet.H" #include "labelHashSet.H"

View File

@ -96,13 +96,5 @@ void Foam::polyTopoChange::renumberKey
elems.transfer(newElems); elems.transfer(newElems);
} }
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
// ************************************************************************* // // ************************************************************************* //

View File

@ -156,7 +156,7 @@ label edgeMesh::regions(labelList& edgeRegion) const
} }
} }
edgesToVisit.transfer(newEdgesToVisit.shrink()); edgesToVisit.transfer(newEdgesToVisit);
} }
currentRegion++; currentRegion++;

View File

@ -371,7 +371,7 @@ void Foam::cellFeatures::calcSuperFaces() const
{ {
superFace.shrink(); superFace.shrink();
faces[superFaceI] = face(superFace); faces[superFaceI].transfer(superFace);
} }
} }
} }

View File

@ -921,14 +921,7 @@ Foam::List<Foam::pointIndexHit> Foam::meshSearch::intersections
hits.shrink(); hits.shrink();
// Copy into straight list return hits;
List<pointIndexHit> allHits(hits.size());
forAll(hits, hitI)
{
allHits[hitI] = hits[hitI];
}
return allHits;
} }

View File

@ -240,13 +240,10 @@ Foam::distributedTriSurfaceMesh::constructSegments
{ {
dynSendMap[procI].shrink(); dynSendMap[procI].shrink();
sendMap[procI].transfer(dynSendMap[procI]); sendMap[procI].transfer(dynSendMap[procI]);
dynSendMap[procI].clear();
} }
allSegments.transfer(dynAllSegments.shrink()); allSegments.transfer(dynAllSegments.shrink());
dynAllSegments.clear();
allSegmentMap.transfer(dynAllSegmentMap.shrink()); allSegmentMap.transfer(dynAllSegmentMap.shrink());
dynAllSegmentMap.clear();
} }
@ -708,15 +705,11 @@ Foam::distributedTriSurfaceMesh::calcLocalQueries
{ {
dynSendMap[procI].shrink(); dynSendMap[procI].shrink();
sendMap[procI].transfer(dynSendMap[procI]); sendMap[procI].transfer(dynSendMap[procI]);
dynSendMap[procI].clear();
} }
allCentres.transfer(dynAllCentres.shrink()); allCentres.transfer(dynAllCentres.shrink());
dynAllCentres.clear();
allRadiusSqr.transfer(dynAllRadiusSqr.shrink()); allRadiusSqr.transfer(dynAllRadiusSqr.shrink());
dynAllRadiusSqr.clear();
allSegmentMap.transfer(dynAllSegmentMap.shrink()); allSegmentMap.transfer(dynAllSegmentMap.shrink());
dynAllSegmentMap.clear();
} }

View File

@ -484,7 +484,6 @@ void Foam::searchableBox::findLineAll
hits.shrink(); hits.shrink();
info[pointI].transfer(hits); info[pointI].transfer(hits);
hits.clear();
} }
else else
{ {

View File

@ -442,7 +442,6 @@ void Foam::triSurfaceMesh::findLineAll
hits.shrink(); hits.shrink();
info[pointI].transfer(hits); info[pointI].transfer(hits);
hits.clear();
} }
else else
{ {

View File

@ -288,11 +288,9 @@ Foam::edgeSurface::edgeSurface
// Transfer. // Transfer.
allEdges.shrink(); allEdges.shrink();
allEdges.clear();
edges_.transfer(allEdges); edges_.transfer(allEdges);
allParentEdges.shrink(); allParentEdges.shrink();
allParentEdges.clear();
parentEdges_.transfer(allParentEdges); parentEdges_.transfer(allParentEdges);
forAll(allFaceEdges, faceI) forAll(allFaceEdges, faceI)
@ -300,7 +298,6 @@ Foam::edgeSurface::edgeSurface
DynamicList<label>& allFEdges = allFaceEdges[faceI]; DynamicList<label>& allFEdges = allFaceEdges[faceI];
allFEdges.shrink(); allFEdges.shrink();
allFEdges.clear();
faceEdges_[faceI].transfer(allFEdges); faceEdges_[faceI].transfer(allFEdges);
} }

View File

@ -40,7 +40,6 @@ void Foam::surfaceIntersection::transfer
{ {
dList.shrink(); dList.shrink();
lList.transfer(dList); lList.transfer(dList);
dList.clear();
} }

View File

@ -199,7 +199,6 @@ void Foam::surfaceFeatures::calcFeatPoints(const List<edgeStatus>& edgeStat)
} }
featurePoints.shrink(); featurePoints.shrink();
featurePoints_.transfer(featurePoints); featurePoints_.transfer(featurePoints);
featurePoints.clear();
} }

View File

@ -36,7 +36,6 @@ SourceFiles
#ifndef triSurfaceSearch_H #ifndef triSurfaceSearch_H
#define triSurfaceSearch_H #define triSurfaceSearch_H
#include "DynamicList.H"
#include "pointField.H" #include "pointField.H"
#include "boolList.H" #include "boolList.H"
#include "pointIndexHit.H" #include "pointIndexHit.H"

View File

@ -300,11 +300,7 @@ Foam::triSurface Foam::triSurfaceTools::doRefine
allPoints.transfer(newPoints); allPoints.transfer(newPoints);
newPoints.clear(); newPoints.clear();
List<labelledTri> allFaces; return triSurface(newFaces, surf.patches(), allPoints, true);
allFaces.transfer(newFaces);
newFaces.clear();
return triSurface(allFaces, surf.patches(), allPoints);
} }
@ -1988,7 +1984,7 @@ Foam::triSurface Foam::triSurfaceTools::greenRefine
newFaces.shrink(); newFaces.shrink();
newPoints.setSize(newPointI); newPoints.setSize(newPointI);
return triSurface(newFaces, surf.patches(), newPoints); return triSurface(newFaces, surf.patches(), newPoints, true);
} }

View File

@ -154,7 +154,6 @@ Foam::labelList Foam::cuttingPlane::intersectEdges
dynCuttingPoints.shrink(); dynCuttingPoints.shrink();
cutPoints_.transfer(dynCuttingPoints); cutPoints_.transfer(dynCuttingPoints);
dynCuttingPoints.clear();
return edgePoint; return edgePoint;
} }

View File

@ -25,7 +25,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "midPointSet.H" #include "midPointSet.H"
#include "DynamicList.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"

View File

@ -25,7 +25,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "midPointAndFaceSet.H" #include "midPointAndFaceSet.H"
#include "DynamicList.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"

View File

@ -41,7 +41,6 @@ SourceFiles
#include "typeInfo.H" #include "typeInfo.H"
#include "HashPtrTable.H" #include "HashPtrTable.H"
#include "SLPtrList.H" #include "SLPtrList.H"
#include "DynamicList.H"
#include "labelList.H" #include "labelList.H"
#include "speciesTable.H" #include "speciesTable.H"
#include "atomicWeights.H" #include "atomicWeights.H"

View File

@ -339,11 +339,7 @@ bool triSurface::readAC(const fileName& ACfileName)
allPoints.transfer(points); allPoints.transfer(points);
points.clear(); points.clear();
List<labelledTri> allFaces; *this = triSurface(faces, patches, allPoints, true);
allFaces.transfer(faces);
faces.clear();
*this = triSurface(allFaces, patches, allPoints);
stitchTriangles(allPoints); stitchTriangles(allPoints);

View File

@ -350,7 +350,7 @@ bool triSurface::readNAS(const fileName& OBJfileName)
points.clear(); points.clear();
// Create triSurface // Create triSurface
*this = triSurface(faces, patches, allPoints); *this = triSurface(faces, patches, allPoints, true);
return true; return true;
} }

View File

@ -195,14 +195,9 @@ bool triSurface::readOBJ(const fileName& OBJfileName)
// Transfer DynamicLists to straight ones. // Transfer DynamicLists to straight ones.
pointField allPoints; pointField allPoints;
allPoints.transfer(points); allPoints.transfer(points);
points.clear();
List<labelledTri> allFaces;
allFaces.transfer(faces);
faces.clear();
// Create triSurface // Create triSurface
*this = triSurface(allFaces, patches, allPoints); *this = triSurface(faces, patches, allPoints, true);
return true; return true;
} }