From b73957c635eb21634bfea7ceaef95e18a8b073f8 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sat, 5 Feb 2022 15:48:43 -0700 Subject: [PATCH] Save a few cycles for single-character output. --- examples/step-16/step-16.cc | 2 +- examples/step-50/step-50.cc | 2 +- examples/step-71/step-71.cc | 4 +- examples/step-79/step-79.cc | 96 +++++++++---------- .../sd/symengine_number_visitor_internal.h | 8 +- .../differentiation/sd/symengine_optimizer.h | 29 +++--- .../differentiation/sd/symengine_utilities.h | 2 +- .../lac/affine_constraints.templates.h | 10 +- source/base/data_out_base.cc | 20 ++-- source/base/timer.cc | 13 ++- source/differentiation/ad/ad_drivers.cc | 44 ++++----- source/differentiation/ad/ad_helpers.cc | 19 ++-- source/grid/grid_out.cc | 27 ++---- source/numerics/point_value_history.cc | 46 +++++---- 14 files changed, 152 insertions(+), 170 deletions(-) diff --git a/examples/step-16/step-16.cc b/examples/step-16/step-16.cc index 5eb6cefb6d..cd58b79527 100644 --- a/examples/step-16/step-16.cc +++ b/examples/step-16/step-16.cc @@ -586,7 +586,7 @@ namespace Step16 solver.solve(system_matrix, solution, system_rhs, preconditioner); std::cout << " Number of CG iterations: " << solver_control.last_step() - << "\n" + << '\n' << std::endl; constraints.distribute(solution); } diff --git a/examples/step-50/step-50.cc b/examples/step-50/step-50.cc index 0ed27598bb..4138084754 100644 --- a/examples/step-50/step-50.cc +++ b/examples/step-50/step-50.cc @@ -327,7 +327,7 @@ bool Settings::try_parse(const std::string &prm_filename) { std::cout << "**** Error: No input file provided!\n" << "**** Error: Call this program as './step-50 input.prm\n" - << "\n" + << '\n' << "**** You may want to use one of the input files in this\n" << "**** directory, or use the following default values\n" << "**** to create an input file:\n"; diff --git a/examples/step-71/step-71.cc b/examples/step-71/step-71.cc index 5389f9e113..2dfa635e93 100644 --- a/examples/step-71/step-71.cc +++ b/examples/step-71/step-71.cc @@ -3911,8 +3911,8 @@ namespace Step71 const SymmetricTensor<2, dim> sigma = Physics::Transformations::Piola::push_forward( material_hand_calculated.get_S(), F); - stream << time.get_current_time() << ";" << h[2] << ";" << b[2] - << ";" << F[1][2] * 100.0 << ";" << sigma[1][2] << "\n"; + stream << time.get_current_time() << ';' << h[2] << ';' << b[2] + << ';' << F[1][2] * 100.0 << ';' << sigma[1][2] << '\n'; } } diff --git a/examples/step-79/step-79.cc b/examples/step-79/step-79.cc index e1dd2e4dc5..ec17414ef2 100644 --- a/examples/step-79/step-79.cc +++ b/examples/step-79/step-79.cc @@ -1971,49 +1971,49 @@ namespace SAND { /* Write one side at z = 0. */ stlfile << " facet normal " << 0.000000e+00 << " " - << 0.000000e+00 << " " << -1.000000e+00 << "\n"; + << 0.000000e+00 << " " << -1.000000e+00 << '\n'; stlfile << " outer loop\n"; stlfile << " vertex " << cell->vertex(0)[0] << " " - << cell->vertex(0)[1] << " " << 0.000000e+00 << "\n"; + << cell->vertex(0)[1] << " " << 0.000000e+00 << '\n'; stlfile << " vertex " << cell->vertex(2)[0] << " " - << cell->vertex(2)[1] << " " << 0.000000e+00 << "\n"; + << cell->vertex(2)[1] << " " << 0.000000e+00 << '\n'; stlfile << " vertex " << cell->vertex(1)[0] << " " - << cell->vertex(1)[1] << " " << 0.000000e+00 << "\n"; + << cell->vertex(1)[1] << " " << 0.000000e+00 << '\n'; stlfile << " endloop\n"; stlfile << " endfacet\n"; stlfile << " facet normal " << 0.000000e+00 << " " - << 0.000000e+00 << " " << -1.000000e+00 << "\n"; + << 0.000000e+00 << " " << -1.000000e+00 << '\n'; stlfile << " outer loop\n"; stlfile << " vertex " << cell->vertex(1)[0] << " " - << cell->vertex(1)[1] << " " << 0.000000e+00 << "\n"; + << cell->vertex(1)[1] << " " << 0.000000e+00 << '\n'; stlfile << " vertex " << cell->vertex(2)[0] << " " - << cell->vertex(2)[1] << " " << 0.000000e+00 << "\n"; + << cell->vertex(2)[1] << " " << 0.000000e+00 << '\n'; stlfile << " vertex " << cell->vertex(3)[0] << " " - << cell->vertex(3)[1] << " " << 0.000000e+00 << "\n"; + << cell->vertex(3)[1] << " " << 0.000000e+00 << '\n'; stlfile << " endloop\n"; stlfile << " endfacet\n"; /* Write one side at z = height. */ stlfile << " facet normal " << 0.000000e+00 << " " - << 0.000000e+00 << " " << 1.000000e+00 << "\n"; + << 0.000000e+00 << " " << 1.000000e+00 << '\n'; stlfile << " outer loop\n"; stlfile << " vertex " << cell->vertex(0)[0] << " " - << cell->vertex(0)[1] << " " << height << "\n"; + << cell->vertex(0)[1] << " " << height << '\n'; stlfile << " vertex " << cell->vertex(1)[0] << " " - << cell->vertex(1)[1] << " " << height << "\n"; + << cell->vertex(1)[1] << " " << height << '\n'; stlfile << " vertex " << cell->vertex(2)[0] << " " - << cell->vertex(2)[1] << " " << height << "\n"; + << cell->vertex(2)[1] << " " << height << '\n'; stlfile << " endloop\n"; stlfile << " endfacet\n"; stlfile << " facet normal " << 0.000000e+00 << " " - << 0.000000e+00 << " " << 1.000000e+00 << "\n"; + << 0.000000e+00 << " " << 1.000000e+00 << '\n'; stlfile << " outer loop\n"; stlfile << " vertex " << cell->vertex(1)[0] << " " - << cell->vertex(1)[1] << " " << height << "\n"; + << cell->vertex(1)[1] << " " << height << '\n'; stlfile << " vertex " << cell->vertex(3)[0] << " " - << cell->vertex(3)[1] << " " << height << "\n"; + << cell->vertex(3)[1] << " " << height << '\n'; stlfile << " vertex " << cell->vertex(2)[0] << " " - << cell->vertex(2)[1] << " " << height << "\n"; + << cell->vertex(2)[1] << " " << height << '\n'; stlfile << " endloop\n"; stlfile << " endfacet\n"; } @@ -2021,49 +2021,49 @@ namespace SAND { /* Write one side at z = 0. */ stlfile << " facet normal " << 0.000000e+00 << " " - << 0.000000e+00 << " " << -1.000000e+00 << "\n"; + << 0.000000e+00 << " " << -1.000000e+00 << '\n'; stlfile << " outer loop\n"; stlfile << " vertex " << cell->vertex(0)[0] << " " - << cell->vertex(0)[1] << " " << 0.000000e+00 << "\n"; + << cell->vertex(0)[1] << " " << 0.000000e+00 << '\n'; stlfile << " vertex " << cell->vertex(1)[0] << " " - << cell->vertex(1)[1] << " " << 0.000000e+00 << "\n"; + << cell->vertex(1)[1] << " " << 0.000000e+00 << '\n'; stlfile << " vertex " << cell->vertex(2)[0] << " " - << cell->vertex(2)[1] << " " << 0.000000e+00 << "\n"; + << cell->vertex(2)[1] << " " << 0.000000e+00 << '\n'; stlfile << " endloop\n"; stlfile << " endfacet\n"; stlfile << " facet normal " << 0.000000e+00 << " " - << 0.000000e+00 << " " << -1.000000e+00 << "\n"; + << 0.000000e+00 << " " << -1.000000e+00 << '\n'; stlfile << " outer loop\n"; stlfile << " vertex " << cell->vertex(1)[0] << " " - << cell->vertex(1)[1] << " " << 0.000000e+00 << "\n"; + << cell->vertex(1)[1] << " " << 0.000000e+00 << '\n'; stlfile << " vertex " << cell->vertex(3)[0] << " " - << cell->vertex(3)[1] << " " << 0.000000e+00 << "\n"; + << cell->vertex(3)[1] << " " << 0.000000e+00 << '\n'; stlfile << " vertex " << cell->vertex(2)[0] << " " - << cell->vertex(2)[1] << " " << 0.000000e+00 << "\n"; + << cell->vertex(2)[1] << " " << 0.000000e+00 << '\n'; stlfile << " endloop\n"; stlfile << " endfacet\n"; /* Write one side at z = height. */ stlfile << " facet normal " << 0.000000e+00 << " " - << 0.000000e+00 << " " << 1.000000e+00 << "\n"; + << 0.000000e+00 << " " << 1.000000e+00 << '\n'; stlfile << " outer loop\n"; stlfile << " vertex " << cell->vertex(0)[0] << " " - << cell->vertex(0)[1] << " " << height << "\n"; + << cell->vertex(0)[1] << " " << height << '\n'; stlfile << " vertex " << cell->vertex(2)[0] << " " - << cell->vertex(2)[1] << " " << height << "\n"; + << cell->vertex(2)[1] << " " << height << '\n'; stlfile << " vertex " << cell->vertex(1)[0] << " " - << cell->vertex(1)[1] << " " << height << "\n"; + << cell->vertex(1)[1] << " " << height << '\n'; stlfile << " endloop\n"; stlfile << " endfacet\n"; stlfile << " facet normal " << 0.000000e+00 << " " - << 0.000000e+00 << " " << 1.000000e+00 << "\n"; + << 0.000000e+00 << " " << 1.000000e+00 << '\n'; stlfile << " outer loop\n"; stlfile << " vertex " << cell->vertex(1)[0] << " " - << cell->vertex(1)[1] << " " << height << "\n"; + << cell->vertex(1)[1] << " " << height << '\n'; stlfile << " vertex " << cell->vertex(2)[0] << " " - << cell->vertex(2)[1] << " " << height << "\n"; + << cell->vertex(2)[1] << " " << height << '\n'; stlfile << " vertex " << cell->vertex(3)[0] << " " - << cell->vertex(3)[1] << " " << height << "\n"; + << cell->vertex(3)[1] << " " << height << '\n'; stlfile << " endloop\n"; stlfile << " endfacet\n"; } @@ -2110,33 +2110,33 @@ namespace SAND stlfile << " facet normal " << normal_vector[0] / normal_norm << " " << normal_vector[1] / normal_norm << " " - << 0.000000e+00 << "\n"; + << 0.000000e+00 << '\n'; stlfile << " outer loop\n"; stlfile << " vertex " << face->vertex(0)[0] << " " << face->vertex(0)[1] << " " - << 0.000000e+00 << "\n"; + << 0.000000e+00 << '\n'; stlfile << " vertex " << face->vertex(0)[0] << " " << face->vertex(0)[1] << " " << height - << "\n"; + << '\n'; stlfile << " vertex " << face->vertex(1)[0] << " " << face->vertex(1)[1] << " " - << 0.000000e+00 << "\n"; + << 0.000000e+00 << '\n'; stlfile << " endloop\n"; stlfile << " endfacet\n"; stlfile << " facet normal " << normal_vector[0] / normal_norm << " " << normal_vector[1] / normal_norm << " " - << 0.000000e+00 << "\n"; + << 0.000000e+00 << '\n'; stlfile << " outer loop\n"; stlfile << " vertex " << face->vertex(0)[0] << " " << face->vertex(0)[1] << " " << height - << "\n"; + << '\n'; stlfile << " vertex " << face->vertex(1)[0] << " " << face->vertex(1)[1] << " " << height - << "\n"; + << '\n'; stlfile << " vertex " << face->vertex(1)[0] << " " << face->vertex(1)[1] << " " - << 0.000000e+00 << "\n"; + << 0.000000e+00 << '\n'; stlfile << " endloop\n"; stlfile << " endfacet\n"; } @@ -2145,33 +2145,33 @@ namespace SAND stlfile << " facet normal " << normal_vector[0] / normal_norm << " " << normal_vector[1] / normal_norm << " " - << 0.000000e+00 << "\n"; + << 0.000000e+00 << '\n'; stlfile << " outer loop\n"; stlfile << " vertex " << face->vertex(0)[0] << " " << face->vertex(0)[1] << " " - << 0.000000e+00 << "\n"; + << 0.000000e+00 << '\n'; stlfile << " vertex " << face->vertex(1)[0] << " " << face->vertex(1)[1] << " " - << 0.000000e+00 << "\n"; + << 0.000000e+00 << '\n'; stlfile << " vertex " << face->vertex(0)[0] << " " << face->vertex(0)[1] << " " << height - << "\n"; + << '\n'; stlfile << " endloop\n"; stlfile << " endfacet\n"; stlfile << " facet normal " << normal_vector[0] / normal_norm << " " << normal_vector[1] / normal_norm << " " - << 0.000000e+00 << "\n"; + << 0.000000e+00 << '\n'; stlfile << " outer loop\n"; stlfile << " vertex " << face->vertex(0)[0] << " " << face->vertex(0)[1] << " " << height - << "\n"; + << '\n'; stlfile << " vertex " << face->vertex(1)[0] << " " << face->vertex(1)[1] << " " - << 0.000000e+00 << "\n"; + << 0.000000e+00 << '\n'; stlfile << " vertex " << face->vertex(1)[0] << " " << face->vertex(1)[1] << " " << height - << "\n"; + << '\n'; stlfile << " endloop\n"; stlfile << " endfacet\n"; } diff --git a/include/deal.II/differentiation/sd/symengine_number_visitor_internal.h b/include/deal.II/differentiation/sd/symengine_number_visitor_internal.h index 6aba78f50f..c60c9c82bf 100644 --- a/include/deal.II/differentiation/sd/symengine_number_visitor_internal.h +++ b/include/deal.II/differentiation/sd/symengine_number_visitor_internal.h @@ -746,12 +746,12 @@ namespace Differentiation const SymEngine::RCP &cse_expr = intermediate_symbols_exprs[i].second; stream << " " << i << ": " << cse_symbol << " = " << cse_expr - << "\n"; + << '\n'; } stream << " Final reduced expressions for dependent variables: \n"; for (unsigned i = 0; i < reduced_exprs.size(); ++i) - stream << " " << i << ": " << reduced_exprs[i] << "\n"; + stream << " " << i << ": " << reduced_exprs[i] << '\n'; stream << std::flush; } @@ -976,7 +976,7 @@ namespace Differentiation { stream << "Independent variables: \n"; for (unsigned i = 0; i < independent_symbols.size(); ++i) - stream << " " << i << ": " << independent_symbols[i] << "\n"; + stream << " " << i << ": " << independent_symbols[i] << '\n'; stream << std::flush; } @@ -994,7 +994,7 @@ namespace Differentiation { stream << "Dependent variables: \n"; for (unsigned i = 0; i < dependent_functions.size(); ++i) - stream << " " << i << dependent_functions[i] << "\n"; + stream << " " << i << dependent_functions[i] << '\n'; stream << std::flush; } diff --git a/include/deal.II/differentiation/sd/symengine_optimizer.h b/include/deal.II/differentiation/sd/symengine_optimizer.h index 559ca22520..fb6d190ce7 100644 --- a/include/deal.II/differentiation/sd/symengine_optimizer.h +++ b/include/deal.II/differentiation/sd/symengine_optimizer.h @@ -2162,38 +2162,36 @@ namespace Differentiation const bool /*print_cse*/) const { // Settings - stream << "Method? " << optimization_method() << "\n"; - stream << "Flags: " << optimization_flags() << "\n"; - stream << "Optimized? " << (optimized() ? "Yes" : "No") << "\n"; + stream << "Method? " << optimization_method() << '\n'; + stream << "Flags: " << optimization_flags() << '\n'; + stream << "Optimized? " << (optimized() ? "Yes" : "No") << '\n'; stream << "Values substituted? " << values_substituted() << "\n\n"; // Independent variables stream << "Symbols (" << n_independent_variables() - << " independent variables):" - << "\n"; + << " independent variables):" << '\n'; int cntr = 0; for (SD::types::substitution_map::const_iterator it = independent_variables_symbols.begin(); it != independent_variables_symbols.end(); ++it, ++cntr) { - stream << cntr << ": " << it->first << "\n"; + stream << cntr << ": " << it->first << '\n'; } - stream << "\n" << std::flush; + stream << '\n' << std::flush; // Dependent functions stream << "Functions (" << n_dependent_variables() - << " dependent variables):" - << "\n"; + << " dependent variables):" << '\n'; cntr = 0; for (typename SD::types::symbol_vector::const_iterator it = dependent_variables_functions.begin(); it != dependent_variables_functions.end(); ++it, ++cntr) { - stream << cntr << ": " << (*it) << "\n"; + stream << cntr << ": " << (*it) << '\n'; } - stream << "\n" << std::flush; + stream << '\n' << std::flush; // Common subexpression if (optimized() == true && use_symbolic_CSE() == true) @@ -2219,7 +2217,7 @@ namespace Differentiation print_dependent_functions, print_cse_reductions); - stream << "\n" << std::flush; + stream << '\n' << std::flush; } else if (optimization_method() == OptimizerType::lambda) { @@ -2261,8 +2259,7 @@ namespace Differentiation if (values_substituted()) { - stream << "Evaluated functions:" - << "\n"; + stream << "Evaluated functions:" << '\n'; stream << std::flush; cntr = 0; for (typename std::vector::const_iterator it = @@ -2270,9 +2267,9 @@ namespace Differentiation it != dependent_variables_output.end(); ++it, ++cntr) { - stream << cntr << ": " << (*it) << "\n"; + stream << cntr << ": " << (*it) << '\n'; } - stream << "\n" << std::flush; + stream << '\n' << std::flush; } } diff --git a/include/deal.II/differentiation/sd/symengine_utilities.h b/include/deal.II/differentiation/sd/symengine_utilities.h index 426ee96baa..f3407e24ad 100644 --- a/include/deal.II/differentiation/sd/symengine_utilities.h +++ b/include/deal.II/differentiation/sd/symengine_utilities.h @@ -146,7 +146,7 @@ namespace Differentiation const SD::types::substitution_map &symbol_value_map) { for (const auto &entry : symbol_value_map) - stream << entry.first << " = " << entry.second << "\n"; + stream << entry.first << " = " << entry.second << '\n'; stream << std::flush; return stream; diff --git a/include/deal.II/lac/affine_constraints.templates.h b/include/deal.II/lac/affine_constraints.templates.h index b268155e90..fdcadc83c9 100644 --- a/include/deal.II/lac/affine_constraints.templates.h +++ b/include/deal.II/lac/affine_constraints.templates.h @@ -1242,11 +1242,11 @@ AffineConstraints::print(std::ostream &out) const { for (const std::pair &entry : line.entries) out << " " << line.index << " " << entry.first << ": " - << entry.second << "\n"; + << entry.second << '\n'; // print out inhomogeneity. if (line.inhomogeneity != number(0.)) - out << " " << line.index << ": " << line.inhomogeneity << "\n"; + out << " " << line.index << ": " << line.inhomogeneity << '\n'; } else // but also output something if the constraint simply reads @@ -1254,7 +1254,7 @@ AffineConstraints::print(std::ostream &out) const // combination of other dofs { if (line.inhomogeneity != number(0.)) - out << " " << line.index << " = " << line.inhomogeneity << "\n"; + out << " " << line.index << " = " << line.inhomogeneity << '\n'; else out << " " << line.index << " = 0\n"; } @@ -1276,9 +1276,9 @@ AffineConstraints::write_dot(std::ostream &out) const if (lines[i].entries.size() > 0) for (size_type j = 0; j < lines[i].entries.size(); ++j) out << " " << lines[i].index << "->" << lines[i].entries[j].first - << "; // weight: " << lines[i].entries[j].second << "\n"; + << "; // weight: " << lines[i].entries[j].second << '\n'; else - out << " " << lines[i].index << "\n"; + out << " " << lines[i].index << '\n'; } out << "}" << std::endl; } diff --git a/source/base/data_out_base.cc b/source/base/data_out_base.cc index eec9f23856..41d587b837 100644 --- a/source/base/data_out_base.cc +++ b/source/base/data_out_base.cc @@ -3351,8 +3351,8 @@ namespace DataOutBase { out << "# This file was generated by the deal.II library." << '\n' - << "# Date = " << Utilities::System::get_date() << "\n" - << "# Time = " << Utilities::System::get_time() << "\n" + << "# Date = " << Utilities::System::get_date() << '\n' + << "# Time = " << Utilities::System::get_time() << '\n' << "#" << '\n' << "# For a description of the UCD format see the AVS Developer's guide." << '\n' @@ -5531,15 +5531,15 @@ namespace DataOutBase (flags.time != std::numeric_limits::min() ? 1 : 0)); if (n_metadata > 0) { - out << "FIELD FieldData " << n_metadata << "\n"; + out << "FIELD FieldData " << n_metadata << '\n'; if (flags.cycle != std::numeric_limits::min()) { - out << "CYCLE 1 1 int\n" << flags.cycle << "\n"; + out << "CYCLE 1 1 int\n" << flags.cycle << '\n'; } if (flags.time != std::numeric_limits::min()) { - out << "TIME 1 1 double\n" << flags.time << "\n"; + out << "TIME 1 1 double\n" << flags.time << '\n'; } } } @@ -6010,7 +6010,7 @@ namespace DataOutBase } vtu_out << offsets; - out << "\n"; + out << '\n'; out << " \n"; // next output the types of the cells. since all cells are the same, this is @@ -6020,7 +6020,7 @@ namespace DataOutBase // this should compress well :-) vtu_out << cell_types; - out << "\n"; + out << '\n'; out << " \n"; out << " \n"; @@ -6186,7 +6186,7 @@ namespace DataOutBase } // loop over nodes vtu_out << data; - out << "\n"; + out << '\n'; out << " \n"; } // loop over ranges @@ -6209,7 +6209,7 @@ namespace DataOutBase std::vector data(data_vectors[data_set].begin(), data_vectors[data_set].end()); vtu_out << data; - out << "\n"; + out << '\n'; out << " \n"; } @@ -9283,7 +9283,7 @@ XDMFEntry::get_xdmf_content(const unsigned int indent_level, << " " << (attribute_dim.second > 1 ? 3 : 1) << "\" NumberType=\"Float\" Precision=\"8\" Format=\"HDF\">\n"; ss << indent(indent_level + 3) << h5_sol_filename << ":/" - << attribute_dim.first << "\n"; + << attribute_dim.first << '\n'; ss << indent(indent_level + 2) << "\n"; ss << indent(indent_level + 1) << "\n"; } diff --git a/source/base/timer.cc b/source/base/timer.cc index c8524fdb4f..ee6f00dda0 100644 --- a/source/base/timer.cc +++ b/source/base/timer.cc @@ -732,8 +732,7 @@ TimerOutput::print_summary() const out_stream << "\n\n+---------------------------------------------" << extra_dash << "+" << "------------+------------+" - << "------------+------------+" - << "\n" + << "------------+------------+" << '\n' << "| Total CPU/wall time elapsed since start " << extra_space << "|" << std::setw(10) << std::setprecision(3) << std::right << total_cpu_time << "s | |" @@ -958,13 +957,13 @@ TimerOutput::print_wall_time_statistics(const MPI_Comm &mpi_comm, const std::string time_rank_space = " |"; // now generate a nice table - out_stream << "\n" + out_stream << '\n' << "+------------------------------" << extra_dash << "+" << time_rank_column << (n_ranks > 1 && quantile > 0. ? time_rank_column : "") << "------------+" << (n_ranks > 1 && quantile > 0. ? time_rank_column : "") - << time_rank_column << "\n" + << time_rank_column << '\n' << "| Total wallclock time elapsed " << extra_space << "|"; print_statistics(timer_all.wall_time()); @@ -974,7 +973,7 @@ TimerOutput::print_wall_time_statistics(const MPI_Comm &mpi_comm, << (n_ranks > 1 && quantile > 0. ? time_rank_space : "") << " " << (n_ranks > 1 && quantile > 0. ? time_rank_space : "") - << time_rank_space << "\n"; + << time_rank_space << '\n'; out_stream << "| Section " << extra_space << "| no. calls " << "| min time rank |"; if (n_ranks > 1 && quantile > 0.) @@ -990,7 +989,7 @@ TimerOutput::print_wall_time_statistics(const MPI_Comm &mpi_comm, << (n_ranks > 1 && quantile > 0. ? time_rank_column : "") << "------------+" << (n_ranks > 1 && quantile > 0. ? time_rank_column : "") - << time_rank_column << "\n"; + << time_rank_column << '\n'; for (const auto &i : sections) { std::string name_out = i.first; @@ -1011,7 +1010,7 @@ TimerOutput::print_wall_time_statistics(const MPI_Comm &mpi_comm, << (n_ranks > 1 && quantile > 0. ? time_rank_column : "") << "------------+" << (n_ranks > 1 && quantile > 0. ? time_rank_column : "") - << time_rank_column << "\n"; + << time_rank_column << '\n'; } } diff --git a/source/differentiation/ad/ad_drivers.cc b/source/differentiation/ad/ad_drivers.cc index fa0806fc56..867006da11 100644 --- a/source/differentiation/ad/ad_drivers.cc +++ b/source/differentiation/ad/ad_drivers.cc @@ -620,11 +620,11 @@ namespace Differentiation stream << tape_index << "->" << status_tape << (i < (registered_tape_indices.size() - 1) ? "," : ""); } - stream << "\n"; + stream << '\n'; - stream << "Keep values? " << keep_independent_values() << "\n"; + stream << "Keep values? " << keep_independent_values() << '\n'; stream << "Use stored tape buffer sizes? " - << use_stored_taped_buffer_sizes << "\n"; + << use_stored_taped_buffer_sizes << '\n'; } @@ -645,28 +645,28 @@ namespace Differentiation ::tapestats(tape_index, counts.data()); Assert(counts.size() >= 18, ExcInternalError()); stream - << "Tape index: " << tape_index << "\n" - << "Number of independent variables: " << counts[0] << "\n" - << "Number of dependent variables: " << counts[1] << "\n" - << "Max number of live, active variables: " << counts[2] << "\n" - << "Size of taylor stack (number of overwrites): " << counts[3] << "\n" - << "Operations buffer size: " << counts[4] << "\n" - << "Total number of recorded operations: " << counts[5] << "\n" - << "Operations file written or not: " << counts[6] << "\n" - << "Overall number of locations: " << counts[7] << "\n" - << "Locations file written or not: " << counts[8] << "\n" - << "Overall number of values: " << counts[9] << "\n" - << "Values file written or not: " << counts[10] << "\n" - << "Locations buffer size: " << counts[11] << "\n" - << "Values buffer size: " << counts[12] << "\n" - << "Taylor buffer size: " << counts[13] << "\n" - << "Number of eq_*_prod for sparsity pattern: " << counts[14] << "\n" + << "Tape index: " << tape_index << '\n' + << "Number of independent variables: " << counts[0] << '\n' + << "Number of dependent variables: " << counts[1] << '\n' + << "Max number of live, active variables: " << counts[2] << '\n' + << "Size of taylor stack (number of overwrites): " << counts[3] << '\n' + << "Operations buffer size: " << counts[4] << '\n' + << "Total number of recorded operations: " << counts[5] << '\n' + << "Operations file written or not: " << counts[6] << '\n' + << "Overall number of locations: " << counts[7] << '\n' + << "Locations file written or not: " << counts[8] << '\n' + << "Overall number of values: " << counts[9] << '\n' + << "Values file written or not: " << counts[10] << '\n' + << "Locations buffer size: " << counts[11] << '\n' + << "Values buffer size: " << counts[12] << '\n' + << "Taylor buffer size: " << counts[13] << '\n' + << "Number of eq_*_prod for sparsity pattern: " << counts[14] << '\n' << "Use of 'min_op', deferred to 'abs_op' for piecewise calculations: " - << counts[15] << "\n" + << counts[15] << '\n' << "Number of 'abs' calls that can switch branch: " << counts[16] - << "\n" + << '\n' << "Number of parameters (doubles) interchangeable without retaping: " - << counts[17] << "\n" + << counts[17] << '\n' << std::flush; } diff --git a/source/differentiation/ad/ad_helpers.cc b/source/differentiation/ad/ad_helpers.cc index 3494a45893..faab8bd8b0 100644 --- a/source/differentiation/ad/ad_helpers.cc +++ b/source/differentiation/ad/ad_helpers.cc @@ -313,41 +313,36 @@ namespace Differentiation // Set stream to print booleans as "true"/"false" stream.setf(std::ios_base::boolalpha); - stream << "Active tape index: " << active_tape_index() << "\n"; - stream << "Recording? " << is_recording() << "\n"; + stream << "Active tape index: " << active_tape_index() << '\n'; + stream << "Recording? " << is_recording() << '\n'; stream << std::flush; if (AD::is_taped_ad_number::value) taped_driver.print(stream); - stream << "Registered independent variables: " - << "\n"; + stream << "Registered independent variables: " << '\n'; for (unsigned int i = 0; i < n_independent_variables(); ++i) stream << registered_independent_variable_values[i] << (i < (n_independent_variables() - 1) ? "," : ""); stream << std::endl; - stream << "Independent variable values: " - << "\n"; + stream << "Independent variable values: " << '\n'; print_values(stream); - stream << "Registered marked independent variables: " - << "\n"; + stream << "Registered marked independent variables: " << '\n'; for (unsigned int i = 0; i < n_independent_variables(); ++i) stream << registered_marked_independent_variables[i] << (i < (n_independent_variables() - 1) ? "," : "") << std::flush; stream << std::endl; - stream << "Dependent variable values: " - << "\n"; + stream << "Dependent variable values: " << '\n'; for (unsigned int i = 0; i < n_dependent_variables(); ++i) stream << dependent_variables[i] << (i < (n_dependent_variables() - 1) ? "," : ""); stream << std::endl; - stream << "Registered dependent variables: " - << "\n"; + stream << "Registered dependent variables: " << '\n'; for (unsigned int i = 0; i < n_dependent_variables(); ++i) stream << registered_marked_dependent_variables[i] << (i < (n_dependent_variables() - 1) ? "," : ""); diff --git a/source/grid/grid_out.cc b/source/grid/grid_out.cc index 1d1c84b7bf..ef9bcfff6a 100644 --- a/source/grid/grid_out.cc +++ b/source/grid/grid_out.cc @@ -3003,8 +3003,7 @@ GridOut::write_mathgl(const Triangulation &tria, << "\n#" << "\n# Note: This file is understood by MathGL v2.1 and higher only, and can " << "\n# be quickly viewed in a graphical environment using \'mglview\'. " - << "\n#" - << "\n"; + << "\n#" << '\n'; } // define a helper to keep loops approximately dim-independent @@ -3014,8 +3013,7 @@ GridOut::write_mathgl(const Triangulation &tria, // (ii) write preamble and graphing tweaks out << "\n#" << "\n# Preamble." - << "\n#" - << "\n"; + << "\n#" << '\n'; if (mathgl_flags.draw_bounding_box) out << "\nbox"; @@ -3035,14 +3033,13 @@ GridOut::write_mathgl(const Triangulation &tria, default: Assert(false, ExcNotImplemented()); } - out << "\n"; + out << '\n'; // (iii) write vertex ordering out << "\n#" << "\n# Vertex ordering." << "\n# list " - << "\n#" - << "\n"; + << "\n#" << '\n'; // todo: This denotes the natural ordering of vertices, but it needs // to check this is really always true for a given grid (it's not @@ -3050,13 +3047,12 @@ GridOut::write_mathgl(const Triangulation &tria, switch (dim) { case 2: - out << "\nlist f 0 1 2 3" - << "\n"; + out << "\nlist f 0 1 2 3" << '\n'; break; case 3: out << "\nlist f 0 2 4 6 | 1 3 5 7 | 0 4 1 5 | 2 6 3 7 | 0 1 2 3 | 4 5 6 7" - << "\n"; + << '\n'; break; default: Assert(false, ExcNotImplemented()); @@ -3066,8 +3062,7 @@ GridOut::write_mathgl(const Triangulation &tria, out << "\n#" << "\n# List of vertices." << "\n# list " - << "\n#" - << "\n"; + << "\n#" << '\n'; // run over all active cells and write out a list of // xyz-coordinates that correspond to vertices @@ -3092,8 +3087,7 @@ GridOut::write_mathgl(const Triangulation &tria, out << "\n#" << "\n# List of cells to quadplot." << "\n# quadplot