mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Remove several TODOs related to C++17 support (#3574)
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
ed433fe1cd
commit
66e7d8634c
3 changed files with 11 additions and 18 deletions
13
src/bank.cpp
13
src/bank.cpp
|
|
@ -79,16 +79,9 @@ void sort_fission_bank()
|
|||
|
||||
// Perform exclusive scan summation to determine starting indices in fission
|
||||
// bank for each parent particle id
|
||||
int64_t tmp = simulation::progeny_per_particle[0];
|
||||
simulation::progeny_per_particle[0] = 0;
|
||||
for (int64_t i = 1; i < simulation::progeny_per_particle.size(); i++) {
|
||||
int64_t value = simulation::progeny_per_particle[i - 1] + tmp;
|
||||
tmp = simulation::progeny_per_particle[i];
|
||||
simulation::progeny_per_particle[i] = value;
|
||||
}
|
||||
|
||||
// TODO: C++17 introduces the exclusive_scan() function which could be
|
||||
// used to replace everything above this point in this function.
|
||||
std::exclusive_scan(simulation::progeny_per_particle.begin(),
|
||||
simulation::progeny_per_particle.end(),
|
||||
simulation::progeny_per_particle.begin(), 0);
|
||||
|
||||
// We need a scratch vector to make permutation of the fission bank into
|
||||
// sorted order easy. Under normal usage conditions, the fission bank is
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "openmc/event.h"
|
||||
|
||||
#include "openmc/material.h"
|
||||
#include "openmc/simulation.h"
|
||||
#include "openmc/timer.h"
|
||||
|
|
@ -73,17 +74,17 @@ void process_calculate_xs_events(SharedArray<EventQueueItem>& queue)
|
|||
{
|
||||
simulation::time_event_calculate_xs.start();
|
||||
|
||||
// TODO: If using C++17, perform a parallel sort of the queue
|
||||
// by particle type, material type, and then energy, in order to
|
||||
// improve cache locality and reduce thread divergence on GPU. Prior
|
||||
// to C++17, std::sort is a serial only operation, which in this case
|
||||
// makes it too slow to be practical for most test problems.
|
||||
// TODO: If using C++17, we could perform a parallel sort of the queue by
|
||||
// particle type, material type, and then energy, in order to improve cache
|
||||
// locality and reduce thread divergence on GPU. However, the parallel
|
||||
// algorithms typically require linking against an additional library (Intel
|
||||
// TBB). Prior to C++17, std::sort is a serial only operation, which in this
|
||||
// case makes it too slow to be practical for most test problems.
|
||||
//
|
||||
// std::sort(std::execution::par_unseq, queue.data(), queue.data() +
|
||||
// queue.size());
|
||||
|
||||
int64_t offset = simulation::advance_particle_queue.size();
|
||||
;
|
||||
|
||||
#pragma omp parallel for schedule(runtime)
|
||||
for (int64_t i = 0; i < queue.size(); i++) {
|
||||
|
|
|
|||
|
|
@ -225,8 +225,7 @@ void get_name(hid_t obj_id, std::string& name)
|
|||
{
|
||||
size_t size = 1 + H5Iget_name(obj_id, nullptr, 0);
|
||||
name.resize(size);
|
||||
// TODO: switch to name.data() when using C++17
|
||||
H5Iget_name(obj_id, &name[0], size);
|
||||
H5Iget_name(obj_id, name.data(), size);
|
||||
}
|
||||
|
||||
int get_num_datasets(hid_t group_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue