UList< T > Class Template Reference

A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscript bounds checking, etc. More...

Inheritance diagram for UList< T >:
[legend]
Collaboration diagram for UList< T >:
[legend]

Classes

struct  greater
 A list compare binary predicate for reverse sort. More...
 
struct  Hash
 Deprecated(2021-04) hashing functor. Use hasher() More...
 
struct  hasher
 Hashing functor for UList. More...
 
struct  less
 A list compare binary predicate for normal sort. More...
 

Public Types

typedef T value_type
 The value type the list contains. More...
 
typedef Tpointer
 The pointer type for non-const access to value_type items. More...
 
typedef Treference
 The type used for storing into value_type objects. More...
 
typedef Titerator
 Random access iterator for traversing a UList. More...
 
typedef label size_type
 The type to represent the size of a UList. More...
 
typedef label difference_type
 The difference between iterator objects. More...
 
typedef std::reverse_iterator< iteratorreverse_iterator
 Reverse iterator (non-const access) More...
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 Reverse iterator (const access) More...
 

Public Member Functions

 UList (const UList< T > &)=default
 Copy construct. More...
 
constexpr UList () noexcept
 Default construct, zero-sized and nullptr. More...
 
 UList (T *__restrict__ v, const label len) noexcept
 Construct from components. More...
 
label fcIndex (const label i) const noexcept
 
label rcIndex (const label i) const noexcept
 
const TfcValue (const label i) const
 Return forward circular value (ie, next value in the list) More...
 
TfcValue (const label i)
 Return forward circular value (ie, next value in the list) More...
 
const TrcValue (const label i) const
 Return reverse circular value (ie, previous value in the list) More...
 
TrcValue (const label i)
 Return reverse circular value (ie, previous value in the list) More...
 
const Tcdata () const noexcept
 Return pointer to the underlying array serving as data storage. More...
 
Tdata () noexcept
 Return pointer to the underlying array serving as data storage. More...
 
const char * cdata_bytes () const noexcept
 Return pointer to the underlying array serving as data storage,. More...
 
char * data_bytes () noexcept
 Return pointer to the underlying array serving as data storage,. More...
 
Tfirst ()
 Return the first element of the list. More...
 
const Tfirst () const
 Return first element of the list. More...
 
Tlast ()
 Return the last element of the list. More...
 
const Tlast () const
 Return the last element of the list. More...
 
std::streamsize size_bytes () const noexcept
 Number of contiguous bytes for the List data. More...
 
std::streamsize byteSize () const
 
void checkStart (const label start) const
 Check start is within valid range [0,size) More...
 
void checkSize (const label size) const
 Check size is within valid range [0,size]. More...
 
void checkRange (const label start, const label len) const
 Check that start and length define a valid range. More...
 
void checkIndex (const label i) const
 Check index is within valid range [0,size) More...
 
bool uniform () const
 True if all entries have identical values, and list is non-empty. More...
 
label find (const T &val, label pos=0) const
 Find index of the first occurrence of the value. More...
 
label rfind (const T &val, label pos=-1) const
 Find index of the last occurrence of the value. More...
 
bool found (const T &val, label pos=0) const
 True if the value if found in the list. More...
 
void moveFirst (const label i)
 Move element to the first position. More...
 
void moveLast (const label i)
 Move element to the last position. More...
 
void swapFirst (const label i)
 Swap element with the first element. Fatal on an empty list. More...
 
void swapLast (const label i)
 Swap element with the last element. Fatal on an empty list. More...
 
void shallowCopy (const UList< T > &list)
 Copy the pointer and size held by the given UList. More...
 
void deepCopy (const UList< T > &list)
 Copy elements of the given UList. Sizes must match! More...
 
template<class Addr >
void deepCopy (const IndirectListBase< T, Addr > &list)
 Copy elements of the given indirect list. Sizes must match! More...
 
SubList< Tslice (const label pos, label len=-1)
 Return SubList slice (non-const access) - no range checking. More...
 
const SubList< Tslice (const label pos, label len=-1) const
 Return SubList slice (const access) - no range checking. More...
 
SubList< Tslice (const labelRange &range)
 Return SubList slice (non-const access) - with range checking. More...
 
const SubList< Tslice (const labelRange &range) const
 Return SubList slice (const access) - with range checking. More...
 
Toperator[] (const label i)
 Return element of UList. More...
 
const Toperator[] (const label i) const
 Return element of constant UList. More...
 
 operator const Foam::List< T > & () const
 Allow cast to a const List<T>&. More...
 
void operator= (const T &val)
 Assignment of all entries to the given value. More...
 
void operator= (const Foam::zero)
 Assignment of all entries to zero. More...
 
iterator begin () noexcept
 Return an iterator to begin traversing the UList. More...
 
iterator end () noexcept
 Return an iterator to end traversing the UList. More...
 
