File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,10 +51,20 @@ namespace internal
5151 Attributable a;
5252 a.setData (std::shared_ptr<AttributableData>{this , [](auto const &) {}});
5353// this check can be too costly in some setups
54- #if 0
55- if (a.containingIteration().closed())
54+ #if openPMD_USE_INVASIVE_TESTS
55+
56+ auto maybe_an_iteration = a.containingIteration ().first ;
57+ if (!maybe_an_iteration.has_value ())
5658 {
57- throw error::WrongAPIUsage(
59+ throw std::runtime_error (
60+ " Trying to write to/read from a RecordComponent that is not "
61+ " contained by any Iteration." );
62+ }
63+ auto &iterationData = *maybe_an_iteration.value ();
64+ auto iteration = iterationData.asInternalCopyOf <Iteration>();
65+ if (iteration.closed () && !iterationData.allow_reopening_implicitly )
66+ {
67+ throw std::runtime_error (
5868 " Cannot write/read chunks to/from closed Iterations." );
5969 }
6070#endif
You can’t perform that action at this time.
0 commit comments