10#include <kernel/util/dist.hpp>
11#include <kernel/lafem/dense_vector.hpp>
66 template<
typename LocalVector_,
typename Mirror_>
71 typedef typename LocalVector_::DataType
DataType;
82 template <
typename LocalVector2_,
typename Mirror2_>
86 template <
typename DataType2_,
typename IndexType2_>
88 typename LocalVector_::template ContainerType<DataType2_, IndexType2_>,
143 _child_mirrors = std::forward<std::vector<Mirror_>>(other._child_mirrors);
154 template<
typename LVT2_,
typename MT2_>
157 if((
void*)
this == (
void*)&other)
160 this->_sibling_comm = other._sibling_comm;
161 this->_parent_rank = other._parent_rank;
162 this->_buffer_size = other._buffer_size;
163 this->_parent_mirror.convert(other._parent_mirror);
165 this->_child_mirrors.resize(other._child_mirrors.size());
166 for(std::size_t i(0); i < other._child_mirrors.size(); ++i)
168 this->_child_mirrors.at(i).convert(other._child_mirrors.at(i));
187 template<
typename LVT2_>
190 if((
void*)
this == (
void*)&other)
193 this->_sibling_comm = other._sibling_comm;
194 this->_parent_rank = other._parent_rank;
195 this->_buffer_size =
Index(0);
196 this->_parent_mirror.clone(other._parent_mirror, mode);
198 this->_child_mirrors.clear();
199 this->_child_mirrors.resize(other._child_mirrors.size());
201 for(std::size_t i(0); i < other._child_mirrors.size(); ++i)
203 this->_child_mirrors.at(i).clone(other._child_mirrors.at(i), mode);
207 compile(std::forward<LocalVector_>(vector));
282 XASSERT(parent_rank < _sibling_comm->size());
341 XASSERT(_parent_rank < _sibling_comm->size());
351 bufsize =
Math::max(bufsize, cm.buffer_size(vec_tmp_));
362 this->_buffer_size = bufsize;
401 void join(
const LocalVector_& vec_src, LocalVector_& vec_trg)
const
406 vec_trg.copy(vec_src);
432 for(
Index i(0); i < num_children; ++i)
476 void split(LocalVector_& vec_trg,
const LocalVector_& vec_src)
const
481 vec_trg.copy(vec_src);
497 for(
Index i(0); i < num_children; ++i)
#define XASSERT(expr)
Assertion macro definition.
void scatter(const void *sendbuf, std::size_t sendcount, const Datatype &sendtype, void *recvbuf, std::size_t recvcount, const Datatype &recvtype, int root) const
Blocking scatter.
void bcast(void *buffer, std::size_t count, const Datatype &datatype, int root) const
Blocking broadcast.
int size() const
Returns the size of this communicator.
void gather(const void *sendbuf, std::size_t sendcount, const Datatype &sendtype, void *recvbuf, std::size_t recvcount, const Datatype &recvtype, int root) const
Blocking gather.
int rank() const
Returns the rank of this process in this communicator.
Global multiplexer/demultiplexer implementation.
Muxer(Muxer &&other)
move-constructor
LocalVector_::IndexType IndexType
the index type
bool is_child() const
Specifies whether this process represents a child in the muxer.
std::size_t bytes() const
Returns the internal data size in bytes.
void join_send(const LocalVector_ &vec_src) const
Sends a join operation to the parent process.
Mirror_ _parent_mirror
parent mirror (on all children)
std::vector< Mirror_ > _child_mirrors
child mirrors (only on parent)
Mirror_ MirrorType
the mirror type
void compile(const LocalVector_ &vec_tmp_)
Compiles the muxer.
Index _buffer_size
buffer size
bool is_ghost() const
Specifies whether this process is a ghost in the muxer.
void convert(const Muxer< LVT2_, MT2_ > &other)
Conversion function for same vector container type but with different MDI-Type.
Muxer()
standard constructor
LocalVector_::DataType DataType
the data type
virtual ~Muxer()
virtual destructor
const Mirror_ & get_parent_mirror() const
Returns the parent mirror.
Muxer & operator=(Muxer &&other)
move-assignment operator
const Dist::Comm * get_sibling_comm() const
Returns the sibling communicator.
bool is_parent() const
Specifies whether this process represents a parent in the muxer.
void convert(const Muxer< LVT2_, Mirror_ > &other, LocalVector_ &&vector, LAFEM::CloneMode mode=LAFEM::CloneMode::Shallow)
Conversion function for different vector container type.
void split_recv(LocalVector_ &vec_trg) const
Receives a split operation from the parent process.
int _parent_rank
the rank of the parent
void join(const LocalVector_ &vec_src, LocalVector_ &vec_trg) const
Performs a join operation on the parent process.
LocalVector_ LocalVectorType
the local vector type
const Dist::Comm * _sibling_comm
the sibling communicator
void push_child(Mirror_ &&child_mirror)
Adds a child rank and mirror for a parent process.
int get_parent_rank() const
Returns the parent rank.
void set_parent(const Dist::Comm *sibling_comm_, int parent_rank, Mirror_ &&parent_mirror)
Sets the sibling communicator.
const std::vector< Mirror_ > & get_child_mirrors() const
Returns the child mirror vector.
void split(LocalVector_ &vec_trg, const LocalVector_ &vec_src) const
Performs a split operation on the parent process.
LAFEM::DenseVector< DataType, IndexType > BufferType
the internal buffer vector type
Dense data vector class template.
DT_ * elements()
Get a pointer to the data array.
T_ max(T_ a, T_ b)
Returns the maximum of two values.
std::uint64_t Index
Index data type.