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:
@@ -14,7 +14,6 @@
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
Simulation Sim;
|
||||
clock_t start_time = clock();
|
||||
Sim.doit();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#define simulation_hpp
|
||||
|
||||
#include <mpi.h>
|
||||
|
||||
#include "particle_looper.hpp"
|
||||
|
||||
class Simulation {
|
||||
@@ -47,6 +48,7 @@ private:
|
||||
int calc_dir_number();
|
||||
std::string build_dirname(int dir_number);
|
||||
void create_out_dir(std::string dirname);
|
||||
std::string create_number_extension();
|
||||
|
||||
public:
|
||||
void doit();
|
||||
|
||||
Reference in New Issue
Block a user