return triangulation.n_active_cells();
}
-void generate_cube(dealii::Triangulation<2> &triangulation)
+void generate_hyper_cube(dealii::Triangulation<2> &triangulation, const double left=0.,
+ const double right=0., const bool colorize=false)
{
dealii::GridGenerator::hyper_cube(triangulation);
}
void save(const dealii::Triangulation<2> &triangulation,
- const std::string filename)
+ const std::string filename)
{
std::ofstream ofs(filename);
boost::archive::text_oarchive oa(ofs);
}
void load(dealii::Triangulation<2> &triangulation,
- const std::string filename)
+ const std::string filename)
{
std::ifstream ifs(filename);
boost::archive::text_iarchive ia(ifs);
ia >> triangulation;
}
+// Macro to enable default arguments
+BOOST_PYTHON_FUNCTION_OVERLOADS(generate_hyper_cube_overloads, generate_hyper_cube, 1, 4)
+
BOOST_PYTHON_MODULE(PyDealII)
{
boost::python::scope().attr("__doc__") = pydealii_docstring;
boost::python::class_<dealii::Triangulation<2>> ("Triangulation")
- .def("n_active_cells", &n_active_cells,
- "Return the number of active cells",
- boost::python::args("self"))
- .def("generate_cube", &generate_cube,
- "Generate a hypercube", boost::python::args("self"))
+ .def("n_active_cells", n_active_cells,
+ "Return the number of active cells",
+ boost::python::args("self"))
+ .def("generate_hyper_cube", generate_hyper_cube,
+ generate_hyper_cube_overloads(
+ boost::python::args("self", "left", "right", "colorize"),
+ "Generate a hyper_cube."))
.def("refine_global", &dealii::Triangulation<2>::refine_global,
- "Refine the mesh uniformly",
- boost::python::args("self", "times"))
- .def("save", &save, "Serialize and save the triangulation",
- boost::python::args("self", "filename"))
- .def("load", &load, "Load and deserialize a triangulation",
- boost::python::args("self", "filename"));
+ "Refine the mesh uniformly",
+ boost::python::args("self", "times"))
+ .def("save", save, "Serialize and save the triangulation",
+ boost::python::args("self", "filename"))
+ .def("load", load, "Load and deserialize a triangulation",
+ boost::python::args("self", "filename"));
}