VTK  9.3.20240726
vtkERFReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3#ifndef vtkERFReader_h
4#define vtkERFReader_h
5
6#include "vtkIOERFModule.h" // For export macro
7#include "vtkNew.h" // For vtkNew
9#include "vtkSmartPointer.h" // For smart pointer
10
11#include <map> // for std::map
12#include <vector> // for std::vector
13
14VTK_ABI_NAMESPACE_BEGIN
15
16class vtkDataAssembly;
18class vtkIntArray;
20class vtkCellArray;
22
87{
88public:
89 static vtkERFReader* New();
91 void PrintSelf(ostream& os, vtkIndent indent) override;
92
93 typedef int64_t hid_t;
94
96
99 vtkSetMacro(FileName, std::string);
100 vtkGetMacro(FileName, std::string);
102
104
112
114
121
123
127 void SetVariablesStatus(const char* name, int status);
128 void SetStagesStatus(const char* name, int status);
129 void SetBlocksStatus(const char* name, int status);
131
135 std::string GetStage() const;
136
137protected:
139 ~vtkERFReader() override;
140
151 vtkInformationVector* outputVector) override;
152
162 vtkInformationVector* outputVector) override;
163
164private:
165 vtkERFReader(const vtkERFReader&) = delete;
166 void operator=(const vtkERFReader&) = delete;
167
174 bool IsValidERFDataset(const hid_t& fileId) const;
175
182 bool ExtractTemporalData(const hid_t& rootIdx);
183
187 void AddTemporalInformation(vtkInformation* info);
188
194 void AddTemporalInformationAsFieldData(vtkPartitionedDataSetCollection* pdc);
195
199 int TraverseStage(vtkPartitionedDataSetCollection* pdc);
200
204 void AppendConstantGroupData(vtkPartitionedDataSetCollection* pdc, hid_t fileId);
205
209 void AppendSinglestateGroupData(hid_t fileId);
210
212
215 void AppendMandatoryBlock(vtkPartitionedDataSetCollection* output, const hid_t& fileId);
216 void AppendSystemBlock(vtkPartitionedDataSetCollection* output, const hid_t& fileId);
217 void AppendERFHeaderBlock(vtkPartitionedDataSetCollection* output, const hid_t& fileId);
219
223 void AppendSinglestateBlock(const hid_t& fileId);
224
228 void AppendFieldDataByName(
229 vtkPartitionedDataSetCollection* pdc, const hid_t& id, const std::string& name);
230
232
235 void BuildMesh(const hid_t& fileId);
236 void AppendPoints(
237 vtkUnstructuredGrid* output, const std::string& nodeAttributePath, const hid_t& fileId);
238 void AppendCells(
239 vtkUnstructuredGrid* output, const std::string& shellAttributePath, const hid_t& fileId);
241
245 void AppendMeshs(vtkPartitionedDataSetCollection* pdc, vtkDataAssembly* hierarchy,
246 int& streamNodeId, int& meshNodeId, int& meshStartId);
247
251 int GetTimeValuesIndex();
252
254
257 std::string GetAttributeValueAsStr(const hid_t& erfIdx, const std::string& attributeName) const;
258 int GetAttributeValueAsInt(const hid_t& erfIdx, const std::string& attributeName) const;
260
262
277 bool IsCellSupported(int ndim, int npelem);
278 bool Is0DCellSupported(int npelem);
279 bool Is1DCellSupported(int npelem);
280 bool Is2DCellSupported(int npelem);
281 bool Is3DCellSupported(int npelem);
283
287 void FillCellsByType(vtkCellArray* cellArray, vtkUnsignedCharArray* cellType, hid_t shellDataType,
288 hid_t arrayId, vtkIntArray* entid, int numberOfDimensions, int numberOfIndicePerCell,
289 int numberOfCell);
290
292
295 void Fill0DCellType(vtkCellArray* cellArray, vtkUnsignedCharArray* cellTypes, vtkIntArray* entid,
296 const std::vector<int>& resData, int numberOfIndicePerCell, int numberOfCell);
297 void Fill1DCellType(vtkCellArray* cellArray, vtkUnsignedCharArray* cellTypes, vtkIntArray* entid,
298 const std::vector<int>& resData, int numberOfIndicePerCell, int numberOfCell);
299 void Fill2DCellType(vtkCellArray* cellArray, vtkUnsignedCharArray* cellTypes, vtkIntArray* entid,
300 const std::vector<int>& resData, int numberOfIndicePerCell, int numberOfCell);
301 void Fill3DCellType(vtkCellArray* cellArray, vtkUnsignedCharArray* cellTypes, vtkIntArray* entid,
302 const std::vector<int>& resData, int numberOfIndicePerCell, int numberOfCell);
304
305 std::string FileName;
306 std::string CurrentName;
307
308 vtkNew<vtkDataArraySelection> StagesSelection;
309 vtkNew<vtkDataArraySelection> VariablesSelection;
310 vtkNew<vtkDataArraySelection> BlocksSelection;
311 vtkNew<vtkDataArraySelection> ConstantGroupSelection;
312 vtkNew<vtkDataArraySelection> MultistateGroupSelection;
313 vtkNew<vtkDataArraySelection> SinglestateGroupSelection;
314
315 std::vector<int> States;
316 std::vector<double> TimeValues;
317 double TimeRanges[2] = { 0.0, 0.0 };
318 double CurrentTimeValue = 0.0;
319
320 std::map<std::string, vtkSmartPointer<vtkUnstructuredGrid>> MeshPoints;
321 std::map<std::string, vtkSmartPointer<vtkUnstructuredGrid>> Meshs;
322};
323
324VTK_ABI_NAMESPACE_END
325#endif
object to represent cell connectivity
Store on/off settings for data arrays, etc.
hierarchical representation to use with vtkPartitionedDataSetCollection
Read ERF-HDF5 files.
vtkGetNewMacro(BlocksSelection, vtkDataArraySelection)
Get the data array selections used to configure which data arrays are loaded by the reader.
std::string GetStage() const
Return the current stage.
vtkGetNewMacro(VariablesSelection, vtkDataArraySelection)
Get the data array selections used to configure which data arrays are loaded by the reader.
void SetVariablesStatus(const char *name, int status)
Get/Set whether the point or cell array with the given name is enabled.
void EnableAllBlocks()
Enable all arrays to be read.
int64_t hid_t
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkERFReader * New()
~vtkERFReader() override
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Standard method herited from the superclass.
void SetBlocksStatus(const char *name, int status)
Get/Set whether the point or cell array with the given name is enabled.
vtkGetNewMacro(StagesSelection, vtkDataArraySelection)
Get the data array selections used to configure which data arrays are loaded by the reader.
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Standard method herited from the superclass.
void EnableAllVariables()
Enable all arrays to be read.
void SetStagesStatus(const char *name, int status)
Get/Set whether the point or cell array with the given name is enabled.
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Allocate and hold a VTK object.
Definition vtkNew.h:160
Superclass for algorithms that produce vtkPartitionedDataSetCollectionAlgorithm.
Composite dataset that groups datasets as a collection.
dynamic, self-adjusting array of unsigned char
dataset represents arbitrary combinations of all possible cell types