Opm::AssembledConnections Class Reference

#include <AssembledConnections.hpp>

Public Types

using Neighbours = std::vector< int >
 Representation of neighbouring entities. More...
 
using Offset = Neighbours::size_type
 Offset into neighbour array. More...
 
using Start = std::vector< Offset >
 CSR start pointers. More...
 
using ConnWeight = std::vector< double >
 Aggregate connection weights. More...
 
using CellNeighbours = SimpleIteratorRange< NeighbourhoodIterator >
 

Public Member Functions

void addConnection (const int i, const int j)
 
void addConnection (const int i, const int j, const double v)
 
void compress (const std::size_t numRows)
 
Offset numRows () const
 
const StartstartPointers () const
 
const Neighboursneighbourhood () const
 
const ConnWeightconnectionWeight () const
 
CellNeighbours cellNeighbourhood (const int cell) const
 

Detailed Description

Form CSR adjacency matrix representation of graph provided as a list of connections between entities, possibly including edge weights.

Member Typedef Documentation

◆ CellNeighbours

Range of neighbours connected to a particular entity. Includes edge weights.

◆ ConnWeight

using Opm::AssembledConnections::ConnWeight = std::vector<double>

Aggregate connection weights.

◆ Neighbours

using Opm::AssembledConnections::Neighbours = std::vector<int>

Representation of neighbouring entities.

◆ Offset

using Opm::AssembledConnections::Offset = Neighbours::size_type

Offset into neighbour array.

◆ Start

CSR start pointers.

Member Function Documentation

◆ addConnection() [1/2]

void Opm::AssembledConnections::addConnection ( const int  i,
const int  j 
)

Add connection between entities.

Parameters
[in]iPrimary (source) entity. Used as row index.
[in]jSecondary (sink) entity. Used as column index.

◆ addConnection() [2/2]

void Opm::AssembledConnections::addConnection ( const int  i,
const int  j,
const double  v 
)

Add weighted connection between entities.

Parameters
[in]iPrimary (source) entity. Used as row index.
[in]jSecondary (sink) entity. Used as column index.
[in]vEdge weight associated to connection.

◆ cellNeighbourhood()

CellNeighbours Opm::AssembledConnections::cellNeighbourhood ( const int  cell) const

Provide a range over a cell neighbourhood.

Example usage:

for (const auto& connection : cellNeighbourhood(cell) {
// connection.neigbour is the neigbouring cell
// connection.weight is the corresponding connection weight
}
CellNeighbours cellNeighbourhood(const int cell) const

This method can only be called if the weight-providing overload of addConnection() was used to build the instance.

◆ compress()

void Opm::AssembledConnections::compress ( const std::size_t  numRows)

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

A call to function compress() will fail unless all previously established connections have an explicit edge weight (

void addConnection(const int i, const int j)

) or none of those connections have an explicit edge weight (

).

This method destroys the connection list so if there are subsequent calls to method addConnection() then those will effectively create a new graph.

Parameters
[in]numRowsNumber 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
.

◆ connectionWeight()

const ConnWeight & Opm::AssembledConnections::connectionWeight ( ) const

Retrieve accumulated connection weights for each aggregate neighbour relation in the adjacency matrix. Only valid if the input graph is specified in terms of explicit edge weights (

).

Weights have the same ordering as the neighbours represented by neighbourhood().

◆ neighbourhood()

const Neighbours & Opm::AssembledConnections::neighbourhood ( ) const

Retrieve raw CSR column indices pertaining to current input graph. Only valid after compress() is called. The neighbours of entity i are

neighbourhood()[startPointers()[i + 1] - 1]
const Neighbours & neighbourhood() const
const Start & startPointers() const

◆ numRows()

Offset Opm::AssembledConnections::numRows ( ) const

Retrieve number of rows (source entities) in input graph. Corresponds to value of argument passed to compress(). Valid only after calling compress().

◆ startPointers()

const Start & Opm::AssembledConnections::startPointers ( ) const

Retrieve raw CSR start pointers pertaining to current input graph. Only valid after compress() is called.


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