]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Clean python documentation.
authorBruno Turcksin <bruno.turcksin@gmail.com>
Fri, 15 Jul 2016 13:10:19 +0000 (09:10 -0400)
committerBruno Turcksin <bruno.turcksin@gmail.com>
Wed, 3 Aug 2016 20:34:02 +0000 (16:34 -0400)
source/python/export_cell_accessor.cc
source/python/export_point.cc
source/python/export_triangulation.cc

index 858b78811074295a54eafed4bf01ca73273c672e..87c994b17814953dfb45fc7d416a0e15c5fcfa79 100644 (file)
 
 namespace PyDealII
 {
+  const char refine_flag_docstring [] =
+    "Get/Set the refine_flag of the cell. In 2D, the possibilities are: \n"
+    "  - isotropic                                                      \n"
+    "  - no_refinement                                                  \n"
+    "  - cut_x                                                          \n"
+    "  - cut_y                                                          \n"
+    "  - cut_xy                                                         \n"
+    "In 3D, the possibilities are:                                      \n"
+    "  - isotropic                                                      \n"
+    "  - no_refinement                                                  \n"
+    "  - cut_x                                                          \n"
+    "  - cut_y                                                          \n"
+    "  - cut_z                                                          \n"
+    "  - cut_xy                                                         \n"
+    "  - cut_xz                                                         \n"
+    "  - cut_yz                                                         \n"
+    "  - cut_xyz                                                        \n"
+    ;
+
+
+
+  const char coarsen_flag_docstring [] =
+    "Get/Set the coarsen_flag of the cell                               \n"
+    ;
+
+
+
+  const char material_id_docstring [] =
+    "Get/Set the material_id of the cell                                \n"
+    ;
+
+
+
+  const char manifold_id_docstring [] =
+    "Get/Set the manifold_id of the cell                                \n"
+    ;
+
+
+
+  const char barycenter_docstring [] =
+    "Return the barycenter of the current cell                          \n"
+    ;
+
+
+
+  const char set_vertex_docstring [] =
+    " Set the ith vertex of the cell to point_wrapper                   \n"
+    ;
+
+
+
+  const char get_vertex_docstring [] =
+    " Get the ith vertex of the cell                                    \n"
+    ;
+
+
+
   void export_cell_accessor()
   {
     boost::python::class_<CellAccessorWrapper>("CellAccessor",
                                                boost::python::init<TriangulationWrapper &, const int, const int> ())
     .add_property("refine_flag", &CellAccessorWrapper::get_refine_flag,
                   &CellAccessorWrapper::set_refine_flag,
-                  "Get/Set the refine_flag of the cell. The possibilities are in 2D: isotropic, no_refinement, cut_x, cut_y, and cut_xy and in 3D: isotropic, no_refinement, cut_x, cut_y, cut_z, cut_xy, cut_xz, cut_yz, and cut_xyz.")
+                  refine_flag_docstring)
     .add_property("coarsen_flag", &CellAccessorWrapper::get_coarsen_flag,
                   &CellAccessorWrapper::set_coarsen_flag,
-                  "Get/Set the coarsen_flag of the cell.")
+                  coarsen_flag_docstring)
     .add_property("material_id", &CellAccessorWrapper::get_material_id,
                   &CellAccessorWrapper::set_material_id,
-                  "Get/Set the material_id of the cell.")
+                  material_id_docstring)
     .add_property("manifold_id", &CellAccessorWrapper::get_manifold_id,
                   &CellAccessorWrapper::set_manifold_id,
-                  "Get/Set the manifold_id of the cell.")
+                  manifold_id_docstring)
     .def("barycenter", &CellAccessorWrapper::get_barycenter,
-         "Return the barycenter of the current cell.",
+         barycenter_docstring,
          boost::python::args("self"))
     .def("set_vertex", &CellAccessorWrapper::set_vertex,
-         "Set the ith vertex of the cell to point_wrapper",
+         set_vertex_docstring,
          boost::python::args("self", "i", "point_wrapper"))
     .def("get_vertex", &CellAccessorWrapper::get_vertex,
-         "Get the ith vertex of the cell",
+         get_vertex_docstring,
          boost::python::args("self", "i"));
   }
 }
