41 template <
int dim,
int spacedim>
53 if (
const auto *p_tria =
dynamic_cast<
66 const std::vector<Point<spacedim>> &vertices = tria.
get_vertices();
67 std::vector<bool> boundary_vertices(vertices.size(),
false);
73 for (; cell != endc; ++cell)
74 for (
const unsigned int face : cell->face_indices())
75 if (cell->face(face)->at_boundary())
76 for (
unsigned int i = 0; i < cell->face(face)->n_vertices(); ++i)
77 boundary_vertices[cell->face(face)->vertex_index(i)] =
true;
81 double max_distance_sqr = 0;
82 std::vector<bool>::const_iterator pi = boundary_vertices.begin();
83 const unsigned int N = boundary_vertices.size();
84 for (
unsigned int i = 0; i < N; ++i, ++pi)
86 std::vector<bool>::const_iterator pj = pi + 1;
87 for (
unsigned int j = i + 1; j < N; ++j, ++pj)
88 if ((*pi ==
true) && (*pj ==
true) &&
89 ((vertices[i] - vertices[j]).norm_square() > max_distance_sqr))
90 max_distance_sqr = (vertices[i] - vertices[j]).norm_square();
98 template <
int dim,
int spacedim>
107 reference_cell.template get_default_linear_mapping<dim, spacedim>());
112 template <
int dim,
int spacedim>
118 unsigned int mapping_degree = 1;
120 mapping_degree = p->get_degree();
121 else if (
const auto *p =
123 mapping_degree = p->get_degree();
130 reference_cell.template get_gauss_type_quadrature<dim>(mapping_degree +
132 const unsigned int n_q_points = quadrature_formula.
size();
143 double local_volume = 0;
146 for (
const auto &cell :
triangulation.active_cell_iterators())
147 if (cell->is_locally_owned())
150 for (
unsigned int q = 0; q < n_q_points; ++q)
151 local_volume += fe_values.
JxW(q);
154 const double global_volume =
157 return global_volume;
162 template <
int dim,
int spacedim>
163 std::pair<unsigned int, double>
167 double max_ratio = 1;
168 unsigned int index = 0;
170 for (
unsigned int i = 0; i < dim; ++i)
171 for (
unsigned int j = i + 1; j < dim; ++j)
173 unsigned int ax = i % dim;
174 unsigned int next_ax = j % dim;
177 cell->extent_in_direction(ax) / cell->extent_in_direction(next_ax);
179 if (ratio > max_ratio)
184 else if (1.0 / ratio > max_ratio)
186 max_ratio = 1.0 / ratio;
190 return std::make_pair(index, max_ratio);
212 struct TransformR2UAffine
227 [1] = {{-1.000000}, {1.000000}};
231 {1.000000, 0.000000};
242 [2] = {{-0.500000, -0.500000},
243 {0.500000, -0.500000},
244 {-0.500000, 0.500000},
245 {0.500000, 0.500000}};
255 {0.750000, 0.250000, 0.250000, -0.250000};
261 {-0.250000, -0.250000, -0.250000},
262 {0.250000, -0.250000, -0.250000},
263 {-0.250000, 0.250000, -0.250000},
264 {0.250000, 0.250000, -0.250000},
265 {-0.250000, -0.250000, 0.250000},
266 {0.250000, -0.250000, 0.250000},
267 {-0.250000, 0.250000, 0.250000},
268 {0.250000, 0.250000, 0.250000}
287 template <
int dim,
int spacedim>
296 for (
unsigned int d = 0; d < spacedim; ++d)
297 for (
unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
298 for (
unsigned int e = 0; e < dim; ++e)
299 A[d][e] += vertices[v][d] * TransformR2UAffine<dim>::KA[v][e];
303 for (
unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
304 b += vertices[v] * TransformR2UAffine<dim>::Kb[v];
306 return std::make_pair(A, b);
323 for (
const auto &cell :
triangulation.active_cell_iterators())
325 if (cell->is_locally_owned())
327 double aspect_ratio_cell = 0.0;
332 for (
unsigned int q = 0; q < quadrature.
size(); ++q)
343 aspect_ratio_cell = std::numeric_limits<double>::infinity();
348 for (
unsigned int i = 0; i < dim; ++i)
349 for (
unsigned int j = 0; j < dim; ++j)
350 J(i, j) = jacobian[i][j];
356 const double ar = max_sv / min_sv;
363 aspect_ratio_cell =
std::max(aspect_ratio_cell, ar);
368 aspect_ratio_vector(cell->active_cell_index()) = aspect_ratio_cell;
372 return aspect_ratio_vector;
393 template <
int dim,
int spacedim>
399 const auto predicate = [](
const iterator &) {
return true; };
402 tria, std::function<
bool(
const iterator &)>(predicate));
407 template <
int dim,
int spacedim>
412 double min_diameter = std::numeric_limits<double>::max();
413 for (
const auto &cell :
triangulation.active_cell_iterators())
414 if (!cell->is_artificial())
415 min_diameter =
std::min(min_diameter, cell->diameter(mapping));
417 const double global_min_diameter =
419 return global_min_diameter;
424 template <
int dim,
int spacedim>
429 double max_diameter = 0.;
430 for (
const auto &cell :
triangulation.active_cell_iterators())
431 if (!cell->is_artificial())
432 max_diameter =
std::max(max_diameter, cell->diameter(mapping));
434 const double global_max_diameter =
436 return global_max_diameter;
442#include "grid/grid_tools_geometry.inst"
const DerivativeForm< 1, dim, spacedim > & jacobian(const unsigned int q_point) const
double JxW(const unsigned int q_point) const
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, level_dof_access > > &cell)
number singular_value(const size_type i) const
Abstract base class for mapping classes.
unsigned int size() const
const std::vector< Point< spacedim > > & get_vertices() const
cell_iterator end() const
unsigned int n_cells() const
active_cell_iterator begin_active(const unsigned int level=0) const
#define DEAL_II_NAMESPACE_OPEN
constexpr bool running_in_debug_mode()
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
@ update_JxW_values
Transformed quadrature weights.
@ update_jacobians
Volume element.
T sum(const T &t, const MPI_Comm mpi_communicator)
T max(const T &t, const MPI_Comm mpi_communicator)
T min(const T &t, const MPI_Comm mpi_communicator)
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
DEAL_II_HOST constexpr Number determinant(const SymmetricTensor< 2, dim, Number > &)