Debian Codegraph @

python/dune/functions/boundarydofs.py

raw
1 # SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
2 # SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
3
4 import dune.common
5
6
7 # Mark all degrees of freedom on the grid boundary
8 def forEachBoundaryDOF(basis, callBack):
9 """Loop over all degrees of freedom (DOFs) associated to the boundary
10
11 This loops over all DOFs of a basis associated to sub-entities
12 on the boundary. This overload will pass a single argument to the
13 given loop callback: The global (multi-)index of the boundary DOF.
14
15 Notice that the same DOF may be visited multiple times.
16
17 Parameters
18 ----------
19 arg0: A function space basis that defines a set of degrees of freedom
20 arg1: A callback that will be called with the global index of the visited boundary DOF
21 """
22 from io import StringIO
23 from dune import generator
24 code="""
25 #include<dune/functions/functionspacebases/boundarydofs.hh>
26 template<class Basis, class CallBack>
27 void run(const Basis& basis, CallBack& callBack)
28 {
29 Dune::Functions::forEachBoundaryDOF<Basis,std::function<void(std::size_t)> >(basis, callBack);
30 }
31 """
32 dune.generator.algorithm.run("run",StringIO(code), basis, callBack)