#include <manifold_wrapper.h>
#include <mapping_wrapper.h>
#include <point_wrapper.h>
+#include <quadrature_wrapper.h>
#include <string>
#include <vector>
double
maximal_cell_diameter() const;
+ /**
+ * Computes an aspect ratio measure for all active cells and fills a vector
+ * with one entry per cell.
+ */
+ boost::python::list
+ compute_aspect_ratio_of_cells(MappingQGenericWrapper mapping,
+ QuadratureWrapper quadrature);
+
/**
* Write mesh to the output file @filename according to the given data
* format.
+ const char compute_aspect_ratio_of_cells_docstring[] =
+ "Computes an aspect ratio measure for all active cells and fills \n"
+ "a vector with one entry per cell. \n";
+
+
+
const char find_cells_adjacent_to_vertex_docstring[] =
"Find and return a list of active cells that surround a given \n"
"vertex with index vertex_index. \n";
&TriangulationWrapper::find_cells_adjacent_to_vertex,
find_cells_adjacent_to_vertex_docstring,
boost::python::args("self", "vertex_index"))
+ .def("compute_aspect_ratio_of_cells",
+ &TriangulationWrapper::compute_aspect_ratio_of_cells,
+ compute_aspect_ratio_of_cells_docstring,
+ boost::python::args("self", "mapping", "quadrature"))
.def("refine_global",
&TriangulationWrapper::refine_global,
refine_global_docstring,
}
+ template <int dim, int spacedim>
+ boost::python::list
+ compute_aspect_ratio_of_cells(MappingQGenericWrapper &mapping_wrapper,
+ QuadratureWrapper & quadrature_wrapper,
+ TriangulationWrapper & triangulation_wrapper)
+ {
+ const Triangulation<dim, spacedim> *tria =
+ static_cast<const Triangulation<dim, spacedim> *>(
+ triangulation_wrapper.get_triangulation());
+
+ Quadrature<dim> *quad =
+ static_cast<Quadrature<dim> *>(quadrature_wrapper.get_quadrature());
+
+ const MappingQGeneric<dim, spacedim> *mapping =
+ static_cast<const MappingQGeneric<dim, spacedim> *>(
+ mapping_wrapper.get_mapping());
+
+ auto aspect_ratios =
+ GridTools::compute_aspect_ratio_of_cells(*tria, *mapping, *quad);
+
+ boost::python::list ratios;
+ for (size_t i = 0; i < aspect_ratios.size(); ++i)
+ ratios.append(aspect_ratios[i]);
+
+ return ratios;
+ }
+
+
template <int dim, int spacedim>
boost::python::list
find_cells_adjacent_to_vertex(const unsigned int vertex_index,
+ boost::python::list
+ TriangulationWrapper::compute_aspect_ratio_of_cells(
+ MappingQGenericWrapper mapping,
+ QuadratureWrapper quadrature)
+ {
+ if ((dim == 2) && (spacedim == 2))
+ return internal::compute_aspect_ratio_of_cells<2, 2>(mapping,
+ quadrature,
+ *this);
+ else if ((dim == 3) && (spacedim == 3))
+ return internal::compute_aspect_ratio_of_cells<3, 3>(mapping,
+ quadrature,
+ *this);
+ else
+ AssertThrow(false,
+ ExcMessage(
+ "Thie combination of dim-spacedim is not supported."));
+ }
+
+
+
void
TriangulationWrapper::refine_global(const unsigned int n)
{