opm-common
Opm::NNCCollection Class Reference

Public Member Functions

 NNCCollection (NNCDataContainer nnc_global)
 Constructs an NNCCollection pre-populated with nnc_global as the global (grid 0) same-grid NNC. More...
 
void addNNC (std::size_t grid1, std::size_t grid2, NNCDataContainerDiffGrid nnc)
 Add a cross-grid NNC between grid1 and grid2. More...
 
void addNNC (std::size_t grid, NNCDataContainer nnc)
 Add a same-grid NNC for the given grid index. More...
 
void addNNC (NNCDataContainer nnc)
 Add the global (main-grid) NNC. Equivalent to addNNC(0, nnc). More...
 
const NNCDataContainerDiffGridgetNNC (std::size_t grid1, std::size_t grid2) const
 Returns a const reference to the cross-grid NNC for the (grid1, grid2) pair. More...
 
NNCDataContainerDiffGridgetNNC (std::size_t grid1, std::size_t grid2)
 Returns a mutable reference to the cross-grid NNC for the (grid1, grid2) pair.
 
bool hasCrossGridNNC (std::size_t grid1, std::size_t grid2) const
 
bool empty () const
 
const NNCDataContainergetNNC (std::size_t grid) const
 Returns a const reference to the same-grid NNC for grid. More...
 
NNCDataContainergetNNC (std::size_t grid)
 Returns a mutable reference to the same-grid NNC for grid.
 
bool hasSameGridNNC (std::size_t grid) const
 
const NNCDataContainergetGlobalNNC () const
 Returns a const reference to the global (grid 0) same-grid NNC. More...
 
NNCDataContainergetGlobalNNC ()
 Returns a mutable reference to the global (grid 0) same-grid NNC. More...
 
bool hasGlobalNNC () const
 
bool hasNNCForGrid (std::size_t grid_index) const
 Returns true if the given grid has any NNC involvement: same-grid NNCs, or cross-grid NNCs with any other grid. More...
 
const std::map< std::size_t, NNCDataContainer > & same_grid_nnc () const
 Returns a view of all same-grid NNCs as (grid_index, NNC) pairs.
 
const std::map< std::pair< std::size_t, std::size_t >, NNCDataContainerDiffGrid > & diff_grid_nnc () const
 Returns a view of all cross-grid NNCs keyed by normalised (g1,g2) pairs.
 
bool operator== (const NNCCollection &other) const
 

Static Public Member Functions

static NNCCollection fromLGROutputContainers (const std::vector< std::vector< NNCdata >> &outputNnc, const std::vector< std::vector< NNCdata >> &outputNncGlobalLocal, const std::vector< std::vector< std::vector< NNCdata >>> &outputAmalgamatedNnc)
 Build an NNCCollection from the three output containers produced by EclGenericWriter::exportNncStructure_(). More...
 

Constructor & Destructor Documentation

◆ NNCCollection()

Opm::NNCCollection::NNCCollection ( NNCDataContainer  nnc_global)
explicit

Constructs an NNCCollection pre-populated with nnc_global as the global (grid 0) same-grid NNC.

Member Function Documentation

◆ addNNC() [1/3]

void Opm::NNCCollection::addNNC ( std::size_t  grid1,
std::size_t  grid2,
NNCDataContainerDiffGrid  nnc 
)

Add a cross-grid NNC between grid1 and grid2.

Adds a cross-grid NNC between grid1 and grid2.

The key is normalised to (min, max) and cell indices are swapped accordingly. Throws std::runtime_error if an entry for this grid pair already exists.

◆ addNNC() [2/3]

void Opm::NNCCollection::addNNC ( std::size_t  grid,
NNCDataContainer  nnc 
)

Add a same-grid NNC for the given grid index.

Adds a same-grid NNC for grid.

Throws std::runtime_error if an entry for this grid index already exists.

◆ addNNC() [3/3]

void Opm::NNCCollection::addNNC ( NNCDataContainer  nnc)

Add the global (main-grid) NNC. Equivalent to addNNC(0, nnc).

Adds nnc as the global (grid 0) same-grid NNC.

Equivalent to addNNC(0, nnc).

◆ fromLGROutputContainers()

NNCCollection Opm::NNCCollection::fromLGROutputContainers ( const std::vector< std::vector< NNCdata >> &  outputNnc,
const std::vector< std::vector< NNCdata >> &  outputNncGlobalLocal,
const std::vector< std::vector< std::vector< NNCdata >>> &  outputAmalgamatedNnc 
)
static

Build an NNCCollection from the three output containers produced by EclGenericWriter::exportNncStructure_().

Builds an NNCCollection from the three output containers produced by EclGenericWriter::exportNncStructure_().

Parameters
outputNncSame-grid NNCs, indexed by grid level. outputNnc[level] holds the NNCs internal to grid level (0 = main grid).
outputNncGlobalLocalGlobal-to-local NNCs, indexed by local level offset. outputNncGlobalLocal[i] holds connections between the main grid (level 0) and the refined level i+1.
outputAmalgamatedNncLGR-to-LGR NNCs, indexed by (smallerLevel-1, largerLevel-smallerLevel-1). outputAmalgamatedNnc[i][j] holds connections between level i+1 and level i+j+2.
Returns
An NNCCollection populated with all three NNC types.

Index convention (matches the layout written by exportNncStructure_):

outputNnc[level] → same-grid NNCs for grid level (0 = main grid).

outputNncGlobalLocal[i] → cross-grid NNCs between main grid (level 0) and level i+1.

outputAmalgamatedNnc[i][j] → cross-grid NNCs between level i+1 and level i+j+2.

◆ getGlobalNNC() [1/2]

const NNCDataContainer & Opm::NNCCollection::getGlobalNNC ( ) const

Returns a const reference to the global (grid 0) same-grid NNC.

Throws std::runtime_error if no global NNC has been added.

◆ getGlobalNNC() [2/2]

NNCDataContainer & Opm::NNCCollection::getGlobalNNC ( )

Returns a mutable reference to the global (grid 0) same-grid NNC.

Throws std::runtime_error if no global NNC has been added.

◆ getNNC() [1/2]

const NNCDataContainerDiffGrid & Opm::NNCCollection::getNNC ( std::size_t  grid1,
std::size_t  grid2 
) const

Returns a const reference to the cross-grid NNC for the (grid1, grid2) pair.

Grid order is normalised automatically. Throws std::runtime_error if no entry exists.

◆ getNNC() [2/2]

const NNCDataContainer & Opm::NNCCollection::getNNC ( std::size_t  grid) const

Returns a const reference to the same-grid NNC for grid.

Throws std::runtime_error if no entry exists.

◆ hasNNCForGrid()

bool Opm::NNCCollection::hasNNCForGrid ( std::size_t  grid_index) const
inline

Returns true if the given grid has any NNC involvement: same-grid NNCs, or cross-grid NNCs with any other grid.


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