From f94ac20bcd0d3ef71f91fd9b0986cf1ea7c64d59 Mon Sep 17 00:00:00 2001 From: David Wells Date: Mon, 20 Jan 2020 10:16:31 -0500 Subject: [PATCH] Utilities::to_string -> std::to_string None of these use the second arguments for padding so we might as well use the standard library function. --- examples/step-10/step-10.cc | 6 +++--- include/deal.II/lac/block_indices.h | 4 ++-- include/deal.II/lac/read_write_vector.templates.h | 8 ++++---- include/deal.II/lac/sparse_matrix.templates.h | 2 +- include/deal.II/matrix_free/fe_evaluation.h | 9 ++++----- .../deal.II/numerics/data_out_dof_data.templates.h | 2 +- source/base/index_set.cc | 8 ++++---- source/differentiation/ad/ad_drivers.cc | 7 +++---- .../sd/symengine_tensor_operations.cc | 2 +- source/dofs/dof_renumbering.cc | 2 +- source/grid/grid_reordering.cc | 13 ++++++------- source/grid/manifold_lib.cc | 2 +- source/lac/petsc_parallel_sparse_matrix.cc | 8 ++++---- source/lac/petsc_precondition.cc | 4 ++-- source/particles/particle.cc | 4 ++-- 15 files changed, 39 insertions(+), 42 deletions(-) diff --git a/examples/step-10/step-10.cc b/examples/step-10/step-10.cc index 4ee00fdebd..deaa2f5e57 100644 --- a/examples/step-10/step-10.cc +++ b/examples/step-10/step-10.cc @@ -94,7 +94,7 @@ namespace Step10 { std::cout << "Refinement level: " << refinement << std::endl; - std::string filename_base = "ball_" + Utilities::to_string(refinement); + std::string filename_base = "ball_" + std::to_string(refinement); for (unsigned int degree = 1; degree < 4; ++degree) { @@ -134,8 +134,8 @@ namespace Step10 grid_out.set_flags(gnuplot_flags); // Finally, generate a filename and a file for output: - std::string filename = filename_base + "_mapping_q_" + - Utilities::to_string(degree) + ".dat"; + std::string filename = + filename_base + "_mapping_q_" + std::to_string(degree) + ".dat"; std::ofstream gnuplot_file(filename); // Then write out the triangulation to this file. The last diff --git a/include/deal.II/lac/block_indices.h b/include/deal.II/lac/block_indices.h index 19119ad6d9..8da555b658 100644 --- a/include/deal.II/lac/block_indices.h +++ b/include/deal.II/lac/block_indices.h @@ -387,9 +387,9 @@ BlockIndices::to_string() const { if (i > 0) result += ','; - result += Utilities::to_string(block_size(i)); + result += std::to_string(block_size(i)); } - result += "|" + Utilities::to_string(total_size()) + ']'; + result += "|" + std::to_string(total_size()) + ']'; return result; } diff --git a/include/deal.II/lac/read_write_vector.templates.h b/include/deal.II/lac/read_write_vector.templates.h index ba1c5f298b..2be7fad2be 100644 --- a/include/deal.II/lac/read_write_vector.templates.h +++ b/include/deal.II/lac/read_write_vector.templates.h @@ -679,7 +679,7 @@ namespace LinearAlgebra const int err = target_vector.Import(multivector, import, Insert); AssertThrow(err == 0, ExcMessage("Epetra Import() failed with error code: " + - Utilities::to_string(err))); + std::to_string(err))); const double *new_values = target_vector.Values(); const int size = target_vector.MyLength(); @@ -694,7 +694,7 @@ namespace LinearAlgebra const int err = target_vector.Import(multivector, import, Add); AssertThrow(err == 0, ExcMessage("Epetra Import() failed with error code: " + - Utilities::to_string(err))); + std::to_string(err))); const double *new_values = target_vector.Values(); const int size = target_vector.MyLength(); @@ -709,7 +709,7 @@ namespace LinearAlgebra const int err = target_vector.Import(multivector, import, Add); AssertThrow(err == 0, ExcMessage("Epetra Import() failed with error code: " + - Utilities::to_string(err))); + std::to_string(err))); const double *new_values = target_vector.Values(); const int size = target_vector.MyLength(); @@ -739,7 +739,7 @@ namespace LinearAlgebra const int err = target_vector.Import(multivector, import, Add); AssertThrow(err == 0, ExcMessage("Epetra Import() failed with error code: " + - Utilities::to_string(err))); + std::to_string(err))); const double *new_values = target_vector.Values(); const int size = target_vector.MyLength(); diff --git a/include/deal.II/lac/sparse_matrix.templates.h b/include/deal.II/lac/sparse_matrix.templates.h index bac9bbafcf..1e81b55c16 100644 --- a/include/deal.II/lac/sparse_matrix.templates.h +++ b/include/deal.II/lac/sparse_matrix.templates.h @@ -1374,7 +1374,7 @@ namespace internal ExcMessage( "There is a zero on the diagonal of this matrix " "in row " + - Utilities::to_string(row) + + std::to_string(row) + ". The preconditioner you selected cannot work if that " "is the case because one of its steps requires " "division by the diagonal elements of the matrix." diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index 0d13715c5d..e053184092 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -3070,20 +3070,19 @@ inline FEEvaluationBasestart_components [dof_info->component_to_base_index[first_selected_component] + 1] - first_selected_component) + " components left when starting from local element index " + - Utilities::to_string( + std::to_string( first_selected_component - dof_info->start_components [dof_info->component_to_base_index[first_selected_component]]) + - " (global index " + Utilities::to_string(first_selected_component) + - ")")); + " (global index " + std::to_string(first_selected_component) + ")")); // do not check for correct dimensions of data fields here, should be done // in derived classes diff --git a/include/deal.II/numerics/data_out_dof_data.templates.h b/include/deal.II/numerics/data_out_dof_data.templates.h index 3ac1a14d40..e120beba6a 100644 --- a/include/deal.II/numerics/data_out_dof_data.templates.h +++ b/include/deal.II/numerics/data_out_dof_data.templates.h @@ -1149,7 +1149,7 @@ DataOut_DoFData:: { for (unsigned int i = 0; i < n_components; ++i) { - deduced_names[i] = name + '_' + Utilities::to_string(i); + deduced_names[i] = name + '_' + std::to_string(i); } } else diff --git a/source/base/index_set.cc b/source/base/index_set.cc index 7fb3b4c68e..6f986b956f 100644 --- a/source/base/index_set.cc +++ b/source/base/index_set.cc @@ -523,10 +523,10 @@ IndexSet::make_tpetra_map(const MPI_Comm &communicator, "contain all indices exactly once: the sum of " "the number of entries the various processors " "want to store locally is " + - Utilities::to_string(n_global_elements) + + std::to_string(n_global_elements) + " whereas the total size of the object to be " "allocated is " + - Utilities::to_string(size()) + + std::to_string(size()) + ". In other words, there are " "either indices that are not spoken for " "by any processor, or there are indices that are " @@ -592,10 +592,10 @@ IndexSet::make_trilinos_map(const MPI_Comm &communicator, "contain all indices exactly once: the sum of " "the number of entries the various processors " "want to store locally is " + - Utilities::to_string(n_global_elements) + + std::to_string(n_global_elements) + " whereas the total size of the object to be " "allocated is " + - Utilities::to_string(size()) + + std::to_string(size()) + ". In other words, there are " "either indices that are not spoken for " "by any processor, or there are indices that are " diff --git a/source/differentiation/ad/ad_drivers.cc b/source/differentiation/ad/ad_drivers.cc index af6a49f008..fe3e85e4e0 100644 --- a/source/differentiation/ad/ad_drivers.cc +++ b/source/differentiation/ad/ad_drivers.cc @@ -1674,15 +1674,14 @@ namespace Differentiation AssertThrow( n_live_variables == 0, ExcMessage( - "There are currently " + - Utilities::to_string(n_live_variables) + + "There are currently " + std::to_string(n_live_variables) + " live " "adtl::adouble variables in existence. They currently " "assume " + - Utilities::to_string(n_set_directional_derivatives) + + std::to_string(n_set_directional_derivatives) + " directional derivatives " "but you wish to increase this to " + - Utilities::to_string(n_directional_derivatives) + + std::to_string(n_directional_derivatives) + ". \n" "To safely change (or more specifically in this case, " "increase) the number of directional derivatives, there " diff --git a/source/differentiation/sd/symengine_tensor_operations.cc b/source/differentiation/sd/symengine_tensor_operations.cc index ced2db7940..0cfce17dcd 100644 --- a/source/differentiation/sd/symengine_tensor_operations.cc +++ b/source/differentiation/sd/symengine_tensor_operations.cc @@ -46,7 +46,7 @@ namespace Differentiation { std::string out; for (unsigned int i = 0; i < rank; ++i) - out += dealii::Utilities::to_string(indices[i]); + out += std::to_string(indices[i]); return out; } diff --git a/source/dofs/dof_renumbering.cc b/source/dofs/dof_renumbering.cc index ae93c7decf..579d6e89fc 100644 --- a/source/dofs/dof_renumbering.cc +++ b/source/dofs/dof_renumbering.cc @@ -456,7 +456,7 @@ namespace DoFRenumbering locally_active_dofs.is_element(starting_index), ExcMessage( "You specified global degree of freedom " + - Utilities::to_string(starting_index) + + std::to_string(starting_index) + " as a starting index, but this index is not among the " "locally active ones on this processor, as required " "for this function.")); diff --git a/source/grid/grid_reordering.cc b/source/grid/grid_reordering.cc index dfff9db7a4..05106492d1 100644 --- a/source/grid/grid_reordering.cc +++ b/source/grid/grid_reordering.cc @@ -1183,10 +1183,10 @@ GridReordering<2>::invert_all_cells_of_negative_grid( // might work also on single cells, grids // with both kind of cells are very likely to // be broken. Check for this here. - AssertThrow(n_negative_cells == 0 || n_negative_cells == cells.size(), - ExcMessage( - std::string( - "This class assumes that either all cells have positive " + AssertThrow( + n_negative_cells == 0 || n_negative_cells == cells.size(), + ExcMessage( + std::string("This class assumes that either all cells have positive " "volume, or that all cells have been specified in an " "inverted vertex order so that their volume is negative. " "(In the latter case, this class automatically inverts " @@ -1195,9 +1195,8 @@ GridReordering<2>::invert_all_cells_of_negative_grid( "negative volume. You need to check your mesh which " "cells these are and how they got there.\n" "As a hint, of the total ") + - Utilities::to_string(cells.size()) + " cells in the mesh, " + - Utilities::to_string(n_negative_cells) + - " appear to have a negative volume.")); + std::to_string(cells.size()) + " cells in the mesh, " + + std::to_string(n_negative_cells) + " appear to have a negative volume.")); } diff --git a/source/grid/manifold_lib.cc b/source/grid/manifold_lib.cc index fd5562b2cb..9b190eab23 100644 --- a/source/grid/manifold_lib.cc +++ b/source/grid/manifold_lib.cc @@ -2172,7 +2172,7 @@ TransfiniteInterpolationManifold:: Assert(triangulation != nullptr, ExcNotInitialized()); Assert(triangulation->begin_active()->level() >= level_coarse, ExcMessage("The manifold was initialized with level " + - Utilities::to_string(level_coarse) + " but there are now" + + std::to_string(level_coarse) + " but there are now" + "active cells on a lower level. Coarsening the mesh is " + "currently not supported")); diff --git a/source/lac/petsc_parallel_sparse_matrix.cc b/source/lac/petsc_parallel_sparse_matrix.cc index 625f5297e3..22c7dd1bae 100644 --- a/source/lac/petsc_parallel_sparse_matrix.cc +++ b/source/lac/petsc_parallel_sparse_matrix.cc @@ -376,17 +376,17 @@ namespace PETScWrappers ExcMessage( std::string( "Each row has to be owned by exactly one owner (n_rows()=") + - Utilities::to_string(sparsity_pattern.n_rows()) + + std::to_string(sparsity_pattern.n_rows()) + " but sum(local_rows.n_elements())=" + - Utilities::to_string(row_owners) + ")")); + std::to_string(row_owners) + ")")); Assert( col_owners == sparsity_pattern.n_cols(), ExcMessage( std::string( "Each column has to be owned by exactly one owner (n_cols()=") + - Utilities::to_string(sparsity_pattern.n_cols()) + + std::to_string(sparsity_pattern.n_cols()) + " but sum(local_columns.n_elements())=" + - Utilities::to_string(col_owners) + ")")); + std::to_string(col_owners) + ")")); } # endif diff --git a/source/lac/petsc_precondition.cc b/source/lac/petsc_precondition.cc index ed961323d1..d29c011385 100644 --- a/source/lac/petsc_precondition.cc +++ b/source/lac/petsc_precondition.cc @@ -482,7 +482,7 @@ namespace PETScWrappers } set_option_value("-pc_hypre_boomeramg_agg_nl", - Utilities::to_string( + std::to_string( additional_data.aggressive_coarsening_num_levels)); std::stringstream ssStream; @@ -630,7 +630,7 @@ namespace PETScWrappers set_option_value("-pc_hypre_parasails_sym", ssStream.str()); set_option_value("-pc_hypre_parasails_nlevels", - Utilities::to_string(additional_data.n_levels)); + std::to_string(additional_data.n_levels)); ssStream.str(""); // empty the stringstream ssStream << additional_data.threshold; diff --git a/source/particles/particle.cc b/source/particles/particle.cc index d421719f9f..7045add9bf 100644 --- a/source/particles/particle.cc +++ b/source/particles/particle.cc @@ -309,9 +309,9 @@ namespace Particles std::string( "You are trying to assign properties with an incompatible length. ") + "The particle has space to store " + - Utilities::to_string(old_properties.size()) + " properties, " + + std::to_string(old_properties.size()) + " properties, " + "and this function tries to assign" + - Utilities::to_string(new_properties.size()) + " properties. " + + std::to_string(new_properties.size()) + " properties. " + "This is not allowed.")); if (old_properties.size() > 0) -- 2.39.5