dune-functions 2.9.0
boundarydofs.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_BOUNDARYDOFS_HH
4#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_BOUNDARYDOFS_HH
5
6#include <utility>
7
9
10namespace Dune {
11namespace Functions {
12
13
14
34template<class Basis, class F,
35 decltype(std::declval<std::decay_t<F>>()(0, std::declval<typename Basis::LocalView>(),std::declval<typename Basis::GridView::Intersection>()), 0) = 0>
36void forEachBoundaryDOF(const Basis& basis, F&& f)
37{
38 auto localView = basis.localView();
39 auto seDOFs = subEntityDOFs(basis);
40 const auto& gridView = basis.gridView();
41 for(auto&& element : elements(gridView))
42 if (element.hasBoundaryIntersections())
43 {
44 localView.bind(element);
45 for(const auto& intersection: intersections(gridView, element))
46 if (intersection.boundary())
47 for(auto localIndex: seDOFs.bind(localView,intersection))
48 f(localIndex, localView, intersection);
49 }
50}
51
52
53
71template<class Basis, class F,
72 decltype(std::declval<std::decay_t<F>>()(0, std::declval<typename Basis::LocalView>()),0) = 0>
73void forEachBoundaryDOF(const Basis& basis, F&& f)
74{
75 auto localView = basis.localView();
76 auto seDOFs = subEntityDOFs(basis);
77 const auto& gridView = basis.gridView();
78 for(auto&& element : elements(gridView))
79 if (element.hasBoundaryIntersections())
80 {
81 localView.bind(element);
82 for(const auto& intersection: intersections(gridView, element))
83 if (intersection.boundary())
84 for(auto localIndex: seDOFs.bind(localView,intersection))
85 f(localIndex, localView);
86 }
87}
88
89
90
107template<class Basis, class F,
108 decltype(std::declval<std::decay_t<F>>()(std::declval<typename Basis::MultiIndex>()),0) = 0>
109void forEachBoundaryDOF(const Basis& basis, F&& f)
110{
111 auto localView = basis.localView();
112 auto seDOFs = subEntityDOFs(basis);
113 const auto& gridView = basis.gridView();
114 for(auto&& element : elements(gridView))
115 if (element.hasBoundaryIntersections())
116 {
117 localView.bind(element);
118 for(const auto& intersection: intersections(gridView, element))
119 if (intersection.boundary())
120 for(auto localIndex: seDOFs.bind(localView,intersection))
121 f(localView.index(localIndex));
122 }
123}
124
125
126
127} // namespace Functions
128} // namespace Dune
129
130#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_BOUNDARYDOFS_HH
auto subEntityDOFs(const T &)
Create SubEntityDOFs object.
Definition: subentitydofs.hh:160
void forEachBoundaryDOF(const Basis &basis, F &&f)
Loop over all DOFs on the boundary.
Definition: boundarydofs.hh:36
Definition: polynomial.hh:10