VTK-m  2.0
RuntimeDeviceOption.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_internal_RuntimeDeviceOption_h
11 #define vtk_m_cont_internal_RuntimeDeviceOption_h
12 
13 #include <vtkm/cont/vtkm_cont_export.h>
14 
17 
18 namespace vtkm
19 {
20 namespace cont
21 {
22 namespace internal
23 {
24 
25 enum class RuntimeDeviceOptionSource
26 {
27  COMMAND_LINE,
28  ENVIRONMENT,
29  IN_CODE,
30  NOT_SET
31 };
32 
33 class VTKM_CONT_EXPORT RuntimeDeviceOption
34 {
35 public:
40  VTKM_CONT RuntimeDeviceOption(const vtkm::Id& index, const std::string& envName);
41 
42  VTKM_CONT virtual ~RuntimeDeviceOption() noexcept;
43 
48  VTKM_CONT void Initialize(const option::Option* options);
49 
51  VTKM_CONT void SetOptionFromEnvironment();
52 
54  VTKM_CONT void SetOptionFromOptionsArray(const option::Option* options);
55 
57  VTKM_CONT void SetOption(const vtkm::Id& value);
58 
59  VTKM_CONT vtkm::Id GetValue() const;
60  VTKM_CONT RuntimeDeviceOptionSource GetSource() const;
61  VTKM_CONT bool IsSet() const;
62 
63 private:
64  const vtkm::Id Index;
65  const std::string EnvName;
66  RuntimeDeviceOptionSource Source;
67  vtkm::Id Value;
68 };
69 
70 } // namespace vtkm::cont::internal
71 } // namespace vtkm::cont
72 } // namespace vtkm
73 
74 #endif // vtk_m_cont_internal_RuntimeDeviceOption_h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
Index
int Index
Definition: ChooseCudaDevice.h:87
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
OptionParserArguments.h
OptionParser.h
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: