18 #ifndef viskores_io_internal_VTKDataSetTypes_h
19 #define viskores_io_internal_VTKDataSetTypes_h
49 DTYPE_UNSIGNED_LONG_LONG,
55 inline const char* DataTypeString(
int id)
57 static const char* strings[] = {
58 "",
"bit",
"unsigned_char",
"char",
"unsigned_short",
59 "short",
"unsigned_int",
"int",
"unsigned_long",
"long",
60 "float",
"double",
"vtktypeuint64",
"vtktypeint64"
65 inline DataType DataTypeId(
const std::string& str)
67 DataType type = DTYPE_UNKNOWN;
68 for (
int id = 1;
id < DTYPE_COUNT; ++id)
70 if (str == DataTypeString(
id))
72 type =
static_cast<DataType
>(id);
82 operator bool()
const {
return false; }
97 : Data(static_cast<
viskores::
UInt8>(std::min(std::max(val, 1.0f), 0.0f) * 255))
107 inline std::ostream&
operator<<(std::ostream& out,
const ColorChannel8& val)
109 return out << static_cast<viskores::Float32>(val);
112 inline std::istream& operator>>(std::istream& in, ColorChannel8& val)
116 val = ColorChannel8(fval);
120 template <
typename T>
123 static const char* Name() {
return "unknown"; }
126 struct DataTypeName<DummyBitType>
128 static const char* Name() {
return "bit"; }
133 static const char* Name() {
return "char"; }
138 static const char* Name() {
return "unsigned_char"; }
143 static const char* Name() {
return "short"; }
148 static const char* Name() {
return "unsigned_short"; }
153 static const char* Name() {
return "int"; }
158 static const char* Name() {
return "unsigned_int"; }
163 static const char* Name() {
return "long"; }
168 static const char* Name() {
return "unsigned_long"; }
173 static const char* Name() {
return "float"; }
178 static const char* Name() {
return "double"; }
181 template <
typename Functor>
182 inline void SelectTypeAndCall(DataType dtype, Functor&& functor)
187 functor(DummyBitType());
189 case DTYPE_UNSIGNED_CHAR:
195 case DTYPE_UNSIGNED_SHORT:
201 case DTYPE_UNSIGNED_INT:
207 case DTYPE_UNSIGNED_LONG:
208 case DTYPE_UNSIGNED_LONG_LONG:
212 case DTYPE_LONG_LONG:
230 #endif // viskores_io_internal_VTKDataSetTypes_h