VTK  9.3.20240419
vtkXMLCompositeDataWriter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) Kitware, Inc.
3 // SPDX-License-Identifier: BSD-3-Clause
15 #ifndef vtkXMLCompositeDataWriter_h
16 #define vtkXMLCompositeDataWriter_h
17 
18 #include "vtkIOXMLModule.h" // For export macro
19 #include "vtkStdString.h" // needed for vtkStdString.
20 #include "vtkXMLWriter.h"
21 
22 VTK_ABI_NAMESPACE_BEGIN
23 class vtkCallbackCommand;
25 class vtkXMLDataElement;
26 class vtkXMLCompositeDataWriterInternals;
27 
28 class VTKIOXML_EXPORT vtkXMLCompositeDataWriter : public vtkXMLWriter
29 {
30 public:
32  void PrintSelf(ostream& os, vtkIndent indent) override;
33 
37  const char* GetDefaultFileExtension() override;
38 
44 
47  vtkGetMacro(GhostLevel, int);
48  vtkSetMacro(GhostLevel, int);
50 
52 
55  vtkGetMacro(WriteMetaFile, int);
56  virtual void SetWriteMetaFile(int flag);
58 
64 
65 protected:
68 
74  int GetDataSetMajorVersion() override { return 1; }
75  int GetDataSetMinorVersion() override { return 0; }
76 
81 
82  // see algorithm for more info
84 
87 
88  int WriteData() override;
89  const char* GetDataSetName() override;
90 
91  // Create a default executive.
93 
95 
100 
104  unsigned int GetNumberOfDataTypes();
105 
110 
111  // Methods to create the set of writers matching the set of inputs.
114 
115  // Methods to help construct internal file names.
118  VTK_FILEPATH const char* GetFilePath();
119 
124  const char* GetDefaultFileExtensionForDataSet(int dataset_type);
125 
132 
133  // Make a directory.
134  void MakeDirectory(const char* name);
135 
136  // Remove a directory.
137  void RemoveADirectory(const char* name);
138 
139  // Internal implementation details.
140  vtkXMLCompositeDataWriterInternals* Internal;
141 
142  // The number of ghost levels to write for unstructured data.
144 
151 
152  // Callback registered with the InternalProgressObserver.
153  static void ProgressCallbackFunction(vtkObject*, unsigned long, void*, void*);
154  // Progress callback from internal writer.
155  virtual void ProgressCallback(vtkAlgorithm* w);
156 
157  // The observer to report progress from the internal writer.
159 
169  virtual int WriteComposite(
170  vtkCompositeDataSet* compositeData, vtkXMLDataElement* element, int& writerIdx) = 0;
171 
183  vtkDataObject* dObj, vtkXMLDataElement* element, int& writerIdx, const char* fileName);
184 
189  virtual void RemoveWrittenFiles(const char* SubDirectory);
190 
191 private:
193  void operator=(const vtkXMLCompositeDataWriter&) = delete;
194 };
195 
196 VTK_ABI_NAMESPACE_END
197 #endif
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:162
supports function callbacks
abstract superclass for composite (multi-block or AMR) datasets
general representation of visualization data
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:69
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
abstract base class for most VTK objects
Definition: vtkObject.h:162
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:78
Writer for multi-group datasets.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const char * GetDefaultFileExtension() override
Get the default file extension for files written by this writer.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
int WriteData() override
void MakeDirectory(const char *name)
static void ProgressCallbackFunction(vtkObject *, unsigned long, void *, void *)
VTK_FILEPATH const char * GetFilePath()
vtkTypeBool ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
See the vtkAlgorithm for a description of what these do.
const char * GetDataSetName() override
vtkStdString CreatePieceFileName(int Piece)
Create a filename for the given index.
~vtkXMLCompositeDataWriter() override
virtual void FillDataTypes(vtkCompositeDataSet *)
Determine the data types for each of the leaf nodes.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
void RemoveADirectory(const char *name)
unsigned int GetNumberOfDataTypes()
Returns the number of leaf nodes (also includes empty leaf nodes).
const char * GetDefaultFileExtensionForDataSet(int dataset_type)
Returns the default extension to use for the given dataset type.
VTK_FILEPATH const char * GetFilePrefix()
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkXMLWriter * GetWriter(int index)
int WriteMetaFileIfRequested()
Write the collection file if it is requested.
virtual void ProgressCallback(vtkAlgorithm *w)
int GetDataSetMajorVersion() override
Methods to define the file's major and minor version numbers.
vtkCallbackCommand * InternalProgressObserver
virtual void SetWriteMetaFile(int flag)
Get/Set whether this instance will write the meta-file.
int * GetDataTypesPointer()
Returns the array pointer to the array of leaf nodes.
virtual void RemoveWrittenFiles(const char *SubDirectory)
Utility function to remove any already written files in case writer failed.
vtkXMLCompositeDataWriterInternals * Internal
int WriteMetaFile
Whether to write the collection file on this node.
virtual int WriteNonCompositeData(vtkDataObject *dObj, vtkXMLDataElement *element, int &writerIdx, const char *fileName)
Internal method to write a non vtkCompositeDataSet subclass as well as add in the file name to the me...
void CreateWriters(vtkCompositeDataSet *)
virtual int WriteComposite(vtkCompositeDataSet *compositeData, vtkXMLDataElement *element, int &writerIdx)=0
Internal method called recursively to create the xml tree for the children of compositeData as well a...
vtkExecutive * CreateDefaultExecutive() override
Create a default executive.
Represents an XML element and those nested inside.
Superclass for VTK's XML file writers.
Definition: vtkXMLWriter.h:54
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
std::map< DataSetType, DataSet > Piece
Definition: VTXTypes.h:43
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_FILEPATH