diff --git a/source/adios2/helper/adiosType.h b/source/adios2/helper/adiosType.h index 8392a9672be303e79e61b8309ad6c7b2420256ac..75c53a23ced6de3a0edd5e9542834cfd340b0b3b 100644 --- a/source/adios2/helper/adiosType.h +++ b/source/adios2/helper/adiosType.h @@ -52,7 +52,7 @@ using SubFileInfoMap = * @return string with type */ template <class T> -inline std::string GetType() noexcept; +std::string GetType() noexcept; /** * Check in types set if "type" is one of the aliases for a certain type, diff --git a/source/adios2/toolkit/format/bp3/BP3Base.tcc b/source/adios2/toolkit/format/bp3/BP3Base.tcc index 5c7fcbdcd6a38f0c63ed2815b8a9cda8f501c426..ffd66cba53c7bb0652c894a07d075bd65077cf6f 100644 --- a/source/adios2/toolkit/format/bp3/BP3Base.tcc +++ b/source/adios2/toolkit/format/bp3/BP3Base.tcc @@ -61,7 +61,12 @@ int8_t BP3Base::GetDataType<int>() const noexcept template <> int8_t BP3Base::GetDataType<long int>() const noexcept { - const int8_t type = static_cast<int8_t>(type_long); + int8_t type = static_cast<int8_t>(type_long); + if (sizeof(long int) == sizeof(int)) + { + type = static_cast<int8_t>(type_integer); + } + return type; } @@ -96,7 +101,12 @@ int8_t BP3Base::GetDataType<unsigned int>() const noexcept template <> int8_t BP3Base::GetDataType<unsigned long int>() const noexcept { - const int8_t type = static_cast<int8_t>(type_unsigned_long); + int8_t type = static_cast<int8_t>(type_unsigned_long); + if (sizeof(unsigned long int) == sizeof(unsigned int)) + { + type = static_cast<int8_t>(type_unsigned_integer); + } + return type; } diff --git a/source/adios2/toolkit/format/bp3/BP3Deserializer.cpp b/source/adios2/toolkit/format/bp3/BP3Deserializer.cpp index 317e0770c3b70748fdd691b68a1b4a901c28029f..99b668ffdde584408dc5d0a5c23ceefaffd7ce17 100644 --- a/source/adios2/toolkit/format/bp3/BP3Deserializer.cpp +++ b/source/adios2/toolkit/format/bp3/BP3Deserializer.cpp @@ -159,11 +159,7 @@ void BP3Deserializer::ParseVariablesIndex(IO &io) case (type_long): { -#ifdef _WIN32 - DefineVariableInIO<long long int>(header, io, buffer, position); -#else - DefineVariableInIO<long int>(header, io, buffer, position); -#endif + DefineVariableInIO<int64_t>(header, io, buffer, position); break; } @@ -187,12 +183,7 @@ void BP3Deserializer::ParseVariablesIndex(IO &io) case (type_unsigned_long): { -#ifdef _WIN32 - DefineVariableInIO<unsigned long long int>(header, io, buffer, - position); -#else - DefineVariableInIO<unsigned long int>(header, io, buffer, position); -#endif + DefineVariableInIO<uint64_t>(header, io, buffer, position); break; } @@ -332,11 +323,7 @@ void BP3Deserializer::ParseAttributesIndex(IO &io) case (type_long): { -#ifdef _WIN32 - DefineAttributeInIO<long long int>(header, io, buffer, position); -#else - DefineAttributeInIO<long int>(header, io, buffer, position); -#endif + DefineAttributeInIO<int64_t>(header, io, buffer, position); break; } @@ -360,13 +347,7 @@ void BP3Deserializer::ParseAttributesIndex(IO &io) case (type_unsigned_long): { -#ifdef _WIN32 - DefineAttributeInIO<unsigned long long int>(header, io, buffer, - position); -#else - DefineAttributeInIO<unsigned long int>(header, io, buffer, - position); -#endif + DefineAttributeInIO<uint64_t>(header, io, buffer, position); break; } diff --git a/source/adios2/toolkit/format/bp3/BP3Deserializer.tcc b/source/adios2/toolkit/format/bp3/BP3Deserializer.tcc index 469bea8554decb9b697645848af379e306ce4a08..f36d3fb7fd4a279716490e62f9221d24370eb54d 100644 --- a/source/adios2/toolkit/format/bp3/BP3Deserializer.tcc +++ b/source/adios2/toolkit/format/bp3/BP3Deserializer.tcc @@ -136,17 +136,15 @@ void BP3Deserializer::DefineAttributeInIO(const ElementIndexHeader &header, attributeName = header.Path + PathSeparator + header.Name; } - Attribute<T> *attribute = nullptr; if (characteristics.Statistics.IsValue) { - attribute = &io.DefineAttribute<T>(attributeName, - characteristics.Statistics.Value); + io.DefineAttribute<T>(attributeName, characteristics.Statistics.Value); } else { - attribute = &io.DefineAttribute<T>( - attributeName, characteristics.Statistics.Values.data(), - characteristics.Statistics.Values.size()); + io.DefineAttribute<T>(attributeName, + characteristics.Statistics.Values.data(), + characteristics.Statistics.Values.size()); } } diff --git a/source/adios2/toolkit/format/bp3/BP3Serializer.cpp b/source/adios2/toolkit/format/bp3/BP3Serializer.cpp index 84127dda3650012f86436cbcf573e2a07757b268..6e8f681ef514f883c45dac83dde45e6a78c9117b 100644 --- a/source/adios2/toolkit/format/bp3/BP3Serializer.cpp +++ b/source/adios2/toolkit/format/bp3/BP3Serializer.cpp @@ -856,8 +856,8 @@ void BP3Serializer::MergeSerializeIndices( case (type_long): { const auto characteristics = - ReadElementIndexCharacteristics<long int>(buffer, position, - type_long, true); + ReadElementIndexCharacteristics<int64_t>(buffer, position, + type_long, true); count = characteristics.EntryCount; length = characteristics.EntryLength; timeStep = characteristics.Statistics.Step; @@ -899,9 +899,8 @@ void BP3Serializer::MergeSerializeIndices( case (type_unsigned_long): { - auto characteristics = - ReadElementIndexCharacteristics<unsigned long int>( - buffer, position, type_unsigned_long, true); + auto characteristics = ReadElementIndexCharacteristics<uint64_t>( + buffer, position, type_unsigned_long, true); count = characteristics.EntryCount; length = characteristics.EntryLength; timeStep = characteristics.Statistics.Step; diff --git a/testing/adios2/engine/bp/TestBPWriteReadAttributesADIOS2.cpp b/testing/adios2/engine/bp/TestBPWriteReadAttributesADIOS2.cpp index db949a31b14c5a61c17d71f3521379b4f1ccbe0d..91ba991e491adb5d8993e685b5168f7f8864a4da 100644 --- a/testing/adios2/engine/bp/TestBPWriteReadAttributesADIOS2.cpp +++ b/testing/adios2/engine/bp/TestBPWriteReadAttributesADIOS2.cpp @@ -131,7 +131,7 @@ TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadSingleTypes) ASSERT_NE(attr_i64, nullptr); ASSERT_EQ(attr_i64->m_Name, i64_Single); ASSERT_EQ(attr_i64->m_IsSingleValue, true); -#ifdef _WIN32 +#if defined(_WIN32) || defined(__APPLE__) ASSERT_EQ(attr_i64->m_Type, "long long int"); #else ASSERT_EQ(attr_i64->m_Type, "long int"); @@ -159,8 +159,7 @@ TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadSingleTypes) ASSERT_NE(attr_u64, nullptr); ASSERT_EQ(attr_u64->m_Name, u64_Single); ASSERT_EQ(attr_u64->m_IsSingleValue, true); - -#ifdef _WIN32 +#if defined(_WIN32) || defined(__APPLE__) ASSERT_EQ(attr_u64->m_Type, "unsigned long long int"); #else ASSERT_EQ(attr_u64->m_Type, "unsigned long int"); @@ -301,7 +300,7 @@ TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadArrayTypes) ASSERT_NE(attr_i64, nullptr); ASSERT_EQ(attr_i64->m_Name, i64_Array); ASSERT_EQ(attr_i64->m_IsSingleValue, false); -#ifdef _WIN32 +#if defined(_WIN32) || defined(__APPLE__) ASSERT_EQ(attr_i64->m_Type, "long long int"); #else ASSERT_EQ(attr_i64->m_Type, "long int"); @@ -325,11 +324,12 @@ TEST_F(BPWriteReadAttributeTestADIOS2, ADIOS2BPWriteReadArrayTypes) ASSERT_NE(attr_u64, nullptr); ASSERT_EQ(attr_u64->m_Name, u64_Array); ASSERT_EQ(attr_u64->m_IsSingleValue, false); -#ifdef _WIN32 +#if defined(_WIN32) || defined(__APPLE__) ASSERT_EQ(attr_u64->m_Type, "unsigned long long int"); #else ASSERT_EQ(attr_u64->m_Type, "unsigned long int"); #endif + ASSERT_NE(attr_r32, nullptr); ASSERT_EQ(attr_r32->m_Name, r32_Array); ASSERT_EQ(attr_r32->m_IsSingleValue, false);