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
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkX3D::value
@ value
Definition: vtkX3D.h:226
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:145
vtkXMLWriter2
base class for new-style XML Writers
Definition: vtkXMLWriter2.h:49
vtkXMLWriter2::ExclusiveScanSum
static int ExclusiveScanSum(vtkMultiProcessController *controller, int value)
Helper method to do an exclusive scan using the summation operator.
vtkXMLWriterBase
Abstract base class for VTK-XML writers.
Definition: vtkXMLWriterBase.h:39
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::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
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:93
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::SetController
void SetController(vtkMultiProcessController *controller)
Get/Set the controller to use.
vtkMultiProcessController
Multiprocessing communication superclass.
Definition: vtkMultiProcessController.h:77
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.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkXMLWriterBase.h
vtkXMLWriter2::MakeDirectory
bool MakeDirectory(const std::string &dirname) const
Use this to create a directory.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:183
vtkX3D::string
@ string
Definition: vtkX3D.h:496
vtkXMLWriter2::ProcessRequest
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Overridden to handle requests.
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:97
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::vtkXMLWriter2
vtkXMLWriter2()
vtkXMLWriter2::~vtkXMLWriter2
~vtkXMLWriter2() override
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkXMLWriter2::AddRootArtifact
void AddRootArtifact(const std::string &fname, bool isDir=false)
Same as AddArtifact except only executes on root node.
vtkXMLWriter2::SplitFileName
static std::tuple< std::string, std::string, std::string > SplitFileName(const std::string &fname)
Splits the file name into three parts: