1#ifndef VIENNASHE_SHE_TRANSFER_TO_NEW_H_SPACE_HPP
2#define VIENNASHE_SHE_TRANSFER_TO_NEW_H_SPACE_HPP
21#include "viennagrid/mesh/mesh.hpp"
22#include "viennagrid/algorithm/voronoi.hpp"
58 template <
typename ElementType,
59 typename VertexT,
typename EdgeT>
82 std::size_t max_unknown_num = std::max<std::size_t>(new_quan.
get_unknown_num(el, index_H ),
84 std::vector<double> values(max_unknown_num);
85 for (std::size_t i=0; i<old_quan.
get_unknown_num(el, std::size_t(old_index_H)); ++i)
86 values[i] = old_quan.
get_values(el, std::size_t(old_index_H))[i];
87 new_quan.
set_values(el, index_H, &(values[0]));
93 template <
typename ElementType,
94 typename VertexT,
typename EdgeT>
97 double scaling_factor)
104 for (std::size_t i=0; i<values.size(); ++i)
105 values[i] = quan.
get_values(el, index_H)[i] * scaling_factor;
121 template <
typename DeviceType>
127 typedef typename DeviceType::mesh_type MeshType;
129 typedef typename viennagrid::result_of::cell<MeshType>::type CellType;
130 typedef typename viennagrid::result_of::facet<MeshType>::type FacetType;
132 typedef typename viennagrid::result_of::const_facet_range<MeshType>::type FacetContainer;
133 typedef typename viennagrid::result_of::iterator<FacetContainer>::type FacetIterator;
135 typedef typename viennagrid::result_of::const_cell_range<MeshType>::type CellContainer;
136 typedef typename viennagrid::result_of::iterator<CellContainer>::type CellIterator;
147 if (new_quan.get_value_H_size() == 0)
154 old_edge_evaluator(
device, conf, old_quan);
156 new_edge_evaluator(
device, conf, new_quan);
161 CellContainer cells(mesh);
162 for (CellIterator cit = cells.begin();
166 for (std::size_t index_H = 1; index_H < new_quan.get_value_H_size() - 1; ++index_H)
170 double density_old = old_density_wrapper(*cit);
171 double density_new = new_density_wrapper(*cit);
173 if (density_new > 0 && density_old > 0)
181 FacetContainer facets(mesh);
182 for (FacetIterator fit = facets.begin();
186 for (std::size_t index_H = 1; index_H < new_quan.get_value_H_size()-1; ++index_H)
190 double current_old = old_edge_evaluator(*fit);
191 double current_new = new_edge_evaluator(*fit);
193 if (current_new && current_old)
Common routines for the assembly of SHE equations.
Writes a possibly scaled block matrix to the system matrix. Includes similar functionality for comput...
Provides an accessor for the carrier density.
Defines a set of checker functors for micro-tests within ViennaSHE.
The main SHE configuration class. To be adjusted by the user for his/her needs.
MeshT const & mesh() const
Returns the underlying mesh.
Defines the physical properties of a device, e.g. doping. This is the implementation for 2d and highe...
An accessor for the carrier density in the device.
The main SHE simulator controller class. Acts as an accessor for all SHE quantities needed for the si...
UnknownSHEQuantityListType & unknown_she_quantities()
General representation of any solver quantity defined on two different element types (e....
std::size_t get_unknown_num(AssociatedT1 const &elem, std::size_t index_H) const
long get_unknown_index(AssociatedT1 const &elem, std::size_t index_H) const
std::size_t get_expansion_order(AssociatedT1 const &elem, std::size_t index_H) const
std::size_t get_value_H_size() const
ValueT get_kinetic_energy(AssociatedT1 const &elem, std::size_t index_H) const
ValueT const * get_values(AssociatedT1 const &elem, std::size_t index_H) const
void set_values(AssociatedT1 const &elem, std::size_t index_H, ValueT const *values)
Contains the dispersion relations for different materials and different polarities.
Provides the SHE coupling matrices and computes higher-order coupling matrices if required....
Implementation of numerical integration routines.
A logging facility providing fine-grained control over logging in ViennaSHE.
Provides a number of fundamental math constants.
void transfer_to_new_H_space_on_element(ElementType const &el, std::size_t index_H, she::unknown_she_quantity< VertexT, EdgeT > const &old_quan, she::unknown_she_quantity< VertexT, EdgeT > &new_quan)
void normalize_on_new_H_space(ElementType const &el, she::unknown_she_quantity< VertexT, EdgeT > &quan, double scaling_factor)
void transfer_to_new_h_space(DeviceType const &device, viennashe::she::timestep_quantities< DeviceType > const &old_quantities, viennashe::she::timestep_quantities< DeviceType > &new_quantities, viennashe::config const &conf)
Interface transferring a solution given by 'old_solution' on some other (old) grid to the new grid.
long energy_index_H(SHEQuantity const &quan, ElementType const &elem, long index_H_hint, double kinetic_energy)
Finds the closest H-index for the provided kinetic energy.
The main ViennaSHE namespace. All functionality resides inside this namespace.
Provides a number of fundamental constants. All constants in SI units.
Returns a few helper routines for computing physical quantities. To be replaced in the future.
Provides an accessor for the current density.
Implementation of spherical harmonics plus helper functions.
A container of all quantities defined for a certain timestep t.
Defines the log keys used within the viennashe::she namespace.