PLaSK library

Loading...
Searching...
No Matches
const_material.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 <boost/algorithm/string.hpp>
15
16#include "const_material.hpp"
17#include "db.hpp"
18#include "../utils/lexical_cast.hpp"
19
20 namespace plask {
21
22 ConstMaterial::ConstMaterial(const std::string& full_name) {
23
24 if (full_name[full_name.size()-1] != ']')
25 throw MaterialParseException("{}: material with custom parameters must end with ']'", full_name);
26
27 auto b = full_name.find('[');
28 std::string basename = full_name.substr(0, b);
29 boost::algorithm::trim_right(basename);
30 if (!basename.empty()) base = MaterialsDB::getDefault().get(basename);
31
32 std::string definition = full_name.substr(b+1, full_name.size()-b-2);
33
34 for (auto item: boost::tokenizer<boost::char_separator<char>>(definition, boost::char_separator<char>(" ,"))) {
35 std::string key, value;
36 std::tie(key, value) = splitString2(item, '=');
37 try {
38 if (key.empty()) {
39 continue;
40 } else if (key == "lattC") {
41 if (cache.lattC) throw MaterialParseException("{}: Repeated parameter 'lattC'", full_name);
42 cache.lattC.reset(boost::lexical_cast<double>(value));
43 } else if (key == "Eg") {
44 if (cache.Eg) throw MaterialParseException("{}: Repeated parameter 'Eg'", full_name);
45 cache.Eg.reset(boost::lexical_cast<double>(value));
46 } else if (key == "CB") {
47 if (cache.CB) throw MaterialParseException("{}: Repeated parameter 'CB'", full_name);
48 cache.CB.reset(boost::lexical_cast<double>(value));
49 } else if (key == "VB") {
50 if (cache.VB) throw MaterialParseException("{}: Repeated parameter 'VB'", full_name);
51 cache.VB.reset(boost::lexical_cast<double>(value));
52 } else if (key == "Dso") {
53 if (cache.Dso) throw MaterialParseException("{}: Repeated parameter 'Dso'", full_name);
54 cache.Dso.reset(boost::lexical_cast<double>(value));
55 } else if (key == "Mso") {
56 if (cache.Mso) throw MaterialParseException("{}: Repeated parameter 'Mso'", full_name);
57 cache.Mso.reset(boost::lexical_cast<double>(value));
58 } else if (key == "Me") {
59 if (cache.Me) throw MaterialParseException("{}: Repeated parameter 'Me'", full_name);
60 cache.Me.reset(boost::lexical_cast<double>(value));
61 } else if (key == "Mhh") {
62 if (cache.Mhh) throw MaterialParseException("{}: Repeated parameter 'Mhh'", full_name);
63 cache.Mhh.reset(boost::lexical_cast<double>(value));
64 } else if (key == "Mlh") {
65 if (cache.Mlh) throw MaterialParseException("{}: Repeated parameter 'Mlh'", full_name);
66 cache.Mlh.reset(boost::lexical_cast<double>(value));
67 } else if (key == "Mh") {
68 if (cache.Mh) throw MaterialParseException("{}: Repeated parameter 'Mh'", full_name);
69 cache.Mh.reset(boost::lexical_cast<double>(value));
70 } else if (key == "y1") {
71 if (cache.y1) throw MaterialParseException("{}: Repeated parameter 'y1'", full_name);
72 cache.y1.reset(boost::lexical_cast<double>(value));
73 } else if (key == "y2") {
74 if (cache.y2) throw MaterialParseException("{}: Repeated parameter 'y2'", full_name);
75 cache.y2.reset(boost::lexical_cast<double>(value));
76 } else if (key == "y3") {
77 if (cache.y3) throw MaterialParseException("{}: Repeated parameter 'y3'", full_name);
78 cache.y3.reset(boost::lexical_cast<double>(value));
79 } else if (key == "ac") {
80 if (cache.ac) throw MaterialParseException("{}: Repeated parameter 'ac'", full_name);
81 cache.ac.reset(boost::lexical_cast<double>(value));
82 } else if (key == "av") {
83 if (cache.av) throw MaterialParseException("{}: Repeated parameter 'av'", full_name);
84 cache.av.reset(boost::lexical_cast<double>(value));
85 } else if (key == "b") {
86 if (cache.b) throw MaterialParseException("{}: Repeated parameter 'b'", full_name);
87 cache.b.reset(boost::lexical_cast<double>(value));
88 } else if (key == "d") {
89 if (cache.d) throw MaterialParseException("{}: Repeated parameter 'd'", full_name);
90 cache.d.reset(boost::lexical_cast<double>(value));
91 } else if (key == "c11") {
92 if (cache.c11) throw MaterialParseException("{}: Repeated parameter 'c11'", full_name);
93 cache.c11.reset(boost::lexical_cast<double>(value));
94 } else if (key == "c12") {
95 if (cache.c12) throw MaterialParseException("{}: Repeated parameter 'c12'", full_name);
96 cache.c12.reset(boost::lexical_cast<double>(value));
97 } else if (key == "c44") {
98 if (cache.c44) throw MaterialParseException("{}: Repeated parameter 'c44'", full_name);
99 cache.c44.reset(boost::lexical_cast<double>(value));
100 } else if (key == "eps") {
101 if (cache.eps) throw MaterialParseException("{}: Repeated parameter 'eps'", full_name);
102 cache.eps.reset(boost::lexical_cast<double>(value));
103 } else if (key == "chi") {
104 if (cache.chi) throw MaterialParseException("{}: Repeated parameter 'chi'", full_name);
105 cache.chi.reset(boost::lexical_cast<double>(value));
106 } else if (key == "Ni") {
107 if (cache.Ni) throw MaterialParseException("{}: Repeated parameter 'Ni'", full_name);
108 cache.Ni.reset(boost::lexical_cast<double>(value));
109 } else if (key == "Nf") {
110 if (cache.Nf) throw MaterialParseException("{}: Repeated parameter 'Nf'", full_name);
111 cache.Nf.reset(boost::lexical_cast<double>(value));
112 } else if (key == "EactD") {
113 if (cache.EactD) throw MaterialParseException("{}: Repeated parameter 'EactD'", full_name);
114 cache.EactD.reset(boost::lexical_cast<double>(value));
115 } else if (key == "EactA") {
116 if (cache.EactA) throw MaterialParseException("{}: Repeated parameter 'EactA'", full_name);
117 cache.EactA.reset(boost::lexical_cast<double>(value));
118 } else if (key == "mob") {
119 if (cache.mob) throw MaterialParseException("{}: Repeated parameter 'mob'", full_name);
120 cache.mob.reset(boost::lexical_cast<double>(value));
121 } else if (key == "cond") {
122 if (cache.cond) throw MaterialParseException("{}: Repeated parameter 'cond'", full_name);
123 cache.cond.reset(boost::lexical_cast<double>(value));
124 } else if (key == "A") {
125 if (cache.A) throw MaterialParseException("{}: Repeated parameter 'A'", full_name);
126 cache.A.reset(boost::lexical_cast<double>(value));
127 } else if (key == "B") {
128 if (cache.B) throw MaterialParseException("{}: Repeated parameter 'B'", full_name);
129 cache.B.reset(boost::lexical_cast<double>(value));
130 } else if (key == "C") {
131 if (cache.C) throw MaterialParseException("{}: Repeated parameter 'C'", full_name);
132 cache.C.reset(boost::lexical_cast<double>(value));
133 } else if (key == "D") {
134 if (cache.D) throw MaterialParseException("{}: Repeated parameter 'D'", full_name);
135 cache.D.reset(boost::lexical_cast<double>(value));
136 } else if (key == "thermk") {
137 if (cache.thermk) throw MaterialParseException("{}: Repeated parameter 'thermk'", full_name);
138 cache.thermk.reset(boost::lexical_cast<double>(value));
139 } else if (key == "dens") {
140 if (cache.dens) throw MaterialParseException("{}: Repeated parameter 'dens'", full_name);
141 cache.dens.reset(boost::lexical_cast<double>(value));
142 } else if (key == "cp") {
143 if (cache.cp) throw MaterialParseException("{}: Repeated parameter 'cp'", full_name);
144 cache.cp.reset(boost::lexical_cast<double>(value));
145 } else if (key == "nr") {
146 if (cache.nr) throw MaterialParseException("{}: Repeated parameter 'nr'", full_name);
147 cache.nr.reset(boost::lexical_cast<double>(value));
148 } else if (key == "absp") {
149 if (cache.absp) throw MaterialParseException("{}: Repeated parameter 'absp'", full_name);
150 cache.absp.reset(boost::lexical_cast<double>(value));
151 } else if (key == "Nr") {
152 if (cache.nr) throw MaterialParseException("{}: Repeated parameter 'Nr'", full_name);
153 cache.Nr.reset(boost::lexical_cast<dcomplex>(value));
154 } else if (key == "mobe") {
155 if (cache.mobe) throw MaterialParseException("{}: Repeated parameter 'mobe'", full_name);
156 cache.mobe.reset(boost::lexical_cast<double>(value));
157 } else if (key == "mobh") {
158 if (cache.mobh) throw MaterialParseException("{}: Repeated parameter 'mobh'", full_name);
159 cache.mobh.reset(boost::lexical_cast<double>(value));
160 } else if (key == "taue") {
161 if (cache.taue) throw MaterialParseException("{}: Repeated parameter 'taue'", full_name);
162 cache.taue.reset(boost::lexical_cast<double>(value));
163 } else if (key == "tauh") {
164 if (cache.tauh) throw MaterialParseException("{}: Repeated parameter 'tauh'", full_name);
165 cache.tauh.reset(boost::lexical_cast<double>(value));
166 } else if (key == "Ce") {
167 if (cache.Ce) throw MaterialParseException("{}: Repeated parameter 'Ce'", full_name);
168 cache.Ce.reset(boost::lexical_cast<double>(value));
169 } else if (key == "Ch") {
170 if (cache.Ch) throw MaterialParseException("{}: Repeated parameter 'Ch'", full_name);
171 cache.Ch.reset(boost::lexical_cast<double>(value));
172 } else if (key == "e13") {
173 if (cache.e13) throw MaterialParseException("{}: Repeated parameter 'e13'", full_name);
174 cache.e13.reset(boost::lexical_cast<double>(value));
175 } else if (key == "e15") {
176 if (cache.e15) throw MaterialParseException("{}: Repeated parameter 'e15'", full_name);
177 cache.e15.reset(boost::lexical_cast<double>(value));
178 } else if (key == "e33") {
179 if (cache.e33) throw MaterialParseException("{}: Repeated parameter 'e33'", full_name);
180 cache.e33.reset(boost::lexical_cast<double>(value));
181 } else if (key == "c13") {
182 if (cache.c13) throw MaterialParseException("{}: Repeated parameter 'c13'", full_name);
183 cache.c13.reset(boost::lexical_cast<double>(value));
184 } else if (key == "c33") {
185 if (cache.c33) throw MaterialParseException("{}: Repeated parameter 'c33'", full_name);
186 cache.c33.reset(boost::lexical_cast<double>(value));
187 } else if (key == "Psp") {
188 if (cache.Psp) throw MaterialParseException("{}: Repeated parameter 'Psp'", full_name);
189 cache.Psp.reset(boost::lexical_cast<double>(value));
190 } else if (key == "Na") {
191 if (cache.Na) throw MaterialParseException("{}: Repeated parameter 'Na'", full_name);
192 cache.Na.reset(boost::lexical_cast<double>(value));
193 } else if (key == "Nd") {
194 if (cache.Nd) throw MaterialParseException("{}: Repeated parameter 'Nd'", full_name);
195 cache.Nd.reset(boost::lexical_cast<double>(value));
196 } else throw MaterialParseException("{}: Bad material parameter '{}'", full_name, key);
197 } catch (boost::bad_lexical_cast&) {
198 throw MaterialParseException("{}: Bad material parameter value '{}={}'", full_name, key, value);
199 }
200 }
201
202}
203
204 ConstMaterial::ConstMaterial(const shared_ptr<Material>& base, const std::map<std::string, double>& items):
205 MaterialWithBase(base) {
206 for (auto item: items) {
207 if (item.first == "lattC") cache.lattC.reset(item.second);
208 else if (item.first == "Eg") cache.Eg.reset(item.second);
209 else if (item.first == "CB") cache.CB.reset(item.second);
210 else if (item.first == "VB") cache.VB.reset(item.second);
211 else if (item.first == "Dso") cache.Dso.reset(item.second);
212 else if (item.first == "Mso") cache.Mso.reset(item.second);
213 else if (item.first == "Me") cache.Me.reset(item.second);
214 else if (item.first == "Mhh") cache.Mhh.reset(item.second);
215 else if (item.first == "Mlh") cache.Mlh.reset(item.second);
216 else if (item.first == "Mh") cache.Mh.reset(item.second);
217 else if (item.first == "y1") cache.y1.reset(item.second);
218 else if (item.first == "y2") cache.y2.reset(item.second);
219 else if (item.first == "y3") cache.y3.reset(item.second);
220 else if (item.first == "ac") cache.ac.reset(item.second);
221 else if (item.first == "av") cache.av.reset(item.second);
222 else if (item.first == "b") cache.b.reset(item.second);
223 else if (item.first == "d") cache.d.reset(item.second);
224 else if (item.first == "c11") cache.c11.reset(item.second);
225 else if (item.first == "c12") cache.c12.reset(item.second);
226 else if (item.first == "c44") cache.c44.reset(item.second);
227 else if (item.first == "eps") cache.eps.reset(item.second);
228 else if (item.first == "chi") cache.chi.reset(item.second);
229 else if (item.first == "Ni") cache.Ni.reset(item.second);
230 else if (item.first == "Nf") cache.Nf.reset(item.second);
231 else if (item.first == "EactD") cache.EactD.reset(item.second);
232 else if (item.first == "EactA") cache.EactA.reset(item.second);
233 else if (item.first == "mob") cache.mob.reset(item.second);
234 else if (item.first == "cond") cache.cond.reset(item.second);
235 else if (item.first == "A") cache.A.reset(item.second);
236 else if (item.first == "B") cache.B.reset(item.second);
237 else if (item.first == "C") cache.C.reset(item.second);
238 else if (item.first == "D") cache.D.reset(item.second);
239 else if (item.first == "thermk") cache.thermk.reset(item.second);
240 else if (item.first == "dens") cache.dens.reset(item.second);
241 else if (item.first == "cp") cache.cp.reset(item.second);
242 else if (item.first == "nr") cache.nr.reset(item.second);
243 else if (item.first == "absp") cache.absp.reset(item.second);
244 else if (item.first == "Nr") cache.Nr.reset(item.second);
245 else if (item.first == "mobe") cache.mobe.reset(item.second);
246 else if (item.first == "mobh") cache.mobh.reset(item.second);
247 else if (item.first == "taue") cache.taue.reset(item.second);
248 else if (item.first == "tauh") cache.tauh.reset(item.second);
249 else if (item.first == "Ce") cache.Ce.reset(item.second);
250 else if (item.first == "Ch") cache.Ch.reset(item.second);
251 else if (item.first == "e13") cache.e13.reset(item.second);
252 else if (item.first == "e15") cache.e15.reset(item.second);
253 else if (item.first == "e33") cache.e33.reset(item.second);
254 else if (item.first == "c13") cache.c13.reset(item.second);
255 else if (item.first == "c33") cache.c33.reset(item.second);
256 else if (item.first == "Psp") cache.Psp.reset(item.second);
257 else if (item.first == "Na") cache.Na.reset(item.second);
258 else if (item.first == "Nd") cache.Nd.reset(item.second);
259 else throw MaterialParseException("bad material parameter '{}'", item.first);
260 }
261}
262
263
264std::string ConstMaterial::str() const{
265 std::string result;
266 bool c = false;
267 if (cache.A) { result += (c? " A=" : "A=") + plask::str(*cache.A); c = true; }
268 if (cache.absp) { result += (c? " absp=" : "absp=") + plask::str(*cache.absp); c = true; }
269 if (cache.ac) { result += (c? " ac=" : "ac=") + plask::str(*cache.ac); c = true; }
270 if (cache.av) { result += (c? " av=" : "av=") + plask::str(*cache.av); c = true; }
271 if (cache.b) { result += (c? " b=" : "b=") + plask::str(*cache.b); c = true; }
272 if (cache.B) { result += (c? " B=" : "B=") + plask::str(*cache.B); c = true; }
273 if (cache.C) { result += (c? " C=" : "C=") + plask::str(*cache.C); c = true; }
274 if (cache.c11) { result += (c? " c11=" : "c11=") + plask::str(*cache.c11); c = true; }
275 if (cache.c12) { result += (c? " c12=" : "c12=") + plask::str(*cache.c12); c = true; }
276 if (cache.c13) { result += (c? " c13=" : "c13=") + plask::str(*cache.c13); c = true; }
277 if (cache.c33) { result += (c? " c33=" : "c33=") + plask::str(*cache.c33); c = true; }
278 if (cache.c44) { result += (c? " c44=" : "c44=") + plask::str(*cache.c44); c = true; }
279 if (cache.CB) { result += (c? " CB=" : "CB=") + plask::str(*cache.CB); c = true; }
280 if (cache.Ce) { result += (c? " Ce=" : "Ce=") + plask::str(*cache.Ce); c = true; }
281 if (cache.Ch) { result += (c? " Ch=" : "Ch=") + plask::str(*cache.Ch); c = true; }
282 if (cache.chi) { result += (c? " chi=" : "chi=") + plask::str(*cache.chi); c = true; }
283 if (cache.cond) { result += (c? " cond=" : "cond=") + plask::str(*cache.cond); c = true; }
284 if (cache.cp) { result += (c? " cp=" : "cp=") + plask::str(*cache.cp); c = true; }
285 if (cache.d) { result += (c? " d=" : "d=") + plask::str(*cache.d); c = true; }
286 if (cache.D) { result += (c? " D=" : "D=") + plask::str(*cache.D); c = true; }
287 if (cache.dens) { result += (c? " dens=" : "dens=") + plask::str(*cache.dens); c = true; }
288 if (cache.Dso) { result += (c? " Dso=" : "Dso=") + plask::str(*cache.Dso); c = true; }
289 if (cache.e13) { result += (c? " e13=" : "e13=") + plask::str(*cache.e13); c = true; }
290 if (cache.e15) { result += (c? " e15=" : "e15=") + plask::str(*cache.e15); c = true; }
291 if (cache.e33) { result += (c? " e33=" : "e33=") + plask::str(*cache.e33); c = true; }
292 if (cache.EactA) { result += (c? " EactA=" : "EactA=") + plask::str(*cache.EactA); c = true; }
293 if (cache.EactD) { result += (c? " EactD=" : "EactD=") + plask::str(*cache.EactD); c = true; }
294 if (cache.Eg) { result += (c? " Eg=" : "Eg=") + plask::str(*cache.Eg); c = true; }
295 if (cache.eps) { result += (c? " eps=" : "eps=") + plask::str(*cache.eps); c = true; }
296 if (cache.Eps) { result += (c? " Eps=" : "Eps=") + plask::str(*cache.Eps); c = true; }
297 if (cache.lattC) { result += (c? " lattC=" : "lattC=") + plask::str(*cache.lattC); c = true; }
298 if (cache.Me) { result += (c? " Me=" : "Me=") + plask::str(*cache.Me); c = true; }
299 if (cache.Mh) { result += (c? " Mh=" : "Mh=") + plask::str(*cache.Mh); c = true; }
300 if (cache.Mhh) { result += (c? " Mhh=" : "Mhh=") + plask::str(*cache.Mhh); c = true; }
301 if (cache.Mlh) { result += (c? " Mlh=" : "Mlh=") + plask::str(*cache.Mlh); c = true; }
302 if (cache.mob) { result += (c? " mob=" : "mob=") + plask::str(*cache.mob); c = true; }
303 if (cache.mobe) { result += (c? " mobe=" : "mobe=") + plask::str(*cache.mobe); c = true; }
304 if (cache.mobh) { result += (c? " mobh=" : "mobh=") + plask::str(*cache.mobh); c = true; }
305 if (cache.Mso) { result += (c? " Mso=" : "Mso=") + plask::str(*cache.Mso); c = true; }
306 if (cache.Na) { result += (c? " Na=" : "Na=") + plask::str(*cache.Na); c = true; }
307 if (cache.Nd) { result += (c? " Nd=" : "Nd=") + plask::str(*cache.Nd); c = true; }
308 if (cache.Nf) { result += (c? " Nf=" : "Nf=") + plask::str(*cache.Nf); c = true; }
309 if (cache.Ni) { result += (c? " Ni=" : "Ni=") + plask::str(*cache.Ni); c = true; }
310 if (cache.nr) { result += (c? " nr=" : "nr=") + plask::str(*cache.nr); c = true; }
311 if (cache.Nr) { result += (c? " Nr=" : "Nr=") + plask::str(*cache.Nr); c = true; }
312 if (cache.Psp) { result += (c? " Psp=" : "Psp=") + plask::str(*cache.Psp); c = true; }
313 if (cache.taue) { result += (c? " taue=" : "taue=") + plask::str(*cache.taue); c = true; }
314 if (cache.tauh) { result += (c? " tauh=" : "tauh=") + plask::str(*cache.tauh); c = true; }
315 if (cache.thermk) { result += (c? " thermk=" : "thermk=") + plask::str(*cache.thermk); c = true; }
316 if (cache.VB) { result += (c? " VB=" : "VB=") + plask::str(*cache.VB); c = true; }
317 if (cache.y1) { result += (c? " y1=" : "y1=") + plask::str(*cache.y1); c = true; }
318 if (cache.y2) { result += (c? " y2=" : "y2=") + plask::str(*cache.y2); c = true; }
319 if (cache.y3) { result += (c? " y3=" : "y3=") + plask::str(*cache.y3); c = true; }
320 if (base)
321 return base->str() + " [" + result + "]";
322 else
323 return "[" + result + "]";
324}
325
326 double ConstMaterial::A(double T) const {
327 if (cache.A) return *cache.A;
328 else if (base) return base->A(T);
329 else throwNotImplemented("A(double T)");
330}
331
332 double ConstMaterial::absp(double, double) const { if (cache.absp) return *cache.absp; return 0.; }
333
334 double ConstMaterial::B(double T) const {
335 if (cache.B) return *cache.B;
336 else if (base) return base->B(T);
337 else throwNotImplemented("A(double T)");
338}
339
340 double ConstMaterial::C(double T) const {
341 if (cache.C) return *cache.C;
342 else if (base) return base->C(T);
343 else throwNotImplemented("A(double T)");
344}
345
346 double ConstMaterial::CB(double T, double e, char point) const {
347 if (cache.CB) return *cache.CB;
348 try {
349 if (cache.VB) return *cache.VB + Eg(T, e, point);
350 else if (cache.Eg) {
351 if (e == 0.)
352 return VB(T, 0., point) + Eg(T, 0., point);
353 else
354 return max(VB(T, e, point, 'H'), VB(T, e, point, 'L')) + *cache.Eg;
355 }
356 } catch (MaterialMethodNotImplemented) {
357 if (base) return base->CB(T, e, point);
358 else throwNotImplemented("CB(double T, double e, char point)");
359 }
360 return NAN;
361}
362
363 double ConstMaterial::chi(double T, double e, char point) const {
364 if (cache.chi) return *cache.chi;
365 else if (base) return base->chi(T, e, point);
366 else throwNotImplemented("A(double T)");
367}
368
369 Tensor2<double> ConstMaterial::cond(double T) const {
370 if (cache.cond) return *cache.cond;
371 else if (base) return base->cond(T);
372 else throwNotImplemented("cond(double T)");
373}
374
375 double ConstMaterial::D(double T) const {
376 if (cache.D) return *cache.D;
377 else if (cache.mob) return 8.6173423e-5 * cache.mob->c00 * T; // D = µ kB T / e
378 else if (base) return base->D(T);
379 else throwNotImplemented("D(double T)");
380}
381
382 double ConstMaterial::dens(double T) const {
383 if (cache.dens) return *cache.dens;
384 else if (base) return base->dens(T);
385 else throwNotImplemented("A(double T)");
386}
387
388 double ConstMaterial::Dso(double T, double e) const {
389 if (cache.Dso) return *cache.Dso;
390 else if (base) return base->Dso(T, e);
391 else throwNotImplemented("A(double T)");
392}
393
394 double ConstMaterial::EactA(double T) const {
395 if (cache.EactA) return *cache.EactA;
396 else if (base) return base->EactA(T);
397 else throwNotImplemented("A(double T)");
398}
399 double ConstMaterial::EactD(double T) const {
400 if (cache.EactD) return *cache.EactD;
401 else if (base) return base->EactD(T);
402 else throwNotImplemented("A(double T)");
403}
404
405 double ConstMaterial::Eg(double T, double e, char point) const {
406 if (cache.Eg) return *cache.Eg;
407 else if (base) return base->Eg(T, e, point);
408 else throwNotImplemented("A(double T)");
409}
410
411 double ConstMaterial::eps(double T) const {
412 if (cache.eps) return *cache.eps;
413 else if (base) return base->eps(T);
414 else throwNotImplemented("A(double T)");
415}
416
417 double ConstMaterial::lattC(double T, char x) const {
418 if (cache.lattC) return *cache.lattC;
419 else if (base) return base->lattC(T, x);
420 else throwNotImplemented("A(double T)");
421}
422
423 Tensor2<double> ConstMaterial::Me(double T, double e, char point) const {
424 if (cache.Me) return *cache.Me;
425 else if (base) return base->Me(T, e, point);
426 else throwNotImplemented("A(double T)");
427}
428 Tensor2<double> ConstMaterial::Mh(double T, double e) const {
429 if (cache.Mh) return *cache.Mh;
430 else if (base) return base->Mh(T, e);
431 else throwNotImplemented("A(double T)");
432}
433 Tensor2<double> ConstMaterial::Mhh(double T, double e) const {
434 if (cache.Mhh) return *cache.Mhh;
435 else if (base) return base->Mhh(T, e);
436 else throwNotImplemented("A(double T)");
437}
438 Tensor2<double> ConstMaterial::Mlh(double T, double e) const {
439 if (cache.Mlh) return *cache.Mlh;
440 else if (base) return base->Mlh(T, e);
441 else throwNotImplemented("A(double T)");
442}
443
444 double ConstMaterial::y1() const {
445 if (cache.y1) return *cache.y1;
446 else if (base) return base->y1();
447 else throwNotImplemented("y1()");
448}
449 double ConstMaterial::y2() const {
450 if (cache.y2) return *cache.y2;
451 else if (base) return base->y2();
452 else throwNotImplemented("y2()");
453}
454 double ConstMaterial::y3() const {
455 if (cache.y3) return *cache.y3;
456 else if (base) return base->y3();
457 else throwNotImplemented("y3()");
458}
459
460 double ConstMaterial::ac(double T) const {
461 if (cache.ac) return *cache.ac;
462 else if (base) return base->ac(T);
463 else throwNotImplemented("A(double T)");
464}
465 double ConstMaterial::av(double T) const {
466 if (cache.av) return *cache.av;
467 else if (base) return base->av(T);
468 else throwNotImplemented("A(double T)");
469}
470 double ConstMaterial::b(double T) const {
471 if (cache.b) return *cache.b;
472 else if (base) return base->b(T);
473 else throwNotImplemented("A(double T)");
474}
475 double ConstMaterial::d(double T) const {
476 if (cache.d) return *cache.d;
477 else if (base) return base->d(T);
478 else throwNotImplemented("A(double T)");
479}
480 double ConstMaterial::c11(double T) const {
481 if (cache.c11) return *cache.c11;
482 else if (base) return base->c11(T);
483 else throwNotImplemented("A(double T)");
484}
485 double ConstMaterial::c12(double T) const {
486 if (cache.c12) return *cache.c12;
487 else if (base) return base->c12(T);
488 else throwNotImplemented("A(double T)");
489}
490 double ConstMaterial::c44(double T) const {
491 if (cache.c44) return *cache.c44;
492 else if (base) return base->c44(T);
493 else throwNotImplemented("A(double T)");
494}
495
496 Tensor2<double> ConstMaterial::mob(double T) const {
497 if (cache.mob) return *cache.mob;
498 else if (base) return base->mob(T);
499 else throwNotImplemented("A(double T)");
500}
501
502 double ConstMaterial::Mso(double T, double e) const {
503 if (cache.Mso) return *cache.Mso;
504 else if (base) return base->Mso(T, e);
505 else throwNotImplemented("A(double T)");
506}
507
508 double ConstMaterial::Nf(double T) const {
509 if (cache.Nf) return *cache.Nf;
510 else if (base) return base->Nf(T);
511 else throwNotImplemented("A(double T)");
512}
513
514 double ConstMaterial::Ni(double T) const {
515 if (cache.Ni) return *cache.Ni;
516 else if (base) return base->Ni(T);
517 else throwNotImplemented("A(double T)");
518}
519
520 double ConstMaterial::nr(double lam, double T, double n) const {
521 if (cache.nr) return *cache.nr;
522 else if (base) return base->nr(lam, T, n);
523 else throwNotImplemented("A(double T)");
524}
525
526dcomplex ConstMaterial::Nr(double lam, double T, double n) const {
527 if (cache.Nr) return *cache.Nr;
528 try {
529 if (cache.nr) return dcomplex(*cache.nr, -7.95774715459e-09 * absp(lam,T) * lam);
530 else if (cache.absp) return dcomplex(nr(lam,T), -7.95774715459e-09 * *cache.absp * lam);
531 } catch (MaterialMethodNotImplemented) {
532 if (base) return base->Nr(lam, T, n);
533 else throwNotImplemented("Nr(double lam, double T, double n)");
534 }
535 return NAN;
536}
537
538 Tensor3<dcomplex> ConstMaterial::Eps(double lam, double T, double n) const {
539 if (cache.Eps) return *cache.Eps;
540 else if (cache.Nr) return *cache.Nr * *cache.Nr;
541 else if (base) return base->Eps(lam, T, n);
542 else throwNotImplemented("Eps(double lam, double T, double n)");
543}
544
545 double ConstMaterial::cp(double T) const {
546 if (cache.cp) return *cache.cp;
547 else if (base) return base->cp(T);
548 else throwNotImplemented("A(double T)");
549}
550
551 Tensor2<double> ConstMaterial::thermk(double T, double h) const {
552 if (cache.thermk) return *cache.thermk;
553 else if (base) return base->thermk(T, h);
554 else throwNotImplemented("A(double T)");
555}
556
557 double ConstMaterial::VB(double T, double e, char point, char hole) const {
558 if (cache.VB) return *cache.VB;
559 else if (base) return base->VB(T, e, point, hole);
560 else throwNotImplemented("A(double T)");
561}
562
563
564 Tensor2<double> ConstMaterial::mobe(double T) const {
565 if (cache.mobe) return *cache.mobe;
566 else if (base) return base->mobe(T);
567 else throwNotImplemented("A(double T)");
568}
569 Tensor2<double> ConstMaterial::mobh(double T) const {
570 if (cache.mobh) return *cache.mobh;
571 else if (base) return base->mobh(T);
572 else throwNotImplemented("A(double T)");
573}
574
575 double ConstMaterial::taue(double T) const {
576 if (cache.taue) return *cache.taue;
577 else if (base) return base->taue(T);
578 else throwNotImplemented("A(double T)");
579}
580
581 double ConstMaterial::tauh(double T) const {
582 if (cache.tauh) return *cache.tauh;
583 else if (base) return base->tauh(T);
584 else throwNotImplemented("A(double T)");
585}
586
587 double ConstMaterial::Ce(double T) const {
588 if (cache.Ce) return *cache.Ce;
589 else if (base) return base->Ce(T);
590 else throwNotImplemented("A(double T)");
591}
592
593 double ConstMaterial::Ch(double T) const {
594 if (cache.Ch) return *cache.Ch;
595 else if (base) return base->Ch(T);
596 else throwNotImplemented("A(double T)");
597}
598
599 double ConstMaterial::e13(double T) const {
600 if (cache.e13) return *cache.e13;
601 else if (base) return base->e13(T);
602 else throwNotImplemented("A(double T)");
603}
604
605 double ConstMaterial::e15(double T) const {
606 if (cache.e15) return *cache.e15;
607 else if (base) return base->e15(T);
608 else throwNotImplemented("A(double T)");
609}
610
611 double ConstMaterial::e33(double T) const {
612 if (cache.e33) return *cache.e33;
613 else if (base) return base->e33(T);
614 else throwNotImplemented("A(double T)");
615}
616
617 double ConstMaterial::c13(double T) const {
618 if (cache.c13) return *cache.c13;
619 else if (base) return base->c13(T);
620 else throwNotImplemented("A(double T)");
621}
622
623 double ConstMaterial::c33(double T) const {
624 if (cache.c33) return *cache.c33;
625 else if (base) return base->c33(T);
626 else throwNotImplemented("A(double T)");
627}
628
629 double ConstMaterial::Psp(double T) const {
630 if (cache.Psp) return *cache.Psp;
631 else if (base) return base->Psp(T);
632 else throwNotImplemented("A(double T)");
633}
634
635 double ConstMaterial::Na() const {
636 if (cache.Na) return *cache.Na;
637 else if (base) return base->Na();
638 else throwNotImplemented("Na()");
639}
640
641 double ConstMaterial::Nd() const {
642 if (cache.Nd) return *cache.Nd;
643 else if (base) return base->Nd();
644 else throwNotImplemented("Nd()");
645}
646
647
648} // namespace plask