Viskores  1.0
Initialize.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_cont_Initialize_h
19 #define viskores_cont_Initialize_h
20 
24 
25 #include <string>
26 #include <type_traits>
27 #include <vector>
28 
29 namespace viskores
30 {
31 namespace cont
32 {
33 
35 {
41 
45  std::string Usage;
46 };
47 
49 {
52  None = 0x00,
53 
55  RequireDevice = 0x01,
56 
59  DefaultAnyDevice = 0x02,
60 
65  AddHelp = 0x04,
66 
70  ErrorOnBadOption = 0x08,
71 
75  ErrorOnBadArgument = 0x10,
76 
81 };
82 
83 // Allow options to be used as a bitfield
85 {
86  using T = std::underlying_type<InitializeOptions>::type;
87  return static_cast<InitializeOptions>(static_cast<T>(lhs) | static_cast<T>(rhs));
88 }
90 {
91  using T = std::underlying_type<InitializeOptions>::type;
92  return static_cast<InitializeOptions>(static_cast<T>(lhs) & static_cast<T>(rhs));
93 }
94 
113 VISKORES_CONT_EXPORT
115 InitializeResult Initialize(int& argc,
116  char* argv[],
118 VISKORES_CONT_EXPORT
120 InitializeResult Initialize();
122 }
123 } // end namespace viskores::cont
124 
125 
126 #endif // viskores_cont_Initialize_h
viskores::cont::InitializeResult
Definition: Initialize.h:34
DeviceAdapterTag.h
viskores::cont::InitializeOptions::ErrorOnBadOption
@ ErrorOnBadOption
If an unknown option is encountered, the program terminates with an error and a usage statement is pr...
ExportMacros.h
viskores::cont::InitializeOptions::Strict
@ Strict
If supplied, Initialize treats its own arguments as the only ones supported by the application and pr...
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::cont::operator|
InitializeOptions operator|(const InitializeOptions &lhs, const InitializeOptions &rhs)
Definition: Initialize.h:84
viskores::cont::DeviceAdapterTagUndefined
Tag for a device adapter used to avoid specifying a device.
Definition: DeviceAdapterTag.h:201
viskores::cont::InitializeOptions
InitializeOptions
Definition: Initialize.h:48
viskores::cont::InitializeOptions::ErrorOnBadArgument
@ ErrorOnBadArgument
If an extra argument is encountered, the program terminates with an error and a usage statement is pr...
viskores::cont::InitializeOptions::AddHelp
@ AddHelp
Add a help argument.
viskores::cont::DeviceAdapterId
An object used to specify a device.
Definition: DeviceAdapterTag.h:66
viskores::cont::InitializeOptions::RequireDevice
@ RequireDevice
Issue an error if the device argument is not specified.
viskores::cont::InitializeOptions::None
@ None
Placeholder used when no options are enabled.
viskores::cont::Initialize
InitializeResult Initialize(int &argc, char *argv[], InitializeOptions opts=InitializeOptions::None)
Initialize the Viskores library, parsing arguments when provided:
viskores::cont::InitializeResult::Device
DeviceAdapterId Device
The device passed into --viskores-device argument.
Definition: Initialize.h:40
viskores::cont::operator&
InitializeOptions operator&(const InitializeOptions &lhs, const InitializeOptions &rhs)
Definition: Initialize.h:89
viskores::cont::InitializeOptions::DefaultAnyDevice
@ DefaultAnyDevice
If no device is specified, treat it as if the user gave --viskores-device=Any.
viskores_cont_export.h
viskores::cont::InitializeResult::Usage
std::string Usage
A usage statement for arguments parsed by Viskores.
Definition: Initialize.h:45