VTK  9.2.6
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 
29 #ifndef vtkXdmfWriter_h
30 #define vtkXdmfWriter_h
31 
32 #include "vtkIOXdmf2Module.h" // For export macro
33 
34 #include "vtkDataObjectAlgorithm.h"
35 
36 #include <string> // Needed for private members
37 #include <vector> //
38 
39 class vtkExecutive;
40 
42 class vtkDataArray;
43 class vtkDataSet;
44 class vtkDataObject;
45 class vtkFieldData;
46 class vtkInformation;
48 class vtkXdmfWriterDomainMemoryHandler;
49 
50 namespace xdmf2
51 {
52 class XdmfArray;
53 class XdmfDOM;
54 class XdmfElement;
55 class XdmfGrid;
56 class XdmfGeometry;
57 class XdmfTopology;
58 }
59 
60 class VTKIOXDMF2_EXPORT vtkXdmfWriter : public vtkDataObjectAlgorithm
61 {
62 public:
63  static vtkXdmfWriter* New();
65  void PrintSelf(ostream& os, vtkIndent indent) override;
66 
70  virtual void SetInputData(vtkDataObject* dobj);
71 
73 
79 
81 
85  vtkSetFilePathMacro(HeavyDataFileName);
86  vtkGetFilePathMacro(HeavyDataFileName);
88 
90 
94  vtkSetStringMacro(HeavyDataGroupName);
95  vtkGetStringMacro(HeavyDataGroupName);
97 
103  virtual int Write();
104 
106 
111  vtkSetMacro(LightDataLimit, int);
112  vtkGetMacro(LightDataLimit, int);
114 
116 
121  vtkSetMacro(WriteAllTimeSteps, int);
122  vtkGetMacro(WriteAllTimeSteps, int);
123  vtkBooleanMacro(WriteAllTimeSteps, int);
125 
127 
133  vtkSetMacro(MeshStaticOverTime, bool);
134  vtkGetMacro(MeshStaticOverTime, bool);
135  vtkBooleanMacro(MeshStaticOverTime, bool);
137 
139 
143  vtkSetMacro(Piece, int);
144  vtkSetMacro(NumberOfPieces, int);
146 
147  // TODO: control choice of heavy data format (xml, hdf5, sql, raw)
148 
149  // TODO: These controls are available in vtkXdmfWriter, but are not used here.
150  // GridsOnly
151  // Append to Domain
152 
153 protected:
155  ~vtkXdmfWriter() override;
156 
157  // Choose composite executive by default for time.
159 
160  // Can take any one data object
162 
163  // Overridden to ...
165  // Overridden to ...
167  // Overridden to ...
169 
170  // These do the work: recursively parse down input's structure all the way to arrays,
171  // use XDMF lib to dump everything to file.
172 
173  virtual int CreateTopology(vtkDataSet* ds, xdmf2::XdmfGrid* grid, vtkIdType PDims[3],
174  vtkIdType CDims[3], vtkIdType& PRank, vtkIdType& CRank, void* staticdata);
175  virtual int CreateGeometry(vtkDataSet* ds, xdmf2::XdmfGrid* grid, void* staticdata);
176 
177  virtual int WriteDataSet(vtkDataObject* dobj, xdmf2::XdmfGrid* grid);
178  virtual int WriteCompositeDataSet(vtkCompositeDataSet* dobj, xdmf2::XdmfGrid* grid);
179  virtual int WriteAtomicDataSet(vtkDataObject* dobj, xdmf2::XdmfGrid* grid);
180  virtual int WriteArrays(vtkFieldData* dsa, xdmf2::XdmfGrid* grid, int association, vtkIdType rank,
181  vtkIdType* dims, const char* name);
182  virtual void ConvertVToXArray(vtkDataArray* vda, xdmf2::XdmfArray* xda, vtkIdType rank,
183  vtkIdType* dims, int AllocStrategy, const char* heavyprefix);
184 
185  virtual void SetupDataArrayXML(xdmf2::XdmfElement*, xdmf2::XdmfArray*) const;
186 
187  char* FileName;
192 
194 
197  double CurrentTime;
201 
202  int Piece;
204 
206 
207  xdmf2::XdmfDOM* DOM;
208  xdmf2::XdmfGrid* TopTemporalGrid;
209 
210  vtkXdmfWriterDomainMemoryHandler* DomainMemoryHandler;
211 
212  std::vector<xdmf2::XdmfTopology*> TopologyAtT0;
213  std::vector<xdmf2::XdmfGeometry*> GeometryAtT0;
214 
215 private:
216  vtkXdmfWriter(const vtkXdmfWriter&) = delete;
217  void operator=(const vtkXdmfWriter&) = delete;
218 };
219 
220 #endif /* vtkXdmfWriter_h */
abstract superclass for composite (multi-block or AMR) datasets
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:165
Superclass for algorithms that produce only data object as output.
general representation of visualization data
abstract class to specify dataset behavior
Definition: vtkDataSet.h:172
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:79
represent and manipulate fields of data
Definition: vtkFieldData.h:172
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
write eXtensible Data Model and Format files
Definition: vtkXdmfWriter.h:61
int UnlabelledDataArrayId
xdmf2::XdmfDOM * DOM
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
bool MeshStaticOverTime
virtual void ConvertVToXArray(vtkDataArray *vda, xdmf2::XdmfArray *xda, vtkIdType rank, vtkIdType *dims, int AllocStrategy, const char *heavyprefix)
virtual int CreateGeometry(vtkDataSet *ds, xdmf2::XdmfGrid *grid, void *staticdata)
vtkSetFilePathMacro(HeavyDataFileName)
Set or get the file name of the hdf5 file.
vtkXdmfWriterDomainMemoryHandler * DomainMemoryHandler
vtkExecutive * CreateDefaultExecutive() override
Create a default executive.
static vtkXdmfWriter * New()
xdmf2::XdmfGrid * TopTemporalGrid
virtual int WriteDataSet(vtkDataObject *dobj, xdmf2::XdmfGrid *grid)
vtkGetFilePathMacro(FileName)
Set or get the file name of the xdmf file.
virtual int CreateTopology(vtkDataSet *ds, xdmf2::XdmfGrid *grid, vtkIdType PDims[3], vtkIdType CDims[3], vtkIdType &PRank, vtkIdType &CRank, void *staticdata)
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
std::vector< xdmf2::XdmfGeometry * > GeometryAtT0
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
double CurrentTime
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
virtual void SetupDataArrayXML(xdmf2::XdmfElement *, xdmf2::XdmfArray *) const
virtual int Write()
Write data to output.
std::string WorkingDirectory
virtual int WriteCompositeDataSet(vtkCompositeDataSet *dobj, xdmf2::XdmfGrid *grid)
virtual int WriteAtomicDataSet(vtkDataObject *dobj, xdmf2::XdmfGrid *grid)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int WriteArrays(vtkFieldData *dsa, xdmf2::XdmfGrid *grid, int association, vtkIdType rank, vtkIdType *dims, const char *name)
~vtkXdmfWriter() override
std::vector< xdmf2::XdmfTopology * > TopologyAtT0
vtkSetFilePathMacro(FileName)
Set or get the file name of the xdmf file.
std::string BaseFileName
char * HeavyDataFileName
virtual void SetInputData(vtkDataObject *dobj)
Set the input data set.
vtkGetFilePathMacro(HeavyDataFileName)
Set or get the file name of the hdf5 file.
char * HeavyDataGroupName
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ name
Definition: vtkX3D.h:225
@ string
Definition: vtkX3D.h:496
std::map< DataSetType, DataSet > Piece
Definition: VTXTypes.h:54
int vtkIdType
Definition: vtkType.h:332