Skip to content

Commit 6a8ac9d

Browse files
committed
Fix for empty datasets
1 parent 4fd42af commit 6a8ac9d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

include/picongpu/plugins/openPMD/writer/ParticleAttribute.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
# include <pmacc/traits/GetNComponents.hpp>
3535
# include <pmacc/traits/Resolve.hpp>
3636

37+
# include <algorithm>
38+
3739
namespace picongpu
3840
{
3941
namespace openPMD
@@ -167,6 +169,15 @@ namespace picongpu
167169
::openPMD::RecordComponent recordComponent
168170
= components > 1 ? record[name_lookup[d]] : record[::openPMD::MeshRecordComponent::SCALAR];
169171

172+
/*
173+
* storeChunk() on constant components (this includes empty datasets) are illegal, so skip in
174+
* that case.
175+
*/
176+
if(std::ranges::any_of(recordComponent.getExtent(), [](auto const e) { return e == 0; }))
177+
{
178+
continue;
179+
}
180+
170181
recordComponent.storeChunk<ComponentType>(
171182
::openPMD::Offset{globalOffset},
172183
::openPMD::Extent{elements});

0 commit comments

Comments
 (0)