Electrons are explicitly stored between timesteps
and can be dumped using MPI-IO. Restarts read particles from earlier output.
This commit is contained in:
@@ -5,8 +5,35 @@
|
||||
#include "simulation/coordinates.h"
|
||||
#include "simulation/species.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
class MpiParticleReader;
|
||||
|
||||
namespace particle {
|
||||
|
||||
class SerializedParticle {
|
||||
public:
|
||||
SerializedParticle(double time_birth, double weight,
|
||||
blitz::TinyVector<double, 3> cart_pos,
|
||||
blitz::TinyVector<double, 3> cart_vel,
|
||||
std::string spec_name);
|
||||
SerializedParticle() {};
|
||||
|
||||
double timeBirth();
|
||||
double weight();
|
||||
blitz::TinyVector<double, 3> cartesianPosition();
|
||||
blitz::TinyVector<double, 3> cartesianVelocity();
|
||||
std::string specieName();
|
||||
|
||||
private:
|
||||
double time_birth_;
|
||||
blitz::TinyVector<double, 3> cartesian_position_;
|
||||
blitz::TinyVector<double, 3> cartesian_velocity_;
|
||||
// has to be null terminated
|
||||
std::array<char, 16> specie_name_;
|
||||
double weight_;
|
||||
};
|
||||
|
||||
class Particle {
|
||||
public:
|
||||
// Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
||||
@@ -18,6 +45,9 @@ class Particle {
|
||||
const double time_birth,
|
||||
const double weight);
|
||||
|
||||
Particle(particle::SerializedParticle sparticle, std::map<std::string,
|
||||
std::shared_ptr<species::TrackedSpecie>>& tracked_species);
|
||||
|
||||
void position(const Coordinate& new_position);
|
||||
CartesianCoordinate cartesianPosition() const;
|
||||
CylinderCoordinate cylinderPosition() const;
|
||||
@@ -52,9 +82,11 @@ class Particle {
|
||||
void indexNextInteration(const int index) { index_next_interaction_ = index; };
|
||||
int indexNextInteraction() { return index_next_interaction_; };
|
||||
|
||||
void deposited();
|
||||
void deposited(bool truthValue=true);
|
||||
bool wasDeposited();
|
||||
|
||||
particle::SerializedParticle serialize();
|
||||
|
||||
private:
|
||||
double weight_;
|
||||
bool deposited_ = false;
|
||||
|
||||
@@ -90,7 +90,7 @@ class Simulation {
|
||||
std::shared_ptr<CpuSynchronizer> cpu_synchronizer_;
|
||||
|
||||
std::vector<particle::Particle> queue_;
|
||||
std::vector<particle::Particle> storage_queue_[2];
|
||||
std::vector<particle::SerializedParticle> storage_queue_[2];
|
||||
|
||||
int active_storage = 0;
|
||||
int inactive_storage = 1;
|
||||
|
||||
Reference in New Issue
Block a user