PLaSK library
Loading...
Searching...
No Matches
mixed.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of PLaSK (https://plask.app) by Photonics Group at TUL
3
* Copyright (c) 2022 Lodz University of Technology
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, version 3.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*/
14
#include "
mixed.hpp
"
15
16
namespace
plask
{
17
18
//------------ MixedMaterial -------------------------
19
20
Material::Kind
MixedMaterial::kind
()
const
{
return
Material::MIXED
; }
21
22
void
MixedMaterial::normalizeWeights
() {
23
double
sum
= 0;
24
for
(
auto
& p:
materials
)
sum
+= std::get<1>(p);
25
for
(
auto
& p:
materials
) std::get<1>(p) /=
sum
;
26
}
27
28
MixedMaterial
&
MixedMaterial::add
(
const
shared_ptr<plask::Material> &material,
double
weight
) {
29
materials
.push_back(std::pair<
shared_ptr<Material>
,
double
>(material,
weight
));
30
return
*
this
;
31
}
32
33
std::string
MixedMaterial::name
()
const
{
34
std::string
result
=
"["
;
35
for
(
auto
i =
materials
.begin(); i !=
materials
.end(); ++i) {
36
if
(i !=
materials
.begin())
result
+=
'+'
;
37
result
+= boost::lexical_cast<std::string>(std::get<1>(*i));
38
result
+=
'*'
;
39
result
+= std::get<0>(*i)->name();
40
}
41
result
+=
']'
;
42
return
result
;
43
}
44
45
double
MixedMaterial::A
(
double
T)
const
{
46
return
avg([&](
const
Material
& m) {
return
m.
A
(T); });
47
}
48
49
double
MixedMaterial::absp
(
double
lam,
double
T)
const
{
50
return
avg([&](
const
Material
& m) {
return
m.
absp
(lam, T); });
51
}
52
53
double
MixedMaterial::B
(
double
T)
const
{
54
return
avg([&](
const
Material
& m) {
return
m.
B
(T); });
55
}
56
57
double
MixedMaterial::C
(
double
T)
const
{
58
return
avg([&](
const
Material
& m) {
return
m.
C
(T); });
59
}
60
61
double
MixedMaterial::CB
(
double
T,
double
e
,
char
point)
const
{
62
return
avg([&](
const
Material
& m) {
return
m.
CB
(T,
e
, point); });
63
}
64
65
double
MixedMaterial::chi
(
double
T,
double
e
,
char
point)
const
{
66
return
avg([&](
const
Material
& m) {
return
m.
chi
(T,
e
, point); });
67
}
68
69
Tensor2<double>
MixedMaterial::cond
(
double
T)
const
{
70
return
avg_pairs([&](
const
Material
& m) {
return
m.
cond
(T); });
71
}
72
73
Material::ConductivityType
MixedMaterial::condtype
()
const
{
74
if
(
materials
.size() == 0)
return
CONDUCTIVITY_UNDETERMINED
;
75
Material::ConductivityType
result
=
materials
[0].first->condtype();
76
for
(
auto
mat =
materials
.begin()+1; mat !=
materials
.end(); ++mat)
77
if
(mat->first->condtype() !=
result
)
return
CONDUCTIVITY_UNDETERMINED
;
78
return
result
;
79
}
80
81
double
MixedMaterial::D
(
double
T)
const
{
82
return
avg([&](
const
Material
& m) {
return
m.
D
(T); });
83
}
84
85
double
MixedMaterial::dens
(
double
T)
const
{
86
return
avg([&](
const
Material
& m) {
return
m.
dens
(T); });
87
}
88
89
double
MixedMaterial::Dso
(
double
T,
double
e
)
const
{
90
return
avg([&](
const
Material
& m) {
return
m.
Dso
(T,
e
); });
91
}
92
93
double
MixedMaterial::EactA
(
double
T)
const
{
94
return
avg([&](
const
Material
& m) {
return
m.
EactA
(T); });
95
}
96
double
MixedMaterial::EactD
(
double
T)
const
{
97
return
avg([&](
const
Material
& m) {
return
m.
EactD
(T); });
98
}
99
100
double
MixedMaterial::Eg
(
double
T,
double
e
,
char
point)
const
{
101
return
avg([&](
const
Material
& m) {
return
m.
Eg
(T,
e
, point); });
102
}
103
104
double
MixedMaterial::eps
(
double
T)
const
{
105
return
avg([&](
const
Material
& m) {
return
m.
eps
(T); });
106
}
107
108
double
MixedMaterial::lattC
(
double
T,
char
x)
const
{
109
return
avg([&](
const
Material
& m) {
return
m.
lattC
(T, x); });
110
}
111
112
Tensor2<double>
MixedMaterial::Me
(
double
T,
double
e
,
char
point)
const
{
113
return
avg_pairs([&](
const
Material
& m) {
return
m.
Me
(T,
e
, point); });
114
}
115
116
Tensor2<double>
MixedMaterial::Mh
(
double
T,
double
e
)
const
{
117
return
avg_pairs([&](
const
Material
& m) {
return
m.
Mh
(T,
e
); });
118
}
119
120
Tensor2<double>
MixedMaterial::Mhh
(
double
T,
double
e
)
const
{
121
return
avg_pairs([&](
const
Material
& m) {
return
m.
Mhh
(T,
e
); });
122
}
123
124
Tensor2<double>
MixedMaterial::Mlh
(
double
T,
double
e
)
const
{
125
return
avg_pairs([&](
const
Material
& m) {
return
m.
Mlh
(T,
e
); });
126
}
127
128
double
MixedMaterial::ac
(
double
T)
const
{
129
return
avg([&](
const
Material
& m) {
return
m.
ac
(T); });
130
}
131
132
double
MixedMaterial::av
(
double
T)
const
{
133
return
avg([&](
const
Material
& m) {
return
m.
av
(T); });
134
}
135
136
double
MixedMaterial::b
(
double
T)
const
{
137
return
avg([&](
const
Material
& m) {
return
m.
b
(T); });
138
}
139
140
double
MixedMaterial::d
(
double
T)
const
{
141
return
avg([&](
const
Material
& m) {
return
m.
d
(T); });
142
}
143
144
double
MixedMaterial::c11
(
double
T)
const
{
145
return
avg([&](
const
Material
& m) {
return
m.
c11
(T); });
146
}
147
148
double
MixedMaterial::c12
(
double
T)
const
{
149
return
avg([&](
const
Material
& m) {
return
m.
c12
(T); });
150
}
151
152
double
MixedMaterial::c44
(
double
T)
const
{
153
return
avg([&](
const
Material
& m) {
return
m.
c44
(T); });
154
}
155
156
Tensor2<double>
MixedMaterial::mob
(
double
T)
const
{
157
return
avg_pairs([&](
const
Material
& m) {
return
m.
mob
(T); });
158
}
159
160
double
MixedMaterial::Mso
(
double
T,
double
e
)
const
{
161
return
avg([&](
const
Material
& m) {
return
m.
Mso
(T,
e
); });
162
}
163
164
double
MixedMaterial::Nf
(
double
T)
const
{
165
return
avg([&](
const
Material
& m) {
return
m.
Nf
(T); });
166
}
167
168
double
MixedMaterial::Ni
(
double
T)
const
{
169
return
avg([&](
const
Material
& m) {
return
m.
Ni
(T); });
170
}
171
172
double
MixedMaterial::nr
(
double
lam,
double
T,
double
n
)
const
{
173
return
avg([&](
const
Material
& m) {
return
m.
nr
(lam, T,
n
); });
174
}
175
176
dcomplex
MixedMaterial::Nr
(
double
lam,
double
T,
double
n
)
const
{
177
return
avg([&](
const
Material
& m) {
return
m.
Nr
(lam, T,
n
); });
178
}
179
180
Tensor3<dcomplex>
MixedMaterial::Eps
(
double
lam,
double
T,
double
n
)
const
{
181
Tensor3<dcomplex>
result
;
182
result
.
c00
= avg([&](
const
Material
& m) {
return
m.
Eps
(lam, T,
n
).c00; });
183
result
.c11 = avg([&](
const
Material
& m) {
return
m.
Eps
(lam, T,
n
).
c11
; });
184
result
.c22 = avg([&](
const
Material
& m) {
return
m.
Eps
(lam, T,
n
).c22; });
185
result
.c01 = avg([&](
const
Material
& m) {
return
m.
Eps
(lam, T,
n
).c01; });
186
result
.c10 = avg([&](
const
Material
& m) {
return
m.
Eps
(lam, T,
n
).c10; });
187
result
.c02 = avg([&](
const
Material
& m) {
return
m.
Eps
(lam, T,
n
).c02; });
188
result
.c20 = avg([&](
const
Material
& m) {
return
m.
Eps
(lam, T,
n
).c20; });
189
result
.c12 = avg([&](
const
Material
& m) {
return
m.
Eps
(lam, T,
n
).
c12
; });
190
result
.c21 = avg([&](
const
Material
& m) {
return
m.
Eps
(lam, T,
n
).c21; });
191
return
result
;
192
}
193
194
double
MixedMaterial::cp
(
double
T)
const
{
195
return
avg([&](
const
Material
& m) {
return
m.
cp
(T); });
196
}
197
198
Tensor2<double>
MixedMaterial::thermk
(
double
T,
double
h)
const
{
199
return
avg_pairs([&](
const
Material
& m) {
return
m.
thermk
(T, h); });
200
}
201
202
double
MixedMaterial::VB
(
double
T,
double
e
,
char
point,
char
hole
)
const
{
203
return
avg([&](
const
Material
& m) {
return
m.
VB
(T,
e
, point,
hole
); });
204
}
205
206
207
Tensor2<double>
MixedMaterial::mobe
(
double
T)
const
{
208
return
avg_pairs([&](
const
Material
& m) {
return
m.
mobe
(T); });
209
}
210
211
Tensor2<double>
MixedMaterial::mobh
(
double
T)
const
{
212
return
avg_pairs([&](
const
Material
& m) {
return
m.
mobh
(T); });
213
}
214
215
double
MixedMaterial::taue
(
double
T)
const
{
216
return
avg([&](
const
Material
& m) {
return
m.
taue
(T); });
217
}
218
219
double
MixedMaterial::tauh
(
double
T)
const
{
220
return
avg([&](
const
Material
& m) {
return
m.
tauh
(T); });
221
}
222
223
double
MixedMaterial::Ce
(
double
T)
const
{
224
return
avg([&](
const
Material
& m) {
return
m.
Ce
(T); });
225
}
226
227
double
MixedMaterial::Ch
(
double
T)
const
{
228
return
avg([&](
const
Material
& m) {
return
m.
Ch
(T); });
229
}
230
231
double
MixedMaterial::e13
(
double
T)
const
{
232
return
avg([&](
const
Material
& m) {
return
m.
e13
(T); });
233
}
234
235
double
MixedMaterial::e15
(
double
T)
const
{
236
return
avg([&](
const
Material
& m) {
return
m.
e15
(T); });
237
}
238
239
double
MixedMaterial::e33
(
double
T)
const
{
240
return
avg([&](
const
Material
& m) {
return
m.
e33
(T); });
241
}
242
243
double
MixedMaterial::c13
(
double
T)
const
{
244
return
avg([&](
const
Material
& m) {
return
m.
c13
(T); });
245
}
246
247
double
MixedMaterial::c33
(
double
T)
const
{
248
return
avg([&](
const
Material
& m) {
return
m.
c33
(T); });
249
}
250
251
double
MixedMaterial::Psp
(
double
T)
const
{
252
return
avg([&](
const
Material
& m) {
return
m.
Psp
(T); });
253
}
254
255
double
MixedMaterial::Na
()
const
{
256
return
avg([&](
const
Material
& m) {
return
m.
Na
(); });
257
}
258
259
double
MixedMaterial::Nd
()
const
{
260
return
avg([&](
const
Material
& m) {
return
m.
Nd
(); });
261
}
262
263
264
bool
Material::isEqual
(
const
Material
&other)
const
{
265
return
this->
str
() == other.
str
();
266
}
267
268
}
// namespace plask
plask
material
mixed.cpp
Generated by
1.9.8