ViennaSHE 1.3.0
Free open-source semiconductor device simulator using spherical harmonics expansions techniques.
viennashe_all.hpp
Go to the documentation of this file.
1#ifndef LIBVIENNASHE_VIENNASHE_ALL_HPP
2#define LIBVIENNASHE_VIENNASHE_ALL_HPP
3/* ============================================================================
4 Copyright (c) 2011-2022, Institute for Microelectronics,
5 Institute for Analysis and Scientific Computing,
6 TU Wien.
7
8 -----------------
9 ViennaSHE - The Vienna Spherical Harmonics Expansion Boltzmann Solver
10 -----------------
11
12 http://viennashe.sourceforge.net/
13
14 License: MIT (X11), see file LICENSE in the base directory
15=============================================================================== */
16
21#if defined(_MSC_VER)
22 // Disable name truncation warning obtained in Visual Studio
23 #pragma warning(disable:4503)
24#endif
25
27
28// ++++++++++++++++++++++++++++++++++++
29//
30// +++++++++++ C++ ONLY +++++++++++
31//
32// ++++++++++++++++++++++++++++++++++++
33
34#include <iostream>
35#include <cstdlib>
36#include <vector>
37
38#include "viennashe/forwards.h"
39#include "viennashe/device.hpp"
44#include "viennashe/config.hpp"
47
51
53
54#include "viennagrid/mesh/mesh.hpp"
55#include "viennagrid/config/default_configs.hpp"
56#include "viennagrid/io/netgen_reader.hpp"
57#include "viennagrid/io/vtk_reader.hpp"
58#include "viennagrid/io/vtk_writer.hpp"
59#include "viennagrid/algorithm/centroid.hpp"
60
61
62#ifndef __FUNCTION_NAME__
63 #ifdef WIN32 // WINDOWS
64 #define __FUNCTION_NAME__ __FUNCTION__
65 #else // UNIX
66 #define __FUNCTION_NAME__ __func__
67 #endif
68#endif
69
70
71/* ============================================================================================================ */
72#define CHECK_ARGUMENT_FOR_NULL(arg, pos, name) if((arg) == NULL) \
73 { \
74 viennashe::log::error() << "ERROR: " << __FUNCTION_NAME__ \
75 << "(): " << (name) << " must not be NULL!" << std::endl; \
76 return (pos); \
77 }
78/* ============================================================================================================ */
79#define CHECK_ARGUMENT(mycheck, pos, msg) if(mycheck) \
80 { \
81 viennashe::log::error() << "ERROR: " << __FUNCTION_NAME__ \
82 << "(): " << (msg) << "!" << std::endl; \
83 return (pos); \
84 }
85/* ============================================================================================================ */
86
87
88
92namespace libviennashe
93{
96 {
97 public:
98
99 array_to_accessor(double * vals) : values_(vals) { }
100
101 template < typename ElementT >
102 double operator()(ElementT const & elem) const
103 {
104 return this->get_value(elem);
105 }
106
107 template < typename ElementT >
108 double get_value(ElementT const & elem) const
109 {
110 if ( values_ != 0)
111 return this->values_[elem.id().get()];
112 else
113 throw viennashe::invalid_value_exception("array_to_accessor: values_ must not be NULL!");
114 }
115
116 template < typename ElementT >
117 double at(ElementT const & elem) const
118 {
119 return get_value(elem);
120 }
121
122
123 private:
124 double * values_;
125 }; // array_to_accessor
126
131 struct meshtype
132 {
133 enum
134 {
140 };
141 };
142}
143
144
147{
153
155
157 {
158 if (stype >= 0)
159 {
161 delete device_1d;
163 delete device_quad_2d;
165 delete device_tri_2d;
167 delete device_hex_3d;
169 delete device_tet_3d;
170
171 device_1d = NULL;
172 }
173 stype = -1;
174 }
175
176 bool is_valid() const { return (stype >= 0 && device_1d != NULL); }
177
178 int stype;
179
180 union
181 {
187 };
188
189}; // viennashe_device_impl
190
191
194{
195 //
196 // Mesh typedefs
197 //
198 typedef viennagrid::line_1d_mesh mesh1d_type;
199 typedef viennagrid::quadrilateral_2d_mesh meshq2d_type;
200 typedef viennagrid::triangular_2d_mesh mesht2d_type;
201 typedef viennagrid::hexahedral_3d_mesh meshh3d_type;
202 typedef viennagrid::tetrahedral_3d_mesh mesht3d_type;
203
204 //
205 // Device typedefs
206 //
212
213 //
214 // Simulator typedefs
215 //
221
222
224
226 {
227 if (stype >= 0 && sim1d != NULL)
228 {
230 delete sim1d;
232 delete simq2d;
234 delete simt2d;
236 delete simh3d;
238 delete simt3d;
239
240 conf = NULL; // Not deleted by this wrapper !
241 simt3d = NULL;
242 }
243 stype = -1;
244 }
245
246 bool is_valid() const { return (stype >= 0 && conf != NULL && sim1d != NULL); }
247
248 int stype;
249 viennashe::config * conf; // Not deleted by this wrapper !
250
251 union
252 {
258 };
259
260};
261
262#endif /* LIBVIENNASHE_VIENNASHE_ALL_HPP */
263
Maps a C-array to an element based accessor. Uses element.id() as an index to the C-array.
double at(ElementT const &elem) const
double get_value(ElementT const &elem) const
double operator()(ElementT const &elem) const
The main SHE configuration class. To be adjusted by the user for his/her needs.
Definition: config.hpp:124
Defines the physical properties of a device, e.g. doping. This is the implementation for 2d and highe...
Definition: device.hpp:818
Exception for the case that an invalid value (depends on the method called) is encountered.
Definition: exception.hpp:76
Class for self-consistent SHE simulations.
Definition: simulator.hpp:675
The SHE configuration class is defined here.
Contains the definition of a device class independent of the actual macroscopic model to be solved.
Computes the electric field from a potential.
Computes the electric flux density from a potential.
Contains forward declarations and definition of small classes that must be defined at an early stage.
Contains the basic models interface.
The internal C++ namespace of the library.
Provides a number of fundamental constants. All constants in SI units.
Computes the current density (both Jn and Jp) after using a drift diffusion solution.
Convenience header, which includes all postprocessing quantities available.
Provides a VTK writer for the computed distribution function. Outputs the (x, H)-space.
Implements the SHE simulator classes (both self-consistent and non-self-consistent).
The mesh types supported by libviennashe.
Internal C++ to C wrapper for the device. Has typedefs and destructor.
viennashe::device< viennagrid::quadrilateral_2d_mesh > devq2d_type
devq2d_type * device_quad_2d
devt2d_type * device_tri_2d
devh3d_type * device_hex_3d
viennashe::device< viennagrid::hexahedral_3d_mesh > devh3d_type
viennashe::device< viennagrid::triangular_2d_mesh > devt2d_type
devt3d_type * device_tet_3d
viennashe::device< viennagrid::line_1d_mesh > dev1d_type
viennashe::device< viennagrid::tetrahedral_3d_mesh > devt3d_type
Internal C++ to C wrapper for the simulator. Has typedefs and destructor.
viennagrid::line_1d_mesh mesh1d_type
viennashe::device< meshq2d_type > devq2d_type
viennashe::simulator< dev1d_type > sim1d_type
viennashe::simulator< devq2d_type > simq2d_type
viennashe::simulator< devh3d_type > simh3d_type
viennashe::simulator< devt3d_type > simt3d_type
viennashe::config * conf
viennashe::device< mesh1d_type > dev1d_type
viennashe::device< mesht2d_type > devt2d_type
viennashe::simulator< devt2d_type > simt2d_type
viennagrid::hexahedral_3d_mesh meshh3d_type
viennagrid::triangular_2d_mesh mesht2d_type
viennagrid::quadrilateral_2d_mesh meshq2d_type
viennashe::device< meshh3d_type > devh3d_type
viennagrid::tetrahedral_3d_mesh mesht3d_type
viennashe_simulator_impl(int s, viennashe::config *c)
viennashe::device< mesht3d_type > devt3d_type
Simple routines for reading a vector from file, or writing a vector to file.