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_PHYSICS_EXCEPTION_HPP
2#define VIENNASHE_PHYSICS_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#include <string>
19#include <iostream>
20#include <fstream>
21#include <stdexcept>
22#include <sstream>
23
28namespace viennashe
29{
30 namespace physics
31 {
32
34 class no_lattice_temperature_available_exception : public std::runtime_error
35 {
36 public:
37
38 virtual const char* what() const throw() { return msg_.c_str(); }
39
41 const double & temp,
42 const long & vertex_id)
43 : std::runtime_error(str), temp_(temp), vt_id_(vertex_id) { this->fill_message(); }
44
46
47 private:
48 double temp_;
49 long vt_id_;
50
51 std::string msg_;
52
53 void fill_message()
54 {
55 std::stringstream ss;
56 ss << "Invalid temperature '" << temp_ << "' on vertex '" << vt_id_ << "'" << std::endl;
57 msg_ = ss.str();
58 }
59
60 };
61
62
64 class data_not_available_exception : public std::runtime_error
65 {
66 public:
67
68 virtual const char* what() const throw() { return _msg.c_str(); }
69
70 data_not_available_exception(std::string const & str,
71 const std::size_t & bin_no)
72 : std::runtime_error(str), _bin_no(bin_no)
73 { }
74
75 virtual ~data_not_available_exception() throw() { }
76
77 private:
78 std::size_t _bin_no;
79 std::string _msg;
80
81 void fill_message()
82 {
83 std::stringstream ss;
84 ss << std::runtime_error::what() << " ## No data found for data bin '" << this->_bin_no << "'" << std::endl;
85 _msg = ss.str();
86 }
87 };
88
89
91 class dispersion_not_invertible_exception : public std::runtime_error
92 {
93 public:
94 dispersion_not_invertible_exception(std::string const & str) : std::runtime_error(str) { }
95 };
96
97 } // namespace io
98} // namespace viennashe
99
100
101#endif
102
Exception which is thrown if there is no data for a given energy.
Definition: exception.hpp:65
data_not_available_exception(std::string const &str, const std::size_t &bin_no)
Definition: exception.hpp:70
Exception which is thrown if there is no data for a given energy.
Definition: exception.hpp:92
Exception which is thrown if there is no lattice temperature for a vertex.
Definition: exception.hpp:35
no_lattice_temperature_available_exception(std::string const &str, const double &temp, const long &vertex_id)
Definition: exception.hpp:40
The main ViennaSHE namespace. All functionality resides inside this namespace.
Definition: accessors.hpp:40