Skip to content

Commit

Permalink
possibly fix some restart stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
lroberts36 committed Jun 12, 2024
1 parent cc87aaf commit 6add08b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 0 additions & 2 deletions src/outputs/restart_hdf5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ void RestartReaderHDF5::ReadBlocks(const std::string &name, IndexRange range,
"Buffer (size " + std::to_string(dataVec.size()) +
") is too small for dataset " + name + " (size " +
std::to_string(total_count) + ")");
PARTHENON_HDF5_CHECK(
H5Sselect_hyperslab(hdl.dataspace, H5S_SELECT_SET, offset, NULL, count, NULL));

const H5S memspace = H5S::FromHIDCheck(H5Screate_simple(total_dim, count, NULL));
PARTHENON_HDF5_CHECK(
Expand Down
10 changes: 4 additions & 6 deletions src/parthenon_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,8 @@ void ParthenonManager::RestartPackages(Mesh &rm, RestartReader &resfile) {
}

// Allocate space based on largest vector
int max_vlen = 1;
int num_sparse = 0;
size_t max_nCells = 1;
size_t max_size = 1;
for (const auto &v_info : all_vars_info) {
const auto &label = v_info.label;

Expand All @@ -304,7 +303,6 @@ void ParthenonManager::RestartPackages(Mesh &rm, RestartReader &resfile) {
"Dense field " + label +
" is marked as sparse in restart file");
}
max_vlen = std::max(max_vlen, v_info.num_components);
IndexRange out_ib = v_info.cellbounds.GetBoundsI(theDomain);
IndexRange out_jb = v_info.cellbounds.GetBoundsJ(theDomain);
IndexRange out_kb = v_info.cellbounds.GetBoundsK(theDomain);
Expand All @@ -314,17 +312,17 @@ void ParthenonManager::RestartPackages(Mesh &rm, RestartReader &resfile) {
bsize.push_back(out_jb.e - out_jb.s + 1);
bsize.push_back(out_kb.e - out_kb.s + 1);

max_nCells = std::max(max_nCells, bsize[0] * bsize[1] * bsize[2]);
max_size = std::max(max_size, v_info.TensorSize() * bsize[0] * bsize[1] * bsize[2]);
}

// make sure we have all sparse variables that are in the restart file
PARTHENON_REQUIRE_THROWS(
num_sparse == sparse_info.num_sparse,
"Mismatch between sparse fields in simulation and restart file");

std::vector<Real> tmp(static_cast<size_t>(nb) * max_nCells * max_vlen);
std::vector<Real> tmp(static_cast<size_t>(nb) * max_size);
for (const auto &v_info : all_vars_info) {
const auto vlen = v_info.num_components;
const auto vlen = v_info.TensorSize();
const auto &label = v_info.label;

if (Globals::my_rank == 0) {
Expand Down

0 comments on commit 6add08b

Please sign in to comment.