Fixed outputfile numeration:
Adding leading 0 to match length of file_endings. MPI_RANK 9 with MPI_SIZE 100 -> '009'
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
|
||||
#include "simulation.hpp"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
using namespace std;
|
||||
|
||||
const long int Simulation::seed = load_parameter("seed");
|
||||
@@ -84,7 +86,7 @@ std::string Simulation::calc_outfile_path() {
|
||||
}
|
||||
MPI_Barrier(MPI_COMM_WORLD);
|
||||
std::stringstream filename;
|
||||
filename<<dirname<<"mc_electron_out_"<<mpi_rank<<".h5";
|
||||
filename<<dirname<<"mc_electron_out_"<<create_number_extension()<<".h5";
|
||||
return filename.str();
|
||||
}
|
||||
|
||||
@@ -115,6 +117,13 @@ void Simulation::create_out_dir(std::string dirname) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string Simulation::create_number_extension() {
|
||||
int digits = to_string(mpi_size).length();
|
||||
std::stringstream ss;
|
||||
ss << std::setw(digits) << std::setfill('0') << mpi_rank;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
void Simulation::doit() {
|
||||
do_cycle(popCalcDecays, popCalcStep, false);
|
||||
if (mpi_rank == 0) {
|
||||
|
||||
Reference in New Issue
Block a user