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 =========================================================================*/
25 #ifndef vtkADIOSWriter_h
26 #define vtkADIOSWriter_h
27 
28 #include <map> // For independently stepped array indexing
29 #include <string> // For independently stepped array indexing
30 #include <vector> // For independently stepped array indexing
31 
32 #include "vtkDataObjectAlgorithm.h"
33 #include "vtkMultiProcessController.h" // For the MPI controller member
34 #include "vtkSetGet.h" // For property get/set macros
35 
36 #include "ADIOSDefs.h" // For enum definitions
37 
38 #include "vtkIOADIOSModule.h" // For export macro
39 
40 namespace ADIOS
41 {
42  class Writer;
43 }
44 
45 class vtkAbstractArray;
46 class vtkCellArray;
47 class vtkDataArray;
48 class vtkDataObject;
49 class vtkDataSet;
50 class vtkFieldData;
51 class vtkImageData;
52 class vtkPolyData;
54 
55 class VTKIOADIOS_EXPORT vtkADIOSWriter : public vtkDataObjectAlgorithm
56 {
57 public:
58  static vtkADIOSWriter* New();
60  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
61 
62  const char* GetDefaultFileExtension();
63 
65 
68  vtkGetStringMacro(FileName)
69  vtkSetStringMacro(FileName)
71 
73 
76  vtkGetMacro(TransportMethod, int);
77  vtkSetClampMacro(TransportMethod, int,
78  static_cast<int>(ADIOS::TransportMethod_NULL),
79  static_cast<int>(ADIOS::TransportMethod_NetCDF4));
80  void SetTransportMethodToNULL() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_NULL)); }
81  void SetTransportMethodToPOSIX() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_POSIX)); }
82  void SetTransportMethodToMPI() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_MPI)); }
83  void SetTransportMethodToMPILustre() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_MPI_LUSTRE)); }
84  void SetTransportMethodToMPIAggregate() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_MPI_AGGREGATE)); }
85  void SetTransportMethodToVarMerge() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_VAR_MERGE)); }
86  void SetTransportMethodToDataSpaces() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_DataSpaces)); }
87  void SetTransportMethodToDIMES() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_DIMES)); }
88  void SetTransportMethodToFlexPath() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_FlexPath)); }
89  void SetTransportMethodToPHDF5() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_PHDF5)); }
90  void SetTransportMethodToNetCDF4() { this->SetTransportMethod(static_cast<int>(ADIOS::TransportMethod_NetCDF4)); }
92 
94 
98  vtkSetStringMacro(TransportMethodArguments)
99  vtkGetStringMacro(TransportMethodArguments)
101 
103 
106  vtkGetMacro(Transform, int);
107  vtkSetClampMacro(Transform, int,
108  static_cast<int>(ADIOS::Transform_NONE),
109  static_cast<int>(ADIOS::Transform_SZIP));
110  void SetTransformToNone() { this->SetTransform(static_cast<int>(ADIOS::Transform_NONE)); }
111  void SetTransformToZLib() { this->SetTransform(static_cast<int>(ADIOS::Transform_ZLIB)); }
112  void SetTransformToBZip2() { this->SetTransform(static_cast<int>(ADIOS::Transform_BZLIB2)); }
113  void SetTransformToSZip() { this->SetTransform(static_cast<int>(ADIOS::Transform_SZIP)); }
115 
117 
122  vtkSetMacro(WriteAllTimeSteps, bool);
123  vtkGetMacro(WriteAllTimeSteps, bool);
124  vtkBooleanMacro(WriteAllTimeSteps, bool);
126 
128 
131  void SetController(vtkMultiProcessController*);
132  vtkGetObjectMacro(Controller, vtkMultiProcessController);
134 
140 
144  void Write() { return this->Update(); }
145 
146 protected:
147 
149 
152  void Define(const std::string& path, const vtkAbstractArray* value);
153  void Define(const std::string& path, const vtkDataArray* value);
154  void Define(const std::string& path, const vtkCellArray* value);
155  void Define(const std::string& path, const vtkFieldData* value);
156  void Define(const std::string& path, const vtkDataSet* value);
157  void Define(const std::string& path, const vtkImageData* value);
158  void Define(const std::string& path, const vtkPolyData* value);
159  void Define(const std::string& path, const vtkUnstructuredGrid* value);
161 
163 
169  void OpenFile();
170  void CloseFile();
172 
174 
177  void Write(const std::string& path, const vtkAbstractArray* value);
178  void Write(const std::string& path, const vtkDataArray* value);
179  void Write(const std::string& path, const vtkCellArray* value);
180  void Write(const std::string& path, const vtkFieldData* value);
181  void Write(const std::string& path, const vtkDataSet* value);
182  void Write(const std::string& path, const vtkImageData* value);
183  void Write(const std::string& path, const vtkPolyData* value);
184  void Write(const std::string& path, const vtkUnstructuredGrid* value);
186 
187  char *FileName;
191  int Rank;
195 
196  vtkADIOSWriter();
197  ~vtkADIOSWriter();
198 
199 protected:
200  // Used to implement vtkAlgorithm
201 
203 
204  virtual int RequestInformation(vtkInformation *request,
205  vtkInformationVector **input,
206  vtkInformationVector *output);
207  virtual int RequestUpdateExtent(vtkInformation *request,
208  vtkInformationVector **input,
209  vtkInformationVector *output);
210  virtual int RequestData(vtkInformation *request,
211  vtkInformationVector **input,
212  vtkInformationVector *output);
213 
218  std::vector<double> TimeSteps;
220  int RequestExtent[6];
221 
222  // Used to determine whether or not the data getting written is stale
223  bool UpdateMTimeTable(const std::string& path, const vtkObject* value);
224  std::map<std::string, unsigned long> LastUpdated;
225 private:
226  bool WriteInternal();
227 
228  template<typename T>
229  bool DefineAndWrite(vtkDataObject *input);
230 
231  vtkADIOSWriter(const vtkADIOSWriter&) VTK_DELETE_FUNCTION;
232  void operator=(const vtkADIOSWriter&) VTK_DELETE_FUNCTION;
233 };
234 
235 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
Abstract superclass for all arrays.
static vtkDataObjectAlgorithm * New()
void SetTransportMethodToMPIAggregate()
Get/Set the ADIOS transport method.
vtkMultiProcessController * Controller
void SetTransportMethodToMPI()
Get/Set the ADIOS transport method.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
void SetTransportMethodToNetCDF4()
Get/Set the ADIOS transport method.
Write ADIOS files.
void SetTransportMethodToDataSpaces()
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:39
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:45
std::map< std::string, unsigned long > LastUpdated
void SetTransformToBZip2()
Get/Set the data transformation.
int ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
see vtkAlgorithm for details
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 *)
This is called by the superclass.
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.
virtual void Update()
Bring this algorithm's outputs up-to-date.
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:50
void SetTransformToSZip()
Get/Set the data transformation.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Store zero or more vtkInformation instances.
void SetTransportMethodToMPILustre()
Get/Set the ADIOS transport method.
void SetTransportMethodToFlexPath()
Get/Set the ADIOS transport method.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
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:64
represent and manipulate fields of data
Definition: vtkFieldData.h:56
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Transform
Definition: ADIOSDefs.h:39
Multiprocessing communication superclass.