Opm::RunLenData< T > Struct Template Reference

#include <runlen.hpp>

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

Public Member Functions

 RunLenData (int number, int *pos_ptr)
 
 ~RunLenData ()
 
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
 

Detailed Description

template<typename T>
struct Opm::RunLenData< T >

Allocate a new vector of data for each element, accessible as a zig-zag matrix.

Use this kind of matrix when you want to enhance the grid structure with some information per element, using the existing format.

See also
Opm::RunLenView

Constructor & Destructor Documentation

template<typename T >
Opm::RunLenData< T >::RunLenData ( int  number,
int *  pos_ptr 
)
inline

Allocate a matrix based on sizes specified elsewhere. This is useful if you want to supply with your own data.

Parameters
numberNumber of entities (rows).
pos_ptrNumber of elements to allocate in front of each entity; starting index in the array for this row.
See also
Opm::RunLenView::RunLenView
template<typename T >
Opm::RunLenData< T >::~RunLenData ( )
inline

Member Function Documentation

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

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
inlineinherited

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
inlineinherited

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
inlineinherited

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
protectedinherited

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
protectedinherited

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
protectedinherited

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