@@ -80,6 +80,20 @@ namespace detail
8080} // namespace detail
8181
8282
83+ namespace ADIOS2Schema
84+ {
85+ using schema_t = uint64_t ;
86+ /*
87+ * Original ADIOS schema.
88+ */
89+ constexpr schema_t schema_0000_00_00 = 00000000 ;
90+ /*
91+ * This introduces attribute layout via scalar ADIOS variables.
92+ */
93+ constexpr schema_t schema_2021_02_09 = 20210209 ;
94+ }
95+
96+
8397class ADIOS2IOHandlerImpl
8498: public AbstractIOHandlerImplCommon< ADIOS2FilePosition >
8599{
@@ -203,14 +217,20 @@ class ADIOS2IOHandlerImpl
203217 * The ADIOS2 engine type, to be passed to adios2::IO::SetEngine
204218 */
205219 std::string m_engineType;
220+ ADIOS2Schema::schema_t m_schema = ADIOS2Schema::schema_0000_00_00;
206221
207222 enum class AttributeLayout : char
208223 {
209224 ByAdiosAttributes,
210225 ByAdiosVariables
211226 };
212227
213- AttributeLayout m_attributeLayout = AttributeLayout::ByAdiosAttributes;
228+ inline AttributeLayout attributeLayout () const
229+ {
230+ return m_schema < ADIOS2Schema::schema_2021_02_09
231+ ? AttributeLayout::ByAdiosAttributes
232+ : AttributeLayout::ByAdiosVariables;
233+ }
214234
215235 struct ParameterizedOperator
216236 {
@@ -357,15 +377,12 @@ namespace ADIOS2Defaults
357377 constexpr const_str str_params = " parameters" ;
358378 constexpr const_str str_usesteps = " usesteps" ;
359379 constexpr const_str str_usesstepsAttribute = " __openPMD_internal/useSteps" ;
360- /*
361- * 0: pre 2021-02-09
362- * 1: 2021-02-09
363- */
364- constexpr const_str str_layoutVersion = " __openPMD_internal/layoutVersion" ;
365- } // namespace ADIOS2Defaults
380+ constexpr const_str str_adios2Schema =
381+ " __openPMD_internal/openPMD2_adios2_schema" ;
382+ } // namespace ADIOS2Defaults
366383
367- namespace detail
368- {
384+ namespace detail
385+ {
369386 // Helper structs for calls to the switchType function
370387
371388 struct DatasetReader
@@ -1090,8 +1107,7 @@ namespace ADIOS2Defaults
10901107 detail::DatasetReader const m_readDataset;
10911108 detail::AttributeReader const m_attributeReader;
10921109 PreloadAdiosAttributes preloadAttributes;
1093- using AttributeLayout = ADIOS2IOHandlerImpl::AttributeLayout;
1094- AttributeLayout & m_attributeLayout;
1110+ ADIOS2Schema::schema_t & m_schema;
10951111 IterationEncoding & m_iterationEncoding;
10961112
10971113 /*
@@ -1308,16 +1324,12 @@ namespace ADIOS2Defaults
13081324
13091325 void configure_IO ( ADIOS2IOHandlerImpl & impl );
13101326
1311- uint32_t layoutVersion () const
1327+ using AttributeLayout = ADIOS2IOHandlerImpl::AttributeLayout;
1328+ inline AttributeLayout attributeLayout () const
13121329 {
1313- switch ( m_attributeLayout )
1314- {
1315- case AttributeLayout::ByAdiosAttributes:
1316- return 0 ;
1317- case AttributeLayout::ByAdiosVariables:
1318- return 1 ;
1319- }
1320- throw std::runtime_error ( " Unreachable!" );
1330+ return m_schema < ADIOS2Schema::schema_2021_02_09
1331+ ? AttributeLayout::ByAdiosAttributes
1332+ : AttributeLayout::ByAdiosVariables;
13211333 }
13221334 };
13231335
0 commit comments