VTK: IO/ParallelXML/vtkXMLWriter2.h Source File

| VTK 9.3.1

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
34 VTK_ABI_NAMESPACE_BEGIN
35 class vtkMultiProcessController;
36
37 class VTKIOPARALLELXML_EXPORT vtkXMLWriter2 : public vtkXMLWriterBase
38 {
39 public:
40 vtkTypeMacro(vtkXMLWriter2, vtkXMLWriterBase);
41 void PrintSelf(ostream& os, vtkIndent indent) override;
42
44
49 void SetController(vtkMultiProcessController* controller);
50 vtkGetObjectMacro(Controller, vtkMultiProcessController);
52
54
61 vtkSetClampMacro(NumberOfGhostLevels, int, 0, VTK_INT_MAX);
62 vtkGetMacro(NumberOfGhostLevels, int);
64
68 vtkTypeBool ProcessRequest(
69 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
70
71 protected:
72 vtkXMLWriter2();
73 ~vtkXMLWriter2() override;
74
76
82 virtual int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*)
83 {
84 return 1;
85 }
86 virtual int RequestDataObject(vtkInformation*, vtkInformationVector**, vtkInformationVector*)
87 {
88 return 1;
89 }
90 virtual int RequestUpdateExtent(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
91 virtual int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) = 0;
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
139 private:
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
153 VTK_ABI_NAMESPACE_END
154 #endif
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:40
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkMultiProcessController
Multiprocessing communication superclass.
Definition: vtkMultiProcessController.h:72
vtkXMLWriter2
base class for new-style XML Writers
Definition: vtkXMLWriter2.h:38
vtkXMLWriter2::ExclusiveScanSum
static int ExclusiveScanSum(vtkMultiProcessController *controller, int value)
Helper method to do an exclusive scan using the summation operator.
vtkXMLWriter2::vtkXMLWriter2
vtkXMLWriter2()
vtkXMLWriter2::~vtkXMLWriter2
~vtkXMLWriter2() override
vtkXMLWriter2::RequestData
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...
vtkXMLWriter2::RequestInformation
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Methods for various pipeline passes that can be overridden by subclasses to do the work for the reque...
Definition: vtkXMLWriter2.h:82
vtkXMLWriter2::AddRootArtifact
void AddRootArtifact(const std::string &fname, bool isDir=false)
Same as AddArtifact except only executes on root node.
vtkXMLWriter2::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkXMLWriter2::Gather
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.
vtkXMLWriter2::ProcessRequest
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Overridden to handle requests.
vtkXMLWriter2::SetController
void SetController(vtkMultiProcessController *controller)
Get/Set the controller to use.
vtkXMLWriter2::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Methods for various pipeline passes that can be overridden by subclasses to do the work for the reque...
vtkXMLWriter2::MakeDirectory
bool MakeDirectory(const std::string &dirname) const
Use this to create a directory.
vtkXMLWriter2::RequestDataObject
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Methods for various pipeline passes that can be overridden by subclasses to do the work for the reque...
Definition: vtkXMLWriter2.h:86
vtkXMLWriter2::SplitFileName
static std::tuple< std::string, std::string, std::string > SplitFileName(const std::string &fname)
Splits the file name into three parts:
vtkXMLWriter2::AddArtifact
void AddArtifact(const std::string &fname, bool isDir=false)
This is used to store a list of generated artifacts as they are written out.
vtkXMLWriterBase
Abstract base class for VTK-XML writers.
Definition: vtkXMLWriterBase.h:28
vtkX3D::value
@ value
Definition: vtkX3D.h:220
vtkX3D::string
@ string
Definition: vtkX3D.h:490
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:144
vtkXMLWriterBase.h