1#ifndef VIENNASHE_UTIL_POSTPROC_ELECTRIC_FIELD_HPP
2#define VIENNASHE_UTIL_POSTPROC_ELECTRIC_FIELD_HPP
25#include "viennagrid/mesh/mesh.hpp"
26#include "viennagrid/algorithm/volume.hpp"
27#include "viennagrid/algorithm/inner_prod.hpp"
51 template <
typename DeviceType,
52 typename PotentialAccessorType>
55 typedef typename DeviceType::mesh_type
MeshType;
57 typedef typename viennagrid::result_of::facet<MeshType>::type
FacetType;
58 typedef typename viennagrid::result_of::cell<MeshType>::type
CellType;
62 template <
typename FacetType>
65 typedef typename viennagrid::result_of::const_coboundary_range<MeshType, FacetType, CellType>::type CellOnFacetContainer;
66 typedef typename viennagrid::result_of::iterator<CellOnFacetContainer>::type CellOnFacetIterator;
68 CellOnFacetContainer cells_on_facet(device_.mesh(), viennagrid::handle(device_.mesh(), facet));
70 if (cells_on_facet.size() < 2)
73 CellOnFacetIterator cofit = cells_on_facet.begin();
79 const double potential_center = potential_.get_value(c1);
80 const double potential_outer = potential_.get_value(c2);
82 const double connection_len =
viennagrid::norm_2(viennagrid::centroid(c2) - viennagrid::centroid(c1));
83 const double Emag = -(potential_outer - potential_center) / connection_len;
88 DeviceType
const & device_;
89 PotentialAccessorType
const & potential_;
96 template <
typename DeviceType,
typename PotentialAccessorType >
100 typedef typename DeviceType::mesh_type MeshType;
101 typedef typename MeshType::config_type ConfigType;
103 typedef typename viennagrid::result_of::point<MeshType>::type PointType;
106 typedef typename viennagrid::result_of::facet<MeshType>::type
FacetType;
107 typedef typename viennagrid::result_of::cell<MeshType>::type
CellType;
117 return facet_eval(facet);
123 typedef typename viennagrid::result_of::const_facet_range<CellType>::type FacetOnCellContainer;
128 std::vector<double> E(3);
130 if (!no_conductor_filter(device_.get_material(cell)))
return E;
134 FieldOnFacetEvaluator facet_evaluator(device_, potential_);
136 FacetOnCellContainer facets_on_cell(cell);
138 cell, facets_on_cell,
139 result, facet_evaluator);
145 DeviceType
const & device_;
146 PotentialAccessorType
const & potential_;
159 template <
typename DeviceType,
160 typename PotentialAccessor,
161 typename ContainerType>
164 ContainerType & container)
Defines a set of checker functors for micro-tests within ViennaSHE.
Defines the physical properties of a device, e.g. doping. This is the implementation for 2d and highe...
Simple checker class for checking whether a certain material is of a given type (conductor,...
A functor which holds a single value. Used in most of the postprocessing routines.
Helper routines for projecting normal components of a vector-valued quantity defined on edges to vert...
A logging facility providing fine-grained control over logging in ViennaSHE.
Writer for arbitrary macroscopic quantities.
A very simple material database. Needs to be replaced by something more versatile soon.
VectorType::value_type norm_2(VectorType const &v)
void dual_box_flux_to_cell(DeviceT const &device, CellT const &cell, FacetContainerT const &facets, CellSetterT &cell_setter, FacetAccessorT const &facet_access)
Interpolates normal components of the flux defined on each facet to cells. Mostly used for visualizat...
The main ViennaSHE namespace. All functionality resides inside this namespace.
@ MATERIAL_NO_CONDUCTOR_ID
void write_electric_field_to_container(DeviceType const &device, PotentialAccessor const &potential, ContainerType &container)
Convenience function for writing the electric field to a container.
void write_macroscopic_quantity_to_container(DeviceType const &device, MacroscopicQuantityAccessor const &quantity, ContainerType &quantity_container)
Writes the provided macroscopic quantity to the container provided.
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.
An accessor to the electric field along a given edge. Electrostatic potential required.
DeviceType::mesh_type MeshType
viennagrid::result_of::cell< MeshType >::type CellType
electric_field_on_facet(DeviceType const &device, PotentialAccessorType const &potential)
viennagrid::result_of::facet< MeshType >::type FacetType
double operator()(FacetType const &facet) const
An accessor to the electric field on vertices and edges. Potential requiered.
electric_field_wrapper(DeviceType const &device, PotentialAccessorType const &potential)
viennagrid::result_of::facet< MeshType >::type FacetType
viennagrid::result_of::cell< MeshType >::type CellType
value_type operator()(CellType const &cell) const
std::vector< double > value_type
double operator()(FacetType const &facet) const