9#include <kernel/util/dist.hpp> 
   10#include <kernel/cubature/dynamic_factory.hpp> 
   11#include <kernel/lafem/dense_vector.hpp> 
   12#include <kernel/lafem/sparse_matrix_csr.hpp> 
   13#include <kernel/lafem/unit_filter.hpp> 
   14#include <kernel/lafem/mean_filter.hpp> 
   15#include <kernel/lafem/none_filter.hpp> 
   16#include <kernel/lafem/filter_chain.hpp> 
   17#include <kernel/lafem/filter_sequence.hpp> 
   18#include <kernel/lafem/vector_mirror.hpp> 
   19#include <kernel/lafem/transfer.hpp> 
   20#include <kernel/global/gate.hpp> 
   21#include <kernel/global/muxer.hpp> 
   22#include <kernel/global/vector.hpp> 
   23#include <kernel/global/matrix.hpp> 
   24#include <kernel/global/transfer.hpp> 
   25#include <kernel/global/splitter.hpp> 
   26#include <kernel/global/filter.hpp> 
   27#include <kernel/global/mean_filter.hpp> 
   28#include <kernel/assembly/common_operators.hpp> 
   29#include <kernel/assembly/symbolic_assembler.hpp> 
   30#include <kernel/assembly/domain_assembler_basic_jobs.hpp> 
   31#include <kernel/assembly/bilinear_operator_assembler.hpp> 
   32#include <kernel/assembly/grid_transfer.hpp> 
   33#include <kernel/assembly/mirror_assembler.hpp> 
   34#include <kernel/assembly/mean_filter_assembler.hpp> 
   35#include <kernel/assembly/unit_filter_assembler.hpp> 
   36#include <kernel/analytic/lambda_function.hpp> 
   37#include <kernel/solver/base.hpp> 
   38#include <kernel/solver/iterative.hpp> 
   39#include <kernel/util/property_map.hpp> 
   40#include <kernel/voxel_assembly/poisson_assembler.hpp> 
   42#include <control/domain/domain_control.hpp> 
   43#include <control/asm/gate_asm.hpp> 
   44#include <control/asm/muxer_asm.hpp> 
   45#include <control/asm/splitter_asm.hpp> 
   46#include <control/asm/transfer_asm.hpp> 
   47#include <control/asm/transfer_voxel_asm.hpp> 
   48#include <control/asm/mean_filter_asm.hpp> 
   49#include <control/asm/unit_filter_asm.hpp> 
   58      typename DataType_ = 
Real,
 
   59      typename IndexType_ = 
Index,
 
   60      typename ScalarMatrix_ = LAFEM::SparseMatrixCSR<DataType_, IndexType_>,
 
   61      typename TransferMatrix_ = LAFEM::SparseMatrixCSR<DataType_, IndexType_> >
 
   65      static_assert(std::is_same<DataType_, typename ScalarMatrix_::DataType>::value, 
"DataType mismatch!");
 
   66      static_assert(std::is_same<IndexType_, typename ScalarMatrix_::IndexType>::value, 
"IndexType mismatch!");
 
   69      typedef DataType_ DataType;
 
   70      typedef IndexType_ IndexType;
 
  143        return this->gate_sys.
bytes() + this->coarse_muxer_sys.
bytes() + this->base_splitter_sys.
bytes()
 
  144          + this->transfer_sys.
bytes() + this->matrix_sys.
local().bytes();
 
  147      template<
typename D_, 
typename I_, 
typename SM_>
 
  157      template<
typename DomainLevel_, 
typename SpaceType_>
 
  158      void assemble_gate(
const Domain::VirtualLevel<DomainLevel_>& virt_dom_lvl, 
const SpaceType_& space)
 
  160        Asm::asm_gate(virt_dom_lvl, space, this->gate_sys, 
true);
 
  163      template<
typename DomainLevel_>
 
  164      void assemble_gate(
const Domain::VirtualLevel<DomainLevel_>& virt_dom_lvl)
 
  166        Asm::asm_gate(virt_dom_lvl, virt_dom_lvl->space, this->gate_sys, 
true);
 
  169      template<
typename DomainLevel_>
 
  170      void assemble_coarse_muxer(
const Domain::VirtualLevel<DomainLevel_>& virt_lvl_coarse)
 
  172        Asm::asm_muxer(virt_lvl_coarse, [](
const DomainLevel_& dl){
return &dl.space;}, this->
coarse_muxer_sys);
 
  175      template<
typename DomainLevel_>
 
  176      void assemble_base_splitter(
const Domain::VirtualLevel<DomainLevel_>& virt_lvl)
 
  178        Asm::asm_splitter(virt_lvl, [](
const DomainLevel_& dl){
return &dl.space;}, this->
base_splitter_sys);
 
  181      template<
