unsigned int
vertex_index(const unsigned int i) const;
+ /*! @copydoc TriaAccessor::n_vertices
+ */
+ unsigned int
+ n_vertices() const;
+
+ /*! @copydoc TriaAccessor::n_lines
+ */
+ unsigned int
+ n_lines() const;
+
+ /*! @copydoc TriaAccessor::n_faces
+ */
+ unsigned int
+ n_faces() const;
+
/**
* Exception.
*/
double
measure() const;
+ /*! @copydoc TriaAccessor::n_vertices
+ */
+ unsigned int
+ n_vertices() const;
+
+ /*! @copydoc TriaAccessor::n_lines
+ */
+ unsigned int
+ n_lines() const;
+
+ /*! @copydoc TriaAccessor::n_faces
+ */
+ unsigned int
+ n_faces() const;
+
/**
* Exception.
*/
void
transform(boost::python::object &transformation);
+ /*! @copydoc GridGenerator::convert_hypercube_to_simplex_mesh
+ */
+ void
+ convert_hypercube_to_simplex_mesh(TriangulationWrapper &tria_out);
+
/*! @copydoc GridTools::find_active_cell_around_point
*/
CellAccessorWrapper
return internal::cell_cast<3, 3>(cell_accessor)->vertex_index(i);
}
+
+
+ unsigned int
+ CellAccessorWrapper::n_vertices() const
+ {
+ if ((dim == 2) && (spacedim == 2))
+ return internal::cell_cast<2, 2>(cell_accessor)->n_vertices();
+ else if ((dim == 2) && (spacedim == 3))
+ return internal::cell_cast<2, 3>(cell_accessor)->n_vertices();
+ else
+ return internal::cell_cast<3, 3>(cell_accessor)->n_vertices();
+ }
+
+
+
+ unsigned int
+ CellAccessorWrapper::n_lines() const
+ {
+ if ((dim == 2) && (spacedim == 2))
+ return internal::cell_cast<2, 2>(cell_accessor)->n_lines();
+ else if ((dim == 2) && (spacedim == 3))
+ return internal::cell_cast<2, 3>(cell_accessor)->n_lines();
+ else
+ return internal::cell_cast<3, 3>(cell_accessor)->n_lines();
+ }
+
+
+
+ unsigned int
+ CellAccessorWrapper::n_faces() const
+ {
+ if ((dim == 2) && (spacedim == 2))
+ return internal::cell_cast<2, 2>(cell_accessor)->n_faces();
+ else if ((dim == 2) && (spacedim == 3))
+ return internal::cell_cast<2, 3>(cell_accessor)->n_faces();
+ else
+ return internal::cell_cast<3, 3>(cell_accessor)->n_faces();
+ }
+
} // namespace python
DEAL_II_NAMESPACE_CLOSE
" for activity of a cell). \n";
+
+ const char n_vertices_docstring[] =
+ " Number of vertices. \n";
+
+
+
+ const char n_lines_docstring[] =
+ " Number of lines. \n";
+
+
+
+ const char n_faces_docstring[] =
+ " Number of faces. \n";
+
+
void
export_cell_accessor()
{
.def("vertex_index",
&CellAccessorWrapper::vertex_index,
vertex_index_docstring,
- boost::python::args("self", "vertex"));
+ boost::python::args("self", "vertex"))
+ .def("n_vertices",
+ &CellAccessorWrapper::n_vertices,
+ n_vertices_docstring,
+ boost::python::args("self"))
+ .def("n_lines",
+ &CellAccessorWrapper::n_lines,
+ n_lines_docstring,
+ boost::python::args("self"))
+ .def("n_faces",
+ &CellAccessorWrapper::n_faces,
+ n_faces_docstring,
+ boost::python::args("self"));
}
} // namespace python
"Return the diameter of the largest active cell of a triangulation. \n";
+
+ const char convert_hypercube_to_simplex_mesh_docstring[] =
+ "Convert a triangulation consisting only of hypercube cells \n"
+ "(quadrilaterals, hexahedra) to a triangulation only consisting of \n"
+ "simplices (triangles, tetrahedra). \n";
+
+
void
export_triangulation()
{
&TriangulationWrapper::transform,
transform_docstring,
boost::python::args("self", "transformation"))
+ .def("convert_hypercube_to_simplex_mesh",
+ &TriangulationWrapper::convert_hypercube_to_simplex_mesh,
+ convert_hypercube_to_simplex_mesh_docstring,
+ boost::python::args("self", "tria_out"))
.def("find_active_cell_around_point",
&TriangulationWrapper::find_active_cell_around_point,
find_active_cell_around_point_overloads(
tria_accessor);
return accessor->measure();
}
+
+ template <int structdim, int dim, int spacedim>
+ const TriaAccessor<structdim, dim, spacedim> *
+ tria_accessor_cast(const void *tria_accessor)
+ {
+ return static_cast<const TriaAccessor<structdim, dim, spacedim> *>(
+ tria_accessor);
+ }
} // namespace internal
return internal::measure<2, 3, 3>(tria_accessor);
}
+
+
+ unsigned int
+ TriaAccessorWrapper::n_vertices() const
+ {
+ if ((dim == 2) && (spacedim == 2) && (structdim == 1))
+ return internal::tria_accessor_cast<1, 2, 2>(tria_accessor)->n_vertices();
+ else if ((dim == 2) && (spacedim == 3) && (structdim == 1))
+ return internal::tria_accessor_cast<1, 2, 3>(tria_accessor)->n_vertices();
+ else
+ return internal::tria_accessor_cast<2, 3, 3>(tria_accessor)->n_vertices();
+ }
+
+
+
+ unsigned int
+ TriaAccessorWrapper::n_lines() const
+ {
+ if ((dim == 2) && (spacedim == 2) && (structdim == 1))
+ return internal::tria_accessor_cast<1, 2, 2>(tria_accessor)->n_lines();
+ else if ((dim == 2) && (spacedim == 3) && (structdim == 1))
+ return internal::tria_accessor_cast<1, 2, 3>(tria_accessor)->n_lines();
+ else
+ return internal::tria_accessor_cast<2, 3, 3>(tria_accessor)->n_lines();
+ }
+
+
+
+ unsigned int
+ TriaAccessorWrapper::n_faces() const
+ {
+ if ((dim == 2) && (spacedim == 2) && (structdim == 1))
+ return internal::tria_accessor_cast<1, 2, 2>(tria_accessor)->n_faces();
+ else if ((dim == 2) && (spacedim == 3) && (structdim == 1))
+ return internal::tria_accessor_cast<1, 2, 3>(tria_accessor)->n_faces();
+ else
+ return internal::tria_accessor_cast<2, 3, 3>(tria_accessor)->n_faces();
+ }
+
} // namespace python
DEAL_II_NAMESPACE_CLOSE
+ template <int dim, int spacedim>
+ void
+ convert_hypercube_to_simplex_mesh(void * triangulation,
+ TriangulationWrapper &tria_out)
+ {
+ Triangulation<dim, spacedim> *tria =
+ static_cast<Triangulation<dim, spacedim> *>(triangulation);
+ Triangulation<dim, spacedim> *tria_2 =
+ static_cast<Triangulation<dim, spacedim> *>(
+ tria_out.get_triangulation());
+ GridGenerator::convert_hypercube_to_simplex_mesh(*tria, *tria_2);
+ }
+
+
+
template <int dim, int spacedim>
void
replicate_triangulation(TriangulationWrapper & tria_in,
}
+ void
+ TriangulationWrapper::convert_hypercube_to_simplex_mesh(
+ TriangulationWrapper &tria_out)
+ {
+ AssertThrow(
+ (tria_out.get_dim() == dim) && (tria_out.get_spacedim() == spacedim),
+ ExcMessage("The output Triangulation must be of the same dimension"));
+
+ if ((dim == 2) && (spacedim == 2))
+ internal::convert_hypercube_to_simplex_mesh<2, 2>(triangulation,
+ tria_out);
+ else if ((dim == 2) && (spacedim == 3))
+ internal::convert_hypercube_to_simplex_mesh<2, 3>(triangulation,
+ tria_out);
+ else
+ internal::convert_hypercube_to_simplex_mesh<3, 3>(triangulation,
+ tria_out);
+ }
+
void
TriangulationWrapper::extrude_triangulation(
else
AssertThrow(false, ExcMessage("Dimension needs to be 2D or 3D."));
}
+
} // namespace python
DEAL_II_NAMESPACE_CLOSE