]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add an incompatibility note and optional args
authorAlexander Grayver <agrayver@erdw.ethz.ch>
Thu, 3 Sep 2020 07:45:30 +0000 (09:45 +0200)
committerAlexander Grayver <agrayver@erdw.ethz.ch>
Tue, 15 Sep 2020 10:40:02 +0000 (12:40 +0200)
contrib/python-bindings/include/triangulation_wrapper.h
contrib/python-bindings/source/export_triangulation.cc
contrib/python-bindings/source/triangulation_wrapper.cc
doc/news/changes/incompatibilities/20200901Grayver [new file with mode: 0644]

index 18269119c856fd414cd5cd37c0c94c5e0d3df61e..4d34e525bc4db3dcd62f3608146ba692ef9787fa 100644 (file)
@@ -236,7 +236,9 @@ namespace python
     /*! @copydoc GridGenerator::merge_triangulations
      */
     void
-    merge_triangulations(boost::python::list &triangulations);
+    merge_triangulations(boost::python::list &triangulations,
+                         const double duplicated_vertex_tolerance = 1.0e-12,
+                         const bool   copy_manifold_ids           = false);
 
     /*! @copydoc GridGenerator::replicate_triangulation
      */
index 9c2db2508a455fec7bc649e0696c1047b3223a8c..14b9163e735d9fb35027f79452a0d32ce22d960b 100644 (file)
@@ -111,6 +111,10 @@ namespace python
     find_active_cell_around_point,
     1,
     2)
+  BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(merge_triangulations_overloads,
+                                         merge_triangulations,
+                                         1,
+                                         3)
 
   const char n_active_cells_docstring[] =
     "Return the number of active cells.                                     \n";
@@ -319,7 +323,7 @@ namespace python
 
 
 
-  const char merge_docstring[] =
+  const char merge_triangulations_docstring[] =
     "Given two or more triangulations, create the triangulation that        \n"
     "contains the cells of given triangulations.                            \n";
 
@@ -622,8 +626,10 @@ namespace python
            boost::python::args("self", "scaling_factor"))
       .def("merge_triangulations",
            &TriangulationWrapper::merge_triangulations,
-           merge_docstring,
-           boost::python::args("self", "triangulations"))
+           merge_triangulations_overloads(
+             boost::python::args(
+               "self", "triangulations", "vertex_tolerance", "copy_manifolds"),
+             merge_triangulations_docstring))
       .def("extrude_triangulation",
            &TriangulationWrapper::extrude_triangulation,
            extrude_docstring,
index e5e48cb0db54b1feadbef55de18a5553bc35d421..019b79dc60001705295e2a00deb7621df1e1cda6 100644 (file)
@@ -515,7 +515,9 @@ namespace python
     template <int dim, int spacedim>
     void
     merge_triangulations(boost::python::list &triangulations,
-                         void *               triangulation)
+                         void *               triangulation,
+                         const double         duplicated_vertex_tolerance,
+                         const bool           copy_manifold_ids)
     {
       Triangulation<dim, spacedim> *tria =
         static_cast<Triangulation<dim, spacedim> *>(triangulation);
@@ -531,7 +533,10 @@ namespace python
             tria_wrapper.get_triangulation()));
         }
 
-      GridGenerator::merge_triangulations(tria_ptrs, *tria);
+      GridGenerator::merge_triangulations(tria_ptrs,
+                                          *tria,
+                                          duplicated_vertex_tolerance,
+                                          copy_manifold_ids);
     }
 
 
@@ -1436,7 +1441,9 @@ namespace python
 
   void
   TriangulationWrapper::merge_triangulations(
-    boost::python::list &triangulations)
+    boost::python::list &triangulations,
+    const double         duplicated_vertex_tolerance,
+    const bool           copy_manifold_ids)
   {
     AssertThrow(boost::python::len(triangulations) >= 2,
                 ExcMessage(
@@ -1457,11 +1464,20 @@ namespace python
       }
 
     if ((dim == 2) && (spacedim == 2))
-      internal::merge_triangulations<2, 2>(triangulations, triangulation);
+      internal::merge_triangulations<2, 2>(triangulations,
+                                           triangulation,
+                                           duplicated_vertex_tolerance,
+                                           copy_manifold_ids);
     else if ((dim == 2) && (spacedim == 3))
-      internal::merge_triangulations<2, 3>(triangulations, triangulation);
+      internal::merge_triangulations<2, 3>(triangulations,
+                                           triangulation,
+                                           duplicated_vertex_tolerance,
+                                           copy_manifold_ids);
     else
-      internal::merge_triangulations<3, 3>(triangulations, triangulation);
+      internal::merge_triangulations<3, 3>(triangulations,
+                                           triangulation,
+                                           duplicated_vertex_tolerance,
+                                           copy_manifold_ids);
   }
 
 
diff --git a/doc/news/changes/incompatibilities/20200901Grayver b/doc/news/changes/incompatibilities/20200901Grayver
new file mode 100644 (file)
index 0000000..0715f29
--- /dev/null
@@ -0,0 +1,3 @@
+Replaced: Python wrapper for 'merge_triangulations' with a more generic equivalent.
+<br>
+(Alexander Grayver, 2020/09/01)

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.