removed the 4d density field
This commit is contained in:
@@ -51,338 +51,6 @@ blitz::Array<double, 3> initiateVolumeArray(
|
||||
}
|
||||
|
||||
DynamicDensityField::DynamicDensityField(
|
||||
const CylinderBinning& position_binning,
|
||||
const EnergyBinning& energy_binning,
|
||||
std::shared_ptr<Timer> timer)
|
||||
: position_binning_(position_binning),
|
||||
energy_binning_(energy_binning),
|
||||
timer_(timer),
|
||||
time_in_bin_s_(initiate4DArray<double>(
|
||||
blitz::Range(position_binning.radial_binning.binIndexMin(),
|
||||
position_binning.radial_binning.binIndexMax()),
|
||||
blitz::Range(position_binning.azimuth_binning.binIndexMin(),
|
||||
position_binning.azimuth_binning.binIndexMax()),
|
||||
blitz::Range(position_binning.longitudinal_binning.binIndexMin(),
|
||||
position_binning.longitudinal_binning.binIndexMax()),
|
||||
blitz::Range(energy_binning.binIndexMin(),
|
||||
energy_binning.binIndexMax()))),
|
||||
sync_time_in_bin_s_(initiate4DArray<double>(
|
||||
blitz::Range(position_binning.radial_binning.binIndexMin(),
|
||||
position_binning.radial_binning.binIndexMax()),
|
||||
blitz::Range(position_binning.azimuth_binning.binIndexMin(),
|
||||
position_binning.azimuth_binning.binIndexMax()),
|
||||
blitz::Range(position_binning.longitudinal_binning.binIndexMin(),
|
||||
position_binning.longitudinal_binning.binIndexMax()),
|
||||
blitz::Range(energy_binning.binIndexMin(),
|
||||
energy_binning.binIndexMax()))),
|
||||
deleted_particles_(initiate4DArray<long int>(
|
||||
blitz::Range(position_binning.radial_binning.binIndexMin(),
|
||||
position_binning.radial_binning.binIndexMax()),
|
||||
blitz::Range(position_binning.azimuth_binning.binIndexMin(),
|
||||
position_binning.azimuth_binning.binIndexMax()),
|
||||
blitz::Range(position_binning.longitudinal_binning.binIndexMin(),
|
||||
position_binning.longitudinal_binning.binIndexMax()),
|
||||
blitz::Range(energy_binning.binIndexMin(),
|
||||
energy_binning.binIndexMax()))),
|
||||
sync_deleted_particles_(initiate4DArray<long int>(
|
||||
blitz::Range(position_binning.radial_binning.binIndexMin(),
|
||||
position_binning.radial_binning.binIndexMax()),
|
||||
blitz::Range(position_binning.azimuth_binning.binIndexMin(),
|
||||
position_binning.azimuth_binning.binIndexMax()),
|
||||
blitz::Range(position_binning.longitudinal_binning.binIndexMin(),
|
||||
position_binning.longitudinal_binning.binIndexMax()),
|
||||
blitz::Range(energy_binning.binIndexMin(),
|
||||
energy_binning.binIndexMax()))),
|
||||
density_per_m3_(initiate4DArray<double>(
|
||||
blitz::Range(position_binning.radial_binning.binIndexMin(),
|
||||
position_binning.radial_binning.binIndexMax()),
|
||||
blitz::Range(position_binning.azimuth_binning.binIndexMin(),
|
||||
position_binning.azimuth_binning.binIndexMax()),
|
||||
blitz::Range(position_binning.longitudinal_binning.binIndexMin(),
|
||||
position_binning.longitudinal_binning.binIndexMax()),
|
||||
blitz::Range(energy_binning.binIndexMin(),
|
||||
energy_binning.binIndexMax()))),
|
||||
bin_volume_m3_(initiateVolumeArray(
|
||||
blitz::Range(position_binning.radial_binning.binIndexMin(),
|
||||
position_binning.radial_binning.binIndexMax()),
|
||||
blitz::Range(position_binning.azimuth_binning.binIndexMin(),
|
||||
position_binning.azimuth_binning.binIndexMax()),
|
||||
blitz::Range(position_binning.longitudinal_binning.binIndexMin(),
|
||||
position_binning.longitudinal_binning.binIndexMax()),
|
||||
position_binning.stepsize())) {
|
||||
if (!timer) {
|
||||
ERROR("Timer is necessary for calculation of density field");
|
||||
}
|
||||
initPositionDistributions();
|
||||
}
|
||||
|
||||
bool DynamicDensityField::changedPositionBin(
|
||||
const Coordinate& old_position,
|
||||
const Coordinate& new_position) const {
|
||||
const blitz::TinyVector<int, 3> old_bin =
|
||||
position_binning_.bin(old_position.cylinderEntries());
|
||||
|
||||
const blitz::TinyVector<int, 3> new_bin =
|
||||
position_binning_.bin(new_position.cylinderEntries());
|
||||
|
||||
return !((old_bin(0) == new_bin(0)) && (old_bin(1) == new_bin(1)) &&
|
||||
(old_bin(2) == new_bin(2)));
|
||||
}
|
||||
|
||||
bool DynamicDensityField::changedEnergyBin(double old_energy_eV,
|
||||
double new_energy_eV) const {
|
||||
const int old_bin = energy_binning_.bin(old_energy_eV);
|
||||
const int new_bin = energy_binning_.bin(new_energy_eV);
|
||||
return !(old_bin == new_bin);
|
||||
}
|
||||
|
||||
void DynamicDensityField::logMovement(const Coordinate& position,
|
||||
double energy_eV,
|
||||
double time_in_bin_s) {
|
||||
const blitz::TinyVector<int, 3> position_bin =
|
||||
position_binning_.bin(position.cylinderEntries());
|
||||
const int energy_bin = energy_binning_.bin(energy_eV);
|
||||
|
||||
// std::stringstream out;
|
||||
// out << "Energy bin " << energy_bin << "\n";
|
||||
// out << "time in bin" << time_in_bin_s;
|
||||
// DEBUG_LEVEL_3(out.str());
|
||||
|
||||
time_in_bin_s_(position_bin(0), position_bin(1), position_bin(2),
|
||||
energy_bin) += time_in_bin_s;
|
||||
}
|
||||
|
||||
void DynamicDensityField::logDeletion(const Coordinate& position,
|
||||
double energy_eV) {
|
||||
const blitz::TinyVector<int, 3> position_bin =
|
||||
position_binning_.bin(position.cylinderEntries());
|
||||
const int energy_bin = energy_binning_.bin(energy_eV);
|
||||
|
||||
deleted_particles_(position_bin(0), position_bin(1), position_bin(2),
|
||||
energy_bin) += 1;
|
||||
}
|
||||
|
||||
double DynamicDensityField::density(const Coordinate& position) {
|
||||
const blitz::TinyVector<int, 3> position_bin =
|
||||
position_binning_.bin(position.cylinderEntries());
|
||||
|
||||
const double t = timer_->getDeltaT();
|
||||
const double time_in_bin = blitz::sum(time_in_bin_s_(
|
||||
position_bin(0), position_bin(1), position_bin(2), blitz::Range::all()));
|
||||
const long int deleted_particles = blitz::sum(deleted_particles_(
|
||||
position_bin(0), position_bin(1), position_bin(2), blitz::Range::all()));
|
||||
|
||||
return (time_in_bin / t - deleted_particles) /
|
||||
bin_volume_m3_(position_bin(0), position_bin(1), position_bin(2));
|
||||
}
|
||||
|
||||
double DynamicDensityField::density(const Coordinate& position,
|
||||
double energy_eV) {
|
||||
const blitz::TinyVector<int, 3> position_bin =
|
||||
position_binning_.bin(position.cylinderEntries());
|
||||
|
||||
const int energy_bin = energy_binning_.bin(energy_eV);
|
||||
const double t = timer_->getDeltaT();
|
||||
const double time_in_bin = time_in_bin_s_(position_bin(0), position_bin(1),
|
||||
position_bin(2), energy_bin);
|
||||
const long deleted_particles = deleted_particles_(
|
||||
position_bin(0), position_bin(1), position_bin(2), energy_bin);
|
||||
|
||||
return (time_in_bin / t - deleted_particles) /
|
||||
bin_volume_m3_(position_bin(0), position_bin(1), position_bin(2));
|
||||
}
|
||||
|
||||
blitz::Array<double, 3> DynamicDensityField::densityArray() {
|
||||
recalculateDensityArray();
|
||||
|
||||
blitz::Array<double, 3> density(density_per_m3_(
|
||||
blitz::Range::all(), blitz::Range::all(), blitz::Range::all(), 0));
|
||||
blitz::fourthIndex iE;
|
||||
density = blitz::sum(density_per_m3_, iE);
|
||||
return density.copy();
|
||||
}
|
||||
|
||||
double DynamicDensityField::particleNumber() {
|
||||
blitz::Array<double, 3> density = densityArray();
|
||||
double particleNumber = blitz::sum(density * bin_volume_m3_);
|
||||
DEBUG_LEVEL_3("particle number: " + std::to_string(particleNumber));
|
||||
return particleNumber;
|
||||
}
|
||||
|
||||
void DynamicDensityField::initPositionDistributions() {
|
||||
double rmin, rmax;
|
||||
double phimin, phimax;
|
||||
double zmin, zmax;
|
||||
|
||||
auto rbins = position_binning_.radial_binning.binBorders();
|
||||
auto zbins = position_binning_.longitudinal_binning.binBorders();
|
||||
auto phibins = position_binning_.azimuth_binning.binBorders();
|
||||
|
||||
rmin = rbins.front();
|
||||
rmax = rbins.back();
|
||||
DEBUG_LEVEL_3("rmax: " + std::to_string(rmax));
|
||||
|
||||
zmin = zbins.front();
|
||||
zmax = zbins.back();
|
||||
DEBUG_LEVEL_3("zmax: " + std::to_string(zmax));
|
||||
|
||||
phimin = phibins.front();
|
||||
phimax = phibins.back();
|
||||
DEBUG_LEVEL_3("phimax: " + std::to_string(phimax));
|
||||
|
||||
r_dist_ = std::uniform_real_distribution<double>(rmin*rmin, rmax*rmax);
|
||||
phi_dist_ = std::uniform_real_distribution<double>(phimin, phimax);
|
||||
z_dist_ = std::uniform_real_distribution<double>(zmin, zmax);
|
||||
}
|
||||
|
||||
void DynamicDensityField::setDensityDistribution() {
|
||||
density_dist_ =
|
||||
std::uniform_real_distribution<double>(0., blitz::max(densityArray()));
|
||||
}
|
||||
|
||||
blitz::TinyVector<double, 4> DynamicDensityField::drawPositionAndEnergy(
|
||||
std::mt19937* engine) {
|
||||
// if the density is empty, then return a TinyVector filled with 0s as
|
||||
// an indiction of that (probably not the best solution)
|
||||
|
||||
// stuff below not optimal, since it's done for every particle that is drawn,
|
||||
// but maybe not certain that otherwise the density is right...
|
||||
// recalculateDensityArray();
|
||||
if (isEqual(blitz::max(density_per_m3_), 0.)) {
|
||||
DEBUG_LEVEL_3("Density is empty");
|
||||
return blitz::TinyVector<double, 4> (0,0,0,0);
|
||||
}
|
||||
// setDensityDistribution();
|
||||
double random_r, random_z, random_phi, random_E, random_n;
|
||||
double density_in_random_cell;
|
||||
|
||||
do {
|
||||
DEBUG_LEVEL_3("Missed.");
|
||||
random_r = std::sqrt(r_dist_(*engine));
|
||||
random_phi = phi_dist_(*engine);
|
||||
random_z = z_dist_(*engine);
|
||||
random_n = density_dist_(*engine);
|
||||
|
||||
density_in_random_cell = density(CylinderCoordinate(
|
||||
blitz::TinyVector<double, 3> (random_r, random_phi, random_z)));
|
||||
DEBUG_LEVEL_3("Density in drawn cell: " + std::to_string(density_in_random_cell));
|
||||
DEBUG_LEVEL_3("drawn density: " + std::to_string(random_n));
|
||||
} while (random_n >= density_in_random_cell);
|
||||
|
||||
const blitz::TinyVector<int, 3> position_bin =
|
||||
position_binning_.bin(CylinderCoordinate(
|
||||
blitz::TinyVector<double, 3> (random_r, random_phi, random_z))
|
||||
.cylinderEntries());
|
||||
|
||||
std::vector<double> energyBins = energy_binning_.binBorders();
|
||||
energyBins.insert(energyBins.begin(), 0.);
|
||||
blitz::Array<double, 1> densityAtPosition = density_per_m3_(position_bin(0),
|
||||
position_bin(1),
|
||||
position_bin(2),
|
||||
blitz::Range::all());
|
||||
|
||||
E_dist_ = std::piecewise_constant_distribution<double>(energyBins.begin(),
|
||||
energyBins.end(),
|
||||
densityAtPosition.begin());
|
||||
|
||||
random_E = E_dist_(*engine);
|
||||
DEBUG_LEVEL_3("energy: " + std::to_string(random_E));
|
||||
|
||||
return blitz::TinyVector<double, 4> (random_r, random_phi, random_z, random_E);
|
||||
}
|
||||
|
||||
blitz::Array<double, 4> DynamicDensityField::spectrumArray() {
|
||||
recalculateDensityArray();
|
||||
return density_per_m3_;
|
||||
}
|
||||
|
||||
void DynamicDensityField::recalculateDensityArray() {
|
||||
blitz::firstIndex ir;
|
||||
blitz::secondIndex iphi;
|
||||
blitz::thirdIndex iz;
|
||||
blitz::fourthIndex iE;
|
||||
|
||||
const double t = timer_->getDeltaT();
|
||||
density_per_m3_ = (time_in_bin_s_(ir, iphi, iz, iE) / t -
|
||||
deleted_particles_(ir, iphi, iz, iE)) /
|
||||
bin_volume_m3_(ir, iphi, iz);
|
||||
}
|
||||
|
||||
blitz::Array<double, 4> DynamicDensityField::timeInBinArray() const {
|
||||
return time_in_bin_s_;
|
||||
}
|
||||
blitz::Array<long int, 4> DynamicDensityField::deletedParticlesArray() const {
|
||||
return deleted_particles_;
|
||||
}
|
||||
blitz::Array<double, 3> DynamicDensityField::binVolumeArray() const {
|
||||
return bin_volume_m3_;
|
||||
}
|
||||
|
||||
const EnergyBinning* DynamicDensityField::energyBinning() const {
|
||||
return &energy_binning_;
|
||||
}
|
||||
|
||||
const CylinderBinning* DynamicDensityField::positionBinning() const {
|
||||
return &position_binning_;
|
||||
}
|
||||
|
||||
double DynamicDensityField::physicalTime() const {
|
||||
return timer_->time();
|
||||
}
|
||||
|
||||
double DynamicDensityField::timeResolution() const {
|
||||
return timer_->getDeltaT();
|
||||
}
|
||||
|
||||
void DynamicDensityField::resetDynamicDensityField() {
|
||||
//timer_->resetTime(); // time stays global
|
||||
time_in_bin_s_ = 0.;
|
||||
deleted_particles_ = 0.;
|
||||
density_per_m3_ = 0.;
|
||||
sync_time_in_bin_s_ = 0.;
|
||||
sync_deleted_particles_ = 0.;
|
||||
}
|
||||
|
||||
void DynamicDensityField::restartTimer(double time, double delta_t) {
|
||||
// make sure that the timer can only be restarted once (per dynamicDensityField object)
|
||||
// probably not necessary, but whatever...
|
||||
if(timer_restarted_) {
|
||||
return;
|
||||
}
|
||||
timer_restarted_ = true;
|
||||
timer_->setTime(time);
|
||||
timer_->setDeltaT(delta_t);
|
||||
}
|
||||
|
||||
void DynamicDensityField::restartTimeInBin(blitz::Array<double, 4> time_in_bin) {
|
||||
if(!blitz::all(time_in_bin_s_.length() == time_in_bin.length())) {
|
||||
std::stringstream out;
|
||||
out << "Expected a size of " << time_in_bin_s_.length();
|
||||
out << ", received a length of " << time_in_bin.length();
|
||||
out << " for time_in_bin array";
|
||||
ERROR(out.str());
|
||||
}
|
||||
time_in_bin_s_ = time_in_bin.copy().reindex(time_in_bin_s_.lbound());
|
||||
}
|
||||
|
||||
void DynamicDensityField::restartDeletedParticlesArray(
|
||||
blitz::Array<long int, 4> deleted_particles) {
|
||||
if(!blitz::all(deleted_particles_.length() == deleted_particles.length())) {
|
||||
std::stringstream out;
|
||||
out << "Expected a size of " << deleted_particles_.length();
|
||||
out << ", received a length of " << deleted_particles.length();
|
||||
out << " for deleted_particles array";
|
||||
ERROR(out.str());
|
||||
}
|
||||
deleted_particles_ = deleted_particles.copy().reindex(deleted_particles_.lbound());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// TBD
|
||||
DynamicDensityFieldWithPitchAngle::DynamicDensityFieldWithPitchAngle(
|
||||
const CylinderBinning& position_binning,
|
||||
const EnergyBinning& energy_binning,
|
||||
const PitchAngleBinning& pitch_angle_binning,
|
||||
@@ -458,7 +126,7 @@ DynamicDensityFieldWithPitchAngle::DynamicDensityFieldWithPitchAngle(
|
||||
initPositionDistributions();
|
||||
}
|
||||
|
||||
double DynamicDensityFieldWithPitchAngle::density(const Coordinate& position) {
|
||||
double DynamicDensityField::density(const Coordinate& position) {
|
||||
const blitz::TinyVector<int, 3> position_bin =
|
||||
position_binning_.bin(position.cylinderEntries());
|
||||
|
||||
@@ -474,7 +142,7 @@ double DynamicDensityFieldWithPitchAngle::density(const Coordinate& position) {
|
||||
bin_volume_m3_(position_bin(0), position_bin(1), position_bin(2));
|
||||
}
|
||||
|
||||
double DynamicDensityFieldWithPitchAngle::density(const Coordinate& position,
|
||||
double DynamicDensityField::density(const Coordinate& position,
|
||||
double energy_eV) {
|
||||
const blitz::TinyVector<int, 3> position_bin =
|
||||
position_binning_.bin(position.cylinderEntries());
|
||||
@@ -492,7 +160,7 @@ double DynamicDensityFieldWithPitchAngle::density(const Coordinate& position,
|
||||
bin_volume_m3_(position_bin(0), position_bin(1), position_bin(2));
|
||||
}
|
||||
|
||||
bool DynamicDensityFieldWithPitchAngle::changedPositionBin(
|
||||
bool DynamicDensityField::changedPositionBin(
|
||||
const Coordinate& old_position,
|
||||
const Coordinate& new_position) const {
|
||||
const blitz::TinyVector<int, 3> old_bin =
|
||||
@@ -505,7 +173,7 @@ bool DynamicDensityFieldWithPitchAngle::changedPositionBin(
|
||||
(old_bin(2) == new_bin(2)));
|
||||
}
|
||||
|
||||
bool DynamicDensityFieldWithPitchAngle::changedEnergyBin(
|
||||
bool DynamicDensityField::changedEnergyBin(
|
||||
double old_energy_eV,
|
||||
double new_energy_eV) const {
|
||||
const int old_bin = energy_binning_.bin(old_energy_eV);
|
||||
@@ -513,7 +181,7 @@ bool DynamicDensityFieldWithPitchAngle::changedEnergyBin(
|
||||
return !(old_bin == new_bin);
|
||||
}
|
||||
|
||||
bool DynamicDensityFieldWithPitchAngle::changedPitchAngleBin(
|
||||
bool DynamicDensityField::changedPitchAngleBin(
|
||||
double old_mu,
|
||||
double new_mu) const {
|
||||
const int old_bin = pitch_angle_binning_.bin(old_mu);
|
||||
@@ -529,7 +197,7 @@ bool DynamicDensityFieldWithPitchAngle::changedPitchAngleBin(
|
||||
return !(old_bin == new_bin);
|
||||
}
|
||||
|
||||
void DynamicDensityFieldWithPitchAngle::logMovement(
|
||||
void DynamicDensityField::logMovement(
|
||||
const Coordinate& position,
|
||||
double energy_eV,
|
||||
double pitch_angle,
|
||||
@@ -551,7 +219,7 @@ void DynamicDensityFieldWithPitchAngle::logMovement(
|
||||
pitch_angle_bin, energy_bin) += time_in_bin_s;
|
||||
}
|
||||
|
||||
void DynamicDensityFieldWithPitchAngle::logDeletion(
|
||||
void DynamicDensityField::logDeletion(
|
||||
const Coordinate& position,
|
||||
double energy_eV,
|
||||
double pitch_angle) {
|
||||
@@ -566,7 +234,7 @@ void DynamicDensityFieldWithPitchAngle::logDeletion(
|
||||
return;
|
||||
}
|
||||
|
||||
blitz::Array<double, 3> DynamicDensityFieldWithPitchAngle::densityArray() {
|
||||
blitz::Array<double, 3> DynamicDensityField::densityArray() {
|
||||
DEBUG_LEVEL_3("recalc Density array");
|
||||
recalculateDensityArray();
|
||||
|
||||
@@ -578,44 +246,44 @@ blitz::Array<double, 3> DynamicDensityFieldWithPitchAngle::densityArray() {
|
||||
return density.copy();
|
||||
}
|
||||
|
||||
blitz::Array<double, 4> DynamicDensityFieldWithPitchAngle::spectrumArray() {
|
||||
blitz::Array<double, 4> DynamicDensityField::spectrumArray() {
|
||||
recalculateDensityArray();
|
||||
return density_per_m3_;
|
||||
}
|
||||
|
||||
blitz::Array<double, 5> DynamicDensityFieldWithPitchAngle::timeInBinArray() const {
|
||||
blitz::Array<double, 5> DynamicDensityField::timeInBinArray() const {
|
||||
return time_in_bin_s_;
|
||||
}
|
||||
|
||||
blitz::Array<long int, 5> DynamicDensityFieldWithPitchAngle::deletedParticlesArray() const {
|
||||
blitz::Array<long int, 5> DynamicDensityField::deletedParticlesArray() const {
|
||||
return deleted_particles_;
|
||||
}
|
||||
|
||||
blitz::Array<double, 3> DynamicDensityFieldWithPitchAngle::binVolumeArray() const {
|
||||
blitz::Array<double, 3> DynamicDensityField::binVolumeArray() const {
|
||||
return bin_volume_m3_;
|
||||
}
|
||||
|
||||
const EnergyBinning* DynamicDensityFieldWithPitchAngle::energyBinning() const {
|
||||
const EnergyBinning* DynamicDensityField::energyBinning() const {
|
||||
return &energy_binning_;
|
||||
}
|
||||
|
||||
const CylinderBinning* DynamicDensityFieldWithPitchAngle::positionBinning() const {
|
||||
const CylinderBinning* DynamicDensityField::positionBinning() const {
|
||||
return &position_binning_;
|
||||
}
|
||||
|
||||
const PitchAngleBinning* DynamicDensityFieldWithPitchAngle::pitchAngleBinning() const {
|
||||
const PitchAngleBinning* DynamicDensityField::pitchAngleBinning() const {
|
||||
return &pitch_angle_binning_;
|
||||
}
|
||||
|
||||
double DynamicDensityFieldWithPitchAngle::physicalTime() const {
|
||||
double DynamicDensityField::physicalTime() const {
|
||||
return timer_->time();
|
||||
}
|
||||
|
||||
double DynamicDensityFieldWithPitchAngle::timeResolution() const {
|
||||
double DynamicDensityField::timeResolution() const {
|
||||
return timer_->getDeltaT();
|
||||
}
|
||||
|
||||
void DynamicDensityFieldWithPitchAngle::recalculateDensityArray() {
|
||||
void DynamicDensityField::recalculateDensityArray() {
|
||||
blitz::firstIndex ir;
|
||||
blitz::secondIndex iphi;
|
||||
blitz::thirdIndex iz;
|
||||
@@ -634,19 +302,19 @@ void DynamicDensityFieldWithPitchAngle::recalculateDensityArray() {
|
||||
bin_volume_m3_(ir, iphi, iz);
|
||||
}
|
||||
|
||||
void DynamicDensityFieldWithPitchAngle::setDensityDistribution() {
|
||||
void DynamicDensityField::setDensityDistribution() {
|
||||
density_dist_ =
|
||||
std::uniform_real_distribution<double>(0., blitz::max(densityArray()));
|
||||
}
|
||||
|
||||
double DynamicDensityFieldWithPitchAngle::particleNumber() {
|
||||
double DynamicDensityField::particleNumber() {
|
||||
blitz::Array<double, 3> density = densityArray();
|
||||
double particleNumber = blitz::sum(density * bin_volume_m3_);
|
||||
DEBUG_LEVEL_3("particle number: " + std::to_string(particleNumber));
|
||||
return particleNumber;
|
||||
}
|
||||
|
||||
void DynamicDensityFieldWithPitchAngle::initPositionDistributions() {
|
||||
void DynamicDensityField::initPositionDistributions() {
|
||||
double rmin, rmax;
|
||||
double phimin, phimax;
|
||||
double zmin, zmax;
|
||||
@@ -674,7 +342,7 @@ void DynamicDensityFieldWithPitchAngle::initPositionDistributions() {
|
||||
|
||||
// don't know if it's even good to have the drawing stuff in the
|
||||
// density distributions...
|
||||
blitz::TinyVector<double, 5> DynamicDensityFieldWithPitchAngle::
|
||||
blitz::TinyVector<double, 5> DynamicDensityField::
|
||||
draw(std::mt19937* engine) {
|
||||
recalculateDensityArray();
|
||||
if (isEqual(blitz::max(density_per_m3_), 0.)) {
|
||||
@@ -737,7 +405,7 @@ blitz::TinyVector<double, 5> DynamicDensityFieldWithPitchAngle::
|
||||
return blitz::TinyVector<double, 5> (random_r, random_phi, random_z, random_mu, random_E);
|
||||
}
|
||||
|
||||
void DynamicDensityFieldWithPitchAngle::resetDynamicDensityField() {
|
||||
void DynamicDensityField::resetDynamicDensityField() {
|
||||
//timer_->resetTime(); // time stays global
|
||||
time_in_bin_s_ = 0.;
|
||||
deleted_particles_ = 0.;
|
||||
@@ -746,7 +414,7 @@ void DynamicDensityFieldWithPitchAngle::resetDynamicDensityField() {
|
||||
sync_deleted_particles_ = 0.;
|
||||
}
|
||||
|
||||
void DynamicDensityFieldWithPitchAngle::restartTimer(double time, double delta_t) {
|
||||
void DynamicDensityField::restartTimer(double time, double delta_t) {
|
||||
// make sure that the timer can only be restarted once (per dynamicDensityField object)
|
||||
// probably not necessary, but whatever...
|
||||
if(timer_restarted_) {
|
||||
@@ -757,7 +425,7 @@ void DynamicDensityFieldWithPitchAngle::restartTimer(double time, double delta_t
|
||||
timer_->setDeltaT(delta_t);
|
||||
}
|
||||
|
||||
void DynamicDensityFieldWithPitchAngle::restartTimeInBin(blitz::Array<double, 5> time_in_bin) {
|
||||
void DynamicDensityField::restartTimeInBin(blitz::Array<double, 5> time_in_bin) {
|
||||
if(!blitz::all(time_in_bin_s_.length() == time_in_bin.length())) {
|
||||
std::stringstream out;
|
||||
out << "Expected a size of " << time_in_bin_s_.length();
|
||||
@@ -768,7 +436,7 @@ void DynamicDensityFieldWithPitchAngle::restartTimeInBin(blitz::Array<double, 5>
|
||||
time_in_bin_s_ = time_in_bin.copy().reindex(time_in_bin_s_.lbound());
|
||||
}
|
||||
|
||||
void DynamicDensityFieldWithPitchAngle::restartDeletedParticlesArray(
|
||||
void DynamicDensityField::restartDeletedParticlesArray(
|
||||
blitz::Array<long int, 5> deleted_particles) {
|
||||
if(!blitz::all(deleted_particles_.length() == deleted_particles.length())) {
|
||||
std::stringstream out;
|
||||
|
||||
Reference in New Issue
Block a user