File: _geometry.cc

package info (click to toggle)
dune-geometry 2.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,304 kB
  • sloc: cpp: 15,221; python: 253; makefile: 3
file content (43 lines) | stat: -rw-r--r-- 1,793 bytes parent folder | download | duplicates (3)
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
39
40
41
42
43
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception

#include <string>

#include <dune-common-config.hh> // DUNE_ENABLE_PYTHONMODULE_PRECOMPILE
#include <dune/python/geometry/type.hh>
#include <dune/python/geometry/referenceelements.hh>
#include <dune/python/pybind11/pybind11.h>

#ifdef DUNE_ENABLE_PYTHONMODULE_PRECOMPILE
#include "registerrefelem.hh"
#endif

PYBIND11_MODULE( _geometry, module )
{
  Dune::Python::registerGeometryType( module );

  // register geometry type constructors
  module.def( "simplex", [] ( int dim ) { return Dune::GeometryTypes::simplex( dim ); } );
  module.def( "cube", [] ( int dim ) { return Dune::GeometryTypes::cube( dim ); } );
  module.def( "none", [] ( int dim ) { return Dune::GeometryTypes::none( dim ); } );

  // register predefined geometry types
  module.attr( "vertex" ) = Dune::GeometryTypes::vertex;
  module.attr( "line" ) = Dune::GeometryTypes::line;
  module.attr( "triangle" ) = Dune::GeometryTypes::triangle;
  module.attr( "quadrilateral" ) = Dune::GeometryTypes::quadrilateral;
  module.attr( "tetrahedron" ) = Dune::GeometryTypes::tetrahedron;
  module.attr( "pyramid" ) = Dune::GeometryTypes::pyramid;
  module.attr( "prism" ) = Dune::GeometryTypes::prism;
  module.attr( "hexahedron" ) = Dune::GeometryTypes::hexahedron;

#ifdef DUNE_ENABLE_PYTHONMODULE_PRECOMPILE
  registerReferenceElementSubModule<0>(module);
  registerReferenceElementSubModule<1>(module);
  registerReferenceElementSubModule<2>(module);
  registerReferenceElementSubModule<3>(module);
  registerReferenceElementSubModule<4>(module);
#endif
}