Dune::Copasi
Loading...
Searching...
No Matches
boundary_entity_mapper.hh
Go to the documentation of this file.
1#ifndef DUNE_COPASI_GRID_BOUNDARY_ENTITY_MAPPER_HH
2#define DUNE_COPASI_GRID_BOUNDARY_ENTITY_MAPPER_HH
3
4#include <dune-copasi-config.hh>
5
6#include <dune/grid/common/mcmgmapper.hh>
7#include <dune/grid/common/rangegenerators.hh>
8
9#include <dune/grid/concepts/gridview.hh>
10
11#include <memory>
12
13namespace Dune::Copasi {
14
15
24template<Dune::Concept::GridView GridView>
26{
27public:
29 : _mapper{ grid_view, [](GeometryType gt, int griddim) { return gt.dim() != static_cast<unsigned int>(griddim); } }
30 , _boundary(_mapper.size(), false)
31 {
32 for (const auto& entity : elements(grid_view)) {
33 for (const auto& intersection : intersections(grid_view, entity)) {
34 if (intersection.boundary()) {
35 auto face = intersection.indexInInside();
36 const auto& refelem = referenceElement(entity.geometry());
37 for (std::size_t codim = 1; codim != (GridView::dimension+1); ++codim) {
38 unsigned int sz = refelem.size(face, 1, codim);
39 for (unsigned int sub_entity = 0; sub_entity != sz; ++sub_entity) {
40 unsigned int local_idx = refelem.subEntity(face, 1, sub_entity, codim);
41 unsigned int idx = _mapper.subIndex(entity, local_idx, codim);
42 _boundary[idx] = true;
43 }
44 }
45 }
46 }
47 }
48 }
49
51 bool isBoundary(const auto& entity, auto local_index, auto codim) const
52 {
53 return _boundary[_mapper.subIndex(entity, local_index, codim)];
54 }
55
57 std::vector<bool> _boundary;
58};
59
60} // namespace Dune::Copasi
61
62#endif // DUNE_COPASI_GRID_BOUNDARY_ENTITY_MAPPER_HH
Mapper of boundary entities.
Definition boundary_entity_mapper.hh:26
std::vector< bool > _boundary
Definition boundary_entity_mapper.hh:57
MultipleCodimMultipleGeomTypeMapper< GridView > _mapper
Definition boundary_entity_mapper.hh:56
BoundaryEntityMapper(GridView grid_view)
Definition boundary_entity_mapper.hh:28
bool isBoundary(const auto &entity, auto local_index, auto codim) const
Whether a sub-entity is in the boundary of the grid view.
Definition boundary_entity_mapper.hh:51
Definition axis_names.hh:7
constexpr bool is_bitflags_v
Alias for Bitflag indicator.
Definition bit_flags.hh:24