1#ifndef VIENNASHE_UTIL_FILTER_HPP
2#define VIENNASHE_UTIL_FILTER_HPP
23#include "viennagrid/mesh/coboundary_iteration.hpp"
54 template <
typename DeviceType>
57 typedef typename DeviceType::mesh_type MeshType;
60 typedef typename viennagrid::result_of::cell<MeshType>::type
cell_type;
67 DeviceType
const & device_;
71 template <
typename DeviceType>
74 typedef typename DeviceType::mesh_type MeshType;
77 typedef typename viennagrid::result_of::vertex<MeshType>::type
vertex_type;
78 typedef typename viennagrid::result_of::cell<MeshType>::type
cell_type;
86 DeviceType
const & device_;
90 template <
typename DeviceType>
93 typedef typename DeviceType::mesh_type MeshType;
96 typedef typename viennagrid::result_of::vertex<MeshType>::type
vertex_type;
97 typedef typename viennagrid::result_of::cell<MeshType>::type
cell_type;
105 DeviceType
const & device_;
110 template <
typename DeviceType>
113 typedef typename DeviceType::mesh_type MeshType;
116 typedef typename viennagrid::result_of::cell<MeshType>::type
cell_type;
122 return !device_.has_contact_potential(cell)
127 DeviceType
const & device_;
134 template <
long a,
long b>
142 template <
typename DeviceType,
typename ElementTagT,
typename CheckerType>
145 typedef typename DeviceType::mesh_type MeshType;
148 vicinity_filter(DeviceType
const & d, CheckerType
const & c) : device_(d), checker_(c) {}
151 template <
typename NCellType>
156 typedef typename viennagrid::result_of::const_coboundary_range<MeshType, NCellType, ElementTagT>::type VicinityContainer;
157 typedef typename viennagrid::result_of::iterator<VicinityContainer>::type VicinityIterator;
159 VicinityContainer vicinity(device_.mesh(), viennagrid::handle(device_.mesh(), cell));
160 for (VicinityIterator vit = vicinity.begin();
161 vit != vicinity.end();
172 template <
typename NCellType>
175 operator()(NCellType
const & cell)
const
177 typedef typename viennagrid::result_of::const_element_range<NCellType, ElementTagT>::type VicinityContainer;
178 typedef typename viennagrid::result_of::iterator<VicinityContainer>::type VicinityIterator;
180 VicinityContainer vicinity = viennagrid::elements<ElementTagT>(cell);
181 for (VicinityIterator vit = vicinity.begin();
182 vit != vicinity.end();
193 DeviceType
const & device_;
194 CheckerType
const & checker_;
199 template <
typename DeviceType>
202 typedef typename DeviceType::mesh_type MeshType;
205 typedef typename viennagrid::result_of::cells<MeshType>::type
cell_type;
212 DeviceType
const & device_;
216 template <
typename DeviceType>
219 typedef typename DeviceType::mesh_type MeshType;
222 typedef typename viennagrid::result_of::cell<MeshType>::type
cell_type;
229 DeviceType
const & device_;
A filter accepting oxide cells only.
viennagrid::result_of::cell< MeshType >::type cell_type
bool operator()(cell_type const &cell) const
oxide_filter(DeviceType const &d)
A filter accepting semiconductor cells only.
semiconductor_filter(DeviceType const &d)
bool operator()(cell_type const &cell) const
viennagrid::result_of::cell< MeshType >::type cell_type
A filter returning true if any of the neighboring ncells of dimension 'dim' evaluate to true.
viennashe::enable_if< detail::is_lesser< NCellType::tag::dim, ElementTagT::dim >::value, bool >::type operator()(NCellType const &cell) const
vicinity_filter(DeviceType const &d, CheckerType const &c)
Simple enable-if variant that uses the SFINAE pattern.
Contains forward declarations and definition of small classes that must be defined at an early stage.
A very simple material database. Needs to be replaced by something more versatile soon.
bool is_semiconductor(long material_id)
Convenience function for checking whether the supplied material ID refers to a semiconductor.
bool is_insulator(long material_id)
Convenience function for checking whether the supplied material ID refers to an oxide.
bool is_conductor(long material_id)
Convenience function for checking whether the supplied material ID refers to a metal.
The main ViennaSHE namespace. All functionality resides inside this namespace.
Simple enable-if variant that uses the SFINAE pattern.
A trivial filter, all objects are accepted.
bool operator()(T const &) const
A trivial filter, no objects shall be accepted.
bool operator()(T const &) const