typename DomainLevel_>
 
  182      void assemble_transfer(
 
  184        const Domain::VirtualLevel<DomainLevel_>& virt_lvl_fine,
 
  185        const Domain::VirtualLevel<DomainLevel_>& virt_lvl_coarse,
 
  186        const String& cubature, 
bool trunc = 
false, 
bool shrink = 
true)
 
  188        Asm::asm_transfer_scalar(virt_lvl_fine, virt_lvl_coarse, cubature, trunc, shrink,
 
  189          [](
const DomainLevel_& dl) {
return &dl.space;},
 
  190          this->transfer_sys.
local(), this->coarse_muxer_sys, this->gate_sys, sys_lvl_coarse.gate_sys);
 
  192        this->transfer_sys.compile();
 
  195      template<
typename DomainLevel_>
 
  196      void assemble_transfer(
 
  197        const Domain::VirtualLevel<DomainLevel_>& virt_lvl_fine,
 
  198        const Domain::VirtualLevel<DomainLevel_>& virt_lvl_coarse,
 
  199        const String& cubature, 
bool trunc = 
false, 
bool shrink = 
true)
 
  202        XASSERT(!virt_lvl_coarse.is_parent());
 
  204        Asm::asm_transfer_scalar(virt_lvl_fine, virt_lvl_coarse, cubature, trunc, shrink,
 
  205          [](
const DomainLevel_& dl) {
return &dl.space;},
 
  206          this->transfer_sys.
local(), this->coarse_muxer_sys, this->gate_sys, this->gate_sys);
 
  208        this->transfer_sys.compile();
 
  211      template<
typename DomainLevel_>
 
  212      void assemble_transfer_voxel(
 
  214        const Domain::VirtualLevel<Domain::VoxelDomainLevelWrapper<DomainLevel_>>& virt_lvl_fine,
 
  215        const Domain::VirtualLevel<Domain::VoxelDomainLevelWrapper<DomainLevel_>>& virt_lvl_coarse,
 
  216        const String& cubature, 
bool trunc = 
false, 
bool shrink = 
true)
 
  218        Asm::asm_transfer_voxel_scalar(virt_lvl_fine, virt_lvl_coarse, cubature, trunc, shrink,
 
  219          [](
const DomainLevel_& dl) {
return &dl.space;},
 
  220          this->transfer_sys.
local(), this->coarse_muxer_sys, this->gate_sys, sys_lvl_coarse.gate_sys);
 
  222        this->transfer_sys.compile();
 
  225      template<
typename DomainLevel_>
 
  226      void assemble_transfer_voxel(
 
  227        const Domain::VirtualLevel<Domain::VoxelDomainLevelWrapper<DomainLevel_>>& virt_lvl_fine,
 
  228        const Domain::VirtualLevel<Domain::VoxelDomainLevelWrapper<DomainLevel_>>& virt_lvl_coarse,
 
  229        const String& cubature, 
bool trunc = 
false, 
bool shrink = 
true)
 
  232        XASSERT(!virt_lvl_coarse.is_parent());
 
  234        Asm::asm_transfer_voxel_scalar(virt_lvl_fine, virt_lvl_coarse, cubature, trunc, shrink,
 
  235          [](
const DomainLevel_& dl) {
return &dl.space;},
 
  236          this->transfer_sys.
local(), this->coarse_muxer_sys, this->gate_sys, this->gate_sys);
 
  238        this->transfer_sys.compile();
 
  241      template<
typename Space_, 
typename Cubature_>
 
  242      void assemble_laplace_matrix(
const Space_& space, 
const Cubature_& cubature, 
const DataType nu = DataType(1))
 
  245        auto& loc_matrix = this->matrix_sys.
local();
 
  248        if(loc_matrix.empty())
 
  255        Assembly::Common::LaplaceOperator laplace_op;
 
  259      template<
typename Trafo_, 
typename Space_>
 
  260      void assemble_laplace_matrix(Assembly::DomainAssembler<Trafo_>& dom_asm, 
const Space_& space, 
const String& cubature, 
const DataType nu = DataType(1))
 
  263        auto& loc_matrix = this->matrix_sys.
local();
 
  266        if(loc_matrix.empty())
 
  273        Assembly::Common::LaplaceOperator laplace_op;
 
  277      template<
typename Space_>
 
  278      void assemble_laplace_voxel_based(
const Adjacency::Coloring& coloring, 
const Space_& space, 
const String& cubature, 
const DataType nu = DataType(1))
 
  281        auto& loc_matrix = this->matrix_sys.
local();
 
  284        if(loc_matrix.empty())
 
  291        VoxelAssembly::VoxelPoissonAssembler<Space_, DataType, IndexType> voxel_assembler(space, coloring);
 
  292        voxel_assembler.assemble_matrix1(loc_matrix, space, Cubature::DynamicFactory(cubature), nu);
 
  295      template<
