Loading...
Searching...
No Matches
IndirectListBase< T, Addr > Class Template Reference

Base for lists with indirect addressing, templated on the list contents type and the addressing type. Storage for both values and addressing is held outside of the class. More...

#include <IndirectListBase.H>

Inheritance diagram for IndirectListBase< T, Addr >:

Classes

class  iterator
 A non-const iterator for an indirect list. More...
class  const_iterator
 A const iterator for an indirect list. More...

Public Types

typedef T value_type
 Type of values the list contains.
typedef Tpointer
 The pointer type for non-const access to value_type items.
typedef const Tconst_pointer
 The pointer type for const access to value_type items.
typedef Treference
 The type used for storing into value_type objects.
typedef const Tconst_reference
 The type used for reading from constant value_type objects.
typedef label size_type
 The type to represent the size of a UList.
typedef label difference_type
 The difference between iterator objects.
typedef Addr addressing_type
 The addressing type (non-stl definition).

Public Member Functions

 IndirectListBase ()=delete
 No default construct.
 IndirectListBase (const UList< T > &values, const Addr &addr)
 Store references to the values list and the addressing array.
bool empty () const noexcept
 True if the list is empty (ie, size() is zero).
label size () const noexcept
 The number of elements in the list.
const UList< T > & values () const noexcept
 The list of values (without addressing).
UList< T > & values () noexcept
 The list of values (without addressing).
const Addr & addressing () const noexcept
 The addressing used for the list.
bool uniform () const
 True if all entries have identical values, and list is non-empty.
const Tfront () const
 The first element of the list.
Tfront ()
 The first element of the list.
const Tback () const
 The last element of the list.
Tback ()
 The last element of the list.
label fcIndex (const label i) const
 The forward circular index. The next index in the list which returns to the first at the end of the list.
label rcIndex (const label i) const
 The reverse circular index. The previous index in the list which returns to the last at the beginning of the list.
const TfcValue (const label i) const
 Return forward circular value (ie, next value in the list).
TfcValue (const label i)
 Return forward circular value (ie, next value in the list).
const TrcValue (const label i) const
 Return reverse circular value (ie, previous value in the list).
TrcValue (const label i)
 Return reverse circular value (ie, previous value in the list).
List< Tlist () const
 Return the addressed elements as a List.
bool contains (const T &val, label pos=0, label len=-1) const
 Is the value contained in the list?
label find (const T &val, label pos=0, label len=-1) const
 Find index of the first occurrence of the value.
label rfind (const T &val, label pos=-1) const
 Find index of the last occurrence of the value.
List< Toperator() () const
 Return the addressed elements as a List.
Toperator[] (const label i)
 Non-const access to an element in the list.
const Toperator[] (const label i) const
 Const access to an element in the list.
void operator= (const T &val)
 Assign all addressed elements to the given value.
void operator= (Foam::zero)
 Assignment of all entries to zero.
void operator= (const UList< T > &rhs)
 Deep copy values from a list of the addressed elements.
void operator= (const IndirectListBase< T, Addr > &rhs)
 Deep copy values from a list of the addressed elements.
template<class AnyAddr>
void operator= (const IndirectListBase< T, AnyAddr > &rhs)
 Deep copy values from a list of the addressed elements.
iterator begin ()
 Return an iterator at begin of list.
iterator end ()
 Return an iterator at end of list.
const_iterator cbegin () const
 Return a const_iterator at begin of list.
const_iterator cend () const
 Return a const_iterator at end of list.
const_iterator begin () const
 Return a const_iterator at begin of list.
const_iterator end () const
 Return a const_iterator at end of list.
OstreamwriteList (Ostream &os, const label shortLen=0) const
 Write List, with line-breaks in ASCII when length exceeds shortLen.
Tfirst ()
 Access first element of the list, position [0].
const Tfirst () const
 Access first element of the list.
Tlast ()
 Access last element of the list, position [size()-1].
const Tlast () const
 Access last element of the list, position [size()-1].
bool found (const T &val, label pos=0) const
 Same as contains().

Protected Member Functions

template<class ListType>
void copyList (const ListType &rhs)
 Deep copy values from the list.

Detailed Description

template<class T, class Addr>
class Foam::IndirectListBase< T, Addr >

Base for lists with indirect addressing, templated on the list contents type and the addressing type. Storage for both values and addressing is held outside of the class.

