Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Private Attributes | Friends
UList Class 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:
Inheritance graph
[legend]

Data Structures

class  greater
 Greater function class that can be used for sorting. More...
 
class  less
 Less function class that can be used for sorting. More...
 

Public Types

typedef T value_type
 Type of values the UList contains. More...
 
typedef Treference
 Type that can be used for storing into. More...
 
typedef label difference_type
 The type that can represent the difference between any two. More...
 
typedef label size_type
 The type that can represent the size of a UList. More...
 
typedef Titerator
 Random access iterator for traversing UList. More...
 
typedef Treverse_iterator
 Reverse iterator for reverse traversal of UList. More...
 

Public Member Functions

 UList ()
 Null constructor. More...
 
 UList (T *__restrict__ v, label size)
 Construct from components. More...
 
label fcIndex (const label i) const
 Return the forward circular index, i.e. the next index. More...
 
label rcIndex (const label i) const
 Return the reverse circular index, i.e. the previous index. More...
 
std::streamsize byteSize () const
 Return the binary size in number of characters of the UList. More...
 
const Tcdata () const
 Return a const pointer to the first data element,. More...
 
Tdata ()
 Return a pointer to the first data element,. 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...
 
void checkStart (const label start) const
 Check start is within valid range (0 ... size-1). More...
 
void checkSize (const label size) const
 Check size is within valid range (0 ... size). More...
 
void checkIndex (const label i) const
 Check index i is within valid range (0 ... size-1). More...
 
void writeEntry (Ostream &) const
 Write the UList as a dictionary entry. More...
 
void writeEntry (const word &keyword, Ostream &) const
 Write the UList as a dictionary entry with keyword. More...
 
void assign (const UList< T > &)
 Assign elements to those from UList. More...
 
Toperator[] (const label)
 Return element of UList. More...
 
const Toperator[] (const label) 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 &)
 Assignment of all entries to the given value. More...
 
iterator begin ()
 Return an iterator to begin traversing the UList. More...
 
iterator end ()
 Return an iterator to end traversing the UList. More...
 
const_iterator cbegin () const
 Return const_iterator to begin traversing the constant UList. More...
 
const_iterator cend () const
 Return const_iterator to end traversing the constant UList. More...
 
const_iterator begin () const
 Return const_iterator to begin traversing the constant UList. More...
 
const_iterator end () const
 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
 Return the number of elements in the UList. More...
 
label max_size () const
 Return size of the largest possible UList. More...
 
bool empty () const
 Return true if the UList is empty (ie, size() is zero). More...
 
void swap (UList< T > &)
 Swap two ULists of the same type in constant time. More...
 
bool operator== (const UList< T > &) const
 Equality operation on ULists of the same type. More...
 
bool operator!= (const UList< T > &) const
 The opposite of the equality operation. Takes linear time. More...
 
bool operator< (const UList< T > &) const
 Compare two ULists lexicographically. Takes linear time. More...
 
bool operator> (const UList< T > &) const
 Compare two ULists lexicographically. Takes linear time. More...
 
bool operator<= (const UList< T > &) const
 Return true if !(a > b). Takes linear time. More...
 
bool operator>= (const UList< T > &) const
 Return true if !(a < b). Takes linear time. More...
 
const bool & operator[] (const label i) const
 

Static Public Member Functions

static const UList< T > & null ()
 Return a null UList. More...
 

Data Fields

const typedef Tconst_reference
 Type that can be used for storing into. More...
 
const typedef Tconst_iterator
 Random access iterator for traversing UList. More...
 
const typedef Tconst_reverse_iterator
 Reverse iterator for reverse traversal of constant UList. More...
 

Private Attributes

label size_
 Number of elements in UList. More...
 
T *__restrict__ v_
 Vector of values of type T. More...
 

Friends

class List< T >
 Declare friendship with the List class. More...
 
class SubList< T >
 Declare friendship with the SubList class. More...
 
Ostreamoperator (Ostream &, const UList< T > &)
 
Istreamoperator>> (Istream &, UList< T > &)
 Read UList contents from Istream. Requires size to have been set. More...
 

Detailed Description

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 60 of file HashTable.H.

Member Typedef Documentation

◆ value_type

typedef T value_type

Type of values the UList contains.

Definition at line 229 of file UList.H.

◆ reference

typedef T& reference

Type that can be used for storing into.

UList::value_type objects.

Definition at line 233 of file UList.H.

