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 =========================================================================*/
24 #ifndef vtkADIOSWriter_h
25 #define vtkADIOSWriter_h
26 
27 #include <map> // For independently stepped array indexing
28 #include <string> // For independently stepped array indexing
29 #include <vector> // For independently stepped array indexing
30 
31 #include "vtkDataObjectAlgorithm.h"
32 #include "vtkMultiProcessController.h" // For the MPI controller member
33 #include "vtkSetGet.h" // For property get/set macros
34 
35 #include "ADIOSDefs.h" // For enum definitions
36 
37 #include "vtkIOADIOSModule.h" // For export macro
38 
39 namespace ADIOS
40 {
41  class Writer;
42 }
43 
44 class vtkAbstractArray;
45 class vtkCellArray;
46 class vtkDataArray;
47 class vtkDataObject;
48 class vtkDataSet;
49 class vtkFieldData;
50 class vtkImageData;
51 class vtkPolyData;
53 
54 class VTKIOADIOS_EXPORT vtkADIOSWriter : public vtkDataObjectAlgorithm
55 {
56 public:
57  static vtkADIOSWriter* New();
59  virtual void PrintSelf(ostream& os, vtkIndent indent);
60 
61  const char* GetDefaultFileExtension();
62 
64 
65  vtkGetStringMacro(FileName)
66  vtkSetStringMacro(FileName)
68 
70 
71  vtkGetMacro(TransportMethod, int);
72  vtkSetClampMacro(TransportMethod, int,
73  static_cast<int>(ADIOS::TransportMethod_NULL),
74  static_cast<int>(ADIOS::TransportMethod_NetCDF4));
75  void SetTransportMethodToNULL() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_NULL)); }
76  void SetTransportMethodToPOSIX() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_POSIX)); }
77  void SetTransportMethodToMPI() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_MPI)); }
78  void SetTransportMethodToMPILustre() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_MPI_LUSTRE)); }
79  void SetTransportMethodToMPIAggregate() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_MPI_AGGREGATE)); }
80  void SetTransportMethodToVarMerge() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_VAR_MERGE)); }
81  void SetTransportMethodToDataSpaces() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_DataSpaces)); }
82  void SetTransportMethodToDIMES() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_DIMES)); }
83  void SetTransportMethodToFlexPath() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_FlexPath)); }
84  void SetTransportMethodToPHDF5() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_PHDF5)); }
85  void SetTransportMethodToNetCDF4() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_NetCDF4)); }
87 
89 
91  vtkSetStringMacro(TransportMethodArguments)
92  vtkGetStringMacro(TransportMethodArguments)
94 
96 
97  vtkGetMacro(Transform, int);
98  vtkSetClampMacro(Transform, int,
99  static_cast<int>(ADIOS::Transform_NONE),
100  static_cast<int>(ADIOS::Transform_SZIP));
101  void SetTransformToNone() { this->SetTransform(static_cast<int>(ADIOS::Transform_NONE)); }
102  void SetTransformToZLib() { this->SetTransform(static_cast<int>(ADIOS::Transform_ZLIB)); }
103  void SetTransformToBZip2() { this->SetTransform(static_cast<int>(ADIOS::Transform_BZLIB2)); }
104  void SetTransformToSZip() { this->SetTransform(static_cast<int>(ADIOS::Transform_SZIP)); }
106 
108 
110  vtkSetMacro(WriteAllTimeSteps, bool);
111  vtkGetMacro(WriteAllTimeSteps, bool);
112  vtkBooleanMacro(WriteAllTimeSteps, bool);
114 
116 
117  void SetController(vtkMultiProcessController*);
118  vtkGetObjectMacro(Controller, vtkMultiProcessController);
120 
122 
126 
129  void Write() { return this->Update(); }
130 
131 protected:
132 
134 
135  void Define(const std::string& path, const vtkAbstractArray* value);
136  void Define(const std::string& path, const vtkDataArray* value);
137  void Define(const std::string& path, const vtkCellArray* value);
138  void Define(const std::string& path, const vtkFieldData* value);
139  void Define(const std::string& path, const vtkDataSet* value);
140  void Define(const std::string& path, const vtkImageData* value);
141  void Define(const std::string& path, const vtkPolyData* value);
142  void Define(const std::string& path, const vtkUnstructuredGrid* value);
144 
146 
150  void OpenFile();
151  void CloseFile();
153 
155 
156  void Write(const std::string& path, const vtkAbstractArray* value);
157  void Write(const std::string& path, const vtkDataArray* value);
158  void Write(const std::string& path, const vtkCellArray* value);
159  void Write(const std::string& path, const vtkFieldData* value);
160  void Write(const std::string& path, const vtkDataSet* value);
161  void Write(const std::string& path, const vtkImageData* value);
162  void Write(const std::string& path, const vtkPolyData* value);
163  void Write(const std::string& path, const vtkUnstructuredGrid* value);
165 
166  char *FileName;
170  int Rank;
173  ADIOS::Writer *Writer;
174 
175  vtkADIOSWriter();
176  ~vtkADIOSWriter();
177 
178 protected:
179  // Used to implement vtkAlgorithm
180 
182 
183  virtual int RequestInformation(vtkInformation *request,
184  vtkInformationVector **input,
185  vtkInformationVector *output);
186  virtual int RequestUpdateExtent(vtkInformation *request,
187  vtkInformationVector **input,
188  vtkInformationVector *output);
189  virtual int RequestData(vtkInformation *request,
190  vtkInformationVector **input,
191  vtkInformationVector *output);
192 
197  std::vector<double> TimeSteps;
199  int RequestExtent[6];
200 
201  // Used to determine whether or not the data getting written is stale
202  bool UpdateMTimeTable(const std::string path, const vtkObject* value);
203  std::map<std::string, unsigned long> LastUpdated;
204 private:
205  bool WriteInternal();
206 
207  template<typename T>
208  bool DefineAndWrite(vtkDataObject *input);
209 
210  vtkADIOSWriter(const vtkADIOSWriter&); // Not implemented.
211  void operator=(const vtkADIOSWriter&); // Not implemented.
212 };
213 
214 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:61
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
Abstract superclass for all arrays.
static vtkDataObjectAlgorithm * New()
void SetTransportMethodToMPIAggregate()
vtkMultiProcessController * Controller
void PrintSelf(ostream &os, vtkIndent indent)
void SetTransportMethodToMPI()
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
void SetTransportMethodToNetCDF4()
Write ADIOS files.
void SetTransportMethodToDataSpaces()
void SetTransformToZLib()
void SetTransportMethodToPHDF5()
char * TransportMethodArguments
a simple class to control print indentation
Definition: vtkIndent.h:38
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
std::map< std::string, unsigned long > LastUpdated
void SetTransformToBZip2()
std::vector< double > TimeSteps
dataset represents arbitrary combinations of all possible cell types
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
void SetTransportMethodToPOSIX()
void SetTransportMethodToVarMerge()
virtual int FillInputPortInformation(int port, vtkInformation *info)
void SetTransportMethodToDIMES()
virtual void Update()
Superclass for algorithms that produce only data object as output.
object to represent cell connectivity
Definition: vtkCellArray.h:49
void SetTransformToSZip()
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual int ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Store zero or more vtkInformation instances.
void SetTransportMethodToMPILustre()
void SetTransportMethodToFlexPath()
ADIOS::Writer * Writer
general representation of visualization data
Definition: vtkDataObject.h:64
represent and manipulate fields of data
Definition: vtkFieldData.h:55
Multiprocessing communication superclass.