Added option for initial weights in the injector
This commit is contained in:
@@ -21,14 +21,16 @@ Particle::Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
||||
Particle::Particle(std::shared_ptr<species::TrackedSpecie> specie,
|
||||
const Coordinate& position,
|
||||
const Vector& velocity,
|
||||
const double time_birth)
|
||||
const double time_birth,
|
||||
const double weight)
|
||||
: specie_(specie),
|
||||
position_(position),
|
||||
velocity_(velocity, position),
|
||||
id_(this->last_id_),
|
||||
time_alive_s_(time_birth),
|
||||
time_in_bin_s_(0.),
|
||||
interaction_counter_(0) {
|
||||
interaction_counter_(0),
|
||||
weight_(weight) {
|
||||
last_id_++;
|
||||
}
|
||||
|
||||
@@ -100,7 +102,7 @@ double Particle::timeAlive() const {
|
||||
}
|
||||
|
||||
void Particle::increaseTimeInBin(double time_s) {
|
||||
time_in_bin_s_ += time_s;
|
||||
time_in_bin_s_ += time_s*weight_;
|
||||
}
|
||||
|
||||
void Particle::resetTimeInBin() {
|
||||
@@ -115,4 +117,8 @@ long int Particle::ID() const {
|
||||
return id_;
|
||||
}
|
||||
|
||||
double Particle::weight() const {
|
||||
return weight_;
|
||||
}
|
||||
|
||||
} // namespace particle
|
||||
|
||||
Reference in New Issue
Block a user