vtkPVOptions.h 8.98 KB
Newer Older
1
/*=========================================================================
2

3 4 5 6 7 8 9 10 11 12 13 14
  Program:   ParaView
  Module:    vtkPVOptions.h

  Copyright (c) Kitware, Inc.
  All rights reserved.
  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
15 16 17 18 19 20 21 22 23
/**
 * @class   vtkPVOptions
 * @brief   ParaView options storage
 *
 * An object of this class represents a storage for ParaView options
 *
 * These options can be retrieved during run-time, set using configuration file
 * or using Command Line Arguments.
*/
24

25 26
#ifndef vtkPVOptions_h
#define vtkPVOptions_h
27

28
#include "vtkCommandOptions.h"
29
#include "vtkPVClientServerCoreCoreModule.h" //needed for exports
30 31 32

class vtkPVOptionsInternal;

33
class VTKPVCLIENTSERVERCORECORE_EXPORT vtkPVOptions : public vtkCommandOptions
34
{
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
35 36
protected:
  friend class vtkPVOptionsXMLParser;
37

Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
38
public:
39
  static vtkPVOptions* New();
Kitware Robot's avatar
Kitware Robot committed
40
  vtkTypeMacro(vtkPVOptions, vtkCommandOptions);
Cory Quammen's avatar
Cory Quammen committed
41
  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
42

43 44 45 46
  //@{
  /**
   * Convenience method to get the local process's host name.
   */
47
  vtkGetStringMacro(HostName);
48
  //@}
49

50 51
  vtkGetMacro(ConnectID, int);
  vtkGetMacro(UseStereoRendering, int);
52
  vtkGetStringMacro(StereoType);
53

54 55 56
  vtkGetMacro(ReverseConnection, int);
  vtkGetMacro(UseRenderingGroup, int);
  vtkGetVector2Macro(TileDimensions, int);
57
  vtkGetVector2Macro(TileMullions, int);
Utkarsh Ayachit's avatar
Utkarsh Ayachit committed
58

59 60 61 62 63 64 65 66 67 68
  /**
   * Returns the egl device index. -1 indicates that no value was specified.
   */
  vtkGetMacro(EGLDeviceIndex, int);

  /**
   * @deprecated in ParaView 5.5. Use `GetForceOnscreenRendering()` instead.
   */
  VTK_LEGACY(int GetUseOffscreenRendering());

69 70 71 72 73 74
  //@{
  /**
   * This is the argument specified by --data on the command line. Additionally,
   * this can also correspond to the last argument specified on the command
   * line if the argument is unknown.
   */
75
  vtkGetStringMacro(ParaViewDataName);
76
  //@}
77

78 79 80 81
  //@{
  /**
   * State file to load on startup.
   */
82 83 84 85
  // See Bug #5711
  vtkGetStringMacro(StateFileName);
  //@}

Louis Amore's avatar
Louis Amore committed
86 87 88 89 90
  //@{
  /**
   * Servers file to load on startup.
   */
  vtkGetStringMacro(ServersFileName);
91
  //@}
92 93 94 95 96 97 98

  //@{
  /**
   * Valid on PVSERVER and PVDATA_SERVER only. It denotes the time (in minutes)
   * since the time that the connection was established with the server that the
   * server may timeout. timeout <= 0 means no timeout.
   */
99
  vtkGetMacro(Timeout, int);
100
  //@}
101

102 103 104 105 106
  //@{
  /**
   * Clients need to set the ConnectID so they can handle server connections
   * after the client has started.
   */
107
  vtkSetMacro(ConnectID, int);
108
  //@}
109

110 111 112 113
  //@{
  /**
   * Log filename.
   */
114 115
  vtkSetStringMacro(LogFileName);
  vtkGetStringMacro(LogFileName);
116
  //@}
117

118 119 120 121
  //@{
  /**
   * vtkPVProcessModule needs to set this.
   */
122
  vtkSetVector2Macro(TileDimensions, int);
123
  vtkSetVector2Macro(TileMullions, int);
124
  vtkSetMacro(UseOffscreenRendering, int);
125
  //@}
126

127 128 129 130 131
  /**
   * Is this server was started for collaboration meaning that it allow
   * several clients to connect to the same server and share the same
   * pipeline and visualization.
   */
132
  virtual int GetMultiClientMode()
Kitware Robot's avatar
Kitware Robot committed
133 134 135
  {
    return (this->MultiClientMode || this->MultiClientModeWithErrorMacro) ? 1 : 0;
  }
136
  virtual int IsMultiClientModeDebug() { return this->MultiClientModeWithErrorMacro; }
137

138 139 140 141 142 143 144
  //@{
  /**
   * Returns if this server does not allow connection after the first client.
   */
  vtkGetMacro(DisableFurtherConnections, int);
  //@}

145 146 147 148
  //@{
  /**
   * Is this client allow multiple server connection in parallel
   */
149
  vtkGetMacro(MultiServerMode, int);
150 151 152 153 154 155 156 157 158 159
  //@}

  //@{
  /**
   * Indicates if the application is in symmetric mpi mode.
   * This is applicable only to PVBATCH type of processes.
   * Typically, when set to true, the python script is run on satellites as
   * well, otherwise only the root node processes the python script. Disabled by
   * default.
   */
160 161
  vtkGetMacro(SymmetricMPIMode, int);
  vtkSetMacro(SymmetricMPIMode, int);
162
  //@}
163

164 165 166 167
  //@{
  /**
   * Should this run print the version numbers and exit.
   */
168
  vtkGetMacro(TellVersion, int);
169
  //@}
170

171 172 173
  /// Provides access to server-url if specified on the command line.
  vtkGetStringMacro(ServerURL);

174 175 176 177
  //@{
  /**
   * This is used when user want to open a file at startup
   */
178
  vtkSetStringMacro(ParaViewDataName);
179
  //@}
180

181 182 183 184 185
  //@{
  /**
   * Until streaming becomes mainstream, we enable streaming support by passing
   * a command line argument to all processes.
   */
186
  vtkGetMacro(EnableStreaming, int);
187
  //@}
188

189 190 191 192
  //@{
  /**
   * Include originating process id text into server to client messages.
   */
193
  vtkSetMacro(SatelliteMessageIds, int);
Kitware Robot's avatar
Kitware Robot committed
194
  vtkGetMacro(SatelliteMessageIds, int);
195
  //@}
196

197 198 199 200
  //@{
  /**
   * Should this process just print monitor information and exit?
   */
201
  vtkGetMacro(PrintMonitors, int);
202
  //@}
203

204 205 206 207
  //@{
  /**
   * Adding ability to test plugins by loading them at command line
   */
208 209
  vtkGetStringMacro(TestPlugin);
  vtkGetStringMacro(TestPluginPath);
210
  //@}
211

212 213 214 215 216
  //@{
  /**
   * Flag for controlling auto generation of stack trace on POSIX
   * systems after crash.
   */
217 218
  vtkGetMacro(EnableStackTrace, int);
  vtkSetMacro(EnableStackTrace, int);
219
  //@}
220

221 222 223 224 225
  //@{
  /**
   * Flag for disabling loading of options and settings stored by the
   * application. Often used for testing.
   */
226
  vtkGetMacro(DisableRegistry, int);
227 228 229 230 231 232 233 234 235 236
  //@}

  //@{
  /**
   * XDisplay test on server processes during initialization sometimes happens
   * too early and may result in remote rendering prematurely disabled. When
   * this flag is set, ParaView will skip such X-display tests. Note, if the
   * display is truly inaccessible when ParaView tries to connect to the server,
   * we will indeed get runtimes errors, including segfaults.
   */
237
  vtkGetMacro(DisableXDisplayTests, int);
238
  //@}
239

240 241 242 243 244 245 246 247 248 249 250
  /**
   * When set to true, ParaView will create headless only render windows on the
   * current process.
   */
  vtkGetMacro(ForceOffscreenRendering, int);

  /**
   * When set to true, ParaView will create on-screen render windows.
   */
  vtkGetMacro(ForceOnscreenRendering, int);

251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268
  //@{
  /**
   * Get/Set the ForceNoMPIInitOnClient flag.
   */
  vtkGetMacro(ForceNoMPIInitOnClient, int);
  vtkSetMacro(ForceNoMPIInitOnClient, int);
  vtkBooleanMacro(ForceNoMPIInitOnClient, int);
  //@}

  //@{
  /**
   * Get/Set the ForceMPIInitOnClient flag.
   */
  vtkGetMacro(ForceMPIInitOnClient, int);
  vtkSetMacro(ForceMPIInitOnClient, int);
  vtkBooleanMacro(ForceMPIInitOnClient, int);
  //@}

269
  enum ProcessTypeEnum
Kitware Robot's avatar
Kitware Robot committed
270
  {
271 272 273 274 275 276
    PARAVIEW = 0x2,
    PVCLIENT = 0x4,
    PVSERVER = 0x8,
    PVRENDER_SERVER = 0x10,
    PVDATA_SERVER = 0x20,
    PVBATCH = 0x40,
Kitware Robot's avatar
Kitware Robot committed
277 278
    ALLPROCESS = PARAVIEW | PVCLIENT | PVSERVER | PVRENDER_SERVER | PVDATA_SERVER | PVBATCH
  };
279

280
protected:
281 282 283
  /**
   * Default constructor.
   */
284 285
  vtkPVOptions();

286 287 288
  /**
   * Destructor.
   */
289
  ~vtkPVOptions() override;
290

291 292 293
  /**
   * Initialize arguments.
   */
294
  void Initialize() VTK_OVERRIDE;
295

296 297 298
  /**
   * After parsing, process extra option dependencies.
   */
299
  int PostProcess(int argc, const char* const* argv) VTK_OVERRIDE;
300

301 302 303 304
  /**
   * This method is called when wrong argument is found. If it returns 0, then
   * the parsing will fail.
   */
305
  int WrongArgument(const char* argument) VTK_OVERRIDE;
306

307 308 309 310
  /**
   * This method is called when a deprecated argument is found. If it returns 0, then
   * the parsing will fail.
   */
311
  int DeprecatedArgument(const char* argument) VTK_OVERRIDE;
312

313 314 315 316
  //@{
  /**
   * Subclasses may need to access these
   */
317
  char* ParaViewDataName;
318
  char* ServerURL; // server URL information
319
  int ServerMode;
320
  int ClientMode;
321
  int RenderServerMode;
322
  int MultiClientMode;
323
  int DisableFurtherConnections;
324
  int MultiClientModeWithErrorMacro;
325
  int MultiServerMode;
326
  int SymmetricMPIMode;
Louis Amore's avatar
Louis Amore committed
327
  char* ServersFileName;
Kitware Robot's avatar
Kitware Robot committed
328 329
  char* StateFileName; // loading state file(Bug #5711)
  char* TestPlugin;    // to load plugins from command line for tests
330
  char* TestPluginPath;
331
  int DisableXDisplayTests;
332
  //@}
333

334 335
  // inline setters
  vtkSetStringMacro(ServerURL);
Louis Amore's avatar
Louis Amore committed
336
  vtkSetStringMacro(ServersFileName);
337
  vtkSetStringMacro(StateFileName);
338 339
  vtkSetStringMacro(TestPlugin);
  vtkSetStringMacro(TestPluginPath);
340

341
private:
342 343
  int ConnectID;
  int UseOffscreenRendering;
344
  int EGLDeviceIndex;
345 346 347
  int UseStereoRendering;
  int ReverseConnection;
  int TileDimensions[2];
348
  int TileMullions[2];
349
  int UseRenderingGroup;
350
  int Timeout;
351
  char* LogFileName;
352
  int TellVersion;
353
  char* StereoType;
354
  int EnableStreaming;
355
  int SatelliteMessageIds;
356
  int PrintMonitors;
357
  int EnableStackTrace;
358
  int DisableRegistry;
359 360
  int ForceMPIInitOnClient;
  int ForceNoMPIInitOnClient;
361
  int DummyMesaFlag;
362 363
  int ForceOffscreenRendering;
  int ForceOnscreenRendering;
364 365 366

  // inline setters
  vtkSetStringMacro(StereoType);
367

368
private:
369 370
  vtkPVOptions(const vtkPVOptions&) = delete;
  void operator=(const vtkPVOptions&) = delete;
371 372

  vtkSetStringMacro(HostName);
373
  char* HostName;
374 375
};

376
#endif