CEPS  24.01
Cardiac ElectroPhysiology Simulator
DistributedInfos< _Type, _Hash > Class Template Reference

Detailed Description

template<class _Type, class _Hash = CepsHash>
class DistributedInfos< _Type, _Hash >

A class that manages data that is distributed between processors, not only real values (as in DistributedVector or DistributedMatrix)

Definition at line 55 of file DistributedInfos.hpp.

#include <DistributedInfos.hpp>

Public Member Functions

 DistributedInfos ()
 Constructor. More...
 
 DistributedInfos (const DistributedInfos &)
 Default copy constructor. More...
 
DistributedInfosoperator= (const DistributedInfos &)
 Default assignment operator. More...
 
 ~DistributedInfos ()
 Destructor. More...
 
LocalGlobalMapping< _Type, _Hash > * getOwnedMapping ()
 Mapping between global and local index of owned data. More...
 
LocalGlobalMapping< _Type, _Hash > * getHaloMapping ()
 Mapping between global and local index of halo data. More...
 
CepsBool hasHash (const _Hash &hashValue, const CepsUInt &pId) const
 Check if container has data with given hash. More...
 
_Type & atHash (const _Hash &hashValue, const CepsUInt &pId, const _Type &def)
 Access with given hash. More...
 
const _Type & atHash (const _Hash &hashValue, const CepsUInt &pId, const _Type &def) const
 const access with given hash More...
 
CepsBool hasLocal (const CepsLocalIndex &localId, const CepsUInt &pId) const
 Check if container has data with given local ID. More...
 
_Type & atLocal (const CepsLocalIndex &localId, const CepsUInt &pId, const _Type &def)
 Access with given local ID. More...
 
const _Type & atLocal (const CepsLocalIndex &localId, const CepsUInt &pId, const _Type &def) const
 const access with given local ID More...
 
CepsBool hasGlobal (const CepsGlobalIndex &globalId, const CepsUInt &pId) const
 Check if container has data with given global ID. More...
 
_Type & atGlobal (const CepsGlobalIndex &globalId, const CepsUInt &pId)
 Access with given global ID. More...
 
const _Type & atGlobal (const CepsGlobalIndex &globalId, const CepsUInt &pId) const
 Access with given global ID. More...
 
_Type & atGlobal (const CepsGlobalIndex &globalId, const CepsUInt &pId, const _Type &def)
 Access with given global ID. More...
 
const _Type & atGlobal (const CepsGlobalIndex &globalId, const CepsUInt &pId, const _Type &def) const
 const access with given global ID More...
 
const CepsVector< _Type > & getOwned () const
 Get data owned by the processor, const. More...
 
CepsVector< _Type > & getOwned ()
 Get data owned by the processor. More...
 
const _Type & getOwned (CepsUInt i) const
 Get data owned by the processor with id i, const. More...
 
_Type & getOwned (CepsUInt i)
 Get data owned by the processor with id i. More...
 
const CepsVector< _Type > & getHalo () const
 Get halo data owned by neighbor processor, const. More...
 
CepsVector< _Type > & getHalo ()
 Get halo data owned by neighbor processor, const. More...
 
const _Type & getHalo (CepsUInt i) const
 Get halo data owned by neighbor processor with ID i, const. More...
 
_Type & getHalo (CepsUInt i)
 Get halo data owned by neighbor processor with ID i, const. More...
 
void add (const _Type &x, const _Hash &hashValue, const CepsGlobalIndex &globalId, const CepsUInt &pId)
 Add entry with global ID to the container, hash must be provided, pId selects owned or halo. More...
 
void addOwned (const _Type &x, const _Hash &hashValue, const CepsGlobalIndex &globalId)
 Add entry with global ID to the container, owned data, hash must be provided. More...
 
void addHalo (const _Type &x, const _Hash &hashValue, const CepsGlobalIndex &globalId, const CepsUInt &fromProcId)
 Add entry with global ID to the container, halo data, hash must be provided. More...
 
void add (const _Type &x, const _Hash &hashValue, const CepsUInt &pId)
 Add an entry to the container, hash must be provided. More...
 
void addOwned (const _Type &x, const _Hash &hashValue)
 Add an entry to the container, hash must be provided, owned data. More...
 
void addHalo (const _Type &x, const _Hash &hashValue, const CepsUInt &fromProcId)
 Add an entry to the container, hash must be provided, halo data. More...
 