◆ difference_type

The type that can represent the difference between any two.

UList iterator objects.

Definition at line 241 of file UList.H.

◆ size_type

typedef label size_type

The type that can represent the size of a UList.

Definition at line 244 of file UList.H.

◆ iterator

typedef T* iterator

Random access iterator for traversing UList.

Definition at line 250 of file UList.H.

◆ reverse_iterator

typedef T* reverse_iterator

Reverse iterator for reverse traversal of UList.

Definition at line 280 of file UList.H.

Constructor & Destructor Documentation

◆ UList() [1/2]

UList ( )
inline

Null constructor.

Definition at line 33 of file UListI.H.

◆ UList() [2/2]

UList ( T *__restrict__  v,
label  size 
)
inline

Construct from components.

Definition at line 41 of file UListI.H.

Member Function Documentation

◆ null()

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

◆ fcIndex()

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

Return the forward circular index, i.e. the next index.

which returns to the first at the end of the list

Definition at line 58 of file UListI.H.

◆ rcIndex()

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

Return the reverse circular index, i.e. the previous index.

which returns to the last at the beginning of the list

Definition at line 65 of file UListI.H.

◆ byteSize()

std::streamsize byteSize ( ) const

Return the binary size in number of characters of the UList.

if the element is a primitive type i.e. contiguous<T>() == true. Note that is of type streamsize since used in stream ops

Definition at line 92 of file UList.C.

◆ cdata()

const T * cdata ( ) const
inline

Return a const pointer to the first data element,.

similar to the STL front() method and the string::data() method This can be used (with caution) when interfacing with C code.

Definition at line 145 of file UListI.H.

◆ data()

T * data ( )
inline

Return a pointer to the first data element,.

similar to the STL front() method and the string::data() method This can be used (with caution) when interfacing with C code.

Definition at line 152 of file UListI.H.

◆ first() [1/2]

T & first ( )
inline

Return the first element of the list.

Definition at line 117 of file UListI.H.

Referenced by boundaryLayers::findPatchesToBeTreatedTogether().

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 124 of file UListI.H.

◆ last() [1/2]

T & last ( )
inline

Return the last element of the list.

Definition at line 131 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 138 of file UListI.H.

◆ checkStart()

void checkStart ( const label  start) const
inline

Check start is within valid range (0 ... size-1).

Definition at line 73 of file UListI.H.

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

Here is the caller graph for this function:

◆ checkSize()

void checkSize ( const label  size) const
inline

Check size is within valid range (0 ... size).

Definition at line 86 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 i is within valid range (0 ... size-1).

Definition at line 99 of file UListI.H.

◆ writeEntry() [1/2]

void writeEntry ( Ostream ) const

Write the UList as a dictionary entry.

◆ writeEntry() [2/2]

void writeEntry ( const word keyword,
Ostream  
) const

Write the UList as a dictionary entry with keyword.

◆ assign()

void assign ( const UList< T > &  a)

◆ operator[]() [1/3]

T& operator[] ( const  label)
inline

Return element of UList.

◆ operator[]() [2/3]

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

Return element of constant UList.

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

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

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

Allow cast to a const List<T>&.

Definition at line 206 of file UListI.H.

◆ operator=()

void operator= ( const T t)

◆ begin() [1/2]

Foam::UList< T >::iterator begin ( )
inline

◆ end() [1/2]

Foam::UList< T >::iterator end ( )
inline

Return an iterator to end traversing the UList.

Definition at line 237 of file UListI.H.

Referenced by UList< Foam::wordRe >::operator<(), Foam::shuffle(), Foam::sort(), and Foam::stableSort().

Here is the caller graph for this function:

◆ cbegin()

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

Return const_iterator to begin traversing the constant UList.

Definition at line 230 of file UListI.H.

◆ cend()

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

Return const_iterator to end traversing the constant UList.

Definition at line 251 of file UListI.H.

◆ begin() [2/2]

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

Return const_iterator to begin traversing the constant UList.

Definition at line 223 of file UListI.H.

◆ end() [2/2]

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

Return const_iterator to end traversing the constant UList.

Definition at line 244 of file UListI.H.

◆ rbegin() [1/2]

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

Return reverse_iterator to begin reverse traversing the UList.

Definition at line 258 of file UListI.H.

◆ rend() [1/2]

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

Return reverse_iterator to end reverse traversing the UList.

Definition at line 279 of file UListI.H.

