Added option whether particles should be stored

explicitly
This commit is contained in:
2025-09-09 10:49:57 +02:00
parent c57dd44dde
commit 641e26c10b
6 changed files with 70 additions and 43 deletions
+2
View File
@@ -28,6 +28,7 @@ struct TrackedSpeciesBuilderInfo {
double mass_kg;
double charge_C;
bool explicitly_stored;
species::ImplementedSpecies type;
std::string name;
json_path path_in_json;
@@ -109,6 +110,7 @@ class SpeciesBuilder {
void fillTerminator(Parameter& parameter);
void fillReflector(Parameter& parameter);
void fillTrackedDensity(Parameter& parameter);
void fillDensityDrawingType(Parameter& parameter);
void initTimer();
void buildSpecies();
+3 -3
View File
@@ -51,14 +51,14 @@ class Simulation {
std::map<std::string, double>& particleNumbers,
bool& all_bins_done);
double meanFreePath(particle::Particle& particle, RandomNumbers* random,
std::vector<double>& macroscopic_cross_sections_m);
// double meanFreePath(particle::Particle& particle, RandomNumbers* random,
// std::vector<double>& macroscopic_cross_sections_m);
// draw the individual collision times of the possible interactions and return the
// minimum of them. Also sets the "nextInteractionIndex" in the particle to the
// interaction of the chosen time.
double collisionTime(particle::Particle& particle, RandomNumbers* random);
void collisionTime(particle::Particle& particle, RandomNumbers* random);
interaction::InteractionOutput interact(particle::Particle& particle,
RandomNumbers* random);
+8
View File
@@ -59,6 +59,7 @@ class TrackedSpecie : public Specie {
std::string name,
double mass_kg,
double charge_C,
bool explicitly_stored,
std::shared_ptr<Mover> mover,
std::shared_ptr<Terminator> terminator,
std::shared_ptr<Reflector> reflector,
@@ -95,6 +96,8 @@ class TrackedSpecie : public Specie {
// getter for the raw pointer to the RandomIndex object
RandomIndex* randomIndex();
bool explicitlyStored();
private:
std::shared_ptr<DynamicDensityField> density_field_;
std::shared_ptr<VelocityDistribution> velocity_distribution_;
@@ -115,6 +118,11 @@ class TrackedSpecie : public Specie {
velocity_distribution_from_density_;
std::shared_ptr<RandomIndex> random_index_;
// should work if it changes from true -> false (after a restart)
// however, it should not work in the opposite case (in which the
// old density would be lost)
const bool explicitly_stored_;
};
class BackgroundSpecie : public Specie {