NiHu  2.0
formalism.hpp
Go to the documentation of this file.
1 // This file is a part of NiHu, a C++ BEM template library.
2 //
3 // Copyright (C) 2012-2014 Peter Fiala <fiala@hit.bme.hu>
4 // Copyright (C) 2012-2014 Peter Rucz <rucz@hit.bme.hu>
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
24 #ifndef FORMALISM_HPP
25 #define FORMALISM_HPP
26 
27 #include "field.hpp"
28 #include <type_traits>
29 
30 namespace NiHu
31 {
32 
34 namespace formalism
35 {
37  struct general { typedef general type; };
39  struct collocational { typedef collocational type; };
40 }
41 
46 template <class TestField, class TrialField, class = void>
48 
50 template <class TestField, class TrialField>
51 struct get_formalism<TestField, TrialField, typename std::enable_if<
52  field_traits::is_dirac<TestField>::value && !field_traits::is_dirac<TrialField>::value
53  >::type
55 
56 
58 template <class TestField, class TrialField>
59 struct get_formalism<TestField, TrialField,
60  typename std::enable_if<
61  !field_traits::is_dirac<TestField>::value && !field_traits::is_dirac<TrialField>::value
62  >::type
63 > : formalism::general {};
64 
65 
66 
68 template <class TestField, class TrialField>
69 struct is_collocational : std::is_same<
70  typename get_formalism<TestField, TrialField>::type,
71  formalism::collocational
72 > {};
73 
74 } // end of namespace NiHu
75 
76 
77 #endif
NiHu::formalism::collocational
collocational case when the test field is Dirac
Definition: formalism.hpp:39
NiHu::is_collocational
metafunction to determine if formalism is collocational
Definition: formalism.hpp:69
NiHu::formalism::general
general case when the test field is not Dirac
Definition: formalism.hpp:37
field.hpp
implementation of fields and field views
NiHu::get_formalism
return formalism from Test and Trial field types
Definition: formalism.hpp:47