FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
filter.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
8#include <kernel/global/vector.hpp>
9
10namespace FEAT
11{
12 namespace Global
13 {
19 template<typename LocalFilter_, typename Mirror_>
20 class Filter
21 {
22 public:
24 typedef Mirror_ MirrorType;
25 typedef LocalFilter_ LocalFilterType;
26
28 template <typename LocalFilter2_, typename Mirror2_ = Mirror_>
30
32 template <typename DataType2_, typename IndexType2_>
33 using FilterTypeByDI = Filter<typename LocalFilter_::template FilterType<DataType2_, IndexType2_>, typename Mirror_::template MirrorType<DataType2_, IndexType2_> >;
34
35 static constexpr bool is_global = true;
36 static constexpr bool is_local = false;
37
38 protected:
39 LocalFilter_ _filter;
40
41 public:
42 template<typename... Args_>
43 explicit Filter(Args_&&... args) :
44 _filter(std::forward<Args_>(args)...)
45 {
46 }
47
48 LocalFilter_& local()
49 {
50 return _filter;
51 }
52
53 const LocalFilter_& local() const
54 {
55 return _filter;
56 }
57
58 template<typename OtherGlobalFilter_>
59 void convert(const OtherGlobalFilter_ & other)
60 {
61 this->_filter.convert(other.local());
62 }
63
64 Filter clone(LAFEM::CloneMode mode = LAFEM::CloneMode::Weak) const
65 {
66 return Filter(_filter.clone(mode));
67 }
68
69 void clone(const Filter& other, LAFEM::CloneMode mode = LAFEM::CloneMode::Weak)
70 {
71 XASSERTM(&(other.local()) != &(this->local()), "Trying to self-clone a Global::Filter!");
72
73 this->local() = other.local().clone(mode);
74 }
75
77 std::size_t bytes() const
78 {
79 return _filter.bytes();
80 }
81
82 void filter_rhs(VectorType& vector) const
83 {
84 _filter.filter_rhs(vector.local());
85 }
86
87 void filter_sol(VectorType& vector) const
88 {
89 _filter.filter_sol(vector.local());
90 }
91
92 void filter_def(VectorType& vector) const
93 {
94 _filter.filter_def(vector.local());
95 }
96
97 void filter_cor(VectorType& vector) const
98 {
99 _filter.filter_cor(vector.local());
100 }
101 }; // class Filter<...>
102 } // namespace Global
103} // namespace FEAT
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Definition: assertion.hpp:263
Global Filter wrapper class template.
Definition: filter.hpp:21
std::size_t bytes() const
Returns the total amount of bytes allocated.
Definition: filter.hpp:77
Global vector wrapper class template.
Definition: vector.hpp:68
@ other
generic/other permutation strategy
FEAT namespace.
Definition: adjactor.hpp:12