typename Triangulation<2, spacedim>::raw_line_iterator
&next_unused_line,
typename Triangulation<2, spacedim>::raw_cell_iterator
- & next_unused_cell,
- typename Triangulation<2, spacedim>::cell_iterator &cell)
+ &next_unused_cell,
+ const typename Triangulation<2, spacedim>::cell_iterator &cell)
{
const unsigned int dim = 2;
// clear refinement flag
// count number of flagged
// cells on this level
unsigned int flagged_cells = 0;
- typename Triangulation<dim, spacedim>::active_cell_iterator
- acell = triangulation.begin_active(level),
- aendc = triangulation.begin_active(level + 1);
- for (; acell != aendc; ++acell)
+
+ for (auto &acell :
+ triangulation.active_cell_iterators_on_level(level))
if (acell->refine_flag_set())
++flagged_cells;
for (int level = triangulation.levels.size() - 2; level >= 0; --level)
{
- typename Triangulation<dim, spacedim>::active_cell_iterator
- cell = triangulation.begin_active(level),
- endc = triangulation.begin_active(level + 1);
-
typename Triangulation<dim, spacedim>::raw_cell_iterator
next_unused_cell = triangulation.begin_raw(level + 1);
- for (; (cell != endc) && (cell->level() == level); ++cell)
+ for (auto &cell :
+ triangulation.active_cell_iterators_on_level(level))
if (cell->refine_flag_set())
{
// clear refinement flag
// how many new vertices and new lines will be needed
unsigned int needed_cells = 0;
- typename Triangulation<dim, spacedim>::active_cell_iterator
- cell = triangulation.begin_active(level),
- endc = triangulation.begin_active(level + 1);
- for (; cell != endc; ++cell)
+ for (auto &cell :
+ triangulation.active_cell_iterators_on_level(level))
if (cell->refine_flag_set())
{
if (cell->refine_flag_set() == RefinementCase<dim>::cut_xy)
level < static_cast<int>(triangulation.levels.size()) - 1;
++level)
{
- // Remember: as we don't operate on the finest level,
- // begin_*(level+1) is allowed
- typename Triangulation<dim, spacedim>::active_cell_iterator
- cell = triangulation.begin_active(level),
- endc = triangulation.begin_active(level + 1);
-
typename Triangulation<dim, spacedim>::raw_cell_iterator
next_unused_cell = triangulation.begin_raw(level + 1);
- for (; cell != endc; ++cell)
+ for (auto &cell :
+ triangulation.active_cell_iterators_on_level(level))
if (cell->refine_flag_set())
{
// set the user flag to indicate, that at least one
// how many new vertices and new lines will be needed
unsigned int new_cells = 0;
- typename Triangulation<dim, spacedim>::active_cell_iterator
- acell = triangulation.begin_active(level),
- aendc = triangulation.begin_active(level + 1);
- for (; acell != aendc; ++acell)
+ for (auto &acell :
+ triangulation.active_cell_iterators_on_level(level))
if (acell->refine_flag_set())
{
RefinementCase<dim> ref_case = acell->refine_flag_set();
ExcMessage(
"Error: set_all_manifold_ids() can not be called on an empty Triangulation."));
- typename Triangulation<dim, spacedim>::active_cell_iterator
- cell = this->begin_active(),
- endc = this->end();
-
- for (; cell != endc; ++cell)
+ for (auto &cell : this->active_cell_iterators())
cell->set_all_manifold_ids(m_number);
}
ExcMessage(
"Error: set_all_manifold_ids_on_boundary() can not be called on an empty Triangulation."));
- typename Triangulation<dim, spacedim>::active_cell_iterator
- cell = this->begin_active(),
- endc = this->end();
-
- for (; cell != endc; ++cell)
+ for (auto &cell : this->active_cell_iterators())
for (auto f : GeometryInfo<dim>::face_indices())
if (cell->face(f)->at_boundary())
cell->face(f)->set_all_manifold_ids(m_number);
"Error: set_all_manifold_ids_on_boundary() can not be called on an empty Triangulation."));
bool boundary_found = false;
- typename Triangulation<dim, spacedim>::active_cell_iterator
- cell = this->begin_active(),
- endc = this->end();
- for (; cell != endc; ++cell)
+ for (auto &cell : this->active_cell_iterators())
{
// loop on faces
for (auto f : GeometryInfo<dim>::face_indices())
{
Assert(n_cells() > 0,
ExcMessage("Error: An empty Triangulation can not be refined."));
- active_cell_iterator cell = begin_active(), endc = end();
- for (; cell != endc; ++cell)
+ for (auto &cell : this->active_cell_iterators())
{
cell->clear_coarsen_flag();
cell->set_refine_flag();
Triangulation<dim, spacedim>::save_refine_flags(std::vector<bool> &v) const
{
v.resize(dim * n_active_cells(), false);
- std::vector<bool>::iterator i = v.begin();
- active_cell_iterator cell = begin_active(), endc = end();
- for (; cell != endc; ++cell)
+ std::vector<bool>::iterator i = v.begin();
+
+ for (auto &cell : this->active_cell_iterators())
for (unsigned int j = 0; j < dim; ++j, ++i)
if (cell->refine_flag_set() & (1 << j))
*i = true;
{
AssertThrow(v.size() == dim * n_active_cells(), ExcGridReadError());
- active_cell_iterator cell = begin_active(), endc = end();
std::vector<bool>::const_iterator i = v.begin();
- for (; cell != endc; ++cell)
+ for (auto &cell : this->active_cell_iterators())
{
unsigned int ref_case = 0;
Triangulation<dim, spacedim>::save_coarsen_flags(std::vector<bool> &v) const
{
v.resize(n_active_cells(), false);
- std::vector<bool>::iterator i = v.begin();
- active_cell_iterator cell = begin_active(), endc = end();
- for (; cell != endc; ++cell, ++i)
- *i = cell->coarsen_flag_set();
+ std::vector<bool>::iterator i = v.begin();
+ for (auto &cell : this->active_cell_iterators())
+ {
+ *i = cell->coarsen_flag_set();
+ ++i;
+ }
Assert(i == v.end(), ExcInternalError());
}
{
Assert(v.size() == n_active_cells(), ExcGridReadError());
- active_cell_iterator cell = begin_active(), endc = end();
std::vector<bool>::const_iterator i = v.begin();
- for (; cell != endc; ++cell, ++i)
- if (*i == true)
- cell->set_coarsen_flag();
- else
- cell->clear_coarsen_flag();
+ for (auto &cell : this->active_cell_iterators())
+ {
+ if (*i == true)
+ cell->set_coarsen_flag();
+ else
+ cell->clear_coarsen_flag();
+ ++i;
+ }
Assert(i == v.end(), ExcInternalError());
}
// store highest level one of the cells adjacent to a vertex
// belongs to
std::fill(vertex_level.begin(), vertex_level.end(), 0);
- active_cell_iterator cell = begin_active(), endc = end();
- for (; cell != endc; ++cell)
+ for (auto &cell : this->active_cell_iterators())
{
if (cell->refine_flag_set())
for (const unsigned int vertex :
// refinement flags, but we will also have to remove
// coarsening flags on cells adjacent to vertices that will
// see refinement
+ active_cell_iterator cell = begin_active(), endc = end();
for (cell = last_active(); cell != endc; --cell)
if (cell->refine_flag_set() == false)
{
clear_user_flags();
// Coarsen flags of cells with no mother cell, i.e. on the
// coarsest level are deleted explicitly.
- active_cell_iterator acell = begin_active(0), end_ac = end_active(0);
- for (; acell != end_ac; ++acell)
+ for (auto &acell : this->active_cell_iterators_on_level(0))
acell->clear_coarsen_flag();
cell_iterator cell = begin(), endc = end();