Source files

Definition at line 52 of file IndirectListBase.H.

Member Typedef Documentation

◆ value_type

template<class T, class Addr>
typedef T value_type

Type of values the list contains.

Definition at line 85 of file IndirectListBase.H.

◆ pointer

template<class T, class Addr>
typedef T* pointer

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

Definition at line 90 of file IndirectListBase.H.

◆ const_pointer

template<class T, class Addr>
typedef const T* const_pointer

The pointer type for const access to value_type items.

Definition at line 95 of file IndirectListBase.H.

◆ reference

template<class T, class Addr>
typedef T& reference

The type used for storing into value_type objects.

Definition at line 100 of file IndirectListBase.H.

◆ const_reference

template<class T, class Addr>
typedef const T& const_reference

The type used for reading from constant value_type objects.

Definition at line 105 of file IndirectListBase.H.

◆ size_type

template<class T, class Addr>
typedef label size_type

The type to represent the size of a UList.

Definition at line 110 of file IndirectListBase.H.

◆ difference_type

template<class T, class Addr>
typedef label difference_type

The difference between iterator objects.

Definition at line 115 of file IndirectListBase.H.

◆ addressing_type

template<class T, class Addr>
typedef Addr addressing_type

The addressing type (non-stl definition).

Definition at line 130 of file IndirectListBase.H.

Constructor & Destructor Documentation

◆ IndirectListBase() [1/2]

template<class T, class Addr>
IndirectListBase ( )
delete

No default construct.

References values().

Referenced by copyList(), operator=(), operator=(), UIndirectList< bool >::UIndirectList(), and writeList().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IndirectListBase() [2/2]

template<class T, class Addr>
IndirectListBase ( const UList< T > & values,
const Addr & addr )
inline

Store references to the values list and the addressing array.

Definition at line 57 of file IndirectListBaseI.H.

References Foam::T(), and values().

Here is the call graph for this function:

Member Function Documentation

◆ copyList()

template<class T, class Addr>
template<class ListType>
void copyList ( const ListType & rhs)
inlineprotected

Deep copy values from the list.

Definition at line 25 of file IndirectListBaseI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, IndirectListBase(), and Foam::rhs().

Referenced by operator=(), operator=(), and operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ empty()

template<class T, class Addr>
bool empty ( ) const
inlinenoexcept

True if the list is empty (ie, size() is zero).

Definition at line 153 of file IndirectListBase.H.

References Foam::noexcept.

Referenced by List< CloudFunctionObject< CloudType > * >::resize_copy().

Here is the caller graph for this function:

◆ size()

◆ values() [1/2]

◆ values() [2/2]

template<class T, class Addr>
UList< T > & values ( )
inlinenoexcept

The list of values (without addressing).

Definition at line 168 of file IndirectListBase.H.

References Foam::noexcept.

◆ addressing()

template<class T, class Addr>
const Addr & addressing ( ) const
inlinenoexcept

The addressing used for the list.

Definition at line 173 of file IndirectListBase.H.

References Foam::noexcept.

Referenced by cellDistFuncs::correctBoundaryCells(), and UIndirectList< bool >::UIndirectList().

Here is the caller graph for this function:

◆ uniform()

template<class T, class Addr>
bool uniform ( ) const
inline

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

Definition at line 71 of file IndirectListBaseI.H.

References size().

Here is the call graph for this function:

◆ front() [1/2]

template<class T, class Addr>
const T & front ( ) const
inline

The first element of the list.

Definition at line 121 of file IndirectListBaseI.H.

References Foam::T().

Referenced by first(), and first().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ front() [2/2]

template<class T, class Addr>
T & front ( )
inline

The first element of the list.

Definition at line 127 of file IndirectListBaseI.H.

References Foam::T().

Here is the call graph for this function:

◆ back() [1/2]

template<class T, class Addr>
const T & back ( ) const
inline

The last element of the list.

Definition at line 134 of file IndirectListBaseI.H.

References Foam::T().

Referenced by last(), and last().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ back() [2/2]

template<class T, class Addr>
T & back ( )
inline

The last element of the list.

Definition at line 140 of file IndirectListBaseI.H.

References Foam::T().

Here is the call graph for this function:

◆ fcIndex()

template<class T, class Addr>
Foam::label fcIndex ( const label i) const
inline

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

