diff --git a/bindings/C/adios2/c/adios2_c_adios.cpp b/bindings/C/adios2/c/adios2_c_adios.cpp index 2f6dd6a615..55ab45261a 100644 --- a/bindings/C/adios2/c/adios2_c_adios.cpp +++ b/bindings/C/adios2/c/adios2_c_adios.cpp @@ -17,6 +17,30 @@ extern "C" { #endif +adios2::ArrayOrdering adios2_ToArrayOrdering(const adios2_arrayordering Corder) +{ + adios2::ArrayOrdering order = adios2::ArrayOrdering::Auto; + switch (Corder) + { + + case adios2_arrayordering_rowmajor: + order = adios2::ArrayOrdering::RowMajor; + break; + + case adios2_arrayordering_columnmajor: + order = adios2::ArrayOrdering::ColumnMajor; + break; + + case adios2_arrayordering_auto: + order = adios2::ArrayOrdering::Auto; + break; + + default: + break; + } + return order; +} + adios2_adios *adios2_init_config_glue_serial(const char *config_file, const adios2_debug_mode debug_mode, const char *host_language) @@ -68,6 +92,25 @@ adios2_io *adios2_declare_io(adios2_adios *adios, const char *name) return io; } +adios2_io *adios2_declare_io_order(adios2_adios *adios, const char *name, + adios2_arrayordering order) +{ + adios2_io *io = nullptr; + try + { + adios2::helper::CheckForNullptr( + adios, "for adios2_adios, in call to adios2_declare_io"); + io = reinterpret_cast( + &reinterpret_cast(adios)->DeclareIO( + name, adios2_ToArrayOrdering(order))); + } + catch (...) + { + adios2::helper::ExceptionToError("adios2_declare_io"); + } + return io; +} + adios2_io *adios2_at_io(adios2_adios *adios, const char *name) { adios2_io *io = nullptr; diff --git a/bindings/C/adios2/c/adios2_c_adios.h b/bindings/C/adios2/c/adios2_c_adios.h index 3bfa473969..1f135b9130 100644 --- a/bindings/C/adios2/c/adios2_c_adios.h +++ b/bindings/C/adios2/c/adios2_c_adios.h @@ -72,6 +72,16 @@ adios2_adios *adios2_init_config_serial(const char *config_file); */ adios2_io *adios2_declare_io(adios2_adios *adios, const char *name); +/** + * Declares a new io handler with specific array ordering + * @param adios owner the io handler + * @param name unique io identifier within current adios handler + * @param order array ordering + * @return success: handler, failure: NULL + */ +adios2_io *adios2_declare_io_order(adios2_adios *adios, const char *name, + adios2_arrayordering order); + /** * Retrieves a previously declared io handler by name * @param adios owner the io handler diff --git a/bindings/C/adios2/c/adios2_c_io.tcc b/bindings/C/adios2/c/adios2_c_io.tcc index 063ee119c6..b8f1039f61 100644 --- a/bindings/C/adios2/c/adios2_c_io.tcc +++ b/bindings/C/adios2/c/adios2_c_io.tcc @@ -37,6 +37,7 @@ adios2::Mode adios2_ToOpenMode(const adios2_mode modeC) } return mode; } + } // end anonymous namespace #endif diff --git a/bindings/C/adios2/c/adios2_c_types.h b/bindings/C/adios2/c/adios2_c_types.h index 47c3aefe32..0c06d9acb7 100644 --- a/bindings/C/adios2/c/adios2_c_types.h +++ b/bindings/C/adios2/c/adios2_c_types.h @@ -138,6 +138,13 @@ typedef enum adios2_shapeid_local_array = 4 } adios2_shapeid; +typedef enum +{ + adios2_arrayordering_rowmajor, + adios2_arrayordering_columnmajor, + adios2_arrayordering_auto +} adios2_arrayordering; + static const size_t adios2_string_array_element_max_size = 4096; static const size_t adios2_local_value_dim = SIZE_MAX - 2; diff --git a/bindings/CXX11/adios2/cxx11/ADIOS.cpp b/bindings/CXX11/adios2/cxx11/ADIOS.cpp index ec0a16ba03..e5f3caa4f4 100644 --- a/bindings/CXX11/adios2/cxx11/ADIOS.cpp +++ b/bindings/CXX11/adios2/cxx11/ADIOS.cpp @@ -29,10 +29,10 @@ ADIOS::ADIOS(const std::string &configFile, const std::string &hostLanguage, ADIOS::operator bool() const noexcept { return m_ADIOS ? true : false; } -IO ADIOS::DeclareIO(const std::string name) +IO ADIOS::DeclareIO(const std::string name, const ArrayOrdering ArrayOrder) { CheckPointer("for io name " + name + ", in call to ADIOS::DeclareIO"); - return IO(&m_ADIOS->DeclareIO(name)); + return IO(&m_ADIOS->DeclareIO(name, ArrayOrder)); } IO ADIOS::AtIO(const std::string name) diff --git a/bindings/CXX11/adios2/cxx11/ADIOS.h b/bindings/CXX11/adios2/cxx11/ADIOS.h index 4304631ce8..4d0a645677 100644 --- a/bindings/CXX11/adios2/cxx11/ADIOS.h +++ b/bindings/CXX11/adios2/cxx11/ADIOS.h @@ -156,7 +156,8 @@ class ADIOS * @exception std::invalid_argument if IO with unique name is already * declared */ - IO DeclareIO(const std::string name); + IO DeclareIO(const std::string name, + const ArrayOrdering ArrayOrder = ArrayOrdering::Auto); /** * Retrieve an existing IO object previously created with DeclareIO.