NiHu  2.0
asymptotic_types.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 
23 #ifndef NIHU_ASYMPTOTIC_TYPES_HPP_INCLUDED
24 #define NIHU_ASYMPTOTIC_TYPES_HPP_INCLUDED
25 
26 #include "../tmp/relation.hpp"
27 
28 namespace NiHu
29 {
30 
32 namespace asymptotic
33 {
35  struct regular { typedef regular type; };
36 
40  template <unsigned order>
41  struct log : std::integral_constant<unsigned, order>
42  {
43  typedef log type;
44  };
45 
49  template <unsigned order>
50  struct inverse : std::integral_constant<unsigned, order>
51  {
52  typedef inverse type;
53  };
54 
58  template <int order>
59  struct power : std::integral_constant<int, order>
60  {
61  typedef power type;
62  };
63 } // end of namespace asymptotic
64 
68 template <class SingularityType>
70 
72 template <>
73 struct minimal_reference_dimension<asymptotic::log<1> >
74 {
75  static unsigned const value = 1;
76 };
77 
78 
82 template <unsigned order>
83 struct minimal_reference_dimension<asymptotic::inverse<order> >
84 {
85  static unsigned const value = order+1;
86 };
87 
91 template <int order>
92 struct minimal_reference_dimension<asymptotic::power<order> >
93 {
94  static unsigned const value = -order+1;
95 };
96 
97 } // end of namespace NiHu
98 
99 
100 
101 namespace tmp
102 {
103  template <unsigned o1, unsigned o2>
104  struct less<NiHu::asymptotic::log<o1>, NiHu::asymptotic::log<o2> >
105  : std::integral_constant<bool, (o1 < o2) > {};
106 
107  template <unsigned o1, unsigned o2>
108  struct greater<NiHu::asymptotic::log<o1>, NiHu::asymptotic::log<o2> >
109  : std::integral_constant<bool, (o1 > o2) > {};
110 
111  template <unsigned o1, unsigned o2>
112  struct less<NiHu::asymptotic::inverse<o1>, NiHu::asymptotic::inverse<o2> >
113  : std::integral_constant<bool, (o1 < o2) > {};
114 
115  template <unsigned o1, unsigned o2>
116  struct greater<NiHu::asymptotic::inverse<o1>, NiHu::asymptotic::inverse<o2> >
117  : std::integral_constant<bool, (o1 > o2) > {};
118 
119  template <unsigned o1, unsigned o2>
120  struct less<NiHu::asymptotic::log<o1>, NiHu::asymptotic::inverse<o2> >
121  : std::true_type {};
122 
123  template <unsigned o1, unsigned o2>
124  struct less<NiHu::asymptotic::inverse<o1>, NiHu::asymptotic::log<o2> >
125  : std::false_type {};
126 
127  template <unsigned o1, unsigned o2>
128  struct greater<NiHu::asymptotic::log<o1>, NiHu::asymptotic::inverse<o2> >
129  : std::false_type {};
130 
131  template <unsigned o1, unsigned o2>
132  struct greater<NiHu::asymptotic::inverse<o1>, NiHu::asymptotic::log<o2> >
133  : std::true_type {};
134 }
135 
136 
137 #endif /* NIHU_ASYMPTOTIC_TYPES_HPP_INCLUDED */
138 
tmp::less
General declaration of the less oparation.
Definition: relation.hpp:41
tmp::greater
General declaration of the greater oparation.
Definition: relation.hpp:51
tmp
template metaprogramming functions
Definition: asymptotic_types.hpp:101
NiHu::asymptotic::log
logarithmic singularity with specified order
Definition: asymptotic_types.hpp:41
NiHu::asymptotic::power
power low type singularity with specified order
Definition: asymptotic_types.hpp:59
NiHu::minimal_reference_dimension
returns the minimal reference domain dimension where the singularity can be integrated
Definition: asymptotic_types.hpp:69
NiHu::asymptotic::inverse
inverse singularity with specified order
Definition: asymptotic_types.hpp:50
NiHu::asymptotic::regular
no singularity
Definition: asymptotic_types.hpp:35