VTK-m  2.0
ZFPFunctions.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_worklet_zfp_functions_h
11 #define vtk_m_worklet_zfp_functions_h
12 
13 #include <vtkm/Math.h>
17 
18 namespace vtkm
19 {
20 namespace worklet
21 {
22 namespace zfp
23 {
24 
25 template <typename T>
26 void PrintBits(T bits)
27 {
28  const int bit_size = sizeof(T) * 8;
29  for (int i = bit_size - 1; i >= 0; --i)
30  {
31  T one = 1;
32  T mask = one << i;
33  int val = (bits & mask) >> T(i);
34  printf("%d", val);
35  }
36  printf("\n");
37 }
38 
39 template <typename T>
40 inline vtkm::UInt32 MinBits(const vtkm::UInt32 bits)
41 {
42  return bits;
43 }
44 
45 template <>
46 inline vtkm::UInt32 MinBits<vtkm::Float32>(const vtkm::UInt32 bits)
47 {
48  return vtkm::Max(bits, 1 + 8u);
49 }
50 
51 template <>
52 inline vtkm::UInt32 MinBits<vtkm::Float64>(const vtkm::UInt32 bits)
53 {
54  return vtkm::Max(bits, 1 + 11u);
55 }
56 
57 
58 
59 
60 } // namespace zfp
61 } // namespace worklet
62 } // namespace vtkm
63 #endif // vtk_m_worklet_zfp_type_info_h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
ZFPTypeInfo.h
ZFPCodec.h
Math.h
vtkm::worklet::zfp::MinBits
vtkm::UInt32 MinBits(const vtkm::UInt32 bits)
Definition: ZFPFunctions.h:40
vtkm::UInt32
uint32_t UInt32
Definition: Types.h:161
ZFPBlockWriter.h
vtkm::worklet::zfp::PrintBits
void PrintBits(T bits)
Definition: ZFPFunctions.h:26