VTK  9.2.6
vtkOpenFOAMReader.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkOpenFOAMReader.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
49
50#ifndef vtkOpenFOAMReader_h
51#define vtkOpenFOAMReader_h
52
53#include "vtkIOGeometryModule.h" // For export macro
55
56class vtkCollection;
57class vtkCharArray;
59class vtkDoubleArray;
60class vtkStdString;
61class vtkStringArray;
62
63class vtkOpenFOAMReaderPrivate;
64
65class VTKIOGEOMETRY_EXPORT vtkOpenFOAMReader : public vtkMultiBlockDataSetAlgorithm
66{
67public:
68 // Access for implementation class
70
73 void PrintSelf(ostream& os, vtkIndent indent) override;
74
78 int CanReadFile(VTK_FILEPATH const char*);
79
81
87
92 {
93 return this->GetNumberOfSelectionArrays(this->CellDataArraySelection);
94 }
95
100 int GetCellArrayStatus(const char* name)
101 {
102 return this->GetSelectionArrayStatus(this->CellDataArraySelection, name);
103 }
104 void SetCellArrayStatus(const char* name, int status)
105 {
106 this->SetSelectionArrayStatus(this->CellDataArraySelection, name, status);
107 }
108
113 const char* GetCellArrayName(int index)
114 {
115 return this->GetSelectionArrayName(this->CellDataArraySelection, index);
116 }
117
121 void DisableAllCellArrays() { this->DisableAllSelectionArrays(this->CellDataArraySelection); }
122 void EnableAllCellArrays() { this->EnableAllSelectionArrays(this->CellDataArraySelection); }
123
128 {
129 return this->GetNumberOfSelectionArrays(this->PointDataArraySelection);
130 }
131
136 int GetPointArrayStatus(const char* name)
137 {
138 return this->GetSelectionArrayStatus(this->PointDataArraySelection, name);
139 }
140 void SetPointArrayStatus(const char* name, int status)
141 {
142 this->SetSelectionArrayStatus(this->PointDataArraySelection, name, status);
143 }
144
149 const char* GetPointArrayName(int index)
150 {
151 return this->GetSelectionArrayName(this->PointDataArraySelection, index);
152 }
153
157 void DisableAllPointArrays() { this->DisableAllSelectionArrays(this->PointDataArraySelection); }
158 void EnableAllPointArrays() { this->EnableAllSelectionArrays(this->PointDataArraySelection); }
159
164 {
165 return this->GetNumberOfSelectionArrays(this->LagrangianDataArraySelection);
166 }
167
172 int GetLagrangianArrayStatus(const char* name)
173 {
174 return this->GetSelectionArrayStatus(this->LagrangianDataArraySelection, name);
175 }
176 void SetLagrangianArrayStatus(const char* name, int status)
177 {
178 this->SetSelectionArrayStatus(this->LagrangianDataArraySelection, name, status);
179 }
180
185 const char* GetLagrangianArrayName(int index)
186 {
187 return this->GetSelectionArrayName(this->LagrangianDataArraySelection, index);
188 }
189
194 {
195 this->DisableAllSelectionArrays(this->LagrangianDataArraySelection);
196 }
198 {
199 this->EnableAllSelectionArrays(this->LagrangianDataArraySelection);
200 }
201
206 {
207 return this->GetNumberOfSelectionArrays(this->PatchDataArraySelection);
208 }
209
214 int GetPatchArrayStatus(const char* name)
215 {
216 return this->GetSelectionArrayStatus(this->PatchDataArraySelection, name);
217 }
218 void SetPatchArrayStatus(const char* name, int status)
219 {
220 this->SetSelectionArrayStatus(this->PatchDataArraySelection, name, status);
221 }
222
227 const char* GetPatchArrayName(int index)
228 {
229 return this->GetSelectionArrayName(this->PatchDataArraySelection, index);
230 }
231
235 void DisableAllPatchArrays() { this->DisableAllSelectionArrays(this->PatchDataArraySelection); }
236 void EnableAllPatchArrays() { this->EnableAllSelectionArrays(this->PatchDataArraySelection); }
237
239
246
248
251 vtkSetMacro(CacheMesh, vtkTypeBool);
252 vtkGetMacro(CacheMesh, vtkTypeBool);
253 vtkBooleanMacro(CacheMesh, vtkTypeBool);
255
257
264
265 // Option for reading old binary lagrangian/positions format
267
277
279
283 vtkSetMacro(SkipZeroTime, bool);
284 vtkGetMacro(SkipZeroTime, bool);
285 vtkBooleanMacro(SkipZeroTime, bool);
287
289
296
298
305
307
310 vtkSetMacro(ReadZones, vtkTypeBool);
311 vtkGetMacro(ReadZones, vtkTypeBool);
312 vtkBooleanMacro(ReadZones, vtkTypeBool);
314
316
319 virtual void SetUse64BitLabels(bool val);
320 vtkGetMacro(Use64BitLabels, bool);
321 vtkBooleanMacro(Use64BitLabels, bool);
323
325
329 vtkGetMacro(CopyDataToCellZones, bool);
330 vtkSetMacro(CopyDataToCellZones, bool);
331 vtkBooleanMacro(CopyDataToCellZones, bool);
333
335
340 virtual void SetUse64BitFloats(bool val);
341 vtkGetMacro(Use64BitFloats, bool);
342 vtkBooleanMacro(Use64BitFloats, bool);
344
346 {
347 this->Refresh = true;
348 this->Modified();
349 }
350
351 void SetParent(vtkOpenFOAMReader* parent) { this->Parent = parent; }
352
354 vtkStringArray* timeNames = nullptr, vtkDoubleArray* timeValues = nullptr);
355
356 double GetTimeValue() const;
357 bool SetTimeValue(const double);
360
361 int MakeMetaDataAtTimeStep(const bool);
362
363protected:
364 // refresh flag
366
367 // for creating cell-to-point translated data
369
370 // for caching mesh
372
373 // for decomposing polyhedra on-the-fly
375
376 // for lagrangian/positions without extra data (OF 1.4 - 2.4)
378
379 // for reading point/face/cell-Zones
381
382 // Ignore 0/ directory
384
385 // determine if time directories are listed according to controlDict
387
388 // add dimensions to array names
390
391 // Expect label size to be 64-bit integers instead of 32-bit.
393
394 // Expect float data to be 64-bit floats instead of 32-bit.
395 // Note that vtkFloatArrays may still be used -- this just tells the reader how to
396 // parse the binary data.
398
399 // The data of internal mesh are copied to cell zones
401
402 char* FileName;
405
406 // DataArraySelection for Patch / Region Data
411
412 // old selection status
417
418 // preserved old information
429
430 // paths to Lagrangians
432
433 // number of reader instances
435 // index of the active reader
437
442
447 void UpdateProgress(double);
448
449private:
450 vtkOpenFOAMReader* Parent;
451
452 vtkOpenFOAMReader(const vtkOpenFOAMReader&) = delete;
453 void operator=(const vtkOpenFOAMReader&) = delete;
454
455 int GetNumberOfSelectionArrays(vtkDataArraySelection*);
456 int GetSelectionArrayStatus(vtkDataArraySelection*, const char*);
457 void SetSelectionArrayStatus(vtkDataArraySelection*, const char*, int);
458 const char* GetSelectionArrayName(vtkDataArraySelection*, int);
459 void DisableAllSelectionArrays(vtkDataArraySelection*);
460 void EnableAllSelectionArrays(vtkDataArraySelection*);
461
462 void AddSelectionNames(vtkDataArraySelection*, vtkStringArray*);
463
464 // Print some time information (names, current time-step)
465 void PrintTimes(std::ostream& os, vtkIndent indent = vtkIndent(), bool full = false) const;
466};
467
468#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:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
virtual void Modified()
Update the modification time for this object.
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.
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)
int GetNumberOfCellArrays(void)
Get the number of cell arrays available in the input.
vtkDataArraySelection * PointDataArraySelection
vtkMTimeType PatchSelectionMTimeOld
double GetTimeValue() const
vtkCollection * Readers
vtkDataArraySelection * CellDataArraySelection
vtkTypeBool PositionsIsIn13Format
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.
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 GetLagrangianArrayStatus(const char *name)
Get/Set whether the Lagrangian array with the given name is to be read.
vtkTypeBool DecomposePolyhedra
void SetParent(vtkOpenFOAMReader *parent)
bool SetTimeValue(const double)
vtkTypeBool ListTimeStepsByControlDict
static vtkOpenFOAMReader * New()
int GetNumberOfLagrangianArrays(void)
Get the number of Lagrangian arrays 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.
friend class vtkOpenFOAMReaderPrivate
void UpdateProgress(double)
const char * GetPointArrayName(int index)
Get the name of the point array with the given index in the input.
int GetNumberOfPatchArrays(void)
Get the number of Patches (including Internal Mesh) available in the input.
int GetPointArrayStatus(const char *name)
Get/Set whether the point array with the given name is to be read.
int MakeMetaDataAtTimeStep(const bool)
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
int GetNumberOfPointArrays(void)
Get the number of point arrays available in the input.
vtkMTimeType LagrangianSelectionMTimeOld
void SetPointArrayStatus(const char *name, int status)
vtkDoubleArray * GetTimeValues()
Wrapper around std::string to keep symbols short.
a vtkAbstractArray subclass for strings
int vtkTypeBool
Definition vtkABI.h:69
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287
#define VTK_FILEPATH