const_iterator cbegin () const noexcept
 Return const_iterator to begin traversing the constant UList. More...
 
const_iterator cend () const noexcept
 Return const_iterator to end traversing the constant UList. More...
 
const_iterator begin () const noexcept
 Return const_iterator to begin traversing the constant UList. More...
 
const_iterator end () const noexcept
 Return const_iterator to end traversing the constant UList. More...
 
reverse_iterator rbegin ()
 Return reverse_iterator to begin reverse traversing the UList. More...
 
reverse_iterator rend ()
 Return reverse_iterator to end reverse traversing the UList. More...
 
const_reverse_iterator crbegin () const
 Return const_reverse_iterator to begin reverse traversing the UList. More...
 
const_reverse_iterator crend () const
 Return const_reverse_iterator to end reverse traversing the UList. More...
 
const_reverse_iterator rbegin () const
 Return const_reverse_iterator to begin reverse traversing the UList. More...
 
const_reverse_iterator rend () const
 Return const_reverse_iterator to end reverse traversing the UList. More...
 
label size () const noexcept
 The number of elements in the UList. More...
 
bool empty () const noexcept
 True if the UList is empty (ie, size() is zero) More...
 
void swap (UList< T > &list)
 Swap content with another UList of the same type in constant time. More...
 
bool operator== (const UList< T > &a) const
 Equality operation on ULists of the same type. More...
 
bool operator!= (const UList< T > &a) const
 The opposite of the equality operation. Takes linear time. More...
 
bool operator< (const UList< T > &list) const
 Compare two ULists lexicographically. Takes linear time. More...
 
bool operator> (const UList< T > &a) const
 Compare two ULists lexicographically. Takes linear time. More...
 
bool operator<= (const UList< T > &a) const
 Return true if !(a > b). Takes linear time. More...
 
bool operator>= (const UList< T > &a) const
 Return true if !(a < b). Takes linear time. More...
 
IstreamreadList (Istream &is)
 Read List contents from Istream. More...
 
void writeEntry (const word &keyword, Ostream &os) const
 Write the List as a dictionary entry with keyword. More...
 
OstreamwriteList (Ostream &os, const label shortLen=0) const
 Write List, with line-breaks in ASCII when length exceeds shortLen. More...
 
template<class TypeT = T>
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type test (const label i) const
 A bitSet::test() method for a list of bool. More...
 
template<class TypeT = T>
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type get (const label i) const
 A bitSet::get() method for a list of bool. More...
 
template<class TypeT = T>
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type unset (const label i)
 A bitSet::unset() method for a list of bool. More...
 
template<>
IstreamreadList (Istream &is)
 
template<>
OstreamwriteList (Ostream &os, const label) const
 
template<>
const booloperator[] (const label i) const
 
template<>
Foam::UPstream::commsStructoperator[] (const label procID)
 
template<>
const Foam::UPstream::commsStructoperator[] (const label procID) const
 
template<>
UPstream::commsStructoperator[] (const label)
 
template<>
const UPstream::commsStructoperator[] (const label) const
 
template<>
OstreamwriteList (Ostream &os, const label) const
 
template<>
IstreamreadList (Istream &is)
 

Static Public Member Functions

static const UList< T > & null ()
 Return a UList reference to a nullObject. More...
 
static constexpr label max_size () noexcept
 The size of the largest possible UList. More...
 

Public Attributes

const typedef Tconst_pointer
 The pointer type for const access to value_type items. More...
 
const typedef Tconst_reference
 The type used for reading from constant value_type objects. More...
 
const typedef Tconst_iterator
 Random access iterator for traversing a UList. More...
 

Protected Member Functions

void setAddressableSize (const label n) noexcept
 Set addressed size to be inconsistent with allocated storage. More...
 
void size (const label n)
 Older name for setAddressableSize. More...
 
void writeEntry (Ostream &os) const
 Write the UList with its compound type. More...
 
labelRange validateRange (const labelRange &requestedRange) const
 
UList< T > & operator= (const UList< T > &)=delete
 No copy assignment (default: shallow copy) More...
 
template<>
void writeEntry (Ostream &os) const
 
template<>
void writeEntry (Ostream &os) const
 

Friends

class List< T >
 Declare friendship with the List class. More...
 
class SubList< T >
 Declare friendship with the SubList class. More...
 
Istreamoperator>> (Istream &os, UList< T > &list)
 Use the readList() method to read contents from Istream. More...
 

Detailed Description

template<class T>
class Foam::UList< T >

A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscript bounds checking, etc.

Storage is not allocated during construction or use but is supplied to the constructor as an argument. This type of list is particularly useful for lists that refer to parts of existing lists such as SubList.

Source files

Definition at line 103 of file HashTable.H.

Member Typedef Documentation

◆ value_type

