std::vector<types::global_dof_index>::const_iterator next =
dof_indices.begin();
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<1>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<1>::vertex_indices())
for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
accessor.set_mg_vertex_dof_index(
level, vertex, dof, *next++, fe_index);
std::vector<types::global_dof_index>::const_iterator next =
dof_indices.begin();
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<2>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<2>::vertex_indices())
for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
accessor.set_mg_vertex_dof_index(
level, vertex, dof, *next++, fe_index);
std::vector<types::global_dof_index>::const_iterator next =
dof_indices.begin();
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<3>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<3>::vertex_indices())
for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
accessor.set_mg_vertex_dof_index(
level, vertex, dof, *next++, fe_index);
handler.get_fe(fe_index);
std::vector<types::global_dof_index>::iterator next = dof_indices.begin();
- for (unsigned int vertex = 0; vertex < GeometryInfo<1>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<1>::vertex_indices())
for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
*next++ = accessor.mg_vertex_dof_index(level, vertex, dof);
handler.get_fe(fe_index);
std::vector<types::global_dof_index>::iterator next = dof_indices.begin();
- for (unsigned int vertex = 0; vertex < GeometryInfo<2>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<2>::vertex_indices())
for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
*next++ = accessor.mg_vertex_dof_index(level, vertex, dof);
handler.get_fe(fe_index);
std::vector<types::global_dof_index>::iterator next = dof_indices.begin();
- for (unsigned int vertex = 0; vertex < GeometryInfo<3>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<3>::vertex_indices())
for (unsigned int dof = 0; dof < fe.dofs_per_vertex; ++dof)
*next++ = accessor.mg_vertex_dof_index(level, vertex, dof);
unsigned int index = 0;
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<dim>::vertex_indices())
for (unsigned int d = 0; d < dofs_per_vertex; ++d, ++index)
accessor.set_vertex_dof_index(vertex,
d,
// for each shape function, copy the flags from the base element to this
// one, taking into account multiplicities, and other complications
unsigned int total_index = 0;
- for (unsigned int vertex_number = 0;
- vertex_number < GeometryInfo<dim>::vertices_per_cell;
- ++vertex_number)
+ for (const unsigned int vertex_number :
+ GeometryInfo<dim>::vertex_indices())
{
for (unsigned int base = 0; base < fes.size(); ++base)
for (unsigned int m = 0; m < multiplicities[base]; ++m)
// to this one, taking into account multiplicities, multiple components in
// base elements, and other complications
unsigned int total_index = 0;
- for (unsigned int vertex_number = 0;
- vertex_number < GeometryInfo<dim>::vertices_per_cell;
- ++vertex_number)
+ for (const unsigned int vertex_number :
+ GeometryInfo<dim>::vertex_indices())
{
unsigned int comp_start = 0;
for (unsigned int base = 0; base < fes.size(); ++base)
// the first vertex in the order of the base elements, then of the second
// vertex, etc
total_index = 0;
- for (unsigned int vertex_number = 0;
- vertex_number < GeometryInfo<dim>::vertices_per_cell;
- ++vertex_number)
+ for (const unsigned int vertex_number :
+ GeometryInfo<dim>::vertex_indices())
{
unsigned int comp_start = 0;
for (unsigned int base = 0; base < fe.n_base_elements(); ++base)
const typename Triangulation<dim, spacedim>::cell_iterator &cell) const
{
vertices.resize(GeometryInfo<dim>::vertices_per_cell);
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
vertices[i] = cell->vertex(i);
this->cell = cell;
}
quad.size(), std::vector<double>(GeometryInfo<dim>::vertices_per_cell));
for (unsigned int q = 0; q < quad.size(); ++q)
{
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
{
cell_manifold_quadrature_weights[q][i] =
GeometryInfo<dim>::d_linear_shape_function(quad.point(q), i);
cell = triangulation.begin_active(),
endc = triangulation.end();
for (; cell != endc; ++cell)
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
if (treated_vertices[cell->vertex_index(v)] == false)
{
// transform this vertex
xi[d] = 0.5;
Point<spacedim> x_k;
- for (unsigned int i = 0; i < GeometryInfo<structdim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
x_k += object->vertex(i) *
GeometryInfo<structdim>::d_linear_shape_function(xi, i);
do
{
Tensor<1, structdim> F_k;
- for (unsigned int i = 0;
- i < GeometryInfo<structdim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i :
+ GeometryInfo<structdim>::vertex_indices())
F_k +=
(x_k - trial_point) * object->vertex(i) *
GeometryInfo<structdim>::d_linear_shape_function_gradient(xi,
i);
Tensor<2, structdim> H_k;
- for (unsigned int i = 0;
- i < GeometryInfo<structdim>::vertices_per_cell;
- ++i)
- for (unsigned int j = 0;
- j < GeometryInfo<structdim>::vertices_per_cell;
- ++j)
+ for (const unsigned int i :
+ GeometryInfo<structdim>::vertex_indices())
+ for (const unsigned int j :
+ GeometryInfo<structdim>::vertex_indices())
{
Tensor<2, structdim> tmp = outer_product(
GeometryInfo<structdim>::d_linear_shape_function_gradient(
xi += delta_xi;
x_k = Point<spacedim>();
- for (unsigned int i = 0;
- i < GeometryInfo<structdim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i :
+ GeometryInfo<structdim>::vertex_indices())
x_k += object->vertex(i) *
GeometryInfo<structdim>::d_linear_shape_function(xi, i);
if (cell->is_locally_owned())
{
std::set<dealii::types::subdomain_id> send_to;
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
{
const std::map<unsigned int,
std::set<dealii::types::subdomain_id>>::
// 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 (unsigned int v = 0; v < GeometryInfo<structdim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<structdim>::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 (unsigned int v = 0; v < GeometryInfo<structdim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<structdim>::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 (unsigned int i = 0;
- i < GeometryInfo<structdim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
for (unsigned int j = i + 1;
j < GeometryInfo<structdim>::vertices_per_cell;
++j)
// perform shift, if so desired
if (shift != Point<patch_space_dim>())
for (unsigned int i = old_n_patches; i < patches.size(); ++i)
- for (unsigned int v = 0; v < GeometryInfo<patch_dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<patch_dim>::vertex_indices())
patches[i].vertices[v] += shift;
// adjust patch numbers
{
// TODO: make tolerance relative
const double epsilon = 3e-16;
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
if (vertices[i].distance(patch.vertices[i]) > epsilon)
return false;
// TODO: make tolerance relative
const double epsilon = 3e-16;
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
if (vertices[i].distance(patch.vertices[i]) > epsilon)
return false;
<< '\n';
// then write all the data that is in this patch
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
out << patch.vertices[GeometryInfo<dim>::ucd_to_deal[i]] << ' ';
out << '\n';
// then read all the data that is in this patch
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
in >> patch.vertices[GeometryInfo<dim>::ucd_to_deal[i]];
for (unsigned int i : GeometryInfo<dim>::face_indices())
triangulation.begin_active();
cell != triangulation.end();
++cell)
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
{
++vertex_touch_count[cell->vertex_index(v)];
vertex_to_cell[cell->vertex_index(v)].emplace_back(cell, v);
const unsigned int index =
coarse_cell_to_p4est_tree_permutation[cell->index()];
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
{
if (set_vertex_info == true)
connectivity
// important: only assign the level_subdomain_id if it is a ghost cell
// even though we could fill in all.
bool used = false;
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
{
if (marked_vertices[dealii_cell->level()]
[dealii_cell->vertex_index(v)])
dealii_cell->is_artificial() == false &&
dealii_cell->level() + 1 < static_cast<int>(marked_vertices.size()))
{
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
{
if (marked_vertices[dealii_cell->level() + 1]
[dealii_cell->vertex_index(v)])
if (!used && dealii_cell->is_active() &&
dealii_cell->is_artificial() == false && dealii_cell->level() > 0)
{
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
{
if (marked_vertices[dealii_cell->level() - 1]
[dealii_cell->vertex_index(v)])
if (dealii_cell->is_locally_owned())
{
std::set<dealii::types::subdomain_id> send_to;
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
{
const std::map<unsigned int,
std::set<dealii::types::subdomain_id>>::
{
std::vector<unsigned int> vertex_indices;
std::vector<dealii::Point<spacedim>> local_vertices;
- for (unsigned int v = 0;
- v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<dim>::vertex_indices())
if (vertex_locally_moved[dealii_cell->vertex_index(v)])
{
vertex_indices.push_back(v);
for (; cell != endc; ++cell)
{
if (cell->refine_flag_set())
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<dim>::vertex_indices())
vertex_level[topological_vertex_numbering
[cell->vertex_index(vertex)]] =
std::max(vertex_level[topological_vertex_numbering
[cell->vertex_index(vertex)]],
cell->level() + 1);
else if (!cell->coarsen_flag_set())
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<dim>::vertex_indices())
vertex_level[topological_vertex_numbering
[cell->vertex_index(vertex)]] =
std::max(vertex_level[topological_vertex_numbering
// to correct this by iterating over the entire
// process until we are converged
Assert(cell->coarsen_flag_set(), ExcInternalError());
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<dim>::vertex_indices())
vertex_level[topological_vertex_numbering
[cell->vertex_index(vertex)]] =
std::max(vertex_level[topological_vertex_numbering
for (cell = tria.last_active(); cell != endc; --cell)
if (cell->refine_flag_set() == false)
{
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<dim>::vertex_indices())
if (vertex_level[topological_vertex_numbering
[cell->vertex_index(vertex)]] >=
cell->level() + 1)
cell->set_refine_flag();
continue_iterating = true;
- for (unsigned int v = 0;
- v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<dim>::vertex_indices())
vertex_level[topological_vertex_numbering
[cell->vertex_index(v)]] =
std::max(
(cell->level_subdomain_id() ==
numbers::artificial_subdomain_id);
bool need_to_know = false;
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<dim>::vertex_indices())
if (active_verts[cell->vertex_index(vertex)])
{
need_to_know = true;
cell_iterator cell = this->begin(level), endc = this->end(level);
for (; cell != endc; ++cell)
if (cell->level_subdomain_id() == this->locally_owned_subdomain())
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
marked_vertices[cell->vertex_index(v)] = true;
/**
std::vector<bool> vertex_of_own_cell(this->n_vertices(), false);
for (const auto &cell : this->active_cell_iterators())
if (cell->is_locally_owned())
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
vertex_of_own_cell[cell->vertex_index(v)] = true;
// 3) for each vertex belonging to a locally owned cell all ghost
const types::subdomain_id owner = cell->subdomain_id();
// loop over all its vertices
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
{
// set owner if vertex belongs to a local cell
if (vertex_of_own_cell[cell->vertex_index(v)])
{
const unsigned int level = cell->level();
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<1>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<1>::vertex_indices())
{
const unsigned int vertex_index = cell->vertex_index(vertex);
{
const unsigned int level = cell->level();
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<2>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<2>::vertex_indices())
{
const unsigned int vertex_index = cell->vertex_index(vertex);
{
const unsigned int level = cell->level();
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<3>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<3>::vertex_indices())
{
const unsigned int vertex_index = cell->vertex_index(vertex);
{
// distribute dofs of vertices
if (dof_handler.get_fe().dofs_per_vertex > 0)
- for (unsigned int v = 0; v < GeometryInfo<1>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<1>::vertex_indices())
{
if (cell->vertex_dof_index(v, 0) == numbers::invalid_dof_index)
for (unsigned int d = 0;
{
if (dof_handler.get_fe().dofs_per_vertex > 0)
// number dofs on vertices
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<2>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<2>::vertex_indices())
// check whether dofs for this vertex have been distributed
// (checking the first dof should be good enough)
if (cell->vertex_dof_index(vertex, 0) ==
{
if (dof_handler.get_fe().dofs_per_vertex > 0)
// number dofs on vertices
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<3>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<3>::vertex_indices())
// check whether dofs for this vertex have been distributed
// (checking the first dof should be good enough)
if (cell->vertex_dof_index(vertex, 0) ==
// (only check the first dof), and if this isn't the case
// distribute new ones there
if (fe.dofs_per_vertex > 0)
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<1>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<1>::vertex_indices())
if (cell->vertex_dof_index(vertex, 0, fe_index) ==
numbers::invalid_dof_index)
for (unsigned int d = 0; d < fe.dofs_per_vertex;
// (only check the first dof), and if this isn't the case
// distribute new ones there
if (fe.dofs_per_vertex > 0)
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<2>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<2>::vertex_indices())
if (cell->vertex_dof_index(vertex, 0, fe_index) ==
numbers::invalid_dof_index)
for (unsigned int d = 0; d < fe.dofs_per_vertex;
// (only check the first dof), and if this isn't the case
// distribute new ones there
if (fe.dofs_per_vertex > 0)
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<3>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<3>::vertex_indices())
if (cell->vertex_dof_index(vertex, 0, fe_index) ==
numbers::invalid_dof_index)
for (unsigned int d = 0; d < fe.dofs_per_vertex;
&dof_handler.get_triangulation()) != nullptr)
for (const auto &cell : dof_handler.active_cell_iterators())
if (cell->is_ghost())
- for (unsigned int v = 0;
- v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
include_vertex[cell->vertex_index(v)] = true;
// loop over all vertices and see which one we need to work on
{
// distribute dofs of vertices
if (cell->get_fe().dofs_per_vertex > 0)
- for (unsigned int v = 0; v < GeometryInfo<1>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<1>::vertex_indices())
{
typename DoFHandler<dim, spacedim>::level_cell_iterator
neighbor = cell->neighbor(v);
{
if (cell->get_fe().dofs_per_vertex > 0)
// number dofs on vertices
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<2>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<2>::vertex_indices())
// check whether dofs for this
// vertex have been distributed
// (only check the first dof)
{
if (cell->get_fe().dofs_per_vertex > 0)
// number dofs on vertices
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<3>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<3>::vertex_indices())
// check whether dofs for this vertex have been distributed
// (only check the first dof)
if (cell->mg_vertex_dof_index(cell->level(), vertex, 0) ==
for (const auto &cell : dof_handler->active_cell_iterators())
if (cell->is_locally_owned())
{
- for (unsigned int v = 0;
- v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
if (vertices_with_ghost_neighbors.find(cell->vertex_index(
v)) != vertices_with_ghost_neighbors.end())
{
// Identify all vertices active on this level and remember some data
// about them
for (cell = dof_handler.begin(level); cell != endc; ++cell)
- for (unsigned int v = 0;
- v < GeometryInfo<DoFHandlerType::dimension>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<DoFHandlerType::dimension>::vertex_indices())
{
const unsigned int vg = cell->vertex_index(v);
vertex_dof_count[vg] += cell->get_fe().dofs_per_cell;
indices.resize(fe.dofs_per_cell);
cell->get_mg_dof_indices(indices);
- for (unsigned int v = 0;
- v < GeometryInfo<DoFHandlerType::dimension>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<DoFHandlerType::dimension>::vertex_indices())
{
const unsigned int vg = cell->vertex_index(v);
const unsigned int block = vertex_mapping[vg];
// Mark vertices that belong to cells in subdomain 1
for (const auto &cell : dof_handler.active_cell_iterators())
if (predicate_1(cell)) // True ==> part of subdomain 1
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
vertices_subdomain_1[cell->vertex_index(v)] = true;
// Find if cells in subdomain 2 and subdomain 1 share vertices.
for (const auto &cell : dof_handler.active_cell_iterators())
if (predicate_2(cell)) // True ==> part of subdomain 2
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
if (vertices_subdomain_1[cell->vertex_index(v)] == true)
{
return true;
{
std::vector<unsigned int> embedding_dofs(
GeometryInfo<dim>::vertices_per_cell);
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
embedding_dofs[i] = i;
return embedding_dofs;
FE_Q_Hierarchical<dim>::get_constant_modes() const
{
Table<2, bool> constant_modes(1, this->dofs_per_cell);
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
constant_modes(0, i) = true;
for (unsigned int i = GeometryInfo<dim>::vertices_per_cell;
i < this->dofs_per_cell;
const typename Triangulation<dim, spacedim>::cell_iterator &cell) const
{
std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell> vertices;
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
{
vertices[i] = cell->vertex(i);
}
if (quad.size() == 0)
{
std::vector<Point<dim>> points(GeometryInfo<dim>::vertices_per_cell);
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
points[i] = GeometryInfo<dim>::unit_cell_vertex(i);
quad = Quadrature<dim>(points);
}
typename VectorType::value_type value =
internal::ElementAccess<VectorType>::get(vector, dof_indices[i]);
if (euler_dof_handler->get_fe().is_primitive(i))
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
vertices[v][comp] += fe_values.shape_value(i, v) * value;
else
Assert(false, ExcNotImplemented());
std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell> vertices;
std::array<double, GeometryInfo<dim>::vertices_per_cell> weights;
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
{
vertices[v] = cell->vertex(v);
weights[v] = GeometryInfo<dim>::d_linear_shape_function(p, v);
const Point<dim> np(p + L * ei);
// Get the weights to compute the np point in real space
- for (unsigned int j = 0;
- j < GeometryInfo<dim>::vertices_per_cell;
- ++j)
+ for (const unsigned int j :
+ GeometryInfo<dim>::vertex_indices())
data.vertex_weights[j] =
GeometryInfo<dim>::d_linear_shape_function(np, j);
shiftmap_dof_handler->get_fe().dofs_per_cell);
dof_cell->get_dof_values(*euler_transform_vectors, mapping_values);
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
{
Point<spacedim> shift_vector;
vertices = this->get_vertices(cell);
std::vector<Point<spacedim>> a(GeometryInfo<dim>::vertices_per_cell);
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
a[i] = vertices[i];
return a;
output[0].reinit(polynomial_degree - 1,
GeometryInfo<1>::vertices_per_cell);
for (unsigned int q = 0; q < polynomial_degree - 1; ++q)
- for (unsigned int i = 0; i < GeometryInfo<1>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<1>::vertex_indices())
output[0](q, i) =
GeometryInfo<1>::d_linear_shape_function(quadrature.point(q + 1),
i);
GeometryInfo<dim>::vertices_per_cell,
GeometryInfo<dim>::vertices_per_cell);
for (unsigned int q = 0; q < output.size(0); ++q)
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
output(q, i) = GeometryInfo<dim>::d_linear_shape_function(
quadrature.point(h2l[q + GeometryInfo<dim>::vertices_per_cell]),
i);
this->compute_mapping_support_points(cell);
a.resize(GeometryInfo<dim>::vertices_per_cell);
std::vector<CellData<dim>> cells(1);
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
cells[0].vertices[i] = i;
Triangulation<dim, spacedim> tria;
tria.create_triangulation(a, cells, SubCellData());
boost::container::small_vector<Point<3>, 200> tmp_points(
GeometryInfo<2>::vertices_per_cell +
GeometryInfo<2>::lines_per_cell * (polynomial_degree - 1));
- for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<2>::vertex_indices())
tmp_points[v] = a[GeometryInfo<3>::face_to_cell_vertices(face_no, v)];
if (polynomial_degree > 1)
for (unsigned int line = 0; line < GeometryInfo<2>::lines_per_cell;
std::vector<Point<3>> & a) const
{
std::array<Point<3>, GeometryInfo<2>::vertices_per_cell> vertices;
- for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<2>::vertex_indices())
vertices[i] = cell->vertex(i);
Table<2, double> weights(Utilities::fixed_power<2>(polynomial_degree - 1),
{
Point<2> point(line_support_points.point(q1 + 1)[0],
line_support_points.point(q2 + 1)[0]);
- for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<2>::vertex_indices())
weights(q, i) = GeometryInfo<2>::d_linear_shape_function(point, i);
}
// get the vertices first
std::vector<Point<spacedim>> a;
a.reserve(Utilities::fixed_power<dim>(polynomial_degree + 1));
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
a.push_back(cell->vertex(i));
if (this->polynomial_degree > 1)
// loop over vertices of all cells
for (auto &cell : tria)
- for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<2>::vertex_indices())
{
// vertex has been already processed: nothing to do
if (vertex_processed[cell.vertex_index(v)])
// Prepare cell data
std::vector<CellData<dim>> cells(1);
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
cells[0].vertices[i] = i;
cells[0].material_id = 0;
typename Triangulation<dim, spacedim>::active_cell_iterator cell =
tria.begin_active();
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
cell->vertex(i) = vertices[i];
// Check that the order of the vertices makes sense, i.e., the volume of the
if (cylinder_triangulation_offset == Tensor<1, 2>())
{
- for (unsigned int vertex_n = 0;
- vertex_n < GeometryInfo<2>::vertices_per_cell;
- ++vertex_n)
+ for (const unsigned int vertex_n :
+ GeometryInfo<2>::vertex_indices())
if (cell->vertex(vertex_n) == Point<2>())
{
// cylinder_tria is centered at zero, so we need to
// and right sides of cylinder_tria inwards so that it fits in
// bulk_tria:
for (const auto &cell : cylinder_tria.active_cell_iterators())
- for (unsigned int vertex_n = 0;
- vertex_n < GeometryInfo<2>::vertices_per_cell;
- ++vertex_n)
+ for (const unsigned int vertex_n : GeometryInfo<2>::vertex_indices())
{
if (std::abs(cell->vertex(vertex_n)[0] - -0.41 / 4.0) < 1e-10)
cell->vertex(vertex_n)[0] = -0.1;
const double shift =
std::min(0.125 + shell_region_width * 0.5, 0.1 * 4. / 3.);
for (const auto &cell : tria.active_cell_iterators())
- for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<2>::vertex_indices())
if (cell->vertex(v).distance(Point<2>(0.1, 0.205)) < 1e-10)
cell->vertex(v) = Point<2>(0.2 - shift, 0.205);
else if (cell->vertex(v).distance(Point<2>(0.3, 0.205)) < 1e-10)
std::vector<CellData<dim>> cells(n_cells);
// Vertices of the center cell
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
{
Point<spacedim> p;
for (unsigned int d = 0; d < dim; ++d)
std::end(vertices_tmp));
unsigned int cell_vertices[1][GeometryInfo<2>::vertices_per_cell];
- for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<2>::vertex_indices())
cell_vertices[0][i] = i;
std::vector<CellData<2>> cells(1, CellData<2>());
- for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<2>::vertex_indices())
cells[0].vertices[i] = cell_vertices[0][i];
cells[0].material_id = 0;
for (unsigned int i = 0; i < n_cells; ++i)
{
- for (unsigned int j = 0; j < GeometryInfo<3>::vertices_per_cell; ++j)
+ for (const unsigned int j : GeometryInfo<3>::vertex_indices())
cells[i].vertices[j] = cell_vertices[i][j];
cells[i].material_id = 0;
cells[i].manifold_id = i == 0 ? numbers::flat_manifold_id : 1;
for (unsigned int i = 0; i < n_cells; ++i)
{
- for (unsigned int j = 0; j < GeometryInfo<3>::vertices_per_cell;
- ++j)
+ for (const unsigned int j : GeometryInfo<3>::vertex_indices())
cells[i].vertices[j] = cell_vertices[i][j];
cells[i].material_id = 0;
}
for (const auto &cell : tmp.active_cell_iterators())
{
const unsigned int cell_index = cell->active_cell_index();
- for (unsigned int v = 0; v < GeometryInfo<3>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<3>::vertex_indices())
cells[cell_index].vertices[v] = cell->vertex_index(v);
cells[cell_index].material_id = 0;
}
"all cells are on the same refinement level."));
CellData<dim> this_cell;
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
this_cell.vertices[v] = cell->vertex_index(v);
this_cell.material_id = cell->material_id();
cells.push_back(this_cell);
for (std::size_t slice_n = 0; slice_n < n_slices - 1; ++slice_n)
{
CellData<3> this_cell;
- for (unsigned int vertex_n = 0;
- vertex_n < GeometryInfo<2>::vertices_per_cell;
- ++vertex_n)
+ for (const unsigned int vertex_n :
+ GeometryInfo<2>::vertex_indices())
{
this_cell.vertices[vertex_n] =
cell->vertex_index(vertex_n) + slice_n * input.n_vertices();
for (unsigned int id = 0; cell != endc; ++cell, ++id)
{
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
cells[id].vertices[i] = cell->vertex_index(i);
cells[id].material_id = cell->material_id();
cells[id].manifold_id = cell->manifold_id();
{
CellData<boundary_dim> c_data;
- for (unsigned int j = 0;
- j < GeometryInfo<boundary_dim>::vertices_per_cell;
- ++j)
+ for (const unsigned int j :
+ GeometryInfo<boundary_dim>::vertex_indices())
{
const unsigned int v_index = face->vertex_index(j);
cells.emplace_back();
AssertThrow(in, ExcIO());
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- v++)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
in >> cells.back().vertices[v];
cells.back().material_id = 0;
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- v++)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
cells.back().vertices[v] = vertex_indices[cells.back().vertices[v]];
cell_indices[no] = no_cell;
{
// allocate and read indices
cells.emplace_back();
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
in >> cells.back().vertices[i];
// to make sure that the cast won't fail
// transform from ucd to
// consecutive numbering
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
if (vertex_indices.find(cells.back().vertices[i]) !=
vertex_indices.end())
// vertex with this index exists
// read in vertex numbers. they
// are 1-based, so subtract one
cells.emplace_back();
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
{
in >> cells.back().vertices[i];
// allocate and read indices
cells.emplace_back();
- for (unsigned int i = 0;
- i < GeometryInfo<dim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
in >> cells.back().vertices[i];
// to make sure that the cast won't fail
// transform from ucd to
// consecutive numbering
- for (unsigned int i = 0;
- i < GeometryInfo<dim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
{
AssertThrow(
vertex_indices.find(cells.back().vertices[i]) !=
{
if (mFaces[i].mNumIndices == GeometryInfo<dim>::vertices_per_cell)
{
- for (unsigned int f = 0; f < GeometryInfo<dim>::vertices_per_cell;
- ++f)
+ for (const unsigned int f : GeometryInfo<dim>::vertex_indices())
{
cells[valid_cell].vertices[f] =
mFaces[i].mIndices[f] + v_offset;
for (const auto &cell : tria.active_cell_iterators())
{
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
out
<< '\t'
<< renumber[cell->vertex_index(GeometryInfo<dim>::dx_to_deal[v])];
// Vertex numbering follows UCD conventions.
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<dim>::vertex_indices())
out << cell->vertex_index(GeometryInfo<dim>::ucd_to_deal[vertex]) + 1
<< ' ';
out << '\n';
// May, 1992, p. E6
//
// note: vertex numbers are 1-base
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<dim>::vertex_indices())
out << cell->vertex_index(GeometryInfo<dim>::ucd_to_deal[vertex]) + 1
<< ' ';
out << '\n';
// out << "\nfalse";
out << "\nlist " << axes[i] << cell->active_cell_index() << " ";
- for (unsigned int j = 0; j < GeometryInfo<dim>::vertices_per_cell;
- ++j)
+ for (const unsigned int j : GeometryInfo<dim>::vertex_indices())
out << cell->vertex(j)[i] << " ";
}
out << '\n';
patch.n_subdivisions = 1;
patch.data.reinit(5, GeometryInfo<dim>::vertices_per_cell);
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
{
patch.vertices[v] = cell->vertex(v);
patch.data(0, v) = cell->level();
for (const auto &cell : tria.active_cell_iterators())
{
out << GeometryInfo<dim>::vertices_per_cell;
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
{
out << ' ' << cell->vertex_index(GeometryInfo<dim>::ucd_to_deal[i]);
}
// write out the four sides of this cell by putting the four
// points (+ the initial point again) in a row and lifting the
// drawing pencil at the end
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
out << cell->vertex(GeometryInfo<dim>::ucd_to_deal[i]) << ' '
<< cell->level() << ' '
<< static_cast<unsigned int>(cell->material_id()) << '\n';
// doing this multiply
std::set<unsigned int> treated_vertices;
for (const auto &cell : tria.active_cell_iterators())
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<dim>::vertex_indices())
if (treated_vertices.find(cell->vertex_index(vertex)) ==
treated_vertices.end())
{
*/
Cell(const CellData<dim> &c, const std::vector<Edge<dim>> &edge_list)
{
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
vertex_indices[i] = c.vertices[i];
// now for each of the edges of this cell, find the location inside the
unsigned int
temp_vertex_indices[GeometryInfo<dim>::vertices_per_cell];
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
temp_vertex_indices[v] =
raw_cells[cell_index]
.vertices[cube_permutations[origin_vertex_of_cell][v]];
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
raw_cells[cell_index].vertices[v] = temp_vertex_indices[v];
break;
unsigned int tmp[GeometryInfo<3>::vertices_per_cell];
for (auto &cell : cells)
{
- for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<3>::vertex_indices())
tmp[i] = cell.vertices[i];
- for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<3>::vertex_indices())
cell.vertices[i] = tmp[GeometryInfo<3>::ucd_to_deal[i]];
}
}
unsigned int tmp[GeometryInfo<3>::vertices_per_cell];
for (auto &cell : cells)
{
- for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<3>::vertex_indices())
tmp[i] = cell.vertices[i];
- for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<3>::vertex_indices())
cell.vertices[GeometryInfo<3>::ucd_to_deal[i]] = tmp[i];
}
}
// GridTools::cell_measure
// requires the vertices to be
// in lexicographic ordering
- for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<2>::vertex_indices())
vertices_lex[GeometryInfo<2>::ucd_to_deal[i]] = cell.vertices[i];
if (GridTools::cell_measure<2>(all_vertices, vertices_lex) < 0)
{
// Check whether the resulting cell is now ok.
// If not, then the grid is seriously broken and
// we just give up.
- for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<2>::vertex_indices())
vertices_lex[GeometryInfo<2>::ucd_to_deal[i]] = cell.vertices[i];
AssertThrow(GridTools::cell_measure<2>(all_vertices, vertices_lex) >
0,
// GridTools::cell_measure
// requires the vertices to be
// in lexicographic ordering
- for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<3>::vertex_indices())
vertices_lex[GeometryInfo<3>::ucd_to_deal[i]] = cell.vertices[i];
if (GridTools::cell_measure<3>(all_vertices, vertices_lex) < 0)
{
// Check whether the resulting cell is now ok.
// If not, then the grid is seriously broken and
// we just give up.
- for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<3>::vertex_indices())
vertices_lex[GeometryInfo<3>::ucd_to_deal[i]] = cell.vertices[i];
AssertThrow(GridTools::cell_measure<3>(all_vertices, vertices_lex) >
0,
unsigned int max_level_0_vertex_n = 0;
for (const auto &cell : tria.cell_iterators_on_level(0))
- for (unsigned int cell_vertex_n = 0;
- cell_vertex_n < GeometryInfo<dim>::vertices_per_cell;
- ++cell_vertex_n)
+ for (const unsigned int cell_vertex_n :
+ GeometryInfo<dim>::vertex_indices())
max_level_0_vertex_n =
std::max(cell->vertex_index(cell_vertex_n), max_level_0_vertex_n);
vertices.resize(max_level_0_vertex_n + 1);
{
// Save cell data
CellData<dim> cell_data;
- for (unsigned int cell_vertex_n = 0;
- cell_vertex_n < GeometryInfo<dim>::vertices_per_cell;
- ++cell_vertex_n)
+ for (const unsigned int cell_vertex_n :
+ GeometryInfo<dim>::vertex_indices())
{
Assert(cell->vertex_index(cell_vertex_n) < vertices.size(),
ExcInternalError());
{
std::vector<bool> used_vertices(vertices.size());
for (const CellData<dim> &cell_data : cells)
- for (unsigned int cell_vertex_n = 0;
- cell_vertex_n < GeometryInfo<dim>::vertices_per_cell;
- ++cell_vertex_n)
+ for (const unsigned int cell_vertex_n :
+ GeometryInfo<dim>::vertex_indices())
used_vertices[cell_data.vertices[cell_vertex_n]] = true;
Assert(std::find(used_vertices.begin(), used_vertices.end(), false) ==
used_vertices.end(),
// first check which vertices are actually used
std::vector<bool> vertex_used(vertices.size(), false);
for (unsigned int c = 0; c < cells.size(); ++c)
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
{
Assert(cells[c].vertices[v] < vertices.size(),
ExcMessage("Invalid vertex index encountered! cells[" +
// next replace old vertex numbers by the new ones
for (unsigned int c = 0; c < cells.size(); ++c)
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
cells[c].vertices[v] = new_vertex_numbers[cells[c].vertices[v]];
// same for boundary data
for (unsigned int c = 0; c < subcelldata.boundary_lines.size(); // NOLINT
++c)
- for (unsigned int v = 0; v < GeometryInfo<1>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<1>::vertex_indices())
{
Assert(subcelldata.boundary_lines[c].vertices[v] <
new_vertex_numbers.size(),
for (unsigned int c = 0; c < subcelldata.boundary_quads.size(); // NOLINT
++c)
- for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<2>::vertex_indices())
{
Assert(subcelldata.boundary_quads[c].vertices[v] <
new_vertex_numbers.size(),
{
// loop over all vertices of the cell and see if it is listed in the map
// given as first argument of the function
- for (unsigned int vertex_no = 0;
- vertex_no < GeometryInfo<dim>::vertices_per_cell;
- ++vertex_no)
+ for (const unsigned int vertex_no : GeometryInfo<dim>::vertex_indices())
{
const unsigned int vertex_index = cell->vertex_index(vertex_no);
const Point<dim> & vertex_point = cell->vertex(vertex_no);
// according to the computed values
std::vector<bool> vertex_touched(triangulation.n_vertices(), false);
for (const auto &cell : dof_handler.active_cell_iterators())
- for (unsigned int vertex_no = 0;
- vertex_no < GeometryInfo<dim>::vertices_per_cell;
- ++vertex_no)
+ for (const unsigned int vertex_no : GeometryInfo<dim>::vertex_indices())
if (vertex_touched[cell->vertex_index(vertex_no)] == false)
{
Point<dim> &v = cell->vertex(vertex_no);
++cell)
if (cell->is_locally_owned())
{
- for (unsigned int vertex_no = 0;
- vertex_no < GeometryInfo<dim>::vertices_per_cell;
- ++vertex_no)
+ for (const unsigned int vertex_no :
+ GeometryInfo<dim>::vertex_indices())
{
const unsigned global_vertex_no =
cell->vertex_index(vertex_no);
triangulation.begin_active();
cell != triangulation.end();
++cell)
- for (unsigned int vertex_no = 0;
- vertex_no < GeometryInfo<dim>::vertices_per_cell;
- ++vertex_no)
+ for (const unsigned int vertex_no :
+ GeometryInfo<dim>::vertex_indices())
cell->vertex(vertex_no) =
new_vertex_locations[cell->vertex_index(vertex_no)];
}
// list, but std::set throws out those cells already entered
for (const auto &cell : mesh.active_cell_iterators())
{
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; v++)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
if (cell->vertex_index(v) == vertex)
{
// OK, we found a cell that contains
for (; i < active_cells.size(); ++i)
if (predicate(active_cells[i]))
- for (unsigned int v = 0;
- v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<MeshType::dimension>::vertex_indices())
for (unsigned int d = 0; d < spacedim; ++d)
{
minp[d] = std::min(minp[d], active_cells[i]->vertex(v)[d]);
cell = triangulation.begin_active(),
endc = triangulation.end();
for (; cell != endc; ++cell)
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
vertex_to_cell_map[cell->vertex_index(i)].insert(cell);
// Take care of hanging nodes
{
if (cell->is_locally_owned())
{
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
{
types::subdomain_id lowest_subdomain_id = cell->subdomain_id();
typename std::set<active_cell_iterator>::iterator
cell != triangulation.end();
++cell)
{
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
vertex_to_cell[cell->vertex_index(v)].push_back(
cell->active_cell_index());
}
cell != triangulation.end();
++cell)
{
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
for (unsigned int n = 0;
n < vertex_to_cell[cell->vertex_index(v)].size();
++n)
cell != triangulation.end(level);
++cell)
{
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
vertex_to_cell[cell->vertex_index(v)].push_back(cell->index());
}
cell != triangulation.end(level);
++cell)
{
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
for (unsigned int n = 0;
n < vertex_to_cell[cell->vertex_index(v)].size();
++n)
if (cell->is_artificial() ||
(cell->is_ghost() &&
(cell->subdomain_id() < tr->locally_owned_subdomain())))
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
locally_owned_vertices[cell->vertex_index(v)] = false;
return locally_owned_vertices;
Tensor<spacedim - structdim, spacedim>
parent_alternating_forms[GeometryInfo<structdim>::vertices_per_cell];
- for (unsigned int i = 0; i < GeometryInfo<structdim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
parent_vertices[i] = object->vertex(i);
GeometryInfo<structdim>::alternating_form_at_vertices(
[GeometryInfo<structdim>::vertices_per_cell];
for (unsigned int c = 0; c < object->n_children(); ++c)
- for (unsigned int i = 0;
- i < GeometryInfo<structdim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
child_vertices[c][i] = object->child(c)->vertex(i);
// replace mid-object
// objective function
double objective = 0;
for (unsigned int c = 0; c < object->n_children(); ++c)
- for (unsigned int i = 0;
- i < GeometryInfo<structdim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
objective +=
(child_alternating_forms[c][i] -
average_parent_alternating_form / std::pow(2., 1. * structdim))
Point<spacedim>
parent_vertices[GeometryInfo<structdim>::vertices_per_cell];
- for (unsigned int i = 0; i < GeometryInfo<structdim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
parent_vertices[i] = object->vertex(i);
Tensor<spacedim - structdim, spacedim>
[GeometryInfo<structdim>::vertices_per_cell];
for (unsigned int c = 0; c < object->n_children(); ++c)
- for (unsigned int i = 0;
- i < GeometryInfo<structdim>::vertices_per_cell;
- ++i)
+ for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
child_vertices[c][i] = object->child(c)->vertex(i);
Tensor<spacedim - structdim, spacedim> child_alternating_forms
old_min_product =
child_alternating_forms[0][0] * parent_alternating_forms[0];
for (unsigned int c = 0; c < object->n_children(); ++c)
- for (unsigned int i = 0;
- i < GeometryInfo<structdim>::vertices_per_cell;
- ++i)
- for (unsigned int j = 0;
- j < GeometryInfo<structdim>::vertices_per_cell;
- ++j)
+ for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
+ for (const unsigned int j :
+ GeometryInfo<structdim>::vertex_indices())
old_min_product = std::min<double>(old_min_product,
child_alternating_forms[c][i] *
parent_alternating_forms[j]);
new_min_product =
child_alternating_forms[0][0] * parent_alternating_forms[0];
for (unsigned int c = 0; c < object->n_children(); ++c)
- for (unsigned int i = 0;
- i < GeometryInfo<structdim>::vertices_per_cell;
- ++i)
- for (unsigned int j = 0;
- j < GeometryInfo<structdim>::vertices_per_cell;
- ++j)
+ for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
+ for (const unsigned int j :
+ GeometryInfo<structdim>::vertex_indices())
new_min_product = std::min<double>(new_min_product,
child_alternating_forms[c][i] *
parent_alternating_forms[j]);
if (cells_to_remove[cell->active_cell_index()] == false)
{
CellData<dim> c;
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
c.vertices[v] = cell->vertex_index(v);
c.manifold_id = cell->manifold_id();
c.material_id = cell->material_id();
CellData<1> line;
if (dim == 2)
{
- for (unsigned int v = 0;
- v < GeometryInfo<1>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<1>::vertex_indices())
line.vertices[v] = face->vertex_index(v);
line.boundary_id = face->boundary_id();
line.manifold_id = face->manifold_id();
}
else
{
- for (unsigned int v = 0;
- v < GeometryInfo<1>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<1>::vertex_indices())
line.vertices[v] = face->line(l)->vertex_index(v);
line.boundary_id = face->line(l)->boundary_id();
line.manifold_id = face->line(l)->manifold_id();
if (dim == 3)
{
CellData<2> quad;
- for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<2>::vertex_indices())
quad.vertices[v] = face->vertex_index(v);
quad.boundary_id = face->boundary_id();
quad.manifold_id = face->manifold_id();
// list, but std::set throws out those cells already entered
for (; cell != endc; ++cell)
{
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; v++)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
if (cell->vertex_index(v) == vertex)
{
// OK, we found a cell that contains
// the halo layer
for (const auto &cell : mesh.active_cell_iterators())
if (predicate(cell)) // True predicate --> Part of subdomain
- for (unsigned int v = 0;
- v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<MeshType::dimension>::vertex_indices())
locally_active_vertices_on_subdomain[cell->vertex_index(v)] = true;
// Find the cells that do not conform to the predicate
// These comprise the halo layer
for (const auto &cell : mesh.active_cell_iterators())
if (!predicate(cell)) // False predicate --> Potential halo cell
- for (unsigned int v = 0;
- v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<MeshType::dimension>::vertex_indices())
if (locally_active_vertices_on_subdomain[cell->vertex_index(v)] ==
true)
{
cell != mesh.end(level);
++cell)
if (predicate(cell)) // True predicate --> Part of subdomain
- for (unsigned int v = 0;
- v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<MeshType::dimension>::vertex_indices())
locally_active_vertices_on_level_subdomain[cell->vertex_index(v)] =
true;
cell != mesh.end(level);
++cell)
if (!predicate(cell)) // False predicate --> Potential halo cell
- for (unsigned int v = 0;
- v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<MeshType::dimension>::vertex_indices())
if (locally_active_vertices_on_level_subdomain[cell->vertex_index(
v)] == true)
{
for (const auto &cell : mesh.active_cell_iterators())
if (!predicate(cell)) // Negation of predicate --> Not Part of subdomain
{
- for (unsigned int v = 0;
- v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<MeshType::dimension>::vertex_indices())
vertices_outside_subdomain[cell->vertex_index(v)] = true;
n_non_predicate_cells++;
}
for (const auto &cell : mesh.active_cell_iterators())
if (predicate(cell)) // True predicate --> Potential boundary cell of the
// subdomain
- for (unsigned int v = 0;
- v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<MeshType::dimension>::vertex_indices())
if (vertices_outside_subdomain[cell->vertex_index(v)] == true)
{
subdomain_boundary_cells.push_back(cell);
// if it belongs to the predicate domain, extend the bounding box.
for (const auto &cell : mesh.active_cell_iterators())
if (predicate(cell)) // True predicate --> Part of subdomain
- for (unsigned int v = 0;
- v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<MeshType::dimension>::vertex_indices())
if (locally_active_vertices_on_subdomain[cell->vertex_index(v)] ==
false)
{
mesh_2.begin(0),
endc = mesh_1.end(0);
for (; cell_1 != endc; ++cell_1, ++cell_2)
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
if (cell_1->vertex(v) != cell_2->vertex(v))
return false;
uniform_cell != uniform_cells.end();
++uniform_cell)
{
- for (unsigned int v = 0;
- v < GeometryInfo<Container::dimension>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<Container::dimension>::vertex_indices())
{
Point<Container::space_dimension> position =
(*uniform_cell)->vertex(v);
{
// adjust the cell vertices of the local_triangulation to
// match cell vertices of the global triangulation
- for (unsigned int v = 0;
- v < GeometryInfo<
- Container::dimension>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<Container::dimension>::vertex_indices())
active_tria_cell->vertex(v) = patch[i]->vertex(v);
Assert(active_tria_cell->center().distance(
while (true)
{
Point<spacedim> F;
- for (unsigned int v = 0; v < GeometryInfo<facedim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<facedim>::vertex_indices())
F += face->vertex(v) *
GeometryInfo<facedim>::d_linear_shape_function(xi, v);
for (unsigned int i = 0; i < facedim; ++i)
{
grad_F[i] = 0;
- for (unsigned int v = 0; v < GeometryInfo<facedim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<facedim>::vertex_indices())
grad_F[i] +=
face->vertex(v) *
GeometryInfo<facedim>::d_linear_shape_function_gradient(xi, v)[i];
Point<spacedim> new_point;
if (cell_is_flat)
- for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<2>::vertex_indices())
new_point += weights_vertices[v] * vertices[v];
else
{
}
// subtract contribution from the vertices (second line in formula)
- for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<2>::vertex_indices())
new_point -= weights_vertices[v] * vertices[v];
}
}
else
{
- for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<2>::vertex_indices())
points[v] = vertices[face_to_cell_vertices_3d[face][v]];
weights[0] =
linear_shapes[face_even + 2] * linear_shapes[face_even + 4];
}
// finally add the contribution of the
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
new_point += weights_vertices[v] * vertices[v];
}
return new_point;
std::array<Point<spacedim>, GeometryInfo<dim>::vertices_per_cell>
vertices;
- for (unsigned int vertex_n = 0;
- vertex_n < GeometryInfo<dim>::vertices_per_cell;
- ++vertex_n)
+ for (const unsigned int vertex_n : GeometryInfo<dim>::vertex_indices())
{
vertices[vertex_n] = cell->vertex(vertex_n);
}
// center of the loop, we can skip the expensive part below (this assumes
// that the manifold does not deform the grid too much)
Point<spacedim> center;
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
center += vertices[v];
center *= 1. / GeometryInfo<dim>::vertices_per_cell;
double radius_square = 0.;
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
radius_square =
std::max(radius_square, (center - vertices[v]).norm_square());
bool inside_circle = true;
triangulation, level_coarse, nearby_cells[b]);
message << "Looking at cell " << cell->id()
<< " with vertices: " << std::endl;
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
message << cell->vertex(v) << " ";
message << std::endl;
message << "Transformation to chart coordinates: " << std::endl;
bool
CellData<structdim>::operator==(const CellData<structdim> &other) const
{
- for (unsigned int i = 0; i < GeometryInfo<structdim>::vertices_per_cell; i++)
+ for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
if (vertices[i] != other.vertices[i])
return false;
triangulation.begin_active();
cell != triangulation.end();
++cell)
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
{
min_adjacent_cell_level[cell->vertex_index(v)] =
std::min<unsigned int>(
unsigned int tmp[GeometryInfo<3>::vertices_per_cell];
for (auto &cell : cells)
{
- for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<3>::vertex_indices())
tmp[i] = cell.vertices[i];
- for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<3>::vertex_indices())
cell.vertices[GeometryInfo<3>::ucd_to_deal[i]] = tmp[i];
}
++cell)
{
Point<dim> vertices[GeometryInfo<dim>::vertices_per_cell];
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
vertices[i] = cell->vertex(i);
Tensor<0, dim> determinants[GeometryInfo<dim>::vertices_per_cell];
GeometryInfo<dim>::alternating_form_at_vertices(vertices, determinants);
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
if (determinants[i] <= 1e-9 * std::pow(cell->diameter(), 1. * dim))
{
distorted_cells.distorted_cells.push_back(cell);
for (unsigned int c = 0; c < cell->n_children(); ++c)
{
Point<dim> vertices[GeometryInfo<dim>::vertices_per_cell];
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
vertices[i] = cell->child(c)->vertex(i);
Tensor<0, dim> determinants[GeometryInfo<dim>::vertices_per_cell];
GeometryInfo<dim>::alternating_form_at_vertices(vertices, determinants);
- for (unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<dim>::vertex_indices())
if (determinants[i] <=
1e-9 * std::pow(cell->child(c)->diameter(), 1. * dim))
return true;
// for all lines
for (; line != triangulation.end(); ++line)
// for each of the two vertices
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<dim>::vertex_indices())
// if first cell adjacent to
// this vertex is the present
// one, then the neighbor is
// vertices used on level 0
unsigned int max_vertex_index = 0;
for (; cell != endc; ++cell)
- for (unsigned int vertex = 0; vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<dim>::vertex_indices())
if (cell->vertex_index(vertex) > max_vertex_index)
max_vertex_index = cell->vertex_index(vertex);
// every time we find an adjacent
// element
for (cell = begin(); cell != endc; ++cell)
- for (unsigned int vertex = 0; vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex : GeometryInfo<dim>::vertex_indices())
++usage_count[cell->vertex_index(vertex)];
return std::max(GeometryInfo<dim>::vertices_per_cell,
for (; cell != endc; ++cell)
{
if (cell->refine_flag_set())
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<dim>::vertex_indices())
vertex_level[cell->vertex_index(vertex)] =
std::max(vertex_level[cell->vertex_index(vertex)],
cell->level() + 1);
else if (!cell->coarsen_flag_set())
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<dim>::vertex_indices())
vertex_level[cell->vertex_index(vertex)] =
std::max(vertex_level[cell->vertex_index(vertex)],
cell->level());
// to correct this by iterating over the entire
// process until we are converged
Assert(cell->coarsen_flag_set(), ExcInternalError());
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<dim>::vertex_indices())
vertex_level[cell->vertex_index(vertex)] =
std::max(vertex_level[cell->vertex_index(vertex)],
cell->level() - 1);
for (cell = last_active(); cell != endc; --cell)
if (cell->refine_flag_set() == false)
{
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<dim>::vertex_indices())
if (vertex_level[cell->vertex_index(vertex)] >=
cell->level() + 1)
{
{
cell->set_refine_flag();
- for (unsigned int v = 0;
- v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<dim>::vertex_indices())
vertex_level[cell->vertex_index(v)] =
std::max(vertex_level[cell->vertex_index(v)],
cell->level() + 1);
for (const auto &cell : active_cell_iterators())
{
if (cell->refine_flag_set())
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<dim>::vertex_indices())
vertex_level[cell->vertex_index(vertex)] =
std::max(vertex_level[cell->vertex_index(vertex)],
cell->level() + 1);
else if (!cell->coarsen_flag_set())
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<dim>::vertex_indices())
vertex_level[cell->vertex_index(vertex)] =
std::max(vertex_level[cell->vertex_index(vertex)],
cell->level());
// always true (the coarsen flag could be removed
// again) and so we may make an error here
Assert(cell->coarsen_flag_set(), ExcInternalError());
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<dim>::vertex_indices())
vertex_level[cell->vertex_index(vertex)] =
std::max(vertex_level[cell->vertex_index(vertex)],
cell->level() - 1);
for (active_cell_iterator cell = last_active(); cell != end(); --cell)
if (cell->refine_flag_set() == false)
{
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dim>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<dim>::vertex_indices())
if (vertex_level[cell->vertex_index(vertex)] >=
cell->level() + 1)
{
{
cell->set_refine_flag();
- for (unsigned int v = 0;
- v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<dim>::vertex_indices())
vertex_level[cell->vertex_index(v)] =
std::max(vertex_level[cell->vertex_index(v)],
cell->level() + 1);
measure(const TriaAccessor<2, 2, 2> &accessor)
{
unsigned int vertex_indices[GeometryInfo<2>::vertices_per_cell];
- for (unsigned int i = 0; i < GeometryInfo<2>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<2>::vertex_indices())
vertex_indices[i] = accessor.vertex_index(i);
return GridTools::cell_measure<2>(
measure(const TriaAccessor<3, 3, 3> &accessor)
{
unsigned int vertex_indices[GeometryInfo<3>::vertices_per_cell];
- for (unsigned int i = 0; i < GeometryInfo<3>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<3>::vertex_indices())
vertex_indices[i] = accessor.vertex_index(i);
return GridTools::cell_measure<3>(
std::array<Point<spacedim>, GeometryInfo<structdim>::vertices_per_cell> p;
std::array<double, GeometryInfo<structdim>::vertices_per_cell> w;
- for (unsigned int i = 0; i < GeometryInfo<structdim>::vertices_per_cell; ++i)
+ for (const unsigned int i : GeometryInfo<structdim>::vertex_indices())
{
p[i] = this->vertex(i);
w[i] = GeometryInfo<structdim>::d_linear_shape_function(coordinates, i);
// copy vertices to avoid expensive resolution of vertex index inside loop
std::array<Point<spacedim>, GeometryInfo<structdim>::vertices_per_cell>
vertices;
- for (unsigned int v = 0; v < GeometryInfo<structdim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<structdim>::vertex_indices())
vertices[v] = this->vertex(v);
for (unsigned int d = 0; d < spacedim; ++d)
- for (unsigned int v = 0; v < GeometryInfo<structdim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<structdim>::vertex_indices())
for (unsigned int e = 0; e < structdim; ++e)
A[d][e] += vertices[v][d] * TransformR2UAffine<structdim>::KA[v][e];
// b = vertex * Kb
Tensor<1, spacedim> b = point;
- for (unsigned int v = 0; v < GeometryInfo<structdim>::vertices_per_cell; ++v)
+ for (const unsigned int v : GeometryInfo<structdim>::vertex_indices())
b -= vertices[v] * TransformR2UAffine<structdim>::Kb[v];
DerivativeForm<1, spacedim, structdim> A_inv = A.covariant_form().transpose();
{
Assert(use_interpolation == false, ExcNotImplemented());
Point<spacedim> p;
- for (unsigned int v = 0; v < GeometryInfo<structdim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<structdim>::vertex_indices())
p += vertex(v);
return p / GeometryInfo<structdim>::vertices_per_cell;
}
TriaIterator<CellAccessor<dim, spacedim>> &cell,
std::vector<bool> &vertices_owned_by_locally_owned_cells) {
// add local vertices
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
{
vertices_owned_by_locally_owned_cells[cell->vertex_index(v)] =
true;
auto is_locally_relevant = [&](
TriaIterator<CellAccessor<dim, spacedim>>
&cell) {
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
if (vertices_owned_by_locally_owned_cells[cell->vertex_index(v)])
return true;
return false;
dealii::CellData<dim> cell_data;
cell_data.material_id = cell->material_id();
cell_data.manifold_id = cell->manifold_id();
- for (unsigned int v = 0;
- v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
cell_data.vertices[v] = cell->vertex_index(v);
construction_data.coarse_cells.push_back(cell_data);
// b) save indices of each vertex of this cell
- for (unsigned int v = 0;
- v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
vertices_locally_relevant[cell->vertex_index(v)] =
numbers::invalid_unsigned_int;
// 4) correct vertices of cells (make them local)
for (auto &cell : construction_data.coarse_cells)
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
cell.vertices[v] = vertices_locally_relevant[cell.vertices[v]];
}
else
// owned cell)
auto is_locally_relevant_on_level =
[&](TriaIterator<CellAccessor<dim, spacedim>> &cell) {
- for (unsigned int v = 0;
- v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<dim>::vertex_indices())
if (vertices_owned_by_locally_owned_cells_on_level
[cell->vertex_index(v)])
return true;
dealii::CellData<dim> cell_data;
cell_data.material_id = cell->material_id();
cell_data.manifold_id = cell->manifold_id();
- for (unsigned int v = 0;
- v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::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 (unsigned int v = 0;
- v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::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 (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
cell.vertices[v] = vertices_locally_relevant[cell.vertices[v]];
}
auto is_locally_relevant_on_active_level =
[&](TriaIterator<CellAccessor<dim, spacedim>> &cell) {
if (cell->active())
- for (unsigned int v = 0;
- v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
if (vertices_owned_by_locally_owned_active_cells
[cell->vertex_index(v)])
return true;
// on level
auto is_locally_relevant_on_level =
[&](TriaIterator<CellAccessor<dim, spacedim>> &cell) {
- for (unsigned int v = 0;
- v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v :
+ GeometryInfo<dim>::vertex_indices())
if (vertices_owned_by_locally_owned_cells_on_level
[cell->vertex_index(v)])
return true;
cell != dof_handler.end();
++cell)
if (!cell->is_artificial())
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
locally_used_vertices[cell->vertex_index(v)] = true;
std::vector<std::vector<bool>> vertex_fe_association(
cell != dof_handler.end();
++cell)
if (!cell->is_artificial())
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
vertex_fe_association[cell->active_fe_index()]
[cell->vertex_index(v)] = true;
// set the vertices of the patch. if the mapping does not preserve locations
// (e.g. MappingQEulerian), we need to compute the offset of the vertex for
// the graphical output. Otherwise, we can just use the vertex info.
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<DoFHandlerType::dimension>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<DoFHandlerType::dimension>::vertex_indices())
if (scratch_data.mapping_collection[0].preserves_vertex_locations())
patch.vertices[vertex] = cell_and_index->first->vertex(vertex);
else
case 2:
{
- for (unsigned int vertex = 0;
- vertex < GeometryInfo<dimension>::vertices_per_cell;
- ++vertex)
+ for (const unsigned int vertex :
+ GeometryInfo<dimension>::vertex_indices())
{
const Point<dimension> v = (*cell)->vertex(vertex);
for (const auto &cell : triangulation->active_cell_iterators())
{
if (cell->is_ghost())
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
vertex_to_neighbor_subdomain[cell->vertex_index(v)].insert(
cell->subdomain_id());
}
if (!cell->is_ghost())
{
std::set<unsigned int> cell_to_neighbor_subdomain;
- for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell;
- ++v)
+ for (const unsigned int v : GeometryInfo<dim>::vertex_indices())
{
cell_to_neighbor_subdomain.insert(
vertex_to_neighbor_subdomain[cell->vertex_index(v)].begin(),