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;
|
using namespace std;
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
Simulation Sim;
|
Simulation Sim;
|
||||||
clock_t start_time = clock();
|
clock_t start_time = clock();
|
||||||
Sim.doit();
|
Sim.doit();
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
#include "simulation.hpp"
|
#include "simulation.hpp"
|
||||||
|
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
const long int Simulation::seed = load_parameter("seed");
|
const long int Simulation::seed = load_parameter("seed");
|
||||||
@@ -84,7 +86,7 @@ std::string Simulation::calc_outfile_path() {
|
|||||||
}
|
}
|
||||||
MPI_Barrier(MPI_COMM_WORLD);
|
MPI_Barrier(MPI_COMM_WORLD);
|
||||||
std::stringstream filename;
|
std::stringstream filename;
|
||||||
filename<<dirname<<"mc_electron_out_"<<mpi_rank<<".h5";
|
filename<<dirname<<"mc_electron_out_"<<create_number_extension()<<".h5";
|
||||||
return filename.str();
|
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() {
|
void Simulation::doit() {
|
||||||
do_cycle(popCalcDecays, popCalcStep, false);
|
do_cycle(popCalcDecays, popCalcStep, false);
|
||||||
if (mpi_rank == 0) {
|
if (mpi_rank == 0) {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#define simulation_hpp
|
#define simulation_hpp
|
||||||
|
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
|
|
||||||
#include "particle_looper.hpp"
|
#include "particle_looper.hpp"
|
||||||
|
|
||||||
class Simulation {
|
class Simulation {
|
||||||
@@ -47,6 +48,7 @@ private:
|
|||||||
int calc_dir_number();
|
int calc_dir_number();
|
||||||
std::string build_dirname(int dir_number);
|
std::string build_dirname(int dir_number);
|
||||||
void create_out_dir(std::string dirname);
|
void create_out_dir(std::string dirname);
|
||||||
|
std::string create_number_extension();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void doit();
|
void doit();
|
||||||
|
|||||||
Reference in New Issue
Block a user