VTK
vtkXdmfWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkXdmfWriter.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 =========================================================================*/
15 
26 #ifndef vtkXdmfWriter_h
27 #define vtkXdmfWriter_h
28 
29 #include "vtkIOXdmf2Module.h" // For export macro
30 
31 #include "vtkDataObjectAlgorithm.h"
32 
33 #include <string> // Needed for private members
34 #include <vector> //
35 
36 class vtkExecutive;
37 
39 class vtkDataArray;
40 class vtkDataSet;
41 class vtkDataObject;
42 class vtkFieldData;
43 class vtkInformation;
45 class vtkXdmfWriterDomainMemoryHandler;
46 
47 namespace xdmf2
48 {
49 class XdmfArray;
50 class XdmfDOM;
51 class XdmfElement;
52 class XdmfGrid;
53 class XdmfGeometry;
54 class XdmfTopology;
55 }
56 
57 class VTKIOXDMF2_EXPORT vtkXdmfWriter : public vtkDataObjectAlgorithm
58 {
59 public:
60  static vtkXdmfWriter *New();
62  void PrintSelf(ostream& os, vtkIndent indent) override;
63 
67  virtual void SetInputData(vtkDataObject* dobj);
68 
70 
73  vtkSetStringMacro(FileName);
74  vtkGetStringMacro(FileName);
76 
78 
82  vtkSetStringMacro(HeavyDataFileName);
83  vtkGetStringMacro(HeavyDataFileName);
85 
87 
91  vtkSetStringMacro(HeavyDataGroupName);
92  vtkGetStringMacro(HeavyDataGroupName);
94 
100  virtual int Write();
101 
103 
108  vtkSetMacro(LightDataLimit, int);
109  vtkGetMacro(LightDataLimit, int);
111 
113 
118  vtkSetMacro(WriteAllTimeSteps, int);
119  vtkGetMacro(WriteAllTimeSteps, int);
120  vtkBooleanMacro(WriteAllTimeSteps, int);
122 
124 
130  vtkSetMacro(MeshStaticOverTime, bool);
131  vtkGetMacro(MeshStaticOverTime, bool);
132  vtkBooleanMacro(MeshStaticOverTime, bool);
134 
136 
140  vtkSetMacro(Piece, int);
141  vtkSetMacro(NumberOfPieces, int);
143 
144  //TODO: control choice of heavy data format (xml, hdf5, sql, raw)
145 
146  //TODO: These controls are available in vtkXdmfWriter, but are not used here.
147  //GridsOnly
148  //Append to Domain
149 
150 protected:
151  vtkXdmfWriter();
152  ~vtkXdmfWriter() override;
153 
154  //Choose composite executive by default for time.
156 
157  //Can take any one data object
158  int FillInputPortInformation(int port, vtkInformation *info) override;
159 
160  //Overridden to ...
163  vtkInformationVector*) override;
164  //Overridden to ...
167  vtkInformationVector*) override;
168  //Overridden to ...
171  vtkInformationVector*) override;
172 
173  //These do the work: recursively parse down input's structure all the way to arrays,
174  //use XDMF lib to dump everything to file.
175 
176  virtual int CreateTopology(vtkDataSet *ds, xdmf2::XdmfGrid *grid, vtkIdType PDims[3], vtkIdType CDims[3], vtkIdType &PRank, vtkIdType &CRank, void *staticdata);
177  virtual int CreateGeometry(vtkDataSet *ds, xdmf2::XdmfGrid *grid, void *staticdata);
178 
179  virtual int WriteDataSet(vtkDataObject *dobj, xdmf2::XdmfGrid *grid);
180  virtual int WriteCompositeDataSet(vtkCompositeDataSet *dobj, xdmf2::XdmfGrid *grid);
181  virtual int WriteAtomicDataSet(vtkDataObject *dobj, xdmf2::XdmfGrid *grid);
182  virtual int WriteArrays(vtkFieldData* dsa, xdmf2::XdmfGrid *grid, int association,
183  vtkIdType rank, vtkIdType *dims, const char *name);
184  virtual void ConvertVToXArray(vtkDataArray *vda, xdmf2::XdmfArray *xda,
185  vtkIdType rank, vtkIdType *dims,
186  int AllocStrategy, const char *heavyprefix);
187 
188  virtual void SetupDataArrayXML(xdmf2::XdmfElement*, xdmf2::XdmfArray*) const;
189 
190  char *FileName;
195 
197 
200  double CurrentTime;
204 
205  int Piece;
207 
209 
210  xdmf2::XdmfDOM *DOM;
211  xdmf2::XdmfGrid *TopTemporalGrid;
212 
213  vtkXdmfWriterDomainMemoryHandler *DomainMemoryHandler;
214 
215  std::vector<xdmf2::XdmfTopology*> TopologyAtT0;
216  std::vector<xdmf2::XdmfGeometry*> GeometryAtT0;
217 
218 private:
219  vtkXdmfWriter(const vtkXdmfWriter&) = delete;
220  void operator=(const vtkXdmfWriter&) = delete;
221 };
222 
223 #endif /* vtkXdmfWriter_h */
virtual vtkExecutive * CreateDefaultExecutive()
Create a default executive.
Store vtkAlgorithm input/output information.
char * HeavyDataGroupName
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
static vtkDataObjectAlgorithm * New()
int vtkIdType
Definition: vtkType.h:347
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:46
std::string BaseFileName
abstract superclass for composite (multi-block or AMR) datasets
std::vector< xdmf2::XdmfGeometry * > GeometryAtT0
write eXtensible Data Model and Format files
Definition: vtkXdmfWriter.h:57
a simple class to control print indentation
Definition: vtkIndent.h:33
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
xdmf2::XdmfGrid * TopTemporalGrid
void SetInputData(vtkDataObject *)
Assign a data object as input.
vtkXdmfWriterDomainMemoryHandler * DomainMemoryHandler
std::string WorkingDirectory
void WriteDataSet(vtkUnstructuredGrid *grid, const std::string &file)
Superclass for algorithms that produce only data object as output.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
double CurrentTime
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
int UnlabelledDataArrayId
Store zero or more vtkInformation instances.
bool MeshStaticOverTime
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
xdmf2::XdmfDOM * DOM
std::vector< xdmf2::XdmfTopology * > TopologyAtT0
general representation of visualization data
Definition: vtkDataObject.h:58
char * HeavyDataFileName
represent and manipulate fields of data
Definition: vtkFieldData.h:53
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.