index f908f1673fb6b5b61b819962879a850993eca29e..e8ab162efb451b89ff837ac1cbf81fbd48bd4d9a 100644 (file)
@@ -22,9 +22,13 @@ namespace PyDealII
 {
   void export_point()
   {
-    boost::python::class_<PointWrapper> ("Point", boost::python::init<boost::python::list>())
-    .add_property("x", &PointWrapper::get_x, &PointWrapper::set_x, "Get the x component of the point.")
-    .add_property("y", &PointWrapper::get_y, &PointWrapper::set_y, "Get the y component of the point.")
-    .add_property("z", &PointWrapper::get_z, &PointWrapper::set_z, "Get the z component of the point.");
+    boost::python::class_<PointWrapper> ("Point",
+                                         boost::python::init<boost::python::list>())
+    .add_property("x", &PointWrapper::get_x, &PointWrapper::set_x,
+                  "Get the x component of the point.")
+    .add_property("y", &PointWrapper::get_y, &PointWrapper::set_y,
+                  "Get the y component of the point.")
+    .add_property("z", &PointWrapper::get_z, &PointWrapper::set_z,
+                  "Get the z component of the point.");
   }
 }
index 535119cdecd586af7cb8a266c45c9fcbb3bc1c9e..f22f7a050760a58d01d0b6380553a3ebf1ad1330 100644 (file)
@@ -21,85 +21,198 @@ namespace PyDealII
 {
 
 // Macro to enable default arguments
-  BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(generate_hyper_cube_overloads, generate_hyper_cube, 0, 3)
+  BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(generate_hyper_cube_overloads,
+                                         generate_hyper_cube, 0, 3)
   BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(generate_subdivided_hyper_cube_overloads,
                                          generate_subdivided_hyper_cube, 1, 3)
   BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(generate_hyper_rectangle_overloads,
                                          generate_hyper_rectangle, 2, 3)
   BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(generate_subdivided_hyper_rectangle_overloads,
                                          generate_subdivided_hyper_rectangle, 3, 4)
-  BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(generate_hyper_ball_overloads, generate_hyper_ball, 1, 2)
+  BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(generate_hyper_ball_overloads,
+                                         generate_hyper_ball, 1, 2)
+
+
+
+  const char n_active_cells_docstring [] =
+    "Return the number of active cells                                      \n"
+    ;
+
+
+
+  const char generate_hyper_cube_docstring [] =
+    "Generate a hyper_cube (square in 2D and cube in 3D)                    \n"
+    "with exactly one cell                                                  \n"
+    ;
+
+
+
+  const char generate_simplex_docstring [] =
+    "Generate a simplex with (dim+1) vertices and mesh cells                \n"
+    ;
+
+
+
+  const char generate_subdivided_hyper_cube_docstring [] =
+    "Same as hyper_cube but not only one cell is created but each           \n"
+    "coordinate direction is subdivided in repetitions cells                \n"
+    ;
+
+
+
+  const char generate_hyper_rectangle_docstring [] =
+    "Generate a coordinate-parallel brick from the two diagonally opposite  \n"
+    "corners points p1 and p2                                               \n"
+    ;
+
+
+
+  const char generate_subdivided_hyper_rectangle_docstring [] =
+    "Generate a coordinate-parallel brick from the two diagonally opposite  \n"
+    "corners point p1 and p2. In direction i, repetitions[i] cells are      \n"
+    "created                                                                \n"
+    ;
+
+
+
+  const char generate_hyper_ball_docstring [] =
+    "Generate a hyperball, i.e., a circle or a ball around center with     \n"
+    "a given radius                                                        \n"
+    ;
+
+
+
+  const char shift_docstring [] =
+    "Shift every vertex of the Triangulation by the gien shift vector      \n"
+    ;
+
+
+
+  const char merge_docstring [] =
+    "Given two triangulations, create the triangulation that contains      \n"
+    "the cells of both triangulations                                      \n"
+    ;
+
+
+
+  const char refine_global_docstring [] =
+    "Refine all the cells times time                                       \n"
+    ;
+
+
+
+  const char execute_coarsening_and_refinement_docstring [] =
+    "Execute both refinement and coarsening of the Triangulation           \n"
+    ;
+
+
+  const char active_cells_docstring [] =
+    "Return the list of active cell accessors of the Triangulation         \n"
+    ;
+
+
+
+  const char write_docstring [] =
+    "Write the mesh to the output file according to the given data format. \n"
+    "The possible formats are:                                             \n"
+    "  - none                                                              \n"
+    "  - dx                                                                \n"
+    "  - gnuplot                                                           \n"
+    "  - eps                                                               \n"
+    "  - ucd                                                               \n"
+    "  - xfig                                                              \n"
+    "  - msh                                                               \n"
+    "  - svg                                                               \n"
+    "  - mathgl                                                            \n"
+    "  - vtk                                                               \n"
+    "  - vtu                                                               \n"
+    ;
+
+
+
+  const char save_docstring [] =
+    "Write the Triangulation to a file                                     \n"
+    ;
+
+
+
+
+  const char load_docstring [] =
+    "Load the Triangulation from a file                                    \n"
+    ;
+
 
 
   void export_triangulation()
   {
-    boost::python::class_<TriangulationWrapper>("Triangulation", boost::python::init<const std::string &>())
+    boost::python::class_<TriangulationWrapper>("Triangulation",
+                                                boost::python::init<const std::string &>())
     .def(boost::python::init<const std::string &, const std::string &>())
     .def("n_active_cells",
          &TriangulationWrapper::n_active_cells,
-         "Return the number of active cells",
+         n_active_cells_docstring,
          boost::python::args("self"))
     .def("generate_hyper_cube",
          &TriangulationWrapper::generate_hyper_cube,
          generate_hyper_cube_overloads(
            boost::python::args("self", "left", "right", "colorize"),
-           "Generate a hyper_cube (square in 2D and cube in 3D) with exactly one cell."))
+           generate_hyper_cube_docstring))
     .def("generate_simplex",
          &TriangulationWrapper::generate_simplex,
-         "Generate a simplex with (dim+1) vertices and mesh cells.",
+         generate_simplex_docstring,
          boost::python::args("self", "vertices"))
     .def("generate_subdivided_hyper_cube",
          &TriangulationWrapper::generate_subdivided_hyper_cube,
          generate_subdivided_hyper_cube_overloads(
            boost::python::args("self", "repetitions", "left", "right"),
-           "Same as hyper_cube but not only one cells is created but each coordinate direction is subdivdided in repetitions cells."))
+           generate_subdivided_hyper_cube_docstring))
     .def("generate_hyper_rectangle",
          &TriangulationWrapper::generate_hyper_rectangle,
          generate_hyper_rectangle_overloads(
            boost::python::args("self", "p1", "p2", "colorize"),
-           "Generate a coordinate-parallel brick from the two diagonally opposite corners points p1 and p2."))
+           generate_hyper_rectangle_docstring))
     .def("generate_subdivided_hyper_rectangle",
          &TriangulationWrapper::generate_subdivided_hyper_rectangle,
          generate_subdivided_hyper_rectangle_overloads(
            boost::python::args("self", "repetitions",
                                "p1", "p2", "colorize"),
-           "Generate a coordinate-parallel brick from the two diagonally opposite corners point @p1 and @p2. In direction i, repetitions[i] cells are created."))
+           generate_subdivided_hyper_rectangle_docstring))
     .def("generate_hyper_ball",
          &TriangulationWrapper::generate_hyper_ball,
          generate_hyper_ball_overloads(
            boost::python::args("self", "center", "radius"),
-           "Generate a hyperball, i.e. a circle or a ball around @p center with given @p radius."))
+           generate_hyper_ball_docstring))
     .def("shift",
          &TriangulationWrapper::shift,
-         "Shift every vertex of the Triangulation by the given shift vector.",
+         shift_docstring,
          boost::python::args("self", "shift"))
     .def("merge_triangulations",
          &TriangulationWrapper::merge_triangulations,
-         "Given two triangulations, create the triangulation that contains the cells of both triangulations.",
+         merge_docstring,
          boost::python::args("self", "triangulation_1", "triangulation_2"))
     .def("refine_global",
          &TriangulationWrapper::refine_global,
-         "Refine all the cells times times.",
+         refine_global_docstring,
          boost::python::args("self", "times"))
     .def("execute_coarsening_and_refinement",
          &TriangulationWrapper::execute_coarsening_and_refinement,
-         "Execute both refinement and coarsening of the Triangulation.",
+         execute_coarsening_and_refinement_docstring,
          boost::python::args("self"))
     .def("active_cells",
          &TriangulationWrapper::active_cells,
-         "Return the list of active cell accessors of the Triangulation.",
+         active_cells_docstring,
          boost::python::args("self"))
     .def("write",
          &TriangulationWrapper::write,
-         "Write the mesh to the output file according to the given data format. The possible formats are: none, dx, gnuplot, eps, ucd, xfig, msh, svg, mathgl, vtk, and vtu.",
+         write_docstring,
          boost::python::args("self", "filename", "format"))
     .def("save",
          &TriangulationWrapper::save,
-         "Write the Triangulation to a file.",
+         save_docstring,
          boost::python::args("self", "filename"))
     .def("load",
          &TriangulationWrapper::load,
-         "Load the Triangulation from a file.",
+         load_docstring,
          boost::python::args("self", "filename"));
   }
 }

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.