VTK  9.4.20250307
vtkXMLWriter2.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
23#ifndef vtkXMLWriter2_h
24#define vtkXMLWriter2_h
25
26#include "vtkIOParallelXMLModule.h" // For export macro
27#include "vtkXMLWriterBase.h"
28
29#include <string> // for std::string
30#include <tuple> // for std::tuple
31#include <utility> // for std::pair
32#include <vector> // for std::vector
33
34VTK_ABI_NAMESPACE_BEGIN
36
37class VTKIOPARALLELXML_EXPORT vtkXMLWriter2 : public vtkXMLWriterBase
38{
39public:
41 void PrintSelf(ostream& os, vtkIndent indent) override;
42
44
50 vtkGetObjectMacro(Controller, vtkMultiProcessController);
52
54
61 vtkSetClampMacro(NumberOfGhostLevels, int, 0, VTK_INT_MAX);
62 vtkGetMacro(NumberOfGhostLevels, int);
64
69 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
70
71protected:
73 ~vtkXMLWriter2() override;
74
76
83 {
84 return 1;
85 }
87 {
88 return 1;
89 }
93
104 static std::tuple<std::string, std::string, std::string> SplitFileName(const std::string& fname);
105
112 void AddArtifact(const std::string& fname, bool isDir = false);
113
117 void AddRootArtifact(const std::string& fname, bool isDir = false);
118
125 bool MakeDirectory(const std::string& dirname) const;
126
130 static int ExclusiveScanSum(vtkMultiProcessController* controller, int value);
131
136 std::vector<std::string> Gather(vtkMultiProcessController* controller,
137 const std::vector<std::string>& values, int destinationRank);
138
139private:
140 vtkXMLWriter2(const vtkXMLWriter2&) = delete;
141 void operator=(const vtkXMLWriter2&) = delete;
142
146 void DeleteArtifacts();
147
148 vtkMultiProcessController* Controller;
149 int NumberOfGhostLevels;
150 std::vector<std::pair<std::string, bool>> Artifacts;
151};
152
153VTK_ABI_NAMESPACE_END
154#endif
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Multiprocessing communication superclass.
base class for new-style XML Writers
static int ExclusiveScanSum(vtkMultiProcessController *controller, int value)
Helper method to do an exclusive scan using the summation operator.
~vtkXMLWriter2() override
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)=0
Methods for various pipeline passes that can be overridden by subclasses to do the work for the reque...
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Methods for various pipeline passes that can be overridden by subclasses to do the work for the reque...
static std::tuple< std::string, std::string, std::string > SplitFileName(const std::string &fname)
Splits the file name into three parts:
void AddRootArtifact(const std::string &fname, bool isDir=false)
Same as AddArtifact except only executes on root node.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Overridden to handle requests.
std::vector< std::string > Gather(vtkMultiProcessController *controller, const std::vector< std::string > &values, int destinationRank)
Utility function to gather a vector of strings on to the destination rank.
void SetController(vtkMultiProcessController *controller)
Get/Set the controller to use.
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Methods for various pipeline passes that can be overridden by subclasses to do the work for the reque...
bool MakeDirectory(const std::string &dirname) const
Use this to create a directory.
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Methods for various pipeline passes that can be overridden by subclasses to do the work for the reque...
void AddArtifact(const std::string &fname, bool isDir=false)
This is used to store a list of generated artifacts as they are written out.
Abstract base class for VTK-XML writers.
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_INT_MAX
Definition vtkType.h:161