criterion by which we decide which cells to refine. An example would
be to change the condition to this:
@code
- for (auto cell: triangulation.active_cell_iterators())
+ for (auto & cell: triangulation.active_cell_iterators())
if (cell->center()[1] > 0)
cell->set_refine_flag ();
@endcode
// <a href="http://en.cppreference.com/w/cpp/language/range-for">range-
// based for loops</a>, which wrap up all of the syntax shown above into a
// much shorter form:
- for (auto cell : triangulation.active_cell_iterators())
+ for (auto &cell : triangulation.active_cell_iterators())
{
// @note See @ref Iterators for more information about the iterator
// classes used in deal.II, and @ref CPP11 for more information about
{
const double inner_radius = 0.8, outer_radius = 1;
GridGenerator::cylinder_shell(triangulation, 3, inner_radius, outer_radius);
- for (auto cell : triangulation.active_cell_iterators())
+ for (auto &cell : triangulation.active_cell_iterators())
for (unsigned int f = 0; f < GeometryInfo<dim>::faces_per_cell; ++f)
if (cell->face(f)->at_boundary())
{
Vector<double> norm_of_stress(triangulation.n_active_cells());
{
// Loop over all the cells...
- for (auto cell : triangulation.active_cell_iterators())
+ for (auto &cell : triangulation.active_cell_iterators())
if (cell->is_locally_owned())
{
// On these cells, add up the stresses over all quadrature
pcout << " Moving mesh..." << std::endl;
std::vector<bool> vertex_touched(triangulation.n_vertices(), false);
- for (auto cell : dof_handler.active_cell_iterators())
+ for (auto &cell : dof_handler.active_cell_iterators())
for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
if (vertex_touched[cell->vertex_index(v)] == false)
{
// quadrature point objects corresponding to this cell in the vector of
// such objects:
unsigned int history_index = 0;
- for (auto cell : triangulation.active_cell_iterators())
+ for (auto &cell : triangulation.active_cell_iterators())
if (cell->is_locally_owned())
{
cell->set_user_pointer(&quadrature_point_history[history_index]);
// Then loop over all cells and do the job in the cells that belong to our
// subdomain:
- for (auto cell : dof_handler.active_cell_iterators())
+ for (auto &cell : dof_handler.active_cell_iterators())
if (cell->is_locally_owned())
{
// Next, get a pointer to the quadrature point history data local to
for (unsigned int step = 0; step < 3; ++step)
{
- for (auto cell : triangulation.active_cell_iterators())
+ for (auto &cell : triangulation.active_cell_iterators())
for (unsigned int v = 0; v < GeometryInfo<2>::vertices_per_cell; ++v)
{
const double distance_from_center =
create_3d_grid(triangulation);
triangulation.set_manifold(cylinder_id, cylinder);
-for (auto cell : triangulation.active_cell_iterators())
+for (auto & cell : triangulation.active_cell_iterators())
if (cell->center()[1] >= 3.0)
cell->set_all_manifold_ids(cylinder_id);
create_3d_grid(triangulation);
triangulation.set_manifold(cylinder_id, cylinder);
-for (auto cell : triangulation.active_cell_iterators())
+for (auto & cell : triangulation.active_cell_iterators())
if (cell->center()[1] >= 3.0)
cell->set_all_manifold_ids(cylinder_id);
-for (auto cell : triangulation.active_cell_iterators())
+for (auto & cell : triangulation.active_cell_iterators())
for (unsigned int face_n = 0; face_n < GeometryInfo<3>::faces_per_cell;
++face_n)
{
// we then increment it):
{
std::map<types::boundary_id, unsigned int> boundary_count;
- for (auto cell : triangulation.active_cell_iterators())
+ for (auto &cell : triangulation.active_cell_iterators())
{
for (unsigned int face = 0; face < GeometryInfo<dim>::faces_per_cell;
++face)
GridTools::compute_point_locations(*space_grid_tools_cache,
support_points);
const auto &cells = std::get<0>(point_locations);
- for (auto cell : cells)
+ for (auto &cell : cells)
{
cell->set_refine_flag();
for (unsigned int face_no = 0;
dim, Vector<double>(triangulation.n_active_cells()));
Vector<double> rho(triangulation.n_active_cells());
- for (auto cell : triangulation.active_cell_iterators())
+ for (auto &cell : triangulation.active_cell_iterators())
{
if (cell->is_locally_owned())
{