VTK
vtkADIOSWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkADIOSWriter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
22 #ifndef vtkADIOSWriter_h
23 #define vtkADIOSWriter_h
24 
25 #include <map> // For independently stepped array indexing
26 #include <string> // For independently stepped array indexing
27 #include <vector> // For independently stepped array indexing
28 
29 #include "vtkDataObjectAlgorithm.h"
30 #include "vtkMultiProcessController.h" // For the MPI controller member
31 #include "vtkSetGet.h" // For property get/set macros
32 
33 #include "ADIOSDefs.h" // For enum definitions
34 
35 #include "vtkIOADIOSModule.h" // For export macro
36 
37 namespace ADIOS
38 {
39  class Writer;
40 }
41 
42 class vtkAbstractArray;
43 class vtkCellArray;
44 class vtkDataArray;
45 class vtkDataObject;
46 class vtkDataSet;
47 class vtkFieldData;
48 class vtkImageData;
49 class vtkPolyData;
51 
52 class VTKIOADIOS_EXPORT vtkADIOSWriter : public vtkDataObjectAlgorithm
53 {
54 public:
55  static vtkADIOSWriter* New();
57  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
58 
59  const char* GetDefaultFileExtension();
60 
62 
65  vtkGetStringMacro(FileName)
66  vtkSetStringMacro(FileName)
68 
70 
73  vtkGetMacro(TransportMethod, int);
74  vtkSetClampMacro(TransportMethod, int,
75  static_cast<int>(ADIOS::TransportMethod_NULL),
76  static_cast<int>(ADIOS::TransportMethod_NetCDF4));
77  void SetTransportMethodToNULL() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_NULL)); }
78  void SetTransportMethodToPOSIX() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_POSIX)); }
79  void SetTransportMethodToMPI() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_MPI)); }
80  void SetTransportMethodToMPILustre() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_MPI_LUSTRE)); }
81  void SetTransportMethodToMPIAggregate() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_MPI_AGGREGATE)); }
82  void SetTransportMethodToVarMerge() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_VAR_MERGE)); }
83  void SetTransportMethodToDataSpaces() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_DataSpaces)); }
84  void SetTransportMethodToDIMES() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_DIMES)); }
85  void SetTransportMethodToFlexPath() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_FlexPath)); }
86  void SetTransportMethodToPHDF5() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_PHDF5)); }
87  void SetTransportMethodToNetCDF4() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_NetCDF4)); }
89 
91 
95  vtkSetStringMacro(TransportMethodArguments)
96  vtkGetStringMacro(TransportMethodArguments)
98 
100 
103  vtkGetMacro(Transform, int);
104  vtkSetClampMacro(Transform, int,
105  static_cast<int>(ADIOS::Transform_NONE),
106  static_cast<int>(ADIOS::Transform_SZIP));
107  void SetTransformToNone() { this->SetTransform(static_cast<int>(ADIOS::Transform_NONE)); }
108  void SetTransformToZLib() { this->SetTransform(static_cast<int>(ADIOS::Transform_ZLIB)); }
109  void SetTransformToBZip2() { this->SetTransform(static_cast<int>(ADIOS::Transform_BZLIB2)); }
110  void SetTransformToSZip() { this->SetTransform(static_cast<int>(ADIOS::Transform_SZIP)); }
112 
114 
119  vtkSetMacro(WriteAllTimeSteps, bool);
120  vtkGetMacro(WriteAllTimeSteps, bool);
121  vtkBooleanMacro(WriteAllTimeSteps, bool);
123 
125 
128  void SetController(vtkMultiProcessController*);
129  vtkGetObjectMacro(Controller, vtkMultiProcessController);
131 
135  virtual int ProcessRequest(vtkInformation*, vtkInformationVector**,
137 
141  void Write() { return this->Update(); }
142 
143 protected:
144 
146 
149  void Define(const std::string& path, const vtkAbstractArray* value);
150  void Define(const std::string& path, const vtkDataArray* value);
151  void Define(const std::string& path, const vtkCellArray* value);
152  void Define(const std::string& path, const vtkFieldData* value);
153  void Define(const std::string& path, const vtkDataSet* value);
154  void Define(const std::string& path, const vtkImageData* value);
155  void Define(const std::string& path, const vtkPolyData* value);
156  void Define(const std::string& path, const vtkUnstructuredGrid* value);
158 
160 
166  void OpenFile();
167  void CloseFile();
169 
171 
174  void Write(const std::string& path, const vtkAbstractArray* value);
175  void Write(const std::string& path, const vtkDataArray* value);
176  void Write(const std::string& path, const vtkCellArray* value);
177  void Write(const std::string& path, const vtkFieldData* value);
178  void Write(const std::string& path, const vtkDataSet* value);
179  void Write(const std::string& path, const vtkImageData* value);
180  void Write(const std::string& path, const vtkPolyData* value);
181  void Write(const std::string& path, const vtkUnstructuredGrid* value);
183 
184  char *FileName;
188  int Rank;
192 
193  vtkADIOSWriter();
194  ~vtkADIOSWriter();
195 
196 protected:
197  // Used to implement vtkAlgorithm
198 
199  int FillInputPortInformation(int port, vtkInformation* info);
200 
201  virtual int RequestInformation(vtkInformation *request,
202  vtkInformationVector **input,
203  vtkInformationVector *output);
204  virtual int RequestUpdateExtent(vtkInformation *request,
205  vtkInformationVector **input,
206  vtkInformationVector *output);
207  virtual int RequestData(vtkInformation *request,
208  vtkInformationVector **input,
209  vtkInformationVector *output);
210 
215  std::vector<double> TimeSteps;
217  int RequestExtent[6];
218 
219  // Used to determine whether or not the data getting written is stale
220  bool UpdateMTimeTable(const std::string& path, const vtkObject* value);
221  std::map<std::string, unsigned long> LastUpdated;
222 private:
223  bool WriteInternal();
224 
225  template<typename T>
226  bool DefineAndWrite(vtkDataObject *input);
227 
228  vtkADIOSWriter(const vtkADIOSWriter&) VTK_DELETE_FUNCTION;
229  void operator=(const vtkADIOSWriter&) VTK_DELETE_FUNCTION;
230 };
231 
232 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:53
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
Abstract superclass for all arrays.
void SetTransportMethodToMPIAggregate()
Get/Set the ADIOS transport method.
vtkMultiProcessController * Controller
void SetTransformToNone()
Get/Set the data transformation.
virtual void Update()
Updates the extensions string.
void SetTransportMethodToMPI()
Get/Set the ADIOS transport method.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
void SetTransportMethodToNetCDF4()
Get/Set the ADIOS transport method.
Write ADIOS files.
void SetTransportMethodToDataSpaces()
Get/Set the ADIOS transport method.
void SetTransportMethodToNULL()
Get/Set the ADIOS transport method.
void SetTransformToZLib()
Get/Set the data transformation.
void SetTransportMethodToPHDF5()
Get/Set the ADIOS transport method.
char * TransportMethodArguments
TransportMethod
Definition: ADIOSDefs.h:23
a simple class to control print indentation
Definition: vtkIndent.h:33
void Write()
Declare data if necessary and write the current step to the output stream.
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
std::map< std::string, unsigned long > LastUpdated
void SetTransformToBZip2()
Get/Set the data transformation.
std::vector< double > TimeSteps
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
void SetTransportMethodToPOSIX()
Get/Set the ADIOS transport method.
void SetTransportMethodToVarMerge()
Get/Set the ADIOS transport method.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
void SetTransportMethodToDIMES()
Get/Set the ADIOS transport method.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Superclass for algorithms that produce only data object as output.
object to represent cell connectivity
Definition: vtkCellArray.h:44
void SetTransformToSZip()
Get/Set the data transformation.
Store zero or more vtkInformation instances.
void SetTransportMethodToMPILustre()
Get/Set the ADIOS transport method.
void SetTransportMethodToFlexPath()
Get/Set the ADIOS transport method.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
ADIOS::Writer * Writer
general representation of visualization data
Definition: vtkDataObject.h:58
represent and manipulate fields of data
Definition: vtkFieldData.h:53
Transform
Definition: ADIOSDefs.h:39
Multiprocessing communication superclass.