built restart utilities
This commit is contained in:
@@ -13,9 +13,11 @@ class Hdf5Reader {
|
||||
blitz::Array<double, 3> readD3Double(std::string path);
|
||||
blitz::Array<double, 2> readD2Double(std::string path);
|
||||
blitz::Array<double, 1> readD1Double(std::string path);
|
||||
std::stringstream readEngineString(std::string path);
|
||||
|
||||
blitz::Array<long int, 4> readD4LongInt(std::string path);
|
||||
|
||||
std::stringstream readEngineString(std::string path);
|
||||
|
||||
private:
|
||||
std::string absolute_filename_;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef RESTART_H
|
||||
#define RESTART_H
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
#include "IO/hdf5_reader.h"
|
||||
|
||||
namespace species {
|
||||
class TrackedSpecie;
|
||||
enum class ImplementedSpecies;
|
||||
}; // namespace species
|
||||
|
||||
class DynamicDensityField;
|
||||
class PoissonSolver;
|
||||
class RandomNumbers;
|
||||
|
||||
// Note: The restarts for the DensirtField and the PoissonSolver require that the
|
||||
// partitioning of the simulation space does not change between the original and
|
||||
// the restarted simulation
|
||||
// Note: think if it's better (or more consistent) to set the dynamic electric field
|
||||
// here after the potential is loaded; would need the electric field class to be included
|
||||
class Restart {
|
||||
public:
|
||||
Restart(bool do_restart, std::string absolute_filename,
|
||||
std::string restart_identifier);
|
||||
|
||||
void restart(std::map<std::string, std::shared_ptr<species::TrackedSpecie>>& species,
|
||||
PoissonSolver* poisson_solver, RandomNumbers* random_numbers);
|
||||
|
||||
private:
|
||||
void restartTimer(species::TrackedSpecie* reference_specie);
|
||||
void restartDrawingDensityField(DynamicDensityField* field, std::string path); // only necc densityfield for the one that is drawn from
|
||||
void restartPoissonSolver(PoissonSolver* solver); // only load in the potential and calc the electric field
|
||||
void restartRandomNumbers(RandomNumbers* random);
|
||||
|
||||
bool do_restart_;
|
||||
std::string restart_identifier_; // i.e. "LastSyncPeriod" or "SyncPeriod_*"
|
||||
Hdf5Reader reader_;
|
||||
};
|
||||
#endif /* RESTART_H */
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef RESTART_GENERATOR_H
|
||||
#define RESTART_GENERATOR_H
|
||||
|
||||
#include "jansson.h"
|
||||
#include "simulation/parameter.h"
|
||||
|
||||
class Restart;
|
||||
|
||||
namespace generator{
|
||||
Restart buildRestart(json_t* object);
|
||||
|
||||
Restart buildRestart(Parameter& parameter);
|
||||
}; // namespace generator
|
||||
|
||||
#endif /* RESTART_GENERATOR_H */
|
||||
@@ -63,6 +63,8 @@ class PoissonSolver {
|
||||
std::shared_ptr<VectorField> staticElectricField();
|
||||
const CylinderBinning* densityBinning();
|
||||
|
||||
void setPotential(blitz::Array<double, 3>& potential);
|
||||
|
||||
private:
|
||||
GlobalBoundary bottom_boundary_;
|
||||
GlobalBoundary top_boundary_;
|
||||
|
||||
@@ -42,7 +42,6 @@ class DynamicDensityField : public DensityField {
|
||||
|
||||
double particleNumber();
|
||||
blitz::TinyVector<double, 4> drawPositionAndEnergy(std::mt19937* engine);
|
||||
void setDensityDistribution();
|
||||
|
||||
void resetDynamicDensityField();
|
||||
|
||||
@@ -58,6 +57,10 @@ class DynamicDensityField : public DensityField {
|
||||
double physicalTime() const;
|
||||
double timeResolution() const;
|
||||
|
||||
void restartTimer(double time, double delta_t);
|
||||
void restartTimeInBin(blitz::Array<double, 4> time_in_bin);
|
||||
void restartDeletedParticlesArray(blitz::Array<long int, 4> deleted_particles);
|
||||
|
||||
friend class CpuSynchronizer;
|
||||
|
||||
private:
|
||||
@@ -77,6 +80,7 @@ class DynamicDensityField : public DensityField {
|
||||
BinCoordinate densityBin(const CylinderCoordinate& position) const;
|
||||
void recalculateDensityArray();
|
||||
void initPositionDistributions();
|
||||
void setDensityDistribution();
|
||||
|
||||
blitz::Array<double, 4> time_in_bin_s_;
|
||||
blitz::Array<long int, 4> deleted_particles_;
|
||||
@@ -97,6 +101,7 @@ class DynamicDensityField : public DensityField {
|
||||
const EnergyBinning energy_binning_;
|
||||
|
||||
std::shared_ptr<Timer> timer_;
|
||||
bool timer_restarted_ = false;
|
||||
};
|
||||
|
||||
class ConstantDensityField : public DensityField {
|
||||
|
||||
Reference in New Issue
Block a user