Loading source/adios2/helper/adiosType.inl +35 −33 Original line number Diff line number Diff line Loading @@ -4,7 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ #ifndef ADIOS2_HELPER_ADIOSTYPE_INL_ #define ADIOS2_HELPER_ADIOSTYPE_INL_ #ifndef ADIOS2_HELPER_ADIOSTYPE_H_ Loading @@ -13,6 +12,7 @@ #include <algorithm> //std::transform #include <sstream> //std::ostringstream #include <type_traits> //std::is_floating_point_v #include "adios2/common/ADIOSMacros.h" #include "adiosLog.h" Loading Loading @@ -110,8 +110,7 @@ template <class T, class U> std::vector<U> NewVectorTypeFromArray(const T *in, const size_t inSize) { std::vector<U> out(inSize); std::transform(in, in + inSize, out.begin(), [](T value) { return static_cast<U>(value); }); std::transform(in, in + inSize, out.begin(), [](T value) { return static_cast<U>(value); }); return out; } Loading Loading @@ -163,6 +162,10 @@ template <class T> inline std::string ValueToString(const T value) noexcept { std::ostringstream valueSS; if constexpr (std::is_floating_point_v<T>) { valueSS << std::scientific; } valueSS << value; const std::string valueStr(valueSS.str()); return valueStr; Loading Loading @@ -237,8 +240,7 @@ void CheckForNullptr(T *pointer, const std::string hint) { if (pointer == nullptr) { helper::Throw<std::invalid_argument>("Helper", "adiosType", "CheckForNullPtr", helper::Throw<std::invalid_argument>("Helper", "adiosType", "CheckForNullPtr", "found null pointer " + hint); } } Loading source/utils/bpls/bpls.cpp +40 −11 Original line number Diff line number Diff line Loading @@ -918,7 +918,7 @@ int printAttributeValue(core::Engine *fp, core::IO *io, core::Attribute<T> *attr DataType adiosvartype = attribute->m_Type; if (attribute->m_IsSingleValue) { print_data((void *)&attribute->m_DataSingleValue, 0, adiosvartype, true); print_data((void *)&attribute->m_DataSingleValue, 0, adiosvartype, false); } else { Loading @@ -926,7 +926,7 @@ int printAttributeValue(core::Engine *fp, core::IO *io, core::Attribute<T> *attr size_t nelems = attribute->m_DataArray.size(); for (size_t j = 0; j < nelems; j++) { print_data((void *)&attribute->m_DataArray[j], 0, adiosvartype, true); print_data((void *)&attribute->m_DataArray[j], 0, adiosvartype, false); if (j < nelems - 1) { fprintf(outf, ", "); Loading @@ -953,7 +953,7 @@ int printAttributeValue(core::Engine *fp, core::IO *io, core::Attribute<std::str } if (printDataAnyway) { print_data((void *)&attribute->m_DataSingleValue, 0, adiosvartype, true); print_data((void *)&attribute->m_DataSingleValue, 0, adiosvartype, false); } } else Loading @@ -969,7 +969,7 @@ int printAttributeValue(core::Engine *fp, core::IO *io, core::Attribute<std::str } if (printDataAnyway) { print_data((void *)&attribute->m_DataArray[j], 0, adiosvartype, true); print_data((void *)&attribute->m_DataArray[j], 0, adiosvartype, false); } if (j < nelems - 1) { Loading Loading @@ -3072,18 +3072,47 @@ int print_data(const void *data, int item, DataType adiosvartype, bool allowform fprintf(outf, (f ? fmt : "%lld"), ((signed long long *)data)[item]); break; case DataType::Float: fprintf(outf, (f ? fmt : "%g"), ((float *)data)[item]); case DataType::Float: { float v = ((float *)data)[item]; if (allowformat) fprintf(outf, (f ? fmt : "%g"), v); else { if (-10000.0 < v && v < 100000.0) fprintf(outf, "%g", v); else fprintf(outf, "%e", v); } break; } case DataType::Double: fprintf(outf, (f ? fmt : "%g"), ((double *)data)[item]); case DataType::Double: { double v = ((double *)data)[item]; if (allowformat) fprintf(outf, (f ? fmt : "%g"), v); else { if (-10000.0 < v && v < 100000.0) fprintf(outf, "%g", v); else fprintf(outf, "%e", v); } break; } case DataType::LongDouble: fprintf(outf, (f ? fmt : "%Lg"), ((long double *)data)[item]); // fprintf(outf,(f ? fmt : "????????")); case DataType::LongDouble: { long double v = ((long double *)data)[item]; if (allowformat) fprintf(outf, (f ? fmt : "%Lg"), v); else { if (-10000.0 < v && v < 100000.0) fprintf(outf, "%Lg", v); else fprintf(outf, "%Le", v); } break; } case DataType::FloatComplex: fprintf(outf, (f ? fmt : "(%g,i%g)"), ((float *)data)[2 * item], Loading testing/utils/bpcmp/TestUtilsBPcmp.stats.expected.txt +2 −2 Original line number Diff line number Diff line COMPARE : FILE : TestBPcmp_set1.bp : FILE : TestBPcmp_set2.bp DIFFER : NUM_STEPS : 2 <> 3 : TestBPcmp_set1.bp : TestBPcmp_set2.bp DIFFER : VARIABLE : bpFloats : MIN : 4 <> 6 : TestBPcmp_set1.bp : TestBPcmp_set2.bp DIFFER : VARIABLE : bpFloats : MAX : 10 <> 11 : TestBPcmp_set1.bp : TestBPcmp_set2.bp DIFFER : VARIABLE : bpFloats : MIN : 4.000000e+00 <> 6.000000e+00 : TestBPcmp_set1.bp : TestBPcmp_set2.bp DIFFER : VARIABLE : bpFloats : MAX : 1.000000e+01 <> 1.100000e+01 : TestBPcmp_set1.bp : TestBPcmp_set2.bp DIFFER : VARIABLE : bpFloats : STEP : 0 : VALUES_SUMMARY : 6 : TestBPcmp_set1.bp : TestBPcmp_set2.bp DIFFER : VARIABLE : bpFloats : STEP : 1 : VALUES_SUMMARY : 6 : TestBPcmp_set1.bp : TestBPcmp_set2.bp DIFFER : VARIABLE : bpStep : NUM_STEPS : 2 <> 3 : TestBPcmp_set1.bp : TestBPcmp_set2.bp Loading Loading
source/adios2/helper/adiosType.inl +35 −33 Original line number Diff line number Diff line Loading @@ -4,7 +4,6 @@ * SPDX-License-Identifier: Apache-2.0 */ #ifndef ADIOS2_HELPER_ADIOSTYPE_INL_ #define ADIOS2_HELPER_ADIOSTYPE_INL_ #ifndef ADIOS2_HELPER_ADIOSTYPE_H_ Loading @@ -13,6 +12,7 @@ #include <algorithm> //std::transform #include <sstream> //std::ostringstream #include <type_traits> //std::is_floating_point_v #include "adios2/common/ADIOSMacros.h" #include "adiosLog.h" Loading Loading @@ -110,8 +110,7 @@ template <class T, class U> std::vector<U> NewVectorTypeFromArray(const T *in, const size_t inSize) { std::vector<U> out(inSize); std::transform(in, in + inSize, out.begin(), [](T value) { return static_cast<U>(value); }); std::transform(in, in + inSize, out.begin(), [](T value) { return static_cast<U>(value); }); return out; } Loading Loading @@ -163,6 +162,10 @@ template <class T> inline std::string ValueToString(const T value) noexcept { std::ostringstream valueSS; if constexpr (std::is_floating_point_v<T>) { valueSS << std::scientific; } valueSS << value; const std::string valueStr(valueSS.str()); return valueStr; Loading Loading @@ -237,8 +240,7 @@ void CheckForNullptr(T *pointer, const std::string hint) { if (pointer == nullptr) { helper::Throw<std::invalid_argument>("Helper", "adiosType", "CheckForNullPtr", helper::Throw<std::invalid_argument>("Helper", "adiosType", "CheckForNullPtr", "found null pointer " + hint); } } Loading
source/utils/bpls/bpls.cpp +40 −11 Original line number Diff line number Diff line Loading @@ -918,7 +918,7 @@ int printAttributeValue(core::Engine *fp, core::IO *io, core::Attribute<T> *attr DataType adiosvartype = attribute->m_Type; if (attribute->m_IsSingleValue) { print_data((void *)&attribute->m_DataSingleValue, 0, adiosvartype, true); print_data((void *)&attribute->m_DataSingleValue, 0, adiosvartype, false); } else { Loading @@ -926,7 +926,7 @@ int printAttributeValue(core::Engine *fp, core::IO *io, core::Attribute<T> *attr size_t nelems = attribute->m_DataArray.size(); for (size_t j = 0; j < nelems; j++) { print_data((void *)&attribute->m_DataArray[j], 0, adiosvartype, true); print_data((void *)&attribute->m_DataArray[j], 0, adiosvartype, false); if (j < nelems - 1) { fprintf(outf, ", "); Loading @@ -953,7 +953,7 @@ int printAttributeValue(core::Engine *fp, core::IO *io, core::Attribute<std::str } if (printDataAnyway) { print_data((void *)&attribute->m_DataSingleValue, 0, adiosvartype, true); print_data((void *)&attribute->m_DataSingleValue, 0, adiosvartype, false); } } else Loading @@ -969,7 +969,7 @@ int printAttributeValue(core::Engine *fp, core::IO *io, core::Attribute<std::str } if (printDataAnyway) { print_data((void *)&attribute->m_DataArray[j], 0, adiosvartype, true); print_data((void *)&attribute->m_DataArray[j], 0, adiosvartype, false); } if (j < nelems - 1) { Loading Loading @@ -3072,18 +3072,47 @@ int print_data(const void *data, int item, DataType adiosvartype, bool allowform fprintf(outf, (f ? fmt : "%lld"), ((signed long long *)data)[item]); break; case DataType::Float: fprintf(outf, (f ? fmt : "%g"), ((float *)data)[item]); case DataType::Float: { float v = ((float *)data)[item]; if (allowformat) fprintf(outf, (f ? fmt : "%g"), v); else { if (-10000.0 < v && v < 100000.0) fprintf(outf, "%g", v); else fprintf(outf, "%e", v); } break; } case DataType::Double: fprintf(outf, (f ? fmt : "%g"), ((double *)data)[item]); case DataType::Double: { double v = ((double *)data)[item]; if (allowformat) fprintf(outf, (f ? fmt : "%g"), v); else { if (-10000.0 < v && v < 100000.0) fprintf(outf, "%g", v); else fprintf(outf, "%e", v); } break; } case DataType::LongDouble: fprintf(outf, (f ? fmt : "%Lg"), ((long double *)data)[item]); // fprintf(outf,(f ? fmt : "????????")); case DataType::LongDouble: { long double v = ((long double *)data)[item]; if (allowformat) fprintf(outf, (f ? fmt : "%Lg"), v); else { if (-10000.0 < v && v < 100000.0) fprintf(outf, "%Lg", v); else fprintf(outf, "%Le", v); } break; } case DataType::FloatComplex: fprintf(outf, (f ? fmt : "(%g,i%g)"), ((float *)data)[2 * item], Loading
testing/utils/bpcmp/TestUtilsBPcmp.stats.expected.txt +2 −2 Original line number Diff line number Diff line COMPARE : FILE : TestBPcmp_set1.bp : FILE : TestBPcmp_set2.bp DIFFER : NUM_STEPS : 2 <> 3 : TestBPcmp_set1.bp : TestBPcmp_set2.bp DIFFER : VARIABLE : bpFloats : MIN : 4 <> 6 : TestBPcmp_set1.bp : TestBPcmp_set2.bp DIFFER : VARIABLE : bpFloats : MAX : 10 <> 11 : TestBPcmp_set1.bp : TestBPcmp_set2.bp DIFFER : VARIABLE : bpFloats : MIN : 4.000000e+00 <> 6.000000e+00 : TestBPcmp_set1.bp : TestBPcmp_set2.bp DIFFER : VARIABLE : bpFloats : MAX : 1.000000e+01 <> 1.100000e+01 : TestBPcmp_set1.bp : TestBPcmp_set2.bp DIFFER : VARIABLE : bpFloats : STEP : 0 : VALUES_SUMMARY : 6 : TestBPcmp_set1.bp : TestBPcmp_set2.bp DIFFER : VARIABLE : bpFloats : STEP : 1 : VALUES_SUMMARY : 6 : TestBPcmp_set1.bp : TestBPcmp_set2.bp DIFFER : VARIABLE : bpStep : NUM_STEPS : 2 <> 3 : TestBPcmp_set1.bp : TestBPcmp_set2.bp Loading