PLaSK library
Loading...
Searching...
No Matches
beta.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 "beta.hpp"
15
16namespace plask { namespace electrical { namespace shockley {
17
18template<typename Geometry2DType>
19BetaSolver<Geometry2DType>::BetaSolver(const std::string& name) : BaseClass(name)
20{
21 js.assign(1, 1.);
22 beta.assign(1, NAN);
23}
24
25template<typename Geometry2DType>
27{
28 while (source.requireTagOrEnd())
29 {
30 if (source.getNodeName() == "junction") {
31 js[0] = source.getAttribute<double>("js", js[0]);
32 beta[0] = source.getAttribute<double>("beta", beta[0]);
33 auto condjunc = source.getAttribute<double>("pnjcond");
34 if (condjunc) {
35 this->writelog(LOG_WARNING, "'pnjcond' attribute is obselete; use <loop start-cond=>");
36 this->setCondJunc(*condjunc);
37 }
38 // if (source.hasAttribute("wavelength") || source.hasAttribute("heat"))
39 // throw XMLException(reader, "heat computation by wavelegth is no onger supporte");
40 for (auto attr: source.getAttributes()) {
41 if (attr.first == "beta" || attr.first == "js" || attr.first == "pnjcond" || attr.first == "wavelength" || attr.first == "heat") continue;
42 if (attr.first.substr(0,4) == "beta") {
43 size_t no;
44 try { no = boost::lexical_cast<size_t>(attr.first.substr(4)); }
45 catch (boost::bad_lexical_cast&) { throw XMLUnexpectedAttrException(source, attr.first); }
46 setBeta(no, source.requireAttribute<double>(attr.first));
47 }
48 else if (attr.first.substr(0,2) == "js") {
49 size_t no;
50 try { no = boost::lexical_cast<size_t>(attr.first.substr(2)); }
51 catch (boost::bad_lexical_cast&) { throw XMLUnexpectedAttrException(source, attr.first); }
52 setJs(no, source.requireAttribute<double>(attr.first));
53 }
54 else
55 throw XMLUnexpectedAttrException(source, attr.first);
56 }
57 source.requireTagEnd();
58 }
59 else {
60 this->parseConfiguration(source, manager);
61 }
62 }
63}
64
65
66template<typename Geometry2DType>
69
70template<> std::string BetaSolver<Geometry2DCartesian>::getClassName() const { return "electrical.Shockley2D"; }
71template<> std::string BetaSolver<Geometry2DCylindrical>::getClassName() const { return "electrical.ShockleyCyl"; }
72template<> std::string BetaSolver<Geometry3D>::getClassName() const { return "electrical.Shockley3D"; }
73
77
78}}} // namespaces