vtkFileSeriesWriter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
12 #ifndef vtkFileSeriesWriter_h
13 #define vtkFileSeriesWriter_h
14 
15 #include "vtkDataObjectAlgorithm.h"
16 #include "vtkPVVTKExtensionsIOCoreModule.h" //needed for exports
18 
20 {
21 public:
22  static vtkFileSeriesWriter* New();
24  void PrintSelf(ostream& os, vtkIndent indent) override;
25 
27 
30  virtual void SetWriter(vtkAlgorithm*);
31  vtkGetObjectMacro(Writer, vtkAlgorithm);
33 
37  vtkMTimeType GetMTime() override;
38 
40 
44  vtkSetStringMacro(FileNameMethod);
45  vtkGetStringMacro(FileNameMethod);
47 
49 
52  vtkSetStringMacro(FileName);
53  vtkGetStringMacro(FileName);
55 
59  int Write();
60 
62 
67  vtkGetMacro(WriteAllTimeSteps, int);
68  vtkSetMacro(WriteAllTimeSteps, int);
69  vtkBooleanMacro(WriteAllTimeSteps, int);
71 
73 
77  vtkGetMacro(WriteJsonMetaFile, bool);
78  vtkSetMacro(WriteJsonMetaFile, bool);
79  vtkBooleanMacro(WriteJsonMetaFile, bool);
81 
83 
90  vtkGetStringMacro(FileNameSuffix);
91  vtkSetStringMacro(FileNameSuffix);
93 
95 
98  vtkGetMacro(MinTimeStep, int);
99  vtkSetClampMacro(MinTimeStep, int, 0, VTK_INT_MAX);
101 
103 
108  vtkGetMacro(MaxTimeStep, int);
109  vtkSetMacro(MaxTimeStep, int);
111 
113 
116  vtkGetMacro(TimeStepStride, int);
117  vtkSetClampMacro(TimeStepStride, int, 1, VTK_INT_MAX);
119 
124 
128  void SetInterpreter(vtkClientServerInterpreter* interp) { this->Interpreter = interp; }
129 
133  static bool SuffixValidation(char* fileNameSuffix);
134 
135 protected:
137  ~vtkFileSeriesWriter() override;
138 
139  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
140  vtkInformationVector* outputVector) override;
141  int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
142  vtkInformationVector* outputVector) override;
143  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
144  vtkInformationVector* outputVector) override;
145 
146 private:
147  vtkFileSeriesWriter(const vtkFileSeriesWriter&) = delete;
148  void operator=(const vtkFileSeriesWriter&) = delete;
149 
150  void SetWriterFileName(const char* fname);
151  bool WriteATimestep(vtkDataObject*, vtkInformation* inInfo);
152  bool WriteJsonFile(vtkInformation* inInfo);
153  void WriteInternal();
154  bool AppendFileNameForTimeStep(std::ostringstream& fname, int timeIndex, bool appendPath = true);
155 
156  vtkAlgorithm* Writer = nullptr;
157  char* FileNameMethod = nullptr;
158 
159  int WriteAllTimeSteps = 0;
160  bool WriteJsonMetaFile = false;
161  char* FileNameSuffix = nullptr;
162  int NumberOfTimeSteps = 1;
163  int CurrentTimeIndex = 0;
164  int MinTimeStep = 0;
165  int MaxTimeStep = -1;
166  int TimeStepStride = 1;
167 
168  // The name of the output file.
169  char* FileName = nullptr;
170 
171  vtkClientServerInterpreter* Interpreter = nullptr;
172 };
173 
174 #endif
#define VTKPVVTKEXTENSIONSIOCORE_EXPORT
static vtkDataObjectAlgorithm * New()
vtkTypeUInt64 vtkMTimeType
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
Run-time VTK interpreter.
meta-writer for writing a file series using writers that are not time-aware.
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual vtkMTimeType GetMTime()
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual int ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
void operator=(const vtkObjectBase &)
void SetInterpreter(vtkClientServerInterpreter *interp)
Get/Set the interpreter to use to call methods on the writer.