Skip to content

Commit 6900e6d

Browse files
committed
Remove ADIOS2Datatype, add SCHAR to openPMD::Datatype
1 parent cd8c26e commit 6900e6d

16 files changed

+274
-627
lines changed

include/openPMD/Datatype.hpp

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ namespace openPMD
4242
enum class Datatype : int
4343
{
4444
CHAR,
45-
UCHAR, // SCHAR,
45+
UCHAR,
46+
SCHAR,
4647
SHORT,
4748
INT,
4849
LONG,
@@ -74,6 +75,7 @@ enum class Datatype : int
7475
VEC_CFLOAT,
7576
VEC_CDOUBLE,
7677
VEC_CLONG_DOUBLE,
78+
VEC_SCHAR,
7779
VEC_STRING,
7880
ARR_DBL_7,
7981

@@ -124,6 +126,10 @@ inline constexpr Datatype determineDatatype()
124126
{
125127
return DT::UCHAR;
126128
}
129+
else if (decay_equiv<T, signed char>::value)
130+
{
131+
return DT::SCHAR;
132+
}
127133
else if (decay_equiv<T, short>::value)
128134
{
129135
return DT::SHORT;
@@ -208,6 +214,10 @@ inline constexpr Datatype determineDatatype()
208214
{
209215
return DT::VEC_UCHAR;
210216
}
217+
else if (decay_equiv<T, std::vector<signed char>>::value)
218+
{
219+
return DT::VEC_SCHAR;
220+
}
211221
else if (decay_equiv<T, std::vector<unsigned short>>::value)
212222
{
213223
return DT::VEC_USHORT;
@@ -276,6 +286,10 @@ inline constexpr Datatype determineDatatype(std::shared_ptr<T>)
276286
{
277287
return DT::UCHAR;
278288
}
289+
else if (decay_equiv<T, signed char>::value)
290+
{
291+
return DT::SCHAR;
292+
}
279293
else if (decay_equiv<T, short>::value)
280294
{
281295
return DT::SHORT;
@@ -360,6 +374,10 @@ inline constexpr Datatype determineDatatype(std::shared_ptr<T>)
360374
{
361375
return DT::VEC_UCHAR;
362376
}
377+
else if (decay_equiv<T, std::vector<signed char>>::value)
378+
{
379+
return DT::VEC_SCHAR;
380+
}
363381
else if (decay_equiv<T, std::vector<unsigned short>>::value)
364382
{
365383
return DT::VEC_USHORT;
@@ -434,9 +452,9 @@ inline size_t toBytes(Datatype d)
434452
case DT::UCHAR:
435453
case DT::VEC_UCHAR:
436454
return sizeof(unsigned char);
437-
// case DT::SCHAR:
438-
// case DT::VEC_SCHAR:
439-
// return sizeof(signed char);
455+
case DT::SCHAR:
456+
case DT::VEC_SCHAR:
457+
return sizeof(signed char);
440458
case DT::SHORT:
441459
case DT::VEC_SHORT:
442460
return sizeof(short);

include/openPMD/DatatypeHelpers.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ auto switchType(Datatype dt, Args &&...args)
110110
case Datatype::UCHAR:
111111
return Action::template call<unsigned char>(
112112
std::forward<Args>(args)...);
113+
case Datatype::SCHAR:
114+
return Action::template call<signed char>(std::forward<Args>(args)...);
113115
case Datatype::SHORT:
114116
return Action::template call<short>(std::forward<Args>(args)...);
115117
case Datatype::INT:
@@ -164,6 +166,9 @@ auto switchType(Datatype dt, Args &&...args)
164166
case Datatype::VEC_UCHAR:
165167
return Action::template call<std::vector<unsigned char> >(
166168
std::forward<Args>(args)...);
169+
case Datatype::VEC_SCHAR:
170+
return Action::template call<std::vector<signed char> >(
171+
std::forward<Args>(args)...);
167172
case Datatype::VEC_USHORT:
168173
return Action::template call<std::vector<unsigned short> >(
169174
std::forward<Args>(args)...);
@@ -241,6 +246,8 @@ auto switchNonVectorType(Datatype dt, Args &&...args)
241246
case Datatype::UCHAR:
242247
return Action::template call<unsigned char>(
243248
std::forward<Args>(args)...);
249+
case Datatype::SCHAR:
250+
return Action::template call<signed char>(std::forward<Args>(args)...);
244251
case Datatype::SHORT:
245252
return Action::template call<short>(std::forward<Args>(args)...);
246253
case Datatype::INT:

include/openPMD/IO/ADIOS/ADIOS1Auxiliary.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ inline ADIOS_DATATYPES getBP1DataType(Datatype dtype)
8686
{
8787
case DT::CHAR:
8888
case DT::VEC_CHAR:
89+
case DT::SCHAR:
90+
case DT::VEC_SCHAR:
8991
return adios_byte;
9092
case DT::UCHAR:
9193
case DT::VEC_UCHAR:

0 commit comments

Comments
 (0)