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) 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 SetTransportMethodTonullptr() { 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&) = delete;
232  void operator=(const vtkADIOSWriter&) = delete;
233 };
234 
235 #endif
vtkADIOSWriter::SetTransportMethodToDataSpaces
void SetTransportMethodToDataSpaces()
Definition: vtkADIOSWriter.h:86
ADIOS::Writer
Definition: ADIOSWriter.h:46
vtkADIOSWriter::SetTransportMethodToMPILustre
void SetTransportMethodToMPILustre()
Definition: vtkADIOSWriter.h:83
vtkADIOSWriter::SetTransportMethodToVarMerge
void SetTransportMethodToVarMerge()
Definition: vtkADIOSWriter.h:85
vtkADIOSWriter::NumberOfGhostLevels
int NumberOfGhostLevels
Definition: vtkADIOSWriter.h:216
ADIOSDefs.h
vtkADIOSWriter::Rank
int Rank
Definition: vtkADIOSWriter.h:191
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:89
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:214
vtkADIOSWriter::WriteAllTimeSteps
bool WriteAllTimeSteps
Definition: vtkADIOSWriter.h:217
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
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:188
ADIOS::TransportMethod_MPI
Definition: ADIOSDefs.h:28
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:59
vtkADIOSWriter::SetTransportMethodToMPI
void SetTransportMethodToMPI()
Definition: vtkADIOSWriter.h:82
ADIOS::TransportMethod_FlexPath
Definition: ADIOSDefs.h:34
vtkADIOSWriter::Transform
int Transform
Definition: vtkADIOSWriter.h:190
vtkADIOSWriter::RequestPiece
int RequestPiece
Definition: vtkADIOSWriter.h:215
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
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:56
vtkADIOSWriter::FileName
char * FileName
Definition: vtkADIOSWriter.h:187
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:110
ADIOS::Transform
Transform
Definition: ADIOSDefs.h:40
ADIOS::TransportMethod_NetCDF4
Definition: ADIOSDefs.h:36
vtkMultiProcessController
Multiprocessing communication superclass.
Definition: vtkMultiProcessController.h:82
vtkAlgorithm::Update
virtual void Update()
vtkADIOSWriter::CurrentStep
int CurrentStep
Definition: vtkADIOSWriter.h:192
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkADIOSWriter::Controller
vtkMultiProcessController * Controller
Definition: vtkADIOSWriter.h:193
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:50
vtkADIOSWriter::SetTransportMethodToDIMES
void SetTransportMethodToDIMES()
Definition: vtkADIOSWriter.h:87
vtkADIOSWriter::TransportMethodArguments
char * TransportMethodArguments
Definition: vtkADIOSWriter.h:189
ADIOS::TransportMethod
TransportMethod
Definition: ADIOSDefs.h:24
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:78
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkX3D::info
Definition: vtkX3D.h:376
vtkADIOSWriter::SetTransportMethodToMPIAggregate
void SetTransportMethodToMPIAggregate()
Definition: vtkADIOSWriter.h:84
vtkADIOSWriter::SetTransportMethodToNetCDF4
void SetTransportMethodToNetCDF4()
Definition: vtkADIOSWriter.h:90
vtkX3D::string
Definition: vtkX3D.h:490
ADIOS
Definition: ADIOSAttribute.h:27
vtkADIOSWriter::SetTransportMethodTonullptr
void SetTransportMethodTonullptr()
Definition: vtkADIOSWriter.h:80
vtkADIOSWriter::CurrentTimeStepIndex
int CurrentTimeStepIndex
Definition: vtkADIOSWriter.h:219
vtkADIOSWriter::SetTransportMethodToFlexPath
void SetTransportMethodToFlexPath()
Definition: vtkADIOSWriter.h:88
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:85
vtkDataObjectAlgorithm::New
static vtkDataObjectAlgorithm * New()
ADIOS::Transform_NONE
Definition: ADIOSDefs.h:42
vtkADIOSWriter::SetTransformToZLib
void SetTransformToZLib()
Definition: vtkADIOSWriter.h:111
vtkDataObjectAlgorithm::RequestData
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Definition: vtkDataObjectAlgorithm.h:122
vtkADIOSWriter::LastUpdated
std::map< std::string, unsigned long > LastUpdated
Definition: vtkADIOSWriter.h:224
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:87
vtkDataObjectAlgorithm.h
vtkADIOSWriter::SetTransportMethodToPOSIX
void SetTransportMethodToPOSIX()
Definition: vtkADIOSWriter.h:81
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:55
vtkDataObjectAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkADIOSWriter::SetTransformToBZip2
void SetTransformToBZip2()
Definition: vtkADIOSWriter.h:112
vtkADIOSWriter::TimeSteps
std::vector< double > TimeSteps
Definition: vtkADIOSWriter.h:218
vtkADIOSWriter::SetTransformToSZip
void SetTransformToSZip()
Definition: vtkADIOSWriter.h:113
vtkADIOSWriter::Write
void Write()
Declare data if necessary and write the current step to the output stream.
Definition: vtkADIOSWriter.h:144
vtkADIOSWriter::Writer
ADIOS::Writer * Writer
Definition: vtkADIOSWriter.h:194
ADIOS::TransportMethod_POSIX
Definition: ADIOSDefs.h:27