FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
FEAT::Global::Muxer< LocalVector_, Mirror_ > Class Template Reference

Global multiplexer/demultiplexer implementation. More...

#include <muxer.hpp>

Public Types

typedef LAFEM::DenseVector< DataType, IndexTypeBufferType
 the internal buffer vector type More...
 
typedef LocalVector_::DataType DataType
 the data type More...
 
typedef LocalVector_::IndexType IndexType
 the index type More...
 
typedef LocalVector_ LocalVectorType
 the local vector type More...
 
typedef Mirror_ MirrorType
 the mirror type More...
 
template<typename LocalVector2_ , typename Mirror2_ >
using MuxerType = Muxer< LocalVector2_, Mirror2_ >
 Our 'base' class type. More...
 
template<typename DataType2_ , typename IndexType2_ >
using MuxerTypeByDI = Muxer< typename LocalVector_::template ContainerType< DataType2_, IndexType2_ >, typename Mirror_::template MirrorType< DataType2_, IndexType2_ > >
 this typedef lets you create a gate container with new Data and Index types More...
 

Public Member Functions

 Muxer ()
 standard constructor More...
 
 Muxer (Muxer &&other)
 move-constructor More...
 
virtual ~Muxer ()
 virtual destructor More...
 
std::size_t bytes () const
 Returns the internal data size in bytes. More...
 
void compile (const LocalVector_ &vec_tmp_)
 Compiles the muxer. More...
 
template<typename LVT2_ >
void convert (const Muxer< LVT2_, Mirror_ > &other, LocalVector_ &&vector, LAFEM::CloneMode mode=LAFEM::CloneMode::Shallow)
 Conversion function for different vector container type. More...
 
template<typename LVT2_ , typename MT2_ >
void convert (const Muxer< LVT2_, MT2_ > &other)
 Conversion function for same vector container type but with different MDI-Type. More...
 
const std::vector< Mirror_ > & get_child_mirrors () const
 Returns the child mirror vector. More...
 
const Mirror_ & get_parent_mirror () const
 Returns the parent mirror. More...
 
int get_parent_rank () const
 Returns the parent rank. More...
 
const Dist::Commget_sibling_comm () const
 Returns the sibling communicator. More...
 
bool is_child () const
 Specifies whether this process represents a child in the muxer. More...
 
bool is_ghost () const
 Specifies whether this process is a ghost in the muxer. More...
 
bool is_parent () const
 Specifies whether this process represents a parent in the muxer. More...
 
void join (const LocalVector_ &vec_src, LocalVector_ &vec_trg) const
 Performs a join operation on the parent process. More...
 
void join_send (const LocalVector_ &vec_src) const
 Sends a join operation to the parent process. More...
 
Muxeroperator= (Muxer &&other)
 move-assignment operator More...
 
void push_child (Mirror_ &&child_mirror)
 Adds a child rank and mirror for a parent process. More...
 
void set_parent (const Dist::Comm *sibling_comm_, int parent_rank, Mirror_ &&parent_mirror)
 Sets the sibling communicator. More...
 
void split (LocalVector_ &vec_trg, const LocalVector_ &vec_src) const
 Performs a split operation on the parent process. More...
 
void split_recv (LocalVector_ &vec_trg) const
 Receives a split operation from the parent process. More...
 

Public Attributes

Index _buffer_size
 buffer size More...
 
std::vector< Mirror_ > _child_mirrors
 child mirrors (only on parent) More...
 
Mirror_ _parent_mirror
 parent mirror (on all children) More...
 
int _parent_rank
 the rank of the parent More...
 
const Dist::Comm_sibling_comm
 the sibling communicator More...
 

Detailed Description

template<typename LocalVector_, typename Mirror_>
class FEAT::Global::Muxer< LocalVector_, Mirror_ >

Global multiplexer/demultiplexer implementation.

This class provides the functionality for the transfer of primal and dual vectors between different (nested) partitionings in the domain decomposition approach, including the N:1 joining and 1:N splitting of vectors from a partitioned mesh to the unpartitioned mesh, which is provided by the Global::Splitter class, which uses the Global::Muxer to outsource the actual dirty work. This class is effectively only required by an application directly when using a multigrid hierarchy in combination with recursive partitioning.

Just like Gate class, each Muxer object is bound to a single space-vector pair, so if you require muxer functionality for different vector types, you have to create a different Muxer for each space-vector type pair. You can also utilize the convert() functions to create a new Muxer object from an existing one, assuming that the space object is the same.

