9#include <kernel/lafem/dense_vector.hpp> 
   10#include <kernel/lafem/dense_vector_blocked.hpp> 
   11#include <kernel/lafem/vector_mirror.hpp> 
   12#include <kernel/global/gate.hpp> 
   13#include <kernel/global/muxer.hpp> 
   14#include <kernel/assembly/mirror_assembler.hpp> 
   16#include <control/domain/domain_control.hpp> 
   40      template<
typename DomainLevel_, 
typename SpaceLambda_, 
typename Muxer_>
 
   41      void asm_muxer(
const Domain::VirtualLevel<DomainLevel_>& virt_lvl_c, SpaceLambda_&& space_lambda, Muxer_& muxer)
 
   43        typedef typename Muxer_::LocalVectorType VectorType;
 
   44        typedef typename Muxer_::MirrorType MirrorType;
 
   47        if(virt_lvl_c.is_parent())
 
   51          const auto& layer_c = virt_lvl_c.layer_c();
 
   52          const DomainLevel_& level_p = virt_lvl_c.level_p();
 
   55          for(
Index i(0); i < layer_c.child_count(); ++i)
 
   57            const auto* 
child = level_p.find_patch_part(
int(i));
 
   59            MirrorType child_mirror;
 
   61            muxer.push_child(std::move(child_mirror));
 
   66        if(virt_lvl_c.is_child())
 
   68          const auto& layer_c = virt_lvl_c.layer_c();
 
   69          const DomainLevel_& level_c = virt_lvl_c.level_c();
 
   71          Index num_dofs = space_lambda(level_c)->get_num_dofs();
 
   75            layer_c.sibling_comm_ptr(),
 
   76            layer_c.get_parent_rank(),
 
   77            MirrorType::make_identity(num_dofs)
 
   81          muxer.compile(VectorType(num_dofs));
 
  108      template<
typename SysMuxer_, 
typename Muxer0_, 
typename Muxer1_>
 
  109      void build_muxer_tuple(SysMuxer_& muxer_sys, 
const typename SysMuxer_::LocalVectorType& tmpl_vec,
 
  110        const Muxer0_& muxer_0, 
const Muxer1_& muxer_1)
 
  112        typedef typename SysMuxer_::MirrorType SystemMirrorType;
 
  115        XASSERTM(muxer_0.get_sibling_comm() == muxer_1.get_sibling_comm(), 
"muxers have incompatible sibling communicators");
 
  118        if(muxer_0.get_sibling_comm() != 
nullptr)
 
  121          SystemMirrorType parent_mirror;
 
  126          muxer_sys.set_parent(muxer_0.get_sibling_comm(), muxer_0.get_parent_rank(), std::move(parent_mirror));
 
  130        const auto& child_mirrors_0 = muxer_0.get_child_mirrors();
 
  131        const auto& child_mirrors_1 = muxer_1.get_child_mirrors();
 
  134        XASSERT(child_mirrors_0.size() == child_mirrors_1.size());
 
  137        for(std::size_t i(0); i < child_mirrors_0.size(); ++i)
 
  140          SystemMirrorType child_mirror;
 
  145          XASSERTM(!child_mirror.empty(), 
"invalid empty mirror");
 
  146          muxer_sys.push_child(std::move(child_mirror));
 
  150        muxer_sys.compile(tmpl_vec);
 
  179      template<
typename SysMuxer_, 
typename Muxer0_, 
typename Muxer1_, 
typename Muxer2_>
 
  180      void build_muxer_tuple(SysMuxer_& muxer_sys, 
const typename SysMuxer_::LocalVectorType& tmpl_vec,
 
  181        const Muxer0_& muxer_0, 
const Muxer1_& muxer_1, 
const Muxer2_& muxer_2)
 
  183        typedef typename SysMuxer_::MirrorType SystemMirrorType;
 
  186        XASSERTM(muxer_0.get_sibling_comm() == muxer_1.get_sibling_comm(), 
"muxers have incompatible sibling communicators");
 
  187        XASSERTM(muxer_0.get_sibling_comm() == muxer_2.get_sibling_comm(), 
"muxers have incompatible sibling communicators");
 
  190        if(muxer_0.get_sibling_comm() != 
nullptr)
 
  193          SystemMirrorType parent_mirror;
 
  199          muxer_sys.set_parent(muxer_0.get_sibling_comm(), muxer_0.get_parent_rank(), std::move(parent_mirror));
 
  203        const auto& child_mirrors_0 = muxer_0.get_child_mirrors();
 
  204        const auto& child_mirrors_1 = muxer_1.get_child_mirrors();
 
  205        const auto& child_mirrors_2 = muxer_2.get_child_mirrors();
 
  208        XASSERT(child_mirrors_0.size() == child_mirrors_1.size());
 
  209        XASSERT(child_mirrors_0.size() == child_mirrors_2.size());
 
  212        for(std::size_t i(0); i < child_mirrors_0.size(); ++i)
 
  215          SystemMirrorType child_mirror;
 
  221          XASSERTM(!child_mirror.empty(), 
"invalid empty mirror");
 
  222          muxer_sys.push_child(std::move(child_mirror));
 
  226        muxer_sys.compile(tmpl_vec);
 
#define XASSERT(expr)
Assertion macro definition.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
static void assemble_mirror(LAFEM::VectorMirror< DataType_, IndexType_ > &vec_mirror, const Space_ &space, const MeshPart_ &mesh_part)
Assembles a VectorMirror from a space and a mesh-part.
@ child
indicates that the level is a child level
std::uint64_t Index
Index data type.