Opm::Linear::DomesticOverlapFromBCRSMatrix Class Reference

This class creates and manages the foreign overlap given an initial list of border indices and a BCRS matrix. More...

#include <domesticoverlapfrombcrsmatrix.hh>

Public Member Functions

 DomesticOverlapFromBCRSMatrix (const DomesticOverlapFromBCRSMatrix &)=delete
 
template<class BCRSMatrix >
 DomesticOverlapFromBCRSMatrix (const BCRSMatrix &A, const BorderList &borderList, const BlackList &blackList, unsigned overlapSize)
 Constructs the foreign overlap given a BCRS matrix and an initial list of border indices. More...
 
void check () const
 
ProcessRank myRank () const
 Returns the rank of the current process. More...
 
unsigned worldSize () const
 Returns the number of processes in the global MPI communicator. More...
 
const PeerSetpeerSet () const
 Return the set of process ranks which share an overlap with the current process. More...
 
bool isBorder (Index domesticIdx) const
 Returns true iff a domestic index is a border index. More...
 
bool isBorderWith (Index domesticIdx, ProcessRank peerRank) const
 Returns true iff a domestic index is on the border with a given peer process. More...
 
size_t numFront (ProcessRank peerRank) const
 Returns the number of indices on the front within a given peer rank's grid partition. More...
 
bool isFront (Index domesticIdx) const
 Returns true iff a domestic index is on the front. More...
 
const BlackListblackList () const
 Returns the object which represents the black-listed native indices. More...
 
size_t numPeers (Index domesticIdx) const
 Returns the number of processes which "see" a given index. More...
 
unsigned overlapSize () const
 Returns the size of the overlap region. More...
 
size_t numNative () const
 Returns the number native indices. More...
 
size_t numLocal () const
 Returns the number local indices. More...
 
size_t numDomestic () const
 Returns the number domestic indices. More...
 
bool isLocal (Index domesticIdx) const
 Return true if a domestic index is local for the process. More...
 
bool iAmMasterOf (Index domesticIdx) const
 Return true iff the current process is the master of a given domestic index. More...
 
ProcessRank masterRank (Index domesticIdx) const
 Return the rank of a master process for a domestic index. More...
 
void print () const
 Print the foreign overlap for debugging purposes. More...
 
Index globalToDomestic (Index globalIdx) const
 Returns a domestic index given a global one. More...
 
Index domesticToGlobal (Index domIdx) const
 Returns a global index given a domestic one. More...
 
Index domesticToNative (Index domIdx) const
 Returns a native index given a domestic one. More...
 
Index nativeToDomestic (Index nativeIdx) const
 Returns a domestic index given a native one. More...
 
bool isInOverlap (Index domesticIdx) const
 Returns true if a given domestic index is either in the foreign or in the domestic overlap. More...
 
bool isFrontFor (ProcessRank peerRank, Index domesticIdx) const
 Returns true if a given domestic index is a front index for a peer rank. More...
 
bool peerHasIndex (int peerRank, Index domesticIdx) const
 Returns true iff a domestic index is seen by a peer rank. More...
 
size_t foreignOverlapSize (ProcessRank peerRank) const
 Returns number of indices which are contained in the foreign overlap with a peer. More...
 
Index foreignOverlapOffsetToDomesticIdx (ProcessRank peerRank, unsigned overlapOffset) const
 Returns the domestic index given an offset in the foreign overlap of a peer process with the local process. More...
 
size_t domesticOverlapSize (ProcessRank peerRank) const
 Returns number of indices which are contained in the domestic overlap with a peer. More...
 
Index domesticOverlapOffsetToDomesticIdx (ProcessRank peerRank, Index overlapOffset) const
 Returns the domestic index given an offset in the domestic overlap of a peer process with the local process. More...
 

Protected Member Functions

void buildDomesticOverlap_ ()
 
void updateMasterRanks_ ()
 
void sendIndicesToPeer_ (ProcessRank peerRank)
 
void waitSendIndices_ (ProcessRank peerRank)
 
void receiveIndicesFromPeer_ (ProcessRank peerRank)
 
void setupDebugMapping_ ()
 
Index mapInternalToExternal_ (Index internalIdx) const
 
Index mapExternalToInternal_ (Index externalIdx) const
 

Protected Attributes

ProcessRank myRank_
 
unsigned worldSize_
 
ForeignOverlap foreignOverlap_
 
BlackList blackList_
 
DomesticOverlapByRank domesticOverlapWithPeer_
 
