/home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/discretization/common/cell_geometry.hh Source File#

DiFfRG: /home/runner/work/DiFfRG_current/DiFfRG_current/DiFfRG/include/DiFfRG/discretization/common/cell_geometry.hh Source File
DiFfRG
Discretization Framework for functional Renormalization Group flows
cell_geometry.hh
Go to the documentation of this file.
1#pragma once
2
3// external libraries
4#include <deal.II/dofs/dof_handler.h>
5
6// standard library
7#include <cmath>
8#include <limits>
9#include <stdexcept>
10
11namespace DiFfRG
12{
13 namespace internal
14 {
23 template <typename CellIterator> double face_normal_cell_width(const CellIterator &cell, const uint face_no)
24 {
25 const double face_measure = cell->face(face_no)->measure();
26 if (!(face_measure > 0.) || !std::isfinite(face_measure))
27 throw std::runtime_error("face_normal_cell_width: invalid face measure.");
28
29 const double width = cell->measure() / face_measure;
30 if (!(width > 0.) || !std::isfinite(width))
31 throw std::runtime_error("face_normal_cell_width: invalid face-normal cell width.");
32 return width;
33 }
34
42 template <typename CellIterator> double cell_width(const CellIterator &cell)
43 {
44 double width = std::numeric_limits<double>::max();
45 for (uint face_no = 0; face_no < cell->n_faces(); ++face_no)
46 width = std::min(width, face_normal_cell_width(cell, face_no));
47 return width;
48 }
49
51 template <int dim> double minimum_face_normal_cell_width(const dealii::DoFHandler<dim> &dof_handler)
52 {
53 double minimum_width = std::numeric_limits<double>::max();
54 for (const auto &cell : dof_handler.active_cell_iterators())
55 minimum_width = std::min(minimum_width, cell_width(cell));
56
57 if (!(minimum_width < std::numeric_limits<double>::max()))
58 throw std::runtime_error("minimum_face_normal_cell_width: the mesh has no active cells.");
59 return minimum_width;
60 }
61 } // namespace internal
62} // namespace DiFfRG
double cell_width(const CellIterator &cell)
The smallest face-normal width over all faces of cell.
Definition cell_geometry.hh:42
double minimum_face_normal_cell_width(const dealii::DoFHandler< dim > &dof_handler)
The smallest face-normal width anywhere on the mesh.
Definition cell_geometry.hh:51
double face_normal_cell_width(const CellIterator &cell, const uint face_no)
The extent of a cell along the normal of one of its faces.
Definition cell_geometry.hh:23
Definition complex_math.hh:10
unsigned int uint
Definition utils.hh:24