opm-common
Loading...
Searching...
No Matches
Opm::RestartIO::Helpers::WindowedMatrix< T > Class Template Reference

Provide read-only and read/write access to constantly sized portions/windows of a linearised buffer with an implied row/column matrix (2D array) structure. More...

#include <WindowedArray.hpp>

Classes

struct  NumRows
 Distinct compile-time type for number of matrix rows in underlying storage. More...
struct  NumCols
 Distinct compile-time type for number of matrix columns in underlying storage. More...

Public Types

using WriteWindow = typename WindowedArray<T>::WriteWindow
using ReadWindow = typename WindowedArray<T>::ReadWindow
using WindowSize = typename WindowedArray<T>::WindowSize
using Idx = typename WindowedArray<T>::Idx

Public Member Functions

 WindowedMatrix (const NumRows &nRows, const NumCols &nCols, const WindowSize &sz, const T initial=T{})
 Constructor.
Idx numCols () const
 Retrieve number of columns allocated for this matrix.
Idx numRows () const
 Retrieve number of rows allocated for this matrix.
Idx windowSize () const
 Retrieve number of data items per windows.
WriteWindow operator() (const Idx row, const Idx col)
 Request read/write access to individual window.
ReadWindow operator() (const Idx row, const Idx col) const
 Request read-only access to individual window.
auto data () const -> decltype(std::declval< const WindowedArray< T > >().data())
 Get read-only access to full, linearised data items for all windows.
auto getDataDestructively () -> decltype(std::declval< WindowedArray< T > >() .getDataDestructively())
 Extract full, linearised data items for all windows.

Detailed Description

template<typename T>
class Opm::RestartIO::Helpers::WindowedMatrix< T >

Provide read-only and read/write access to constantly sized portions/windows of a linearised buffer with an implied row/column matrix (2D array) structure.

Intended as backing store for vectors that have a constant number of items per sub-entity of a fixed number of containing entities (e.g., K double precision data items for each of N maximum well connections for each of M maximum active wells at a particular report step).

Template Parameters
TElement type for underlying data items.

Constructor & Destructor Documentation

◆ WindowedMatrix()

template<typename T>
Opm::RestartIO::Helpers::WindowedMatrix< T >::WindowedMatrix ( const NumRows & nRows,
const NumCols & nCols,
const WindowSize & sz,
const T initial = T{} )
inlineexplicit

Constructor.

Parameters
[in]nRowsNumber of rows.
[in]nColsNumber of columns.
[in]szNumber of data items per (row,column) window.
[in]initialInitial value to use

Member Function Documentation

◆ getDataDestructively()

template<typename T>
auto Opm::RestartIO::Helpers::WindowedMatrix< T >::getDataDestructively ( ) ->decltype(std::declval< WindowedArray< T > >().getDataDestructively())
inline

Extract full, linearised data items for all windows.

Destroys the internal state of the WindowedMatrix.

◆ operator()() [1/2]

template<typename T>
WriteWindow Opm::RestartIO::Helpers::WindowedMatrix< T >::operator() ( const Idx row,
const Idx col )
inline

Request read/write access to individual window.

Parameters
[in]rowNumeric ID of particular row in matrix. Must be in range
.
[in]colNumeric ID of particular column in matrix. Must be in range
.
Returns
Read/write window at position
.

◆ operator()() [2/2]

template<typename T>
ReadWindow Opm::RestartIO::Helpers::WindowedMatrix< T >::operator() ( const Idx row,
const Idx col ) const
inline

Request read-only access to individual window.

Parameters
[in]rowNumeric ID of particular row in matrix. Must be in range
.
[in]colNumeric ID of particular column in matrix. Must be in range
.
Returns
Read-only window at position
.

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