All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CompactListList< T, Container > Class Template Reference

A packed storage unstructured matrix of objects of type <T> using an offset table for access. More...

Public Member Functions

 CompactListList ()
 Null constructor. More...
 
 CompactListList (CompactListList< T, Container > &&)
 Move constructor. More...
 
 CompactListList (const List< Container > &)
 Construct by converting given List<List<T>> More...
 
 CompactListList (const label mRows, const label nData)
 Construct given size of offset table (number of rows) More...
 
 CompactListList (const label mRows, const label nData, const T &)
 Construct given size of offset table (number of rows),. More...
 
 CompactListList (const labelUList &rowSizes)
 Construct given list of row-sizes. More...
 
 CompactListList (const labelUList &rowSizes, const T &)
 Construct given list of row-sizes. More...
 
 CompactListList (CompactListList< T, Container > &, bool reuse)
 Construct as copy or re-use as specified. More...
 
 CompactListList (Istream &)
 Construct from Istream. More...
 
autoPtr< CompactListList< T, Container > > clone () const
 Clone. More...
 
label size () const
 Return the primary size, i.e. the number of rows. More...
 
bool empty () const
 Return true if the number of rows is zero. More...
 
const List< label > & offsets () const
 Return the offset table (= size()+1) More...
 
List< label > & offsets ()
 Return non-const access to the offset table. More...
 
const List< T > & m () const
 Return the packed matrix of data. More...
 
List< T > & m ()
 Return non-const access to the packed matrix of data. More...
 
void setSize (const label mRows)
 Reset size of CompactListList. More...
 
void setSize (const label mRows, const label nData)
 Reset size of CompactListList. More...
 
void setSize (const label mRows, const label nData, const T &)
 Reset sizes of CompactListList and value for new elements. More...
 
void setSize (const labelUList &rowSizes)
 Reset size of CompactListList. More...
 
void resize (const label mRows)
 Reset size of CompactListList. More...
 
void resize (const label mRows, const label nData)
 Reset size of CompactListList. More...
 
void resize (const label mRows, const label nData, const T &)
 Reset sizes of CompactListList and value for new elements. More...
 
void resize (const labelUList &rowSizes)
 Reset size of CompactListList. More...
 
void clear ()
 Clear the CompactListList, i.e. set sizes to zero. More...
 
labelList sizes () const
 Return sizes (to be used e.g. for construction) More...
 
void transfer (CompactListList< T, Container > &)
 Transfer the contents of the argument CompactListList. More...
 
label index (const label row, const label col) const
 Return index into m. More...
 
label whichRow (const label index) const
 Get row for index into m. More...
 
label whichColumn (const label row, const label index) const
 Get column index (j) given above row. More...
 
UList< Toperator[] (const label i)
 Return subscript-checked row as UList. More...
 
const UList< Toperator[] (const label i) const
 Return const subscript-checked row as UList. More...
 
Toperator() (const label i, const label j)
 Return subscript-checked element. More...
 
const Toperator() (const label i, const label j) const
 Return const subscript-checked element. More...
 
List< Container > operator() () const
 Return as List<Container> More...
 
void operator= (CompactListList< T, Container > &&)
 Move assignment operator. More...
 
void operator= (const T &)
 Assignment of all entries to the given value. More...
 

Static Public Member Functions

static const CompactListList< T, Container > & null ()
 Return a null CompactListList. More...
 

Friends

Istreamoperator>> (Istream &, CompactListList< T, Container > &)
 Read CompactListList from Istream, discarding contents. More...
 
Ostreamoperator (Ostream &, const CompactListList< T, Container > &)
 

Detailed Description

template<class T, class Container = List<T>>
class Foam::CompactListList< T, Container >

A packed storage unstructured matrix of objects of type <T> using an offset table for access.

The offset table is the size of the number of rows+1 whose elements are the accumulated sizes of the rows, i.e.

  • offset[i] gives the index of first element of row i
  • offset[i+1] - offset[i] is the number of elements in row i

Storage is allocated on free-store during construction.

As a special case a null-constructed CompactListList has an empty offsets_ (instead of size 1).

Source files

Definition at line 91 of file polyTopoChange.H.

Constructor & Destructor Documentation

◆ CompactListList() [1/9]

CompactListList ( )
inline

Null constructor.

Definition at line 32 of file CompactListListI.H.

Referenced by CompactListList< T, Container >::CompactListList().

Here is the caller graph for this function:

◆ CompactListList() [2/9]

CompactListList ( CompactListList< T, Container > &&  lst)

Move constructor.

Definition at line 104 of file CompactListList.C.

References CompactListList< T, Container >::CompactListList(), and CompactListList< T, Container >::transfer().