typedef T value_type

The value type the list contains.

Definition at line 136 of file UList.H.

◆ pointer

typedef T* pointer

The pointer type for non-const access to value_type items.

Definition at line 139 of file UList.H.

◆ reference

typedef T& reference

The type used for storing into value_type objects.

Definition at line 145 of file UList.H.

◆ iterator

typedef T* iterator

Random access iterator for traversing a UList.

Definition at line 151 of file UList.H.

◆ size_type

typedef label size_type

The type to represent the size of a UList.

Definition at line 157 of file UList.H.

◆ difference_type

typedef label difference_type

The difference between iterator objects.

Definition at line 160 of file UList.H.

◆ reverse_iterator

typedef std::reverse_iterator<iterator> reverse_iterator

Reverse iterator (non-const access)

Definition at line 163 of file UList.H.

◆ const_reverse_iterator

typedef std::reverse_iterator<const_iterator> const_reverse_iterator

Reverse iterator (const access)

Definition at line 166 of file UList.H.

Constructor & Destructor Documentation

◆ UList() [1/3]

UList ( const UList< T > &  )
default

Copy construct.

◆ UList() [2/3]

constexpr UList ( )
inlineconstexprnoexcept

Default construct, zero-sized and nullptr.

Definition at line 35 of file UListI.H.

◆ UList() [3/3]

UList ( T *__restrict__  v,
const label  len 
)
inlinenoexcept

Construct from components.

Definition at line 43 of file UListI.H.

Member Function Documentation

◆ setAddressableSize()

void setAddressableSize ( const label  n)
inlineprotectednoexcept

Set addressed size to be inconsistent with allocated storage.

Use with care

Definition at line 413 of file UListI.H.

Referenced by UList< Foam::wordRe >::size().

Here is the caller graph for this function:

◆ size() [1/2]

void size ( const label  n)
inlineprotected

Older name for setAddressableSize.

Definition at line 114 of file UList.H.

