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 
28 #ifndef _vtkXdmfWriter_h
29 #define _vtkXdmfWriter_h
30 
31 #include "vtkIOXdmf2Module.h" // For export macro
32 
33 #include "vtkDataObjectAlgorithm.h"
34 
35 #include <string> // Needed for private members
36 #include <vector> //
37 
38 class vtkExecutive;
39 
41 class vtkDataArray;
42 class vtkDataSet;
43 class vtkDataObject;
44 class vtkFieldData;
45 class vtkInformation;
47 class vtkXdmfWriterDomainMemoryHandler;
48 
49 namespace xdmf2
50 {
51 class XdmfArray;
52 class XdmfDOM;
53 class XdmfElement;
54 class XdmfGrid;
55 class XdmfGeometry;
56 class XdmfTopology;
57 }
58 
59 class VTKIOXDMF2_EXPORT vtkXdmfWriter : public vtkDataObjectAlgorithm
60 {
61 public:
62  static vtkXdmfWriter *New();
64  void PrintSelf(ostream& os, vtkIndent indent);
65 
67  virtual void SetInputData(vtkDataObject* dobj);
68 
70 
71  vtkSetStringMacro(FileName);
72  vtkGetStringMacro(FileName);
74 
76 
78  vtkSetStringMacro(HeavyDataFileName);
79  vtkGetStringMacro(HeavyDataFileName);
81 
83 
85  vtkSetStringMacro(HeavyDataGroupName);
86  vtkGetStringMacro(HeavyDataGroupName);
88 
92  virtual int Write();
93 
95 
98  vtkSetMacro(LightDataLimit, int);
99  vtkGetMacro(LightDataLimit, int);
101 
103 
105  vtkSetMacro(WriteAllTimeSteps, int);
106  vtkGetMacro(WriteAllTimeSteps, int);
107  vtkBooleanMacro(WriteAllTimeSteps, int);
109 
111 
115  vtkSetMacro(MeshStaticOverTime, bool);
116  vtkGetMacro(MeshStaticOverTime, bool);
117  vtkBooleanMacro(MeshStaticOverTime, bool);
119 
121 
123  vtkSetMacro(Piece, int);
124  vtkSetMacro(NumberOfPieces, int);
126 
127  //TODO: control choice of heavy data format (xml, hdf5, sql, raw)
128 
129  //TODO: These controls are available in vtkXdmfWriter, but are not used here.
130  //GridsOnly
131  //Append to Domain
132 
133 protected:
134  vtkXdmfWriter();
135  ~vtkXdmfWriter();
136 
137  //Choose composite executive by default for time.
139 
140  //Can take any one data object
142 
143  //Overridden to ...
144  virtual int RequestInformation(vtkInformation*,
147  //Overridden to ...
148  virtual int RequestUpdateExtent(vtkInformation*,
151  //Overridden to ...
152  virtual int RequestData(vtkInformation*,
155 
156  //These do the work: recursively parse down input's structure all the way to arrays,
157  //use XDMF lib to dump everything to file.
158 
159  virtual int CreateTopology(vtkDataSet *ds, xdmf2::XdmfGrid *grid, vtkIdType PDims[3], vtkIdType CDims[3], vtkIdType &PRank, vtkIdType &CRank, void *staticdata);
160  virtual int CreateGeometry(vtkDataSet *ds, xdmf2::XdmfGrid *grid, void *staticdata);
161 
162  virtual int WriteDataSet(vtkDataObject *dobj, xdmf2::XdmfGrid *grid);
163  virtual int WriteCompositeDataSet(vtkCompositeDataSet *dobj, xdmf2::XdmfGrid *grid);
164  virtual int WriteAtomicDataSet(vtkDataObject *dobj, xdmf2::XdmfGrid *grid);
165  virtual int WriteArrays(vtkFieldData* dsa, xdmf2::XdmfGrid *grid, int association,
166  vtkIdType rank, vtkIdType *dims, const char *name);
167  virtual void ConvertVToXArray(vtkDataArray *vda, xdmf2::XdmfArray *xda,
168  vtkIdType rank, vtkIdType *dims,
169  int AllocStrategy, const char *heavyprefix);
170 
171  virtual void SetupDataArrayXML(xdmf2::XdmfElement*, xdmf2::XdmfArray*) const;
172 
173  char *FileName;
178 
180 
183  double CurrentTime;
187 
188  int Piece;
190 
192 
193  xdmf2::XdmfDOM *DOM;
194  xdmf2::XdmfGrid *TopTemporalGrid;
195 
196  vtkXdmfWriterDomainMemoryHandler *DomainMemoryHandler;
197 
198  std::vector<xdmf2::XdmfTopology*> TopologyAtT0;
199  std::vector<xdmf2::XdmfGeometry*> GeometryAtT0;
200 
201 private:
202  vtkXdmfWriter(const vtkXdmfWriter&); // Not implemented
203  void operator=(const vtkXdmfWriter&); // Not implemented
204 };
205 
206 #endif /* _vtkXdmfWriter_h */
virtual vtkExecutive * CreateDefaultExecutive()
Store vtkAlgorithm input/output information.
char * HeavyDataGroupName
abstract class to specify dataset behavior
Definition: vtkDataSet.h:61
static vtkDataObjectAlgorithm * New()
void PrintSelf(ostream &os, vtkIndent indent)
int vtkIdType
Definition: vtkType.h:275
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:51
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:59
a simple class to control print indentation
Definition: vtkIndent.h:38
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
xdmf2::XdmfGrid * TopTemporalGrid
void SetInputData(vtkDataObject *)
virtual int FillInputPortInformation(int port, vtkInformation *info)
vtkXdmfWriterDomainMemoryHandler * DomainMemoryHandler
std::string WorkingDirectory
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
xdmf2::XdmfDOM * DOM
std::vector< xdmf2::XdmfTopology * > TopologyAtT0
general representation of visualization data
Definition: vtkDataObject.h:64
char * HeavyDataFileName
represent and manipulate fields of data
Definition: vtkFieldData.h:55