Here is the call graph for this function:

◆ CompactListList() [3/9]

CompactListList ( const List< Container > &  ll)
explicit

Construct by converting given List<List<T>>

Definition at line 31 of file CompactListList.C.

References CompactListList< T, Container >::CompactListList(), forAll, k, and List< T >::size().

Here is the call graph for this function:

◆ CompactListList() [4/9]

CompactListList ( const label  mRows,
const label  nData 
)
inline

Construct given size of offset table (number of rows)

and number of data.

Definition at line 40 of file CompactListListI.H.

References CompactListList< T, Container >::CompactListList().

Here is the call graph for this function:

◆ CompactListList() [5/9]

CompactListList ( const label  mRows,
const label  nData,
const T t 
)
inline

Construct given size of offset table (number of rows),.

the number of data and a value for all elements.

Definition at line 53 of file CompactListListI.H.

◆ CompactListList() [6/9]

CompactListList ( const labelUList rowSizes)
explicit

Construct given list of row-sizes.

Definition at line 61 of file CompactListList.C.

References CompactListList< T, Container >::CompactListList(), and forAll.

Here is the call graph for this function:

◆ CompactListList() [7/9]

CompactListList ( const labelUList rowSizes,
const T t 
)

Construct given list of row-sizes.

Definition at line 82 of file CompactListList.C.

References CompactListList< T, Container >::CompactListList(), and forAll.

Here is the call graph for this function:

◆ CompactListList() [8/9]

CompactListList ( CompactListList< T, Container > &  lst,
bool  reuse 
)

Construct as copy or re-use as specified.

Definition at line 114 of file CompactListList.C.

◆ CompactListList() [9/9]

Construct from Istream.

Definition at line 32 of file CompactListListIO.C.

References Foam::operator>>(), and List< T >::size().

Here is the call graph for this function:

Member Function Documentation

◆ null()

const Foam::CompactListList< T, Container > & null ( )
inlinestatic

Return a null CompactListList.

Definition at line 80 of file CompactListListI.H.

◆ clone()

Foam::autoPtr< Foam::CompactListList< T, Container > > clone ( ) const
inline

Clone.

Definition at line 67 of file CompactListListI.H.

◆ size()

Foam::label size ( ) const
inline

Return the primary size, i.e. the number of rows.

Definition at line 87 of file CompactListListI.H.

Referenced by decompositionMethod::calcCellCells(), CompactListList< T, Container >::operator()(), CompactListList< T, Container >::setSize(), and CompactListList< T, Container >::sizes().

Here is the caller graph for this function:

◆ empty()

bool empty ( ) const
inline

Return true if the number of rows is zero.

Definition at line 94 of file CompactListListI.H.

◆ offsets() [1/2]

const Foam::List< Foam::label > & offsets ( ) const
inline

Return the offset table (= size()+1)

Definition at line 102 of file CompactListListI.H.

Referenced by decompositionMethod::calcCellCells().

Here is the caller graph for this function:

◆ offsets() [2/2]

Foam::List< Foam::label > & offsets ( )
inline

Return non-const access to the offset table.

Definition at line 109 of file CompactListListI.H.

◆ m() [1/2]

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

Return the packed matrix of data.

Definition at line 116 of file CompactListListI.H.

Referenced by decompositionMethod::calcCellCells().

Here is the caller graph for this function:

◆ m() [2/2]

Foam::List< T > & m ( )
inline

Return non-const access to the packed matrix of data.

Definition at line 124 of file CompactListListI.H.

References CompactListList< T, Container >::index().

Here is the call graph for this function:

◆ setSize() [1/4]

void setSize ( const label  mRows)

◆ setSize() [2/4]

void setSize ( const label  mRows,
const label  nData 
)

Reset size of CompactListList.

Definition at line 153 of file CompactListList.C.

References CompactListList< T, Container >::setSize(), and List< T >::setSize().

Here is the call graph for this function:

◆ setSize() [3/4]

void setSize ( const label  mRows,
const label  nData,
const T t 
)

Reset sizes of CompactListList and value for new elements.

Definition at line 166 of file CompactListList.C.

References List< T >::setSize().

Here is the call graph for this function:

◆ setSize() [4/4]

void setSize ( const labelUList rowSizes)

Reset size of CompactListList.

Definition at line 179 of file CompactListList.C.

References forAll, List< T >::setSize(), and UList< T >::size().

Here is the call graph for this function:

◆ resize() [1/4]

void resize ( const label  mRows)
inline

Reset size of CompactListList.

This form only allows contraction of the CompactListList.

Definition at line 168 of file CompactListListI.H.

References CompactListList< T, Container >::setSize().