OverlapByIndex domesticOverlapByIndex_
 
std::vector< BorderDistanceborderDistance_
 
std::vector< ProcessRankmasterRank_
 
std::map< ProcessRank, MpiBuffer< size_t > * > numIndicesSendBuffer_
 
std::map< ProcessRank, MpiBuffer< IndexDistanceNpeers > * > indicesSendBuffer_
 
GlobalIndices globalIndices_
 
PeerSet peerSet_
 

Detailed Description

This class creates and manages the foreign overlap given an initial list of border indices and a BCRS matrix.

The foreign overlap are all (row) indices which overlap with the some of the current process's local indices.

Constructor & Destructor Documentation

◆ DomesticOverlapFromBCRSMatrix() [1/2]

Opm::Linear::DomesticOverlapFromBCRSMatrix::DomesticOverlapFromBCRSMatrix ( const DomesticOverlapFromBCRSMatrix )
delete

◆ DomesticOverlapFromBCRSMatrix() [2/2]

template<class BCRSMatrix >
Opm::Linear::DomesticOverlapFromBCRSMatrix::DomesticOverlapFromBCRSMatrix ( const BCRSMatrix &  A,
const BorderList borderList,
const BlackList blackList,
unsigned  overlapSize 
)
inline

Constructs the foreign overlap given a BCRS matrix and an initial list of border indices.

References blackList_, buildDomesticOverlap_(), myRank_, setupDebugMapping_(), updateMasterRanks_(), Opm::Linear::BlackList::updateNativeToDomesticMap(), and worldSize_.

Member Function Documentation

◆ blackList()

const BlackList & Opm::Linear::DomesticOverlapFromBCRSMatrix::blackList ( ) const
inline

Returns the object which represents the black-listed native indices.

References blackList_.

◆ buildDomesticOverlap_()

◆ check()

◆ domesticOverlapOffsetToDomesticIdx()

Index Opm::Linear::DomesticOverlapFromBCRSMatrix::domesticOverlapOffsetToDomesticIdx ( ProcessRank  peerRank,
Index  overlapOffset 
) const
inline

Returns the domestic index given an offset in the domestic overlap of a peer process with the local process.

References domesticOverlapWithPeer_, and mapInternalToExternal_().

◆ domesticOverlapSize()

size_t Opm::Linear::DomesticOverlapFromBCRSMatrix::domesticOverlapSize ( ProcessRank  peerRank) const
inline

Returns number of indices which are contained in the domestic overlap with a peer.

References domesticOverlapWithPeer_.

◆ domesticToGlobal()

Index Opm::Linear::DomesticOverlapFromBCRSMatrix::domesticToGlobal ( Index  domIdx) const
inline

Returns a global index given a domestic one.

References Opm::Linear::GlobalIndices< ForeignOverlap >::domesticToGlobal(), globalIndices_, and mapExternalToInternal_().

Referenced by check().

◆ domesticToNative()

Index Opm::Linear::DomesticOverlapFromBCRSMatrix::domesticToNative ( Index  domIdx) const
inline

◆ foreignOverlapOffsetToDomesticIdx()

Index Opm::Linear::DomesticOverlapFromBCRSMatrix::foreignOverlapOffsetToDomesticIdx ( ProcessRank  peerRank,
unsigned  overlapOffset 
) const
inline

Returns the domestic index given an offset in the foreign overlap of a peer process with the local process.

References foreignOverlap_, Opm::Linear::ForeignOverlapFromBCRSMatrix::foreignOverlapWithPeer(), and mapInternalToExternal_().

◆ foreignOverlapSize()

size_t Opm::Linear::DomesticOverlapFromBCRSMatrix::foreignOverlapSize ( ProcessRank  peerRank) const
inline

Returns number of indices which are contained in the foreign overlap with a peer.

References foreignOverlap_, and Opm::Linear::ForeignOverlapFromBCRSMatrix::foreignOverlapWithPeer().

◆ globalToDomestic()

Index Opm::Linear::DomesticOverlapFromBCRSMatrix::globalToDomestic ( Index  globalIdx) const
inline

Returns a domestic index given a global one.

References globalIndices_, Opm::Linear::GlobalIndices< ForeignOverlap >::globalToDomestic(), and mapInternalToExternal_().

Referenced by check().

◆ iAmMasterOf()

bool Opm::Linear::DomesticOverlapFromBCRSMatrix::iAmMasterOf ( Index  domesticIdx) const
inline

Return true iff the current process is the master of a given domestic index.