Template Parameters
LocalVector_The local vector type that the muxer is to be applied onto.
Mirror_The mirror type that is to be used.

To set up an object of this class, one requires various information from the underlying partitioning, especially regarding the parent-child and sibling relations between the processes that are joined/split when transitioning between two partitionings. Basically, the following steps have to be performed:

  1. On each process, call the set_parent() function and provide the sibling communicator, which groups all processes which are to be joined into one parent process, as well as the rank of the remaining parent process with respect to the sibling communicator as well as the identity mirror for all DOFs.
  2. On the parent process, call the push_child() function and provide the mirror for each corresponding child patch, which can be assembled from the 'patch:' meshparts that are (hopefully) generated by the partitioner.
  3. Compile the muxer by calling the compile() function and supplying it with a temporary local vector.

To perform the actual transition between two partitionings, the functions required to be called differ depending on the whether the calling process is a parent process, i.e. it is an active process in both the child and parent communicators, or whether it is only a simple child process, i.e. is only active in the child communicator. On each parent process, the caller has to call the join() or split() functions, which require both the coarse and fine partitioning input/output vectors. On all other child processes, the caller has to call the join_send() function, which only requires the fine partitioning input vector, or the split_recv() function, which only requires the fine partitioning output vector.

Author
Peter Zajac

Definition at line 67 of file muxer.hpp.

Member Typedef Documentation

◆ BufferType

template<typename LocalVector_ , typename Mirror_ >
typedef LAFEM::DenseVector<DataType, IndexType> FEAT::Global::Muxer< LocalVector_, Mirror_ >::BufferType

the internal buffer vector type

Definition at line 79 of file muxer.hpp.

◆ DataType

template<typename LocalVector_ , typename Mirror_ >
typedef LocalVector_::DataType FEAT::Global::Muxer< LocalVector_, Mirror_ >::DataType

the data type

Definition at line 71 of file muxer.hpp.

◆ IndexType

template<typename LocalVector_ , typename Mirror_ >
typedef LocalVector_::IndexType FEAT::Global::Muxer< LocalVector_, Mirror_ >::IndexType

the index type

Definition at line 73 of file muxer.hpp.

◆ LocalVectorType

template<typename LocalVector_ , typename Mirror_ >
typedef LocalVector_ FEAT::Global::Muxer< LocalVector_, Mirror_ >::LocalVectorType

the local vector type

Definition at line 75 of file muxer.hpp.

◆ MirrorType

template<typename LocalVector_ , typename Mirror_ >
typedef Mirror_ FEAT::Global::Muxer< LocalVector_, Mirror_ >::MirrorType

the mirror type

Definition at line 77 of file muxer.hpp.

◆ MuxerType

template<typename LocalVector_ , typename Mirror_ >
template<typename LocalVector2_ , typename Mirror2_ >
using FEAT::Global::Muxer< LocalVector_, Mirror_ >::MuxerType = Muxer<LocalVector2_, Mirror2_>

Our 'base' class type.

Definition at line 83 of file muxer.hpp.

◆ MuxerTypeByDI

template<typename LocalVector_ , typename Mirror_ >
template<typename DataType2_ , typename IndexType2_ >
using FEAT::Global::Muxer< LocalVector_, Mirror_ >::MuxerTypeByDI = Muxer< typename LocalVector_::template ContainerType<DataType2_, IndexType2_>, typename Mirror_::template MirrorType<DataType2_, IndexType2_> >

this typedef lets you create a gate container with new Data and Index types

Definition at line 87 of file muxer.hpp.

Constructor & Destructor Documentation

◆ Muxer() [1/2]

template<typename LocalVector_ , typename Mirror_ >
FEAT::Global::Muxer< LocalVector_, Mirror_ >::Muxer ( )
inline

standard constructor

Definition at line 109 of file muxer.hpp.

◆ Muxer() [2/2]

template<typename LocalVector_ , typename Mirror_ >
FEAT::Global::Muxer< LocalVector_, Mirror_ >::Muxer ( Muxer< LocalVector_, Mirror_ > &&  other)
inline

move-constructor

Definition at line 119 of file muxer.hpp.

◆ ~Muxer()

template<typename LocalVector_ , typename Mirror_ >
virtual FEAT::Global::Muxer< LocalVector_, Mirror_ >::~Muxer ( )
inlinevirtual

virtual destructor

Definition at line 129 of file muxer.hpp.

Member Function Documentation

◆ bytes()

◆ compile()

◆ convert() [1/2]