Referenced by CompactListList< T, Container >::resize().

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

◆ resize() [2/4]

void resize ( const label  mRows,
const label  nData 
)
inline

Reset size of CompactListList.

Definition at line 176 of file CompactListListI.H.

References CompactListList< T, Container >::resize(), and CompactListList< T, Container >::setSize().

Here is the call graph for this function:

◆ resize() [3/4]

void resize ( const label  mRows,
const label  nData,
const T t 
)
inline

Reset sizes of CompactListList and value for new elements.

Definition at line 187 of file CompactListListI.H.

References CompactListList< T, Container >::resize(), and CompactListList< T, Container >::setSize().

Here is the call graph for this function:

◆ resize() [4/4]

void resize ( const labelUList rowSizes)
inline

Reset size of CompactListList.

Definition at line 199 of file CompactListListI.H.

References CompactListList< T, Container >::setSize().

Here is the call graph for this function:

◆ clear()

void clear ( )

Clear the CompactListList, i.e. set sizes to zero.

Definition at line 213 of file CompactListList.C.

References List< T >::clear(), and CompactListList< T, Container >::transfer().

Referenced by CompactListList< T, Container >::setSize().

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

◆ sizes()

Foam::labelList sizes ( ) const

Return sizes (to be used e.g. for construction)

Definition at line 197 of file CompactListList.C.

References forAll, List< T >::size(), and CompactListList< T, Container >::size().

Here is the call graph for this function:

◆ transfer()

void transfer ( CompactListList< T, Container > &  a)

Transfer the contents of the argument CompactListList.

into this CompactListList and annul the argument list.

Definition at line 223 of file CompactListList.C.

References List< T >::transfer().

Referenced by CompactListList< T, Container >::clear(), CompactListList< T, Container >::CompactListList(), and CompactListList< T, Container >::operator=().

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

◆ index()

Foam::label index ( const label  row,
const label  col 
) const
inline

Return index into m.

Definition at line 132 of file CompactListListI.H.

Referenced by CompactListList< T, Container >::m(), CompactListList< T, Container >::operator()(), and CompactListList< T, Container >::whichColumn().

Here is the caller graph for this function:

◆ whichRow()

Foam::label whichRow ( const label  index) const
inline

Get row for index into m.

Definition at line 142 of file CompactListListI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, Foam::findLower(), and CompactListList< T, Container >::whichColumn().

Here is the call graph for this function:

◆ whichColumn()

Foam::label whichColumn ( const label  row,
const label  index 
) const
inline

Get column index (j) given above row.

Definition at line 158 of file CompactListListI.H.

References CompactListList< T, Container >::index().

Referenced by CompactListList< T, Container >::whichRow().

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

◆ operator[]() [1/2]

Foam::UList< T > operator[] ( const label  i)
inline

Return subscript-checked row as UList.

Definition at line 211 of file CompactListListI.H.

◆ operator[]() [2/2]

const Foam::UList< T > operator[] ( const label  i) const
inline

Return const subscript-checked row as UList.

Definition at line 223 of file CompactListListI.H.

References CompactListList< T, Container >::operator, and Foam::T().

Here is the call graph for this function:

◆ operator()() [1/3]

T & operator() ( const label  i,
const label  j 
)
inline

Return subscript-checked element.

Definition at line 238 of file CompactListListI.H.

References CompactListList< T, Container >::index(), CompactListList< T, Container >::operator, and Foam::T().

Here is the call graph for this function:

◆ operator()() [2/3]

const T & operator() ( const label  i,
const label  j 
) const
inline

Return const subscript-checked element.

Definition at line 249 of file CompactListListI.H.

References CompactListList< T, Container >::index().

Here is the call graph for this function:

◆ operator()() [3/3]

Foam::List< Container > operator() ( ) const

Return as List<Container>

Definition at line 238 of file CompactListList.C.

References forAll, and CompactListList< T, Container >::size().

Here is the call graph for this function:

◆ operator=() [1/2]

void operator= ( CompactListList< T, Container > &&  cll)
inline

Move assignment operator.

Definition at line 260 of file CompactListListI.H.

References CompactListList< T, Container >::transfer().

Here is the call graph for this function:

◆ operator=() [2/2]

void operator= ( const T t)
inline

Assignment of all entries to the given value.

Definition at line 269 of file CompactListListI.H.

Friends And Related Function Documentation

◆ operator>>

Istream& operator>> ( Istream ,
CompactListList< T, Container > &   
)
friend

Read CompactListList from Istream, discarding contents.

of existing CompactListList.

◆ operator

Ostream& operator ( Ostream ,
const CompactListList< T, Container > &   
)
friend

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