Skip to content

Commit

Permalink
🎨 added const keyword and short description.
Browse files Browse the repository at this point in the history
  • Loading branch information
Drewniok committed Feb 23, 2023
1 parent cca55af commit d5240bd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions include/fiction/algorithms/simulation/sidb/quicksim.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,16 @@ void quicksim(const Lyt& lyt, const quicksim_params& ps = quicksim_params{}, qui
}

// If the number of threads is initially set to zero, the simulation is run with one thread.
uint64_t num_threads = std::max(ps.number_threads, uint64_t{1});
const uint64_t num_threads = std::max(ps.number_threads, uint64_t{1});

// split the iterations among threads
const auto iter_per_thread =
std::max(ps.interation_steps / num_threads,
uint64_t{1}); // If the number of set threads is greater than the number of iterations, the
// number of threads defines how many times QuickSim is repeated

const auto bound = static_cast<uint64_t>(std::round(0.6 * static_cast<double>(charge_lyt.num_cells())));
// Only 60 % of all cells are used as the negatively charged cell in the first iteration step.
const auto upper_bound = static_cast<uint64_t>(std::round(0.6 * static_cast<double>(charge_lyt.num_cells())));

std::vector<std::thread> threads{};
threads.reserve(num_threads);
Expand All @@ -159,7 +160,7 @@ void quicksim(const Lyt& lyt, const quicksim_params& ps = quicksim_params{}, qui

for (uint64_t l = 0ul; l < iter_per_thread; ++l)
{
for (uint64_t i = 0ul; i < bound; ++i)
for (uint64_t i = 0ul; i < upper_bound; ++i)
{
std::vector<uint64_t> index_start{i};
charge_lyt_copy.set_all_charge_states(sidb_charge_state::NEUTRAL);
Expand Down

0 comments on commit d5240bd

Please sign in to comment.