Referenced by AABBTree< Type >::AABBTree(), dynamicOversetFvMesh::active(), fvMeshPrimitiveLduAddressing::addAddressing(), dynamicOversetFvMesh::addInterpolation(), faMatrix< Type >::addToInternalField(), fvMatrix< Type >::addToInternalField(), MeshedSurface< Foam::face >::addZones(), pairGAMGAgglomeration::agglomerate(), GAMGAgglomeration::agglomerateLduAddressing(), UPstream::allToAll(), List< vectorField >::append(), ITstream::append(), DynamicList< Foam::FixedList< scalar, 3 > >::append(), DynamicField< Foam::Vector >::append(), Foam::appendCsvLabels(), assemblyFaceAreaPairGAMGAgglomeration::assemblyFaceAreaPairGAMGAgglomeration(), Field< Foam::Vector2D >::autoMap(), fvPatchField< vector >::autoMap(), bitSet::bitSet(), isoSurfaceBase::blockCells(), coupledPolyPatch::calcFaceTol(), globalIndex::calcOffsets(), globalIndex::calcRanges(), Foam::checkFaceSizeMatch(), GAMGAgglomeration::checkRestriction(), lduPrimitiveMesh::checkUpperTriangular(), ensightFaces::classify(), ORourkeCollision< CloudType >::collide(), GAMGAgglomeration::compactLevels(), vtuAdaptor::convertField(), UList< Foam::wordRe >::deepCopy(), Matrix< RectangularMatrix< Type >, Type >::diag(), faMeshBoundaryHalo::distributeSparse(), edgeInterpolationScheme< scalar >::euclidianInterpolate(), Pstream::exchange(), functionObjectList::execute(), regionSizeDistribution::extractData(), FaceCellWave< Type, TrackingData >::FaceCellWave(), NASCore::faceDecomposition(), ABAQUSCore::faceDecomposition(), lduMatrix::faceH(), LduMatrix< Type, DType, LUType >::faceH(), Foam::vtk::Tools::Faces(), fft::fftRenumberRecurse(), FixedList< Type, 3 >::FixedList(), mapDistributeBase::flipAndCombine(), globalIndex::gather(), globalIndex::get(), coupledPolyPatch::getAnchorPoints(), GenericPatchGeoFieldsWriter< PatchType >::getFaceField(), Foam::ensightOutput::Detail::getFaceSizes(), weightedPosition::getPoints(), Foam::ensightOutput::Detail::getPolysNFaces(), globalIndex::globalIndex(), Foam::Im(), Foam::ImComplexField(), vtuAdaptor::internal(), cyclicACMIGAMGInterface::internalFieldTransfer(), cyclicAMIGAMGInterface::internalFieldTransfer(), cyclicAMIPolyPatch::interpolate(), edgeInterpolationScheme< scalar >::interpolate(), surfaceInterpolationScheme< GType >::interpolate(), AMIInterpolation::interpolateToSource(), AMIInterpolation::interpolateToTarget(), interpolationTable< scalar >::interpolateValues(), meshToMeshMethod::intersect(), meshToMeshMethod::interVol(), meshToMeshMethod::interVolAndCentroid(), Foam::inv(), cell::labels(), lduPrimitiveMesh::lduPrimitiveMesh(), List< vectorField >::List(), UPstream::listScatterValues(), polyTopoChange::makeMesh(), Field< Foam::Vector2D >::map(), mapDistributeBase::mapDistributeBase(), Foam::matchPoints(), PrimitivePatch<::Foam::List< labelledTri >, pointField >::meshEdges(), MeshedSurface< Foam::face >::MeshedSurface(), LduMatrix< Type, DType, LUType >::negSumDiag(), lduMatrix::negSumDiag(), noiseFFT::octaves(), noiseModel::octaves(), dlLibraryTable::open(), Foam::operator<<(), BiIndirectList< T >::operator=(), List< vectorField >::operator=(), FixedList< Type, 3 >::operator=(), HashSet< word, Hash< word > >::operator=(), PackedList< 2 >::PackedList(), Foam::peekTokenAt(), vtuAdaptor::points(), Foam::vtk::Tools::Points(), Polynomial< 8 >::Polynomial(), seriesWriter::print(), faFieldDecomposer::processorAreaPatchFieldDecomposer::processorAreaPatchFieldDecomposer(), fvFieldDecomposer::processorVolPatchFieldDecomposer::processorVolPatchFieldDecomposer(), FIRECore::putFireLabels(), Foam::Re(), UList< Foam::wordRe >::readList(), hashedWordList::rehash(), Foam::ReImSum(), UnsortedMeshedSurface< Face >::remapFaces(), MeshedSurface< Foam::face >::remapFaces(), UPtrList< const Foam::UList >::reorder(), globalIndex::reset(), vtuSizing::reset(), vtuSizing::resetShapes(), Foam::reverse(), face::reverseFace(), SortList< T >::reverseSort(), sampledSurface::sampleOnFaces(), sampledSurface::sampleOnPoints(), triSurfaceLoader::select(), weightedPosition::setPoints(), removeCells::setRefinement(), CompactListList< T, Container >::setSize(), Foam::ListOps::setValue(), UnsortedMeshedSurface< Face >::setZones(), directFieldMapper::size(), directFvPatchFieldMapper::size(), directPointPatchFieldMapper::size(), distributedUnallocatedDirectFieldMapper::size(), distributedUnallocatedDirectFvPatchFieldMapper::size(), LLTMatrix< Type >::solve(), SortList< T >::sort(), UPtrList< const Foam::UList >::sortOrder(), extendedEdgeMesh::sortPointsAndEdges(), Foam::stabilise(), faMatrix< Type >::subtractFromInternalField(), fvMatrix< Type >::subtractFromInternalField(), Foam::sumCmptProd(), LduMatrix< Type, DType, LUType >::sumDiag(), lduMatrix::sumDiag(), LduMatrix< Type, DType, LUType >::sumMagOffDiag(), lduMatrix::sumMagOffDiag(), Foam::sumProd(), syncTools::swapBoundaryCellList(), syncTools::swapBoundaryCellPositions(), syncTools::syncBoundaryFaceList(), syncTools::syncPointList(), weightedPosition::syncPoints(), Foam::system(), meshRefinement::testSyncBoundaryFaceList(), fft::transform(), PackedList< 2 >::unpack(), dynamicOversetFvMesh::updateAddressing(), topoBoolSet::updateLabels(), topoBitSet::updateLabels(), topoSet::updateLabels(), Foam::HashSetOps::used(), Foam::vtk::Tools::Vertices(), FLMAsurfaceFormat< Face >::write(), OBJsurfaceFormat< Face >::write(), SMESHsurfaceFormat< Face >::write(), OFFsurfaceFormat< Face >::write(), GTSsurfaceFormat< Face >::write(), ABAQUSsurfaceFormat< Face >::write(), dynamicOversetFvMesh::write(), STARCDsurfaceFormat< Face >::write(), NASsurfaceFormat< Face >::write(), VTPsurfaceFormat< Face >::write(), OBJstream::write(), decomposedBlockData::writeBlocks(), STARCDsurfaceFormatCore::writeCase(), VTKsurfaceFormatCore::writeCellData(), VTPsurfaceFormatCore::writeCellData(), lumpedPointMovement::writeData(), lumpedPointMovement::writeForcesAndMomentsVTP(), VTPsurfaceFormatCore::writeHeader(), VTKsurfaceFormatCore::writeHeader(), AC3DsurfaceFormatCore::writeHeader(), UList< Foam::wordRe >::writeList(), Foam::vtk::writeListsParallel(), coupledPolyPatch::writeOBJ(), Foam::meshTools::writeOBJ(), Foam::ensightOutput::writePolysPoints(), nastranWriter::writeTemplate(), starcdWriter::writeTemplate(), and Foam::zip().

