My Project
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 = boost::iterator_range< typename std::vector< T >::iterator >
 Read/write access.
 
using ReadWindow = boost::iterator_range< typename std::vector< T >::const_iterator >
 Read-only access.
 
using Idx = typename std::vector< T >::size_type
 

Public Member Functions

 WindowedArray (const NumWindows n, const WindowSize sz)
 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.

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.

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
[0 .. numWindows()-1]
Idx numWindows() const
Retrieve number of windows allocated for this array.
Definition WindowedArray.hpp:88
.

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

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