VTK  9.6.20260422
vtkCGNSReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright 2013-2014 Mickael Philit
3// SPDX-License-Identifier: BSD-3-Clause
18
19#ifndef vtkCGNSReader_h
20#define vtkCGNSReader_h
21
22#include "vtkIOCGNSReaderModule.h" // for export macro
24#include "vtkNew.h" // for vtkNew.
25
26#include <map> // for std::map
27#include <set> // for std::set
28#include <string> // for std::string
29
30namespace CGNSRead
31{
32VTK_ABI_NAMESPACE_BEGIN
33class vtkCGNSMetaData;
34VTK_ABI_NAMESPACE_END
35}
36
37VTK_ABI_NAMESPACE_BEGIN
41
42class VTKIOCGNSREADER_EXPORT vtkCGNSReader : public vtkMultiBlockDataSetAlgorithm
43{
44public:
45 static vtkCGNSReader* New();
47 void PrintSelf(ostream& os, vtkIndent indent) override;
48
54
56
66 vtkSetClampMacro(DataLocation, int, vtkCGNSReader::CELL_DATA, vtkCGNSReader::FACE_DATA);
67 vtkGetMacro(DataLocation, int);
69
71
77
81 int CanReadFile(VTK_FILEPATH const char* filename);
82
87
92
97
102
107
109
115 int GetBaseArrayStatus(const char* name);
116 void SetBaseArrayStatus(const char* name, int status);
120 const char* GetBaseArrayName(int index);
122
124
129 const char* GetFamilyArrayName(int index);
130 void SetFamilyArrayStatus(const char* name, int status);
131 int GetFamilyArrayStatus(const char* name);
135
137
142 const char* GetPointArrayName(int index);
143 int GetPointArrayStatus(const char* name);
144 void SetPointArrayStatus(const char* name, int status);
148
150
155 const char* GetCellArrayName(int index);
156 int GetCellArrayStatus(const char* name);
157 void SetCellArrayStatus(const char* name, int status);
161
163
168 const char* GetFaceArrayName(int index);
169 int GetFaceArrayStatus(const char* name);
170 void SetFaceArrayStatus(const char* name, int status);
174
176
180 vtkSetMacro(DoublePrecisionMesh, int);
181 vtkGetMacro(DoublePrecisionMesh, int);
182 vtkBooleanMacro(DoublePrecisionMesh, int);
184
186
190 vtkSetMacro(LoadBndPatch, bool);
191 vtkGetMacro(LoadBndPatch, bool);
192 vtkBooleanMacro(LoadBndPatch, bool);
194
196
200 vtkSetMacro(LoadSurfacePatch, bool);
201 vtkGetMacro(LoadSurfacePatch, bool);
202 vtkBooleanMacro(LoadSurfacePatch, bool);
204
206
210 vtkSetMacro(LoadMesh, bool);
211 vtkGetMacro(LoadMesh, bool);
212 vtkBooleanMacro(LoadMesh, bool);
214
216
220 vtkSetMacro(Use3DVector, bool);
221 vtkGetMacro(Use3DVector, bool);
222 vtkBooleanMacro(Use3DVector, bool);
224
226
232 vtkSetMacro(FlipFaceNormals, bool);
233 vtkGetMacro(FlipFaceNormals, bool);
234 vtkBooleanMacro(FlipFaceNormals, bool);
236
238
246 vtkSetMacro(CreateEachSolutionAsBlock, int);
247 vtkGetMacro(CreateEachSolutionAsBlock, int);
248 vtkBooleanMacro(CreateEachSolutionAsBlock, int);
250
252
265 vtkSetMacro(IgnoreFlowSolutionPointers, bool);
266 vtkGetMacro(IgnoreFlowSolutionPointers, bool);
267 vtkBooleanMacro(IgnoreFlowSolutionPointers, bool);
269
271
277 vtkSetMacro(UseUnsteadyPattern, bool);
278 vtkGetMacro(UseUnsteadyPattern, bool);
279 vtkBooleanMacro(UseUnsteadyPattern, bool);
281
283
288 vtkSetMacro(UnsteadySolutionStartTimestep, int);
289 vtkGetMacro(UnsteadySolutionStartTimestep, int);
291
293
298 vtkSetMacro(DistributeBlocks, bool);
299 vtkGetMacro(DistributeBlocks, bool);
300 vtkBooleanMacro(DistributeBlocks, bool);
302
304
310 void SetCacheMesh(bool enable);
311 vtkGetMacro(CacheMesh, bool);
312 vtkBooleanMacro(CacheMesh, bool);
314
316
322 void SetCacheConnectivity(bool enable);
323 vtkGetMacro(CacheConnectivity, bool);
324 vtkBooleanMacro(CacheConnectivity, bool);
326
328
336
342
347
348protected:
350 ~vtkCGNSReader() override;
351
352 int FillOutputPortInformation(int port, vtkInformation* info) override;
355
357 int base, int zone, int cell_dim, int phys_dim, void* zsize, vtkMultiBlockDataSet* mbase);
358
360 int base, int zone, int cell_dim, int phys_dim, void* zsize, vtkMultiBlockDataSet* mbase);
361
367
371
374
378
379private:
380 vtkCGNSReader(const vtkCGNSReader&) = delete;
381 void operator=(const vtkCGNSReader&) = delete;
382
383 std::string FileName;
384 int DataLocation = vtkCGNSReader::CELL_DATA;
385 bool LoadBndPatch = false;
386 bool LoadSurfacePatch = false;
387 bool LoadMesh = true;
388 int DoublePrecisionMesh = 1;
389 int CreateEachSolutionAsBlock = 0;
390 bool IgnoreFlowSolutionPointers = false;
391 bool UseUnsteadyPattern = false;
392 bool DistributeBlocks = true;
393 bool CacheMesh = false;
394 bool CacheConnectivity = false;
395 bool Use3DVector = true;
396 bool FlipFaceNormals = false;
397 int UnsteadySolutionStartTimestep = 0;
398
399 // For internal cgio calls (low level IO)
400 int cgioNum; // cgio file reference
401 double rootId; // id of root node
402 double currentZoneId; // id of node currently being read (zone)
403
404 unsigned int NumberOfBases = 0;
405 int ActualTimeStep = 0;
406
407 class vtkPrivate;
408 vtkPrivate* Internals;
409 friend class vtkPrivate;
410};
411
412VTK_ABI_NAMESPACE_END
413#endif // vtkCGNSReader_h
void DisableAllFamilies()
API to select families to read.
int GetNumberOfFaceArrays()
API to get information of face arrays and enable/disable loading of particular arrays.
friend class vtkPrivate
void Broadcast(vtkMultiProcessController *ctrl)
Sends metadata (that read from the input file, not settings modified through this API) from the rank ...
const char * GetPointArrayName(int index)
API to get information of point arrays and enable/disable loading of particular arrays.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void SetController(vtkMultiProcessController *c)
Set/get the communication object used to relay a list of files from the rank 0 process to all others.
void SetCacheMesh(bool enable)
This reader can cache the mesh points if they are time invariant.
int GetCurvilinearZone(int base, int zone, int cell_dim, int phys_dim, void *zsize, vtkMultiBlockDataSet *mbase)
~vtkCGNSReader() override
int GetCellArrayStatus(const char *name)
API to get information of cell arrays and enable/disable loading of particular arrays.
vtkMultiProcessController * Controller
int GetPointArrayStatus(const char *name)
API to get information of point arrays and enable/disable loading of particular arrays.
void EnableAllFaceArrays()
API to get information of face arrays and enable/disable loading of particular arrays.
int CanReadFile(const char *filename)
Is the given file name a CGNS file?
void DisableAllCellArrays()
API to get information of cell arrays and enable/disable loading of particular arrays.
void EnableAllFamilies()
API to select families to read.
void DisableAllPointArrays()
API to get information of point arrays and enable/disable loading of particular arrays.
const char * GetBaseArrayName(int index)
API to select bases to read.
int GetNumberOfPointArrays()
API to get information of point arrays and enable/disable loading of particular arrays.
vtkNew< vtkDataArraySelection > FaceDataArraySelection
void SetBaseArrayStatus(const char *name, int status)
API to select bases to read.
vtkIdType ProcSize
int ReadUserDefinedData(int zone, vtkMultiBlockDataSet *mbase)
Read "UserDefinedData_t" nodes in the given zone.
vtkDataArraySelection * GetBaseSelection()
Returns access to the base selection object.
const char * GetCellArrayName(int index)
API to get information of cell arrays and enable/disable loading of particular arrays.
int GetUnstructuredZone(int base, int zone, int cell_dim, int phys_dim, void *zsize, vtkMultiBlockDataSet *mbase)
vtkIdType ProcRank
static vtkCGNSReader * New()
void SetFaceArrayStatus(const char *name, int status)
API to get information of face arrays and enable/disable loading of particular arrays.
vtkDataArraySelection * GetFamilySelection()
Returns access to the family selection object.
void DisableAllBases()
API to select bases to read.
void SetCacheConnectivity(bool enable)
This reader can cache the mesh connectivities if they are time invariant.
int GetBaseArrayStatus(const char *name)
API to select bases to read.
void EnableAllCellArrays()
API to get information of cell arrays and enable/disable loading of particular arrays.
vtkGetCharFromStdStringMacro(FileName)
Specify file name of CGNS datafile to read.
int GetFamilyArrayStatus(const char *name)
API to select families to read.
vtkNew< vtkDataArraySelection > PointDataArraySelection
int GetNumberOfBaseArrays()
API to select bases to read.
void DisableAllFaceArrays()
API to get information of face arrays and enable/disable loading of particular arrays.
vtkNew< vtkDataArraySelection > CellDataArraySelection
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkSetStdStringFromCharMacro(FileName)
Specify file name of CGNS datafile to read.
void EnableAllPointArrays()
API to get information of point arrays and enable/disable loading of particular arrays.
void SetFamilyArrayStatus(const char *name, int status)
API to select families to read.
vtkNew< vtkDataArraySelection > BaseSelection
void SetCellArrayStatus(const char *name, int status)
API to get information of cell arrays and enable/disable loading of particular arrays.
int GetNumberOfFamilyArrays()
API to select families to read.
const char * GetFaceArrayName(int index)
API to get information of face arrays and enable/disable loading of particular arrays.
int GetFaceArrayStatus(const char *name)
API to get information of face arrays and enable/disable loading of particular arrays.
const char * GetFamilyArrayName(int index)
API to select families to read.
int GetNumberOfCellArrays()
API to get information of cell arrays and enable/disable loading of particular arrays.
void SetPointArrayStatus(const char *name, int status)
API to get information of point arrays and enable/disable loading of particular arrays.
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkInformationStringKey * FAMILY()
Key used to put a family name in the meta-data associated with a node.
void EnableAllBases()
API to select bases to read.
vtkNew< vtkDataArraySelection > FamilySelection
Store on/off settings for data arrays, etc.
a simple class to control print indentation
Definition vtkIndent.h:108
Key for string values in vtkInformation.
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Composite dataset that organizes datasets into blocks.
Multiprocessing communication superclass.
Allocate and hold a VTK object.
Definition vtkNew.h:168
This file defines functions used by vtkCGNSReader and vtkCGNSReaderInternal.
int vtkIdType
Definition vtkType.h:363
#define VTK_FILEPATH