Newer
Older
* Distributed under the OSI-approved Apache License, Version 2.0. See
* accompanying file Copyright.txt for details.
*
*
* Created on: Mar 23, 2017
* Author: Chuck Atkins chuck.atkins@kitware.com
* Norbert Podhorszki pnorbert@ornl.gov
* William F Godoy godoywf@ornl.gov
*
#ifndef ADIOS2_ADIOSTYPES_H_
#define ADIOS2_ADIOSTYPES_H_
#include <cstddef>
#include <cstdint>
#include <type_traits>
/** Variable shape type identifier */
enum class ShapeID
{
GlobalValue, ///< single global value, common case
GlobalArray, ///< global (across MPI_Comm) array, common case
JoinedArray, ///< global array with a common (joinable) dimension
LocalValue, ///< special case, local independent value
LocalArray ///< special case, local independent array
};
/** Used to set IO class */
enum class IOMode
{
Independent, ///< all I/O operations are independent per rank
Collective ///< expect collective I/O operations
};
enum class OpenMode
{
Undefined,
Write,
Read,
Append,
ReadWrite,
};
enum class ReadMultiplexPattern
{
GlobalReaders,
RoundRobin,
FirstInFirstOut,
OpenAllSteps
};
enum class StreamOpenMode
{
Wait,
NoWait
};
};
enum class TransportType
{
File,
WAN
};
enum class IOEngine
{
Unknown,
BPFileWriter, ///< produces bp files
BPFileReader, ///< read bp files
HDF5Writer, ///<
HDF5Reader, ///<
ADIOS1Writer,
ADIOS1Reader,
DataManWriter,
DataManReader
};
enum class ReadMode
{
NonBlocking,
Blocking
};
enum class AdvanceMode
{
Append,
Update, // writer advance mode
NextAvailable,
LatestAvailable // reader advance mode
};
OK,
StepNotReady,
EndOfStream,
OtherError
};
/** Type of selection */
enum class SelectionType
{
BoundingBox, ///< Contiguous block of data defined by offsets and counts per
/// dimension
Points, ///< List of individual points
WriteBlock, ///< Selection of an individual block written by a writer
/// process
Auto ///< Let the engine decide what to return
};
// adios defaults
#ifdef _WIN32
const std::string DefaultFileLibrary("stdio");
#else
const std::string DefaultFileLibrary("POSIX");
const std::string DefaultTimeUnit("Microseconds");
constexpr TimeUnit DefaultTimeUnitEnum(TimeUnit::Microseconds);
/** default initial bp buffer size, 16Kb, in bytes */
constexpr size_t DefaultInitialBufferSize(16384);
/** default maximum bp buffer size, 16Mb, in bytes */
constexpr size_t DefaultMaxBufferSize(16777216);
/** default buffer growth factor (from STL vector = 2.) */
constexpr float DefaultBufferGrowthFactor(2.);
/** default size for writing/reading files using POSIX/fstream/stdio write
* 1Gb - 1Kb (tolerance)*/
constexpr size_t DefaultMaxFileBatchSize(1024 * 1024 * 1024 - 1024);
// adios alias values and types
constexpr bool DebugON = true;
constexpr bool DebugOFF = false;
constexpr size_t UnknownDim = 0;
constexpr size_t JoinedDim = std::numeric_limits<size_t>::max() - 1;
constexpr size_t LocalValueDim = std::numeric_limits<size_t>::max() - 2;
constexpr size_t IrregularDim = std::numeric_limits<size_t>::max() - 3;
constexpr bool ConstantDims = true;
constexpr bool ReadIn = true;
using std::size_t;
using Dims = std::vector<size_t>;
using Params = std::map<std::string, std::string>;
// Primitives
// using schar = signed char;
using std::int8_t;
using std::int16_t;
using std::int32_t;
using std::int64_t;
// using uchar = unsigned char;
using std::uint8_t;
using std::uint16_t;
using std::uint32_t;
using std::uint64_t;
// Complex
using cfloat = std::complex<float>;
using cdouble = std::complex<double>;
using cldouble = std::complex<long double>;
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
// Get a fixed width integer type from a size specification
template <size_t Bytes, bool Signed>
struct FixedWidthInt;
template <>
struct FixedWidthInt<1, true>
{
using Type = std::int8_t;
};
template <>
struct FixedWidthInt<2, true>
{
using Type = std::int16_t;
};
template <>
struct FixedWidthInt<4, true>
{
using Type = std::int32_t;
};
template <>
struct FixedWidthInt<8, true>
{
using Type = std::int64_t;
};
template <>
struct FixedWidthInt<1, false>
{
using Type = std::uint8_t;
};
template <>
struct FixedWidthInt<2, false>
{
using Type = std::uint16_t;
};
template <>
struct FixedWidthInt<4, false>
{
using Type = std::uint32_t;
};
template <>
struct FixedWidthInt<8, false>
{
using Type = std::uint64_t;
};
// Some core type information that may be useful at compile time
template <typename T, typename Enable = void>
struct TypeInfo;
template <typename T>
struct TypeInfo<T, typename std::enable_if<std::is_integral<T>::value>::type>
{
using IOType =
typename FixedWidthInt<sizeof(T), std::is_signed<T>::value>::Type;
};
template <typename T>
struct TypeInfo<T,
typename std::enable_if<std::is_floating_point<T>::value>::type>
{
using IOType = T;
};
template <typename T>
struct TypeInfo<T, typename std::enable_if<std::is_same<
T, std::complex<typename T::value_type>>::value>::type>
{
using IOType = T;
using ValueType = typename T::value_type;
};
} // end namespace adios
#endif /* ADIOS2_ADIOSTYPES_H_ */