VTK-m  2.0
Initialize.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_cont_Initialize_h
11 #define vtk_m_cont_Initialize_h
12 
14 #include <vtkm/cont/vtkm_cont_export.h>
16 
17 #include <string>
18 #include <type_traits>
19 #include <vector>
20 
21 namespace vtkm
22 {
23 namespace cont
24 {
25 
27 {
29  DeviceAdapterId Device = DeviceAdapterTagUndefined{};
30 
32  std::string Usage;
33 };
34 
36 {
37  None = 0x00,
38 
40  RequireDevice = 0x01,
41 
44  DefaultAnyDevice = 0x02,
45 
48  AddHelp = 0x04,
49 
53  ErrorOnBadOption = 0x08,
54 
58  ErrorOnBadArgument = 0x10,
59 
64 };
65 
66 // Allow options to be used as a bitfield
68 {
69  using T = std::underlying_type<InitializeOptions>::type;
70  return static_cast<InitializeOptions>(static_cast<T>(lhs) | static_cast<T>(rhs));
71 }
73 {
74  using T = std::underlying_type<InitializeOptions>::type;
75  return static_cast<InitializeOptions>(static_cast<T>(lhs) & static_cast<T>(rhs));
76 }
77 
96 VTKM_CONT_EXPORT
98 InitializeResult Initialize(int& argc,
99  char* argv[],
101 VTKM_CONT_EXPORT
102 VTKM_CONT
103 InitializeResult Initialize();
105 }
106 } // end namespace vtkm::cont
107 
108 
109 #endif // vtk_m_cont_Initialize_h
vtkm::cont::InitializeOptions
InitializeOptions
Definition: Initialize.h:35
vtkm::cont::InitializeOptions::AddHelp
@ AddHelp
Add a help argument.
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::cont::InitializeResult::Usage
std::string Usage
Usage statement for arguments parsed by VTK-m.
Definition: Initialize.h:32
DeviceAdapterTag.h
vtkm::cont::InitializeOptions::Strict
@ Strict
If supplied, Initialize treats its own arguments as the only ones supported by the application and pr...
ExportMacros.h
vtkm::cont::InitializeResult
Definition: Initialize.h:26
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::cont::InitializeOptions::None
@ None
vtkm::cont::DeviceAdapterId
Definition: DeviceAdapterTag.h:52
vtkm::cont::InitializeOptions::RequireDevice
@ RequireDevice
Issue an error if the device argument is not specified.
vtkm::cont::InitializeOptions::DefaultAnyDevice
@ DefaultAnyDevice
If no device is specified, treat it as if the user gave –vtkm-device=Any.
vtkm::cont::InitializeOptions::ErrorOnBadArgument
@ ErrorOnBadArgument
If an extra argument is encountered, the program terminates with an error and a usage statement is pr...
vtkm::cont::Initialize
VTKM_CONT_EXPORT VTKM_CONT InitializeResult Initialize(int &argc, char *argv[], InitializeOptions opts=InitializeOptions::None)
Initialize the VTKm library, parsing arguments when provided:
vtkm::cont::InitializeOptions::ErrorOnBadOption
@ ErrorOnBadOption
If an unknown option is encountered, the program terminates with an error and a usage statement is pr...
vtkm::cont::operator|
InitializeOptions operator|(const InitializeOptions &lhs, const InitializeOptions &rhs)
Definition: Initialize.h:67
vtkm::cont::operator&
InitializeOptions operator&(const InitializeOptions &lhs, const InitializeOptions &rhs)
Definition: Initialize.h:72
vtkm::cont::InitializeResult::Device
DeviceAdapterId Device
Device passed into –vtkm-device, or undefined.
Definition: Initialize.h:29