VTK  9.4.20241118
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 <string> // for std::string
27
28namespace CGNSRead
29{
30VTK_ABI_NAMESPACE_BEGIN
31class vtkCGNSMetaData;
32VTK_ABI_NAMESPACE_END
33}
34
35VTK_ABI_NAMESPACE_BEGIN
39
40class VTKIOCGNSREADER_EXPORT vtkCGNSReader : public vtkMultiBlockDataSetAlgorithm
41{
42public:
43 static vtkCGNSReader* New();
45 void PrintSelf(ostream& os, vtkIndent indent) override;
46
48 {
49 CELL_DATA = 0,
50 FACE_DATA
51 };
52
54
64 vtkSetClampMacro(DataLocation, int, vtkCGNSReader::CELL_DATA, vtkCGNSReader::FACE_DATA);
65 vtkGetMacro(DataLocation, int);
67
69
75
79 int CanReadFile(VTK_FILEPATH const char* filename);
80
85
90
94 vtkGetMacro(CellDataArraySelection, vtkDataArraySelection*);
95
99 vtkGetMacro(FaceDataArraySelection, vtkDataArraySelection*);
100
104 vtkGetMacro(PointDataArraySelection, vtkDataArraySelection*);
105
107
113 int GetBaseArrayStatus(const char* name);
114 void SetBaseArrayStatus(const char* name, int status);
118 const char* GetBaseArrayName(int index);
120
122
127 const char* GetFamilyArrayName(int index);
128 void SetFamilyArrayStatus(const char* name, int status);
129 int GetFamilyArrayStatus(const char* name);
133
135
140 const char* GetPointArrayName(int index);
141 int GetPointArrayStatus(const char* name);
142 void SetPointArrayStatus(const char* name, int status);
146
148
153 const char* GetCellArrayName(int index);
154 int GetCellArrayStatus(const char* name);
155 void SetCellArrayStatus(const char* name, int status);
159
161
166 const char* GetFaceArrayName(int index);
167 int GetFaceArrayStatus(const char* name);
168 void SetFaceArrayStatus(const char* name, int status);
172
174
178 vtkSetMacro(DoublePrecisionMesh, int);
179 vtkGetMacro(DoublePrecisionMesh, int);
180 vtkBooleanMacro(DoublePrecisionMesh, int);
182
184
188 vtkSetMacro(LoadBndPatch, bool);
189 vtkGetMacro(LoadBndPatch, bool);
190 vtkBooleanMacro(LoadBndPatch, bool);
192
194
198 vtkSetMacro(LoadSurfacePatch, bool);
199 vtkGetMacro(LoadSurfacePatch, bool);
200 vtkBooleanMacro(LoadSurfacePatch, bool);
202
204
208 vtkSetMacro(LoadMesh, bool);
209 vtkGetMacro(LoadMesh, bool);
210 vtkBooleanMacro(LoadMesh, bool);
212
214
218 vtkSetMacro(Use3DVector, bool);
219 vtkGetMacro(Use3DVector, bool);
220 vtkBooleanMacro(Use3DVector, bool);
222
224
232 vtkSetMacro(CreateEachSolutionAsBlock, int);
233 vtkGetMacro(CreateEachSolutionAsBlock, int);
234 vtkBooleanMacro(CreateEachSolutionAsBlock, int);
236
238
251 vtkSetMacro(IgnoreFlowSolutionPointers, bool);
252 vtkGetMacro(IgnoreFlowSolutionPointers, bool);
253 vtkBooleanMacro(IgnoreFlowSolutionPointers, bool);
255
257
263 vtkSetMacro(UseUnsteadyPattern, bool);
264 vtkGetMacro(UseUnsteadyPattern, bool);
265 vtkBooleanMacro(UseUnsteadyPattern, bool);
267
269
274 vtkSetMacro(UnsteadySolutionStartTimestep, int);
275 vtkGetMacro(UnsteadySolutionStartTimestep, int);
277
279
284 vtkSetMacro(DistributeBlocks, bool);
285 vtkGetMacro(DistributeBlocks, bool);
286 vtkBooleanMacro(DistributeBlocks, bool);
288
290
296 void SetCacheMesh(bool enable);
297 vtkGetMacro(CacheMesh, bool);
298 vtkBooleanMacro(CacheMesh, bool);
300
302
308 void SetCacheConnectivity(bool enable);
309 vtkGetMacro(CacheConnectivity, bool);
310 vtkBooleanMacro(CacheConnectivity, bool);
312
314
320 vtkGetObjectMacro(Controller, vtkMultiProcessController);
322
328
333
334protected:
336 ~vtkCGNSReader() override;
337
338 int FillOutputPortInformation(int port, vtkInformation* info) override;
341
343 int base, int zone, int cell_dim, int phys_dim, void* zsize, vtkMultiBlockDataSet* mbase);
344
346 int base, int zone, int cell_dim, int phys_dim, void* zsize, vtkMultiBlockDataSet* mbase);
347
353
354 vtkMultiProcessController* Controller = nullptr;
355 vtkIdType ProcRank = 0;
356 vtkIdType ProcSize = 1;
357
360
364
365private:
366 vtkCGNSReader(const vtkCGNSReader&) = delete;
367 void operator=(const vtkCGNSReader&) = delete;
368
369 std::string FileName;
370 int DataLocation = vtkCGNSReader::CELL_DATA;
371 bool LoadBndPatch = false;
372 bool LoadSurfacePatch = false;
373 bool LoadMesh = true;
374 int DoublePrecisionMesh = 1;
375 int CreateEachSolutionAsBlock = 0;
376 bool IgnoreFlowSolutionPointers = false;
377 bool UseUnsteadyPattern = false;
378 bool DistributeBlocks = true;
379 bool CacheMesh = false;
380 bool CacheConnectivity = false;
381 bool Use3DVector = true;
382 int UnsteadySolutionStartTimestep = 0;
383
384 // For internal cgio calls (low level IO)
385 int cgioNum; // cgio file reference
386 double rootId; // id of root node
387 double currentZoneId; // id of node currently being read (zone)
388
389 unsigned int NumberOfBases = 0;
390 int ActualTimeStep = 0;
391
392 class vtkPrivate;
393 vtkPrivate* Internals;
394 friend class vtkPrivate;
395};
396
397VTK_ABI_NAMESPACE_END
398#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.
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 CanReadFile(VTK_FILEPATH const char *filename)
Is the given file name a CGNS file?
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:315
#define VTK_FILEPATH