VTK  9.2.5
vtkCGNSReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCGNSReader.h
5 
6  Copyright (c) Ken Martin, Will Schrodeder, 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  =========================================================================*/
15 // Copyright 2013-2014 Mickael Philit.
16 
32 #ifndef vtkCGNSReader_h
33 #define vtkCGNSReader_h
34 
35 #include "vtkIOCGNSReaderModule.h" // for export macro
37 #include "vtkNew.h" // for vtkNew.
38 
39 #include <string> // for std::string
40 
43 
44 namespace CGNSRead
45 {
46 class vtkCGNSMetaData;
47 }
48 
50 class VTKIOCGNSREADER_EXPORT vtkCGNSReader : public vtkMultiBlockDataSetAlgorithm
51 {
52 public:
53  static vtkCGNSReader* New();
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
58  {
59  CELL_DATA = 0,
60  FACE_DATA
61  };
62 
64 
74  vtkSetClampMacro(DataLocation, int, vtkCGNSReader::CELL_DATA, vtkCGNSReader::FACE_DATA);
75  vtkGetMacro(DataLocation, int);
77 
79 
85 
89  int CanReadFile(VTK_FILEPATH const char* filename);
90 
95 
100 
102 
108  int GetBaseArrayStatus(const char* name);
109  void SetBaseArrayStatus(const char* name, int status);
113  const char* GetBaseArrayName(int index);
115 
117 
122  const char* GetFamilyArrayName(int index);
123  void SetFamilyArrayStatus(const char* name, int status);
124  int GetFamilyArrayStatus(const char* name);
128 
130 
135  const char* GetPointArrayName(int index);
136  int GetPointArrayStatus(const char* name);
137  void SetPointArrayStatus(const char* name, int status);
141 
143 
148  const char* GetCellArrayName(int index);
149  int GetCellArrayStatus(const char* name);
150  void SetCellArrayStatus(const char* name, int status);
154 
156 
161  const char* GetFaceArrayName(int index);
162  int GetFaceArrayStatus(const char* name);
163  void SetFaceArrayStatus(const char* name, int status);
167 
168  vtkSetMacro(DoublePrecisionMesh, int);
169  vtkGetMacro(DoublePrecisionMesh, int);
170  vtkBooleanMacro(DoublePrecisionMesh, int);
171 
173 
177  vtkSetMacro(LoadBndPatch, bool);
178  vtkGetMacro(LoadBndPatch, bool);
179  vtkBooleanMacro(LoadBndPatch, bool);
181 
183 
187  vtkSetMacro(LoadMesh, bool);
188  vtkGetMacro(LoadMesh, bool);
189  vtkBooleanMacro(LoadMesh, bool);
191 
193 
196  vtkSetMacro(Use3DVector, bool);
197  vtkGetMacro(Use3DVector, bool);
198  vtkBooleanMacro(Use3DVector, bool);
200 
208  vtkSetMacro(CreateEachSolutionAsBlock, int);
209  vtkGetMacro(CreateEachSolutionAsBlock, int);
210  vtkBooleanMacro(CreateEachSolutionAsBlock, int);
211 
225  vtkSetMacro(IgnoreFlowSolutionPointers, bool);
226  vtkGetMacro(IgnoreFlowSolutionPointers, bool);
227  vtkBooleanMacro(IgnoreFlowSolutionPointers, bool);
228 
235  vtkSetMacro(UseUnsteadyPattern, bool);
236  vtkGetMacro(UseUnsteadyPattern, bool);
237  vtkBooleanMacro(UseUnsteadyPattern, bool);
238 
244  vtkSetMacro(DistributeBlocks, bool);
245  vtkGetMacro(DistributeBlocks, bool);
246  vtkBooleanMacro(DistributeBlocks, bool);
247 
249 
254  void SetCacheMesh(bool enable);
255  vtkGetMacro(CacheMesh, bool);
256  vtkBooleanMacro(CacheMesh, bool);
257 
259 
264  void SetCacheConnectivity(bool enable);
265  vtkGetMacro(CacheConnectivity, bool);
266  vtkBooleanMacro(CacheConnectivity, bool);
267 
269 
275  vtkGetObjectMacro(Controller, vtkMultiProcessController);
277 
283 
288 
289 protected:
291  ~vtkCGNSReader() override;
292 
296 
298  int base, int zone, int cell_dim, int phys_dim, void* zsize, vtkMultiBlockDataSet* mbase);
299 
301  int base, int zone, int cell_dim, int phys_dim, void* zsize, vtkMultiBlockDataSet* mbase);
302 
303  vtkMultiProcessController* Controller = nullptr;
304  vtkIdType ProcRank = 0;
305  vtkIdType ProcSize = 1;
306 
309 
313 
314 private:
315  vtkCGNSReader(const vtkCGNSReader&) = delete;
316  void operator=(const vtkCGNSReader&) = delete;
317 
318  std::string FileName = "";
319  int DataLocation = vtkCGNSReader::CELL_DATA;
320  bool LoadBndPatch = false; // option to set section loading for unstructured grid
321  bool LoadMesh = true; // option to enable/disable mesh loading
322  int DoublePrecisionMesh = 1; // option to set mesh loading to double precision
323  int CreateEachSolutionAsBlock = 0; // debug option to create
324  bool IgnoreFlowSolutionPointers = false;
325  bool UseUnsteadyPattern = false;
326  bool DistributeBlocks = true;
327  bool CacheMesh = false;
328  bool CacheConnectivity = false;
329  bool Use3DVector = true;
330 
331  // For internal cgio calls (low level IO)
332  int cgioNum; // cgio file reference
333  double rootId; // id of root node
334  double currentId; // id of node currently being read (zone)
335 
336  unsigned int NumberOfBases = 0;
337  int ActualTimeStep = 0;
338 
339  class vtkPrivate;
340  vtkPrivate* Internals;
341  friend class vtkPrivate;
342 };
343 
344 #endif // vtkCGNSReader_h
vtkCGNSReader creates a multi-block dataset and reads unstructured grids and structured meshes from b...
Definition: vtkCGNSReader.h:51
void DisableAllFamilies()
API to select families to read.
int GetNumberOfFaceArrays()
API to get information of face arrays and enable/disable loading of a particular arrays.
const char * GetBaseArrayName(int index)
API to select bases to read.
const char * GetFamilyArrayName(int index)
API to select families to read.
void Broadcast(vtkMultiProcessController *ctrl)
Sends metadata (that read from the input file, not settings modified through this API) from the rank ...
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.
static vtkCGNSReader * New()
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 a particular arrays.
int GetPointArrayStatus(const char *name)
API to get information of point arrays and enable/disable loading of a particular arrays.
void EnableAllFaceArrays()
API to get information of face arrays and enable/disable loading of a particular arrays.
void DisableAllCellArrays()
API to get information of cell arrays and enable/disable loading of a particular arrays.
void EnableAllFamilies()
API to select families to read.
void DisableAllPointArrays()
API to get information of point arrays and enable/disable loading of a particular arrays.
int GetNumberOfPointArrays()
API to get information of point arrays and enable/disable loading of a particular arrays.
vtkNew< vtkDataArraySelection > FaceDataArraySelection
void SetBaseArrayStatus(const char *name, int status)
API to select bases to read.
vtkDataArraySelection * GetFamilySelection()
Returns access to the family selection object.
int GetUnstructuredZone(int base, int zone, int cell_dim, int phys_dim, void *zsize, vtkMultiBlockDataSet *mbase)
const char * GetCellArrayName(int index)
API to get information of cell arrays and enable/disable loading of a particular arrays.
static vtkInformationStringKey * FAMILY()
Key used to put a family name in the meta-data associated with a node.
void SetFaceArrayStatus(const char *name, int status)
API to get information of face arrays and enable/disable loading of a particular arrays.
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 a 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 a 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 a particular arrays.
void SetFamilyArrayStatus(const char *name, int status)
API to select families to read.
const char * GetFaceArrayName(int index)
API to get information of face arrays and enable/disable loading of a particular arrays.
vtkNew< vtkDataArraySelection > BaseSelection
void SetCellArrayStatus(const char *name, int status)
API to get information of cell arrays and enable/disable loading of a particular arrays.
int GetNumberOfFamilyArrays()
API to select families to read.
int GetFaceArrayStatus(const char *name)
API to get information of face arrays and enable/disable loading of a particular arrays.
int GetNumberOfCellArrays()
API to get information of cell arrays and enable/disable loading of a particular arrays.
void SetPointArrayStatus(const char *name, int status)
API to get information of point arrays and enable/disable loading of a particular arrays.
vtkDataArraySelection * GetBaseSelection()
Returns access to the base selection object.
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.
void EnableAllBases()
API to select bases to read.
vtkNew< vtkDataArraySelection > FamilySelection
const char * GetPointArrayName(int index)
API to get information of point arrays and enable/disable loading of a particular arrays.
Store on/off settings for data arrays, etc.
a simple class to control print indentation
Definition: vtkIndent.h:119
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.
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252
@ string
Definition: vtkX3D.h:496
int vtkIdType
Definition: vtkType.h:332
#define VTK_FILEPATH