Definition at line 107 of file IndirectListBaseI.H.

Referenced by fcValue(), and fcValue().

Here is the caller graph for this function:

◆ rcIndex()

template<class T, class Addr>
Foam::label rcIndex ( const label i) const
inline

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

Definition at line 114 of file IndirectListBaseI.H.

Referenced by rcValue(), and rcValue().

Here is the caller graph for this function:

◆ fcValue() [1/2]

template<class T, class Addr>
const T & fcValue ( const label i) const
inline

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

Definition at line 147 of file IndirectListBaseI.H.

References fcIndex(), and Foam::T().

Here is the call graph for this function:

◆ fcValue() [2/2]

template<class T, class Addr>
T & fcValue ( const label i)
inline

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

Definition at line 154 of file IndirectListBaseI.H.

References fcIndex(), and Foam::T().

Here is the call graph for this function:

◆ rcValue() [1/2]

template<class T, class Addr>
const T & rcValue ( const label i) const
inline

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

Definition at line 161 of file IndirectListBaseI.H.

References rcIndex(), and Foam::T().

Here is the call graph for this function:

◆ rcValue() [2/2]

template<class T, class Addr>
T & rcValue ( const label i)
inline

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

Definition at line 168 of file IndirectListBaseI.H.

References rcIndex(), and Foam::T().

Here is the call graph for this function:

◆ list()

template<class T, class Addr>
Foam::List< T > list ( ) const
inline

◆ contains()

template<class T, class Addr>
bool contains ( const T & val,
label pos = 0,
label len = -1 ) const
inline

Is the value contained in the list?

Parameters
valThe value to search for
posThe first position to examine (default: 0, no-op if -ve)
lenThe length of the search region (-ve until the end)
Returns
true if found.

Definition at line 95 of file IndirectListBaseI.H.

References find(), Foam::pos(), and Foam::T().

Referenced by found().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find()

template<class T, class Addr>
Foam::label find ( const T & val,
label pos = 0,
label len = -1 ) const

Find index of the first occurrence of the value.

Parameters
valThe value to search for
posThe first position to examine (default: 0, no-op if -ve)
lenThe length of the search region (-ve until the end)
Returns
position in list or -1 if not found.

Definition at line 24 of file IndirectListBase.C.

References Foam::pos(), and Foam::T().

Referenced by contains(), and faMesh::whichFace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rfind()

template<class T, class Addr>
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
-1 if not found.

Definition at line 60 of file IndirectListBase.C.

References Foam::pos(), and Foam::T().

Here is the call graph for this function:

◆ operator()()

template<class T, class Addr>
List< T > operator() ( ) const
inline

Return the addressed elements as a List.

Definition at line 276 of file IndirectListBase.H.

References list().

Here is the call graph for this function:

◆ operator[]() [1/2]

template<class T, class Addr>
T & operator[] ( const label i)
inline

Non-const access to an element in the list.

Definition at line 193 of file IndirectListBaseI.H.

References Foam::T().

Here is the call graph for this function:

◆ operator[]() [2/2]

template<class T, class Addr>
const T & operator[] ( const label i) const
inline

Const access to an element in the list.

Definition at line 201 of file IndirectListBaseI.H.

◆ operator=() [1/5]

template<class T, class Addr>
void operator= ( const T & val)
inline

Assign all addressed elements to the given value.

Definition at line 208 of file IndirectListBaseI.H.

References Foam::T().

Here is the call graph for this function:

◆ operator=() [2/5]

template<class T, class Addr>
void operator= ( Foam::zero )
inline

Assignment of all entries to zero.

Definition at line 219 of file IndirectListBaseI.H.

References Foam::Zero.

◆ operator=() [3/5]

template<class T, class Addr>
void operator= ( const UList< T > & rhs)
inline

Deep copy values from a list of the addressed elements.

Fatal if list sizes are not identical

Definition at line 230 of file IndirectListBaseI.H.

References copyList(), and Foam::rhs().

Here is the call graph for this function:

◆ operator=() [4/5]

template<class T, class Addr>
void operator= ( const IndirectListBase< T, Addr > & rhs)
inline

Deep copy values from a list of the addressed elements.

Fatal if list sizes are not identical

Definition at line 240 of file IndirectListBaseI.H.