◆ writeEntry() [1/4]

void writeEntry ( Ostream os) const
protected

Write the UList with its compound type.

Definition at line 38 of file UListIO.C.

Referenced by faceZone::writeDict().

Here is the caller graph for this function:

◆ validateRange()

Foam::labelRange validateRange ( const labelRange requestedRange) const
protected

Return a validated (start,size) subset range, which means that it always addresses a valid section of the list.

Definition at line 41 of file UList.C.

◆ operator=() [1/3]

UList<T>& operator= ( const UList< T > &  )
protecteddelete

No copy assignment (default: shallow copy)

Assignment may need to be shallow (copy pointer) or deep (copy elements) depending on context or type of list. Disallow default assignment and provide separate 'shallowCopy' and 'deepCopy' member functions.

Referenced by SortableList< T >::operator=().

Here is the caller graph for this function:

◆ null()

const Foam::UList< T > & null ( )
inlinestatic

Return a UList reference to a nullObject.

Definition at line 53 of file UListI.H.

Referenced by FieldMapper::directAddressing(), pointFieldReconstructor::pointPatchFieldReconstructor::directAddressing(), fvFieldReconstructor::fvPatchFieldReconstructor::directAddressing(), faFieldReconstructor::faPatchFieldReconstructor::directAddressing(), globalIndex::localStarts(), voxelMeshSearch::makeMesh(), polyPatch::nbrCells(), vtuSizing::reset(), and starcdWriter::write().

Here is the caller graph for this function:

◆ fcIndex()

Foam::label fcIndex ( const label  i) const
inlinenoexcept

The forward circular index. The next index in the list which returns to the first at the end of the list

Definition at line 60 of file UListI.H.

◆ rcIndex()

Foam::label rcIndex ( const label  i) const
inlinenoexcept

The reverse circular index. The previous index in the list which returns to the last at the beginning of the list

Definition at line 67 of file UListI.H.

◆ fcValue() [1/2]

const T & fcValue ( const label  i) const
inline

Return forward circular value (ie, next value in the list)

Definition at line 74 of file UListI.H.

◆ fcValue() [2/2]

T & fcValue ( const label  i)
inline

Return forward circular value (ie, next value in the list)

Definition at line 81 of file UListI.H.

◆ rcValue() [1/2]

const T & rcValue ( const label  i) const
inline

Return reverse circular value (ie, previous value in the list)

Definition at line 88 of file UListI.H.

◆ rcValue() [2/2]

T & rcValue ( const label  i)
inline

Return reverse circular value (ie, previous value in the list)

Definition at line 95 of file UListI.H.

◆ cdata()

const T * cdata ( ) const
inlinenoexcept

Return pointer to the underlying array serving as data storage.

Definition at line 230 of file UListI.H.

Referenced by UPstream::allToAll(), UList< T >::hasher::operator()(), OFstreamCollator::write(), and decomposedBlockData::writeBlocks().

Here is the caller graph for this function:

◆ data()

T * data ( )
inlinenoexcept

Return pointer to the underlying array serving as data storage.

Definition at line 237 of file UListI.H.

Referenced by UList< Foam::wordRe >::readList().

Here is the caller graph for this function:

◆ cdata_bytes()

const char * cdata_bytes ( ) const
inlinenoexcept

Return pointer to the underlying array serving as data storage,.

reinterpreted as byte data

Note
Only meaningful for contiguous data

Definition at line 244 of file UListI.H.

Referenced by UPstream::listScatterValues(), globalIndex::mpiGather(), UList< Foam::wordRe >::writeList(), and Foam::vtk::writeListsParallel().

Here is the caller graph for this function:

◆ data_bytes()

char * data_bytes ( )
inlinenoexcept

Return pointer to the underlying array serving as data storage,.

reinterpreted as byte data

Note
Only meaningful for contiguous data

Definition at line 251 of file UListI.H.

Referenced by UList< Foam::wordRe >::readList().

Here is the caller graph for this function:

◆ first() [1/2]

T & first ( )
inline

Return the first element of the list.

Definition at line 202 of file UListI.H.

Referenced by weightedPosition::getPoints(), and Foam::printTable().

Here is the caller graph for this function:

◆ first() [2/2]

const T & first ( ) const
inline

Return first element of the list.

Definition at line 209 of file UListI.H.

◆ last() [1/2]

T & last ( )
inline

Return the last element of the list.

Definition at line 216 of file UListI.H.

Referenced by globalIndex::gather().

Here is the caller graph for this function:

◆ last() [2/2]

