Particles don't reset interaction between timesteps,
added possibility to stride the injection of new beta particles
This commit is contained in:
@@ -13,38 +13,50 @@ namespace particle {
|
||||
|
||||
class SerializedParticle {
|
||||
public:
|
||||
SerializedParticle(double time_birth, double weight,
|
||||
SerializedParticle(double weight,
|
||||
blitz::TinyVector<double, 3> cart_pos,
|
||||
blitz::TinyVector<double, 3> cart_vel,
|
||||
std::string spec_name);
|
||||
std::string spec_name,
|
||||
int next_interaction_index,
|
||||
double time_until_interaction);
|
||||
SerializedParticle() {};
|
||||
|
||||
double timeBirth();
|
||||
double weight();
|
||||
blitz::TinyVector<double, 3> cartesianPosition();
|
||||
blitz::TinyVector<double, 3> cartesianVelocity();
|
||||
std::string specieName();
|
||||
double timeUntilCollision();
|
||||
int indexNextInteraction();
|
||||
|
||||
private:
|
||||
double time_birth_;
|
||||
blitz::TinyVector<double, 3> cartesian_position_;
|
||||
blitz::TinyVector<double, 3> cartesian_velocity_;
|
||||
// has to be null terminated
|
||||
// has to include null character, s.t. the transformation back
|
||||
// to a string becomes trivial. This requires the actual string
|
||||
// to be 16-1=15 characters long at most
|
||||
// (it can be shorter due to the null character)
|
||||
// Example: "e-" -> ['e', '-', '\0', ...] gets correctly transformed back
|
||||
// into "e-"
|
||||
std::array<char, 16> specie_name_;
|
||||
double weight_;
|
||||
|
||||
int idx_nxt_interaction_;
|
||||
double time_until_interaction_;
|
||||
};
|
||||
|
||||
class Particle {
|
||||
public:
|
||||
// Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
||||
// Coordinate* position,
|
||||
// Vector* velocity);
|
||||
Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
||||
const Coordinate& position,
|
||||
const Vector& velocity,
|
||||
const double time_birth,
|
||||
const double weight);
|
||||
|
||||
Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
||||
const Coordinate& position,
|
||||
const Vector& velocity,
|
||||
const double weight);
|
||||
|
||||
Particle(particle::SerializedParticle sparticle, std::map<std::string,
|
||||
std::shared_ptr<species::TrackedSpecie>>& tracked_species);
|
||||
|
||||
@@ -81,15 +93,21 @@ class Particle {
|
||||
|
||||
void indexNextInteration(const int index) { index_next_interaction_ = index; };
|
||||
int indexNextInteraction() { return index_next_interaction_; };
|
||||
void invalidateNextInteraction() { index_next_interaction_ = -1; };
|
||||
bool isNextInteractionValid() { return index_next_interaction_ >= 0; };
|
||||
|
||||
void timeUntilCollision(const double time_until_collision);
|
||||
double timeUntilCollision() const;
|
||||
void reduceTimeUntilCollision(const double delta);
|
||||
|
||||
void deposited(bool truthValue=true);
|
||||
bool wasDeposited();
|
||||
|
||||
// note: particle id is not being stored!
|
||||
particle::SerializedParticle serialize();
|
||||
|
||||
private:
|
||||
double weight_;
|
||||
bool deposited_ = false;
|
||||
|
||||
CartesianVector velocity_;
|
||||
CartesianCoordinate position_cart_;
|
||||
@@ -99,8 +117,10 @@ class Particle {
|
||||
// double time_in_bin_s_;
|
||||
long int interaction_counter_;
|
||||
|
||||
bool deposited_ = false;
|
||||
// index of the interaction with the sortest distance (-1 if that's none of them)
|
||||
int index_next_interaction_ = -1;
|
||||
double time_until_collision_;
|
||||
|
||||
std::shared_ptr<species::TrackedSpecie> specie_;
|
||||
long int id_;
|
||||
|
||||
Reference in New Issue
Block a user