Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
removed todos related to c++17 support
  • Loading branch information
GuySten committed Sep 18, 2025
commit b4d357af3f3ac24726aeee5dae0ce4bd123a1bbc
13 changes: 3 additions & 10 deletions src/bank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions src/event.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#include "openmc/event.h"

#include "openmc/material.h"
#include "openmc/simulation.h"
#include "openmc/timer.h"

#include <execution>

namespace openmc {

//==============================================================================
Expand Down Expand Up @@ -73,14 +76,11 @@ 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
// 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.
//
// std::sort(std::execution::par_unseq, queue.data(), queue.data() +
// queue.size());
// improve cache locality and reduce thread divergence on GPU.
std::sort(
std::execution::par_unseq, queue.data(), queue.data() + queue.size());

int64_t offset = simulation::advance_particle_queue.size();
;
Expand Down
3 changes: 1 addition & 2 deletions src/hdf5_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading