@@ -95,10 +95,7 @@ RecordComponent &RecordComponent::resetDataset(Dataset d)
9595 }
9696 // if( d.extent.empty() )
9797 // throw std::runtime_error("Dataset extent must be at least 1D.");
98- if (std::any_of (
99- d.extent .begin (), d.extent .end (), [](Extent::value_type const &i) {
100- return i == 0u ;
101- }))
98+ if (d.empty ())
10299 return makeEmpty (std::move (d));
103100
104101 rc.m_isEmpty = false ;
@@ -299,6 +296,7 @@ void RecordComponent::flush(
299296 dCreate.extent = getExtent ();
300297 dCreate.dtype = getDatatype ();
301298 dCreate.options = rc.m_dataset .value ().options ;
299+ dCreate.joinedDimension = joinedDimension ();
302300 IOHandler ()->enqueue (IOTask (this , dCreate));
303301 }
304302 }
@@ -474,22 +472,57 @@ void RecordComponent::verifyChunk(
474472 uint8_t dim = getDimensionality ();
475473 Extent dse = getExtent ();
476474
477- if (e. size () != dim || o. size () != dim )
475+ if (auto jd = joinedDimension (); jd. has_value () )
478476 {
479- std::ostringstream oss;
480- oss << " Dimensionality of chunk ("
481- << " offset=" << o.size () << " D, "
482- << " extent=" << e.size () << " D) "
483- << " and record component (" << int (dim) << " D) "
484- << " do not match." ;
485- throw std::runtime_error (oss.str ());
477+ if (o.size () != 0 )
478+ {
479+ std::ostringstream oss;
480+ oss << " Joined array: Must specify an empty offset (given: "
481+ << " offset=" << o.size () << " D, "
482+ << " extent=" << e.size () << " D)." ;
483+ throw std::runtime_error (oss.str ());
484+ }
485+ if (e.size () != dim)
486+ {
487+ std::ostringstream oss;
488+ oss << " Joined array: Dimensionalities of chunk extent and dataset "
489+ " extent must be equivalent (given: "
490+ << " offset=" << o.size () << " D, "
491+ << " extent=" << e.size () << " D)." ;
492+ throw std::runtime_error (oss.str ());
493+ }
494+ for (size_t i = 0 ; i < dim; ++i)
495+ {
496+ if (i != jd.value () && e[i] != dse[i])
497+ {
498+ throw std::runtime_error (
499+ " Joined array: Chunk extent on non-joined dimensions must "
500+ " be equivalent to dataset extents (Dimension on index " +
501+ std::to_string (i) + " . DS: " + std::to_string (dse[i]) +
502+ " - Chunk: " + std::to_string (o[i] + e[i]) + " )" );
503+ }
504+ }
505+ }
506+ else
507+ {
508+ if (e.size () != dim || o.size () != dim)
509+ {
510+ std::ostringstream oss;
511+ oss << " Dimensionality of chunk ("
512+ << " offset=" << o.size () << " D, "
513+ << " extent=" << e.size () << " D) "
514+ << " and record component (" << int (dim) << " D) "
515+ << " do not match." ;
516+ throw std::runtime_error (oss.str ());
517+ }
518+ for (uint8_t i = 0 ; i < dim; ++i)
519+ if (dse[i] < o[i] + e[i])
520+ throw std::runtime_error (
521+ " Chunk does not reside inside dataset (Dimension on "
522+ " index " +
523+ std::to_string (i) + " . DS: " + std::to_string (dse[i]) +
524+ " - Chunk: " + std::to_string (o[i] + e[i]) + " )" );
486525 }
487- for (uint8_t i = 0 ; i < dim; ++i)
488- if (dse[i] < o[i] + e[i])
489- throw std::runtime_error (
490- " Chunk does not reside inside dataset (Dimension on index " +
491- std::to_string (i) + " . DS: " + std::to_string (dse[i]) +
492- " - Chunk: " + std::to_string (o[i] + e[i]) + " )" );
493526}
494527
495528namespace
0 commit comments