File: subspacebasis.hh

package info (click to toggle)
dune-functions 2.10.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,544 kB
  • sloc: cpp: 14,241; python: 661; makefile: 3
file content (38 lines) | stat: -rw-r--r-- 1,226 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later

#ifndef DUNE_PYTHON_FUNCTIONS_SUBSPACEBASIS_HH
#define DUNE_PYTHON_FUNCTIONS_SUBSPACEBASIS_HH

#include <type_traits>

#include <dune/functions/functionspacebases/subspacebasis.hh>

#include <dune/python/pybind11/pybind11.h>
#include <dune/python/pybind11/stl.h>

#include <dune/python/functions/globalbasis.hh>

namespace Dune
{

  namespace Python
  {

    template< class SubspaceBasis, class... options >
    DUNE_EXPORT void registerSubspaceBasis ( pybind11::module module, pybind11::class_< SubspaceBasis, options... > &cls )
    {
      using RootBasis = typename SubspaceBasis::RootBasis;

      // Use default constructed TreePath. This requires, that
      // the PrefixPath template parameter of SubspaceBasis is
      // a fully static tree path.
      auto construct = [] ( const RootBasis &rootBasis ) { return new SubspaceBasis( rootBasis, {} ); };
      registerBasisType ( module, cls, construct, std::false_type{} );
    }

  } // namespace Python

} // namespace Dune

#endif // #ifndef DUNE_PYTHON_FUNCTIONS_SUBSPACEBASIS_HH