typename Space_>
 
  296      void symbolic_assembly_std1(
const Space_& space)
 
  299        auto& loc_matrix = this->matrix_sys.
local();
 
  301        ASSERTM(loc_matrix.empty(), 
"Called symbolic assembly on non empty matrix");
 
  309      typename DataType_ = 
Real,
 
  310      typename IndexType_ = 
Index,
 
  311      typename ScalarMatrix_ = LAFEM::SparseMatrixCSR<DataType_, IndexType_> >
 
  319      typedef DataType_ DataType;
 
  320      typedef IndexType_ IndexType;
 
  332      template <
typename DT2_, 
typename IT2_, 
typename ScalarMatrix2_>
 
  357      template<
typename D_, 
typename I_, 
typename SM_>
 
  360        BaseClass::convert(other);
 
  364      template<
typename DomainLevel_, 
typename Space_>
 
  365      void assemble_homogeneous_unit_filter(
const DomainLevel_& dom_level, 
const Space_& space)
 
  367        Asm::asm_unit_filter_scalar_homogeneous(this->filter_sys.local(), dom_level, space, 
"*");
 
  373      typename DataType_ = 
Real,
 
  374      typename IndexType_ = 
Index,
 
  375      typename ScalarMatrix_ = LAFEM::SparseMatrixCSR<DataType_, IndexType_> >
 
  383      typedef DataType_ DataType;
 
  384      typedef IndexType_ IndexType;
 
  396      template <
typename DT2_, 
typename IT2_, 
typename ScalarMatrix2_>
 
  421      template<
typename D_, 
typename I_, 
typename SM_>
 
  424        BaseClass::convert(other);
 
  428      template<
typename Space_, 
typename Cubature_>
 
  429      void assemble_mean_filter(
const Space_& space, 
const Cubature_& cubature)
 
  431        this->filter_sys.local() = Asm::asm_mean_filter(this->gate_sys, space, cubature);
 
  436      typename DataType_ = 
Real,
 
  437      typename IndexType_ = 
Index,
 
  438      typename ScalarMatrix_ = LAFEM::SparseMatrixCSR<DataType_, IndexType_> >
 
  446      typedef DataType_ DataType;
 
  447      typedef IndexType_ IndexType;
 
  462      template <
typename DT2_, 
typename IT2_, 
typename ScalarMatrix2_>
 
  480      template<
typename D_, 
typename I_, 
typename SM_>
 
  483        BaseClass::convert(other);
 
  487      LocalUnitFilterSeq& get_local_unit_filter_seq()
 
  489        return this->filter_sys.local().template at<0>();
 
  494        return get_local_unit_filter_seq().find_or_add(name);
 
  497      LocalMeanFilter& get_local_mean_filter()
 
  499        return this->filter_sys.local().template at<1>();
 
  502      template<
typename DomainLevel_, 
typename Space_>
 
  503      void assemble_unit_filter(
const DomainLevel_& dom_level, 
const Space_& space, 
const String& name, 
const String& mesh_part_names)
 
  505        auto& loc_filter = get_local_unit_filter(name);
 
  507        Asm::asm_unit_filter_scalar_homogeneous(loc_filter, dom_level, space, mesh_part_names);
 
  510      template<
typename DomainLevel_, 
typename Space_, 
typename Function_>
 
  511      void assemble_unit_filter(
const DomainLevel_& dom_level, 
const Space_& space, 
const String& name, 
const String& mesh_part_names, 
const Function_& function)
 
  513        auto& loc_filter = get_local_unit_filter(name);
 
  515        Asm::asm_unit_filter_scalar(loc_filter, dom_level, space, mesh_part_names, function);
 
  518      template<
typename Space_>
 
  519      void assemble_mean_filter(
const Space_& space, 
const String& cubature)
 
  521        get_local_mean_filter() = Asm::asm_mean_filter(this->gate_sys, space, cubature);
 
