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
20namespace plask {
21
22ConstMaterial::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);
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
204ConstMaterial::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
326double 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
332double ConstMaterial::absp(double, double) const { if (cache.absp) return *cache.absp; return 0.; }
333
334double 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
340double 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
346double 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 }
357 if (base) return base->CB(T, e, point);
358 else throwNotImplemented("CB(double T, double e, char point)");
359 }
360}
361
362double ConstMaterial::chi(double T, double e, char point) const {
363 if (cache.chi) return *cache.chi;
364 else if (base) return base->chi(T, e, point);
365 else throwNotImplemented("A(double T)");
366}
367
369 if (cache.cond) return *cache.cond;
370 else if (base) return base->cond(T);
371 else throwNotImplemented("cond(double T)");
372}
373
374double ConstMaterial::D(double T) const {
375 if (cache.D) return *cache.D;
376 else if (cache.mob) return 8.6173423e-5 * cache.mob->c00 * T; // D = µ kB T / e
377 else if (base) return base->D(T);
378 else throwNotImplemented("D(double T)");
379}
380
381double ConstMaterial::dens(double T) const {
382 if (cache.dens) return *cache.dens;
383 else if (base) return base->dens(T);
384 else throwNotImplemented("A(double T)");
385}
386
387double ConstMaterial::Dso(double T, double e) const {
388 if (cache.Dso) return *cache.Dso;
389 else if (base) return base->Dso(T, e);
390 else throwNotImplemented("A(double T)");
391}
392
393double ConstMaterial::EactA(double T) const {
394 if (cache.EactA) return *cache.EactA;
395 else if (base) return base->EactA(T);
396 else throwNotImplemented("A(double T)");
397}
398double ConstMaterial::EactD(double T) const {
399 if (cache.EactD) return *cache.EactD;
400 else if (base) return base->EactD(T);
401 else throwNotImplemented("A(double T)");
402}
403
404double ConstMaterial::Eg(double T, double e, char point) const {
405 if (cache.Eg) return *cache.Eg;
406 else if (base) return base->Eg(T, e, point);
407 else throwNotImplemented("A(double T)");
408}
409
410double ConstMaterial::eps(double T) const {
411 if (cache.eps) return *cache.eps;
412 else if (base) return base->eps(T);
413 else throwNotImplemented("A(double T)");
414}
415
416double ConstMaterial::lattC(double T, char x) const {
417 if (cache.lattC) return *cache.lattC;
418 else if (base) return base->lattC(T, x);
419 else throwNotImplemented("A(double T)");
420}
421
422Tensor2<double> ConstMaterial::Me(double T, double e, char point) const {
423 if (cache.Me) return *cache.Me;
424 else if (base) return base->Me(T, e, point);
425 else throwNotImplemented("A(double T)");
426}
427Tensor2<double> ConstMaterial::Mh(double T, double e) const {
428 if (cache.Mh) return *cache.Mh;
429 else if (base) return base->Mh(T, e);
430 else throwNotImplemented("A(double T)");
431}
432Tensor2<double> ConstMaterial::Mhh(double T, double e) const {
433 if (cache.Mhh) return *cache.Mhh;
434 else if (base) return base->Mhh(T, e);
435 else throwNotImplemented("A(double T)");
436}
437Tensor2<double> ConstMaterial::Mlh(double T, double e) const {
438 if (cache.Mlh) return *cache.Mlh;
439 else if (base) return base->Mlh(T, e);
440 else throwNotImplemented("A(double T)");
441}
442
443double ConstMaterial::y1() const {
444 if (cache.y1) return *cache.y1;
445 else if (base) return base->y1();
446 else throwNotImplemented("y1()");
447}
448double ConstMaterial::y2() const {
449 if (cache.y2) return *cache.y2;
450 else if (base) return base->y2();
451 else throwNotImplemented("y2()");
452}
453double ConstMaterial::y3() const {
454 if (cache.y3) return *cache.y3;
455 else if (base) return base->y3();
456 else throwNotImplemented("y3()");
457}
458
459double ConstMaterial::ac(double T) const {
460 if (cache.ac) return *cache.ac;
461 else if (base) return base->ac(T);
462 else throwNotImplemented("A(double T)");
463}
464double ConstMaterial::av(double T) const {
465 if (cache.av) return *cache.av;
466 else if (base) return base->av(T);
467 else throwNotImplemented("A(double T)");
468}
469double ConstMaterial::b(double T) const {
470 if (cache.b) return *cache.b;
471 else if (base) return base->b(T);
472 else throwNotImplemented("A(double T)");
473}
474double ConstMaterial::d(double T) const {
475 if (cache.d) return *cache.d;
476 else if (base) return base->d(T);
477 else throwNotImplemented("A(double T)");
478}
479double ConstMaterial::c11(double T) const {
480 if (cache.c11) return *cache.c11;
481 else if (base) return base->c11(T);
482 else throwNotImplemented("A(double T)");
483}
484double ConstMaterial::c12(double T) const {
485 if (cache.c12) return *cache.c12;
486 else if (base) return base->c12(T);
487 else throwNotImplemented("A(double T)");
488}
489double ConstMaterial::c44(double T) const {
490 if (cache.c44) return *cache.c44;
491 else if (base) return base->c44(T);
492 else throwNotImplemented("A(double T)");
493}
494
496 if (cache.mob) return *cache.mob;
497 else if (base) return base->mob(T);
498 else throwNotImplemented("A(double T)");
499}
500
501double ConstMaterial::Mso(double T, double e) const {
502 if (cache.Mso) return *cache.Mso;
503 else if (base) return base->Mso(T, e);
504 else throwNotImplemented("A(double T)");
505}
506
507double ConstMaterial::Nf(double T) const {
508 if (cache.Nf) return *cache.Nf;
509 else if (base) return base->Nf(T);
510 else throwNotImplemented("A(double T)");
511}
512
513double ConstMaterial::Ni(double T) const {
514 if (cache.Ni) return *cache.Ni;
515 else if (base) return base->Ni(T);
516 else throwNotImplemented("A(double T)");
517}
518
519double ConstMaterial::nr(double lam, double T, double n) const {
520 if (cache.nr) return *cache.nr;
521 else if (base) return base->nr(lam, T, n);
522 else throwNotImplemented("A(double T)");
523}
524
525dcomplex ConstMaterial::Nr(double lam, double T, double n) const {
526 if (cache.Nr) return *cache.Nr;
527 try {
528 if (cache.nr) return dcomplex(*cache.nr, -7.95774715459e-09 * absp(lam,T) * lam);
529 else if (cache.absp) return dcomplex(nr(lam,T), -7.95774715459e-09 * *cache.absp * lam);
531 if (base) return base->Nr(lam, T, n);
532 else throwNotImplemented("Nr(double lam, double T, double n)");
533 }
534}
535
536Tensor3<dcomplex> ConstMaterial::Eps(double lam, double T, double n) const {
537 if (cache.Eps) return *cache.Eps;
538 else if (cache.Nr) return *cache.Nr * *cache.Nr;
539 else if (base) return base->Eps(lam, T, n);
540 else throwNotImplemented("Eps(double lam, double T, double n)");
541}
542
543double ConstMaterial::cp(double T) const {
544 if (cache.cp) return *cache.cp;
545 else if (base) return base->cp(T);
546 else throwNotImplemented("A(double T)");
547}
548
549Tensor2<double> ConstMaterial::thermk(double T, double h) const {
550 if (cache.thermk) return *cache.thermk;
551 else if (base) return base->thermk(T, h);
552 else throwNotImplemented("A(double T)");
553}
554
555double ConstMaterial::VB(double T, double e, char point, char hole) const {
556 if (cache.VB) return *cache.VB;
557 else if (base) return base->VB(T, e, point, hole);
558 else throwNotImplemented("A(double T)");
559}
560
561
563 if (cache.mobe) return *cache.mobe;
564 else if (base) return base->mobe(T);
565 else throwNotImplemented("A(double T)");
566}
568 if (cache.mobh) return *cache.mobh;
569 else if (base) return base->mobh(T);
570 else throwNotImplemented("A(double T)");
571}
572
573double ConstMaterial::taue(double T) const {
574 if (cache.taue) return *cache.taue;
575 else if (base) return base->taue(T);
576 else throwNotImplemented("A(double T)");
577}
578
579double ConstMaterial::tauh(double T) const {
580 if (cache.tauh) return *cache.tauh;
581 else if (base) return base->tauh(T);
582 else throwNotImplemented("A(double T)");
583}
584
585double ConstMaterial::Ce(double T) const {
586 if (cache.Ce) return *cache.Ce;
587 else if (base) return base->Ce(T);
588 else throwNotImplemented("A(double T)");
589}
590
591double ConstMaterial::Ch(double T) const {
592 if (cache.Ch) return *cache.Ch;
593 else if (base) return base->Ch(T);
594 else throwNotImplemented("A(double T)");
595}
596
597double ConstMaterial::e13(double T) const {
598 if (cache.e13) return *cache.e13;
599 else if (base) return base->e13(T);
600 else throwNotImplemented("A(double T)");
601}
602
603double ConstMaterial::e15(double T) const {
604 if (cache.e15) return *cache.e15;
605 else if (base) return base->e15(T);
606 else throwNotImplemented("A(double T)");
607}
608
609double ConstMaterial::e33(double T) const {
610 if (cache.e33) return *cache.e33;
611 else if (base) return base->e33(T);
612 else throwNotImplemented("A(double T)");
613}
614
615double ConstMaterial::c13(double T) const {
616 if (cache.c13) return *cache.c13;
617 else if (base) return base->c13(T);
618 else throwNotImplemented("A(double T)");
619}
620
621double ConstMaterial::c33(double T) const {
622 if (cache.c33) return *cache.c33;
623 else if (base) return base->c33(T);
624 else throwNotImplemented("A(double T)");
625}
626
627double ConstMaterial::Psp(double T) const {
628 if (cache.Psp) return *cache.Psp;
629 else if (base) return base->Psp(T);
630 else throwNotImplemented("A(double T)");
631}
632
633double ConstMaterial::Na() const {
634 if (cache.Na) return *cache.Na;
635 else if (base) return base->Na();
636 else throwNotImplemented("Na()");
637}
638
639double ConstMaterial::Nd() const {
640 if (cache.Nd) return *cache.Nd;
641 else if (base) return base->Nd();
642 else throwNotImplemented("Nd()");
643}
644
645
646} // namespace plask