template<typename LocalVector_ , typename Mirror_ >
template<typename LVT2_ >
void FEAT::Global::Muxer< LocalVector_, Mirror_ >::convert ( const Muxer< LVT2_, Mirror_ > &  other,
LocalVector_ &&  vector,
LAFEM::CloneMode  mode = LAFEM::CloneMode::Shallow 
)
inline

Conversion function for different vector container type.

This function (re)creates this gate from another muxer with a different vector type, but the same mirrors. This can be used to create a gate using DenseVectorBlocked from a muxer using DenseVector or vice versa.

Parameters
[in]otherA (transient) reference to the muxer using the other vector type to create this muxer from.
[in]vectorA temporary vector allocated to the correct size that is to be used for internal initialization.
[in]modeThe clone-mode to be used for cloning the mirrors. Defaults to shallow clone.

Definition at line 188 of file muxer.hpp.

References FEAT::Global::Muxer< LocalVector_, Mirror_ >::compile().

◆ convert() [2/2]

template<typename LocalVector_ , typename Mirror_ >
template<typename LVT2_ , typename MT2_ >
void FEAT::Global::Muxer< LocalVector_, Mirror_ >::convert ( const Muxer< LVT2_, MT2_ > &  other)
inline

Conversion function for same vector container type but with different MDI-Type.

Parameters
[in]otherA transient reference to the muxer to convert from

Definition at line 155 of file muxer.hpp.

Referenced by FEAT::Global::Splitter< LocalVector_, Mirror_ >::convert().

◆ get_child_mirrors()

template<typename LocalVector_ , typename Mirror_ >
const std::vector< Mirror_ > & FEAT::Global::Muxer< LocalVector_, Mirror_ >::get_child_mirrors ( ) const
inline

Returns the child mirror vector.

Returns
The child mirror vector

Definition at line 323 of file muxer.hpp.

References FEAT::Global::Muxer< LocalVector_, Mirror_ >::_child_mirrors.

◆ get_parent_mirror()

template<typename LocalVector_ , typename Mirror_ >
const Mirror_ & FEAT::Global::Muxer< LocalVector_, Mirror_ >::get_parent_mirror ( ) const
inline

Returns the parent mirror.

Returns
The parent mirror

Definition at line 302 of file muxer.hpp.

References FEAT::Global::Muxer< LocalVector_, Mirror_ >::_parent_mirror.

◆ get_parent_rank()

template<typename LocalVector_ , typename Mirror_ >
int FEAT::Global::Muxer< LocalVector_, Mirror_ >::get_parent_rank ( ) const
inline

Returns the parent rank.

Returns
The parent rank

Definition at line 292 of file muxer.hpp.

References FEAT::Global::Muxer< LocalVector_, Mirror_ >::_parent_rank.

◆ get_sibling_comm()

template<typename LocalVector_ , typename Mirror_ >
const Dist::Comm * FEAT::Global::Muxer< LocalVector_, Mirror_ >::get_sibling_comm ( ) const
inline

Returns the sibling communicator.

Returns
The sibling communicator.

Definition at line 260 of file muxer.hpp.

References FEAT::Global::Muxer< LocalVector_, Mirror_ >::_sibling_comm.

Referenced by FEAT::Global::Splitter< LocalVector_, Mirror_ >::is_root(), and FEAT::Global::Splitter< LocalVector_, Mirror_ >::is_single().

◆ is_child()

◆ is_ghost()

template<typename LocalVector_ , typename Mirror_ >
bool FEAT::Global::Muxer< LocalVector_, Mirror_ >::is_ghost ( ) const
inline

Specifies whether this process is a ghost in the muxer.

Note
A ghost is a child process, which is not a parent process.
Returns
true, if this process is a ghost, otherwise false.

Definition at line 250 of file muxer.hpp.

References FEAT::Global::Muxer< LocalVector_, Mirror_ >::is_child(), and FEAT::Global::Muxer< LocalVector_, Mirror_ >::is_parent().

Referenced by FEAT::Global::Transfer< LocalTransfer_, Mirror_ >::is_ghost(), FEAT::Global::Transfer< LocalTransfer_, Mirror_ >::prol_recv(), FEAT::Global::Transfer< LocalTransfer_, Mirror_ >::rest_send(), and FEAT::Global::Transfer< LocalTransfer_, Mirror_ >::trunc_send().

◆ is_parent()

◆ join()

template<typename LocalVector_ , typename Mirror_ >
void FEAT::Global::Muxer< LocalVector_, Mirror_ >::join ( const LocalVector_ &  vec_src,
LocalVector_ &  vec_trg 
) const
inline

◆ join_send()