References foreignOverlap_, Opm::Linear::ForeignOverlapFromBCRSMatrix::iAmMasterOf(), isLocal(), and mapExternalToInternal_().

◆ isBorder()

bool Opm::Linear::DomesticOverlapFromBCRSMatrix::isBorder ( Index  domesticIdx) const
inline

Returns true iff a domestic index is a border index.

References foreignOverlap_, Opm::Linear::ForeignOverlapFromBCRSMatrix::isBorder(), isLocal(), and mapExternalToInternal_().

◆ isBorderWith()

bool Opm::Linear::DomesticOverlapFromBCRSMatrix::isBorderWith ( Index  domesticIdx,
ProcessRank  peerRank 
) const
inline

Returns true iff a domestic index is on the border with a given peer process.

References foreignOverlap_, Opm::Linear::ForeignOverlapFromBCRSMatrix::isBorderWith(), isLocal(), and mapExternalToInternal_().

◆ isFront()

bool Opm::Linear::DomesticOverlapFromBCRSMatrix::isFront ( Index  domesticIdx) const
inline

◆ isFrontFor()

bool Opm::Linear::DomesticOverlapFromBCRSMatrix::isFrontFor ( ProcessRank  peerRank,
Index  domesticIdx 
) const
inline

Returns true if a given domestic index is a front index for a peer rank.

References foreignOverlap_, Opm::Linear::ForeignOverlapFromBCRSMatrix::isFrontFor(), and mapExternalToInternal_().

◆ isInOverlap()

bool Opm::Linear::DomesticOverlapFromBCRSMatrix::isInOverlap ( Index  domesticIdx) const
inline

Returns true if a given domestic index is either in the foreign or in the domestic overlap.

References foreignOverlap_, Opm::Linear::ForeignOverlapFromBCRSMatrix::isInOverlap(), isLocal(), and mapExternalToInternal_().

◆ isLocal()

bool Opm::Linear::DomesticOverlapFromBCRSMatrix::isLocal ( Index  domesticIdx) const
inline

Return true if a domestic index is local for the process.

I.e. the entity for this index is in the interior or on the border of the process' domain.

References mapExternalToInternal_(), and numLocal().

Referenced by iAmMasterOf(), isBorder(), isBorderWith(), isFront(), and isInOverlap().

◆ mapExternalToInternal_()

Index Opm::Linear::DomesticOverlapFromBCRSMatrix::mapExternalToInternal_ ( Index  externalIdx) const
inlineprotected

◆ mapInternalToExternal_()

Index Opm::Linear::DomesticOverlapFromBCRSMatrix::mapInternalToExternal_ ( Index  internalIdx) const
inlineprotected

◆ masterRank()

ProcessRank Opm::Linear::DomesticOverlapFromBCRSMatrix::masterRank ( Index  domesticIdx) const
inline

Return the rank of a master process for a domestic index.

References mapExternalToInternal_(), and masterRank_.

◆ myRank()

ProcessRank Opm::Linear::DomesticOverlapFromBCRSMatrix::myRank ( ) const
inline

Returns the rank of the current process.

References myRank_.

◆ nativeToDomestic()

Index Opm::Linear::DomesticOverlapFromBCRSMatrix::nativeToDomestic ( Index  nativeIdx) const
inline

Returns a domestic index given a native one.

References foreignOverlap_, mapInternalToExternal_(), and Opm::Linear::ForeignOverlapFromBCRSMatrix::nativeToLocal().

◆ numDomestic()

size_t Opm::Linear::DomesticOverlapFromBCRSMatrix::numDomestic ( ) const
inline

Returns the number domestic indices.

The domestic indices are defined as the process' local indices plus its domestic overlap (i.e. indices for which it is not neither master nor are on the process border).

References globalIndices_, and Opm::Linear::GlobalIndices< ForeignOverlap >::numDomestic().

Referenced by check(), and updateMasterRanks_().

◆ numFront()

size_t Opm::Linear::DomesticOverlapFromBCRSMatrix::numFront ( ProcessRank  peerRank) const
inline

Returns the number of indices on the front within a given peer rank's grid partition.

References foreignOverlap_, and Opm::Linear::ForeignOverlapFromBCRSMatrix::numFront().

◆ numLocal()

size_t Opm::Linear::DomesticOverlapFromBCRSMatrix::numLocal ( ) const
inline

Returns the number local indices.

I.e. indices in the interior or on the border of the process' domain.

