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
36 
37 class VTKIOPARALLELXML_EXPORT vtkXMLWriter2 : public vtkXMLWriterBase
38 {
39 public:
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 
69  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
70 
71 protected:
72  vtkXMLWriter2();
73  ~vtkXMLWriter2() override;
74 
76 
83  {
84  return 1;
85  }
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
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
Store vtkAlgorithm input/output information.
#define VTK_INT_MAX
Definition: vtkType.h:144
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int vtkTypeBool
Definition: vtkABI.h:64
virtual vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
Upstream/Downstream requests form the generalized interface through which executives invoke a algorit...
a simple class to control print indentation
Definition: vtkIndent.h:28
Abstract base class for VTK-XML writers.
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
base class for new-style XML Writers
Definition: vtkXMLWriter2.h:37
Store zero or more vtkInformation instances.
Multiprocessing communication superclass.