47 obj->setGlobalIndex (idx);
54 template <
class _Type,
class _Hash=CepsHash>
177 const _Hash& hashValue,
209 CepsBool setGlobalIndicesFromLocals,
std::vector< _Type, _Alloc > CepsVector
C++ vector.
CepsIndex CepsGlobalIndex
Many uses. Has to be signed for PETSc.
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
CepsIndex CepsLocalIndex
To use when the indexing is only on one process.
CepsUInt CepsProcId
For CPU indices.
void setGlobalIndexFunction(_Tp *&obj, CepsGlobalIndex idx)
Sets the ID of data to the passed idx.
A class that manages data that is distributed between processors, not only real values (as in Distrib...
CepsUInt getGlobalIndexOffset(CepsProcId pId) const
Return the number of elements on the processes before pId This supposes that synchronizeTotalSize has...
const _Type & getOwned(CepsUInt i) const
Get data owned by the processor with id i, const.
CepsBool hasLocal(const CepsLocalIndex &localId, const CepsUInt &pId) const
Check if container has data with given local ID.
CepsUInt m_nbGlobalHalo
sum of size(m_halo) on whole communicator
CepsUInt getTotalNumberOfEntities() const
Total number of distributed data amongst all process.
void reset()
Clears the container.
LocalGlobalMapping< _Type, _Hash > * m_halo
Proc halo _Type object.
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.
const CepsVector< _Type > & getOwned() const
Get data owned by the processor, const.
~DistributedInfos()
Destructor.
CepsUInt getNumberOfHalo() const
Number of shared data from other process stored.
LocalGlobalMapping< _Type, _Hash > * getHaloMapping()
Mapping between global and local index of halo data.
DistributedInfos & operator=(const DistributedInfos &)
Default assignment operator.
CepsVector< CepsVector< _Hash > > m_toReceiveFrom
Local Halo hash to receive, grouped by origin processor.
DistributedInfos()
Constructor.
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.
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.
void synchronize(CepsBool setGlobalIndicesFromLocals, std::function< void(_Type &, CepsGlobalIndex)> update=nullptr)
Recomputes global indices from all local indices, build correct halo global indices.
CepsBool hasHash(const _Hash &hashValue, const CepsUInt &pId) const
Check if container has data with given hash.
const _Type & atHash(const _Hash &hashValue, const CepsUInt &pId, const _Type &def) const
const access with given hash
void addOwned(const _Type &x, const _Hash &hashValue)
Add an entry to the container, hash must be provided, owned data.
void synchronizeTotalSize()
Compute the total number of owned elements.
CepsUInt m_nbGlobalOwned
sum of size(m_owned) on whole communicator
CepsUInt getNumberOfOwned() const
Number of owned data stored.
LocalGlobalMapping< _Type, _Hash > * getOwnedMapping()
Mapping between global and local index of owned data.
CepsVector< _Type > & getHalo()
Get halo data owned by neighbor processor, const.
_Type & getHalo(CepsUInt i)
Get halo data owned by neighbor processor with ID i, const.
void add(const _Type &x, const _Hash &hashValue, const CepsUInt &pId)
Add an entry to the container, hash must be provided.
_Type & atGlobal(const CepsGlobalIndex &globalId, const CepsUInt &pId)
Access with given global ID.
_Type & atHash(const _Hash &hashValue, const CepsUInt &pId, const _Type &def)
Access with given hash.
LocalGlobalMapping< _Type, _Hash > * m_owned
Proc owned _Type object.
CepsBool hasGlobal(const CepsGlobalIndex &globalId, const CepsUInt &pId) const
Check if container has data with given global ID.
_Type & getOwned(CepsUInt i)
Get data owned by the processor with id i.
const CepsVector< _Type > & getHalo() const
Get halo data owned by neighbor processor, const.
void destroyObjects()
Clears the contents, keeps structure.
_Type & atLocal(const CepsLocalIndex &localId, const CepsUInt &pId, const _Type &def)
Access with given local ID.
_Type & atGlobal(const CepsGlobalIndex &globalId, const CepsUInt &pId, const _Type &def)
Access with given global ID.
const _Type & getHalo(CepsUInt i) const
Get halo data owned by neighbor processor with ID i, const.
void addHalo(const _Type &x, const _Hash &hashValue, const CepsUInt &fromProcId)
Add an entry to the container, hash must be provided, halo data.
const _Type & atLocal(const CepsLocalIndex &localId, const CepsUInt &pId, const _Type &def) const
const access with given local ID
const _Type & atGlobal(const CepsGlobalIndex &globalId, const CepsUInt &pId) const
Access with given global ID.
DistributedInfos(const DistributedInfos &)
Default copy constructor.
CepsVector< CepsUInt > m_elementsOffset
sum of size(m_owned) on processes before owner
CepsVector< _Type > & getOwned()
Get data owned by the processor.
const _Type & atGlobal(const CepsGlobalIndex &globalId, const CepsUInt &pId, const _Type &def) const
const access with given global ID
A map destined for things that have (or could have) a global index and must be distributed amongst CP...