Advanced Multi-Physics (AMP)
On-Line Documentation
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
AMP::LinearAlgebra::CommunicationList Class Referencefinal

What to send where and what to receive from where. More...

#include <CommunicationList.h>

Public Member Functions

bool anyCommunication ()
 Returns true if any rank has remote data.
 
void clearBuffers ()
 
 CommunicationList (const AMP_MPI &comm, std::vector< size_t > local, std::vector< size_t > remote)
 Construct a CommunicationList with comunication.
 
 CommunicationList (const std::vector< size_t > &d_partition, const AMP_MPI &comm)
 
 CommunicationList (size_t local, const AMP_MPI &comm)
 Construct a CommunicationList with no comunication.
 
 CommunicationList (std::shared_ptr< const CommunicationListParameters > params)
 Construct a communication list.
 
const AMP_MPIgetComm () const
 Return the communicator used for this communication list.
 
const std::vector< size_t > & getGhostIDList () const
 Retrieve list of global indices shared locally stored elsewhere.
 
uint64_t getID () const
 Get a unique id hash.
 
size_t getLocalGhostID (size_t dof) const
 Return the local index of a shared datum.
 
std::shared_ptr< CommunicationListgetNoCommunicationList ()
 Returns a shared_ptr to a CommunicationList with no data communication.
 
const std::vector< size_t > & getPartition () const
 Retrieve the partition of DOFs.
 
const std::vector< int > & getReceiveDisp () const
 Get the receive displacements.
 
const std::vector< int > & getReceiveSizes () const
 Retrieve number of DOFs received from each rank.
 
const std::vector< size_t > & getReplicatedIDList () const
 Retrieve list of global indices stored here and shared elsewhere.
 
const std::vector< int > & getSendDisp () const
 Get the send displacements.
 
const std::vector< int > & getSendSizes () const
 Retrieve number of DOFs sent to each rank.
 
size_t getStartGID () const
 Return the first d.o.f. on this core.
 
size_t getTotalSize () const
 Return the total d.o.f. on entire communicator.
 
size_t getVectorReceiveBufferSize () const
 Retrieve the size of the buffer used to receive data from other processes.
 
size_t getVectorSendBufferSize () const
 Retrieve the size of the buffer used to send data to other processes.
 
void initialize () const
 
size_t numLocalRows () const
 Return the number of local rows for this communication list.
 
std::shared_ptr< CommunicationListsubset (std::shared_ptr< VectorIndexer > sub)
 Subset a communication list based on a VectorIndexer.
 

Protected Member Functions

 CommunicationList ()
 

Private Attributes

bool d_anyRankRemote = false
 
AMP_MPI d_comm
 
bool d_initialized = false
 
std::vector< size_t > d_partition
 
std::vector< int > d_ReceiveDisp
 
std::vector< size_t > d_ReceiveDOFList
 
std::vector< int > d_ReceiveSizes
 
std::vector< int > d_SendDisp
 
std::vector< size_t > d_SendDOFList
 
std::vector< int > d_SendSizes
 

Detailed Description

What to send where and what to receive from where.

This interface provides communication routines to compute send and receive lists for blocks of data with global indices. For instance, a vector storing degrees of freedom for nodes in a finite element analysis may share data with other cores in a parallel computation. This class tracks which local data need to be communicated with other cores and which data should be received from those cores.

Definition at line 54 of file CommunicationList.h.

Constructor & Destructor Documentation

◆ CommunicationList() [1/5]

AMP::LinearAlgebra::CommunicationList::CommunicationList ( std::shared_ptr< const CommunicationListParameters params)

Construct a communication list.

Parameters
[in]paramsA shared pointer to parameters for constructing the list

This will set the communicator for the communication list. It will not compute the communication lists. Derived classes are expected to call buildCommunicationArrays with appropriate data to compute the communication list This is a blocking call and must be called from all ranks.

◆ CommunicationList() [2/5]

AMP::LinearAlgebra::CommunicationList::CommunicationList ( size_t  local,
const AMP_MPI comm 
)

Construct a CommunicationList with no comunication.