template<typename LocalVector_ , typename Mirror_ >
void FEAT::Global::Muxer< LocalVector_, Mirror_ >::join_send ( const LocalVector_ &  vec_src) const
inline

Sends a join operation to the parent process.

Parameters
[in]vec_srcA transient reference to the type-0 child vector that is to be joined on the parent process.
Note
This function returns immediately after the parent process has gathered all contributions from its siblings and does not block or barrier any further.

Definition at line 375 of file muxer.hpp.

References FEAT::Global::Muxer< LocalVector_, Mirror_ >::_buffer_size, FEAT::Global::Muxer< LocalVector_, Mirror_ >::_parent_mirror, FEAT::Global::Muxer< LocalVector_, Mirror_ >::_parent_rank, FEAT::Global::Muxer< LocalVector_, Mirror_ >::_sibling_comm, FEAT::LAFEM::DenseVector< DT_, IT_ >::elements(), FEAT::Dist::Comm::gather(), FEAT::Dist::Comm::rank(), FEAT::Dist::Comm::size(), and XASSERT.

Referenced by FEAT::Global::Splitter< LocalVector_, Mirror_ >::join(), FEAT::Global::Transfer< LocalTransfer_, Mirror_ >::rest_send(), and FEAT::Global::Transfer< LocalTransfer_, Mirror_ >::trunc_send().

◆ operator=()

◆ push_child()

template<typename LocalVector_ , typename Mirror_ >
void FEAT::Global::Muxer< LocalVector_, Mirror_ >::push_child ( Mirror_ &&  child_mirror)
inline

Adds a child rank and mirror for a parent process.

Parameters
[in]child_mirrorThe mirror of the child patch of this parent process.

Definition at line 313 of file muxer.hpp.

References FEAT::Global::Muxer< LocalVector_, Mirror_ >::_child_mirrors.

Referenced by FEAT::Global::Splitter< LocalVector_, Mirror_ >::push_patch().

◆ set_parent()

template<typename LocalVector_ , typename Mirror_ >
void FEAT::Global::Muxer< LocalVector_, Mirror_ >::set_parent ( const Dist::Comm sibling_comm_,
int  parent_rank,
Mirror_ &&  parent_mirror 
)
inline

Sets the sibling communicator.

Parameters
[in]sibling_comm_A resident pointer to the sibling communicator.
[in]parent_rankThe rank of the parent process in the sibling comm.
[in]parent_mirrorThe parent mirror.

Definition at line 277 of file muxer.hpp.

References FEAT::Global::Muxer< LocalVector_, Mirror_ >::_parent_mirror, FEAT::Global::Muxer< LocalVector_, Mirror_ >::_parent_rank, FEAT::Global::Muxer< LocalVector_, Mirror_ >::_sibling_comm, and XASSERT.

Referenced by FEAT::Global::Splitter< LocalVector_, Mirror_ >::set_root().

◆ split()

template<typename LocalVector_ , typename Mirror_ >
void FEAT::Global::Muxer< LocalVector_, Mirror_ >::split ( LocalVector_ &  vec_trg,
const LocalVector_ &  vec_src 
) const
inline

◆ split_recv()

template<typename LocalVector_ , typename Mirror_ >
void FEAT::Global::Muxer< LocalVector_, Mirror_ >::split_recv ( LocalVector_ &  vec_trg) const
inline

Receives a split operation from the parent process.

Parameters
[out]vec_trgA transient reference to the split type-1 child vector.
Note
This function posts a blocking scatter which will only unblock once the parent process has scattered the data to all its siblings.

Definition at line 449 of file muxer.hpp.

References FEAT::Global::Muxer< LocalVector_, Mirror_ >::_buffer_size, FEAT::Global::Muxer< LocalVector_, Mirror_ >::_parent_mirror, FEAT::Global::Muxer< LocalVector_, Mirror_ >::_parent_rank, FEAT::Global::Muxer< LocalVector_, Mirror_ >::_sibling_comm, FEAT::LAFEM::DenseVector< DT_, IT_ >::elements(), FEAT::Dist::Comm::rank(), FEAT::Dist::Comm::scatter(), FEAT::Dist::Comm::size(), and XASSERT.

Referenced by FEAT::Global::Transfer< LocalTransfer_, Mirror_ >::prol_recv(), and FEAT::Global::Splitter< LocalVector_, Mirror_ >::split().

Member Data Documentation

◆ _buffer_size

◆ _child_mirrors

◆ _parent_mirror

◆ _parent_rank

◆ _sibling_comm


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