const T & last ( ) const
inline

Return the last element of the list.

Definition at line 223 of file UListI.H.

◆ size_bytes()

std::streamsize size_bytes ( ) const
inlinenoexcept

Number of contiguous bytes for the List data.

Note
Only meaningful for contiguous data

Definition at line 258 of file UListI.H.

Referenced by globalIndex::mpiGather(), UList< T >::hasher::operator()(), UList< Foam::wordRe >::readList(), OFstreamCollator::write(), decomposedBlockData::writeBlocks(), UList< Foam::wordRe >::writeList(), and Foam::vtk::writeListsParallel().

Here is the caller graph for this function:

◆ byteSize()

std::streamsize byteSize ( ) const

Number of contiguous bytes for the List data, runtime FatalError if type is not contiguous

Definition at line 199 of file UList.C.

◆ checkStart()

void checkStart ( const label  start) const
inline

Check start is within valid range [0,size)

Definition at line 102 of file UListI.H.

◆ checkSize()

void checkSize ( const label  size) const
inline

Check size is within valid range [0,size].

Definition at line 116 of file UListI.H.

Referenced by SubList< T >::SubList().

Here is the caller graph for this function:

◆ checkRange()

void checkRange ( const label  start,
const label  len 
) const
inline

Check that start and length define a valid range.

Definition at line 130 of file UListI.H.

Referenced by SubList< T >::SubList().

Here is the caller graph for this function:

◆ checkIndex()

void checkIndex ( const label  i) const
inline

Check index is within valid range [0,size)

Definition at line 159 of file UListI.H.

◆ uniform()

bool uniform ( ) const
inline

True if all entries have identical values, and list is non-empty.

Definition at line 178 of file UListI.H.

Referenced by UList< Foam::wordRe >::writeList().

Here is the caller graph for this function:

◆ find()

Foam::label find ( const T val,
label  pos = 0 
) const

Find index of the first occurrence of the value.

Any occurrences before the start pos are ignored. Linear search.

Returns
position in list or -1 if not found.

Definition at line 212 of file UList.C.

◆ rfind()

Foam::label rfind ( const T val,
label  pos = -1 
) const

Find index of the last occurrence of the value.

Any occurrences after the end pos are ignored. Linear search.

Returns
position in list or -1 if not found.

Definition at line 236 of file UList.C.

◆ found()

bool found ( const T val,
label  pos = 0 
) const
inline

True if the value if found in the list.

Any occurrences before the start pos are ignored. Linear search.

Returns
true if found.

Definition at line 265 of file UListI.H.

Referenced by findNearestMaskedOp< PatchType >::operator()(), and foundOp< StringType >::operator()().

Here is the caller graph for this function:

◆ moveFirst()

void moveFirst ( const label  i)

Move element to the first position.

Definition at line 57 of file UList.C.

◆ moveLast()

void moveLast ( const label  i)

Move element to the last position.

Definition at line 69 of file UList.C.

◆ swapFirst()

void swapFirst ( const label  i)

Swap element with the first element. Fatal on an empty list.

Definition at line 81 of file UList.C.

◆ swapLast()

void swapLast ( const label  i)

Swap element with the last element. Fatal on an empty list.

Definition at line 93 of file UList.C.

◆ shallowCopy()

void shallowCopy ( const UList< T > &  list)
inline

Copy the pointer and size held by the given UList.

Definition at line 272 of file UListI.H.

Referenced by surfMesh::updateRefs().

Here is the caller graph for this function:

◆ deepCopy() [1/2]

void deepCopy ( const UList< T > &  list)

Copy elements of the given UList. Sizes must match!

Definition at line 107 of file UList.C.

Referenced by UPstream::allToAll().

Here is the caller graph for this function:

◆ deepCopy() [2/2]

void deepCopy ( const IndirectListBase< T, Addr > &  list)

Copy elements of the given indirect list. Sizes must match!

Definition at line 144 of file UList.C.

◆ slice() [1/4]

Foam::SubList< Type > slice ( const label  pos,
label  len = -1 
)

Return SubList slice (non-const access) - no range checking.

Definition at line 165 of file SubList.H.

◆ slice() [2/4]

const Foam::SubList< Type > slice ( const label  pos,
label  len = -1 
) const

Return SubList slice (const access) - no range checking.

Definition at line 177 of file SubList.H.

◆ slice() [3/4]

Foam::SubList< Type > slice ( const labelRange range)

Return SubList slice (non-const access) - with range checking.

The range is subsetted with the list size itself to ensure that the result always addresses a valid section of the list.

Definition at line 189 of file SubList.H.

◆ slice() [4/4]

const Foam::SubList< Type > slice ( const labelRange range) const

Return SubList slice (const access) - with range checking.

The range is subsetted with the list size itself to ensure that the result always addresses a valid section of the list.

