A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects. More...
#include <OpenFOAM/DynamicList.H>
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Internal storage is a compact array and the list can be shrunk to compact storage. The increase of list size is controlled by three template parameters, which allows the list storage to either increase by the given increment or by the given multiplier and divider (allowing non-integer multiples).
Definition at line 77 of file DynamicList.H.
Public Member Functions | |
DynamicList () | |
Construct null. | |
DynamicList (const label) | |
Construct given size. | |
DynamicList (const DynamicList< T, SizeInc, SizeMult, SizeDiv > &) | |
Construct copy. | |
DynamicList (const UList< T > &) | |
Construct from UList. Size set to UList size. | |
DynamicList (const UIndirectList< T > &) | |
Construct from UIndirectList. Size set to UIndirectList size. | |
DynamicList (const Xfer< List< T > > &) | |
Construct by transferring the parameter contents. | |
DynamicList (Istream &) | |
Construct from Istream. Size set to size of read list. | |
label | capacity () const |
Size of the underlying storage. | |
void | setCapacity (const label) |
Alter the size of the underlying storage. | |
void | setSize (const label) |
Alter the addressed list size. | |
void | setSize (const label, const T &) |
Alter the addressed list size and fill new space with a constant. | |
void | resize (const label) |
Alter the addressed list size. | |
void | resize (const label, const T &) |
Alter the addressed list size and fill new space with a constant. | |
void | reserve (const label) |
Reserve allocation space for at least this size. | |
void | clear () |
Clear the addressed list, i.e. set the size to zero. | |
void | clearStorage () |
Clear the list and delete storage. | |
DynamicList< T, SizeInc, SizeMult, SizeDiv > & | shrink () |
Shrink the allocated space to the number of elements used. | |
void | transfer (List< T > &) |
Transfer contents of the argument List into this DynamicList. | |
void | transfer (DynamicList< T, SizeInc, SizeMult, SizeDiv > &) |
Transfer contents of the argument DynamicList into this DynamicList. | |
Xfer< List< T > > | xfer () |
Transfer contents to the Xfer container as a plain List. | |
void | append (const T &) |
Append an element at the end of the list. | |
void | append (const UList< T > &) |
Append a List at the end of this list. | |
void | append (const UIndirectList< T > &) |
Append a UIndirectList at the end of this list. | |
T | remove () |
Remove and return the top element. | |
T & | operator() (const label) |
Return non-const access to an element, resizing list if necessary. | |
void | operator= (const T &) |
Assignment of all addressed entries to the given value. | |
void | operator= (const DynamicList< T, SizeInc, SizeMult, SizeDiv > &) |
Assignment from DynamicList. | |
void | operator= (const UList< T > &) |
Assignment from UList. | |
![]() | |
List () | |
Null constructor. | |
List (const label) | |
Construct with given size. | |
List (const label, const T &) | |
Construct with given size and value for all elements. | |
List (const List< T > &) | |
Copy constructor. | |
List (const Xfer< List< T > > &) | |
Construct by transferring the parameter contents. | |
List (List< T > &, bool reUse) | |
Construct as copy or re-use as specified. | |
List (const UList< T > &, const unallocLabelList &mapAddressing) | |
Construct as subset. | |
template<class InputIterator > | |
List (InputIterator first, InputIterator last) | |
Construct given start and end iterators. | |
template<unsigned Size> | |
List (const FixedList< T, Size > &) | |
Construct as copy of FixedList<T, Size> | |
List (const PtrList< T > &) | |
Construct as copy of PtrList<T> | |
List (const SLList< T > &) | |
Construct as copy of SLList<T> | |
List (const IndirectList< T > &) | |
Construct as copy of IndirectList<T> | |
List (const UIndirectList< T > &) | |
Construct as copy of UIndirectList<T> | |
List (const BiIndirectList< T > &) | |
Construct as copy of BiIndirectList<T> | |
List (Istream &) | |
Construct from Istream. | |
autoPtr< List< T > > | clone () const |
Clone. | |
~List () | |
label | size () const |
Return the number of elements in the UList. | |
void | transfer (SortableList< T > &) |
Transfer the contents of the argument List into this list. | |
T & | newElmt (const label) |
Return subscript-checked element of UList. | |
void | operator= (const List< T > &) |
Assignment operator. Takes linear time. | |
void | operator= (const SLList< T > &) |
Assignment from SLList operator. Takes linear time. | |
void | operator= (const IndirectList< T > &) |
Assignment from IndirectList operator. Takes linear time. | |
void | operator= (const UIndirectList< T > &) |
Assignment from UIndirectList operator. Takes linear time. | |
void | operator= (const BiIndirectList< T > &) |
Assignment from BiIndirectList operator. Takes linear time. | |
![]() | |
UList () | |
Null constructor. | |
UList (T *__restrict__ v, label size) | |
Construct from components. | |
label | fcIndex (const label i) const |
Return the forward circular index, i.e. the next index. | |
label | rcIndex (const label i) const |
Return the reverse circular index, i.e. the previous index. | |
label | byteSize () const |
Return the binary size in number of characters of the UList. | |
const T * | cdata () const |
Return a const pointer to the first data element,. | |
T * | data () |
Return a pointer to the first data element,. | |
void | checkStart (const label start) const |
Check start is within valid range (0 ... size-1). | |
void | checkSize (const label size) const |
Check size is within valid range (0 ... size). | |
void | checkIndex (const label i) const |
Check index i is within valid range (0 ... size-1). | |
void | writeEntry (Ostream &) const |
Write the UList as a dictionary entry. | |
void | writeEntry (const word &keyword, Ostream &) const |
Write the UList as a dictionary entry with keyword. | |
void | assign (const UList< T > &) |
Assign elements to those from UList. | |
T & | operator[] (const label) |
Return element of UList. | |
const T & | operator[] (const label) const |
Return element of constant UList. | |
operator const Foam::List< T > & () const | |
Allow cast to a const List<T>&. | |
iterator | begin () |
Return an iterator to begin traversing the UList. | |
iterator | end () |
Return an iterator to end traversing the UList. | |
const_iterator | cbegin () const |
Return const_iterator to begin traversing the constant UList. | |
const_iterator | cend () const |
Return const_iterator to end traversing the constant UList. | |
const_iterator | begin () const |
Return const_iterator to begin traversing the constant UList. | |
const_iterator | end () const |
Return const_iterator to end traversing the constant UList. | |
reverse_iterator | rbegin () |
Return reverse_iterator to begin reverse traversing the UList. | |
reverse_iterator | rend () |
Return reverse_iterator to end reverse traversing the UList. | |
const_reverse_iterator | crbegin () const |
Return const_reverse_iterator to begin reverse traversing the UList. | |
const_reverse_iterator | crend () const |
Return const_reverse_iterator to end reverse traversing the UList. | |
const_reverse_iterator | rbegin () const |
Return const_reverse_iterator to begin reverse traversing the UList. | |
const_reverse_iterator | rend () const |
Return const_reverse_iterator to end reverse traversing the UList. | |
label | max_size () const |
Return size of the largest possible UList. | |
bool | empty () const |
Return true if the UList is empty (ie, size() is zero). | |
void | swap (UList< T > &) |
Swap two ULists of the same type in constant time. | |
bool | operator== (const UList< T > &) const |
Equality operation on ULists of the same type. | |
bool | operator!= (const UList< T > &) const |
The opposite of the equality operation. Takes linear time. | |
bool | operator< (const UList< T > &) const |
Compare two ULists lexicographically. Takes linear time. | |
bool | operator> (const UList< T > &) const |
Compare two ULists lexicographically. Takes linear time. | |
bool | operator<= (const UList< T > &) const |
Return true if !(a > b). Takes linear time. | |
bool | operator>= (const UList< T > &) const |
Return true if !(a < b). Takes linear time. | |
template<> | |
const bool & | operator[] (const label i) const |
Friends | |
class | List< T > |
Declare friendship with the List class. | |
Ostream & | operator (Ostream &, const DynamicList< T, SizeInc, SizeMult, SizeDiv > &) |
Istream & | operator>> (Istream &, DynamicList< T, SizeInc, SizeMult, SizeDiv > &) |
Read from Istream, discarding contents of existing DynamicList. |
Additional Inherited Members | |
![]() | |
typedef SubList< T > | subList |
Declare type of subList. | |
![]() | |
typedef T | value_type |
Type of values the UList contains. | |
typedef T & | reference |
Type that can be used for storing into. | |
typedef const T & | const_reference |
Type that can be used for storing into. | |
typedef label | difference_type |
The type that can represent the difference between any two. | |
typedef label | size_type |
The type that can represent the size of a UList. | |
typedef T * | iterator |
Random access iterator for traversing UList. | |
typedef const T * | const_iterator |
Random access iterator for traversing UList. | |
typedef T * | reverse_iterator |
Reverse iterator for reverse traversal of UList. | |
typedef const T * | const_reverse_iterator |
Reverse iterator for reverse traversal of constant UList. | |
![]() | |
static const List< T > & | null () |
Return a null List. | |
![]() | |
void | size (const label) |
Override size to be inconsistent with allocated storage. |
|
inline |
|
inlineexplicit |
|
inlineexplicit |
Construct copy.
Definition at line 54 of file DynamicListI.H.
|
inlineexplicit |
Construct from UList. Size set to UList size.
Also constructs from DynamicList with different sizing parameters.
Definition at line 65 of file DynamicListI.H.
|
inlineexplicit |
Construct from UIndirectList. Size set to UIndirectList size.
Definition at line 76 of file DynamicListI.H.
|
inlineexplicit |
Construct by transferring the parameter contents.
Definition at line 87 of file DynamicListI.H.
|
explicit |
Construct from Istream. Size set to size of read list.
Definition at line 32 of file DynamicList.C.
|
inline |
Size of the underlying storage.
Definition at line 100 of file DynamicListI.H.
Referenced by primitiveMesh::cellEdges(), primitiveMesh::cellPoints(), primitiveMesh::faceEdges(), and primitiveMesh::pointPoints().
|
inline |
Alter the size of the underlying storage.
The addressed size will be truncated if needed to fit, but will remain otherwise untouched. Use this or reserve() in combination with append().
Definition at line 109 of file DynamicListI.H.
References List< T >::setSize(), and List< T >::size().
Referenced by primitiveMesh::cellEdges(), primitiveMesh::cellPoints(), primitiveMesh::faceEdges(), primitiveMesh::pointPoints(), and surfaceFeatures::selectFeatureEdges().
|
inline |
Alter the addressed list size.
New space will be allocated if required. Use this to resize the list prior to using the operator[] for setting values (as per List usage).
Reimplemented from List< T >.
Definition at line 167 of file DynamicListI.H.
References Foam::max(), List< T >::setSize(), and List< T >::size().
Referenced by primitiveMesh::pointCells(), and face::triangles().
|
inline |
Alter the addressed list size and fill new space with a constant.
Reimplemented from List< T >.
Definition at line 204 of file DynamicListI.H.
References setSize(), and List< T >::size().
|
inline |
Alter the addressed list size.
New space will be allocated if required. Use this to resize the list prior to using the operator[] for setting values (as per List usage).
Reimplemented from List< T >.
Definition at line 222 of file DynamicListI.H.
References setSize().
|
inline |
Alter the addressed list size and fill new space with a constant.
Reimplemented from List< T >.
Definition at line 232 of file DynamicListI.H.
References setSize().
|
inline |
Reserve allocation space for at least this size.
Never shrinks the allocated size, use setCapacity() for that.
Definition at line 130 of file DynamicListI.H.
References Foam::max(), List< T >::setSize(), and List< T >::size().
Referenced by STARCDsurfaceFormat< Face >::read().
|
inline |
Clear the addressed list, i.e. set the size to zero.
Allocated size does not change
Reimplemented from List< T >.
Definition at line 242 of file DynamicListI.H.
References List< T >::size().
Referenced by primitiveMesh::cellCells(), primitiveMesh::cellEdges(), primitiveMesh::cellPoints(), primitiveMesh::edgeCells(), primitiveMesh::edgeFaces(), primitiveMesh::faceEdges(), Particle< ParticleType >::findFaces(), searchableBox::findLineAll(), triSurfaceMesh::findLineAll(), indexedOctree< Type >::indexedOctree(), primitiveMesh::pointCells(), primitiveMesh::pointPoints(), and STARCDsurfaceFormat< Face >::read().
|
inline |
Clear the list and delete storage.
Definition at line 249 of file DynamicListI.H.
References List< T >::clear().
Referenced by NASsurfaceFormat< Face >::read(), and List< T >::transfer().
|
inline |
Shrink the allocated space to the number of elements used.
Returns a reference to the DynamicList.
Definition at line 258 of file DynamicListI.H.
References List< T >::setSize(), and List< T >::size().
Referenced by geomCellLooper::cut(), boundaryMesh::getNearest(), indexedOctree< Type >::indexedOctree(), meshSearch::intersections(), isoSurfaceCell::isoSurfaceCell(), noiseFFT::noiseFFT(), ProcessorTopology< Patch, ProcPatch >::ProcessorTopology(), OBJsurfaceFormat< Face >::read(), NASsurfaceFormat< Face >::read(), interactionLists::realCellsInRangeOfSegment(), interactionLists::referredCellsInRangeOfSegment(), searchableSurfaceCollection::regions(), surfaceFeatures::selectFeatureEdges(), dynamicRefineFvMesh::selectRefineCells(), List< T >::transfer(), triSurfaceTools::triangulate(), and triSurfaceTools::triangulateFaceCentre().
Transfer contents of the argument List into this DynamicList.
Reimplemented from List< T >.
Definition at line 277 of file DynamicListI.H.
References List< T >::size(), and List< T >::transfer().
Referenced by OBJsurfaceFormat< Face >::read().
|
inline |
Transfer contents of the argument DynamicList into this DynamicList.
Reimplemented from List< T >.
Definition at line 287 of file DynamicListI.H.
References List< T >::transfer().
|
inline |
Transfer contents to the Xfer container as a plain List.
Reimplemented from List< T >.
Definition at line 301 of file DynamicListI.H.
Referenced by fileName::components(), OBJsurfaceFormat< Face >::read(), NASsurfaceFormat< Face >::read(), OFFsurfaceFormat< Face >::read(), and STARCDsurfaceFormat< Face >::read().
|
inline |
Append an element at the end of the list.
Definition at line 309 of file DynamicListI.H.
References setSize(), and List< T >::size().
Referenced by cellZoneSet::addSet(), pointZoneSet::addSet(), faceZoneSet::addSet(), normalToFace::applyToSet(), primitiveMesh::cellCells(), primitiveMesh::cellEdges(), primitiveMesh::cellPoints(), fileName::components(), geomCellLooper::cut(), primitiveMesh::edgeCells(), primitiveMesh::edgeFaces(), primitiveMesh::faceEdges(), Particle< ParticleType >::findFaces(), searchableBox::findLineAll(), triSurfaceMesh::findLineAll(), FreeStream< CloudType >::FreeStream(), removeCells::getExposedFaces(), boundaryMesh::getNearest(), indexedOctree< Type >::indexedOctree(), meshSearch::intersections(), LocalInteraction< CloudType >::LocalInteraction(), hsCombustionThermo::NewType(), hCombustionThermo::NewType(), hReactionThermo::NewType(), hsReactionThermo::NewType(), csvTableReader< Type >::operator()(), primitiveMesh::pointCells(), primitiveMesh::pointPoints(), ProcessorTopology< Patch, ProcPatch >::ProcessorTopology(), OBJsurfaceFormat< Face >::read(), NASsurfaceFormat< Face >::read(), OFFsurfaceFormat< Face >::read(), AC3DsurfaceFormat< Face >::read(), STARCDsurfaceFormat< Face >::read(), STARCDsurfaceFormatCore::readPoints(), interactionLists::realCellsInRangeOfSegment(), interactionLists::referredCellsInRangeOfSegment(), searchableSurfaceCollection::regions(), scalarRanges::scalarRanges(), surfaceFeatures::selectFeatureEdges(), dynamicRefineFvMesh::selectRefineCells(), boundaryMesh::setFeatureEdges(), faceCollapser::setRefinement(), boundaryCutter::setRefinement(), hexRef8::setRefinement(), cellZoneSet::subset(), pointZoneSet::subset(), surfaceIntersection::surfaceIntersection(), and wallLayerCells::wallLayerCells().
Append a List at the end of this list.
Reimplemented from List< T >.
Definition at line 322 of file DynamicListI.H.
References Foam::abort(), Foam::FatalError, FatalErrorIn, forAll, setSize(), List< T >::size(), and UList< T >::size().
|
inline |
Append a UIndirectList at the end of this list.
Reimplemented from List< T >.
Definition at line 347 of file DynamicListI.H.
References forAll, setSize(), UIndirectList< T >::size(), and List< T >::size().
|
inline |
Remove and return the top element.
Definition at line 362 of file DynamicListI.H.
References Foam::abort(), Foam::FatalError, FatalErrorIn, UList< T >::operator[](), List< T >::size(), and Foam::T().
Return non-const access to an element, resizing list if necessary.
Definition at line 386 of file DynamicListI.H.
References setSize().
Assignment of all addressed entries to the given value.
Reimplemented from List< T >.
Definition at line 401 of file DynamicListI.H.
References UList< T >::operator=().
|
inline |
Assignment from DynamicList.
Definition at line 434 of file DynamicListI.H.
References Foam::abort(), Foam::FatalError, FatalErrorIn, List< T >::operator=(), UIndirectList< T >::size(), and List< T >::size().
Assignment from UList.
Reimplemented from List< T >.
Definition at line 411 of file DynamicListI.H.
References List< T >::operator=(), UIndirectList< T >::size(), and List< T >::size().
Declare friendship with the List class.
Reimplemented from UList< T >.
Definition at line 93 of file DynamicList.H.
|
friend |
|
friend |
Read from Istream, discarding contents of existing DynamicList.