void destroyObjects ()
 Clears the contents, keeps structure. More...
 
void reset ()
 Clears the container. More...
 
void synchronize (CepsBool setGlobalIndicesFromLocals, std::function< void(_Type &, CepsGlobalIndex)> update=nullptr)
 Recomputes global indices from all local indices, build correct halo global indices. More...
 
void synchronizeTotalSize ()
 Compute the total number of owned elements. More...
 
CepsUInt getNumberOfOwned () const
 Number of owned data stored. More...
 
CepsUInt getNumberOfHalo () const
 Number of shared data from other process stored. More...
 
CepsUInt getTotalNumberOfEntities () const
 Total number of distributed data amongst all process. More...
 
CepsUInt getGlobalIndexOffset (CepsProcId pId) const
 Return the number of elements on the processes before pId This supposes that synchronizeTotalSize has been called beforehand. Use at your own risk. More...
 

Protected Attributes

LocalGlobalMapping< _Type, _Hash > * m_owned = nullptr
 Proc owned _Type object. More...
 
LocalGlobalMapping< _Type, _Hash > * m_halo = nullptr
 Proc halo _Type object. More...
 
CepsVector< CepsVector< _Hash > > m_toReceiveFrom = {}
 Local Halo hash to receive, grouped by origin processor. More...
 
CepsUInt m_nbGlobalOwned = 0U
 sum of size(m_owned) on whole communicator More...
 
CepsUInt m_nbGlobalHalo = 0U
 sum of size(m_halo) on whole communicator More...
 
CepsVector< CepsUIntm_elementsOffset
 sum of size(m_owned) on processes before owner More...
 

Constructor & Destructor Documentation

◆ DistributedInfos() [1/2]

template<class _Type , class _Hash = CepsHash>
DistributedInfos< _Type, _Hash >::DistributedInfos ( )

Constructor.

◆ DistributedInfos() [2/2]

template<class _Type , class _Hash = CepsHash>
DistributedInfos< _Type, _Hash >::DistributedInfos ( const DistributedInfos< _Type, _Hash > &  )

Default copy constructor.

◆ ~DistributedInfos()

template<class _Type , class _Hash = CepsHash>
DistributedInfos< _Type, _Hash >::~DistributedInfos ( )

Destructor.

Member Function Documentation

◆ add() [1/2]

template<class _Type , class _Hash = CepsHash>
void DistributedInfos< _Type, _Hash >::add ( const _Type &  x,
const _Hash &  hashValue,
const CepsGlobalIndex globalId,
const CepsUInt pId 
)

Add entry with global ID to the container, hash must be provided, pId selects owned or halo.

◆ add() [2/2]

template<class _Type , class _Hash = CepsHash>
void DistributedInfos< _Type, _Hash >::add ( const _Type &  x,
const _Hash &  hashValue,
const CepsUInt pId 
)

Add an entry to the container, hash must be provided.

◆ addHalo() [1/2]

template<class _Type , class _Hash = CepsHash>
void DistributedInfos< _Type, _Hash >::addHalo ( const _Type &  x,
const _Hash &  hashValue,
const CepsGlobalIndex globalId,
const CepsUInt fromProcId 
)

Add entry with global ID to the container, halo data, hash must be provided.

◆ addHalo() [2/2]

template<class _Type , class _Hash = CepsHash>
void DistributedInfos< _Type, _Hash >::addHalo ( const _Type &  x,
const _Hash &  hashValue,
const CepsUInt fromProcId 
)

Add an entry to the container, hash must be provided, halo data.

◆ addOwned() [1/2]

template<class _Type , class _Hash = CepsHash>
void DistributedInfos< _Type, _Hash >::addOwned ( const _Type &  x,
const _Hash &  hashValue 
)

Add an entry to the container, hash must be provided, owned data.

◆ addOwned() [2/2]

template<class _Type , class _Hash = CepsHash>
void DistributedInfos< _Type, _Hash >::addOwned ( const _Type &  x,
const _Hash &  hashValue,
const CepsGlobalIndex globalId 
)

Add entry with global ID to the container, owned data, hash must be provided.

◆ atGlobal() [1/4]

template<class _Type , class _Hash = CepsHash>
_Type& DistributedInfos< _Type, _Hash >::atGlobal ( const CepsGlobalIndex globalId,
const CepsUInt pId 
)

Access with given global ID.

◆ atGlobal() [2/4]

