You are here:
Concepts
>
Concepts Web
>
Class documentation
Class documentation of Concepts
Loading...
Searching...
No Matches
bem
kernel.hh
Go to the documentation of this file.
1
6
#ifndef bemKernel_hh
7
#define bemKernel_hh
8
9
#include "
basics/vectorsMatrices.hh
"
10
11
#include <cmath>
12
#ifndef M_1_PI
13
# define M_1_PI 0.31830988618379067154
/* 1/pi */
14
#endif
15
16
namespace
bem
{
17
18
#define KrnlEPS 1e-10
19
20
// ****************************************************************** Cnst **
21
24
class
Cnst
{
25
friend
std::ostream& operator<<(std::ostream& os,
const
Cnst
& c);
26
concepts::Real
c_;
27
28
public
:
29
typedef
concepts::Real
F;
30
31
Cnst
(
concepts::Real
c) : c_(c) {}
32
33
concepts::Real
operator()(
const
concepts::Real3d
&,
const
concepts::Real3d
&)
34
{
return
c_; }
35
};
36
37
// ****************************************************************** Poly **
38
41
class
Poly
{
42
friend
std::ostream& operator<<(std::ostream& os,
const
Poly
& p);
43
bool
var_;
44
uint idx_;
45
uint exp_;
46
47
public
:
48
typedef
concepts::Real
F;
49
50
Poly
(
bool
var, uint idx, uint e)
51
: var_(var), idx_((idx > 2 ? 2 : idx)), exp_(e) {}
52
53
concepts::Real
operator()(
const
concepts::Real3d
& x,
54
const
concepts::Real3d
& y) {
55
concepts::Real
vari = var_ ? y[idx_] : x[idx_];
56
concepts::Real
krnl = 1.0;
57
for
(uint i = 0; i < exp_; i++) krnl *= vari;
58
return
krnl;
59
}
60
};
61
62
// ***************************************************************** ExpR2 **
63
66
class
ExpR2
{
67
friend
std::ostream& operator<<(std::ostream& os,
const
ExpR2
& e);
68
concepts::MapReal3d
gamma_;
69
70
public
:
71
typedef
concepts::Real
F;
72
73
ExpR2
(
concepts::MapReal3d
& gamma) : gamma_(gamma) {}
74
75
concepts::Real
operator()(
const
concepts::Real3d
& x,
76
const
concepts::Real3d
& y) {
77
concepts::Real3d
r(x-y);
78
concepts::Real
e = r * (gamma_ * r);
79
80
return
std::exp(-e);
81
}
82
};
83
84
// ****************************************************************** ExpR **
85
88
class
ExpR
{
89
friend
std::ostream& operator<<(std::ostream& os,
const
ExpR
& e);
90
91
concepts::Real
gamma_;
92
93
public
:
94
typedef
concepts::Real
F;
95
ExpR
(
concepts::Real
gamma) : gamma_(gamma) {}
96
97
concepts::Real
operator()(
const
concepts::Real3d
& x,
98
const
concepts::Real3d
& y) {
99
concepts::Real
r = (x - y).l2();
100
return
std::exp(-gamma_ * r);
101
}
102
};
103
104
// **************************************************************** Inv1Rn **
105
108
class
Inv1Rn
{
109
friend
std::ostream& operator<<(std::ostream& os,
const
Inv1Rn
& krnl);
110
concepts::Real
gamma_;
111
uint n_;
112
113
public
:
114
typedef
concepts::Real
F;
115
116
Inv1Rn
(
concepts::Real
gamma, uint n) : gamma_(gamma), n_(n) {}
117
118
concepts::Real
operator()(
const
concepts::Real3d
& x,
119
const
concepts::Real3d
& y) {
120
concepts::Real
r = (x - y).l2();
121
return
(r < KrnlEPS) ? 1.0
122
: 1.0 / (1.0 + gamma_*std::exp(n_ * std::log(r)));
123
}
124
};
125
126
// *************************************************************** Laplace **
127
130
class
Laplace
{
131
friend
std::ostream& operator<<(std::ostream& os,
const
Laplace
& lpl);
132
const
concepts::Real
sc_;
133
134
public
:
135
typedef
concepts::Real
F;
136
137
Laplace
() : sc_(0.25 * M_1_PI) {}
138
139
concepts::Real
operator()(
const
concepts::Real3d
& x,
140
const
concepts::Real3d
& y) {
141
concepts::Real
r = (x - y).l2();
142
return
sc_ / r;
143
}
144
};
145
146
}
// namespace bem
147
148
#endif
// bemKernel_hh
bem::Cnst
Definition
kernel.hh:24
bem::ExpR2
Definition
kernel.hh:66
bem::ExpR
Definition
kernel.hh:88
bem::Inv1Rn
Definition
kernel.hh:108
bem::Laplace
Definition
kernel.hh:130
bem::Poly
Definition
kernel.hh:41
concepts::Mapping< Real, 3 >
concepts::Point< Real, 3 >
bem
Definition
bem.hh:18
concepts::Real
double Real
Definition
typedefs.hh:39
vectorsMatrices.hh
Generated on Wed Sep 13 2023 21:06:17 for Concepts by
1.9.8