ViennaSHE 1.3.0
Free open-source semiconductor device simulator using spherical harmonics expansions techniques.
exception.hpp
Go to the documentation of this file.
1#ifndef VIENNASHE_EXCEPTION_HPP
2#define VIENNASHE_EXCEPTION_HPP
3
4/* ============================================================================
5 Copyright (c) 2011-2022, Institute for Microelectronics,
6 Institute for Analysis and Scientific Computing,
7 TU Wien.
8
9 -----------------
10 ViennaSHE - The Vienna Spherical Harmonics Expansion Boltzmann Solver
11 -----------------
12
13 http://viennashe.sourceforge.net/
14
15 License: MIT (X11), see file LICENSE in the base directory
16=============================================================================== */
17
18
19#include <string>
20#include <iostream>
21#include <fstream>
22#include <stdexcept>
23#include <sstream>
24
29namespace viennashe
30{
31
33 class invalid_cell_exception : public std::runtime_error {
34 public:
35 invalid_cell_exception(std::string const & str) : std::runtime_error(str) {}
36 };
37
39 class invalid_doping_in_device_exception : public std::runtime_error {
40 public:
41 invalid_doping_in_device_exception(std::string const & str) : std::runtime_error(str) {}
42 };
43
45 class invalid_lattice_temperature_in_device_exception : public std::runtime_error {
46 public:
47 invalid_lattice_temperature_in_device_exception(std::string const & str) : std::runtime_error(str) {}
48 };
49
51 class invalid_trap_energy_exception : public std::runtime_error {
52 public:
53 invalid_trap_energy_exception(std::string const & str) : std::runtime_error(str) {}
54 };
55
57 class invalid_trap_density_exception : public std::runtime_error {
58 public:
59 invalid_trap_density_exception(std::string const & str) : std::runtime_error(str) {}
60 };
61
63 class invalid_segment_exception : public std::runtime_error {
64 public:
65 invalid_segment_exception(std::string const & str) : std::runtime_error(str) {}
66 };
67
69 class invalid_boundary_condition_exception : public std::runtime_error {
70 public:
71 invalid_boundary_condition_exception(std::string const & str) : std::runtime_error(str) {}
72 };
73
75 class invalid_value_exception : public std::runtime_error
76 {
77 public:
78 invalid_value_exception(std::string const & str) : std::runtime_error(str), _value(0) { this->fill_message(); }
79
80 virtual const char* what() const throw() { return _msg.c_str(); }
81
82 invalid_value_exception(std::string const & str, const double & value)
83 : std::runtime_error(str), _value(value)
84 { this->fill_message(); }
85
86 virtual ~invalid_value_exception() throw () { }
87
88 private:
89 double _value;
90 std::string _msg;
91
92 void fill_message()
93 {
94 std::stringstream ss;
95 ss << "Invalid value '" << this->_value << "' encountered. " << std::endl;
96 ss << std::runtime_error::what();
97 _msg = ss.str();
98 }
99 };
100
102 class unavailable_feature_exception : public std::runtime_error
103 {
104 public:
105
106 unavailable_feature_exception(std::string const & str) : std::runtime_error(str), _file_name(""), _line("") { this->fill_message(); }
107
108 virtual const char* what() const throw() { return _msg.c_str(); }
109
110 unavailable_feature_exception(std::string const & str, std::string const & file_name, std::string const & line_of_code)
111 : std::runtime_error(str), _file_name(file_name), _line(line_of_code)
112 { this->fill_message(); }
113
114 virtual ~unavailable_feature_exception() throw () { this->fill_message(); }
115
116 private:
117 std::string _file_name;
118 std::string _line;
119 std::string _msg;
120
121 void fill_message()
122 {
123 std::stringstream ss;
124 ss << "Unavailable feature in '" << _file_name << "' on line '" << _line << "' " << std::endl;
125 ss << std::runtime_error::what();
126 _msg = ss.str();
127 }
128
129 };
130
132 class quantity_not_found_exception : public std::runtime_error
133 {
134 public:
135 quantity_not_found_exception(std::string const & str) : std::runtime_error(str) {}
136 };
137
139 class solver_failed_exception : public std::runtime_error
140 {
141 public:
142 solver_failed_exception(std::string const & str) : std::runtime_error(str) {}
143 };
144
146 class assembly_not_implemented_exception : public std::runtime_error
147 {
148 public:
149 assembly_not_implemented_exception(std::string const & str) : std::runtime_error(str) {}
150 };
151
153 class carrier_type_not_supported_exception : public std::runtime_error
154 {
155 public:
156 carrier_type_not_supported_exception(std::string const & str) : std::runtime_error(str) {}
157 };
158
159
160}
161
162#endif
163
164
165
Exception thrown in the case that an equation assembler cannot be found.
Definition: exception.hpp:147
assembly_not_implemented_exception(std::string const &str)
Definition: exception.hpp:149
Exception thrown in the case that any code does not support the given carrier type.
Definition: exception.hpp:154
carrier_type_not_supported_exception(std::string const &str)
Definition: exception.hpp:156
Exception for the case that a segment or a segment that does not belong to a mesh is encountered.
Definition: exception.hpp:69
invalid_boundary_condition_exception(std::string const &str)
Definition: exception.hpp:71
Exception for the case that an invalid cell is encountered.
Definition: exception.hpp:33
invalid_cell_exception(std::string const &str)
Definition: exception.hpp:35
Exception for the case that an invalid doping is encountered.
Definition: exception.hpp:39
invalid_doping_in_device_exception(std::string const &str)
Definition: exception.hpp:41
Exception for the case that an invalid lattice temperature is encountered.
Definition: exception.hpp:45
invalid_lattice_temperature_in_device_exception(std::string const &str)
Definition: exception.hpp:47
Exception for the case that a segment or a segment that does not belong to a mesh is encountered.
Definition: exception.hpp:63
invalid_segment_exception(std::string const &str)
Definition: exception.hpp:65
Exception for the case that an invalid lattice temperature is encountered.
Definition: exception.hpp:57
invalid_trap_density_exception(std::string const &str)
Definition: exception.hpp:59
Exception for the case that an invalid lattice temperature is encountered.
Definition: exception.hpp:51
invalid_trap_energy_exception(std::string const &str)
Definition: exception.hpp:53
Exception for the case that an invalid value (depends on the method called) is encountered.
Definition: exception.hpp:76
invalid_value_exception(std::string const &str)
Definition: exception.hpp:78
invalid_value_exception(std::string const &str, const double &value)
Definition: exception.hpp:82
virtual const char * what() const
Definition: exception.hpp:80
Exception in case a (requested) quantity cannot be found.
Definition: exception.hpp:133
quantity_not_found_exception(std::string const &str)
Definition: exception.hpp:135
Exception thrown in the case that an equation solver failed.
Definition: exception.hpp:140
solver_failed_exception(std::string const &str)
Definition: exception.hpp:142
Exception for the case that a requested feature is not available (due to configuration or due to not ...
Definition: exception.hpp:103
unavailable_feature_exception(std::string const &str)
Definition: exception.hpp:106
unavailable_feature_exception(std::string const &str, std::string const &file_name, std::string const &line_of_code)
Definition: exception.hpp:110
virtual const char * what() const
Definition: exception.hpp:108
The main ViennaSHE namespace. All functionality resides inside this namespace.
Definition: accessors.hpp:40