FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

CompactListList< T > Class Template Reference

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

#include <OpenFOAM/CompactListList.H>


Detailed Description

template<class T>
class Foam::CompactListList< T >

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 whose elements are the accumulated sizes of the rows, i.e.

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

and for i = 0, offset[i-1] = 0.

Storage is allocated on free-store during construction.

Source files

Definition at line 70 of file CompactListList.H.

Collaboration diagram for CompactListList< T >:

List of all members.

Public Member Functions

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

Static Public Member Functions

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

Friends

Istream &  operator>> (Istream &, CompactListList< T > &)
 Read CompactListList from Istream, discarding contents.
Ostream &  operator (Ostream &, const CompactListList< T > &)

Constructor & Destructor Documentation

CompactListList (  ) [inline]

Null constructor.

Definition at line 30 of file CompactListListI.H.

CompactListList ( const List< List< T > > &   ll  )

Construct by converting given List<List<T> >

Definition at line 31 of file CompactListList.C.

References forAll, and k().

CompactListList ( const label   nRows,
const label   nData  
) [inline]

Construct given size of offset table (number of rows)

and number of data.

Definition at line 36 of file CompactListListI.H.

CompactListList ( const label   nRows,
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 48 of file CompactListListI.H.

CompactListList ( const UList< label > &   rowSizes  )

Construct given list of row-sizes.

Definition at line 59 of file CompactListList.C.

References forAll.

CompactListList ( const UList< label > &   rowSizes,
const T &   t  
)

Construct given list of row-sizes.

Definition at line 78 of file CompactListList.C.

References forAll.

CompactListList ( const Xfer< CompactListList< T > > &   lst  )

Construct by transferring the parameter contents.

Definition at line 98 of file CompactListList.C.

CompactListList ( CompactListList< T > &   lst,
bool   reUse  
)

Construct as copy or re-use as specified.

Definition at line 108 of file CompactListList.C.

CompactListList ( Istream &   is  )

Construct from Istream.

Definition at line 32 of file CompactListListIO.C.

References operator>>().


Member Function Documentation

const Foam::CompactListList< T > & null (  ) [inline, static]

Return a null CompactListList.

Definition at line 70 of file CompactListListI.H.

Foam::autoPtr< Foam::CompactListList< T > > clone (  ) const [inline]

Clone.

Definition at line 61 of file CompactListListI.H.

Foam::label size (  ) const [inline]

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

Definition at line 77 of file CompactListListI.H.

bool empty (  ) const [inline]

Return true if the number of rows is zero.

Definition at line 84 of file CompactListListI.H.

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

Return the offset table.

Definition at line 91 of file CompactListListI.H.

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

Return non-const access to the offset table.

Definition at line 98 of file CompactListListI.H.

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

Return the packed matrix of data.

Definition at line 105 of file CompactListListI.H.

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

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

Definition at line 112 of file CompactListListI.H.

void setSize ( const label   nRows  )

Reset size of CompactListList.

This form only allows contraction of the CompactListList.

Definition at line 121 of file CompactListList.C.

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

void setSize ( const label   nRows,
const label   nData  
)

Reset size of CompactListList.

Definition at line 145 of file CompactListList.C.

void setSize ( const label   nRows,
const label   nData,
const T &   t  
)

Reset sizes of CompactListList and value for new elements.

Definition at line 157 of file CompactListList.C.

void setSize ( const UList< label > &   rowSizes  )

Reset size of CompactListList.

Definition at line 169 of file CompactListList.C.

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

void resize ( const label   nRows  ) [inline]

Reset size of CompactListList.

This form only allows contraction of the CompactListList.

Definition at line 179 of file CompactListListI.H.

References setSize().

void resize ( const label   nRows,
const label   nData  
) [inline]

Reset size of CompactListList.

Definition at line 187 of file CompactListListI.H.

References setSize().

void resize ( const label   nRows,
const label   nData,
const T &   t  
) [inline]

Reset sizes of CompactListList and value for new elements.

Definition at line 198 of file CompactListListI.H.

References setSize().

void resize ( const UList< label > &   rowSizes  ) [inline]

Reset size of CompactListList.

Definition at line 209 of file CompactListListI.H.

References setSize().

void clear (  )

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

Definition at line 200 of file CompactListList.C.

Foam::labelList sizes (  ) const

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

Definition at line 185 of file CompactListList.C.

References forAll.

void transfer ( CompactListList< T > &   a  )

Transfer the contents of the argument CompactListList.

into this CompactListList and annull the argument list.

Definition at line 208 of file CompactListList.C.

References CompactListList< T >::transfer().

Referenced by CompactListList< T >::transfer().

Foam::Xfer< Foam::CompactListList< T > > xfer (  ) [inline]

Transfer the contents to the Xfer container.

Definition at line 172 of file CompactListListI.H.

References Foam::xferMove().

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

Return index into m.

Definition at line 120 of file CompactListListI.H.

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

Get row for index into m.

Definition at line 137 of file CompactListListI.H.

References Foam::abort(), Foam::FatalError, FatalErrorIn, and forAll.

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

Get column index (j) given above row.

Definition at line 162 of file CompactListListI.H.

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

Return subscript-checked row as UList.

Definition at line 219 of file CompactListListI.H.

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

Return const subscript-checked row as UList.

Definition at line 236 of file CompactListListI.H.

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

Return subscript-checked element.

Definition at line 253 of file CompactListListI.H.

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

Return const subscript-checked element.

Definition at line 264 of file CompactListListI.H.

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

Return as List<List<T> >

Definition at line 218 of file CompactListList.C.

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

void operator= ( const T &   t  ) [inline]

Assignment of all entries to the given value.

Definition at line 274 of file CompactListListI.H.


Friends And Related Function Documentation

Istream& operator>> ( Istream &   ,
CompactListList< T > &    
) [friend]

Read CompactListList from Istream, discarding contents.

of existing CompactListList.

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

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