]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add ReferenceCell::Type wrapper
authorAlexander Grayver <agrayver@erdw.ethz.ch>
Mon, 18 Jan 2021 20:38:52 +0000 (21:38 +0100)
committerAlexander Grayver <agrayver@erdw.ethz.ch>
Wed, 20 Jan 2021 11:19:43 +0000 (12:19 +0100)
contrib/python-bindings/include/cell_accessor_wrapper.h
contrib/python-bindings/source/CMakeLists.txt
contrib/python-bindings/source/cell_accessor_wrapper.cc
contrib/python-bindings/source/export_cell_accessor.cc
contrib/python-bindings/source/wrappers.cc

index bf10570a37f7fb49f1402ce2c01ed9b560de09d7..5443ea60994a48d7a0d1f7432cf4f7a2ca5fae09 100644 (file)
@@ -28,6 +28,7 @@ namespace python
 {
   class PointWrapper;
   class TriangulationWrapper;
+  class CellTypeWrapper;
 
   class CellAccessorWrapper
   {
@@ -184,6 +185,11 @@ namespace python
     unsigned int
     vertex_index(const unsigned int i) const;
 
+    /*! @copydoc TriaAccessor::reference_cell_type
+     */
+    CellTypeWrapper
+    reference_cell_type() const;
+
     /*! @copydoc TriaAccessor::n_vertices
      */
     unsigned int
index c6ab09562fe2a51fde8ad1777da01882805c6684..e0182fb695dc9f8cd08a47820ad6e97adb86cb04 100644 (file)
@@ -38,6 +38,7 @@ SET(_src
   export_mapping.cc
   export_manifold.cc
   export_quadrature.cc
+  export_reference_cell.cc
   cell_accessor_wrapper.cc
   tria_accessor_wrapper.cc
   point_wrapper.cc
@@ -45,6 +46,7 @@ SET(_src
   mapping_wrapper.cc
   manifold_wrapper.cc
   quadrature_wrapper.cc
+  reference_cell_wrapper.cc
   )
 
 FOREACH(_build ${DEAL_II_BUILD_TYPES})
index 4d9dfc71141e14e9056479f9908cd96a65199bed..50ce261f391e8fc95b789a48a840ea07c20f273d 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <cell_accessor_wrapper.h>
 #include <point_wrapper.h>
+#include <reference_cell_wrapper.h>
 #include <tria_accessor_wrapper.h>
 #include <triangulation_wrapper.h>
 
@@ -795,6 +796,17 @@ namespace python
       return internal::cell_cast<3, 3>(cell_accessor)->n_faces();
   }
 
+  CellTypeWrapper
+  CellAccessorWrapper::reference_cell_type() const
+  {
+    if ((dim == 2) && (spacedim == 2))
+      return internal::cell_cast<2, 2>(cell_accessor)->reference_cell_type();
+    else if ((dim == 2) && (spacedim == 3))
+      return internal::cell_cast<2, 3>(cell_accessor)->reference_cell_type();
+    else
+      return internal::cell_cast<3, 3>(cell_accessor)->reference_cell_type();
+  }
+
 } // namespace python
 
 DEAL_II_NAMESPACE_CLOSE
index b14b212a60508f1859977a23a722e69f53b09355..02b954ffdae6941750fba1b12239000b5b7ba3d5 100644 (file)
@@ -16,6 +16,7 @@
 #include <boost/python.hpp>
 
 #include <cell_accessor_wrapper.h>
+#include <reference_cell_wrapper.h>
 #include <triangulation_wrapper.h>
 
 DEAL_II_NAMESPACE_OPEN
@@ -151,6 +152,11 @@ namespace python
 
 
 
+  const char reference_cell_type_docstring[] =
+    " Reference cell type of the current cell).                          \n";
+
+
+
   const char n_vertices_docstring[] =
     " Number of vertices.                                                \n";
 
@@ -254,6 +260,10 @@ namespace python
            &CellAccessorWrapper::vertex_index,
            vertex_index_docstring,
            boost::python::args("self", "vertex"))
+      .def("reference_cell_type",
+           &CellAccessorWrapper::reference_cell_type,
+           reference_cell_type_docstring,
+           boost::python::args("self"))
       .def("n_vertices",
            &CellAccessorWrapper::n_vertices,
            n_vertices_docstring,
index 05d0885fd1ea535e5c001788fb578d34da361720..fabd0c96251d98d14ed35e8cdcb5da822f0ddb80 100644 (file)
@@ -37,6 +37,8 @@ namespace python
   export_manifold();
   void
   export_quadrature();
+  void
+  export_reference_cell();
 } // namespace python
 
 DEAL_II_NAMESPACE_CLOSE
@@ -65,6 +67,7 @@ BOOST_PYTHON_MODULE(Debug)
   // message is printed.
   dealii::deal_II_exceptions::disable_abort_on_exception();
 
+  dealii::python::export_reference_cell();
   dealii::python::export_tria_accessor();
   dealii::python::export_cell_accessor();
   dealii::python::export_point();
@@ -85,6 +88,7 @@ BOOST_PYTHON_MODULE(Release)
   doc_options.enable_py_signatures();
   doc_options.disable_cpp_signatures();
 
+  dealii::python::export_reference_cell();
   dealii::python::export_tria_accessor();
   dealii::python::export_cell_accessor();
   dealii::python::export_point();

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.