Parameters
[in]localThe number of local elements in the vector
[in]commThe AMP_MPI for the vector.

Create a communication list with no communication. This is a blocking call and must be called from all ranks.

◆ CommunicationList() [3/5]

AMP::LinearAlgebra::CommunicationList::CommunicationList ( const AMP_MPI comm,
std::vector< size_t >  local,
std::vector< size_t >  remote 
)

Construct a CommunicationList with comunication.

Parameters
[in]commThe AMP_MPI for the vector.
[in]localThe number of local elements for each rank
[in]remoteThe remote DOFs that we need to receive on this rank

Create a communication list (advanced interface)

◆ CommunicationList() [4/5]

AMP::LinearAlgebra::CommunicationList::CommunicationList ( const std::vector< size_t > &  d_partition,
const AMP_MPI comm 
)

Constructor for creating CommunicationLists with no communication from an existing CommunicationList object without incurring global communication (meant for internal use only)

◆ CommunicationList() [5/5]

AMP::LinearAlgebra::CommunicationList::CommunicationList ( )
protected

Member Function Documentation

◆ anyCommunication()

bool AMP::LinearAlgebra::CommunicationList::anyCommunication ( )

Returns true if any rank has remote data.

◆ clearBuffers()

void AMP::LinearAlgebra::CommunicationList::clearBuffers ( )

Clears the internal buffers so that they are empty

◆ getComm()

const AMP_MPI & AMP::LinearAlgebra::CommunicationList::getComm ( ) const

Return the communicator used for this communication list.

Returns
The communicator.

◆ getGhostIDList()

const std::vector< size_t > & AMP::LinearAlgebra::CommunicationList::getGhostIDList ( ) const

Retrieve list of global indices shared locally stored elsewhere.

Returns
A vector of indices not owned by the rank but are stored locally.

◆ getID()

uint64_t AMP::LinearAlgebra::CommunicationList::getID ( ) const

Get a unique id hash.

◆ getLocalGhostID()

size_t AMP::LinearAlgebra::CommunicationList::getLocalGhostID ( size_t  dof) const

Return the local index of a shared datum.

Parameters
[in]dofThe global index to get a local ghost id for

It is assumed that data are stored in two arrays: an owned array and a shared array. This function returns the local offset of a shared datum into the shared array

Returns
The index into the shared array for the global index.

◆ getNoCommunicationList()

std::shared_ptr< CommunicationList > AMP::LinearAlgebra::CommunicationList::getNoCommunicationList ( )

Returns a shared_ptr to a CommunicationList with no data communication.

◆ getPartition()

const std::vector< size_t > & AMP::LinearAlgebra::CommunicationList::getPartition ( ) const

Retrieve the partition of DOFs.

Returns
A vector size of comm.getSize() containing the endDOF (getStartGID()+numLocalRows()) for each rank

◆ getReceiveDisp()

const std::vector< int > & AMP::LinearAlgebra::CommunicationList::getReceiveDisp ( ) const

Get the receive displacements.

◆ getReceiveSizes()

const std::vector< int > & AMP::LinearAlgebra::CommunicationList::getReceiveSizes ( ) const

Retrieve number of DOFs received from each rank.

Retrieve number of DOFs received from each rank This is a potentially blocking call and must be called from all ranks. It is only blocking if initialize has not been called first. Users can explicitly call initialize() to avoid this.

Returns
A vector size of comm.getSize() containing the number of DOFs we will receive from each rank

◆ getReplicatedIDList()

const std::vector< size_t > & AMP::LinearAlgebra::CommunicationList::getReplicatedIDList ( ) const

Retrieve list of global indices stored here and shared elsewhere.

This will obtain the list of indices owned by this rank and shared on other rank. This is a potentially blocking call and must be called from all ranks. It is only blocking if initialize has not been called first. Users can explicitly call initialize() to avoid this.

Returns
A vector of indices owned by the rank and shared on other ranks.

◆ getSendDisp()

const std::vector< int > & AMP::LinearAlgebra::CommunicationList::getSendDisp ( ) const

Get the send displacements.

◆ getSendSizes()