◆ crbegin()

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

Return const_reverse_iterator to begin reverse traversing the UList.

Definition at line 272 of file UListI.H.

◆ crend()

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

Return const_reverse_iterator to end reverse traversing the UList.

Definition at line 293 of file UListI.H.

◆ rbegin() [2/2]

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

Return const_reverse_iterator to begin reverse traversing the UList.

Definition at line 265 of file UListI.H.

◆ rend() [2/2]

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

Return const_reverse_iterator to end reverse traversing the UList.

Definition at line 286 of file UListI.H.

◆ size()

Foam::label size ( ) const
inline

Return the number of elements in the UList.

Definition at line 299 of file UListI.H.

Referenced by isoSurface::adaptPatchFields(), fvMatrix< Type >::addToInternalField(), pairGAMGAgglomeration::agglomerate(), GAMGAgglomeration::agglomerateLduAddressing(), ptscotchDecomp::append(), Field< Foam::Vector2D >::autoMap(), fvPatchField< Type >::autoMap(), cuttingPlane::calcCutCells(), oldCyclicPolyPatch::calcFaceCentres(), coupledPolyPatch::calcFaceTol(), meshSurfaceEngine::calcGlobalBoundaryFaceLabels(), lduAddressing::calcLosort(), blockMesh::calcMergeInfoFast(), meshSurfaceEngine::calculateBoundaryFacePatches(), meshSurfaceEngine::calculateBoundaryOwners(), meshSurfaceEngine::calculateFaceCentres(), meshSurfaceEngine::calculateFaceEdgesAddressing(), meshSurfaceEngine::calculateFaceFacesAddressing(), meshSurfaceEngine::calculateFaceNormals(), boundaryLayerOptimisation::calculateHairEdges(), GAMGAgglomeration::checkRestriction(), lduPrimitiveMesh::checkUpperTriangular(), ensightPartCells::classify(), GAMGAgglomeration::compactLevels(), immersedBoundaryFvPatchField< Type >::correctOffDiag(), partTriMesh::createPointsAndTrias(), createFundamentalSheetsJFS::createSheetsAtFeatureEdges(), MGridGenGAMGAgglomeration::detectSharedFaces(), directFvPatchFieldMapper::directFvPatchFieldMapper(), directPointPatchFieldMapper::directPointPatchFieldMapper(), meshSurfaceEdgeExtractorFUN::distributeBoundaryFaces(), edgeExtractor::distributeBoundaryFaces(), distributedUnallocatedDirectFieldMapper::distributedUnallocatedDirectFieldMapper(), distributedUnallocatedDirectFvPatchFieldMapper::distributedUnallocatedDirectFvPatchFieldMapper(), Foam::duplicateOrder(), DynList< Foam::triFace >::DynList(), regionSizeDistribution::extractData(), FaceCellWave< Type, int >::FaceCellWave(), lduMatrix::faceH(), edgeExtractor::findPatchesNearSurfaceFace(), mapDistributeBase::flipAndCombine(), meshRefinement::gAverage(), oldCyclicPolyPatch::getAnchorPoints(), coupledPolyPatch::getAnchorPoints(), Foam::Im(), Foam::ImComplexField(), regionModel::initialise(), fvMeshDistribute::inplaceRenumberWithFlip(), Foam::inplaceSubset(), cyclicACMIGAMGInterface::internalFieldTransfer(), cyclicAMIGAMGInterface::internalFieldTransfer(), regionCoupledFvPatch::internalFieldTransfer(), regionCoupledWallFvPatch::internalFieldTransfer(), surfaceInterpolationScheme< scalar >::interpolate(), AMIInterpolation< SourcePatch, TargetPatch >::interpolateToSource(), AMIInterpolation< SourcePatch, TargetPatch >::interpolateToTarget(), lduPrimitiveMesh::lduPrimitiveMesh(), MGridGenGAMGAgglomeration::makeCompactCellFaceAddressingAndFaceWeights(), immersedBoundaryFvPatch::makeIbCells(), Field< Foam::Vector2D >::map(), Foam::matchPoints(), mergeSurfacePatches(), MeshedSurface< Foam::face >::MeshedSurface(), edgeExtractor::moveVerticesTowardsDiscontinuities(), LduMatrix< Type, DType, LUType >::negSumDiag(), lduMatrix::negSumDiag(), BiIndirectList< T >::operator=(), PackedBoolList::operator=(), partTriMesh::partTriMesh(), directFieldMapper::patchFieldSubset(), Polynomial< 8 >::Polynomial(), meshSurfaceMapper::preMapVertices(), ptscotchDecomp::prepend(), printInfo(), GAMGSolver::procAgglomerateMatrix(), Foam::Re(), Foam::ReComplexField(), Foam::ReImSum(), ensightPart::renumber(), UPtrList< Foam::Field< Type > >::reorder(), PtrList< injectionModel >::reorder(), Foam::reverse(), separateList(), CompactListList::setSize(), UnsortedMeshedSurface< Face >::setZones(), directFieldMapper::size(), directFvPatchFieldMapper::size(), directPointPatchFieldMapper::size(), distributedUnallocatedDirectFieldMapper::size(), distributedUnallocatedDirectFvPatchFieldMapper::size(), PCGgpu::solve(), PBiCGgpu::solve(), Foam::sortedOrder(), Foam::subset(), 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(), meshRefinement::testSyncBoundaryFaceList(), Foam::transformList(), UnsortedMeshedSurface< Face >::UnsortedMeshedSurface(), meshSurfaceEngineModifier::updateGeometry(), edgeExtractor::updateMeshPatches(), lduPrimitiveMesh::upperTriOrder(), ensightPartCells::writeConnectivity(), ensightPartFaces::writeConnectivity(), VTKedgeFormat::writeEdges(), writeEdgesToVTK(), writeFacetsToVTK(), ensightPart::writeField(), WRLsurfaceFormatCore::writeHeader(), OFSsurfaceFormatCore::writeHeader(), AC3DsurfaceFormatCore::writeHeader(), VTKsurfaceFormat< Face >::writeHeaderPolygons(), coupledPolyPatch::writeOBJ(), Foam::meshTools::writeOBJ(), writePointsToVTK(), ensightPart::writeScalarField(), VTKsurfaceFormatCore::writeTail(), and ensightPart::writeVectorField().

