Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
776de1f593 | ||
|
|
c6687a23c3 |
@@ -15,6 +15,7 @@ class MpiParticleReader {
|
|||||||
MpiParticleReader(std::string abs_filename_without_extension, int restart_at);
|
MpiParticleReader(std::string abs_filename_without_extension, int restart_at);
|
||||||
|
|
||||||
void readParticles(std::vector<particle::SerializedParticle>& storage_queue);
|
void readParticles(std::vector<particle::SerializedParticle>& storage_queue);
|
||||||
|
void readParticles(std::vector<particle::SerializedParticle>& storage_queue, int nold);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string absolute_filename_;
|
std::string absolute_filename_;
|
||||||
|
|||||||
@@ -46,9 +46,11 @@ class Restart {
|
|||||||
// only load in the potential and calc the electric field
|
// only load in the potential and calc the electric field
|
||||||
void restartPoissonSolver(PoissonSolver* solver);
|
void restartPoissonSolver(PoissonSolver* solver);
|
||||||
void restartRandomNumbers(RandomNumbers* random);
|
void restartRandomNumbers(RandomNumbers* random);
|
||||||
|
void restartRandomNumbers(RandomNumbers* random, int nold);
|
||||||
void restartParticles(std::vector<particle::SerializedParticle>& storage_queue);
|
void restartParticles(std::vector<particle::SerializedParticle>& storage_queue);
|
||||||
|
|
||||||
bool do_restart_;
|
bool do_restart_;
|
||||||
|
int process_number_old_; // number of processes of the state the simulation is restarted from
|
||||||
std::string restart_identifier_; // i.e. "LastSyncPeriod" or "SyncPeriod_*"
|
std::string restart_identifier_; // i.e. "LastSyncPeriod" or "SyncPeriod_*"
|
||||||
Hdf5Reader reader_;
|
Hdf5Reader reader_;
|
||||||
MpiParticleReader particle_reader_;
|
MpiParticleReader particle_reader_;
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ class SimulationOutput {
|
|||||||
|
|
||||||
void writeMetaData(
|
void writeMetaData(
|
||||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>& species,
|
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>& species,
|
||||||
const std::shared_ptr<PoissonSolver>& poisson_solver);
|
const std::shared_ptr<PoissonSolver>& poisson_solver,
|
||||||
|
std::string parameter_file_path);
|
||||||
|
|
||||||
void writeSimulationData(
|
void writeSimulationData(
|
||||||
int cpu_sync,
|
int cpu_sync,
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ class Simulation {
|
|||||||
|
|
||||||
int timestep = 0;
|
int timestep = 0;
|
||||||
int injectionGroupOffset = 0;
|
int injectionGroupOffset = 0;
|
||||||
|
|
||||||
|
std::string parameter_file_path_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SIMULATION_H */
|
#endif /* SIMULATION_H */
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include <fstream>
|
||||||
#include "mpi.h"
|
#include "mpi.h"
|
||||||
#include "IO/simulation_output.h"
|
#include "IO/simulation_output.h"
|
||||||
#include "IO/hdf5_writer.h"
|
#include "IO/hdf5_writer.h"
|
||||||
@@ -43,7 +44,8 @@ void SimulationOutput::setParticleOutput(OutputTask task) {
|
|||||||
|
|
||||||
void SimulationOutput::writeMetaData(
|
void SimulationOutput::writeMetaData(
|
||||||
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>& species,
|
std::map<std::string, std::shared_ptr<species::TrackedSpecie>>& species,
|
||||||
const std::shared_ptr<PoissonSolver>& poisson_solver) {
|
const std::shared_ptr<PoissonSolver>& poisson_solver,
|
||||||
|
std::string parameter_file_path) {
|
||||||
if (MpiCommunication::mpi_rank == 0) {
|
if (MpiCommunication::mpi_rank == 0) {
|
||||||
for (auto& pair : species) {
|
for (auto& pair : species) {
|
||||||
writeMetaData(pair.second.get());
|
writeMetaData(pair.second.get());
|
||||||
@@ -70,6 +72,24 @@ void SimulationOutput::writeMetaData(
|
|||||||
{
|
{
|
||||||
writer.write(MpiCommunication::mpiSize(), "/NumberProcesses");
|
writer.write(MpiCommunication::mpiSize(), "/NumberProcesses");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// write the json file to the hdf output
|
||||||
|
{
|
||||||
|
std::stringstream file;
|
||||||
|
std::ifstream istream(parameter_file_path.c_str());
|
||||||
|
istream >> file.rdbuf();
|
||||||
|
|
||||||
|
// find occurance of last slash in the path of the parameter
|
||||||
|
size_t slshidx = parameter_file_path.rfind("/");
|
||||||
|
|
||||||
|
std::string hdf5path = (slshidx == std::string::npos) ?
|
||||||
|
"/" + parameter_file_path :
|
||||||
|
parameter_file_path.substr(slshidx);
|
||||||
|
|
||||||
|
SIM_INFO("blubb: " + hdf5path);
|
||||||
|
|
||||||
|
writer.write(file.str(), hdf5path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "tools/simulation_time.h"
|
#include "tools/simulation_time.h"
|
||||||
|
|
||||||
Simulation::Simulation(std::string parameter_filename)
|
Simulation::Simulation(std::string parameter_filename)
|
||||||
: parameter_(parameter_filename) {
|
: parameter_(parameter_filename), parameter_file_path_(parameter_filename) {
|
||||||
init(parameter_);
|
init(parameter_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ void Simulation::init(Parameter& parameter) {
|
|||||||
#ifdef debug
|
#ifdef debug
|
||||||
DEBUG_LEVEL_0("Output meta data.");
|
DEBUG_LEVEL_0("Output meta data.");
|
||||||
#endif
|
#endif
|
||||||
output_->writeMetaData(tracked_species_, poisson_solver_);
|
output_->writeMetaData(tracked_species_, poisson_solver_, parameter_file_path_);
|
||||||
}
|
}
|
||||||
|
|
||||||
int eventsThisCpu(int events_all_cpus) {
|
int eventsThisCpu(int events_all_cpus) {
|
||||||
|
|||||||
Reference in New Issue
Block a user