VTK  9.5.20251128
vtkXdmfWriter.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
16
17#ifndef vtkXdmfWriter_h
18#define vtkXdmfWriter_h
19
20#include "vtkIOXdmf2Module.h" // For export macro
21
23
24#include <string> // Needed for private members
25#include <vector> //
26
27namespace xdmf2
28{
29class XdmfArray;
30class XdmfDOM;
31class XdmfElement;
32class XdmfGrid;
33class XdmfGeometry;
34class XdmfTopology;
35}
36
37VTK_ABI_NAMESPACE_BEGIN
38class vtkExecutive;
39
41class vtkDataArray;
42class vtkDataSet;
43class vtkDataObject;
44class vtkFieldData;
45class vtkInformation;
47class vtkXdmfWriterDomainMemoryHandler;
48
49class VTKIOXDMF2_EXPORT vtkXdmfWriter : public vtkDataObjectAlgorithm
50{
51public:
52 static vtkXdmfWriter* New();
54 void PrintSelf(ostream& os, vtkIndent indent) override;
55
59 virtual void SetInputData(vtkDataObject* dobj);
60
62
68
70
77
79
83 vtkSetStringMacro(HeavyDataGroupName);
84 vtkGetStringMacro(HeavyDataGroupName);
86
92 virtual int Write();
93
95
100 vtkSetMacro(LightDataLimit, int);
101 vtkGetMacro(LightDataLimit, int);
103
105
110 vtkSetMacro(WriteAllTimeSteps, int);
111 vtkGetMacro(WriteAllTimeSteps, int);
112 vtkBooleanMacro(WriteAllTimeSteps, int);
114
116
122 vtkSetMacro(MeshStaticOverTime, bool);
123 vtkGetMacro(MeshStaticOverTime, bool);
124 vtkBooleanMacro(MeshStaticOverTime, bool);
126
128
132 vtkSetMacro(Piece, int);
133 vtkSetMacro(NumberOfPieces, int);
135
136 // TODO: control choice of heavy data format (xml, hdf5, sql, raw)
137
138 // TODO: These controls are available in vtkXdmfWriter, but are not used here.
139 // GridsOnly
140 // Append to Domain
141
142protected:
144 ~vtkXdmfWriter() override;
145
146 // Choose composite executive by default for time.
148
149 // Can take any one data object
150 int FillInputPortInformation(int port, vtkInformation* info) override;
151
152 // Overridden to ...
154 // Overridden to ...
156 // Overridden to ...
158
159 // These do the work: recursively parse down input's structure all the way to arrays,
160 // use XDMF lib to dump everything to file.
161
162 virtual int CreateTopology(vtkDataSet* ds, xdmf2::XdmfGrid* grid, vtkIdType PDims[3],
163 vtkIdType CDims[3], vtkIdType& PRank, vtkIdType& CRank, void* staticdata);
164 virtual int CreateGeometry(vtkDataSet* ds, xdmf2::XdmfGrid* grid, void* staticdata);
165
166 virtual int WriteDataSet(vtkDataObject* dobj, xdmf2::XdmfGrid* grid);
167 virtual int WriteCompositeDataSet(vtkCompositeDataSet* dobj, xdmf2::XdmfGrid* grid);
168 virtual int WriteAtomicDataSet(vtkDataObject* dobj, xdmf2::XdmfGrid* grid);
169 virtual int WriteArrays(vtkFieldData* dsa, xdmf2::XdmfGrid* grid, int association, vtkIdType rank,
170 vtkIdType* dims, const char* name);
171 virtual void ConvertVToXArray(vtkDataArray* vda, xdmf2::XdmfArray* xda, vtkIdType rank,
172 vtkIdType* dims, int AllocStrategy, const char* heavyprefix);
173
174 virtual void SetupDataArrayXML(xdmf2::XdmfElement*, xdmf2::XdmfArray*) const;
175
176 char* FileName;
179 std::string WorkingDirectory;
180 std::string BaseFileName;
181
183
190
191 int Piece;
193
195
196 xdmf2::XdmfDOM* DOM;
197 xdmf2::XdmfGrid* TopTemporalGrid;
198
199 vtkXdmfWriterDomainMemoryHandler* DomainMemoryHandler;
200
201 std::vector<xdmf2::XdmfTopology*> TopologyAtT0;
202 std::vector<xdmf2::XdmfGeometry*> GeometryAtT0;
203
204private:
205 vtkXdmfWriter(const vtkXdmfWriter&) = delete;
206 void operator=(const vtkXdmfWriter&) = delete;
207};
208
209VTK_ABI_NAMESPACE_END
210#endif /* vtkXdmfWriter_h */
abstract superclass for composite (multi-block or AMR) datasets
general representation of visualization data
abstract class to specify dataset behavior
Definition vtkDataSet.h:166
Superclass for all pipeline executives in VTK.
Represents and manipulates a collection of data arrays.
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
xdmf2::XdmfDOM * DOM
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
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.
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
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)
static vtkXdmfWriter * New()
~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
#define vtkDataArray
int vtkIdType
Definition vtkType.h:367