template<class _Type , class _Hash = CepsHash>
const _Type& DistributedInfos< _Type, _Hash >::atGlobal ( const CepsGlobalIndex globalId,
const CepsUInt pId 
) const

Access with given global ID.

◆ atGlobal() [3/4]

template<class _Type , class _Hash = CepsHash>
_Type& DistributedInfos< _Type, _Hash >::atGlobal ( const CepsGlobalIndex globalId,
const CepsUInt pId,
const _Type &  def 
)

Access with given global ID.

◆ atGlobal() [4/4]

template<class _Type , class _Hash = CepsHash>
const _Type& DistributedInfos< _Type, _Hash >::atGlobal ( const CepsGlobalIndex globalId,
const CepsUInt pId,
const _Type &  def 
) const

const access with given global ID

◆ atHash() [1/2]

template<class _Type , class _Hash = CepsHash>
_Type& DistributedInfos< _Type, _Hash >::atHash ( const _Hash &  hashValue,
const CepsUInt pId,
const _Type &  def 
)

Access with given hash.

◆ atHash() [2/2]

template<class _Type , class _Hash = CepsHash>
const _Type& DistributedInfos< _Type, _Hash >::atHash ( const _Hash &  hashValue,
const CepsUInt pId,
const _Type &  def 
) const

const access with given hash

◆ atLocal() [1/2]

template<class _Type , class _Hash = CepsHash>
_Type& DistributedInfos< _Type, _Hash >::atLocal ( const CepsLocalIndex localId,
const CepsUInt pId,
const _Type &  def 
)

Access with given local ID.

◆ atLocal() [2/2]

template<class _Type , class _Hash = CepsHash>
const _Type& DistributedInfos< _Type, _Hash >::atLocal ( const CepsLocalIndex localId,
const CepsUInt pId,
const _Type &  def 
) const

const access with given local ID

◆ destroyObjects()

template<class _Type , class _Hash = CepsHash>
void DistributedInfos< _Type, _Hash >::destroyObjects ( )

Clears the contents, keeps structure.

◆ getGlobalIndexOffset()

template<class _Type , class _Hash = CepsHash>
CepsUInt DistributedInfos< _Type, _Hash >::getGlobalIndexOffset ( CepsProcId  pId) const

Return the number of elements on the processes before pId This supposes that synchronizeTotalSize has been called beforehand. Use at your own risk.

◆ getHalo() [1/4]

template<class _Type , class _Hash = CepsHash>
CepsVector<_Type>& DistributedInfos< _Type, _Hash >::getHalo ( )

Get halo data owned by neighbor processor, const.

◆ getHalo() [2/4]

template<class _Type , class _Hash = CepsHash>
const CepsVector<_Type>& DistributedInfos< _Type, _Hash >::getHalo ( ) const

Get halo data owned by neighbor processor, const.

◆ getHalo() [3/4]

template<class _Type , class _Hash = CepsHash>
_Type& DistributedInfos< _Type, _Hash >::getHalo ( CepsUInt  i)

Get halo data owned by neighbor processor with ID i, const.

◆ getHalo() [4/4]

template<class _Type , class _Hash = CepsHash>
const _Type& DistributedInfos< _Type, _Hash >::getHalo ( CepsUInt  i) const

Get halo data owned by neighbor processor with ID i, const.

◆ getHaloMapping()

template<class _Type , class _Hash = CepsHash>
LocalGlobalMapping<_Type,_Hash>* DistributedInfos< _Type, _Hash >::getHaloMapping ( )

Mapping between global and local index of halo data.

◆ getNumberOfHalo()

template<class _Type , class _Hash = CepsHash>
CepsUInt DistributedInfos< _Type, _Hash >::getNumberOfHalo ( ) const

Number of shared data from other process stored.

◆ getNumberOfOwned()

template<class _Type , class _Hash = CepsHash>
CepsUInt DistributedInfos< _Type, _Hash >::getNumberOfOwned ( ) const

Number of owned data stored.

◆ getOwned() [1/4]

template<class _Type , class _Hash = CepsHash>
CepsVector<_Type>& DistributedInfos< _Type, _Hash >::getOwned ( )

Get data owned by the processor.

◆ getOwned() [2/4]

template<class _Type , class _Hash = CepsHash>
const CepsVector<_Type>& DistributedInfos< _Type, _Hash >::getOwned ( ) const

Get data owned by the processor, const.

