vtkParallelSerialWriter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkParallelSerialWriter.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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 =========================================================================*/
30 #ifndef vtkParallelSerialWriter_h
31 #define vtkParallelSerialWriter_h
32 
33 #include "vtkDataObjectAlgorithm.h"
34 #include "vtkPVVTKExtensionsIOCoreModule.h" //needed for exports
35 #include "vtkSmartPointer.h" // needed for vtkSmartPointer
36 #include <string> // for std::string
37 
40 
42 {
43 public:
44  static vtkParallelSerialWriter* New();
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
49 
52  void SetWriter(vtkAlgorithm*);
53  vtkGetObjectMacro(Writer, vtkAlgorithm);
55 
59  vtkMTimeType GetMTime() override;
60 
62 
66  vtkSetStringMacro(FileNameMethod);
67  vtkGetStringMacro(FileNameMethod);
69 
71 
74  vtkSetStringMacro(FileName);
75  vtkGetStringMacro(FileName);
77 
81  int Write();
82 
84 
88  vtkGetMacro(Piece, int);
89  vtkSetMacro(Piece, int);
91 
93 
96  vtkGetMacro(NumberOfPieces, int);
97  vtkSetMacro(NumberOfPieces, int);
99 
101 
104  vtkGetMacro(GhostLevel, int);
105  vtkSetMacro(GhostLevel, int);
107 
109 
113  void SetPreGatherHelper(vtkAlgorithm*);
114  vtkGetObjectMacro(PreGatherHelper, vtkAlgorithm);
116 
118 
124  void SetPostGatherHelper(vtkAlgorithm*);
125  vtkGetObjectMacro(PostGatherHelper, vtkAlgorithm);
127 
129 
133  vtkGetMacro(WriteAllTimeSteps, int);
134  vtkSetMacro(WriteAllTimeSteps, int);
135  vtkBooleanMacro(WriteAllTimeSteps, int);
137 
141  void SetInterpreter(vtkClientServerInterpreter* interp) { this->Interpreter = interp; }
142 
144 
151  vtkGetStringMacro(FileNameSuffix);
152  vtkSetStringMacro(FileNameSuffix);
154 
156 
163  vtkSetClampMacro(NumberOfIORanks, int, 0, VTK_INT_MAX);
164  vtkGetMacro(NumberOfIORanks, int);
166 
167  enum
168  {
170  ASSIGNMENT_MODE_ROUND_ROBIN
171  };
172 
174 
189  vtkSetClampMacro(
190  RankAssignmentMode, int, ASSIGNMENT_MODE_CONTIGUOUS, ASSIGNMENT_MODE_ROUND_ROBIN);
191  vtkGetMacro(RankAssignmentMode, int);
193 
195 
199  void SetController(vtkMultiProcessController* controller);
200  vtkGetObjectMacro(Controller, vtkMultiProcessController);
202 
203 protected:
205  ~vtkParallelSerialWriter() override;
206 
207  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
208  vtkInformationVector* outputVector) override;
209  int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
210  vtkInformationVector* outputVector) override;
211  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
212  vtkInformationVector* outputVector) override;
213 
214 private:
216  void operator=(const vtkParallelSerialWriter&) = delete;
217 
218  void WriteATimestep(vtkDataObject* input);
219  void WriteAFile(const std::string& fname, vtkDataObject* input);
220 
221  void SetWriterFileName(const char* fname);
222  void WriteInternal();
223 
224  std::string GetPartitionFileName(const std::string& fname);
225 
226  vtkAlgorithm* PreGatherHelper;
227  vtkAlgorithm* PostGatherHelper;
228 
229  vtkAlgorithm* Writer;
230  char* FileNameMethod;
231  int Piece;
232  int NumberOfPieces;
233  int GhostLevel;
234 
235  int WriteAllTimeSteps;
236  int NumberOfTimeSteps;
237  int CurrentTimeIndex;
238 
239  // The name of the output file.
240  char* FileName;
241  char* FileNameSuffix;
242 
243  vtkClientServerInterpreter* Interpreter;
244 
245  int NumberOfIORanks;
246  int RankAssignmentMode;
247 
248  vtkMultiProcessController* Controller;
250  int SubControllerColor;
251 };
252 
253 #endif
#define VTKPVVTKEXTENSIONSIOCORE_EXPORT
void SetInterpreter(vtkClientServerInterpreter *interp)
Get/Set the interpreter to use to call methods on the writer.
static vtkDataObjectAlgorithm * New()
#define VTK_INT_MAX
vtkTypeUInt64 vtkMTimeType
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
Run-time VTK interpreter.
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual vtkMTimeType GetMTime()
parallel meta-writer for serial formats
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
void operator=(const vtkObjectBase &)