Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/RecordComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ void RecordComponent::flush(
{
// The check for !written() is technically not needed, just
// defensive programming against internal bugs that go on us.
if (!written() && rc.m_chunks.empty())
if (!written() && rc.m_chunks.empty() && !rc.m_isConstant)
{
// No data written yet, just accessed the object so far without
// doing anything
Expand All @@ -283,7 +283,8 @@ void RecordComponent::flush(
{
throw error::WrongAPIUsage(
"[RecordComponent] Must specify dataset type and extent "
"before flushing (see RecordComponent::resetDataset()).");
"before flushing or setting a constant value (see "
"RecordComponent::resetDataset()).");
}
}
if (!containsAttribute("unitSI"))
Expand Down
2 changes: 2 additions & 0 deletions test/python/unittest/API/APITest.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def refcountingCreateData(self):
for dim in ["x", "y"]:
# Do not bother with a positionOffset
position_offset = e["positionOffset"][dim]
position_offset.reset_dataset(
io.Dataset(np.dtype("int"), [100]))
position_offset.make_constant(0)

position = e["position"][dim]
Expand Down
Loading