From 5a9e8cad2d4f6a6d3dc0ff19fde5ec466a65dd1b Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Mon, 6 May 2019 08:33:25 -0400 Subject: [PATCH] Modernize step-63 --- examples/step-63/step-63.cc | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/examples/step-63/step-63.cc b/examples/step-63/step-63.cc index ca64242194..00518581ca 100644 --- a/examples/step-63/step-63.cc +++ b/examples/step-63/step-63.cc @@ -156,7 +156,7 @@ namespace Step63 Patterns::Bool(), "Generate graphical output: true|false"); - if (prm_filename.size() == 0) + if (prm_filename.empty()) { prm.print_parameters(std::cout, ParameterHandler::Text); AssertThrow( @@ -197,9 +197,7 @@ namespace Step63 CompareDownstream::level_cell_iterator, dim> comparator(direction); - typename DoFHandler::level_cell_iterator cell = dof.begin(level); - typename DoFHandler::level_cell_iterator endc = dof.end(level); - for (; cell != endc; ++cell) + for (const auto &cell : dof.cell_iterators_on_level(level)) ordered_cells.push_back(cell); std::sort(ordered_cells.begin(), ordered_cells.end(), comparator); @@ -207,8 +205,8 @@ namespace Step63 std::vector ordered_indices; ordered_indices.reserve(dof.get_triangulation().n_cells(level)); - for (unsigned int i = 0; i < ordered_cells.size(); ++i) - ordered_indices.push_back(ordered_cells[i]->index()); + for (const auto &cell : ordered_cells) + ordered_indices.push_back(cell->index()); return ordered_indices; } @@ -224,9 +222,7 @@ namespace Step63 CompareDownstream::active_cell_iterator, dim> comparator(direction); - typename DoFHandler::active_cell_iterator cell = dof.begin_active(); - typename DoFHandler::active_cell_iterator endc = dof.end(); - for (; cell != endc; ++cell) + for (const auto &cell : dof.active_cell_iterators()) ordered_cells.push_back(cell); std::sort(ordered_cells.begin(), ordered_cells.end(), comparator); @@ -234,8 +230,8 @@ namespace Step63 std::vector ordered_indices; ordered_indices.reserve(dof.get_triangulation().n_active_cells()); - for (unsigned int i = 0; i < ordered_cells.size(); ++i) - ordered_indices.push_back(ordered_cells[i]->index()); + for (const auto &cell : ordered_cells) + ordered_indices.push_back(cell->index()); return ordered_indices; } @@ -252,9 +248,7 @@ namespace Step63 std::vector ordered_cells; ordered_cells.reserve(n_cells); - typename DoFHandler::cell_iterator cell = dof.begin(level); - typename DoFHandler::cell_iterator endc = dof.end(level); - for (; cell != endc; ++cell) + for (const auto &cell : dof.cell_iterators_on_level(level)) ordered_cells.push_back(cell->index()); // shuffle the elements @@ -282,9 +276,7 @@ namespace Step63 std::vector ordered_cells; ordered_cells.reserve(n_cells); - typename DoFHandler::active_cell_iterator cell = dof.begin_active(); - typename DoFHandler::active_cell_iterator endc = dof.end(); - for (; cell != endc; ++cell) + for (const auto &cell : dof.active_cell_iterators()) ordered_cells.push_back(cell->index()); // shuffle the elements @@ -322,12 +314,11 @@ namespace Step63 }; template - double RightHandSide::value(const Point & p, + double RightHandSide::value(const Point &, const unsigned int component) const { Assert(component == 0, ExcIndexRange(component, 0, 1)); (void)component; - (void)p; return 0.0; } -- 2.39.5