Dune-Fufem 2.11-git
Loading...
Searching...
No Matches
boundarydofs.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set ts=4 sw=2 et sts=2:
3
4// SPDX-FileCopyrightText: Copyright © DUNE-FUFEM 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_FUFEM_FUNCTIONTOOLS_BOUNDARYDOFS_HH
8#define DUNE_FUFEM_FUNCTIONTOOLS_BOUNDARYDOFS_HH
9
11
14
15#include <dune/functions/backends/concepts.hh>
18
19
20
21namespace Dune::Fufem {
22
43 template <class IntersectionSet, class Basis, class Vector>
45 void markIntersectionDofs(const IntersectionSet& intersectionSet,
46 const Basis& basis,
47 Vector& vector)
48 {
49 auto&& toVectorBackend = [&](auto& v) -> decltype(auto) {
50 if constexpr (Dune::models<Dune::Functions::Concept::VectorBackend<Basis>, decltype(v)>()) {
51 return v;
52 } else {
54 }
55 };
56 auto&& vectorBackend = toVectorBackend(vector);
57 vectorBackend.resize(basis);
58 vectorBackend = false;
59
60 auto localView = basis.localView();
61 auto seDOFs = Dune::Functions::subEntityDOFs(basis);
62 const auto& gridView = basis.gridView();
63 if constexpr (requires{ intersectionSet.begin(); intersectionSet.end(); })
64 for(const auto& intersection: intersectionSet)
65 {
66 localView.bind(intersection.inside());
67 for(auto localIndex: seDOFs.bind(localView,intersection))
68 vectorBackend[localView.index(localIndex)] = true;
69 }
70 else
71 for(auto&& element : elements(gridView))
72 {
73 if constexpr (requires{intersectionSet.containsFaceOf(element);})
74 if (not intersectionSet.containsFaceOf(element))
75 continue;
76 localView.bind(element);
77 for(const auto& intersection: intersections(gridView, element))
78 {
80 if (not intersection.boundary())
81 continue;
82 if (intersectionSet.contains(intersection))
83 for(auto localIndex: seDOFs.bind(localView,intersection))
84 vectorBackend[localView.index(localIndex)] = true;
85 }
86 }
87 }
88
89
90
103 template <class GridView, class Basis, class Vector>
105 const Basis& basis,
106 Vector& vector)
107 {
108 markIntersectionDofs(boundaryPatch, basis, vector);
109 }
110
111
112
127 template <class Basis, class Vector>
128 void markBoundaryDofs(const Basis& basis, Vector& vector)
129 {
131 }
132
133
134} // namespace Dune::Fufem
135
136
137
138#endif // DUNE_FUFEM_FUNCTIONTOOLS_BOUNDARYDOFS_HH
auto subEntityDOFs(const T &)
auto istlVectorBackend(Vector &v)
void markBoundaryPatchDofs(const BoundaryPatch< GridView > &boundaryPatch, const Basis &basis, Vector &vector)
For a given basis and boundary patch, determine all degrees of freedom on the patch.
Definition boundarydofs.hh:104
void markIntersectionDofs(const IntersectionSet &intersectionSet, const Basis &basis, Vector &vector)
For a given basis and intersection set, determine all degrees of freedom on the patch.
Definition boundarydofs.hh:45
void markBoundaryDofs(const Basis &basis, Vector &vector)
For a given basis determine all degrees of freedom on the boundary.
Definition boundarydofs.hh:128
constexpr Boundary boundary
Object representing the full grid view boundary as integration domain.
Definition domains.hh:242
Definition dunefunctionsboundaryfunctionalassembler.hh:29
Encapsulate a subset of the boundary intersections of a GridView.
Definition domains/boundarypatch.hh:37
Traits class to identify boundary integration domains.
Definition domains.hh:49
Traits class to identify skeleton integration domains.
Definition domains.hh:62