Definition at line 197 of file SubList.H.

◆ operator[]() [1/7]

T & operator[] ( const label  i)
inline

Return element of UList.

Definition at line 299 of file UListI.H.

◆ operator[]() [2/7]

const T & operator[] ( const label  i) const
inline

Return element of constant UList.

Note
bool specialization adds lazy evaluation so reading an out-of-range element returns false without ill-effects

Definition at line 309 of file UListI.H.

◆ operator const Foam::List< T > &()

operator const Foam::List< T > & ( ) const
inline

Allow cast to a const List<T>&.

Definition at line 319 of file UListI.H.

◆ operator=() [2/3]

void operator= ( const T val)

Assignment of all entries to the given value.

Definition at line 169 of file UList.C.

◆ operator=() [3/3]

void operator= ( const Foam::zero  )

Assignment of all entries to zero.

Definition at line 183 of file UList.C.

◆ begin() [1/2]

◆ end() [1/2]

◆ cbegin()

Foam::UList< T >::const_iterator cbegin ( ) const
inlinenoexcept

Return const_iterator to begin traversing the constant UList.

Definition at line 343 of file UListI.H.

Referenced by IndirectListBase< T, Addr >::begin(), IndirectListBase< T, Addr >::cbegin(), HashTable< Foam::autoPtr< Foam::interfaceCompositionModel > >::erase(), and Foam::isFaceCut().

Here is the caller graph for this function:

◆ cend()

Foam::UList< T >::const_iterator cend ( ) const
inlinenoexcept

Return const_iterator to end traversing the constant UList.

Definition at line 364 of file UListI.H.

Referenced by IndirectListBase< T, Addr >::cend(), IndirectListBase< T, Addr >::end(), HashTable< Foam::autoPtr< Foam::interfaceCompositionModel > >::erase(), and Foam::isFaceCut().

Here is the caller graph for this function:

◆ begin() [2/2]

Foam::UList< T >::const_iterator begin ( ) const
inlinenoexcept

Return const_iterator to begin traversing the constant UList.

Definition at line 336 of file UListI.H.

◆ end() [2/2]

Foam::UList< T >::const_iterator end ( ) const
inlinenoexcept

Return const_iterator to end traversing the constant UList.

Definition at line 357 of file UListI.H.

◆ rbegin() [1/2]

Foam::UList< T >::reverse_iterator rbegin ( )
inline

Return reverse_iterator to begin reverse traversing the UList.

Definition at line 371 of file UListI.H.

◆ rend() [1/2]

Foam::UList< T >::reverse_iterator rend ( )
inline

Return reverse_iterator to end reverse traversing the UList.

Definition at line 392 of file UListI.H.

◆ crbegin()

Foam::UList< T >::const_reverse_iterator crbegin ( ) const
inline

Return const_reverse_iterator to begin reverse traversing the UList.

Definition at line 385 of file UListI.H.

◆ crend()

Foam::UList< T >::const_reverse_iterator crend ( ) const
inline

Return const_reverse_iterator to end reverse traversing the UList.

Definition at line 406 of file UListI.H.

◆ rbegin() [2/2]

Foam::UList< T >::const_reverse_iterator rbegin ( ) const
inline

Return const_reverse_iterator to begin reverse traversing the UList.

Definition at line 378 of file UListI.H.

◆ rend() [2/2]

Foam::UList< T >::const_reverse_iterator rend ( ) const
inline

Return const_reverse_iterator to end reverse traversing the UList.

Definition at line 399 of file UListI.H.

◆ size() [2/2]

Foam::label size ( ) const
inlinenoexcept

The number of elements in the UList.

Definition at line 420 of file UListI.H.

◆ empty()

bool empty ( ) const
inlinenoexcept

True if the UList is empty (ie, size() is zero)

Definition at line 427 of file UListI.H.

Referenced by AABBTree< Type >::AABBTree(), faMeshBoundaryHalo::distributeSparse(), UPstream::listScatterValues(), Foam::printTable(), UnsortedMeshedSurface< Face >::remapFaces(), MeshedSurface< Foam::face >::remapFaces(), Foam::system(), and treeBoundBox::treeBoundBox().

Here is the caller graph for this function:

◆ max_size()

static constexpr label max_size ( )
inlinestaticconstexprnoexcept

The size of the largest possible UList.

Definition at line 458 of file UList.H.

◆ swap()

void swap ( UList< T > &  list)
inline

Swap content with another UList of the same type in constant time.

Definition at line 434 of file UListI.H.

Referenced by DynamicField< Foam::Vector >::readList(), and Foam::Swap().

Here is the caller graph for this function:

◆ operator==()

bool operator== ( const UList< T > &  a) const

Equality operation on ULists of the same type.

Returns true when the ULists are element-wise equal (using UList::value_type::operator==). Takes linear time

