My Project
Loading...
Searching...
No Matches
Opm::data::InterRegFlowMap Class Reference

Form CSR adjacency matrix representation of inter-region flow rate graph provided as a list of connections between regions. More...

#include <InterRegFlowMap.hpp>

Public Types

using ReadOnlyWindow = InterRegFlow< std::vector< float >::const_iterator >
 Client view of flows between specified region pair.
 
using FlowRates = Window::FlowRates
 Client type through which to define a single inter-region connection.
 
using Component = Window::Component
 Client type through which to identify a component flow of a single inter-region connection.
 

Public Member Functions

void addConnection (const int r1, const int r2, const FlowRates &rates)
 Add flow rate connection between regions.
 
void compress (const std::size_t numRegions)
 Form CSR adjacency matrix representation of input graph from connections established in previous calls to addConnection().
 
Offset numRegions () const
 Retrieve number of rows (source entities) in input graph.
 
std::optional< std::pair< ReadOnlyWindow, ReadOnlyWindow::ElmT > > getInterRegFlows (const int r1, const int r2) const
 Retrieve accumulated inter-region flow rates for identified pair of regions.
 
template<class MessageBufferType >
void write (MessageBufferType &buffer) const
 
template<class MessageBufferType >
void read (MessageBufferType &buffer)
 
void clear ()
 Clear all internal buffers, but preserve allocated capacity.
 

Detailed Description

Form CSR adjacency matrix representation of inter-region flow rate graph provided as a list of connections between regions.

Member Function Documentation

◆ addConnection()

void Opm::data::InterRegFlowMap::addConnection ( const int  r1,
const int  r2,
const FlowRates rates 
)

Add flow rate connection between regions.

Parameters
[in]r1Primary (source) zero-based region index. Used as row index.
[in]r2Secondary (sink) zero-based region index. Used as column index.
[in]ratesFlow rates associated to single connection.

If both region IDs are the same then this function does nothing.

◆ compress()

void Opm::data::InterRegFlowMap::compress ( const std::size_t  numRegions)

Form CSR adjacency matrix representation of input graph from connections established in previous calls to addConnection().

Parameters
[in]numRegionsNumber of rows in resulting CSR matrix. If prior calls to addConnection() supply source entity IDs (row indices) greater than or equal to numRows, then method compress() will throw
std::invalid_argument
.

◆ getInterRegFlows()

std::optional< std::pair< Opm::data::InterRegFlowMap::ReadOnlyWindow, Opm::data::InterRegFlowMap::ReadOnlyWindow::ElmT > > Opm::data::InterRegFlowMap::getInterRegFlows ( const int  r1,
const int  r2 
) const

Retrieve accumulated inter-region flow rates for identified pair of regions.

Parameters
[in]r1Primary (source) zero-based region index. Used as row index.
[in]r2Secondary (sink) zero-based region index. Used as column index.
Returns
View of accumulated inter-region flow rates and associated flow direction sign.
std::nullopt
if no such rates exist.

◆ numRegions()

Opm::data::InterRegFlowMap::Offset Opm::data::InterRegFlowMap::numRegions ( ) const

Retrieve number of rows (source entities) in input graph.

Corresponds to value of argument passed to compress(). Valid only after calling compress().


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