Skip to content

Commit

Permalink
Merge branch 'develop' into lroberts36/add-fine-variables
Browse files Browse the repository at this point in the history
  • Loading branch information
lroberts36 authored Jun 12, 2024
2 parents 90ff0dc + ff02625 commit 8982895
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- [[PR 1004]](https://github.com/parthenon-hpc-lab/parthenon/pull/1004) Allow parameter modification from an input file for restarts

### Fixed (not changing behavior/API/variables/...)
- [[PR 1104]](https://github.com/parthenon-hpc-lab/parthenon/pull/1104) Fix reading restarts due to hidden ghost var
- [[PR 1098]](https://github.com/parthenon-hpc-lab/parthenon/pull/1098) Move to symmetrized logical coordinates and fix SMR bug
- [[PR 1095]](https://github.com/parthenon-hpc-lab/parthenon/pull/1095) Add missing include guards in hdf5 restart
- [[PR 1093]](https://github.com/parthenon-hpc-lab/parthenon/pull/1093) Fix forest size for symmetry dimensions
Expand Down
3 changes: 1 addition & 2 deletions src/outputs/restart.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ class RestartReader {
// perhaps belongs in a destructor?
void Close();

// Does file have ghost cells?
int hasGhost;
[[nodiscard]] virtual int HasGhost() const = 0;
};

} // namespace parthenon
Expand Down
6 changes: 2 additions & 4 deletions src/outputs/restart_hdf5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ RestartReaderHDF5::RestartReaderHDF5(const char *filename) : filename_(filename)
fh_ = H5F::FromHIDCheck(H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT));
params_group_ = H5G::FromHIDCheck(H5Oopen(fh_, "Params", H5P_DEFAULT));

hasGhost = GetAttr<int>("Info", "IncludesGhost");
has_ghost = GetAttr<int>("Info", "IncludesGhost");
#endif // ENABLE_HDF5
}

Expand Down Expand Up @@ -224,7 +224,7 @@ void RestartReaderHDF5::ReadBlocks(const std::string &name, IndexRange range,

offset[0] = static_cast<hsize_t>(range.s);
count[0] = static_cast<hsize_t>(range.e - range.s + 1);
const IndexDomain domain = hasGhost ? IndexDomain::entire : IndexDomain::interior;
const IndexDomain domain = has_ghost != 0 ? IndexDomain::entire : IndexDomain::interior;

// Currently supports versions 3 and 4.
if (file_output_format_version >= HDF5::OUTPUT_VERSION_FORMAT - 1) {
Expand All @@ -245,8 +245,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
8 changes: 5 additions & 3 deletions src/outputs/restart_hdf5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class RestartReaderHDF5 : public RestartReader {
// Return output format version number. Return -1 if not existent.
[[nodiscard]] int GetOutputFormatVersion() const override;

[[nodiscard]] int HasGhost() const override { return has_ghost; };

private:
#ifdef ENABLE_HDF5
struct DatasetHandle {
Expand Down Expand Up @@ -225,12 +227,12 @@ class RestartReaderHDF5 : public RestartReader {
// perhaps belongs in a destructor?
void Close();

// Does file have ghost cells?
int hasGhost;

private:
const std::string filename_;

// Does file have ghost cells?
int has_ghost;

#ifdef ENABLE_HDF5
// Currently all restarts are HDF5 files
// when that changes, this will be revisited
Expand Down
4 changes: 2 additions & 2 deletions src/parthenon_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void ParthenonManager::RestartPackages(Mesh &rm, RestartReader &resfile) {
// Restart packages with information for blocks in ids from the restart file
// Assumption: blocks are contiguous in restart file, may have to revisit this.
const IndexDomain theDomain =
(resfile.hasGhost ? IndexDomain::entire : IndexDomain::interior);
(resfile.HasGhost() != 0 ? IndexDomain::entire : IndexDomain::interior);
// Get block list and temp array size
auto &mb = *(rm.block_list.front());
int nb = rm.GetNumMeshBlocksThisRank(Globals::my_rank);
Expand Down Expand Up @@ -364,7 +364,7 @@ void ParthenonManager::RestartPackages(Mesh &rm, RestartReader &resfile) {
// we update the HDF5 infrastructure!
if (file_output_format_ver >= HDF5::OUTPUT_VERSION_FORMAT - 1) {
OutputUtils::PackOrUnpackVar(
v_info, resfile.hasGhost, index,
v_info, resfile.HasGhost() != 0, index,
[&](auto index, int topo, int t, int u, int v, int k, int j, int i) {
v_h(topo, t, u, v, k, j, i) = tmp[index];
});
Expand Down

0 comments on commit 8982895

Please sign in to comment.