My Project
Loading...
Searching...
No Matches
Opm::SparseTable< T > Class Template Reference

A SparseTable stores a table with rows of varying size as efficiently as possible. More...

#include <SparseTable.hpp>

Classes

class  Iterator
 Iterator for iterating over the container as a whole, i.e. More...
 

Public Types

using row_type = iterator_range< typename std::vector< T >::const_iterator >
 Defining the row type, returned by operator[].
 
using mutable_row_type = mutable_iterator_range< typename std::vector< T >::iterator >
 

Public Member Functions

 SparseTable ()
 Default constructor. Yields an empty SparseTable.
 
template<typename DataIter , typename IntegerIter >
 SparseTable (DataIter data_beg, DataIter data_end, IntegerIter rowsize_beg, IntegerIter rowsize_end)
 A constructor taking all the data for the table and row sizes.
 
template<typename DataIter , typename IntegerIter >
void assign (DataIter data_beg, DataIter data_end, IntegerIter rowsize_beg, IntegerIter rowsize_end)
 Sets the table to contain the given data, organized into rows as indicated by the given row sizes.
 
template<typename IntegerIter >
void allocate (IntegerIter rowsize_beg, IntegerIter rowsize_end)
 Request storage for table of given size.
 
template<typename DataIter >
void appendRow (DataIter row_beg, DataIter row_end)
 Appends a row to the table.
 
bool empty () const
 True if the table contains no rows.
 
int size () const
 Returns the number of rows in the table.
 
void reserve (int exptd_nrows, int exptd_ndata)
 Allocate storage for table of expected size.
 
void swap (SparseTable< T > &other)
 Swap contents for other SparseTable<T>
 
int dataSize () const
 Returns the number of data elements.
 
int rowSize (int row) const
 Returns the size of a table row.
 
void clear ()
 Makes the table empty().
 
row_type operator[] (int row) const
 Returns a row of the table.
 
mutable_row_type operator[] (int row)
 Returns a mutable row of the table.
 
Iterator begin () const
 Iterator access.
 
Iterator end () const
 
bool operator== (const SparseTable &other) const
 Equality.
 
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.

Constructor & Destructor Documentation

◆ 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

◆ allocate()

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.

◆ assign()

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.

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