References foreignOverlap_, and Opm::Linear::ForeignOverlapFromBCRSMatrix::numLocal().

Referenced by buildDomesticOverlap_(), domesticToNative(), isLocal(), and updateMasterRanks_().

◆ numNative()

size_t Opm::Linear::DomesticOverlapFromBCRSMatrix::numNative ( ) const
inline

Returns the number native indices.

I.e. the number of indices of the "raw" grid partition of the local process (including the indices in ghost and overlap elements).

References foreignOverlap_, and Opm::Linear::ForeignOverlapFromBCRSMatrix::numNative().

◆ numPeers()

size_t Opm::Linear::DomesticOverlapFromBCRSMatrix::numPeers ( Index  domesticIdx) const
inline

Returns the number of processes which "see" a given index.

References domesticOverlapByIndex_, and mapExternalToInternal_().

Referenced by sendIndicesToPeer_().

◆ overlapSize()

unsigned Opm::Linear::DomesticOverlapFromBCRSMatrix::overlapSize ( ) const
inline

Returns the size of the overlap region.

References foreignOverlap_, and Opm::Linear::ForeignOverlapFromBCRSMatrix::overlapSize().

◆ peerHasIndex()

bool Opm::Linear::DomesticOverlapFromBCRSMatrix::peerHasIndex ( int  peerRank,
Index  domesticIdx 
) const
inline

Returns true iff a domestic index is seen by a peer rank.

References foreignOverlap_, mapExternalToInternal_(), and Opm::Linear::ForeignOverlapFromBCRSMatrix::peerHasIndex().

◆ peerSet()

const PeerSet & Opm::Linear::DomesticOverlapFromBCRSMatrix::peerSet ( ) const
inline

Return the set of process ranks which share an overlap with the current process.

References peerSet_.

◆ print()

void Opm::Linear::DomesticOverlapFromBCRSMatrix::print ( ) const
inline

Print the foreign overlap for debugging purposes.

References globalIndices_, and Opm::Linear::GlobalIndices< ForeignOverlap >::print().

◆ receiveIndicesFromPeer_()

◆ sendIndicesToPeer_()

◆ setupDebugMapping_()

void Opm::Linear::DomesticOverlapFromBCRSMatrix::setupDebugMapping_ ( )
inlineprotected

◆ updateMasterRanks_()

◆ waitSendIndices_()

void Opm::Linear::DomesticOverlapFromBCRSMatrix::waitSendIndices_ ( ProcessRank  peerRank)
inlineprotected

◆ worldSize()

unsigned Opm::Linear::DomesticOverlapFromBCRSMatrix::worldSize ( ) const
inline

Returns the number of processes in the global MPI communicator.

References worldSize_.

Member Data Documentation

◆ blackList_

BlackList Opm::Linear::DomesticOverlapFromBCRSMatrix::blackList_
protected

◆ borderDistance_

std::vector<BorderDistance> Opm::Linear::DomesticOverlapFromBCRSMatrix::borderDistance_
protected

◆ domesticOverlapByIndex_

OverlapByIndex Opm::Linear::DomesticOverlapFromBCRSMatrix::domesticOverlapByIndex_
protected

◆ domesticOverlapWithPeer_

DomesticOverlapByRank Opm::Linear::DomesticOverlapFromBCRSMatrix::domesticOverlapWithPeer_
protected

◆ foreignOverlap_

◆ globalIndices_

GlobalIndices Opm::Linear::DomesticOverlapFromBCRSMatrix::globalIndices_
protected

◆ indicesSendBuffer_

std::map<ProcessRank, MpiBuffer<IndexDistanceNpeers> *> Opm::Linear::DomesticOverlapFromBCRSMatrix::indicesSendBuffer_
protected

◆ masterRank_

std::vector<ProcessRank> Opm::Linear::DomesticOverlapFromBCRSMatrix::masterRank_
protected

Referenced by masterRank(), and updateMasterRanks_().

◆ myRank_

ProcessRank Opm::Linear::DomesticOverlapFromBCRSMatrix::myRank_
protected

◆ numIndicesSendBuffer_

std::map<ProcessRank, MpiBuffer<size_t> *> Opm::Linear::DomesticOverlapFromBCRSMatrix::numIndicesSendBuffer_
protected

◆ peerSet_

PeerSet Opm::Linear::DomesticOverlapFromBCRSMatrix::peerSet_
protected

◆ worldSize_

unsigned Opm::Linear::DomesticOverlapFromBCRSMatrix::worldSize_
protected

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