@@ -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{
@@ -195,23 +209,28 @@ class ADIOS2IOHandlerImpl
195209 * @brief The ADIOS2 access type to chose for Engines opened
196210 * within this instance.
197211 */
198- adios2::Mode adios2AccessMode ( );
199-
212+ adios2::Mode adios2AccessMode ( std::string const & fullPath );
200213
201214private:
202215 adios2::ADIOS m_ADIOS;
203216 /* *
204217 * The ADIOS2 engine type, to be passed to adios2::IO::SetEngine
205218 */
206219 std::string m_engineType;
220+ ADIOS2Schema::schema_t m_schema = ADIOS2Schema::schema_0000_00_00;
207221
208222 enum class AttributeLayout : char
209223 {
210224 ByAdiosAttributes,
211225 ByAdiosVariables
212226 };
213227
214- 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+ }
215234
216235 struct ParameterizedOperator
217236 {
@@ -358,6 +377,8 @@ namespace ADIOS2Defaults
358377 constexpr const_str str_params = " parameters" ;
359378 constexpr const_str str_usesteps = " usesteps" ;
360379 constexpr const_str str_usesstepsAttribute = " __openPMD_internal/useSteps" ;
380+ constexpr const_str str_adios2Schema =
381+ " __openPMD_internal/openPMD2_adios2_schema" ;
361382} // namespace ADIOS2Defaults
362383
363384namespace detail
@@ -996,8 +1017,7 @@ namespace detail
9961017 detail::DatasetReader const m_readDataset;
9971018 detail::AttributeReader const m_attributeReader;
9981019 PreloadAdiosAttributes preloadAttributes;
999- using AttributeLayout = ADIOS2IOHandlerImpl::AttributeLayout;
1000- AttributeLayout m_attributeLayout = AttributeLayout::ByAdiosAttributes;
1020+ ADIOS2Schema::schema_t & m_schema;
10011021
10021022 /*
10031023 * We call an attribute committed if the step during which it was
@@ -1233,13 +1253,19 @@ namespace detail
12331253
12341254 void
12351255 configure_IO ( ADIOS2IOHandlerImpl & impl );
1236- };
12371256
1257+ using AttributeLayout = ADIOS2IOHandlerImpl::AttributeLayout;
1258+ inline AttributeLayout attributeLayout () const
1259+ {
1260+ return m_schema < ADIOS2Schema::schema_2021_02_09
1261+ ? AttributeLayout::ByAdiosAttributes
1262+ : AttributeLayout::ByAdiosVariables;
1263+ }
1264+ };
12381265
12391266} // namespace detail
12401267#endif // openPMD_HAVE_ADIOS2
12411268
1242-
12431269class ADIOS2IOHandler : public AbstractIOHandler
12441270{
12451271#if openPMD_HAVE_ADIOS2
@@ -1290,6 +1316,6 @@ friend class ADIOS2IOHandlerImpl;
12901316
12911317 std::string backendName () const override { return " ADIOS2" ; }
12921318
1293- std::future< void > flush ( ) override ;
1319+ std::future< void > flush () override ;
12941320}; // ADIOS2IOHandler
12951321} // namespace openPMD
0 commit comments