Opm::SparseTable< T > Class Template Reference

#include <TofDiscGalReorder.hpp>

Inheritance diagram for Opm::SparseTable< T >:
Inheritance graph

Public Types

typedef boost::iterator_range
< const T * > 
row_type
 Defining the row type, returned by operator[]. More...
 
typedef boost::iterator_range
< T * > 
mutable_row_type
 

Public Member Functions

 SparseTable ()
 Default constructor. Yields an empty SparseTable. More...
 
template<typename DataIter , typename IntegerIter >
 SparseTable (DataIter data_beg, DataIter data_end, IntegerIter rowsize_beg, IntegerIter rowsize_end)
 
template<typename DataIter , typename IntegerIter >
void assign (DataIter data_beg, DataIter data_end, IntegerIter rowsize_beg, IntegerIter rowsize_end)
 
template<typename IntegerIter >
void allocate (IntegerIter rowsize_beg, IntegerIter rowsize_end)
 
template<typename DataIter >
void appendRow (DataIter row_beg, DataIter row_end)
 Appends a row to the table. More...
 
bool empty () const
 True if the table contains no rows. More...
 
int size () const
 Returns the number of rows in the table. More...
 
void reserve (int exptd_nrows, int exptd_ndata)
 Allocate storage for table of expected size. More...
 
void swap (SparseTable< T > &other)
 Swap contents for other SparseTable<T> More...
 
int dataSize () const
 Returns the number of data elements. More...
 
int rowSize (int row) const
 Returns the size of a table row. More...
 
void clear ()
 Makes the table empty(). More...
 
row_type operator[] (int row) const
 Returns a row of the table. More...
 
mutable_row_type operator[] (int row)
 Returns a mutable row of the table. More...
 
bool operator== (const SparseTable &other) const
 Equality. More...
 
template<class charT , class traits >
void print (std::basic_ostream< charT, traits > &os) const
 
const T data (int i) const
 

Detailed Description

template<typename T>
class Opm::SparseTable< T >

A SparseTable stores a table with rows of varying size as efficiently as possible. It is supposed to behave similarly to a vector of vectors. Its behaviour is similar to compressed row sparse matrices.

Member Typedef Documentation

template<typename T>
typedef boost::iterator_range<T*> Opm::SparseTable< T >::mutable_row_type
template<typename T>
typedef boost::iterator_range<const T*> Opm::SparseTable< T >::row_type

Defining the row type, returned by operator[].

Constructor & Destructor Documentation

template<typename T>
Opm::SparseTable< T >::SparseTable ( )
inline

Default constructor. Yields an empty SparseTable.

template<typename T>
template<typename DataIter , typename IntegerIter >
Opm::SparseTable< T >::SparseTable ( DataIter  data_beg,
DataIter  data_end,
IntegerIter  rowsize_beg,
IntegerIter  rowsize_end 
)
inline

A constructor taking all the data for the table and row sizes.

Parameters
data_begThe start of the table data.
data_endOne-beyond-end of the table data.
rowsize_begThe start of the row length data.
rowsize_endOne beyond the end of the row length data.

Member Function Documentation

template<typename T>
template<typename IntegerIter >
void Opm::SparseTable< T >::allocate ( IntegerIter  rowsize_beg,
IntegerIter  rowsize_end 
)
inline

Request storage for table of given size.

Parameters
rowsize_begStart of row size data.
rowsize_endOne beyond end of row size data.
template<typename T>
template<typename DataIter >
void Opm::SparseTable< T >::appendRow ( DataIter  row_beg,
DataIter  row_end 
)
inline

Appends a row to the table.

template<typename T>
template<typename DataIter , typename IntegerIter >
void Opm::SparseTable< T >::assign ( DataIter  data_beg,
DataIter  data_end,
IntegerIter  rowsize_beg,
IntegerIter  rowsize_end 
)
inline

Sets the table to contain the given data, organized into rows as indicated by the given row sizes.

Parameters
data_begThe start of the table data.
data_endOne-beyond-end of the table data.
rowsize_begThe start of the row length data.
rowsize_endOne beyond the end of the row length data.
template<typename T>
void Opm::SparseTable< T >::clear ( )
inline

Makes the table empty().

template<typename T>
const T Opm::SparseTable< T >::data ( int  i) const
inline
template<typename T>
int Opm::SparseTable< T >::dataSize ( ) const
inline

Returns the number of data elements.

template<typename T>
bool Opm::SparseTable< T >::empty ( ) const
inline

True if the table contains no rows.

Referenced by Opm::SparseTable< Opm::WachspressCoord::CornerInfo >::size().

template<typename T>
bool Opm::SparseTable< T >::operator== ( const SparseTable< T > &  other) const
inline

Equality.

template<typename T>
row_type Opm::SparseTable< T >::operator[] ( int  row) const
inline

Returns a row of the table.

template<typename T>
mutable_row_type Opm::SparseTable< T >::operator[] ( int  row)
inline

Returns a mutable row of the table.

template<typename T>
template<class charT , class traits >
void Opm::SparseTable< T >::print ( std::basic_ostream< charT, traits > &  os) const
inline
template<typename T>
void Opm::SparseTable< T >::reserve ( int  exptd_nrows,
int  exptd_ndata 
)
inline

Allocate storage for table of expected size.

template<typename T>
int Opm::SparseTable< T >::rowSize ( int  row) const
inline

Returns the size of a table row.

template<typename T>
void Opm::SparseTable< T >::swap ( SparseTable< T > &  other)
inline

Swap contents for other SparseTable<T>


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