Opm::RunLenView< T > Class Template Reference

#include <runlen.hpp>

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

Public Member Functions

 RunLenView (int num_cols, int *pos_ptr, T *values)
 
 RunLenView (const RunLenView &rhs)
 
T * operator[] (int col) const
 
int cols () const
 
int size (int col) const
 
T & last (int col) const
 

Protected Attributes

int num_of_cols
 
int * pos
 
T * data
 

Constructor & Destructor Documentation

template<typename T >
Opm::RunLenView< T >::RunLenView ( int  num_cols,
int *  pos_ptr,
T *  values 
)
inline

Construct a view into the run-length encoded matrix. The view is only defined as long as the underlaying structures exist!

Parameters
numberNumber of cells (elements, faces, nodes)
pos_ptrTable of starting indices. If columns are "foo" and rows are "bar", then this is the member called "foo_barpos".
valuesActual data storage. If columns are "foo" and rows are "bar", then this is the member called "foo_bars".
template<typename T >
Opm::RunLenView< T >::RunLenView ( const RunLenView< T > &  rhs)
inline

Create another view of the same data.

Parameters
rhsView to a run-length-encoded matrix

Member Function Documentation

template<typename T >
int Opm::RunLenView< T >::cols ( ) const
inline

Number of columns that are stored in the entire matrix.

Returns
Number of columns.

References Opm::RunLenView< T >::num_of_cols.

template<typename T >
T& Opm::RunLenView< T >::last ( int  col) const
inline

Quick accessor to get the last element. When we store accumulated data in the array, this will quickly give us the total.

Note that this is NOT the end iterator for the column.

Parameters
colIndex of the column
Returns
Value of the last element. If there is no elements in this column, then the return value is undefined.
template<typename T >
T* Opm::RunLenView< T >::operator[] ( int  col) const
inline

Access a column directly.

Parameters
colIndex of the column to get
Returns
Pointer to the start of the column
template<typename T >
int Opm::RunLenView< T >::size ( int  col) const
inline

Number of elements that are stored in one particular column.

Parameters
colIndex of the column.
Returns
Number of elements.

Member Data Documentation

template<typename T >
T* Opm::RunLenView< T >::data
protected

Data for each of the individual elements, stored consecutively for each column located together, followed by the next column.

template<typename T >
int Opm::RunLenView< T >::num_of_cols
protected

Size information. pos has num_of_cols+1 items, pos[i] contains the starting index of the data values for column i. (Since there is one more element than there are columns, the last one is the total number of elements). The number 0 is explicitly stored in the first column to avoid special processing.

Referenced by Opm::RunLenView< T >::cols().

template<typename T >
int* Opm::RunLenView< T >::pos
protected

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