mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Use pointer instead of full copy for bank_index
This commit is contained in:
parent
3059c75eb1
commit
fd6e516a71
1 changed files with 5 additions and 5 deletions
|
|
@ -615,7 +615,7 @@ write_source_bank(hid_t group_id, bool surf_src_bank)
|
|||
int64_t max_bank_size = simulation::work_per_rank;
|
||||
|
||||
// Set vectors for source bank and starting bank index of each process
|
||||
std::vector<int64_t> bank_index = simulation::work_index;
|
||||
std::vector<int64_t>* bank_index = &simulation::work_index;
|
||||
std::vector<Particle::Bank> src_bank = simulation::source_bank;
|
||||
|
||||
// Reset dataspace sizes and vectors for surface source bank
|
||||
|
|
@ -625,7 +625,7 @@ write_source_bank(hid_t group_id, bool surf_src_bank)
|
|||
dims_size = qsize[0];
|
||||
count_size = simulation::surf_src_bank.size();
|
||||
|
||||
bank_index = simulation::surf_src_index;
|
||||
bank_index = &simulation::surf_src_index;
|
||||
|
||||
src_bank.assign(simulation::surf_src_bank.data(),
|
||||
simulation::surf_src_bank.data()
|
||||
|
|
@ -645,7 +645,7 @@ write_source_bank(hid_t group_id, bool surf_src_bank)
|
|||
hid_t memspace = H5Screate_simple(1, count, nullptr);
|
||||
|
||||
// Select hyperslab for this dataspace
|
||||
hsize_t start[] {static_cast<hsize_t>(bank_index[mpi::rank])};
|
||||
hsize_t start[] {static_cast<hsize_t>((*bank_index)[mpi::rank])};
|
||||
H5Sselect_hyperslab(dspace, H5S_SELECT_SET, start, nullptr, count, nullptr);
|
||||
|
||||
// Set up the property list for parallel writing
|
||||
|
|
@ -677,7 +677,7 @@ write_source_bank(hid_t group_id, bool surf_src_bank)
|
|||
|
||||
for (int i = 0; i < mpi::n_procs; ++i) {
|
||||
// Create memory space
|
||||
hsize_t count[] {static_cast<hsize_t>(bank_index[i+1] - bank_index[i])};
|
||||
hsize_t count[] {static_cast<hsize_t>((*bank_index)[i+1] - (*bank_index)[i])};
|
||||
hid_t memspace = H5Screate_simple(1, count, nullptr);
|
||||
|
||||
#ifdef OPENMC_MPI
|
||||
|
|
@ -689,7 +689,7 @@ write_source_bank(hid_t group_id, bool surf_src_bank)
|
|||
|
||||
// Select hyperslab for this dataspace
|
||||
dspace = H5Dget_space(dset);
|
||||
hsize_t start[] {static_cast<hsize_t>(bank_index[i])};
|
||||
hsize_t start[] {static_cast<hsize_t>((*bank_index)[i])};
|
||||
H5Sselect_hyperslab(dspace, H5S_SELECT_SET, start, nullptr, count, nullptr);
|
||||
|
||||
// Write data to hyperslab
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue