vtkCSVWriter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
9 #ifndef vtkCSVWriter_h
10 #define vtkCSVWriter_h
11 
12 #include "vtkDataObject.h" // for vtkDataObject::FieldAssociations
13 #include "vtkPVVTKExtensionsIOCoreModule.h" // needed for exports
14 #include "vtkWriter.h"
15 
16 #include <string> // for std::string
17 #include <vector> // for std::vector
18 
19 class vtkDoubleArray;
21 class vtkTable;
22 
24 {
25 public:
26  static vtkCSVWriter* New();
27  vtkTypeMacro(vtkCSVWriter, vtkWriter);
28  void PrintSelf(ostream& os, vtkIndent indent) override;
29 
31 
35  void SetController(vtkMultiProcessController*);
36  vtkGetObjectMacro(Controller, vtkMultiProcessController);
38 
40 
43  vtkSetStringMacro(FieldDelimiter);
44  vtkGetStringMacro(FieldDelimiter);
46 
48 
52  vtkSetStringMacro(StringDelimiter);
53  vtkGetStringMacro(StringDelimiter);
55 
57 
60  vtkSetStringMacro(FileName);
61  vtkGetStringMacro(FileName);
63 
65 
71  vtkSetMacro(WriteAllTimeSteps, bool);
72  vtkGetMacro(WriteAllTimeSteps, bool);
73  vtkBooleanMacro(WriteAllTimeSteps, bool);
75 
77 
85  vtkSetMacro(WriteAllTimeStepsSeparately, bool);
86  vtkGetMacro(WriteAllTimeStepsSeparately, bool);
87  vtkBooleanMacro(WriteAllTimeStepsSeparately, bool);
89 
91 
98  vtkGetStringMacro(FileNameSuffix);
99  vtkSetStringMacro(FileNameSuffix);
101 
103 
107  vtkSetMacro(UseStringDelimiter, bool);
108  vtkGetMacro(UseStringDelimiter, bool);
110 
112 
116  vtkSetClampMacro(Precision, int, 0, VTK_INT_MAX);
117  vtkGetMacro(Precision, int);
119 
121 
124  vtkSetMacro(UseScientificNotation, bool);
125  vtkGetMacro(UseScientificNotation, bool);
126  vtkBooleanMacro(UseScientificNotation, bool);
128 
130 
136  vtkSetClampMacro(FieldAssociation, int, 0, vtkDataObject::NUMBER_OF_ASSOCIATIONS - 1);
137  vtkGetMacro(FieldAssociation, int);
139 
141 
147  vtkSetMacro(AddMetaData, bool);
148  vtkGetMacro(AddMetaData, bool);
149  vtkBooleanMacro(AddMetaData, bool);
151 
153 
157  vtkSetMacro(AddTime, bool);
158  vtkGetMacro(AddTime, bool);
159  vtkBooleanMacro(AddTime, bool);
161 
163 
167  vtkSetMacro(AddTimeStep, bool);
168  vtkGetMacro(AddTimeStep, bool);
169  vtkBooleanMacro(AddTimeStep, bool);
171 
173 
177  std::string GetString(std::string string);
179 
180 protected:
181  vtkCSVWriter();
182  ~vtkCSVWriter() override;
183 
184  void WriteData() override;
185 
186  // see algorithm for more info.
187  // This writer takes in vtkTable, vtkDataSet or vtkCompositeDataSet.
188  int FillInputPortInformation(int port, vtkInformation* info) override;
189 
190  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
191  vtkInformationVector* outputVector);
192  int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
193  vtkInformationVector* outputVector);
194  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
195  vtkInformationVector* outputVector) override;
196 
197  // see algorithm for more info. needed here so we can request pieces.
198  int ProcessRequest(vtkInformation* request, vtkInformationVector** inputVector,
199  vtkInformationVector* outputVector) override;
200 
201  char* FileName;
213  bool AddTime;
214 
216 
220 
221 private:
222  vtkCSVWriter(const vtkCSVWriter&) = delete;
223  void operator=(const vtkCSVWriter&) = delete;
224 
225  class CSVFile;
226 };
227 
228 #endif
char * FileNameSuffix
Definition: vtkCSVWriter.h:204
#define VTKPVVTKEXTENSIONSIOCORE_EXPORT
vtkMultiProcessController * Controller
Definition: vtkCSVWriter.h:215
bool WriteAllTimeSteps
Definition: vtkCSVWriter.h:202
virtual int ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
vtkDoubleArray * TimeValues
Definition: vtkCSVWriter.h:217
int CurrentTimeIndex
Definition: vtkCSVWriter.h:218
int NumberOfTimeSteps
Definition: vtkCSVWriter.h:219
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
virtual int FillInputPortInformation(int port, vtkInformation *info)
int FieldAssociation
Definition: vtkCSVWriter.h:210
char * StringDelimiter
Definition: vtkCSVWriter.h:206
bool UseStringDelimiter
Definition: vtkCSVWriter.h:207
bool WriteAllTimeStepsSeparately
Definition: vtkCSVWriter.h:203
char * FieldDelimiter
Definition: vtkCSVWriter.h:205
static vtkAlgorithm * New()
virtual void WriteData()=0
CSV writer for vtkTable/vtkDataSet/vtkCompositeDataSet Writes a vtkTable/vtkDataSet/vtkCompositeDataS...
Definition: vtkCSVWriter.h:23
char * FileName
Definition: vtkCSVWriter.h:201
bool UseScientificNotation
Definition: vtkCSVWriter.h:209
void operator=(const vtkObjectBase &)
void PrintSelf(ostream &os, vtkIndent indent)