#define ASSERTM(expr, msg)
Debug-Assertion macro definition with custom message.
#define XASSERT(expr)
Assertion macro definition.
static void assemble_matrix1(Matrix_ &matrix, Operator_ &operat, const Space_ &space, const CubatureFactory_ &cubature_factory, typename Matrix_::DataType alpha=typename Matrix_::DataType(1))
Assembles a bilinear operator into a matrix.
static void assemble_matrix_std1(MatrixType_ &matrix, const Space_ &space)
Assembles a standard matrix structure from a single space.
Global::Muxer< LocalSystemVector, SystemMirror > SystemMuxer
define system muxer
LocalSystemMatrix::VectorTypeR LocalSystemVector
define local system vector type
LAFEM::Transfer< LocalSystemTransferMatrix > LocalSystemTransfer
define local system transfer operator type
SystemGate gate_sys
our system gate
ScalarBasicSystemLevel()
CTOR.
Global::Transfer< LocalSystemTransfer, SystemMirror > GlobalSystemTransfer
define global system transfer operator type
std::size_t bytes() const
Returns the total amount of bytes allocated.
SystemSplitter base_splitter_sys
our base-mesh multiplexer
ScalarMatrix_ LocalScalarMatrix
define local scalar matrix type
LAFEM::VectorMirror< DataType, IndexType > SystemMirror
define system mirror type
TransferMatrix_ LocalSystemTransferMatrix
define local transfer matrix type
GlobalSystemTransfer transfer_sys
our global transfer operator
SystemMuxer coarse_muxer_sys
our coarse-level system muxer
Global::Matrix< LocalSystemMatrix, SystemMirror, SystemMirror > GlobalSystemMatrix
define global system matrix type
Global::Vector< LocalSystemVector, SystemMirror > GlobalSystemVector
define global system vector type
Global::Gate< LocalSystemVector, SystemMirror > SystemGate
define system gate
Global::Splitter< LocalSystemVector, SystemMirror > SystemSplitter
define system splitter
GlobalSystemMatrix matrix_sys
our global system matrix
ScalarMatrix_ LocalSystemMatrix
define local system matrix type
Global::Filter< LocalSystemFilter, SystemMirror > GlobalSystemFilter
define global filter types
LAFEM::VectorMirror< DataType, IndexType > SystemMirror
define system mirror type
std::size_t bytes() const
Returns the total amount of bytes allocated.
GlobalSystemFilter filter_sys
our global system filter
ScalarCombinedSystemLevel()
CTOR.
LAFEM::UnitFilter< DataType, IndexType > LocalUnitFilter
define local filter types
GlobalSystemFilter filter_sys
our global system filter
ScalarMeanFilterSystemLevel()
CTOR.
Global::Filter< LocalSystemFilter, SystemMirror > GlobalSystemFilter
define global filter type
Global::MeanFilter< DataType_, IndexType_ > LocalSystemFilter
define local filter type
std::size_t bytes() const
Returns the total amount of bytes allocated.
void convert(const ScalarMeanFilterSystemLevel< D_, I_, SM_ > &other)
Conversion method.
LAFEM::VectorMirror< DataType, IndexType > SystemMirror
define system mirror type
LAFEM::VectorMirror< DataType, IndexType > SystemMirror
define system mirror type
Global::Filter< LocalSystemFilter, SystemMirror > GlobalSystemFilter
define global filter type
std::size_t bytes() const
Returns the total amount of bytes allocated.
LAFEM::UnitFilter< DataType_, IndexType_ > LocalSystemFilter
define local filter type
GlobalSystemFilter filter_sys
our global system filter
void convert(const ScalarUnitFilterSystemLevel< D_, I_, SM_ > &other)
Conversion method.
ScalarUnitFilterSystemLevel()
CTOR.
Global Filter wrapper class template.
Global gate implementation.
void convert(const Gate< LVT2_, MT2_ > &other)
Conversion function for same vector container type but with different MDI-Type.
std::size_t bytes() const
Returns the total amount of bytes allocated.
Global Matrix wrapper class template.
LocalMatrix_ & local()
Returns a reference to the internal local LAFEM matrix object.
Mean Filter class template.
Global multiplexer/demultiplexer implementation.
std::size_t bytes() const
Returns the internal data size in bytes.
void convert(const Muxer< LVT2_, MT2_ > &other)
Conversion function for same vector container type but with different MDI-Type.
Global base-mesh vector splitter (and joiner) implementation.
std::size_t bytes() const
Returns the internal data size in bytes.
void convert(const Splitter< LVT2_, MT2_ > &other)
Conversion function for same vector container type but with different MDI-Type.
Global grid-transfer operator class template.
void convert(MuxerType *coarse_muxer, const Transfer< LocalTransfer2_, Mirror2_ > &other)
container conversion function
std::size_t bytes() const
Global vector wrapper class template.
Filter Chainclass template.
std::size_t bytes() const
Returns the total amount of bytes allocated.
Sequence of filters of the same type.
Grid-Transfer operator class template.
Unit Filter class template.
std::size_t bytes() const
Returns the total amount of bytes allocated.
Handles vector prolongation, restriction and serialization.
void assemble_bilinear_operator_matrix_1(DomainAssembler< Trafo_ > &dom_asm, Matrix_ &matrix, const BilOp_ &bilinear_operator, const Space_ &space, const String &cubature, const typename Matrix_::DataType alpha=typename Matrix_::DataType(1))
Assembles a bilinear operator into a matrix with identical test- and trial-spaces.
double Real
Real data type.
std::uint64_t Index
Index data type.