Skip to content

Commit

Permalink
Merge pull request #1064 from parthenon-hpc-lab/jmm/add-fail-on-edge-…
Browse files Browse the repository at this point in the history
…case

add fail on edge case in Mesh Data
  • Loading branch information
Yurlungur authored Apr 25, 2024
2 parents dedc15f + f59e7d1 commit d9c04f6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- [[PR 1031]](https://github.com/parthenon-hpc-lab/parthenon/pull/1031) Fix bug in non-cell centered AMR

### Infrastructure (changes irrelevant to downstream codes)
- [[PR 1064]](https://github.com/parthenon-hpc-lab/parthenon/pull/1064) Forbid erroneous edge case when adding MeshData on a partition
- [[PR 1035]](https://github.com/parthenon-hpc-lab/parthenon/pull/1035) Fix multigrid infrastructure to work with forest
- [[PR 1048]](https://github.com/parthenon-hpc-lab/parthenon/pull/1048) Tiny fixes to custom coords logic
- [[PR 1028]](https://github.com/parthenon-hpc-lab/parthenon/pull/1028) Internal reorganization of LogicalLocation files
Expand Down
5 changes: 5 additions & 0 deletions src/interface/mesh_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ void MeshData<T>::Set(BlockList_t blocks, Mesh *pmesh) {
Set(blocks, pmesh, ndim);
}

template <typename T>
bool MeshData<T>::BlockDataIsWholeRank_() const {
return block_data_.size() == (pmy_mesh_->block_list).size();
}

template class MeshData<Real>;

} // namespace parthenon
5 changes: 5 additions & 0 deletions src/interface/mesh_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ class MeshData {
// modifying DataCollection::GetOrAdd. In the future we should
// make that "just work (tm)."
grid = src->grid;
PARTHENON_REQUIRE((grid.type == GridType::two_level_composite) ||
src->BlockDataIsWholeRank_(),
"Add may only be called on all blocks on a rank");
for (int i = 0; i < nblocks; ++i) {
auto pmbd = src->GetBlockData(i);
block_data_[i] = pmbd->GetBlockSharedPointer()->meshblock_data.Add(
Expand Down Expand Up @@ -460,6 +463,8 @@ class MeshData {
SparsePackCache &GetSparsePackCache() { return sparse_pack_cache_; }

private:
bool BlockDataIsWholeRank_() const;

int ndim_;
Mesh *pmy_mesh_;
BlockDataList_t<T> block_data_;
Expand Down

0 comments on commit d9c04f6

Please sign in to comment.