1#ifndef VIENNASHE_SHE_TIMESTEP_QUANTITIES_HPP
2#define VIENNASHE_SHE_TIMESTEP_QUANTITIES_HPP
42 template <
typename DeviceType>
46 typedef std::vector<double> VectorType;
48 typedef typename DeviceType::mesh_type MeshType;
50 typedef typename viennagrid::result_of::facet<MeshType>::type FacetType;
51 typedef typename viennagrid::result_of::cell<MeshType>::type CellType;
52 typedef typename viennagrid::result_of::cell_tag<MeshType>::type CellTag;
54 typedef std::vector<std::vector<long> > index_vector_type;
55 typedef std::vector<std::vector<double> > trap_occupancy_type;
57 typedef std::vector<long> expansion_order_vector_type;
58 typedef std::vector<double> boundary_values_vector_type;
59 typedef std::vector<double> error_values_vector_type;
94 return cell_trap_unknown_indices_.at(std::size_t(c.id().get())).size();
104 return cell_trap_unknown_indices_.at(c.id().get()).at(inner_index);
109 typedef typename viennagrid::result_of::const_cell_range<MeshType>::type CellContainer;
110 typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator;
112 typedef typename DeviceType::trap_level_container_type TrapContainerType;
113 typedef typename TrapContainerType::const_iterator TrapIterator;
118 cell_trap_unknown_indices_.resize(cells.size());
119 cell_trap_occupancies_.resize(cells.size());
121 for (CellIterator cit = cells.begin();
128 std::vector<long> & idx = cell_trap_unknown_indices_.at(std::size_t(cit->id().get()));
129 idx.resize(traps.size());
130 cell_trap_occupancies_.at(std::size_t(cit->id().get())).resize(traps.size(), 0);
133 for (TrapIterator trap_it = traps.begin(); trap_it != traps.end(); ++trap_it, ++i, ++j)
139 cell_trap_unknown_indices_.at(std::size_t(cit->id().get())).clear();
140 cell_trap_unknown_indices_.at(std::size_t(cit->id().get())).resize(0);
147 return cell_trap_occupancies_.at(std::size_t(c.id().get())).at(inner_index);
150 void trap_occupancy(CellType
const & c, std::size_t inner_index,
double new_occupancy)
152 if(new_occupancy < 0.0 || new_occupancy > 1.0)
154 log::error() <<
"ERROR: Invalid trap occupancy: " << new_occupancy << std::endl;
157 cell_trap_occupancies_.at(std::size_t(c.id().get())).at(inner_index) = new_occupancy;
169 for (std::size_t i=0; i<unknown_she_quantities_.size(); ++i)
171 if (quantity_name == unknown_she_quantities_[i].get_name())
172 return unknown_she_quantities_[i];
176 std::stringstream ss;
177 ss <<
"No SHE quantity named '" << quantity_name <<
"'";
188 for (std::size_t i=0; i<unknown_she_quantities_.size(); ++i)
190 if (quantity_name == unknown_she_quantities_[i].get_name())
191 return unknown_she_quantities_[i];
195 std::stringstream ss;
196 ss <<
"No SHE quantity named '" << quantity_name <<
"'";
229 for (std::size_t i=0; i<unknown_quantities_.size(); ++i)
231 if (quantity_name == unknown_quantities_[i].get_name())
236 std::stringstream ss;
237 ss <<
"No quantity named '" << quantity_name <<
"'";
258 for (std::size_t i=0; i<unknown_quantities_.size(); ++i)
260 if (quantity_name == unknown_quantities_[i].get_name())
261 return unknown_quantities_[i];
265 std::stringstream ss;
266 ss <<
"No unknown quantity named '" << quantity_name <<
"'";
277 for (std::size_t i=0; i<unknown_quantities_.size(); ++i)
279 if (quantity_name == unknown_quantities_[i].get_name())
280 return unknown_quantities_[i];
284 std::stringstream ss;
285 ss <<
"No unknown quantity named '" << quantity_name <<
"'";
295 std::deque<UnknownQuantityType> unknown_quantities_;
298 index_vector_type cell_trap_unknown_indices_;
299 trap_occupancy_type cell_trap_occupancies_;
Contains the definition of per-device accessors (read-only!) for various quantities.
Exception thrown in the case that any code does not support the given carrier type.
Common representation of any quantity associated with objects of a certain type.
long get_material(cell_type const &elem) const
Returns the material id of the provided cell.
MeshT const & mesh() const
Returns the underlying mesh.
trap_level_container_type const & get_trap_levels(cell_type const &cell) const
Returns all the trap levels defined for the provided cell.
Defines the physical properties of a device, e.g. doping. This is the implementation for 2d and highe...
Exception for the case that an invalid value (depends on the method called) is encountered.
Exception in case a (requested) quantity cannot be found.
Common representation of any quantity associated with two objects of a certain type and an index.
A convenience wrapper for accessing the energy distribution function on each vertex of the device.
A convenience wrapper for accessing the generalized energy distribution function (f * Z,...
A convenience wrapper for accessing the distribution function coefficients over the device....
The main SHE simulator controller class. Acts as an accessor for all SHE quantities needed for the si...
UnknownSHEQuantityType const & carrier_distribution_function(viennashe::carrier_type_id ctype) const
long trap_unknown_index(CellType const &c, long inner_index) const
Returns an unknown index for traps associated with a cell.
const_quantity< CellType > ResultQuantityType
UnknownSHEQuantityListType & unknown_she_quantities()
ResultQuantityType electron_density_type
UnknownSHEQuantityType & hole_distribution_function()
const_she_quantity< CellType, FacetType > ResultSHEQuantityType
unknown_quantity< CellType > UnknownQuantityType
UnknownQuantityType unknown_quantity_type
UnknownSHEQuantityType const & electron_distribution_function() const
ResultQuantityType quantity(std::string quantity_name) const
Returns the quantity identified by its name.
ResultQuantityType electron_density() const
ResultQuantityType potential() const
void setup_trap_unkown_indices(DeviceType const &device)
UnknownQuantityType & get_unknown_quantity(std::string quantity_name)
Returns a reference to the unkown quantity identified by its name.
void trap_occupancy(CellType const &c, std::size_t inner_index, double new_occupancy)
std::deque< UnknownQuantityType > const & unknown_quantities() const
UnknownSHEQuantityType const & hole_distribution_function() const
UnknownSHEQuantityType & electron_distribution_function()
UnknownSHEQuantityType & she_quantity(std::string quantity_name)
Returns a reference to a SHE quantity identified by its name.
std::deque< UnknownQuantityType > & unknown_quantities()
UnknownSHEQuantityListType const & unknown_she_quantities() const
viennashe::she::edf_wrapper< DeviceType, UnknownSHEQuantityType > edf_type
unknown_she_quantity< CellType, FacetType > UnknownSHEQuantityType
UnknownSHEQuantityType unknown_she_quantity_type
double trap_occupancy(CellType const &c, std::size_t inner_index) const
viennashe::she::she_df_wrapper< DeviceType, UnknownSHEQuantityType > she_df_type
UnknownQuantityType const & get_unknown_quantity(std::string quantity_name) const
Returns a const reference to the unkown quantity identified by its name.
viennashe::she::generalized_edf_wrapper< DeviceType, UnknownSHEQuantityType > generalized_edf_type
ResultQuantityType hole_density() const
ResultQuantityType dg_pot_p() const
UnknownSHEQuantityType const & she_quantity(std::string quantity_name) const
Returns a const reference to a SHE quantity identified by its name.
ResultQuantityType lattice_temperature() const
ResultQuantityType dg_pot_n() const
std::size_t num_trap_unknown_indices(CellType const &c) const
Returns the number of inner unknown indices (aka. degree of freedom - dof) for traps associated with ...
ResultQuantityType potential_type
ResultQuantityType hole_density_type
std::deque< UnknownSHEQuantityType > UnknownSHEQuantityListType
UnknownSHEQuantityType & carrier_distribution_function(viennashe::carrier_type_id ctype)
The SHE configuration class is defined here.
Provides a convenience wrapper for accessing the distribution function coefficients over the device.
Provides the exceptions used in the main viennashe namespace.
Contains forward declarations and definition of small classes that must be defined at an early stage.
logger< true > error()
Used to log errors. The logging level is logERROR.
bool is_semiconductor(long material_id)
Convenience function for checking whether the supplied material ID refers to a semiconductor.
std::string lattice_temperature()
std::string hole_density()
std::string electron_distribution_function()
std::string density_gradient_hole_correction()
std::string hole_distribution_function()
std::string density_gradient_electron_correction()
std::string electron_density()
The main ViennaSHE namespace. All functionality resides inside this namespace.
carrier_type_id
Enumeration type for selecting the carrier type.
Provides a number of fundamental constants. All constants in SI units.
Defines a SHE quantity in (x, H)-space for use within the solvers of ViennaSHE.
Defines a generic simulator quantity for use within the solvers of ViennaSHE.