VTK  9.3.0
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 "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_1_0
42#include "vtkIOGeometryModule.h" // For export macro
44
45VTK_ABI_NAMESPACE_BEGIN
46class vtkCollection;
47class vtkCharArray;
49class vtkDoubleArray;
50class vtkStdString;
51class vtkStringArray;
52
53class vtkOpenFOAMReaderPrivate;
54
55class VTKIOGEOMETRY_EXPORT vtkOpenFOAMReader : public vtkMultiBlockDataSetAlgorithm
56{
57public:
58 // Access for implementation class
59 friend class vtkOpenFOAMReaderPrivate;
60
63 void PrintSelf(ostream& os, vtkIndent indent) override;
64
68 int CanReadFile(VTK_FILEPATH const char*);
69
71
77
82 {
83 return this->GetNumberOfSelectionArrays(this->CellDataArraySelection);
84 }
85
90 int GetCellArrayStatus(const char* name)
91 {
92 return this->GetSelectionArrayStatus(this->CellDataArraySelection, name);
93 }
94 void SetCellArrayStatus(const char* name, int status)
95 {
96 this->SetSelectionArrayStatus(this->CellDataArraySelection, name, status);
97 }
98
103 const char* GetCellArrayName(int index)
104 {
105 return this->GetSelectionArrayName(this->CellDataArraySelection, index);
106 }
107
111 void DisableAllCellArrays() { this->DisableAllSelectionArrays(this->CellDataArraySelection); }
112 void EnableAllCellArrays() { this->EnableAllSelectionArrays(this->CellDataArraySelection); }
113
118 {
119 return this->GetNumberOfSelectionArrays(this->PointDataArraySelection);
120 }
121
126 int GetPointArrayStatus(const char* name)
127 {
128 return this->GetSelectionArrayStatus(this->PointDataArraySelection, name);
129 }
130 void SetPointArrayStatus(const char* name, int status)
131 {
132 this->SetSelectionArrayStatus(this->PointDataArraySelection, name, status);
133 }
134
139 const char* GetPointArrayName(int index)
140 {
141 return this->GetSelectionArrayName(this->PointDataArraySelection, index);
142 }
143
147 void DisableAllPointArrays() { this->DisableAllSelectionArrays(this->PointDataArraySelection); }
148 void EnableAllPointArrays() { this->EnableAllSelectionArrays(this->PointDataArraySelection); }
149
154 {
155 return this->GetNumberOfSelectionArrays(this->LagrangianDataArraySelection);
156 }
157
162 int GetLagrangianArrayStatus(const char* name)
163 {
164 return this->GetSelectionArrayStatus(this->LagrangianDataArraySelection, name);
165 }
166 void SetLagrangianArrayStatus(const char* name, int status)
167 {
168 this->SetSelectionArrayStatus(this->LagrangianDataArraySelection, name, status);
169 }
170
175 const char* GetLagrangianArrayName(int index)
176 {
177 return this->GetSelectionArrayName(this->LagrangianDataArraySelection, index);
178 }
179
184 {
185 this->DisableAllSelectionArrays(this->LagrangianDataArraySelection);
186 }
188 {
189 this->EnableAllSelectionArrays(this->LagrangianDataArraySelection);
190 }
191
196 {
197 return this->GetNumberOfSelectionArrays(this->PatchDataArraySelection);
198 }
199
204 int GetPatchArrayStatus(const char* name)
205 {
206 return this->GetSelectionArrayStatus(this->PatchDataArraySelection, name);
207 }
208 void SetPatchArrayStatus(const char* name, int status)
209 {
210 this->SetSelectionArrayStatus(this->PatchDataArraySelection, name, status);
211 }
212
217 const char* GetPatchArrayName(int index)
218 {
219 return this->GetSelectionArrayName(this->PatchDataArraySelection, index);
220 }
221
225 void DisableAllPatchArrays() { this->DisableAllSelectionArrays(this->PatchDataArraySelection); }
226 void EnableAllPatchArrays() { this->EnableAllSelectionArrays(this->PatchDataArraySelection); }
227
229
232 vtkSetMacro(CreateCellToPoint, vtkTypeBool);
233 vtkGetMacro(CreateCellToPoint, vtkTypeBool);
234 vtkBooleanMacro(CreateCellToPoint, vtkTypeBool);
236
238
245 vtkSetMacro(SizeAverageCellToPoint, vtkTypeBool);
246 vtkGetMacro(SizeAverageCellToPoint, vtkTypeBool);
247 vtkBooleanMacro(SizeAverageCellToPoint, vtkTypeBool);
249
251
254 vtkSetMacro(CacheMesh, vtkTypeBool);
255 vtkGetMacro(CacheMesh, vtkTypeBool);
256 vtkBooleanMacro(CacheMesh, vtkTypeBool);
258
260
263 VTK_DEPRECATED_IN_9_1_0("Decomposing polyhedra will be removed.")
264 virtual void SetDecomposePolyhedra(vtkTypeBool _arg);
265 vtkGetMacro(DecomposePolyhedra, vtkTypeBool);
266 vtkBooleanMacro(DecomposePolyhedra, vtkTypeBool);
268
269 // Option for reading old binary lagrangian/positions format
271
277 vtkSetMacro(PositionsIsIn13Format, vtkTypeBool);
278 vtkGetMacro(PositionsIsIn13Format, vtkTypeBool);
279 vtkBooleanMacro(PositionsIsIn13Format, vtkTypeBool);
281
283
287 vtkSetMacro(SkipZeroTime, bool);
288 vtkGetMacro(SkipZeroTime, bool);
289 vtkBooleanMacro(SkipZeroTime, bool);
291
293
296 vtkSetMacro(ListTimeStepsByControlDict, vtkTypeBool);
297 vtkGetMacro(ListTimeStepsByControlDict, vtkTypeBool);
298 vtkBooleanMacro(ListTimeStepsByControlDict, vtkTypeBool);
300
302
305 vtkSetMacro(AddDimensionsToArrayNames, vtkTypeBool);
306 vtkGetMacro(AddDimensionsToArrayNames, vtkTypeBool);
307 vtkBooleanMacro(AddDimensionsToArrayNames, vtkTypeBool);
309
311
314 vtkSetMacro(ReadZones, vtkTypeBool);
315 vtkGetMacro(ReadZones, vtkTypeBool);
316 vtkBooleanMacro(ReadZones, vtkTypeBool);
318
320
323 virtual void SetUse64BitLabels(bool val);
324 vtkGetMacro(Use64BitLabels, bool);
325 vtkBooleanMacro(Use64BitLabels, bool);
327
329
333 vtkGetMacro(CopyDataToCellZones, bool);
334 vtkSetMacro(CopyDataToCellZones, bool);
335 vtkBooleanMacro(CopyDataToCellZones, bool);
337
339
344 virtual void SetUse64BitFloats(bool val);
345 vtkGetMacro(Use64BitFloats, bool);
346 vtkBooleanMacro(Use64BitFloats, bool);
348
349 void SetRefresh()
350 {
351 this->Refresh = true;
352 this->Modified();
353 }
354
355 void SetParent(vtkOpenFOAMReader* parent) { this->Parent = parent; }
356
358 vtkStringArray* timeNames = nullptr, vtkDoubleArray* timeValues = nullptr);
359
360 double GetTimeValue() const;
361 bool SetTimeValue(double);
364
366
367protected:
368 // refresh flag
370
371 // for creating cell-to-point translated data
373
374 // for running size average for cell to point calculation
375 vtkTypeBool SizeAverageCellToPoint = false;
376
377 // for caching mesh
379
380 // for decomposing polyhedra on-the-fly
382
383 // for lagrangian/positions without extra data (OF 1.4 - 2.4)
385
386 // for reading point/face/cell-Zones
388
389 // Ignore 0/ directory
391
392 // determine if time directories are listed according to controlDict
394
395 // add dimensions to array names
397
398 // Expect label size to be 64-bit integers instead of 32-bit.
400
401 // Expect float data to be 64-bit floats instead of 32-bit.
402 // Note that vtkFloatArrays may still be used -- this just tells the reader how to
403 // parse the binary data.
405
406 // The data of internal mesh are copied to cell zones
408
409 char* FileName;
412
413 // DataArraySelection for Patch / Region Data
418
419 // old selection status
424
425 // preserved old information
436
437 // paths to Lagrangians
439
440 // number of reader instances
442 // index of the active reader
444
449
454 void UpdateProgress(double);
455
456private:
457 vtkOpenFOAMReader* Parent;
458
459 vtkOpenFOAMReader(const vtkOpenFOAMReader&) = delete;
460 void operator=(const vtkOpenFOAMReader&) = delete;
461
462 int GetNumberOfSelectionArrays(vtkDataArraySelection*);
463 int GetSelectionArrayStatus(vtkDataArraySelection*, const char*);
464 void SetSelectionArrayStatus(vtkDataArraySelection*, const char*, int);
465 const char* GetSelectionArrayName(vtkDataArraySelection*, int);
466 void DisableAllSelectionArrays(vtkDataArraySelection*);
467 void EnableAllSelectionArrays(vtkDataArraySelection*);
468
469 void AddSelectionNames(vtkDataArraySelection*, vtkStringArray*);
470
471 // Print some time information (names, current time-step)
472 void PrintTimes(std::ostream& os, vtkIndent indent = vtkIndent(), bool full = false) const;
473};
474
475VTK_ABI_NAMESPACE_END
476#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:29
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.
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
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
#define VTK_DEPRECATED_IN_9_1_0(reason)
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_FILEPATH