Refactored name of struct from QueueItem to EventQueueItem.

This commit is contained in:
John Tramm 2020-01-27 16:07:15 +00:00
parent 598bead82e
commit 53e59a6790
2 changed files with 17 additions and 17 deletions

View file

@ -17,13 +17,13 @@ namespace openmc {
// In the event-based model, instead of moving or sorting the particles
// themselves based on which event they need, a queue is used to store the
// index (and other useful info) for each event type.
// The QueueItem struct holds the relevant information about a particle needed
// The EventQueueItem struct holds the relevant information about a particle needed
// for sorting the queue. For very high particle counts, a sorted queue has the
// potential to result in greatly improved cache efficiency. However, sorting
// will introduce some overhead due to the sorting process itself, and may not
// result in any benefits if not enough particles are present for them to achieve
// consistent locality improvements.
struct QueueItem{
struct EventQueueItem{
int64_t idx; //!< particle index in event-based particle buffer
Particle::Type type; //!< particle type
int64_t material; //!< material that particle is in
@ -33,7 +33,7 @@ struct QueueItem{
// TODO: Currently, material IDs are not usually unique to material
// types. When unique material type IDs are available, we can alter the
// material field in this struct to contain the material type instead.
bool operator<(const QueueItem& rhs) const
bool operator<(const EventQueueItem& rhs) const
{
return std::tie(type, material, E) < std::tie(rhs.type, rhs.material, rhs.E);
}
@ -49,11 +49,11 @@ namespace simulation {
// vector, as they will be shared between threads and may be appended to at the
// same time. To facilitate this, the SharedArray thread_safe_append() method
// is provided which controls the append operations using atomics.
extern SharedArray<QueueItem> calculate_fuel_xs_queue;
extern SharedArray<QueueItem> calculate_nonfuel_xs_queue;
extern SharedArray<QueueItem> advance_particle_queue;
extern SharedArray<QueueItem> surface_crossing_queue;
extern SharedArray<QueueItem> collision_queue;
extern SharedArray<EventQueueItem> calculate_fuel_xs_queue;
extern SharedArray<EventQueueItem> calculate_nonfuel_xs_queue;
extern SharedArray<EventQueueItem> advance_particle_queue;
extern SharedArray<EventQueueItem> surface_crossing_queue;
extern SharedArray<EventQueueItem> collision_queue;
// Particle buffer
extern std::vector<Particle> particles;
@ -75,7 +75,7 @@ void free_event_queues(void);
//! \param queue The queue to append the particle to
//! \param p A pointer to the particle
//! \param buffer_idx The particle's actual index in the particle buffer
void enqueue_particle(SharedArray<QueueItem>& queue, const Particle* p, int64_t buffer_idx);
void enqueue_particle(SharedArray<EventQueueItem>& queue, const Particle* p, int64_t buffer_idx);
//! Enqueues a particle based on if it is in fuel or a non-fuel material
//! \param buffer_idx The particle's actual index in the particle buffer
@ -88,7 +88,7 @@ void process_init_events(int64_t n_particles, int64_t source_offset);
//! Executes the calculate XS event for all particles in this event's buffer
//! \param queue A reference to the desired XS lookup queue
void process_calculate_xs_events(SharedArray<QueueItem>& queue);
void process_calculate_xs_events(SharedArray<EventQueueItem>& queue);
//! Executes the advance particle event for all particles in this event's buffer
void process_advance_particle_events();

View file

@ -11,11 +11,11 @@ namespace openmc {
namespace simulation {
SharedArray<QueueItem> calculate_fuel_xs_queue;
SharedArray<QueueItem> calculate_nonfuel_xs_queue;
SharedArray<QueueItem> advance_particle_queue;
SharedArray<QueueItem> surface_crossing_queue;
SharedArray<QueueItem> collision_queue;
SharedArray<EventQueueItem> calculate_fuel_xs_queue;
SharedArray<EventQueueItem> calculate_nonfuel_xs_queue;
SharedArray<EventQueueItem> advance_particle_queue;
SharedArray<EventQueueItem> surface_crossing_queue;
SharedArray<EventQueueItem> collision_queue;
std::vector<Particle> particles;
@ -47,7 +47,7 @@ void free_event_queues(void)
simulation::particles.clear();
}
void enqueue_particle(SharedArray<QueueItem>& queue, const Particle* p, int64_t buffer_idx)
void enqueue_particle(SharedArray<EventQueueItem>& queue, const Particle* p, int64_t buffer_idx)
{
int64_t idx = queue.thread_safe_append();
@ -78,7 +78,7 @@ void process_init_events(int64_t n_particles, int64_t source_offset)
simulation::time_event_init.stop();
}
void process_calculate_xs_events(SharedArray<QueueItem>& queue)
void process_calculate_xs_events(SharedArray<EventQueueItem>& queue)
{
simulation::time_event_calculate_xs.start();