Dune-Fufem 2.11-git
Loading...
Searching...
No Matches
dunefunctionsboundaryfunctionalassembler.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
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_ASSEMBERS_DUNEFUNCTIONSBOUNDARYFUNCTIONALASSEMBLER_HH
8#define DUNE_FUFEM_ASSEMBERS_DUNEFUNCTIONSBOUNDARYFUNCTIONALASSEMBLER_HH
9
10#ifndef DUNE_FUFEM_DISABLE_HEADER_DEPRECATION
11#warning This header is deprecated and will be removed after 2.11. Use the global assemblers from dune/assembler/defaultglobalassembler.hh instead.
12#endif
13
22
23#include <dune/istl/matrix.hh>
24
26
27
28namespace Dune {
29namespace Fufem {
30
31
38template <class TestBasis>
39class
40[[deprecated("This class will be removed after 2.11. Use Dune::Assembler::Assembler together with Dune::Fufem::Forms based local assemblers instead.")]]
42{
43 using GridView = typename TestBasis::GridView;
44
45public:
47 [[deprecated("This class will be removed after 2.11. Use Dune::Assembler::Assembler together with Dune::Fufem::Forms based local assemblers instead.")]]
48 DuneFunctionsBoundaryFunctionalAssembler(const TestBasis& tBasis, const BoundaryPatch<GridView>& boundaryPatch) :
49 testBasis_(tBasis),
50 boundaryPatch_(boundaryPatch)
51 {}
52
53
54
55 template <class VectorBackend, class LocalAssembler>
56 void assembleBulkEntries(VectorBackend&& vectorBackend, LocalAssembler&& localAssembler) const
57 {
58 auto testLocalView = testBasis_.localView();
59
60 using Field = std::decay_t<decltype(vectorBackend[testLocalView.index(0)])>;
62
63 auto localVector = LocalVector(testLocalView.maxSize());
64
65 // iterate over boundary
66 for (auto it =boundaryPatch_.begin(); it!= boundaryPatch_.end(); ++it)
67 {
68 const auto& element = it->inside();
69 testLocalView.bind(element);
70
71 for (size_t i=0; i<testLocalView.tree().size(); ++i)
72 {
73 auto localRow = testLocalView.tree().localIndex(i);
74 localVector[localRow] = 0;
75 }
76
77 localAssembler(it, localVector, testLocalView);
78
79 for (size_t i=0; i<testLocalView.tree().size(); ++i)
80 {
81 auto localRow = testLocalView.tree().localIndex(i);
82 auto row = testLocalView.index(localRow);
83 vectorBackend[row] += localVector[localRow];
84 }
85 }
86 }
87
88 template <class VectorBackend, class LocalAssembler>
89 void assembleBulk(VectorBackend&& vectorBackend, LocalAssembler&& localAssembler) const
90 {
91 vectorBackend.resize(testBasis_);
92 vectorBackend.vector() = 0.0;
93 assembleBulkEntries(vectorBackend, std::forward<LocalAssembler>(localAssembler));
94 }
95
96
97protected:
98 const TestBasis& testBasis_;
100};
101
102
110template <class TestBasis, class BP>
111[[deprecated("This function will be removed after 2.11. Use Dune::Assembler::Assembler together with Dune::Fufem::Forms based local assemblers instead.")]]
112auto duneFunctionsBoundaryFunctionalAssembler(const TestBasis& testBasis, const BP& bp)
113{
117}
118
119
120
121} // namespace Fufem
122} // namespace Dune
123
124
125#endif
126
int size() const
#define DUNE_NO_DEPRECATED_END
#define DUNE_NO_DEPRECATED_BEGIN
auto duneFunctionsBoundaryFunctionalAssembler(const TestBasis &testBasis, const BP &bp)
Create DuneFunctionsBoundaryFunctionalAssembler.
Definition dunefunctionsboundaryfunctionalassembler.hh:112
Generic global assembler for functionals on a boundary.
Definition dunefunctionsboundaryfunctionalassembler.hh:42
const BoundaryPatch< GridView > & boundaryPatch_
Definition dunefunctionsboundaryfunctionalassembler.hh:99
void assembleBulk(VectorBackend &&vectorBackend, LocalAssembler &&localAssembler) const
Definition dunefunctionsboundaryfunctionalassembler.hh:89
DuneFunctionsBoundaryFunctionalAssembler(const TestBasis &tBasis, const BoundaryPatch< GridView > &boundaryPatch)
create assembler for grid
Definition dunefunctionsboundaryfunctionalassembler.hh:48
const TestBasis & testBasis_
Definition dunefunctionsboundaryfunctionalassembler.hh:98
void assembleBulkEntries(VectorBackend &&vectorBackend, LocalAssembler &&localAssembler) const
Definition dunefunctionsboundaryfunctionalassembler.hh:56
Encapsulate a subset of the boundary intersections of a GridView.
Definition domains/boundarypatch.hh:37
T forward(T... args)