◆ getOwned() [3/4]

template<class _Type , class _Hash = CepsHash>
_Type& DistributedInfos< _Type, _Hash >::getOwned ( CepsUInt  i)

Get data owned by the processor with id i.

◆ getOwned() [4/4]

template<class _Type , class _Hash = CepsHash>
const _Type& DistributedInfos< _Type, _Hash >::getOwned ( CepsUInt  i) const

Get data owned by the processor with id i, const.

◆ getOwnedMapping()

template<class _Type , class _Hash = CepsHash>
LocalGlobalMapping<_Type,_Hash>* DistributedInfos< _Type, _Hash >::getOwnedMapping ( )

Mapping between global and local index of owned data.

◆ getTotalNumberOfEntities()

template<class _Type , class _Hash = CepsHash>
CepsUInt DistributedInfos< _Type, _Hash >::getTotalNumberOfEntities ( ) const

Total number of distributed data amongst all process.

◆ hasGlobal()

template<class _Type , class _Hash = CepsHash>
CepsBool DistributedInfos< _Type, _Hash >::hasGlobal ( const CepsGlobalIndex globalId,
const CepsUInt pId 
) const

Check if container has data with given global ID.

◆ hasHash()

template<class _Type , class _Hash = CepsHash>
CepsBool DistributedInfos< _Type, _Hash >::hasHash ( const _Hash &  hashValue,
const CepsUInt pId 
) const

Check if container has data with given hash.

◆ hasLocal()

template<class _Type , class _Hash = CepsHash>
CepsBool DistributedInfos< _Type, _Hash >::hasLocal ( const CepsLocalIndex localId,
const CepsUInt pId 
) const

Check if container has data with given local ID.

◆ operator=()

template<class _Type , class _Hash = CepsHash>
DistributedInfos& DistributedInfos< _Type, _Hash >::operator= ( const DistributedInfos< _Type, _Hash > &  )

Default assignment operator.

◆ reset()

template<class _Type , class _Hash = CepsHash>
void DistributedInfos< _Type, _Hash >::reset ( )

Clears the container.

◆ synchronize()

template<class _Type , class _Hash = CepsHash>
void DistributedInfos< _Type, _Hash >::synchronize ( CepsBool  setGlobalIndicesFromLocals,
std::function< void(_Type &, CepsGlobalIndex)>  update = nullptr 
)

Recomputes global indices from all local indices, build correct halo global indices.

◆ synchronizeTotalSize()

template<class _Type , class _Hash = CepsHash>
void DistributedInfos< _Type, _Hash >::synchronizeTotalSize ( )

Compute the total number of owned elements.

Field Documentation

◆ m_elementsOffset

template<class _Type , class _Hash = CepsHash>
CepsVector<CepsUInt> DistributedInfos< _Type, _Hash >::m_elementsOffset
protected

sum of size(m_owned) on processes before owner

Definition at line 242 of file DistributedInfos.hpp.

◆ m_halo

template<class _Type , class _Hash = CepsHash>
LocalGlobalMapping<_Type,_Hash>* DistributedInfos< _Type, _Hash >::m_halo = nullptr
protected

Proc halo _Type object.

Definition at line 238 of file DistributedInfos.hpp.

◆ m_nbGlobalHalo

template<class _Type , class _Hash = CepsHash>
CepsUInt DistributedInfos< _Type, _Hash >::m_nbGlobalHalo = 0U
protected

sum of size(m_halo) on whole communicator

Definition at line 241 of file DistributedInfos.hpp.

◆ m_nbGlobalOwned

template<class _Type , class _Hash = CepsHash>
CepsUInt DistributedInfos< _Type, _Hash >::m_nbGlobalOwned = 0U
protected

sum of size(m_owned) on whole communicator

Definition at line 240 of file DistributedInfos.hpp.

◆ m_owned

template<class _Type , class _Hash = CepsHash>
LocalGlobalMapping<_Type,_Hash>* DistributedInfos< _Type, _Hash >::m_owned = nullptr
protected

Proc owned _Type object.

Definition at line 237 of file DistributedInfos.hpp.

◆ m_toReceiveFrom

template<class _Type , class _Hash = CepsHash>
CepsVector<CepsVector<_Hash> > DistributedInfos< _Type, _Hash >::m_toReceiveFrom = {}
protected

Local Halo hash to receive, grouped by origin processor.

Definition at line 239 of file DistributedInfos.hpp.


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