vtkParallelSerialWriter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
18 #ifndef vtkParallelSerialWriter_h
19 #define vtkParallelSerialWriter_h
20 
21 #include "vtkDataObjectAlgorithm.h"
22 #include "vtkPVVTKExtensionsIOCoreModule.h" //needed for exports
23 #include "vtkSmartPointer.h" // needed for vtkSmartPointer
24 #include <string> // for std::string
25 
28 class vtkPartitionedDataSet;
29 
31 {
32 public:
33  static vtkParallelSerialWriter* New();
35  void PrintSelf(ostream& os, vtkIndent indent) override;
36 
38 
41  void SetWriter(vtkAlgorithm*);
42  vtkGetObjectMacro(Writer, vtkAlgorithm);
44 
48  vtkMTimeType GetMTime() override;
49 
51 
55  vtkSetStringMacro(FileNameMethod);
56  vtkGetStringMacro(FileNameMethod);
58 
60 
63  vtkSetStringMacro(FileName);
64  vtkGetStringMacro(FileName);
66 
70  int Write();
71 
73 
77  vtkGetMacro(Piece, int);
78  vtkSetMacro(Piece, int);
80 
82 
85  vtkGetMacro(NumberOfPieces, int);
86  vtkSetMacro(NumberOfPieces, int);
88 
90 
93  vtkGetMacro(GhostLevel, int);
94  vtkSetMacro(GhostLevel, int);
96 
98 
102  void SetPreGatherHelper(vtkAlgorithm*);
103  vtkGetObjectMacro(PreGatherHelper, vtkAlgorithm);
105 
107 
113  void SetPostGatherHelper(vtkAlgorithm*);
114  vtkGetObjectMacro(PostGatherHelper, vtkAlgorithm);
116 
118 
122  vtkGetMacro(WriteAllTimeSteps, int);
123  vtkSetMacro(WriteAllTimeSteps, int);
124  vtkBooleanMacro(WriteAllTimeSteps, int);
126 
130  void SetInterpreter(vtkClientServerInterpreter* interp) { this->Interpreter = interp; }
131 
133 
140  vtkGetStringMacro(FileNameSuffix);
141  vtkSetStringMacro(FileNameSuffix);
143 
145 
152  vtkSetClampMacro(NumberOfIORanks, int, 0, VTK_INT_MAX);
153  vtkGetMacro(NumberOfIORanks, int);
155 
156  enum
157  {
159  ASSIGNMENT_MODE_ROUND_ROBIN
160  };
161 
163 
178  vtkSetClampMacro(
179  RankAssignmentMode, int, ASSIGNMENT_MODE_CONTIGUOUS, ASSIGNMENT_MODE_ROUND_ROBIN);
180  vtkGetMacro(RankAssignmentMode, int);
182 
184 
188  void SetController(vtkMultiProcessController* controller);
189  vtkGetObjectMacro(Controller, vtkMultiProcessController);
191 
192 protected:
194  ~vtkParallelSerialWriter() override;
195 
196  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
197  vtkInformationVector* outputVector) override;
198  int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
199  vtkInformationVector* outputVector) override;
200  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
201  vtkInformationVector* outputVector) override;
202 
203 private:
205  void operator=(const vtkParallelSerialWriter&) = delete;
206 
207  void WriteATimestep(const std::string& fname, vtkPartitionedDataSet* input);
208  void WriteAFile(const std::string& fname, vtkDataObject* input);
209 
210  void SetWriterFileName(const char* fname);
211  void WriteInternal();
212 
213  std::string GetPartitionFileName(const std::string& fname);
214 
215  vtkAlgorithm* PreGatherHelper;
216  vtkAlgorithm* PostGatherHelper;
217 
218  vtkAlgorithm* Writer;
219  char* FileNameMethod;
220  int Piece;
221  int NumberOfPieces;
222  int GhostLevel;
223 
224  int WriteAllTimeSteps;
225  int NumberOfTimeSteps;
226  int CurrentTimeIndex;
227 
228  // The name of the output file.
229  char* FileName;
230  char* FileNameSuffix;
231 
232  vtkClientServerInterpreter* Interpreter;
233 
234  int NumberOfIORanks;
235  int RankAssignmentMode;
236 
237  vtkMultiProcessController* Controller;
239  int SubControllerColor;
240 };
241 
242 #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 &)