VTK  9.5.20250804
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
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
50 {
51 CELL_DATA = 0,
52 FACE_DATA
53 };
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
96 vtkGetMacro(CellDataArraySelection, vtkDataArraySelection*);
97
101 vtkGetMacro(FaceDataArraySelection, vtkDataArraySelection*);
102
106 vtkGetMacro(PointDataArraySelection, vtkDataArraySelection*);
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
234 vtkSetMacro(CreateEachSolutionAsBlock, int);
235 vtkGetMacro(CreateEachSolutionAsBlock, int);
236 vtkBooleanMacro(CreateEachSolutionAsBlock, int);
238
240
253 vtkSetMacro(IgnoreFlowSolutionPointers, bool);
254 vtkGetMacro(IgnoreFlowSolutionPointers, bool);
255 vtkBooleanMacro(IgnoreFlowSolutionPointers, bool);
257
259
265 vtkSetMacro(UseUnsteadyPattern, bool);
266 vtkGetMacro(UseUnsteadyPattern, bool);
267 vtkBooleanMacro(UseUnsteadyPattern, bool);
269
271
276 vtkSetMacro(UnsteadySolutionStartTimestep, int);
277 vtkGetMacro(UnsteadySolutionStartTimestep, int);
279
281
286 vtkSetMacro(DistributeBlocks, bool);
287 vtkGetMacro(DistributeBlocks, bool);
288 vtkBooleanMacro(DistributeBlocks, bool);
290
292
298 void SetCacheMesh(bool enable);
299 vtkGetMacro(CacheMesh, bool);
300 vtkBooleanMacro(CacheMesh, bool);
302
304
310 void SetCacheConnectivity(bool enable);
311 vtkGetMacro(CacheConnectivity, bool);
312 vtkBooleanMacro(CacheConnectivity, bool);
314
316
322 vtkGetObjectMacro(Controller, vtkMultiProcessController);
324
330
335
336protected:
338 ~vtkCGNSReader() override;
339
340 int FillOutputPortInformation(int port, vtkInformation* info) override;
343
345 int base, int zone, int cell_dim, int phys_dim, void* zsize, vtkMultiBlockDataSet* mbase);
346
348 int base, int zone, int cell_dim, int phys_dim, void* zsize, vtkMultiBlockDataSet* mbase);
349
355
356 vtkMultiProcessController* Controller = nullptr;
357 vtkIdType ProcRank = 0;
358 vtkIdType ProcSize = 1;
359
362
366
367private:
368 vtkCGNSReader(const vtkCGNSReader&) = delete;
369 void operator=(const vtkCGNSReader&) = delete;
370
371 std::string FileName;
372 int DataLocation = vtkCGNSReader::CELL_DATA;
373 bool LoadBndPatch = false;
374 bool LoadSurfacePatch = false;
375 bool LoadMesh = true;
376 int DoublePrecisionMesh = 1;
377 int CreateEachSolutionAsBlock = 0;
378 bool IgnoreFlowSolutionPointers = false;
379 bool UseUnsteadyPattern = false;
380 bool DistributeBlocks = true;
381 bool CacheMesh = false;
382 bool CacheConnectivity = false;
383 bool Use3DVector = true;
384 int UnsteadySolutionStartTimestep = 0;
385
386 // For internal cgio calls (low level IO)
387 int cgioNum; // cgio file reference
388 double rootId; // id of root node
389 double currentZoneId; // id of node currently being read (zone)
390
391 unsigned int NumberOfBases = 0;
392 int ActualTimeStep = 0;
393
394 class vtkPrivate;
395 vtkPrivate* Internals;
396 friend class vtkPrivate;
397};
398
399VTK_ABI_NAMESPACE_END
400#endif // vtkCGNSReader_h
vtkCGNSReader creates a multi-block dataset and reads unstructured grids and structured meshes from b...
void DisableAllFamilies()
API to select families to read.
int GetNumberOfFaceArrays()
API to get information of face arrays and enable/disable loading of particular arrays.
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.
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.
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)
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.
Superclass for algorithms that produce only vtkMultiBlockDataSet as output.
Composite dataset that organizes datasets into blocks.
Multiprocessing communication superclass.
Allocate and hold a VTK object.
Definition vtkNew.h:167
This file defines functions used by vtkCGNSReader and vtkCGNSReaderInternal.
int vtkIdType
Definition vtkType.h:332
#define VTK_FILEPATH