1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkADIOSUtilities.cxx
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 #include "vtkADIOSUtilities.h"
16 
17 namespace ADIOS
18 {
19 namespace Type
20 {
21 
22 //----------------------------------------------------------------------------
NativeToADIOS()23 template<> ADIOS_DATATYPES NativeToADIOS<vtkIdType>()
24 {
25   return SizeToInt<sizeof(vtkIdType)>();
26 }
27 
28 //----------------------------------------------------------------------------
VTKToADIOS(int tv)29 ADIOS_DATATYPES VTKToADIOS(int tv)
30 {
31   switch(tv)
32     {
33     case VTK_TYPE_INT8: return adios_byte;
34     case VTK_TYPE_INT16: return adios_short;
35     case VTK_TYPE_INT32: return adios_integer;
36     case VTK_TYPE_INT64: return adios_long;
37     case VTK_TYPE_UINT8: return adios_unsigned_byte;
38     case VTK_TYPE_UINT16: return adios_unsigned_short;
39     case VTK_TYPE_UINT32: return adios_unsigned_integer;
40     case VTK_TYPE_UINT64: return adios_unsigned_long;
41     case VTK_FLOAT: return adios_real;
42     case VTK_DOUBLE: return adios_double;
43     case VTK_STRING: return adios_string;
44     case VTK_ID_TYPE:
45       switch(sizeof(vtkIdType))
46         {
47         case 1: return adios_byte;
48         case 2: return adios_short;
49         case 4: return adios_integer;
50         case 8: return adios_long;
51         default: return adios_unknown;
52         }
53     default: return adios_unknown;
54     }
55 }
56 
57 //----------------------------------------------------------------------------
ADIOSToVTK(ADIOS_DATATYPES ta)58 int ADIOSToVTK(ADIOS_DATATYPES ta)
59 {
60   switch(ta)
61     {
62     case adios_byte: return VTK_TYPE_INT8;
63     case adios_short: return VTK_TYPE_INT16;
64     case adios_integer: return VTK_TYPE_INT32;
65     case adios_long: return VTK_TYPE_INT64;
66     case adios_unsigned_byte: return VTK_TYPE_UINT8;
67     case adios_unsigned_short: return VTK_TYPE_UINT16;
68     case adios_unsigned_integer: return VTK_TYPE_UINT32;
69     case adios_unsigned_long: return VTK_TYPE_UINT64;
70     case adios_real: return VTK_FLOAT;
71     case adios_double: return VTK_DOUBLE;
72     case adios_string: return VTK_STRING;
73     default: return -1;
74     }
75 }
76 
77 } // End namespace Type
78 } // End namespace ADIOS
79