Previously, we had widely used the constructors that take a char* and for that needed
to call the '.c_str()' function of std::string. This is now no longer necessary in C++11.
+ "_mapping_q_"
+ Utilities::to_string(degree)
+ ".dat";
- std::ofstream gnuplot_file (filename.c_str());
+ std::ofstream gnuplot_file (filename);
// Then write out the triangulation to this file. The last
// argument of the function is a pointer to a mapping object. This
{
const std::string filename = "grid-" + std::to_string(cycle) + ".eps";
deallog << "Writing grid to <" << filename << ">" << std::endl;
- std::ofstream eps_output (filename.c_str());
+ std::ofstream eps_output (filename);
GridOut grid_out;
grid_out.write_eps (triangulation, eps_output);
{
const std::string filename = "sol-" + std::to_string(cycle) + ".gnuplot";
deallog << "Writing solution to <" << filename << ">" << std::endl;
- std::ofstream gnuplot_output (filename.c_str());
+ std::ofstream gnuplot_output (filename);
DataOut<dim> data_out;
data_out.attach_dof_handler (dof_handler);
// With the so-completed filename, let us open a file and write the data
// we have generated into it:
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
data_out.write_vtu (output);
// The record files must be written only once and not by each processor,
visit_master_filename = ("solution-" +
Utilities::int_to_string(timestep_no,4) +
".visit");
- std::ofstream visit_master (visit_master_filename.c_str());
+ std::ofstream visit_master (visit_master_filename);
DataOutBase::write_visit_record (visit_master, filenames);
// Similarly, we write the paraview .pvtu:
pvtu_master_filename = ("solution-" +
Utilities::int_to_string(timestep_no,4) +
".pvtu");
- std::ofstream pvtu_master (pvtu_master_filename.c_str());
+ std::ofstream pvtu_master (pvtu_master_filename);
data_out.write_pvtu_record (pvtu_master, filenames);
// Finally, we write the paraview record, that references all .pvtu files and
DataOutReader<dim,spacedim> merged_data;
{
- std::ifstream input (input_file_names[0].c_str());
+ std::ifstream input (input_file_names[0]);
AssertThrow (input, ExcIO());
merged_data.read (input);
// object, and then merge that into the first object declared above:
for (unsigned int i=1; i<input_file_names.size(); ++i)
{
- std::ifstream input (input_file_names[i].c_str());
+ std::ifstream input (input_file_names[i]);
AssertThrow (input, ExcIO());
DataOutReader<dim,spacedim> additional_data;
// the command line. Note that this ensures that if the library acquires
// the ability to output in other output formats, this program will be
// able to make use of this ability without having to be changed!
- std::ofstream output_stream (output_file.c_str());
+ std::ofstream output_stream (output_file);
AssertThrow (output_stream, ExcIO());
const DataOutBase::OutputFormat format
AssertThrow (input_file_names.size() > 0,
ExcMessage ("No input files specified."));
- std::ifstream input(input_file_names[0].c_str());
+ std::ifstream input(input_file_names[0]);
AssertThrow (input, ExcIO());
const std::pair<unsigned int, unsigned int>
const std::string filename = "solution-" +
Utilities::int_to_string (timestep_number, 3) +
".gnuplot";
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
data_out.write_gnuplot (output);
}
const std::string filename = "solution-" +
Utilities::int_to_string (timestep_number, 3) +
".gnuplot";
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
data_out.write_gnuplot (output);
}
Utilities::int_to_string (timestep_number, 3) +
".vtk";
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
data_out.write_vtk (output);
}
const std::string filename = "solution-"
+ Utilities::int_to_string(timestep_number, 3) +
".vtk";
- std::ofstream output(filename.c_str());
+ std::ofstream output(filename);
data_out.write_vtk(output);
}
const std::string filename = "solution-" +
Utilities::int_to_string (cycle, 2) +
".vtk";
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
data_out.write_vtk (output);
}
data_out.add_data_vector (solution, "solution");
data_out.build_patches ();
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
data_out.write_vtu (output);
}
const std::string filename = output_file +
data_out.default_suffix();
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
// The solution vectors $v$ and $w$ are added to the DataOut object in the
// usual way:
filename += refine_type + ".eps";
std::cout << "Writing grid to <" << filename << ">..." << std::endl;
- std::ofstream eps_output (filename.c_str());
+ std::ofstream eps_output (filename);
GridOut grid_out;
grid_out.write_eps (triangulation, eps_output);
filename += refine_type + ".gnuplot";
std::cout << "Writing grid to <" << filename << ">..." << std::endl;
- std::ofstream gnuplot_grid_output (filename.c_str());
+ std::ofstream gnuplot_grid_output (filename);
grid_out.write_gnuplot (triangulation, gnuplot_grid_output);
filename += refine_type + ".gnuplot";
std::cout << "Writing solution to <" << filename << ">..."
<< std::endl;
- std::ofstream gnuplot_output (filename.c_str());
+ std::ofstream gnuplot_output (filename);
DataOut<dim> data_out;
data_out.attach_dof_handler (dof_handler);
ParameterHandler prm;
BoussinesqFlowProblem<dim>::Parameters::declare_parameters (prm);
- std::ifstream parameter_file (parameter_filename.c_str());
+ std::ifstream parameter_file (parameter_filename);
if (!parameter_file)
{
parameter_file.close ();
- std::ofstream parameter_out (parameter_filename.c_str());
+ std::ofstream parameter_out (parameter_filename);
prm.print_parameters (parameter_out,
ParameterHandler::Text);
Utilities::int_to_string
(triangulation.locally_owned_subdomain(), 4) +
".vtu");
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
data_out.write_vtu (output);
pvtu_master_filename = ("solution-" +
Utilities::int_to_string (out_index, 5) +
".pvtu");
- std::ofstream pvtu_master (pvtu_master_filename.c_str());
+ std::ofstream pvtu_master (pvtu_master_filename);
data_out.write_pvtu_record (pvtu_master, filenames);
const std::string
visit_master_filename = ("solution-" +
Utilities::int_to_string (out_index, 5) +
".visit");
- std::ofstream visit_master (visit_master_filename.c_str());
+ std::ofstream visit_master (visit_master_filename);
DataOutBase::write_visit_record (visit_master, filenames);
}
std::string filename = "solution-" +
Utilities::int_to_string (output_file_number, 3) +
".vtk";
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
data_out.write_vtk (output);
++output_file_number;
GridIn<dim> grid_in;
grid_in.attach_triangulation(triangulation);
- std::ifstream input_file(parameters.mesh_filename.c_str());
+ std::ifstream input_file(parameters.mesh_filename);
Assert (input_file, ExcFileNotOpen(parameters.mesh_filename.c_str()));
grid_in.read_ucd(input_file);
const std::string
filename = Utilities::int_to_string(dim) + "d_external.vtk";
- std::ofstream file(filename.c_str());
+ std::ofstream file(filename);
data_out.write_vtk(file);
}
"d_boundary_solution_" +
Utilities::int_to_string(cycle) +
".vtk" );
- std::ofstream file(filename.c_str());
+ std::ofstream file(filename);
dataout.write_vtk(file);
{
std::string filename = "nsbench2.inp";
- std::ifstream file (filename.c_str());
+ std::ifstream file (filename);
Assert (file, ExcFileNotOpen (filename.c_str()));
grid_in.read_ucd (file);
}
DataOut<dim>::type_dof_data,
component_interpretation);
data_out.build_patches (deg + 1);
- std::ofstream output (("solution-" +
- Utilities::int_to_string (step, 5) +
- ".vtk").c_str());
+ std::ofstream output ("solution-" +
+ Utilities::int_to_string (step, 5) +
+ ".vtk");
data_out.write_vtk (output);
}
+ ".vtu");
std::string master_name = "solution-" + Utilities::to_string(cycle) + ".pvtu";
- std::ofstream master_output (master_name.c_str());
+ std::ofstream master_output (master_name);
data_out.write_pvtu_record (master_output, filenames);
}
}
std::string filename ("solution-");
filename += static_cast<char>('0'+spacedim);
filename += "d.vtk";
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
data_out.write_vtk (output);
}
deallog << "Writing solution to <" << filename << ">..."
<< std::endl << std::endl;
- std::ofstream gnuplot_output (filename.c_str());
+ std::ofstream gnuplot_output (filename);
DataOut<dim> data_out;
data_out.attach_dof_handler (dof_handler);
"." +
Utilities::int_to_string
(triangulation.locally_owned_subdomain(), 4));
- std::ofstream output ((filename + ".vtu").c_str());
+ std::ofstream output ((filename + ".vtu"));
data_out.write_vtu (output);
// The last step is to write a "master record" that lists for the
Utilities::int_to_string (i, 4) +
".vtu");
- std::ofstream master_output (("solution-" +
- Utilities::int_to_string (cycle, 2) +
- ".pvtu").c_str());
+ std::ofstream master_output ("solution-" +
+ Utilities::int_to_string (cycle, 2) +
+ ".pvtu");
data_out.write_pvtu_record (master_output, filenames);
}
}
data_out.build_patches ();
- std::ofstream output_vtk ((std::string("output_") +
- Utilities::int_to_string (iteration, 3) +
- ".vtk").c_str ());
+ std::ofstream output_vtk (std::string("output_") +
+ Utilities::int_to_string (iteration, 3) +
+ ".vtk");
data_out.write_vtk (output_vtk);
}
nx(0),
ny(0)
{
- std::ifstream f(name.c_str());
+ std::ifstream f(name);
AssertThrow (f, ExcMessage (std::string("Can't read from file <") +
name + ">!"));
(output_dir + filename_base + "-"
+ Utilities::int_to_string(triangulation.locally_owned_subdomain(), 4));
- std::ofstream output_vtu((filename + ".vtu").c_str());
+ std::ofstream output_vtu((filename + ".vtu"));
data_out.write_vtu(output_vtu);
pcout << output_dir + filename_base << ".pvtu" << std::endl;
Utilities::int_to_string(i, 4) +
".vtu");
- std::ofstream pvtu_master_output((output_dir + filename_base + ".pvtu").c_str());
+ std::ofstream pvtu_master_output((output_dir + filename_base + ".pvtu"));
data_out.write_pvtu_record(pvtu_master_output, filenames);
- std::ofstream visit_master_output((output_dir + filename_base + ".visit").c_str());
+ std::ofstream visit_master_output((output_dir + filename_base + ".visit"));
DataOutBase::write_visit_record(visit_master_output, filenames);
}
std::string filename = "solution-" +
Utilities::int_to_string (timestep_number, 5) + ".vtu";
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
data_out.write_vtu (output);
}
pvtu_master_filename = ("solution-" +
Utilities::int_to_string (refinement_cycle, 2) +
".pvtu");
- std::ofstream pvtu_master (pvtu_master_filename.c_str());
+ std::ofstream pvtu_master (pvtu_master_filename);
data_out.write_pvtu_record (pvtu_master, filenames);
}
}
//std::endl; std::cout << F << std::endl;
std::string filename = "vertices.dat";
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
output << "#vertices of xfem subcells" << std::endl;
output << v0(0) << " " << v0(1) << std::endl;
output << v1(0) << " " << v1(1) << std::endl;
//std::cout << "Pos " << Pos << std::endl; std::cout << A <<
//std::endl; std::cout << B << std::endl;
std::string filename = "vertices.dat";
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
output << "#vertices of xfem subcells" << std::endl;
output << A(0) << " " << A(1) << std::endl;
output << B(0) << " " << B(1) << std::endl;
filename += ('0' + cycle);
filename += ".vtk";
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
Postprocessor<dim> postprocessor;
DataOut<dim,hp::DoFHandler<dim> > data_out;
const std::string filename =
"solution-" + Utilities::int_to_string (timestep_number, 3);
- std::ofstream output ((filename +
- "." + Utilities::int_to_string (Utilities::MPI::
- this_mpi_process(MPI_COMM_WORLD),4) + ".vtu").c_str());
+ std::ofstream output (filename +
+ "." + Utilities::int_to_string (Utilities::MPI::
+ this_mpi_process(MPI_COMM_WORLD),4) + ".vtu");
data_out.write_vtu (output);
if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
Utilities::int_to_string (i, 4) +
".vtu");
- std::ofstream master_output ((filename + ".pvtu").c_str());
+ std::ofstream master_output ((filename + ".pvtu"));
data_out.write_pvtu_record (master_output, filenames);
}
}
Utilities::int_to_string
(triangulation.locally_owned_subdomain(), 4) +
".vtu");
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
data_out.write_vtu (output);
if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
pvtu_master_filename = ("solution-" +
Utilities::int_to_string (cycle, 5) +
".pvtu");
- std::ofstream pvtu_master (pvtu_master_filename.c_str());
+ std::ofstream pvtu_master (pvtu_master_filename);
data_out.write_pvtu_record (pvtu_master, filenames);
const std::string
visit_master_filename = ("solution-" +
Utilities::int_to_string (cycle, 5) +
".visit");
- std::ofstream visit_master (visit_master_filename.c_str());
+ std::ofstream visit_master (visit_master_filename);
DataOutBase::write_visit_record (visit_master, filenames);
std::cout << " wrote " << pvtu_master_filename << std::endl;
filename += "-q" + Utilities::int_to_string(fe.degree,1);
filename += "-" + Utilities::int_to_string(cycle,2);
filename += ".vtk";
- std::ofstream output (filename.c_str());
+ std::ofstream output (filename);
DataOut<dim> data_out;
face_out += "-q" + Utilities::int_to_string(fe.degree,1);
face_out += "-" + Utilities::int_to_string(cycle,2);
face_out += ".vtk";
- std::ofstream face_output (face_out.c_str());
+ std::ofstream face_output (face_out);
// The <code>DataOutFaces</code> class works analogously to the <code>DataOut</code>
// class when we have a <code>DoFHandler</code> that defines the solution on
const std::string filename = "solution-" + method_name + "-" +
Utilities::int_to_string (time_step, 3) +
".vtu";
- std::ofstream output(filename.c_str());
+ std::ofstream output(filename);
data_out.write_vtu(output);
}
// Having done this all, we can now output the mesh into a file of its own:
const std::string filename = "mesh.vtu";
- std::ofstream out (filename.c_str());
+ std::ofstream out (filename);
GridOut grid_out;
grid_out.write_vtu (triangulation, out);
}
// mesh from an external VTK file, and convert it to a deal triangulation.
std::ifstream in;
- in.open(initial_mesh_filename.c_str());
+ in.open(initial_mesh_filename);
GridIn<2,3> gi;
gi.attach_triangulation(tria);
const std::string filename = ( output_filename + "_" +
Utilities::int_to_string(cycle) +
".vtk" );
- std::ofstream logfile(filename.c_str());
+ std::ofstream logfile(filename);
GridOut grid_out;
grid_out.write_vtk(tria, logfile);
}
"." +
Utilities::int_to_string
(triangulation.locally_owned_subdomain(), 4));
- std::ofstream output ((filename + ".vtu").c_str());
+ std::ofstream output ((filename + ".vtu"));
data_out.write_vtu (output);
if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)
Utilities::int_to_string (i, 4) +
".vtu");
- std::ofstream master_output (("solution-" +
- Utilities::int_to_string (cycle, 2) +
- ".pvtu").c_str());
+ std::ofstream master_output ("solution-" +
+ Utilities::int_to_string (cycle, 2) +
+ ".pvtu");
data_out.write_pvtu_record (master_output, filenames);
}
}
// appropriate for VTK output, open a file, and add the solution vector to
// the object that will do the actual output:
vtk_filename += ".vtk";
- std::ofstream output (vtk_filename.c_str());
+ std::ofstream output (vtk_filename);
DataOut<dim> data_out;
data_out.attach_dof_handler (dof_handler);
}
error_filename += ".tex";
- std::ofstream error_table_file(error_filename.c_str());
+ std::ofstream error_table_file(error_filename);
convergence_table.write_tex(error_table_file);
}
conv_filename += ".tex";
- std::ofstream table_file(conv_filename.c_str());
+ std::ofstream table_file(conv_filename);
convergence_table.write_tex(table_file);
}
}