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) 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 SetTransportMethodTonullptr() { 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 
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 
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&) = delete;
229  void operator=(const vtkADIOSWriter&) = delete;
230 };
231 
232 #endif
vtkADIOSWriter::SetTransportMethodToDataSpaces
void SetTransportMethodToDataSpaces()
Definition: vtkADIOSWriter.h:83
ADIOS::Writer
Definition: ADIOSWriter.h:46
vtkADIOSWriter::SetTransportMethodToMPILustre
void SetTransportMethodToMPILustre()
Definition: vtkADIOSWriter.h:80
vtkADIOSWriter::SetTransportMethodToVarMerge
void SetTransportMethodToVarMerge()
Definition: vtkADIOSWriter.h:82
vtkADIOSWriter::NumberOfGhostLevels
int NumberOfGhostLevels
Definition: vtkADIOSWriter.h:213
ADIOSDefs.h
vtkADIOSWriter::Rank
int Rank
Definition: vtkADIOSWriter.h:188
vtkDataObjectAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
ADIOS::Transform_BZLIB2
Definition: ADIOSDefs.h:44
vtkADIOSWriter::SetTransportMethodToPHDF5
void SetTransportMethodToPHDF5()
Definition: vtkADIOSWriter.h:86
vtkX3D::value
Definition: vtkX3D.h:220
ADIOS::TransportMethod_MPI_LUSTRE
Definition: ADIOSDefs.h:29
ADIOS::TransportMethod_DIMES
Definition: ADIOSDefs.h:33
ADIOS::TransportMethod_NULL
Definition: ADIOSDefs.h:26
vtkADIOSWriter::NumberOfPieces
int NumberOfPieces
Definition: vtkADIOSWriter.h:211
vtkADIOSWriter::WriteAllTimeSteps
bool WriteAllTimeSteps
Definition: vtkADIOSWriter.h:214
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkDataObjectAlgorithm
Superclass for algorithms that produce only data object as output.
Definition: vtkDataObjectAlgorithm.h:43
vtkMultiProcessController.h
ADIOS::Transform_ZLIB
Definition: ADIOSDefs.h:43
vtkADIOSWriter::TransportMethod
int TransportMethod
Definition: vtkADIOSWriter.h:185
ADIOS::TransportMethod_MPI
Definition: ADIOSDefs.h:28
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:53
vtkADIOSWriter::SetTransportMethodToMPI
void SetTransportMethodToMPI()
Definition: vtkADIOSWriter.h:79
ADIOS::TransportMethod_FlexPath
Definition: ADIOSDefs.h:34
vtkADIOSWriter::Transform
int Transform
Definition: vtkADIOSWriter.h:187
vtkADIOSWriter::RequestPiece
int RequestPiece
Definition: vtkADIOSWriter.h:212
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
ADIOS::Transform_SZIP
Definition: ADIOSDefs.h:45
ADIOS::TransportMethod_MPI_AGGREGATE
Definition: ADIOSDefs.h:30
vtkFieldData
represent and manipulate fields of data
Definition: vtkFieldData.h:53
vtkADIOSWriter::FileName
char * FileName
Definition: vtkADIOSWriter.h:184
ADIOS::TransportMethod_VAR_MERGE
Definition: ADIOSDefs.h:31
vtkX3D::port
Definition: vtkX3D.h:447
vtkDataObjectAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Definition: vtkDataObjectAlgorithm.h:115
ADIOS::TransportMethod_DataSpaces
Definition: ADIOSDefs.h:32
ADIOS::TransportMethod_PHDF5
Definition: ADIOSDefs.h:35
vtkADIOSWriter::SetTransformToNone
void SetTransformToNone()
Definition: vtkADIOSWriter.h:107
ADIOS::Transform
Transform
Definition: ADIOSDefs.h:40
ADIOS::TransportMethod_NetCDF4
Definition: ADIOSDefs.h:36
vtkMultiProcessController
Multiprocessing communication superclass.
Definition: vtkMultiProcessController.h:76
vtkAlgorithm::Update
virtual void Update()
vtkADIOSWriter::CurrentStep
int CurrentStep
Definition: vtkADIOSWriter.h:189
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkADIOSWriter::Controller
vtkMultiProcessController * Controller
Definition: vtkADIOSWriter.h:190
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:44
vtkADIOSWriter::SetTransportMethodToDIMES
void SetTransportMethodToDIMES()
Definition: vtkADIOSWriter.h:84
vtkADIOSWriter::TransportMethodArguments
char * TransportMethodArguments
Definition: vtkADIOSWriter.h:186
ADIOS::TransportMethod
TransportMethod
Definition: ADIOSDefs.h:24
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:75
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
vtkX3D::info
Definition: vtkX3D.h:376
vtkADIOSWriter::SetTransportMethodToMPIAggregate
void SetTransportMethodToMPIAggregate()
Definition: vtkADIOSWriter.h:81
vtkADIOSWriter::SetTransportMethodToNetCDF4
void SetTransportMethodToNetCDF4()
Definition: vtkADIOSWriter.h:87
vtkX3D::string
Definition: vtkX3D.h:490
ADIOS
Definition: ADIOSAttribute.h:27
vtkADIOSWriter::SetTransportMethodTonullptr
void SetTransportMethodTonullptr()
Definition: vtkADIOSWriter.h:77
vtkADIOSWriter::CurrentTimeStepIndex
int CurrentTimeStepIndex
Definition: vtkADIOSWriter.h:216
vtkADIOSWriter::SetTransportMethodToFlexPath
void SetTransportMethodToFlexPath()
Definition: vtkADIOSWriter.h:85
vtkDataObjectAlgorithm::ProcessRequest
int ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
see vtkAlgorithm for details
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
vtkDataObjectAlgorithm::New
static vtkDataObjectAlgorithm * New()
ADIOS::Transform_NONE
Definition: ADIOSDefs.h:42
vtkADIOSWriter::SetTransformToZLib
void SetTransformToZLib()
Definition: vtkADIOSWriter.h:108
vtkDataObjectAlgorithm::RequestData
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Definition: vtkDataObjectAlgorithm.h:122
vtkADIOSWriter::LastUpdated
std::map< std::string, unsigned long > LastUpdated
Definition: vtkADIOSWriter.h:221
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:81
vtkDataObjectAlgorithm.h
vtkADIOSWriter::SetTransportMethodToPOSIX
void SetTransportMethodToPOSIX()
Definition: vtkADIOSWriter.h:78
vtkDataObjectAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkADIOSWriter
Write ADIOS files.
Definition: vtkADIOSWriter.h:52
vtkDataObjectAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:58
vtkADIOSWriter::SetTransformToBZip2
void SetTransformToBZip2()
Definition: vtkADIOSWriter.h:109
vtkADIOSWriter::TimeSteps
std::vector< double > TimeSteps
Definition: vtkADIOSWriter.h:215
vtkADIOSWriter::SetTransformToSZip
void SetTransformToSZip()
Definition: vtkADIOSWriter.h:110
vtkADIOSWriter::Write
void Write()
Declare data if necessary and write the current step to the output stream.
Definition: vtkADIOSWriter.h:141
vtkADIOSWriter::Writer
ADIOS::Writer * Writer
Definition: vtkADIOSWriter.h:191
ADIOS::TransportMethod_POSIX
Definition: ADIOSDefs.h:27