fpmas 1.6
Public Member Functions | Static Public Attributes | List of all members
fpmas::api::graph::DistributedId Class Reference

#include <distributed_id.h>

Public Member Functions

 DistributedId (const MpiDistributedId &mpi_id)
 
 DistributedId ()
 
 DistributedId (int rank)
 
 DistributedId (int rank, FPMAS_ID_TYPE id)
 
int rank () const
 
FPMAS_ID_TYPE id () const
 
DistributedId operator++ (int)
 
bool operator< (const DistributedId &other) const
 
bool operator<= (const DistributedId &other) const
 
bool operator== (const DistributedId &other) const
 
bool operator!= (const DistributedId &other) const
 
 operator std::string () const
 
std::size_t hash () const
 

Static Public Attributes

static int max_rank = std::numeric_limits<int>::max()
 
static FPMAS_ID_TYPE max_id = std::numeric_limits<FPMAS_ID_TYPE>::max()
 
static MPI_Datatype mpiDistributedIdType
 

Detailed Description

Distributed IdType implementation, used by any DistributedGraph.

The id is represented by a pair constituted by:

  1. The rank on which the item where created
  2. An incrementing local id of type FPMAS_ID_TYPE

Constructor & Destructor Documentation

◆ DistributedId() [1/4]

fpmas::api::graph::DistributedId::DistributedId ( const MpiDistributedId mpi_id)
inlineexplicit

Converts an MpiDistributedId instance into a DistributedId.

Parameters
mpi_idMpiDistributedId to convert

◆ DistributedId() [2/4]

fpmas::api::graph::DistributedId::DistributedId ( )
inline

Default DistributedId constructor.

◆ DistributedId() [3/4]

fpmas::api::graph::DistributedId::DistributedId ( int  rank)
inlineexplicit

Initializes a DistributedId instance for the specified proc.

Local id starts from 0.

Parameters
rankMPI rank

◆ DistributedId() [4/4]

fpmas::api::graph::DistributedId::DistributedId ( int  rank,
FPMAS_ID_TYPE  id 
)
inline

Initializes a DistributedId instance from the specified rank and id.

Parameters
rankMPI rank
idinitial local id value

Member Function Documentation

◆ rank()

int fpmas::api::graph::DistributedId::rank ( ) const
inline

Rank associated to this DistributedId instance.

Returns
MPI rank

◆ id()

FPMAS_ID_TYPE fpmas::api::graph::DistributedId::id ( ) const
inline

Current local id.

Returns
local id

◆ operator++()

DistributedId fpmas::api::graph::DistributedId::operator++ ( int  )
inline

Returns the current DistributedId value and increments its local id.

◆ operator<()

bool fpmas::api::graph::DistributedId::operator< ( const DistributedId other) const
inline

Comparison function that allows DistributedId usage in std::set.

First, perform a comparison on the rank of the two instances, and return the result if one is less or greater than the other.

If the two ranks are equal, return the result of the comparison of the local ids.

◆ operator<=()

bool fpmas::api::graph::DistributedId::operator<= ( const DistributedId other) const
inline

DistributedId comparison function, consistent with the operator==() and operator<() definitions.

◆ operator==()

bool fpmas::api::graph::DistributedId::operator== ( const DistributedId other) const
inline

Two DistributedId instances are equal iff their ranks and their ids are equal.

Returns
comparison result

◆ operator!=()

bool fpmas::api::graph::DistributedId::operator!= ( const DistributedId other) const
inline

Two DistributedId instances are not equal iff their ranks or their ids are different.

Returns
comparison result

◆ operator std::string()

fpmas::api::graph::DistributedId::operator std::string ( ) const
inline
Deprecated:

std::string conversion.

◆ hash()

std::size_t fpmas::api::graph::DistributedId::hash ( ) const
inline

Computes the hash value of this DistributedId.

Returns
hash value

Member Data Documentation

◆ max_rank

int fpmas::DistributedId::max_rank = std::numeric_limits<int>::max()
static

The maximum rank that can be represented.

◆ max_id

FPMAS_ID_TYPE fpmas::DistributedId::max_id = std::numeric_limits<FPMAS_ID_TYPE>::max()
static

The maximum id that can be represented.

This can be controlled defining a custom FPMAS_ID_TYPE.

Overflows, that might occur if the FPMAS_ID_TYPE is not large enough to represent ids of all DistributedNodes and DistributedEdges created during a single simulation, will produce unexpected behaviors.

◆ mpiDistributedIdType

MPI_Datatype fpmas::api::graph::DistributedId::mpiDistributedIdType
static

MPI_Datatype used to send and receive DistributedIds.

Should be initialized with fpmas::communication::createMpiTypes and freed with fpmas::communication::freeMpiTypes


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