Skip to content

Commit

Permalink
Merge pull request #5236 from bangerth/c_str
Browse files Browse the repository at this point in the history
Avoid use of taking .c_str() just to convert back to std::string.
  • Loading branch information
gassmoeller committed Jul 9, 2023
2 parents f663f48 + 17a04cd commit a153bb8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions source/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ parse_parameters (const std::string &input_as_string,
if (dealii::Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) == 0)
try
{
prm.parse_input_from_string(input_as_string.c_str());
prm.parse_input_from_string(input_as_string);
}
catch (const dealii::ExceptionBase &e)
{
Expand Down Expand Up @@ -486,7 +486,7 @@ parse_parameters (const std::string &input_as_string,
// other processors will be ok as well
if (dealii::Utilities::MPI::this_mpi_process (MPI_COMM_WORLD) != 0)
{
prm.parse_input_from_string(input_as_string.c_str());
prm.parse_input_from_string(input_as_string);
}
}

Expand Down
2 changes: 1 addition & 1 deletion source/postprocess/depth_average.cc
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ namespace aspect
"velocity magnitude|sinking velocity|rising velocity|Vs|Vp|log viscosity|"
"viscosity|vertical heat flux|vertical mass flux|composition mass";
prm.declare_entry("List of output variables", "all",
Patterns::MultipleSelection(variables.c_str()),
Patterns::MultipleSelection(variables),
"A comma separated list which specifies which quantities to "
"average in each depth slice. It defaults to averaging all "
"available quantities, but this can be an expensive operation, "
Expand Down
4 changes: 2 additions & 2 deletions source/postprocess/particles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ namespace aspect
// Just write one data file in parallel
else if (group_files == 1)
{
data_out.write_vtu_in_parallel(filename.c_str(),
data_out.write_vtu_in_parallel(filename,
this->get_mpi_communicator());
}
// Write as many output files as 'group_files' groups
Expand All @@ -481,7 +481,7 @@ namespace aspect
int ierr = MPI_Comm_split(this->get_mpi_communicator(), color, my_id, &comm);
AssertThrowMPI(ierr);

data_out.write_vtu_in_parallel(filename.c_str(), comm);
data_out.write_vtu_in_parallel(filename, comm);
ierr = MPI_Comm_free(&comm);
AssertThrowMPI(ierr);
}
Expand Down
4 changes: 2 additions & 2 deletions source/postprocess/visualization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ namespace aspect
// Just write one data file in parallel
if (group_files == 1)
{
data_out.write_vtu_in_parallel(filename.c_str(),
data_out.write_vtu_in_parallel(filename,
this->get_mpi_communicator());
}
else // Write as many output files as 'group_files' groups
Expand All @@ -602,7 +602,7 @@ namespace aspect
MPI_Comm comm;
int ierr = MPI_Comm_split(this->get_mpi_communicator(), color, my_id, &comm);
AssertThrowMPI(ierr);
data_out.write_vtu_in_parallel(filename.c_str(), comm);
data_out.write_vtu_in_parallel(filename, comm);
ierr = MPI_Comm_free(&comm);
AssertThrowMPI(ierr);
}
Expand Down
4 changes: 2 additions & 2 deletions source/simulator/checkpoint_restart.cc
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ namespace aspect

signals.pre_checkpoint_store_user_data(triangulation);

triangulation.save ((parameters.output_directory + "restart.mesh.new").c_str());
triangulation.save (parameters.output_directory + "restart.mesh.new");
}

// save general information This calls the serialization functions on all
Expand Down Expand Up @@ -523,7 +523,7 @@ namespace aspect
// now that we have resumed from the snapshot load the mesh and solution vectors
try
{
triangulation.load ((parameters.output_directory + "restart.mesh").c_str());
triangulation.load (parameters.output_directory + "restart.mesh");
}
catch (...)
{
Expand Down

0 comments on commit a153bb8

Please sign in to comment.