Opm::RestartIO::Helpers::WindowedArray< T > Class Template Reference

#include <WindowedArray.hpp>

Inheritance diagram for Opm::RestartIO::Helpers::WindowedArray< T >:
Inheritance graph

Classes

struct  NumWindows
 
struct  WindowSize
 

Public Types

using WriteWindow = boost::iterator_range< typename std::vector< T >::iterator >
 Read/write access. More...
 
using ReadWindow = boost::iterator_range< typename std::vector< T >::const_iterator >
 Read-only access. More...
 
using Idx = typename std::vector< T >::size_type
 

Public Member Functions

 WindowedArray (const NumWindows n, const WindowSize sz)
 
Idx numWindows () const
 Retrieve number of windows allocated for this array. More...
 
Idx windowSize () const
 Retrieve number of data items per windows. More...
 
WriteWindow operator[] (const Idx window)
 
ReadWindow operator[] (const Idx window) const
 
const std::vector< T > & data () const
 
std::vector< T > getDataDestructively ()
 

Detailed Description

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

Provide read-only and read/write access to constantly sized portions/windows of a linearised buffer with an implied 1D array structure.

Intended as backing store for vectors that have a constant number of items per entity (e.g., N integer data items for each active group at a report step).

Template Parameters
TElement type for underlying data items.

Member Typedef Documentation

◆ Idx

template<typename T >
using Opm::RestartIO::Helpers::WindowedArray< T >::Idx = typename std::vector<T>::size_type

◆ ReadWindow

template<typename T >
using Opm::RestartIO::Helpers::WindowedArray< T >::ReadWindow = boost::iterator_range< typename std::vector<T>::const_iterator>

Read-only access.

◆ WriteWindow

template<typename T >
using Opm::RestartIO::Helpers::WindowedArray< T >::WriteWindow = boost::iterator_range< typename std::vector<T>::iterator>

Read/write access.

Constructor & Destructor Documentation

◆ WindowedArray()

template<typename T >
Opm::RestartIO::Helpers::WindowedArray< T >::WindowedArray ( const NumWindows  n,
const WindowSize  sz 
)
inlineexplicit

Constructor.

Parameters
[in]nNumber of windows.
[in]szNumber of data items per window.

References Opm::RestartIO::Helpers::WindowedArray< T >::WindowSize::value.

Member Function Documentation

◆ data()

◆ getDataDestructively()

template<typename T >
std::vector< T > Opm::RestartIO::Helpers::WindowedArray< T >::getDataDestructively ( )
inline

Extract full, linearised data items for all windows.

Destroys the internal state of the WindowedArray.

◆ numWindows()

template<typename T >
Idx Opm::RestartIO::Helpers::WindowedArray< T >::numWindows ( ) const
inline

Retrieve number of windows allocated for this array.

Referenced by Opm::RestartIO::Helpers::WindowedArray< T >::operator[]().

◆ operator[]() [1/2]

template<typename T >
WriteWindow Opm::RestartIO::Helpers::WindowedArray< T >::operator[] ( const Idx  window)
inline

Request read/write access to individual window.

Parameters
[in]windowNumeric ID of particular read/write window. Must be in range
[0 .. numWindows()-1]
Idx numWindows() const
Retrieve number of windows allocated for this array.
Definition: WindowedArray.hpp:83
.

References b, Catch::begin, exprtk::details::numeric::constant::e, and Opm::RestartIO::Helpers::WindowedArray< T >::numWindows().

◆ operator[]() [2/2]

template<typename T >
ReadWindow Opm::RestartIO::Helpers::WindowedArray< T >::operator[] ( const Idx  window) const
inline

Request read-only access to individual window.

Parameters
[in]windowNumeric ID of particular read-only window. Must be in range
[0 .. numWindows()-1]
.

References b, Catch::begin, exprtk::details::numeric::constant::e, and Opm::RestartIO::Helpers::WindowedArray< T >::numWindows().

◆ windowSize()

template<typename T >
Idx Opm::RestartIO::Helpers::WindowedArray< T >::windowSize ( ) const
inline

Retrieve number of data items per windows.


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