◆ max_size()

Foam::label max_size ( ) const
inline

Return size of the largest possible UList.

Definition at line 306 of file UListI.H.

◆ empty()

bool empty ( ) const
inline

Return true if the UList is empty (ie, size() is zero).

Definition at line 313 of file UListI.H.

Referenced by boundBox::boundBox(), boundBox::contains(), boundBox::containsAny(), and treeBoundBox::treeBoundBox().

Here is the caller graph for this function:

◆ swap()

void swap ( UList< T > &  a)

Swap two ULists of the same type in constant time.

Definition at line 82 of file UList.C.

◆ operator==()

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

Equality operation on ULists of the same type.

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

Definition at line 144 of file UList.C.

◆ operator!=()

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

The opposite of the equality operation. Takes linear time.

Definition at line 165 of file UList.C.

◆ operator<()

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

Compare two ULists lexicographically. Takes linear time.

Definition at line 172 of file UList.C.

◆ operator>()

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

Compare two ULists lexicographically. Takes linear time.

Definition at line 203 of file UList.C.

◆ operator<=()

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

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

Definition at line 210 of file UList.C.

◆ operator>=()

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

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

Definition at line 217 of file UList.C.

◆ operator[]() [3/3]

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

Definition at line 177 of file UListI.H.

Friends And Related Function Documentation

◆ List< T >

friend class List< T >
friend

Declare friendship with the List class.

Definition at line 86 of file UList.H.

◆ SubList< T >

friend class SubList< T >
friend

Declare friendship with the SubList class.

Definition at line 89 of file UList.H.

◆ operator

Ostream& operator ( Ostream ,
const UList< T > &   
)
friend

◆ operator>>

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

Read UList contents from Istream. Requires size to have been set.

before.

Field Documentation

◆ const_reference

const typedef T& const_reference

Type that can be used for storing into.

constant UList::value_type objects

Definition at line 237 of file UList.H.

◆ const_iterator

const typedef T* const_iterator

Random access iterator for traversing UList.

Definition at line 262 of file UList.H.

◆ const_reverse_iterator

const typedef T* const_reverse_iterator

Reverse iterator for reverse traversal of constant UList.

Definition at line 292 of file UList.H.

◆ size_

label size_
private

◆ v_

T* __restrict__ v_
private

Vector of values of type T.

Definition at line 78 of file UList.H.

Referenced by UList< Foam::wordRe >::assign(), and UList< Foam::wordRe >::swap().


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