diff --git a/include/openPMD/IO/ADIOS/ADIOS1Auxiliary.hpp b/include/openPMD/IO/ADIOS/ADIOS1Auxiliary.hpp
index 73f0740dc2..f9aaedabdc 100644
--- a/include/openPMD/IO/ADIOS/ADIOS1Auxiliary.hpp
+++ b/include/openPMD/IO/ADIOS/ADIOS1Auxiliary.hpp
@@ -180,6 +180,15 @@ getBP1DataType(Datatype dtype)
case DT::LONG_DOUBLE:
case DT::VEC_LONG_DOUBLE:
return adios_long_double;
+ case DT::CFLOAT:
+ case DT::VEC_CFLOAT:
+ return adios_complex;
+ case DT::CDOUBLE:
+ case DT::VEC_CDOUBLE:
+ return adios_double_complex;
+ case DT::CLONG_DOUBLE:
+ case DT::VEC_CLONG_DOUBLE:
+ throw unsupported_data_error("No native equivalent for Datatype::CLONG_DOUBLE found.");
case DT::STRING:
return adios_string;
case DT::VEC_STRING:
diff --git a/src/IO/ADIOS/CommonADIOS1IOHandler.cpp b/src/IO/ADIOS/CommonADIOS1IOHandler.cpp
index 43e184fd28..65b3105c20 100644
--- a/src/IO/ADIOS/CommonADIOS1IOHandler.cpp
+++ b/src/IO/ADIOS/CommonADIOS1IOHandler.cpp
@@ -19,6 +19,7 @@
* If not, see .
*/
#include
+#include
#include
#include
@@ -185,6 +186,23 @@ CommonADIOS1IOHandlerImpl::flush_attribute(int64_t group, std::string const& nam
*ptr = att.get< long double >();
break;
}
+ case DT::CFLOAT:
+ {
+ auto ptr = reinterpret_cast< std::complex< float >* >(values.get());
+ *ptr = att.get< std::complex< float > >();
+ break;
+ }
+ case DT::CDOUBLE:
+ {
+ auto ptr = reinterpret_cast< std::complex< double >* >(values.get());
+ *ptr = att.get< std::complex< double > >();
+ break;
+ }
+ case DT::CLONG_DOUBLE:
+ {
+ throw std::runtime_error("[ADIOS1] Unknown Attribute datatype (CLONG_DOUBLE)");
+ break;
+ }
case DT::STRING:
{
auto const & v = att.get< std::string >();
@@ -296,6 +314,27 @@ CommonADIOS1IOHandlerImpl::flush_attribute(int64_t group, std::string const& nam
ptr[i] = vec[i];
break;
}
+ case DT::VEC_CFLOAT:
+ {
+ auto ptr = reinterpret_cast< std::complex< float >* >(values.get());
+ auto const& vec = att.get< std::vector< std::complex< float > > >();
+ for( size_t i = 0; i < vec.size(); ++i )
+ ptr[i] = vec[i];
+ break;
+ }
+ case DT::VEC_CDOUBLE:
+ {
+ auto ptr = reinterpret_cast< std::complex< double >* >(values.get());
+ auto const& vec = att.get< std::vector< std::complex< double > > >();
+ for( size_t i = 0; i < vec.size(); ++i )
+ ptr[i] = vec[i];
+ break;
+ }
+ case DT::VEC_CLONG_DOUBLE:
+ {
+ throw std::runtime_error("[ADIOS1] Unknown Attribute datatype (VEC_CLONG_DOUBLE)");
+ break;
+ }
case DT::VEC_STRING:
{
auto ptr = reinterpret_cast< char** >(values.get());
@@ -668,11 +707,15 @@ CommonADIOS1IOHandlerImpl::openDataset(Writable* writable,
case adios_long_double:
dtype = DT::LONG_DOUBLE;
break;
+ case adios_complex:
+ dtype = DT::CFLOAT;
+ break;
+ case adios_double_complex:
+ dtype = DT::CDOUBLE;
+ break;
case adios_string:
case adios_string_array:
- case adios_complex:
- case adios_double_complex:
default:
throw unsupported_data_error("[ADIOS1] Datatype not implemented for ADIOS dataset writing");
}
@@ -822,6 +865,8 @@ CommonADIOS1IOHandlerImpl::readDataset(Writable* writable,
using DT = Datatype;
case DT::DOUBLE:
case DT::FLOAT:
+ case DT::CDOUBLE:
+ case DT::CFLOAT:
case DT::SHORT:
case DT::INT:
case DT::LONG:
@@ -935,14 +980,18 @@ CommonADIOS1IOHandlerImpl::readAttribute(Writable* writable,
case adios_long_double:
size /= sizeof(long double);
break;
+ case adios_complex:
+ size /= 8;
+ break;
+ case adios_double_complex:
+ size /= 16;
+ break;
case adios_string:
break;
case adios_string_array:
size /= sizeof(char*);
break;
- case adios_complex:
- case adios_double_complex:
default:
throw unsupported_data_error(
"[ADIOS1] readAttribute: Unsupported ADIOS1 attribute datatype '" +
@@ -1120,6 +1169,14 @@ CommonADIOS1IOHandlerImpl::readAttribute(Writable* writable,
dtype = DT::LONG_DOUBLE;
a = Attribute(*reinterpret_cast< long double* >(data));
break;
+ case adios_complex:
+ dtype = DT::CFLOAT;
+ a = Attribute(*reinterpret_cast< std::complex* >(data));
+ break;
+ case adios_double_complex:
+ dtype = DT::CDOUBLE;
+ a = Attribute(*reinterpret_cast< std::complex* >(data));
+ break;
case adios_string:
{
dtype = DT::STRING;
@@ -1142,8 +1199,6 @@ CommonADIOS1IOHandlerImpl::readAttribute(Writable* writable,
a = Attribute(vs);
break;
}
- case adios_complex:
- case adios_double_complex:
default:
throw unsupported_data_error(
"[ADIOS1] readAttribute: Unsupported ADIOS1 attribute datatype '" +
@@ -1294,6 +1349,28 @@ CommonADIOS1IOHandlerImpl::readAttribute(Writable* writable,
a = Attribute(vld);
break;
}
+ case adios_complex:
+ {
+ dtype = DT::VEC_CFLOAT;
+ auto cf4 = reinterpret_cast< std::complex* >(data);
+ std::vector< std::complex > vcf;
+ vcf.resize(size);
+ for( int i = 0; i < size; ++i )
+ vcf[i] = cf4[i];
+ a = Attribute(vcf);
+ break;
+ }
+ case adios_double_complex:
+ {
+ dtype = DT::VEC_CDOUBLE;
+ auto cd8 = reinterpret_cast< std::complex* >(data);
+ std::vector< std::complex > vcd;
+ vcd.resize(size);
+ for( int i = 0; i < size; ++i )
+ vcd[i] = cd8[i];
+ a = Attribute(vcd);
+ break;
+ }
case adios_string:
{
dtype = DT::STRING;
@@ -1316,8 +1393,6 @@ CommonADIOS1IOHandlerImpl::readAttribute(Writable* writable,
break;
}
- case adios_complex:
- case adios_double_complex:
default:
throw unsupported_data_error(
"[ADIOS1] readAttribute: Unsupported ADIOS1 attribute datatype '" +