References copyList(), IndirectListBase(), and Foam::rhs().

Here is the call graph for this function:

◆ operator=() [5/5]

template<class T, class Addr>
template<class AnyAddr>
void operator= ( const IndirectListBase< T, AnyAddr > & rhs)
inline

Deep copy values from a list of the addressed elements.

Fatal if list sizes are not identical

Definition at line 251 of file IndirectListBaseI.H.

References copyList(), IndirectListBase(), and Foam::rhs().

Here is the call graph for this function:

◆ begin() [1/2]

template<class T, class Addr>
iterator begin ( )
inline

Return an iterator at begin of list.

Definition at line 426 of file IndirectListBase.H.

Referenced by bitSet::bitSet(), bitSet::bitSet(), HashSet< Key, Hash >::HashSet(), HashSet< Key, HashType >::insert(), bitSet::set(), bitSet::unset(), and HashSet< Key, HashType >::unset().

Here is the caller graph for this function:

◆ end() [1/2]

template<class T, class Addr>
iterator end ( )
inline

Return an iterator at end of list.

Definition at line 434 of file IndirectListBase.H.

Referenced by bitSet::bitSet(), bitSet::bitSet(), HashSet< Key, Hash >::HashSet(), HashSet< Key, HashType >::insert(), bitSet::set(), bitSet::unset(), and HashSet< Key, HashType >::unset().

Here is the caller graph for this function:

◆ cbegin()

template<class T, class Addr>
const_iterator cbegin ( ) const
inline

Return a const_iterator at begin of list.

Definition at line 445 of file IndirectListBase.H.

Referenced by begin().

Here is the caller graph for this function:

◆ cend()

template<class T, class Addr>
const_iterator cend ( ) const
inline

Return a const_iterator at end of list.

Definition at line 453 of file IndirectListBase.H.

Referenced by end().

Here is the caller graph for this function:

◆ begin() [2/2]

template<class T, class Addr>
const_iterator begin ( ) const
inline

Return a const_iterator at begin of list.

Definition at line 461 of file IndirectListBase.H.

References cbegin().

Here is the call graph for this function:

◆ end() [2/2]

template<class T, class Addr>
const_iterator end ( ) const
inline

Return a const_iterator at end of list.

Definition at line 466 of file IndirectListBase.H.

References cend().

Here is the call graph for this function:

◆ writeList()

template<class T, class Addr>
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 29 of file IndirectListBaseIO.C.

References token::BEGIN_BLOCK, token::BEGIN_LIST, IOstreamOption::BINARY, token::END_BLOCK, token::END_LIST, FUNCTION_NAME, IndirectListBase(), Foam::is_contiguous_v, list(), Foam::nl, os(), token::SPACE, and Foam::T().

Referenced by Foam::operator<<().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ first() [1/2]

template<class T, class Addr>
T & first ( )
inline

Access first element of the list, position [0].

FOAM_DEPRECATED_FOR(2022-10, "front()")

Definition at line 486 of file IndirectListBase.H.

References front(), and Foam::T().

Referenced by DarcyForchheimer::calcTransformModelData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ first() [2/2]

template<class T, class Addr>
const T & first ( ) const
inline

Access first element of the list.

FOAM_DEPRECATED_FOR(2022-10, "front()")

Definition at line 493 of file IndirectListBase.H.

References front(), and Foam::T().

Here is the call graph for this function:

◆ last() [1/2]

template<class T, class Addr>
T & last ( )
inline

Access last element of the list, position [size()-1].

FOAM_DEPRECATED_FOR(2022-10, "back()")

Definition at line 500 of file IndirectListBase.H.

References back(), and Foam::T().

Referenced by SprayCloud< CloudType >::penetration().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ last() [2/2]

template<class T, class Addr>
const T & last ( ) const
inline

Access last element of the list, position [size()-1].

FOAM_DEPRECATED_FOR(2022-10, "back()")

Definition at line 507 of file IndirectListBase.H.

References back(), and Foam::T().

Here is the call graph for this function:

◆ found()

template<class T, class Addr>
bool found ( const T & val,
label pos = 0 ) const
inline

Same as contains().

Definition at line 512 of file IndirectListBase.H.

References contains(), Foam::pos(), and Foam::T().

Referenced by processorColour::colour().

Here is the call graph for this function:
Here is the caller graph for this function:

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