CEPS
24.01
Cardiac ElectroPhysiology Simulator
|
A map destined for things that have (or could have) a global index and must be distributed amongst CPUs. The class manages the local to global indices mapping, and back.
When placing elements in this map, a hash that is unique and the same across CPUs must be given. This is for communication purposes.
_Type |
Definition at line 48 of file LocalGlobalMapping.hpp.
#include <LocalGlobalMapping.hpp>
Public Member Functions | |
LocalGlobalMapping () | |
Constructor, empty structures. More... | |
~LocalGlobalMapping () | |
Destructor. More... | |
void | reserve (CepsUInt n) |
Prepare room for storage. More... | |
void | append (const _Type &x, const _Hash &hashValue) |
Emplace an element in the map. More... | |
void | append (const _Type &x, const _Hash &hashValue, const CepsGlobalIndex &gId) |
Emplace an element in the map, with an extra global index. More... | |
const CepsVector< _Type > & | all () const |
access to data More... | |
CepsVector< _Type > & | all () |
acces to data More... | |
CepsUInt | size () const |
Number of elements. More... | |
CepsBool | contains (const _Type &x) const |
Tells if the map has the element x. More... | |
void | destroyObjects () |
Wipes content, keeps structure. More... | |
void | reset () |
Wipes content, erase structure. More... | |
void | synchronizeLocalSizes () |
Get info on number of local elements from each CPU. More... | |
void | setGlobalIndicesFromLocals () |
Modifies the local indices by adding the total number of elements on CPUs before self. More... | |
void | updateObjects (std::function< void(_Type &, CepsGlobalIndex)> func) |
Applies function func to all elements stored. More... | |
const CepsVector< CepsUInt > & | getLocalSizes () const |
Number of elements on each CPU synchronize must be called beforehand. More... | |
CepsBool | hasLocal (const CepsLocalIndex &lId) const |
Tells if item with local index lID can be found on this CPU. More... | |
CepsBool | hasGlobal (const CepsGlobalIndex &gId) const |
Tells if item with global index gID can be found on this CPU. More... | |
CepsBool | hasHash (const _Hash &hId) const |
Tells if map contains the hash hID. More... | |
_Type & | atLocal (const CepsLocalIndex &lId, const _Type &def) |
Access value with local ID, with default value. More... | |
const _Type & | atLocal (const CepsLocalIndex &lId, const _Type &def) const |
Access value with local ID, with default value. More... | |
const _Type & | atLocal (const CepsLocalIndex &lId) const |
Access value with local ID. More... | |
_Type & | atLocal (const CepsLocalIndex &lId) |
Access value with local ID. More... | |
const CepsGlobalIndex & | localToGlobal (const CepsLocalIndex &lId) const |
Local index to global index conversion. More... | |
_Type & | atGlobal (const CepsGlobalIndex &gId, const _Type &def) |
Access value with global ID, with default value. More... | |
const _Type & | atGlobal (const CepsGlobalIndex &gId, const _Type &def) const |
Access value with global ID, with default value. More... | |
_Type & | atGlobal (const CepsGlobalIndex &gId) |
Access value with global ID. More... | |
const _Type & | atGlobal (const CepsGlobalIndex &gId) const |
Access value with global ID. More... | |
const CepsLocalIndex & | globalToLocal (const CepsGlobalIndex &gId) const |
Global index to local index conversion. More... | |
_Type & | atHash (const _Hash &hId) |
Access value with given hash, with default value. More... | |
const _Type & | atHash (const _Hash &hId) const |
Access value with given hash, with default value. More... | |
_Type & | atHash (const _Hash &hId, const _Type &def) |
Access value with given hash, with default value. More... | |
const _Type & | atHash (const _Hash &hId, const _Type &def) const |
Access value with given hash, with default value. More... | |
const CepsLocalIndex & | hashToLocal (const _Hash &hId) const |
Access value with given hash. More... | |
const CepsGlobalIndex & | hashToGlobal (const _Hash &hId) const |
Access value with given hash. More... | |
void | registerIndices (const CepsLocalIndex &localId, const CepsGlobalIndex &globalId) |
Stores the pair (localID,globalID) More... | |
Protected Member Functions | |
CepsLocalIndex | pushBack (const _Type &x) |
Adds an element to the map, returns the localID. More... | |
void | registerHash (const CepsLocalIndex &localId, const _Hash &hashValue) |
Stores the localID associated to the hash. More... | |
Protected Attributes | |
CepsVector< _Type > | m_data |
Stored objects. More... | |
CepsMap< _Hash, CepsLocalIndex > | m_hash |
hash map More... | |
CepsMap< CepsGlobalIndex, CepsLocalIndex > | m_globalToLocal |
global local map More... | |
CepsMap< CepsLocalIndex, CepsGlobalIndex > | m_localToGlobal |
reverse map More... | |
CepsVector< CepsUInt > | m_localSizes |
sizes of maps on each cpu More... | |
CepsBool | m_synchronized |
true if sizes were updated More... | |
LocalGlobalMapping< _Type, _Hash >::LocalGlobalMapping | ( | ) |
Constructor, empty structures.
LocalGlobalMapping< _Type, _Hash >::~LocalGlobalMapping | ( | ) |
Destructor.
CepsVector<_Type>& LocalGlobalMapping< _Type, _Hash >::all | ( | ) |
acces to data
const CepsVector<_Type>& LocalGlobalMapping< _Type, _Hash >::all | ( | ) | const |
access to data
void LocalGlobalMapping< _Type, _Hash >::append | ( | const _Type & | x, |
const _Hash & | hashValue | ||
) |
Emplace an element in the map.
x | the element to place |
hashValue | unique identifier for the element |
void LocalGlobalMapping< _Type, _Hash >::append | ( | const _Type & | x, |
const _Hash & | hashValue, | ||
const CepsGlobalIndex & | gId | ||
) |
Emplace an element in the map, with an extra global index.
x | the element to place |
hashValue | unique identifier for the element |
gId | a global index |
_Type& LocalGlobalMapping< _Type, _Hash >::atGlobal | ( | const CepsGlobalIndex & | gId | ) |
Access value with global ID.
const _Type& LocalGlobalMapping< _Type, _Hash >::atGlobal | ( | const CepsGlobalIndex & | gId | ) | const |
Access value with global ID.
_Type& LocalGlobalMapping< _Type, _Hash >::atGlobal | ( | const CepsGlobalIndex & | gId, |
const _Type & | def | ||
) |
Access value with global ID, with default value.
const _Type& LocalGlobalMapping< _Type, _Hash >::atGlobal | ( | const CepsGlobalIndex & | gId, |
const _Type & | def | ||
) | const |
Access value with global ID, with default value.
_Type& LocalGlobalMapping< _Type, _Hash >::atHash | ( | const _Hash & | hId | ) |
Access value with given hash, with default value.
const _Type& LocalGlobalMapping< _Type, _Hash >::atHash | ( | const _Hash & | hId | ) | const |
Access value with given hash, with default value.
_Type& LocalGlobalMapping< _Type, _Hash >::atHash | ( | const _Hash & | hId, |
const _Type & | def | ||
) |
Access value with given hash, with default value.
const _Type& LocalGlobalMapping< _Type, _Hash >::atHash | ( | const _Hash & | hId, |
const _Type & | def | ||
) | const |
Access value with given hash, with default value.
_Type& LocalGlobalMapping< _Type, _Hash >::atLocal | ( | const CepsLocalIndex & | lId | ) |
Access value with local ID.
const _Type& LocalGlobalMapping< _Type, _Hash >::atLocal | ( | const CepsLocalIndex & | lId | ) | const |
Access value with local ID.
_Type& LocalGlobalMapping< _Type, _Hash >::atLocal | ( | const CepsLocalIndex & | lId, |
const _Type & | def | ||
) |
Access value with local ID, with default value.
const _Type& LocalGlobalMapping< _Type, _Hash >::atLocal | ( | const CepsLocalIndex & | lId, |
const _Type & | def | ||
) | const |
Access value with local ID, with default value.
CepsBool LocalGlobalMapping< _Type, _Hash >::contains | ( | const _Type & | x | ) | const |
Tells if the map has the element x.
void LocalGlobalMapping< _Type, _Hash >::destroyObjects | ( | ) |
Wipes content, keeps structure.
const CepsVector<CepsUInt>& LocalGlobalMapping< _Type, _Hash >::getLocalSizes | ( | ) | const |
Number of elements on each CPU synchronize must be called beforehand.
const CepsLocalIndex& LocalGlobalMapping< _Type, _Hash >::globalToLocal | ( | const CepsGlobalIndex & | gId | ) | const |
Global index to local index conversion.
CepsBool LocalGlobalMapping< _Type, _Hash >::hasGlobal | ( | const CepsGlobalIndex & | gId | ) | const |
Tells if item with global index gID can be found on this CPU.
CepsBool LocalGlobalMapping< _Type, _Hash >::hasHash | ( | const _Hash & | hId | ) | const |
Tells if map contains the hash hID.
const CepsGlobalIndex& LocalGlobalMapping< _Type, _Hash >::hashToGlobal | ( | const _Hash & | hId | ) | const |
Access value with given hash.
const CepsLocalIndex& LocalGlobalMapping< _Type, _Hash >::hashToLocal | ( | const _Hash & | hId | ) | const |
Access value with given hash.
CepsBool LocalGlobalMapping< _Type, _Hash >::hasLocal | ( | const CepsLocalIndex & | lId | ) | const |
Tells if item with local index lID can be found on this CPU.
const CepsGlobalIndex& LocalGlobalMapping< _Type, _Hash >::localToGlobal | ( | const CepsLocalIndex & | lId | ) | const |
Local index to global index conversion.
|
protected |
Adds an element to the map, returns the localID.
|
protected |
Stores the localID associated to the hash.
void LocalGlobalMapping< _Type, _Hash >::registerIndices | ( | const CepsLocalIndex & | localId, |
const CepsGlobalIndex & | globalId | ||
) |
Stores the pair (localID,globalID)
void LocalGlobalMapping< _Type, _Hash >::reserve | ( | CepsUInt | n | ) |
Prepare room for storage.
void LocalGlobalMapping< _Type, _Hash >::reset | ( | ) |
Wipes content, erase structure.
void LocalGlobalMapping< _Type, _Hash >::setGlobalIndicesFromLocals | ( | ) |
Modifies the local indices by adding the total number of elements on CPUs before self.
CepsUInt LocalGlobalMapping< _Type, _Hash >::size | ( | ) | const |
Number of elements.
void LocalGlobalMapping< _Type, _Hash >::synchronizeLocalSizes | ( | ) |
Get info on number of local elements from each CPU.
void LocalGlobalMapping< _Type, _Hash >::updateObjects | ( | std::function< void(_Type &, CepsGlobalIndex)> | func | ) |
Applies function func to all elements stored.
func | Has the globalID as second argument |
|
protected |
Stored objects.
Definition at line 212 of file LocalGlobalMapping.hpp.
|
protected |
global local map
Definition at line 214 of file LocalGlobalMapping.hpp.
|
protected |
hash map
Definition at line 213 of file LocalGlobalMapping.hpp.
|
protected |
sizes of maps on each cpu
Definition at line 216 of file LocalGlobalMapping.hpp.
|
protected |
reverse map
Definition at line 215 of file LocalGlobalMapping.hpp.
|
protected |
true if sizes were updated
Definition at line 217 of file LocalGlobalMapping.hpp.