#include <deal.II/grid/tria_iterator.templates.h>
#include <deal.II/grid/tria_levels.h>
+#include <boost/container/small_vector.hpp>
+
#include <cmath>
DEAL_II_NAMESPACE_OPEN
inline static bool
face_flip(const TriaAccessor<3, 3, 3> &accessor, const unsigned int face)
{
- AssertIndexRange(face, GeometryInfo<3>::faces_per_cell);
+ AssertIndexRange(face, accessor.n_faces());
Assert(accessor.present_index * GeometryInfo<3>::faces_per_cell + face <
accessor.tria->levels[accessor.present_level]
->face_orientations.size(),
face_rotation(const TriaAccessor<3, 3, 3> &accessor,
const unsigned int face)
{
- AssertIndexRange(face, GeometryInfo<3>::faces_per_cell);
+ AssertIndexRange(face, accessor.n_faces());
Assert(accessor.present_index * GeometryInfo<3>::faces_per_cell + face <
accessor.tria->levels[accessor.present_level]
->face_orientations.size(),
const unsigned int line)
{
Assert(accessor.used(), TriaAccessorExceptions::ExcCellNotUsed());
- AssertIndexRange(line, GeometryInfo<3>::lines_per_cell);
+ AssertIndexRange(line, accessor.n_lines());
const auto pair =
GeometryInfo<3>::standard_hex_line_to_quad_line_index(line);
const bool value)
{
Assert(accessor.used(), TriaAccessorExceptions::ExcCellNotUsed());
- AssertIndexRange(face, GeometryInfo<3>::faces_per_cell);
+ AssertIndexRange(face, accessor.n_faces());
Assert(accessor.present_index * GeometryInfo<3>::faces_per_cell + face <
accessor.tria->levels[accessor.present_level]
->face_orientations.size(),
const unsigned int face,
const bool value)
{
- AssertIndexRange(face, GeometryInfo<3>::faces_per_cell);
+ AssertIndexRange(face, accessor.n_faces());
Assert(accessor.present_index * GeometryInfo<3>::faces_per_cell + face <
accessor.tria->levels[accessor.present_level]
->face_orientations.size(),
const unsigned int face,
const bool value)
{
- AssertIndexRange(face, GeometryInfo<3>::faces_per_cell);
+ AssertIndexRange(face, accessor.n_faces());
Assert(accessor.present_index * GeometryInfo<3>::faces_per_cell + face <
accessor.tria->levels[accessor.present_level]
->face_orientations.size(),
const bool value)
{
Assert(accessor.used(), TriaAccessorExceptions::ExcCellNotUsed());
- AssertIndexRange(line, GeometryInfo<3>::lines_per_face);
- Assert(accessor.present_index * GeometryInfo<3>::lines_per_face + line <
+ AssertIndexRange(line, accessor.n_lines());
+ Assert(accessor.present_index * GeometryInfo<2>::lines_per_cell + line <
accessor.tria->faces->quads_line_orientations.size(),
ExcInternalError());
// quads as part of 3d hexes can have non-standard orientation
accessor.tria->faces->quads_line_orientations
- [accessor.present_index * GeometryInfo<3>::lines_per_face + line] =
+ [accessor.present_index * GeometryInfo<2>::lines_per_cell + line] =
value;
}
TriaAccessor<structdim, dim, spacedim>::vertex_index(
const unsigned int corner) const
{
- AssertIndexRange(corner, GeometryInfo<structdim>::vertices_per_cell);
+ AssertIndexRange(corner, this->n_vertices());
return dealii::internal::TriaAccessorImplementation::Implementation::
vertex_index(*this, corner);
inline unsigned int
TriaAccessor<structdim, dim, spacedim>::line_index(const unsigned int i) const
{
- AssertIndexRange(i, GeometryInfo<structdim>::lines_per_cell);
+ AssertIndexRange(i, this->n_lines());
return dealii::internal::TriaAccessorImplementation::Implementation::
line_index(*this, i);
const unsigned int line) const
{
Assert(used(), TriaAccessorExceptions::ExcCellNotUsed());
- AssertIndexRange(line, GeometryInfo<structdim>::lines_per_cell);
+ AssertIndexRange(line, this->n_lines());
return dealii::internal::TriaAccessorImplementation::Implementation::
line_orientation(*this, line);
const bool value) const
{
Assert(used(), TriaAccessorExceptions::ExcCellNotUsed());
- AssertIndexRange(line, GeometryInfo<structdim>::lines_per_cell);
+ AssertIndexRange(line, this->n_lines());
dealii::internal::TriaAccessorImplementation::Implementation::
set_line_orientation(*this, line, value);
// two vertices corresponding to the largest diagonal which is being used
// to construct the initial ball.
// We employ this mask to skip these two vertices while enlarging the ball.
- std::array<bool, GeometryInfo<structdim>::vertices_per_cell>
- is_initial_guess_vertex;
+ std::vector<bool> is_initial_guess_vertex(this->n_vertices());
// First let all the vertices be outside
std::fill(is_initial_guess_vertex.begin(),
// For each vertex that is found to be geometrically outside the ball
// enlarge the ball so that the new ball contains both the previous ball
// and the given vertex.
- for (const unsigned int v : GeometryInfo<structdim>::vertex_indices())
+ for (const unsigned int v : this->vertex_indices())
if (!is_initial_guess_vertex[v])
{
const double distance = center.distance(this->vertex(v));
// Set all_vertices_within_ball false if any of the vertices of the object
// are geometrically outside the ball
- for (const unsigned int v : GeometryInfo<structdim>::vertex_indices())
+ for (const unsigned int v : this->vertex_indices())
if (center.distance(this->vertex(v)) >
radius + 100. * std::numeric_limits<double>::epsilon())
{
case 3:
{
double min = std::numeric_limits<double>::max();
- for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
- for (unsigned int j = i + 1;
- j < GeometryInfo<structdim>::vertices_per_cell;
- ++j)
+ for (const unsigned int i : this->vertex_indices())
+ for (unsigned int j = i + 1; j < this->n_vertices(); ++j)
min = std::min(min,
(this->vertex(i) - this->vertex(j)) *
(this->vertex(i) - this->vertex(j)));
bool is_translation = true;
const Tensor<1, spacedim> dist = o->vertex(0) - this->vertex(0);
const double tol_square = 1e-24 * dist.norm_square();
- for (unsigned int i = 1; i < GeometryInfo<structdim>::vertices_per_cell; ++i)
+ for (unsigned int i = 1; i < this->n_vertices(); ++i)
{
const Tensor<1, spacedim> dist_new =
(o->vertex(i) - this->vertex(i)) - dist;
}
+
+template <int structdim, int dim, int spacedim>
+unsigned int
+TriaAccessor<structdim, dim, spacedim>::n_vertices() const
+{
+ return GeometryInfo<structdim>::vertices_per_cell;
+}
+
+
+
+template <int structdim, int dim, int spacedim>
+unsigned int
+TriaAccessor<structdim, dim, spacedim>::n_lines() const
+{
+ return GeometryInfo<structdim>::lines_per_cell;
+}
+
+
+
+template <int structdim, int dim, int spacedim>
+unsigned int
+TriaAccessor<structdim, dim, spacedim>::n_faces() const
+{
+ AssertDimension(structdim, dim);
+
+ return GeometryInfo<structdim>::faces_per_cell;
+}
+
+
+
+template <int structdim, int dim, int spacedim>
+std_cxx20::ranges::iota_view<unsigned int, unsigned int>
+TriaAccessor<structdim, dim, spacedim>::vertex_indices() const
+{
+ return {0U, n_vertices()};
+}
+
+
+
+template <int structdim, int dim, int spacedim>
+std_cxx20::ranges::iota_view<unsigned int, unsigned int>
+TriaAccessor<structdim, dim, spacedim>::line_indices() const
+{
+ return {0U, n_lines()};
+}
+
+
+
+template <int structdim, int dim, int spacedim>
+std_cxx20::ranges::iota_view<unsigned int, unsigned int>
+TriaAccessor<structdim, dim, spacedim>::face_indices() const
+{
+ return {0U, n_faces()};
+}
+
+
/*----------------- Functions: TriaAccessor<0,dim,spacedim> -----------------*/
template <int dim, int spacedim>
return tria->vertex_used(global_vertex_index);
}
+
+
+template <int spacedim>
+unsigned int
+TriaAccessor<0, 1, spacedim>::n_vertices() const
+{
+ return 1;
+}
+
+
+
+template <int spacedim>
+unsigned int
+TriaAccessor<0, 1, spacedim>::n_lines() const
+{
+ return 0;
+}
+
+
+
+template <int spacedim>
+std_cxx20::ranges::iota_view<unsigned int, unsigned int>
+TriaAccessor<0, 1, spacedim>::vertex_indices() const
+{
+ return {0U, n_vertices()};
+}
+
+
+
+template <int spacedim>
+std_cxx20::ranges::iota_view<unsigned int, unsigned int>
+TriaAccessor<0, 1, spacedim>::line_indices() const
+{
+ return {0U, n_lines()};
+}
+
/*------------------ Functions: CellAccessor<dim,spacedim> ------------------*/
CellAccessor<dim, spacedim>::face_iterator_to_index(
const TriaIterator<TriaAccessor<dim - 1, dim, spacedim>> &face) const
{
- for (const unsigned int face_n : GeometryInfo<dim>::face_indices())
+ for (const unsigned int face_n : this->face_indices())
if (this->face(face_n) == face)
return face_n;
template <int dim, int spacedim>
-inline std::array<TriaIterator<TriaAccessor<dim - 1, dim, spacedim>>,
- GeometryInfo<dim>::faces_per_cell>
+inline boost::container::small_vector<
+ TriaIterator<TriaAccessor<dim - 1, dim, spacedim>>,
+ GeometryInfo<dim>::faces_per_cell>
CellAccessor<dim, spacedim>::face_iterators() const
{
- std::array<TriaIterator<TriaAccessor<dim - 1, dim, spacedim>>,
- GeometryInfo<dim>::faces_per_cell>
- face_iterators;
+ boost::container::small_vector<
+ TriaIterator<TriaAccessor<dim - 1, dim, spacedim>>,
+ GeometryInfo<dim>::faces_per_cell>
+ face_iterators(this->n_faces());
- for (unsigned int i : GeometryInfo<dim>::face_indices())
+ for (unsigned int i : this->face_indices())
face_iterators[i] =
dealii::internal::CellAccessorImplementation::get_face(*this, i);
inline int
CellAccessor<dim, spacedim>::neighbor_index(const unsigned int i) const
{
- AssertIndexRange(i, GeometryInfo<dim>::faces_per_cell);
+ AssertIndexRange(i, this->n_faces());
return this->tria->levels[this->present_level]
->neighbors[this->present_index * GeometryInfo<dim>::faces_per_cell + i]
.second;
inline int
CellAccessor<dim, spacedim>::neighbor_level(const unsigned int i) const
{
- AssertIndexRange(i, GeometryInfo<dim>::faces_per_cell);
+ AssertIndexRange(i, this->n_faces());
return this->tria->levels[this->present_level]
->neighbors[this->present_index * GeometryInfo<dim>::faces_per_cell + i]
.first;
const RefinementCase<dim - 1> &face_refinement_case) const
{
Assert(dim > 1, ExcImpossibleInDim(dim));
- AssertIndexRange(face_no, GeometryInfo<dim>::faces_per_cell);
+ AssertIndexRange(face_no, this->n_faces());
AssertIndexRange(face_refinement_case,
RefinementCase<dim>::isotropic_refinement + 1);
const unsigned int line_no) const
{
Assert(dim > 1, ExcImpossibleInDim(dim));
- AssertIndexRange(line_no, GeometryInfo<dim>::lines_per_cell);
+ AssertIndexRange(line_no, this->n_lines());
// the new refinement case is a combination
// of the minimum required one for the given
CellAccessor<2>::subface_case(const unsigned int face_no) const
{
Assert(is_active(), TriaAccessorExceptions::ExcCellNotActive());
- AssertIndexRange(face_no, GeometryInfo<2>::faces_per_cell);
+ AssertIndexRange(face_no, this->n_faces());
return ((face(face_no)->has_children()) ?
dealii::internal::SubfaceCase<2>::case_x :
dealii::internal::SubfaceCase<2>::case_none);
CellAccessor<2, 3>::subface_case(const unsigned int face_no) const
{
Assert(is_active(), TriaAccessorExceptions::ExcCellNotActive());
- AssertIndexRange(face_no, GeometryInfo<2>::faces_per_cell);
+ AssertIndexRange(face_no, this->n_faces());
return ((face(face_no)->has_children()) ?
dealii::internal::SubfaceCase<2>::case_x :
dealii::internal::SubfaceCase<2>::case_none);
CellAccessor<3>::subface_case(const unsigned int face_no) const
{
Assert(is_active(), TriaAccessorExceptions::ExcCellNotActive());
- AssertIndexRange(face_no, GeometryInfo<3>::faces_per_cell);
+ AssertIndexRange(face_no, this->n_faces());
switch (static_cast<std::uint8_t>(face(face_no)->refinement_case()))
{
case RefinementCase<3>::no_refinement:
TriaIterator<CellAccessor<dim, spacedim>> &cell,
std::vector<bool> &vertices_owned_by_locally_owned_cells) {
// add local vertices
- for (const auto v : GeometryInfo<dim>::vertex_indices())
+ for (const auto v : cell->vertex_indices())
{
vertices_owned_by_locally_owned_cells[cell->vertex_index(v)] =
true;
// helper function to determine if cell is locally relevant
// (i.e. a cell which is connected to a vertex via a locally
// owned cell)
- auto is_locally_relevant_on_level =
+ const auto is_locally_relevant_on_level =
[&](TriaIterator<CellAccessor<dim, spacedim>> &cell) {
- for (const auto v : GeometryInfo<dim>::vertex_indices())
+ for (const auto v : cell->vertex_indices())
if (vertices_owned_by_locally_owned_cells_on_level
[cell->vertex_index(v)])
return true;
continue;
// extract cell definition (with old numbering of vertices)
- dealii::CellData<dim> cell_data(
- GeometryInfo<dim>::vertices_per_cell);
+ dealii::CellData<dim> cell_data(cell->n_vertices());
cell_data.material_id = cell->material_id();
cell_data.manifold_id = cell->manifold_id();
- for (const auto v : GeometryInfo<dim>::vertex_indices())
+ for (const auto v : cell->vertex_indices())
cell_data.vertices[v] = cell->vertex_index(v);
construction_data.coarse_cells.push_back(cell_data);
// save indices of each vertex of this cell
- for (const auto v : GeometryInfo<dim>::vertex_indices())
+ for (const auto v : cell->vertex_indices())
vertices_locally_relevant[cell->vertex_index(v)] =
numbers::invalid_unsigned_int;
// c) correct vertices of cells (make them local)
for (auto &cell : construction_data.coarse_cells)
- for (const auto v : GeometryInfo<dim>::vertex_indices())
+ for (unsigned int v = 0; v < cell.vertices.size(); ++v)
cell.vertices[v] = vertices_locally_relevant[cell.vertices[v]];
}
// helper function to determine if cell is locally relevant
// on active level
- auto is_locally_relevant_on_active_level =
+ const auto is_locally_relevant_on_active_level =
[&](TriaIterator<CellAccessor<dim, spacedim>> &cell) {
if (cell->active())
- for (const auto v : GeometryInfo<dim>::vertex_indices())
+ for (const auto v : cell->vertex_indices())
if (vertices_owned_by_locally_owned_active_cells
[cell->vertex_index(v)])
return true;
// helper function to determine if cell is locally relevant
// on level
- auto is_locally_relevant_on_level =
+ const auto is_locally_relevant_on_level =
[&](TriaIterator<CellAccessor<dim, spacedim>> &cell) {
- for (const auto v : GeometryInfo<dim>::vertex_indices())
+ for (const auto v : cell->vertex_indices())
if (vertices_owned_by_locally_owned_cells_on_level
[cell->vertex_index(v)])
return true;
cell_info.id = cell->id().template to_binary<dim>();
// save boundary_ids of each face of this cell
- for (const auto f : GeometryInfo<dim>::face_indices())
+ for (const auto f : cell->face_indices())
{
types::boundary_id boundary_ind =
cell->face(f)->boundary_id();
// ... of lines
if (dim >= 2)
- for (unsigned int line = 0;
- line < GeometryInfo<dim>::lines_per_cell;
- ++line)
+ for (const auto line : cell->line_indices())
cell_info.manifold_line_ids[line] =
cell->line(line)->manifold_id();
// ... of quads
if (dim == 3)
- for (const auto f : GeometryInfo<dim>::face_indices())
+ for (const auto f : cell->face_indices())
cell_info.manifold_quad_ids[f] =
cell->quad(f)->manifold_id();
}