const std::vector< int > & AMP::LinearAlgebra::CommunicationList::getSendSizes ( ) const

Retrieve number of DOFs sent to each rank.

Retrieve number of DOFs sent to each rank This is a potentially blocking call and must be called from all ranks. It is only blocking if initialize has not been called first. Users can explicitly call initialize() to avoid this.

Returns
A vector size of comm.getSize() containing the number of DOFs we will sent to each rank

◆ getStartGID()

size_t AMP::LinearAlgebra::CommunicationList::getStartGID ( ) const

Return the first d.o.f. on this core.

Returns
The first d.o.f. on this core

◆ getTotalSize()

size_t AMP::LinearAlgebra::CommunicationList::getTotalSize ( ) const

Return the total d.o.f. on entire communicator.

◆ getVectorReceiveBufferSize()

size_t AMP::LinearAlgebra::CommunicationList::getVectorReceiveBufferSize ( ) const

Retrieve the size of the buffer used to receive data from other processes.

This is an alias of getGhostIDList().size() This is a potentially blocking call and must be called from all ranks. It is only blocking if initialize has not been called first. Users can explicitly call initialize() to avoid this.

Returns
The number of unowned entries on this rank

◆ getVectorSendBufferSize()

size_t AMP::LinearAlgebra::CommunicationList::getVectorSendBufferSize ( ) const

Retrieve the size of the buffer used to send data to other processes.

This is an alias of getReplicatedIDList().size() This is a potentially blocking call and must be called from all ranks. It is only blocking if initialize has not been called first. Users can explicitly call initialize() to avoid this.

Returns
The number of owned entries on this rank shared with other rank

◆ initialize()

void AMP::LinearAlgebra::CommunicationList::initialize ( ) const

◆ numLocalRows()

size_t AMP::LinearAlgebra::CommunicationList::numLocalRows ( ) const

Return the number of local rows for this communication list.

Returns
The number of local d.o.f. for this communication list

◆ subset()

std::shared_ptr< CommunicationList > AMP::LinearAlgebra::CommunicationList::subset ( std::shared_ptr< VectorIndexer sub)

Subset a communication list based on a VectorIndexer.

Parameters
[in]subA VectorIndexer pointer that describes a subset This is a blocking call and must be called from all ranks.

Member Data Documentation

◆ d_anyRankRemote

bool AMP::LinearAlgebra::CommunicationList::d_anyRankRemote = false
mutableprivate

Definition at line 230 of file CommunicationList.h.

◆ d_comm

AMP_MPI AMP::LinearAlgebra::CommunicationList::d_comm
private

Definition at line 228 of file CommunicationList.h.

◆ d_initialized

bool AMP::LinearAlgebra::CommunicationList::d_initialized = false
mutableprivate

Definition at line 229 of file CommunicationList.h.

◆ d_partition

std::vector<size_t> AMP::LinearAlgebra::CommunicationList::d_partition
private

Definition at line 232 of file CommunicationList.h.

◆ d_ReceiveDisp

std::vector<int> AMP::LinearAlgebra::CommunicationList::d_ReceiveDisp
mutableprivate

Definition at line 235 of file CommunicationList.h.

◆ d_ReceiveDOFList

std::vector<size_t> AMP::LinearAlgebra::CommunicationList::d_ReceiveDOFList
private

Definition at line 231 of file CommunicationList.h.

◆ d_ReceiveSizes

std::vector<int> AMP::LinearAlgebra::CommunicationList::d_ReceiveSizes
mutableprivate

Definition at line 234 of file CommunicationList.h.

◆ d_SendDisp

std::vector<int> AMP::LinearAlgebra::CommunicationList::d_SendDisp
mutableprivate

Definition at line 237 of file CommunicationList.h.

◆ d_SendDOFList

std::vector<size_t> AMP::LinearAlgebra::CommunicationList::d_SendDOFList
mutableprivate

Definition at line 233 of file CommunicationList.h.

◆ d_SendSizes

std::vector<int> AMP::LinearAlgebra::CommunicationList::d_SendSizes
mutableprivate

Definition at line 236 of file CommunicationList.h.


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



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:42.
Comments on this page