Removed drawing infrastructure

This commit is contained in:
2025-10-13 13:19:23 +02:00
parent 21ad9cd30a
commit 31c2b230a9
15 changed files with 32 additions and 670 deletions
-14
View File
@@ -42,15 +42,6 @@ class DynamicDensityField : public DensityField {
double pitch_angle,
double weight);
// void logDeletion(const Coordinate& position,
// double energy_eV,
// double pitch_angle);
// return the particle number stored in the density of this object
double particleNumber();
// return the particle number at the given index
double particleNumber(blitz::TinyVector<int, 5> index);
// returns true if the old pitch angle and the new pitch angle are in different bins
// of the pitch angle binning
bool changedPitchAngleBin(double old_pitch_angle, double new_pitch_angle) const;
@@ -58,7 +49,6 @@ class DynamicDensityField : public DensityField {
blitz::Array<double, 3> densityArray();
blitz::Array<double, 4> spectrumArray();
blitz::Array<double, 5> timeInBinArray() const;
// blitz::Array<long int, 5> deletedParticlesArray() const;
blitz::Array<double, 3> binVolumeArray() const;
// return an array of the density values at the Coordinate position (only energy
@@ -84,7 +74,6 @@ class DynamicDensityField : public DensityField {
void restartTimer(double time, double delta_t);
void restartTimeInBin(blitz::Array<double, 5> time_in_bin);
// void restartDeletedParticlesArray(blitz::Array<long int, 5> deleted_particles);
private:
@@ -95,10 +84,7 @@ class DynamicDensityField : public DensityField {
// (not renamed, since that would require many, many changes due to
// renaming of the functions)
blitz::Array<double, 5> time_in_bin_s_;
// blitz::Array<long int, 5> deleted_particles_;
blitz::Array<double, 5> sync_time_in_bin_s_;
// blitz::Array<long int, 5> sync_deleted_particles_;
blitz::Array<double, 4> density_per_m3_;
blitz::Array<double, 3> bin_volume_m3_;
@@ -37,38 +37,4 @@ class EventPositionDistribution {
std::uniform_real_distribution<double> density_values;
};
// Class to draw a position from the density provided by a pointer
// to a DynamicDensityField object
class PositionDistributionFromDensity {
public:
// Constructor taking a pointer to a DynamicDensityField object
PositionDistributionFromDensity(std::shared_ptr<DynamicDensityField> density);
// // draw a position from the density provided at construction using the rejection method
// CylinderCoordinate drawPosition(std::mt19937* engine);
// draw a position uniformly distributed within the bin of the given index
// (note that the r-dependence of the particle number in a uniform density distribution
// is not incorporated)
CylinderCoordinate drawPosition(std::mt19937* engine, int r_idx, int phi_idx,
int z_idx);
// // sets the maximum density value needed for the rejection method
// // should not be called frequently, since during each call the density field is
// // recalculated from scratch by the DynamicDensityField object
// void setMaximumDensity();
private:
// variable storing the maximum value of the density
// double maximum_density_ = 1.;
std::shared_ptr<DynamicDensityField> density_;
// // distributions for the spatial directions and for the density
// std::uniform_real_distribution<double> r_values;
// std::uniform_real_distribution<double> phi_values;
// std::uniform_real_distribution<double> z_values;
// std::uniform_real_distribution<double> density_values;
std::uniform_real_distribution<double> std_unifrm;
};
#endif /* EVENT_POSITION_DISTRIBUTION_H */
-13
View File
@@ -48,19 +48,6 @@ class Injector {
// numerical_number: number of numerical beta particles to be injected on
// a single process
void setWeights(const double physical_number, const int numerical_number);
// draw new particles from the DynamicDensityField of the provided specie,
// the new particles are then appened to the vector 'queue'
// the magnetic field is necessary for the determination of the direction of the
// injected particles
// the weight_factor scales the time a particle contributes to a certain bin
// and the injection time specifies the time the particle is injected (has to be
// between T, T+\DeltaT)
void drawNewParticleFromDensityField(std::mt19937* engine,
std::shared_ptr<species::TrackedSpecie> specie,
std::vector<particle::Particle>& queue,
std::shared_ptr<MagneticField> field,
const double weight_factor);
void initInjectionTimeDistribution(double delta_t);
+1 -7
View File
@@ -36,16 +36,10 @@ class Simulation {
void finalize();
void processEvents(int events);
void processDensityEvents(int particles_per_bin, const double weight_factor);
void processDensityEvents();
void processUntilTermination(particle::Particle& particle);
private:
std::vector<particle::Particle> determineInjectedDensityParticles(
RandomNumbers* random,
const double weight_factor,
const int current,
std::map<std::string, double>& particleNumbers,
bool& all_bins_done);
// draw the individual collision times of the possible interactions and return the
// minimum of them. Also sets the "nextInteractionIndex" in the particle to the
+1 -18
View File
@@ -59,7 +59,6 @@ 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,
@@ -88,19 +87,11 @@ class TrackedSpecie : public Specie {
std::vector<std::shared_ptr<interaction::Interaction>> interactions();
void addInteraction(std::shared_ptr<interaction::Interaction> interaction);
// getter for the raw pointer to the positionDistributionFromDensity object
PositionDistributionFromDensity* positionDistributionFromDensity();
// getter for the raw pointer to the VelocityDistributionFromDensityField object
VelocityDistributionFromDensityField* velocityDistributionFromDensityField();
// 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_;
std::shared_ptr<DriftVelocity> drift_velocity_;
std::shared_ptr<Mover> mover_;
@@ -112,17 +103,9 @@ class TrackedSpecie : public Specie {
std::vector<std::shared_ptr<interaction::Interaction>> interactions_;
std::shared_ptr<DynamicDensityField> density_for_drawing_;
std::shared_ptr<PositionDistributionFromDensity>
position_distribution_from_density_;
// necessary for interactions between TrackedSpecies
std::shared_ptr<VelocityDistributionFromDensityField>
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 {
@@ -56,19 +56,9 @@ class VelocityDistributionFromDensityField : public VelocityDistribution {
const Coordinate& position, std::mt19937* engine,
std::shared_ptr<MagneticField> magnetic_field);
// return a velocity vector drawn uniformly in the bin specifed by index
CartesianVector drawVelocity(const blitz::TinyVector<int, 5> index,
std::mt19937* engine);
CartesianVector drawVelocity(const blitz::TinyVector<int, 5> index,
std::mt19937* engine,
const Coordinate& position,
std::shared_ptr<MagneticField> magnetic_field);
private:
// mass of the species of which the density field is a part of
const double mass_kg_;
double alpha_lower_limit;
double alpha_upper_limit;
std::shared_ptr<DynamicDensityField> density_field_;