Definition at line 298 of file UList.C.

◆ operator!=()

bool operator!= ( const UList< T > &  a) const

The opposite of the equality operation. Takes linear time.

Definition at line 322 of file UList.C.

◆ operator<()

bool operator< ( const UList< T > &  list) const

Compare two ULists lexicographically. Takes linear time.

Definition at line 329 of file UList.C.

◆ operator>()

bool operator> ( const UList< T > &  a) const

Compare two ULists lexicographically. Takes linear time.

Definition at line 354 of file UList.C.

◆ operator<=()

bool operator<= ( const UList< T > &  a) const

Return true if !(a > b). Takes linear time.

Definition at line 361 of file UList.C.

◆ operator>=()

bool operator>= ( const UList< T > &  a) const

Return true if !(a < b). Takes linear time.

Definition at line 368 of file UList.C.

◆ readList() [1/3]

Foam::Istream & readList ( Istream is)

Read List contents from Istream.

The List must have the proper size before calling

Definition at line 157 of file UListIO.C.

Referenced by Foam::operator>>().

Here is the caller graph for this function:

◆ writeEntry() [2/4]

void writeEntry ( const word keyword,
Ostream os 
) const

Write the List as a dictionary entry with keyword.

Definition at line 66 of file UListIO.C.

◆ writeList() [1/3]

Foam::Ostream & writeList ( Ostream os,
const label  shortLen = 0 
) const

Write List, with line-breaks in ASCII when length exceeds shortLen.

Using '0' suppresses line-breaks entirely.

Definition at line 79 of file UListIO.C.

Referenced by Foam::operator<<(), decomposedBlockData::writeBlockEntry(), and ensightCells::writeDict().

Here is the caller graph for this function:

◆ test()

std::enable_if<std::is_same<bool, TypeT>::value, bool>::type test ( const label  i) const
inline

A bitSet::test() method for a list of bool.

Returns
The element value, or false for out-of-range access

Definition at line 518 of file UList.H.

◆ get()

std::enable_if<std::is_same<bool, TypeT>::value, bool>::type get ( const label  i) const
inline

A bitSet::get() method for a list of bool.

Returns
The element value, or false for out-of-range access

Definition at line 528 of file UList.H.

◆ unset()

std::enable_if<std::is_same<bool, TypeT>::value, bool>::type unset ( const label  i)
inline

A bitSet::unset() method for a list of bool.

Returns
True if value changed and was not out-of-range

Definition at line 538 of file UList.H.

◆ readList() [2/3]

Istream & readList ( Istream is)

Specialized list reading for character lists which always uses binary format.

◆ writeEntry() [3/4]

void writeEntry ( Ostream os) const
protected

Specialized writeEntry for character lists which always uses binary format.

◆ writeList() [2/3]

Ostream & writeList ( Ostream os,
const  label 
) const

Specialized writeList for character lists which always uses binary format.

◆ operator[]() [3/7]

const bool & operator[] ( const label  i) const
inline

Definition at line 285 of file UListI.H.

◆ operator[]() [4/7]

Foam::UPstream::commsStruct & operator[] ( const label  procID)

Definition at line 260 of file UPstream.C.

◆ operator[]() [5/7]

const Foam::UPstream::commsStruct & operator[] ( const label  procID) const

Definition at line 361 of file UPstream.C.

◆ operator[]() [6/7]

UPstream::commsStruct & operator[] ( const  label)

◆ operator[]() [7/7]

const UPstream::commsStruct & operator[] ( const  label) const

◆ writeEntry() [4/4]

void writeEntry ( Ostream os) const
protected

Definition at line 71 of file charUList.C.

◆ writeList() [3/3]

Ostream & writeList ( Ostream os,
const  label 
) const

Definition at line 98 of file charUList.C.

◆ readList() [3/3]

Istream & readList ( Istream is)

Definition at line 108 of file charUList.C.

Friends And Related Function Documentation

◆ List< T >

friend class List< T >
friend

Declare friendship with the List class.

Definition at line 172 of file UList.H.

◆ SubList< T >

friend class SubList< T >
friend

Declare friendship with the SubList class.

Definition at line 175 of file UList.H.

◆ operator>>

Istream& operator>> ( Istream os,
UList< T > &  list 
)
friend

Use the readList() method to read contents from Istream.

Definition at line 606 of file UList.H.

Member Data Documentation

◆ const_pointer

const typedef T* const_pointer

The pointer type for const access to value_type items.

Definition at line 142 of file UList.H.

◆ const_reference

const typedef T& const_reference

The type used for reading from constant value_type objects.

Definition at line 148 of file UList.H.

◆ const_iterator

const typedef T* const_iterator

Random access iterator for traversing a UList.

Definition at line 154 of file UList.H.


The documentation for this class was generated from the following files: