DUNE PDELab (git)

boundarydofs.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
5// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
6
7#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_BOUNDARYDOFS_HH
8#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_BOUNDARYDOFS_HH
9
10#include <utility>
11
12#include <dune/functions/functionspacebases/subentitydofs.hh>
13
14namespace Dune {
15namespace Functions {
16
17
18
38template<class Basis, class F,
39 decltype(std::declval<std::decay_t<F>>()(0, std::declval<typename Basis::LocalView>(),std::declval<typename Basis::GridView::Intersection>()), 0) = 0>
40void forEachBoundaryDOF(const Basis& basis, F&& f)
41{
42 auto localView = basis.localView();
43 auto seDOFs = subEntityDOFs(basis);
44 const auto& gridView = basis.gridView();
45 for(auto&& element : elements(gridView))
46 if (element.hasBoundaryIntersections())
47 {
48 localView.bind(element);
49 for(const auto& intersection: intersections(gridView, element))
50 if (intersection.boundary())
51 for(auto localIndex: seDOFs.bind(localView,intersection))
52 f(localIndex, localView, intersection);
53 }
54}
55
56
57
75template<class Basis, class F,
76 decltype(std::declval<std::decay_t<F>>()(0, std::declval<typename Basis::LocalView>()),0) = 0>
77void forEachBoundaryDOF(const Basis& basis, F&& f)
78{
79 auto localView = basis.localView();
80 auto seDOFs = subEntityDOFs(basis);
81 const auto& gridView = basis.gridView();
82 for(auto&& element : elements(gridView))
83 if (element.hasBoundaryIntersections())
84 {
85 localView.bind(element);
86 for(const auto& intersection: intersections(gridView, element))
87 if (intersection.boundary())
88 for(auto localIndex: seDOFs.bind(localView,intersection))
89 f(localIndex, localView);
90 }
91}
92
93
94
111template<class Basis, class F,
112 decltype(std::declval<std::decay_t<F>>()(std::declval<typename Basis::MultiIndex>()),0) = 0>
113void forEachBoundaryDOF(const Basis& basis, F&& f)
114{
115 auto localView = basis.localView();
116 auto seDOFs = subEntityDOFs(basis);
117 const auto& gridView = basis.gridView();
118 for(auto&& element : elements(gridView))
119 if (element.hasBoundaryIntersections())
120 {
121 localView.bind(element);
122 for(const auto& intersection: intersections(gridView, element))
123 if (intersection.boundary())
124 for(auto localIndex: seDOFs.bind(localView,intersection))
125 f(localView.index(localIndex));
126 }
127}
128
129
130
131} // namespace Functions
132} // namespace Dune
133
134#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_BOUNDARYDOFS_HH
auto subEntityDOFs(const T &)
Create SubEntityDOFs object.
Definition: subentitydofs.hh:164
void forEachBoundaryDOF(const Basis &basis, F &&f)
Loop over all DOFs on the boundary.
Definition: boundarydofs.hh:40
Dune namespace.
Definition: alignedallocator.hh:13
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 13, 23:29, 2024)