VTK  9.1.0
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=========================================================================*/
47#ifndef vtkOpenFOAMReader_h
48#define vtkOpenFOAMReader_h
49
50#include "vtkIOGeometryModule.h" // For export macro
52
53class vtkCollection;
54class vtkCharArray;
56class vtkDoubleArray;
57class vtkStdString;
58class vtkStringArray;
59
60class vtkOpenFOAMReaderPrivate;
61
62class VTKIOGEOMETRY_EXPORT vtkOpenFOAMReader : public vtkMultiBlockDataSetAlgorithm
63{
64public:
65 // Access for implementation class
66 friend class vtkOpenFOAMReaderPrivate;
67
70 void PrintSelf(ostream& os, vtkIndent indent) override;
71
75 int CanReadFile(VTK_FILEPATH const char*);
76
78
84
89 {
90 return this->GetNumberOfSelectionArrays(this->CellDataArraySelection);
91 }
92
97 int GetCellArrayStatus(const char* name)
98 {
99 return this->GetSelectionArrayStatus(this->CellDataArraySelection, name);
100 }
101 void SetCellArrayStatus(const char* name, int status)
102 {
103 this->SetSelectionArrayStatus(this->CellDataArraySelection, name, status);
104 }
105
110 const char* GetCellArrayName(int index)
111 {
112 return this->GetSelectionArrayName(this->CellDataArraySelection, index);
113 }
114
118 void DisableAllCellArrays() { this->DisableAllSelectionArrays(this->CellDataArraySelection); }
119 void EnableAllCellArrays() { this->EnableAllSelectionArrays(this->CellDataArraySelection); }
120
125 {
126 return this->GetNumberOfSelectionArrays(this->PointDataArraySelection);
127 }
128
133 int GetPointArrayStatus(const char* name)
134 {
135 return this->GetSelectionArrayStatus(this->PointDataArraySelection, name);
136 }
137 void SetPointArrayStatus(const char* name, int status)
138 {
139 this->SetSelectionArrayStatus(this->PointDataArraySelection, name, status);
140 }
141
146 const char* GetPointArrayName(int index)
147 {
148 return this->GetSelectionArrayName(this->PointDataArraySelection, index);
149 }
150
154 void DisableAllPointArrays() { this->DisableAllSelectionArrays(this->PointDataArraySelection); }
155 void EnableAllPointArrays() { this->EnableAllSelectionArrays(this->PointDataArraySelection); }
156
161 {
162 return this->GetNumberOfSelectionArrays(this->LagrangianDataArraySelection);
163 }
164
170 {
171 return this->GetSelectionArrayStatus(this->LagrangianDataArraySelection, name);
172 }
173 void SetLagrangianArrayStatus(const char* name, int status)
174 {
175 this->SetSelectionArrayStatus(this->LagrangianDataArraySelection, name, status);
176 }
177
183 {
184 return this->GetSelectionArrayName(this->LagrangianDataArraySelection, index);
185 }
186
191 {
192 this->DisableAllSelectionArrays(this->LagrangianDataArraySelection);
193 }
195 {
196 this->EnableAllSelectionArrays(this->LagrangianDataArraySelection);
197 }
198
203 {
204 return this->GetNumberOfSelectionArrays(this->PatchDataArraySelection);
205 }
206
211 int GetPatchArrayStatus(const char* name)
212 {
213 return this->GetSelectionArrayStatus(this->PatchDataArraySelection, name);
214 }
215 void SetPatchArrayStatus(const char* name, int status)
216 {
217 this->SetSelectionArrayStatus(this->PatchDataArraySelection, name, status);
218 }
219
224 const char* GetPatchArrayName(int index)
225 {
226 return this->GetSelectionArrayName(this->PatchDataArraySelection, index);
227 }
228
232 void DisableAllPatchArrays() { this->DisableAllSelectionArrays(this->PatchDataArraySelection); }
233 void EnableAllPatchArrays() { this->EnableAllSelectionArrays(this->PatchDataArraySelection); }
234
236
239 vtkSetMacro(CreateCellToPoint, vtkTypeBool);
240 vtkGetMacro(CreateCellToPoint, vtkTypeBool);
241 vtkBooleanMacro(CreateCellToPoint, vtkTypeBool);
243
245
248 vtkSetMacro(CacheMesh, vtkTypeBool);
249 vtkGetMacro(CacheMesh, vtkTypeBool);
250 vtkBooleanMacro(CacheMesh, vtkTypeBool);
252
254
257 vtkSetMacro(DecomposePolyhedra, vtkTypeBool);
258 vtkGetMacro(DecomposePolyhedra, vtkTypeBool);
259 vtkBooleanMacro(DecomposePolyhedra, vtkTypeBool);
261
262 // Option for reading old binary lagrangian/positions format
264
270 vtkSetMacro(PositionsIsIn13Format, vtkTypeBool);
271 vtkGetMacro(PositionsIsIn13Format, vtkTypeBool);
272 vtkBooleanMacro(PositionsIsIn13Format, vtkTypeBool);
274
276
280 vtkSetMacro(SkipZeroTime, bool);
281 vtkGetMacro(SkipZeroTime, bool);
282 vtkBooleanMacro(SkipZeroTime, bool);
284
286
289 vtkSetMacro(ListTimeStepsByControlDict, vtkTypeBool);
290 vtkGetMacro(ListTimeStepsByControlDict, vtkTypeBool);
291 vtkBooleanMacro(ListTimeStepsByControlDict, vtkTypeBool);
293
295
298 vtkSetMacro(AddDimensionsToArrayNames, vtkTypeBool);
299 vtkGetMacro(AddDimensionsToArrayNames, vtkTypeBool);
300 vtkBooleanMacro(AddDimensionsToArrayNames, vtkTypeBool);
302
304
307 vtkSetMacro(ReadZones, vtkTypeBool);
308 vtkGetMacro(ReadZones, vtkTypeBool);
309 vtkBooleanMacro(ReadZones, vtkTypeBool);
311
313
316 virtual void SetUse64BitLabels(bool val);
317 vtkGetMacro(Use64BitLabels, bool);
318 vtkBooleanMacro(Use64BitLabels, bool);
320
322
326 vtkGetMacro(CopyDataToCellZones, bool);
327 vtkSetMacro(CopyDataToCellZones, bool);
328 vtkBooleanMacro(CopyDataToCellZones, bool);
330
332
337 virtual void SetUse64BitFloats(bool val);
338 vtkGetMacro(Use64BitFloats, bool);
339 vtkBooleanMacro(Use64BitFloats, bool);
341
343 {
344 this->Refresh = true;
345 this->Modified();
346 }
347
348 void SetParent(vtkOpenFOAMReader* parent) { this->Parent = parent; }
349
351 vtkStringArray* timeNames = nullptr, vtkDoubleArray* timeValues = nullptr);
352
353 double GetTimeValue() const;
354 bool SetTimeValue(const double);
357
358 int MakeMetaDataAtTimeStep(const bool);
359
360protected:
361 // refresh flag
363
364 // for creating cell-to-point translated data
366
367 // for caching mesh
369
370 // for decomposing polyhedra on-the-fly
372
373 // for lagrangian/positions without extra data (OF 1.4 - 2.4)
375
376 // for reading point/face/cell-Zones
378
379 // Ignore 0/ directory
381
382 // determine if time directories are listed according to controlDict
384
385 // add dimensions to array names
387
388 // Expect label size to be 64-bit integers instead of 32-bit.
390
391 // Expect float data to be 64-bit floats instead of 32-bit.
392 // Note that vtkFloatArrays may still be used -- this just tells the reader how to
393 // parse the binary data.
395
396 // The data of internal mesh are copied to cell zones
398
399 char* FileName;
402
403 // DataArraySelection for Patch / Region Data
408
409 // old selection status
414
415 // preserved old information
426
427 // paths to Lagrangians
429
430 // number of reader instances
432 // index of the active reader
434
439
444 void UpdateProgress(double);
445
446private:
447 vtkOpenFOAMReader* Parent;
448
449 vtkOpenFOAMReader(const vtkOpenFOAMReader&) = delete;
450 void operator=(const vtkOpenFOAMReader&) = delete;
451
452 int GetNumberOfSelectionArrays(vtkDataArraySelection*);
453 int GetSelectionArrayStatus(vtkDataArraySelection*, const char*);
454 void SetSelectionArrayStatus(vtkDataArraySelection*, const char*, int);
455 const char* GetSelectionArrayName(vtkDataArraySelection*, int);
456 void DisableAllSelectionArrays(vtkDataArraySelection*);
457 void EnableAllSelectionArrays(vtkDataArraySelection*);
458
459 void AddSelectionNames(vtkDataArraySelection*, vtkStringArray*);
460
461 // Print some time information (names, current time-step)
462 void PrintTimes(std::ostream& os, vtkIndent indent = vtkIndent(), bool full = false) const;
463};
464
465#endif
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:68
create and manipulate ordered lists of objects
Definition: vtkCollection.h:53
Store on/off settings for data arrays for a vtkSource.
dynamic, self-adjusting array of double
a simple class to control print indentation
Definition: vtkIndent.h:113
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.
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.
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.
Definition: vtkStdString.h:105
a vtkAbstractArray subclass for strings
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252
int vtkTypeBool
Definition: vtkABI.h:69
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_FILEPATH