VTK
vtkXMLPDataWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkXMLPDataWriter.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 =========================================================================*/
25 #ifndef vtkXMLPDataWriter_h
26 #define vtkXMLPDataWriter_h
27 
28 #include "vtkIOParallelXMLModule.h" // For export macro
29 #include "vtkXMLWriter.h"
30 
31 class vtkCallbackCommand;
33 
34 class VTKIOPARALLELXML_EXPORT vtkXMLPDataWriter : public vtkXMLWriter
35 {
36 public:
38  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
39 
41 
44  vtkSetMacro(NumberOfPieces, int);
45  vtkGetMacro(NumberOfPieces, int);
47 
49 
52  vtkSetMacro(StartPiece, int);
53  vtkGetMacro(StartPiece, int);
54  vtkSetMacro(EndPiece, int);
55  vtkGetMacro(EndPiece, int);
57 
59 
62  vtkSetMacro(GhostLevel, int);
63  vtkGetMacro(GhostLevel, int);
65 
67 
70  vtkSetMacro(UseSubdirectory, bool);
71  vtkGetMacro(UseSubdirectory, bool);
73 
75 
81  virtual void SetWriteSummaryFile(int flag);
82  vtkGetMacro(WriteSummaryFile, int);
83  vtkBooleanMacro(WriteSummaryFile, int);
85 
87 
92  virtual void SetController(vtkMultiProcessController*);
93  vtkGetObjectMacro(Controller, vtkMultiProcessController);
95 
96 
101  int ProcessRequest(vtkInformation* request,
102  vtkInformationVector** inputVector, vtkInformationVector* outputVector) VTK_OVERRIDE;
103 
104 protected:
106  ~vtkXMLPDataWriter() VTK_OVERRIDE;
107 
111  virtual int RequestUpdateExtent(vtkInformation *request,
112  vtkInformationVector **inputVector, vtkInformationVector *outputVector);
113 
114  // Override writing method from superclass.
115  int WriteInternal() VTK_OVERRIDE;
116 
117  // Subclasses can override this method to collect information between ranks
118  // before writing the summary file. This method is called on all ranks while
119  // summary file is only written on 1 rank (rank 0).
120  virtual void PrepareSummaryFile();
121 
122  virtual vtkXMLWriter* CreatePieceWriter(int index)=0;
123 
124  void WritePrimaryElementAttributes(ostream &os, vtkIndent indent) VTK_OVERRIDE;
125  int WriteData() VTK_OVERRIDE;
126  virtual void WritePData(vtkIndent indent);
127  virtual void WritePPieceAttributes(int index);
128 
129  char* CreatePieceFileName(int index, const char* path=0);
130  void SplitFileName();
131  virtual int WritePiece(int index);
132 
133  // Callback registered with the ProgressObserver.
134  static void ProgressCallbackFunction(vtkObject*, unsigned long, void*,
135  void*);
136  // Progress callback from internal writer.
137  virtual void ProgressCallback(vtkAlgorithm* w);
138 
139  int StartPiece;
140  int EndPiece;
141  int NumberOfPieces;
142  int GhostLevel;
143  int WriteSummaryFile;
144  bool UseSubdirectory;
145 
146  char* PathName;
147  char* FileNameBase;
148  char* FileNameExtension;
149  char* PieceFileNameExtension;
150 
151  // The observer to report progress from the internal writer.
152  vtkCallbackCommand* ProgressObserver;
153 
155 
160  vtkGetMacro(ContinuingExecution, bool);
161 
162 private:
163  vtkXMLPDataWriter(const vtkXMLPDataWriter&) VTK_DELETE_FUNCTION;
164  void operator=(const vtkXMLPDataWriter&) VTK_DELETE_FUNCTION;
165 
169  void DeleteFiles();
170 
174  void SetupPieceFileNameExtension();
175 
176  // Indicates the piece currently being written.
177  int CurrentPiece;
178 
179  // Set in WriteInternal() to request continued execution from the executive to
180  // write more pieces.
181  bool ContinuingExecution;
182 
183  // Flags used to keep track of which pieces were written out.
184  unsigned char *PieceWrittenFlags;
185 };
186 
187 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:53
Store vtkAlgorithm input/output information.
int ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Upstream/Downstream requests form the generalized interface through which executives invoke a algorit...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
supports function callbacks
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:53
Superclass for VTK's XML file writers.
Definition: vtkXMLWriter.h:53
a simple class to control print indentation
Definition: vtkIndent.h:33
Write data in a parallel XML format.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Store zero or more vtkInformation instances.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Multiprocessing communication superclass.