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

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

#include <WindowedArray.hpp>

Classes

struct  NumWindows
 Distinct compile-time type for number of windows in underlying storage. More...
struct  WindowSize
 Distinct compile-time type for size of windows (number of data items per window.). More...

Public Types

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

Public Member Functions

 WindowedArray (const NumWindows n, const WindowSize sz, const T initial=T{})
 Constructor.
 WindowedArray (const WindowedArray &rhs)=default
 WindowedArray (WindowedArray &&rhs)=default
WindowedArrayoperator= (const WindowedArray &rhs)=delete
WindowedArrayoperator= (WindowedArray &&rhs)=default
Idx numWindows () const
 Retrieve number of windows allocated for this array.
Idx windowSize () const
 Retrieve number of data items per windows.
WriteWindow operator[] (const Idx window)
 Request read/write access to individual window.
ReadWindow operator[] (const Idx window) const
 Request read-only access to individual window.
const std::vector< T > & data () const
 Get read-only access to full, linearised data items for all windows.
std::vector< T > getDataDestructively ()
 Extract full, linearised data items for all windows.

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

◆ ReadWindow

template<typename T>
using Opm::RestartIO::Helpers::WindowedArray< T >::ReadWindow
Initial value:

Read-only access.

◆ WriteWindow

template<typename T>
using Opm::RestartIO::Helpers::WindowedArray< T >::WriteWindow
Initial value:

Read/write access.

Constructor & Destructor Documentation

◆ WindowedArray()

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

Constructor.

Parameters
[in]nNumber of windows.
[in]szNumber of data items per window.
[in]initialInitial value to use

Member Function Documentation

◆ 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.

◆ 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
.

◆ 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
.

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