VTK  9.3.20240425
vtkOpenFOAMReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
38#ifndef vtkOpenFOAMReader_h
39#define vtkOpenFOAMReader_h
40
41#include "vtkIOGeometryModule.h" // For export macro
43
44VTK_ABI_NAMESPACE_BEGIN
45class vtkCollection;
46class vtkCharArray;
48class vtkDoubleArray;
49class vtkStdString;
50class vtkStringArray;
51
52class vtkOpenFOAMReaderPrivate;
53
54class VTKIOGEOMETRY_EXPORT vtkOpenFOAMReader : public vtkMultiBlockDataSetAlgorithm
55{
56public:
57 // Access for implementation class
58 friend class vtkOpenFOAMReaderPrivate;
59
62 void PrintSelf(ostream& os, vtkIndent indent) override;
63
67 int CanReadFile(VTK_FILEPATH const char*);
68
70
76
81 {
82 return this->GetNumberOfSelectionArrays(this->CellDataArraySelection);
83 }
84
89 int GetCellArrayStatus(const char* name)
90 {
91 return this->GetSelectionArrayStatus(this->CellDataArraySelection, name);
92 }
93 void SetCellArrayStatus(const char* name, int status)
94 {
95 this->SetSelectionArrayStatus(this->CellDataArraySelection, name, status);
96 }
97
102 const char* GetCellArrayName(int index)
103 {
104 return this->GetSelectionArrayName(this->CellDataArraySelection, index);
105 }
106
110 void DisableAllCellArrays() { this->DisableAllSelectionArrays(this->CellDataArraySelection); }
111 void EnableAllCellArrays() { this->EnableAllSelectionArrays(this->CellDataArraySelection); }
112
117 {
118 return this->GetNumberOfSelectionArrays(this->PointDataArraySelection);
119 }
120
125 int GetPointArrayStatus(const char* name)
126 {
127 return this->GetSelectionArrayStatus(this->PointDataArraySelection, name);
128 }
129 void SetPointArrayStatus(const char* name, int status)
130 {
131 this->SetSelectionArrayStatus(this->PointDataArraySelection, name, status);
132 }
133
138 const char* GetPointArrayName(int index)
139 {
140 return this->GetSelectionArrayName(this->PointDataArraySelection, index);
141 }
142
146 void DisableAllPointArrays() { this->DisableAllSelectionArrays(this->PointDataArraySelection); }
147 void EnableAllPointArrays() { this->EnableAllSelectionArrays(this->PointDataArraySelection); }
148
153 {
154 return this->GetNumberOfSelectionArrays(this->LagrangianDataArraySelection);
155 }
156
161 int GetLagrangianArrayStatus(const char* name)
162 {
163 return this->GetSelectionArrayStatus(this->LagrangianDataArraySelection, name);
164 }
165 void SetLagrangianArrayStatus(const char* name, int status)
166 {
167 this->SetSelectionArrayStatus(this->LagrangianDataArraySelection, name, status);
168 }
169
174 const char* GetLagrangianArrayName(int index)
175 {
176 return this->GetSelectionArrayName(this->LagrangianDataArraySelection, index);
177 }
178
183 {
184 this->DisableAllSelectionArrays(this->LagrangianDataArraySelection);
185 }
187 {
188 this->EnableAllSelectionArrays(this->LagrangianDataArraySelection);
189 }
190
195 {
196 return this->GetNumberOfSelectionArrays(this->PatchDataArraySelection);
197 }
198
203 int GetPatchArrayStatus(const char* name)
204 {
205 return this->GetSelectionArrayStatus(this->PatchDataArraySelection, name);
206 }
207 void SetPatchArrayStatus(const char* name, int status)
208 {
209 this->SetSelectionArrayStatus(this->PatchDataArraySelection, name, status);
210 }
211
216 const char* GetPatchArrayName(int index)
217 {
218 return this->GetSelectionArrayName(this->PatchDataArraySelection, index);
219 }
220
224 void DisableAllPatchArrays() { this->DisableAllSelectionArrays(this->PatchDataArraySelection); }
225 void EnableAllPatchArrays() { this->EnableAllSelectionArrays(this->PatchDataArraySelection); }
226
228
231 vtkSetMacro(CreateCellToPoint, vtkTypeBool);
232 vtkGetMacro(CreateCellToPoint, vtkTypeBool);
233 vtkBooleanMacro(CreateCellToPoint, vtkTypeBool);
235
237
244 vtkSetMacro(SizeAverageCellToPoint, vtkTypeBool);
245 vtkGetMacro(SizeAverageCellToPoint, vtkTypeBool);
246 vtkBooleanMacro(SizeAverageCellToPoint, vtkTypeBool);
248
250
253 vtkSetMacro(CacheMesh, vtkTypeBool);
254 vtkGetMacro(CacheMesh, vtkTypeBool);
255 vtkBooleanMacro(CacheMesh, vtkTypeBool);
257
258 // Option for reading old binary lagrangian/positions format
260
266 vtkSetMacro(PositionsIsIn13Format, vtkTypeBool);
267 vtkGetMacro(PositionsIsIn13Format, vtkTypeBool);
268 vtkBooleanMacro(PositionsIsIn13Format, vtkTypeBool);
270
272
276 vtkSetMacro(SkipZeroTime, bool);
277 vtkGetMacro(SkipZeroTime, bool);
278 vtkBooleanMacro(SkipZeroTime, bool);
280
282
285 vtkSetMacro(ListTimeStepsByControlDict, vtkTypeBool);
286 vtkGetMacro(ListTimeStepsByControlDict, vtkTypeBool);
287 vtkBooleanMacro(ListTimeStepsByControlDict, vtkTypeBool);
289
291
294 vtkSetMacro(AddDimensionsToArrayNames, vtkTypeBool);
295 vtkGetMacro(AddDimensionsToArrayNames, vtkTypeBool);
296 vtkBooleanMacro(AddDimensionsToArrayNames, vtkTypeBool);
298
300
303 vtkSetMacro(ReadZones, vtkTypeBool);
304 vtkGetMacro(ReadZones, vtkTypeBool);
305 vtkBooleanMacro(ReadZones, vtkTypeBool);
307
309
312 virtual void SetUse64BitLabels(bool val);
313 vtkGetMacro(Use64BitLabels, bool);
314 vtkBooleanMacro(Use64BitLabels, bool);
316
318
322 vtkGetMacro(CopyDataToCellZones, bool);
323 vtkSetMacro(CopyDataToCellZones, bool);
324 vtkBooleanMacro(CopyDataToCellZones, bool);
326
328
333 virtual void SetUse64BitFloats(bool val);
334 vtkGetMacro(Use64BitFloats, bool);
335 vtkBooleanMacro(Use64BitFloats, bool);
337
339 {
340 this->Refresh = true;
341 this->Modified();
342 }
343
344 void SetParent(vtkOpenFOAMReader* parent) { this->Parent = parent; }
345
347 vtkStringArray* timeNames = nullptr, vtkDoubleArray* timeValues = nullptr);
348
349 double GetTimeValue() const;
350 bool SetTimeValue(double);
353
355
356protected:
357 // refresh flag
359
360 // for creating cell-to-point translated data
362
363 // for running size average for cell to point calculation
364 vtkTypeBool SizeAverageCellToPoint = false;
365
366 // for caching mesh
368
369 // for decomposing polyhedra on-the-fly
371
372 // for lagrangian/positions without extra data (OF 1.4 - 2.4)
374
375 // for reading point/face/cell-Zones
377
378 // Ignore 0/ directory
380
381 // determine if time directories are listed according to controlDict
383
384 // add dimensions to array names
386
387 // Expect label size to be 64-bit integers instead of 32-bit.
389
390 // Expect float data to be 64-bit floats instead of 32-bit.
391 // Note that vtkFloatArrays may still be used -- this just tells the reader how to
392 // parse the binary data.
394
395 // The data of internal mesh are copied to cell zones
397
398 char* FileName;
401
402 // DataArraySelection for Patch / Region Data
407
408 // old selection status
413
414 // preserved old information
425
426 // paths to Lagrangians
428
429 // number of reader instances
431 // index of the active reader
433
438
443 void UpdateProgress(double);
444
445private:
446 vtkOpenFOAMReader* Parent;
447
448 vtkOpenFOAMReader(const vtkOpenFOAMReader&) = delete;
449 void operator=(const vtkOpenFOAMReader&) = delete;
450
451 int GetNumberOfSelectionArrays(vtkDataArraySelection*);
452 int GetSelectionArrayStatus(vtkDataArraySelection*, const char*);
453 void SetSelectionArrayStatus(vtkDataArraySelection*, const char*, int);
454 const char* GetSelectionArrayName(vtkDataArraySelection*, int);
455 void DisableAllSelectionArrays(vtkDataArraySelection*);
456 void EnableAllSelectionArrays(vtkDataArraySelection*);
457
458 void AddSelectionNames(vtkDataArraySelection*, vtkStringArray*);
459
460 // Print some time information (names, current time-step)
461 void PrintTimes(std::ostream& os, vtkIndent indent = vtkIndent(), bool full = false) const;
462};
463
464VTK_ABI_NAMESPACE_END
465#endif
dynamic, self-adjusting array of char
create and manipulate ordered lists of objects
Store on/off settings for data arrays, etc.
dynamic, self-adjusting array of double
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
virtual void Modified()
Update the modification time for this object.
reads a dataset in OpenFOAM format
vtkMTimeType CellSelectionMTimeOld
vtkCharArray * CasePath
void SetLagrangianArrayStatus(const char *name, int status)
~vtkOpenFOAMReader() override
vtkTypeBool AddDimensionsToArrayNames
void DisableAllPatchArrays()
Turn on/off all Patches including the Internal Mesh.
bool SetTimeValue(double)
int GetCellArrayStatus(const char *name)
Get/Set whether the cell array with the given name is to be read.
vtkSetFilePathMacro(FileName)
Set/Get the filename.
int CanReadFile(VTK_FILEPATH const char *)
Determine if the file can be read with this reader.
void SetPatchArrayStatus(const char *name, int status)
vtkDataArraySelection * PointDataArraySelection
vtkMTimeType PatchSelectionMTimeOld
double GetTimeValue() const
vtkCollection * Readers
vtkDataArraySelection * CellDataArraySelection
vtkTypeBool PositionsIsIn13Format
int GetNumberOfCellArrays()
Get the number of cell arrays available in the input.
void CreateCasePath(vtkStdString &, vtkStdString &)
void DisableAllPointArrays()
Turn on/off all point arrays.
int MakeInformationVector(vtkInformationVector *, const vtkStdString &procDirName, vtkStringArray *timeNames=nullptr, vtkDoubleArray *timeValues=nullptr)
const char * GetLagrangianArrayName(int index)
Get the name of the Lagrangian array with the given index in the input.
int GetNumberOfPointArrays()
Get the number of point arrays available in the input.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetUse64BitLabels(bool val)
If true, labels are expected to be 64-bit, rather than 32.
void CreateCharArrayFromString(vtkCharArray *, const char *, vtkStdString &)
vtkDataArraySelection * PatchDataArraySelection
const char * GetCellArrayName(int index)
Get the name of the cell array with the given index in the input.
int MakeMetaDataAtTimeStep(bool)
int GetLagrangianArrayStatus(const char *name)
Get/Set whether the Lagrangian array with the given name is to be read.
vtkTypeBool DecomposePolyhedra
void SetParent(vtkOpenFOAMReader *parent)
vtkTypeBool ListTimeStepsByControlDict
static vtkOpenFOAMReader * New()
int GetNumberOfPatchArrays()
Get the number of Patches (including Internal Mesh) available in the input.
vtkStringArray * GetTimeNames()
vtkMTimeType PointSelectionMTimeOld
vtkGetFilePathMacro(FileName)
Set/Get the filename.
void DisableAllLagrangianArrays()
Turn on/off all Lagrangian arrays.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkDataArraySelection * LagrangianDataArraySelection
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
int GetPatchArrayStatus(const char *name)
Get/Set whether the Patch with the given name is to be read.
void UpdateProgress(double)
const char * GetPointArrayName(int index)
Get the name of the point array with the given index in the input.
int GetPointArrayStatus(const char *name)
Get/Set whether the point array with the given name is to be read.
const char * GetPatchArrayName(int index)
Get the name of the Patch with the given index in the input.
void DisableAllCellArrays()
Turn on/off all cell arrays.
void SetCellArrayStatus(const char *name, int status)
vtkStringArray * LagrangianPaths
vtkStdString * FileNameOld
virtual void SetUse64BitFloats(bool val)
If true, floats are expected to be 64-bit, rather than 32.
void SetTimeInformation(vtkInformationVector *, vtkDoubleArray *)
vtkTypeBool CreateCellToPoint
vtkMTimeType LagrangianSelectionMTimeOld
void SetPointArrayStatus(const char *name, int status)
vtkDoubleArray * GetTimeValues()
int GetNumberOfLagrangianArrays()
Get the number of Lagrangian arrays available in the input.
Wrapper around std::string to keep symbols short.
a vtkAbstractArray subclass for strings
int vtkTypeBool
Definition vtkABI.h:64
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_FILEPATH