9#include <kernel/lafem/meta_element.hpp>
31 template<
typename,
typename...>
45 typedef typename First_::VectorType VectorType;
48 template <
typename DT2_ = DataType,
typename IT2_ = IndexType>
54 template <
typename DT2_ = DataType,
typename IT2_ = IndexType>
58 static_assert(std::is_same<DataType, typename RestClass::DataType>::value,
59 "sub-filters have different data-types");
60 static_assert(std::is_same<IndexType, typename RestClass::IndexType>::value,
61 "sub-filters have different index-types");
71 _first(std::move(the_first)),
72 _rest(std::move(the_rest))
83 explicit FilterChain(First_&& the_first, Rest_&&... the_rest) :
84 _first(std::move(the_first)),
85 _rest(std::move(the_rest...))
101 _first = std::move(other._first);
102 _rest = std::move(other._rest);
116 _first.clone(other._first.get_filter_vector(), clone_mode);
120 template<
typename... SubFilter2_>
123 _first.convert(other._first);
124 _rest.convert(other._rest);
139 const First_& first()
const
149 const RestClass&
rest()
const
156 typename TupleElement<i_, First_, Rest_...>::Type& at()
158 static_assert((0 <= i_) && (i_ <
num_blocks),
"invalid sub-filter index");
159 return TupleElement<i_, First_, Rest_...>::get(*
this);
166 static_assert((0 <= i_) && (i_ <
num_blocks),
"invalid sub-filter index");
171 template<
typename Vector_>
174 first().filter_rhs(vector);
175 rest().filter_rhs(vector);
179 template<
typename Vector_>
182 first().filter_sol(vector);
183 rest().filter_sol(vector);
187 template<
typename Vector_>
190 first().filter_def(vector);
191 rest().filter_def(vector);
195 template<
typename Vector_>
198 first().filter_cor(vector);
199 rest().filter_cor(vector);
203 template<
typename Matrix_>
206 first().filter_mat(matrix);
207 rest().filter_mat(matrix);
212 template<
typename First_>
213 class FilterChain<First_>
215 template<
typename,
typename...>
216 friend class FilterChain;
222 typedef typename First_::DataType
DataType;
224 typedef typename First_::IndexType
IndexType;
226 template <
typename DT2_ = DataType,
typename IT2_ = IndexType>
227 using FilterType = FilterChain<typename First_::template FilterType<DT2_, IT2_> >;
240 explicit FilterChain(First_&& the_first) :
241 _first(std::move(the_first))
246 FilterChain(FilterChain&& other) :
252 FilterChain&
operator=(FilterChain&& other)
264 return FilterChain(
_first.clone(clone_mode));
270 _first.clone(
other._first.get_filter_vector(), clone_mode);
273 template<
typename SubFilter2_>
274 void convert(
const FilterChain<SubFilter2_>& other)
280 std::size_t
bytes()
const
290 const First_& first()
const
296 typename TupleElement<i_, First_>::Type& at()
298 static_assert(i_ == 0,
"invalid sub-filter index");
303 typename TupleElement<i_, First_>::Type
const& at()
const
305 static_assert(i_ == 0,
"invalid sub-filter index");
310 template<
typename Vector_>
313 first().filter_rhs(vector);
317 template<
typename Vector_>
320 first().filter_sol(vector);
324 template<
typename Vector_>
327 first().filter_def(vector);
331 template<
typename Vector_>
334 first().filter_cor(vector);
338 template<
typename Matrix_>
341 first().filter_mat(matrix);
Filter Chainclass template.
First_::DataType DataType
sub-filter data-type
void filter_cor(Vector_ &vector) const
Applies the filter onto a correction vector.
void filter_sol(Vector_ &vector) const
Applies the filter onto the solution vector.
FilterChain & operator=(FilterChain &&other)
move-assign operator
First_::IndexType IndexType
sub-filter index-type
RestClass _rest
all remaining sub-filters
FilterChain clone(CloneMode clone_mode=CloneMode::Deep) const
Creates a clone of itself.
FilterChain< typename First_::template FilterType< DT2_, IT2_ >, typename Rest_::template FilterType< DT2_, IT2_ >... > FilterType
Our 'base' class type.
void filter_mat(Matrix_ &matrix) const
Applies the filter onto a system matrix.
void clone(const FilterChain &other, CloneMode clone_mode=CloneMode::Deep)
Clones data from another FilterChain.
TupleElement< i_, First_, Rest_... >::Type const & at() const
First_ _first
the first sub-filter
void filter_rhs(Vector_ &vector) const
Applies the filter onto the right-hand-side vector.
FilterChain(First_ &&the_first, RestClass &&the_rest)
data-emplacement ctor; this one is protected for a reason
std::size_t bytes() const
Returns the total amount of bytes allocated.
FilterChain(First_ &&the_first, Rest_ &&... the_rest)
sub-filter emplacement ctor
FilterChain()
default ctor
static constexpr int num_blocks
number of vector blocks
FilterChain(FilterChain &&other)
move-ctor
void filter_def(Vector_ &vector) const
Applies the filter onto a defect vector.
@ other
generic/other permutation strategy
@ rest
restriction (multigrid)
Tuple container element helper class template.