https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
Moose::MFEM::BlockDistribution Class Reference

Block distribution of a dense global index range [0, n) over the ranks of a communicator: rank r owns [begin(r), end(r)). More...

#include <MFEMDistributedGraph.h>

Public Member Functions

 BlockDistribution (std::int64_t n, int nprocs)
 
int owner (std::int64_t g) const
 Owning rank of global id g, which must lie in [0, n).
 
std::int64_t begin (int rank) const
 
std::int64_t end (int rank) const
 
std::int64_t size () const
 

Private Attributes

std::int64_t _n
 
int _nprocs
 Number of ranks the ids are distributed over.
 

Detailed Description

Block distribution of a dense global index range [0, n) over the ranks of a communicator: rank r owns [begin(r), end(r)).

Used to give every global vertex or component id a unique owning rank without any replicated lookup table.

Definition at line 31 of file MFEMDistributedGraph.h.

Constructor & Destructor Documentation

◆ BlockDistribution()

Moose::MFEM::BlockDistribution::BlockDistribution ( std::int64_t  n,
int  nprocs 
)

Definition at line 44 of file MFEMDistributedGraph.C.

44: _n(n), _nprocs(nprocs) {}
int _nprocs
Number of ranks the ids are distributed over.

Member Function Documentation

◆ begin()

std::int64_t Moose::MFEM::BlockDistribution::begin ( int  rank) const

Definition at line 54 of file MFEMDistributedGraph.C.

55{
56 return rank * _n / _nprocs;
57}

Referenced by Moose::MFEM::distributedSpanningForest(), and Moose::MFEM::fetchLabels().

◆ end()

std::int64_t Moose::MFEM::BlockDistribution::end ( int  rank) const

Definition at line 60 of file MFEMDistributedGraph.C.

61{
62 return (rank + 1) * _n / _nprocs;
63}

Referenced by Moose::MFEM::distributedSpanningForest().

◆ owner()

int Moose::MFEM::BlockDistribution::owner ( std::int64_t  g) const

Owning rank of global id g, which must lie in [0, n).

Definition at line 47 of file MFEMDistributedGraph.C.

48{
49 mooseAssert(g >= 0 && g < _n, "Global id out of range");
50 return static_cast<int>(((g + 1) * _nprocs - 1) / _n);
51}

Referenced by Moose::MFEM::distributedSpanningForest(), and Moose::MFEM::fetchLabels().

◆ size()

std::int64_t Moose::MFEM::BlockDistribution::size ( ) const
inline

Definition at line 40 of file MFEMDistributedGraph.h.

40{ return _n; }

Member Data Documentation

◆ _n

std::int64_t Moose::MFEM::BlockDistribution::_n
private

Definition at line 43 of file MFEMDistributedGraph.h.

Referenced by begin(), end(), owner(), and size().

◆ _nprocs

int Moose::MFEM::BlockDistribution::_nprocs
private

Number of ranks the ids are distributed over.

Definition at line 45 of file MFEMDistributedGraph.h.

Referenced by begin(), end(), and owner().


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