ViennaSHE 1.3.0
Free open-source semiconductor device simulator using spherical harmonics expansions techniques.
add_to_writer.hpp
Go to the documentation of this file.
1#ifndef VIENNASHE_IO_ADD_TO_WRITER_HPP
2#define VIENNASHE_IO_ADD_TO_WRITER_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
22// std
23#include <string>
24#include <vector>
25
26// viennashe
27#include "viennashe/forwards.h"
28
32
33
34namespace viennashe
35{
36 namespace io
37 {
38 namespace detail
39 {
40
45 template < typename AccessorT, typename ValueT = typename AccessorT::value_type >
47 {
48 public:
49 typedef ValueT value_type;
50
51 viennagrid_accessor_wrapper(AccessorT acc) : acc_(acc) { }
53
54 template < typename ElementT >
55 value_type const & at(ElementT const & el) const
56 {
57 static value_type cache_ = acc_(el);
58 cache_ = acc_(el);
59 return cache_;
60 }
61
62 template < typename ElementT >
63 value_type const & operator()(ElementT const & el) const
64 {
65 static value_type cache_ = acc_(el);
66 cache_ = acc_(el);
67 return cache_;
68 }
69
70 template < typename ElementT >
71 value_type const * find(ElementT const & el) const
72 {
73 static value_type cache_ = acc_(el);
74 cache_ = acc_(el);
75 return &cache_;
76 }
77
78 private:
79 AccessorT acc_; // COPY !!!
80 };
81
89 template <typename MacroscopicQuantityAccessor, typename WriterType>
90 void add_macroscopic_quantity_to_writer_impl(MacroscopicQuantityAccessor const & quantity,
91 WriterType & writer,
92 std::string name,
93 double * dummy = 0)
94 {
95 (void)dummy;
96 // quantity IS GOING TO BE COPIED!
98
99 writer.add_scalar_data_on_cells(wrap, name);
100 }
101
109 template <typename MacroscopicQuantityAccessor, typename WriterType>
110 void add_macroscopic_quantity_to_writer_impl(MacroscopicQuantityAccessor const & quantity,
111 WriterType & writer,
112 std::string name,
113 std::vector<double> * dummy = 0)
114 {
115 (void)dummy;
116 // quantity IS GOING TO BE COPIED!
118 writer.add_vector_data_on_cells(wrap, name);
119 }
120 } // namespace detail
121
128 template <typename MacroscopicQuantityAccessor, typename WriterType>
129 void add_macroscopic_quantity_to_writer(MacroscopicQuantityAccessor const & quantity,
130 WriterType & writer, std::string name)
131 {
132 typename MacroscopicQuantityAccessor::value_type * dummy = 0;
133 // quantity IS GOING TO BE COPIED!
135 }
136
143 template <typename PotentialAccessor,
144 typename WriterType>
145 void add_potential_to_writer(PotentialAccessor const & pot,
146 WriterType & writer, std::string name)
147 {
148 // quantity IS GOING TO BE COPIED!
150 }
151
152 /*
153 template <typename DeviceType,
154 typename SHEQuantity,
155 typename WriterType>
156 void add_carrier_velocity_to_writer(DeviceType const & device,
157 SHEQuantity const & quan,
158 viennashe::config::dispersion_relation_type const & dispersion,
159 WriterType & writer,
160 std::string name)
161 {
162 // get accessor
163 viennashe::she::carrier_velocity_wrapper<DeviceType, SHEQuantity> velocity_wrapper(device, quan, dispersion);
164 // write
165 // quantity IS GOING TO BE COPIED!
166 viennashe::io::add_macroscopic_quantity_to_writer(velocity_wrapper, writer, name);
167 } */
168
177 template <typename DeviceType,
178 typename SHEQuantity,
179 typename WriterType>
180 void add_current_density_to_writer(DeviceType const & device,
181 viennashe::config const & conf,
182 SHEQuantity const & quan,
183 WriterType & writer,
184 std::string name)
185 {
187 // quantity IS GOING TO BE COPIED!
188 viennashe::io::add_macroscopic_quantity_to_writer(current_wrapper, writer, name);
189 }
190
201 template <typename DeviceType,
202 typename PotentialQuantityType,
203 typename CarrierQuantityType,
204 typename MobilityModel,
205 typename WriterType>
206 void add_current_density_to_writer(DeviceType const & device,
207 PotentialQuantityType const & potential,
208 CarrierQuantityType const & carrier,
210 MobilityModel const & mobility_model,
211 WriterType & writer,
212 std::string name)
213 {
214 typedef typename viennashe::current_density_wrapper<DeviceType, PotentialQuantityType,
215 CarrierQuantityType, MobilityModel> current_density_type;
216 current_density_type Jfield(device, ctype, potential, carrier, mobility_model);
217 // quantity IS GOING TO BE COPIED!
219 }
220
228 template <typename SHEQuantity,
229 typename WriterType>
231 SHEQuantity const & quan,
232 WriterType & writer,
233 std::string name)
234 {
236 // quantity IS GOING TO BE COPIED!
238 }
239
240
241 } // namespace io
242} // namespace viennashe
243
244
245#endif /* VIENNASHE_IO_ADD_TO_WRITER_HPP */
246
The main SHE configuration class. To be adjusted by the user for his/her needs.
Definition: config.hpp:124
An accessor to the current density on vertices and edges (drift diffusion only!)
Defines the physical properties of a device, e.g. doping. This is the implementation for 2d and highe...
Definition: device.hpp:818
A wrapper for the accessor in viennashe, in order for them to be suitable for viennagrid.
value_type const & at(ElementT const &el) const
viennagrid_accessor_wrapper(viennagrid_accessor_wrapper const &o)
value_type const * find(ElementT const &el) const
value_type const & operator()(ElementT const &el) const
An accessor for the average carrier energy at each point inside the device.
Accessor class providing the carrier velocity inside the device.
Computes the electric field from a potential.
Contains forward declarations and definition of small classes that must be defined at an early stage.
void add_macroscopic_quantity_to_writer_impl(MacroscopicQuantityAccessor const &quantity, WriterType &writer, std::string name, double *dummy=0)
Implementation of the quantity addition to a writer for single valued quantities.
void add_kinetic_carrier_energy_to_writer(viennashe::config const &conf, SHEQuantity const &quan, WriterType &writer, std::string name)
Free function to add the average carrier energy to a writer.
void add_macroscopic_quantity_to_writer(MacroscopicQuantityAccessor const &quantity, WriterType &writer, std::string name)
Adds a quantity to a writer.
void add_current_density_to_writer(DeviceType const &device, viennashe::config const &conf, SHEQuantity const &quan, WriterType &writer, std::string name)
Special free function to add the current density - calculated from a solution of the BTE - to a write...
void add_potential_to_writer(PotentialAccessor const &pot, WriterType &writer, std::string name)
Special free function to add the potential to a writer.
The main ViennaSHE namespace. All functionality resides inside this namespace.
Definition: accessors.hpp:40
carrier_type_id
Enumeration type for selecting the carrier type.
Definition: forwards.h:185
Computes the current density (both Jn and Jp) after using a drift diffusion solution.
Convenience header, which includes all postprocessing quantities available.