1#ifndef VIENNASHE_SIMULATOR_SETUP_HPP
2#define VIENNASHE_SIMULATOR_SETUP_HPP
37#include "viennagrid/algorithm/norm.hpp"
38#include "viennagrid/algorithm/quantity_transfer.hpp"
39#include "viennagrid/algorithm/closest_points.hpp"
40#include "viennagrid/algorithm/distance.hpp"
42#include "viennagrid/mesh/segmentation.hpp"
43#include "viennagrid/mesh/mesh_operations.hpp"
64 template <
typename ElementTagT,
typename DeviceType,
typename AccessorType,
typename FilterType,
typename CheckerType>
66 AccessorType
const & accessor,
67 FilterType
const & filter,
68 CheckerType
const & checker)
70 typedef typename DeviceType::mesh_type MeshType;
71 typedef typename viennagrid::result_of::const_element_range<MeshType, ElementTagT>::type NCellContainer;
72 typedef typename viennagrid::result_of::iterator<NCellContainer>::type NCellIterator;
76 bool quantity_okay =
true;
79 for (NCellIterator nit = cells.begin();
86 if (!checker(accessor(*nit)))
88 quantity_okay =
false;
112 template <
typename TagT,
typename FallbackTagT,
typename DeviceType,
113 typename AccessorType,
typename FilterType,
typename CheckerType,
114 typename FallbackAccessorType,
typename FallbackSetterType,
typename FallbackAveragerType,
typename FallbackFilterType,
typename FallbackCheckerType>
116 AccessorType
const & accessor,
117 FilterType
const & filter,
118 CheckerType
const & checker,
119 FallbackAccessorType
const & fallback_accessor,
120 FallbackSetterType & fallback_setter,
121 FallbackAveragerType
const & fallback_averager,
122 FallbackFilterType
const & fallback_filter,
123 FallbackCheckerType
const & fallback_checker
126 bool quantity_okay = check_quantity_on_ncell<TagT>(
device, accessor, filter, checker);
132 viennagrid::quantity_transfer<FallbackTagT, TagT>(
device.
mesh(),
133 fallback_accessor, fallback_setter,
135 fallback_filter, filter);
138 check_quantity_on_ncell<TagT>(
device, accessor, filter, fallback_checker);
168 template <
typename DeviceType>
171 typedef typename viennagrid::result_of::cell_tag<typename DeviceType::mesh_type>::type CellTag;
185 bool fallback_used = detail::setup_and_check_quantity_on_ncell_with_fallback<viennagrid::vertex_tag, CellTag>(
192 log::info() <<
"* setup_doping_on_vertices(): Doping defined on cells successfully transferred to vertices. " << std::endl;
196 log::info() <<
"* setup_doping_on_vertices(): Doping defined on vertices passes consistency check." << std::endl;
205 template <
typename DeviceType>
Contains the definition of per-device accessors (read-only!) for various quantities.
Defines a set of checker functors for micro-tests within ViennaSHE.
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...
Accessor for returning the doping (donator/acceptor doping is defined in the CTOR)
Convenience functor for setting the doping across the device.
Exception for the case that an invalid doping is encountered.
Checker for values inside a half-open interval [a, b), where 'a' is included, while 'b' is not.
A filter accepting semiconductor cells only.
A filter returning true if any of the neighboring ncells of dimension 'dim' evaluate to true.
Contains the definition of a device class independent of the actual macroscopic model to be solved.
Provides the exceptions used in the main viennashe namespace.
Defines several filter functors for the device. A filter functor returns true if the supplied argumen...
Contains forward declarations and definition of small classes that must be defined at an early stage.
A logging facility providing fine-grained control over logging in ViennaSHE.
A very simple material database. Needs to be replaced by something more versatile soon.
invalid_doping_in_device_exception get_invalid_doping_exception(viennashe::carrier_type_id ctype)
Helper routine for creating the exception thrown if the donator doping is found to be invalid on the ...
bool setup_and_check_quantity_on_ncell_with_fallback(DeviceType &device, AccessorType const &accessor, FilterType const &filter, CheckerType const &checker, FallbackAccessorType const &fallback_accessor, FallbackSetterType &fallback_setter, FallbackAveragerType const &fallback_averager, FallbackFilterType const &fallback_filter, FallbackCheckerType const &fallback_checker)
Ensures that a quantity is available on n-cells of a certain dimension. If this is not the case,...
bool check_quantity_on_ncell(DeviceType const &device, AccessorType const &accessor, FilterType const &filter, CheckerType const &checker)
Ensures that a quantity is available on n-cells of a certain dimension. If this is not the case,...
logger< true > info()
Used to log infos. The logging level is logINFO.
checker_with_exception< CheckerType, ExceptionType > make_checker_with_exception(CheckerType const &checker, ExceptionType const &ex)
Convenience creator routine for creating a checker with exception from checker returning a bool only.
The main ViennaSHE namespace. All functionality resides inside this namespace.
void setup_doping_on_vertices(DeviceType &device, viennashe::carrier_type_id ctype)
Sets up donator or acceptor doping on vertices. If doping is provided on cells, it is interpolated ac...
carrier_type_id
Enumeration type for selecting the carrier type.
Returns a few helper routines for computing physical quantities. To be replaced in the future.
Contains the definition of convenience functors for accessing device quantities (see class device)....
A functor which computes the geometric average of all entries in a container.