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 (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 (const CompactListList< T, Container > &lst)
 Copy construct. More...
 
 CompactListList (CompactListList< T, Container > &&lst)
 Move construct. More...
 
 CompactListList (CompactListList< T, Container > &lst, 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 noexcept
 The primary size (the number of rows) More...
 
bool empty () const noexcept
 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 swap (CompactListList< T, Container > &lst)
 Swap contents. More...
 
void transfer (CompactListList< T, Container > &lst)
 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= (const T &val)
 Assignment of all entries to the given value. More...
 
void operator= (const CompactListList< T, Container > &lst)
 Copy assignment. More...
 
void operator= (CompactListList< T, Container > &&lst)
 Move assignment. 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 94 of file polyTopoChange.H.

Constructor & Destructor Documentation

◆ CompactListList() [1/10]

CompactListList ( )
inline

Null constructor.

Definition at line 35 of file CompactListListI.H.

◆ CompactListList() [2/10]

CompactListList ( const List< Container > &  ll)
explicit

Construct by converting given List<List<T>>

Definition at line 34 of file CompactListList.C.

References forAll, and k.

◆ CompactListList() [3/10]

CompactListList ( const label  mRows,
const label  nData 
)
inline

Construct given size of offset table (number of rows)

and number of data.

Definition at line 43 of file CompactListListI.H.

◆ CompactListList() [4/10]

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

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

the number of data and a value for all elements.

Definition at line 56 of file CompactListListI.H.

◆ CompactListList() [5/10]

CompactListList ( const labelUList rowSizes)
explicit

Construct given list of row-sizes.

Definition at line 64 of file CompactListList.C.

References forAll.

◆ CompactListList() [6/10]

CompactListList ( const labelUList rowSizes,
const T val 
)

Construct given list of row-sizes.

Definition at line 85 of file CompactListList.C.

References forAll, and Foam::val.

◆ CompactListList() [7/10]

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

Copy construct.

Definition at line 70 of file CompactListListI.H.

◆ CompactListList() [8/10]

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

Move construct.

Definition at line 82 of file CompactListListI.H.

◆ CompactListList() [9/10]

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

Construct as copy or re-use as specified.

Definition at line 92 of file CompactListListI.H.

◆ CompactListList() [10/10]

Construct from Istream.

Definition at line 34 of file CompactListListIO.C.

References Foam::operator>>().

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 115 of file CompactListListI.H.

◆ clone()

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

Clone.

Definition at line 105 of file CompactListListI.H.

References Foam::New().

Here is the call graph for this function:

◆ size()

Foam::label size ( ) const
inlinenoexcept

The primary size (the number of rows)

Definition at line 122 of file CompactListListI.H.

Referenced by decompositionMethod::calcCellCells().

Here is the caller graph for this function:

◆ empty()

bool empty ( ) const
inlinenoexcept

True if the number of rows is zero.

Definition at line 129 of file CompactListListI.H.

◆ offsets() [1/2]

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

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

Definition at line 137 of file CompactListListI.H.

Referenced by decompositionMethod::calcCellCells(), metisLikeDecomp::decompose(), decompositionInformation::decompositionInformation(), and globalIndex::get().

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 144 of file CompactListListI.H.

◆ m() [1/2]

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

Return the packed matrix of data.

Definition at line 151 of file CompactListListI.H.

Referenced by decompositionMethod::calcCellCells(), metisLikeDecomp::decompose(), and decompositionInformation::decompositionInformation().

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 159 of file CompactListListI.H.

◆ setSize() [1/4]

void setSize ( const label  mRows)

Reset size of CompactListList.

This form only allows contraction of the CompactListList.

Definition at line 108 of file CompactListList.C.

References Foam::abort(), clear(), Foam::FatalError, FatalErrorInFunction, and Foam::nl.

Referenced by decompositionMethod::calcCellCells().

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

◆ setSize() [2/4]

void setSize ( const label  mRows,
const label  nData 
)

Reset size of CompactListList.

Definition at line 133 of file CompactListList.C.

◆ 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 146 of file CompactListList.C.

◆ setSize() [4/4]

void setSize ( const labelUList rowSizes)

Reset size of CompactListList.

Definition at line 159 of file CompactListList.C.

References forAll, 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 203 of file CompactListListI.H.

References setSize().

Here is the call graph for this function:

◆ resize() [2/4]

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

Reset size of CompactListList.

Definition at line 211 of file CompactListListI.H.

References 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 222 of file CompactListListI.H.

References 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 234 of file CompactListListI.H.

References setSize().

Here is the call graph for this function:

◆ clear()

void clear ( )

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

Definition at line 193 of file CompactListList.C.

◆ sizes()

Foam::labelList sizes ( ) const

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

Definition at line 177 of file CompactListList.C.

References forAll.

◆ swap()

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

Swap contents.

Definition at line 203 of file CompactListList.C.

References Foam::Swap().

Here is the call graph for this function:

◆ transfer()

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

Transfer the contents of the argument CompactListList.

into this CompactListList and annul the argument list.

Definition at line 220 of file CompactListList.C.

◆ index()

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

Return index into m.

Definition at line 167 of file CompactListListI.H.

◆ whichRow()

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

Get row for index into m.

Definition at line 177 of file CompactListListI.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and Foam::findLower().

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 193 of file CompactListListI.H.

◆ operator[]() [1/2]

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

Return subscript-checked row as UList.

Definition at line 246 of file CompactListListI.H.

References Foam::start.

◆ operator[]() [2/2]

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

Return const subscript-checked row as UList.

Definition at line 258 of file CompactListListI.H.

References Foam::start, 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 273 of file CompactListListI.H.

◆ operator()() [2/3]

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

Return const subscript-checked element.

Definition at line 284 of file CompactListListI.H.

◆ operator()() [3/3]

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

Return as List<Container>

Definition at line 238 of file CompactListList.C.

References forAll.

◆ operator=() [1/3]

void operator= ( const T val)
inline

Assignment of all entries to the given value.

Definition at line 294 of file CompactListListI.H.

References Foam::val.

◆ operator=() [2/3]

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

Copy assignment.

Definition at line 302 of file CompactListListI.H.

◆ operator=() [3/3]

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

Move assignment.

Definition at line 319 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: