8#include <kernel/lafem/power_vector.hpp>
9#include <kernel/lafem/meta_element.hpp>
37 static_assert(count_ > 1,
"invalid block size");
40 template<
typename,
int>
50 typedef typename SubFilter_::DataType
DataType;
61 template <
typename DT2_ = DataType,
typename IT2_ = IndexType>
65 template <
typename DataType2_,
typename IndexType2_>
76 _first(std::move(the_first)),
77 _rest(std::move(the_rest))
99 _first = std::move(other._first);
100 _rest = std::move(other._rest);
114 _first.clone(other._first.get_filter_vector(), clone_mode);
119 template<
typename SubFilter2_>
122 _first.convert(other._first);
157 static_assert((0 <= i_) && (i_ < count_),
"invalid sub-filter index");
158 return PowerElement<i_, SubFilterType>::get(*
this);
164 static_assert((0 <= i_) && (i_ < count_),
"invalid sub-filter index");
165 return PowerElement<i_, SubFilterType>::get(*
this);
179 XASSERTM((0 <= i) && (i < count_),
"invalid sub-filter index");
186 XASSERTM((0 <= i) && (i < count_),
"invalid sub-filter index");
193 first().filter_rhs(vector.first());
194 rest().filter_rhs(vector.rest());
200 first().filter_sol(vector.first());
201 rest().filter_sol(vector.rest());
207 first().filter_def(vector.first());
208 rest().filter_def(vector.rest());
214 first().filter_cor(vector.first());
215 rest().filter_cor(vector.rest());
220 template<
typename SubFilter_>
221 class PowerFilter<SubFilter_, 1>
223 template<
typename,
int>
224 friend class PowerFilter;
228 typedef typename SubFilter_::DataType
DataType;
229 typedef typename SubFilter_::IndexType
IndexType;
233 typedef PowerVector<typename SubFilter_::VectorType, 1>
VectorType;
235 template <
typename DT2_ = DataType,
typename IT2_ = IndexType>
236 using FilterType = PowerFilter<typename SubFilterType::template FilterType<DT2_, IT2_>,
Index(1)>;
239 template <
typename DataType2_,
typename IndexType2_>
246 _first(std::move(the_first))
256 PowerFilter(PowerFilter&& other) :
261 PowerFilter&
operator=(PowerFilter&& other)
273 return PowerFilter(first().
clone(clone_mode));
279 _first.clone(
other._first.get_filter_vector(), clone_mode);
282 template<
typename SubFilter2_>
283 void convert(
const PowerFilter<SubFilter2_, 1>& other)
289 std::size_t
bytes()
const
307 static_assert(i_ != 0,
"invalid sub-filter index");
314 static_assert(i_ != 0,
"invalid sub-filter index");
320 XASSERTM(i == 0,
"invalid sub-filter index");
326 XASSERTM(i == 0,
"invalid sub-filter index");
332 first().filter_rhs(vector.first());
337 first().filter_sol(vector.first());
342 first().filter_def(vector.first());
347 first().filter_cor(vector.first());
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
PowerVector meta-filter class template.
SubFilter_ SubFilterType
sub-filter type
PowerFilter(PowerFilter &&other)
move CTOR
PowerFilter(SubFilterType &&the_first, RestClass &&the_rest)
base-class ctor; for internal use only
PowerFilter()
default ctor
void filter_sol(VectorType &vector) const
Applies the filter onto the solution vector.
SubFilter_::IndexType IndexType
sub-filter index-type
static constexpr int num_blocks
number of filter blocks
PowerFilter< typename SubFilterType::template FilterType< DT2_, IT2_ >, count_ > FilterType
Our 'base' class type.
PowerFilter & operator=(PowerFilter &&other)
move-assign operator
const SubFilterType & get(int i) const
Returns a sub-filter block.
PowerVector< typename SubFilter_::VectorType, count_ > VectorType
vector type
void filter_def(VectorType &vector) const
Applies the filter onto a defect vector.
std::size_t bytes() const
Returns the total amount of bytes allocated.
void convert(const PowerFilter< SubFilter2_, count_ > &other)
Conversion method.
SubFilter_::DataType DataType
sub-filter data-type
FilterType< DataType2_, IndexType2_ > FilterTypeByDI
this typedef lets you create a filter with different Data and Index types
PowerFilter< SubFilter_, count_-1 > RestClass
base-class typedef
void filter_rhs(VectorType &vector) const
Applies the filter onto the right-hand-side vector.
RestClass _rest
the remaining part
void filter_cor(VectorType &vector) const
Applies the filter onto a correction vector.
PowerFilter clone(CloneMode clone_mode=CloneMode::Deep) const
Creates a clone of itself.
void clone(const PowerFilter &other, CloneMode clone_mode=CloneMode::Deep)
Clones data from another PowerFilter.
SubFilterType _first
the first sub-filter
SubFilterType & get(int i)
Returns a sub-filter block.
Power-Vector meta class template.
@ other
generic/other permutation strategy
@ rest
restriction (multigrid)
std::uint64_t Index
Index data type.