VTK  9.1.0
vtkXMLWriter2.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkXMLWriter2.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
35 #ifndef vtkXMLWriter2_h
36 #define vtkXMLWriter2_h
37 
38 #include "vtkIOParallelXMLModule.h" // For export macro
39 #include "vtkXMLWriterBase.h"
40 
41 #include <string> // for std::string
42 #include <tuple> // for std::tuple
43 #include <utility> // for std::pair
44 #include <vector> // for std::vector
45 
47 
48 class VTKIOPARALLELXML_EXPORT vtkXMLWriter2 : public vtkXMLWriterBase
49 {
50 public:
52  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
55 
61  vtkGetObjectMacro(Controller, vtkMultiProcessController);
63 
65 
72  vtkSetClampMacro(NumberOfGhostLevels, int, 0, VTK_INT_MAX);
73  vtkGetMacro(NumberOfGhostLevels, int);
75 
80  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
81 
82 protected:
84  ~vtkXMLWriter2() override;
85 
87 
94  {
95  return 1;
96  }
98  {
99  return 1;
100  }
104 
115  static std::tuple<std::string, std::string, std::string> SplitFileName(const std::string& fname);
116 
123  void AddArtifact(const std::string& fname, bool isDir = false);
124 
128  void AddRootArtifact(const std::string& fname, bool isDir = false);
129 
136  bool MakeDirectory(const std::string& dirname) const;
137 
141  static int ExclusiveScanSum(vtkMultiProcessController* controller, int value);
142 
147  std::vector<std::string> Gather(vtkMultiProcessController* controller,
148  const std::vector<std::string>& values, int destinationRank);
149 
150 private:
151  vtkXMLWriter2(const vtkXMLWriter2&) = delete;
152  void operator=(const vtkXMLWriter2&) = delete;
153 
157  void DeleteArtifacts();
158 
159  vtkMultiProcessController* Controller;
160  int NumberOfGhostLevels;
161  std::vector<std::pair<std::string, bool>> Artifacts;
162 };
163 
164 #endif
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Multiprocessing communication superclass.
base class for new-style XML Writers
Definition: vtkXMLWriter2.h:49
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...
Definition: vtkXMLWriter2.h:93
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.
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.
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Overridden to handle requests.
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...
Definition: vtkXMLWriter2.h:97
static std::tuple< std::string, std::string, std::string > SplitFileName(const std::string &fname)
Splits the file name into three parts:
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.
@ value
Definition: vtkX3D.h:226
@ string
Definition: vtkX3D.h:496
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_INT_MAX
Definition: vtkType.h:155