VTK  9.7.20260724
vtkIOSSReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef vtkIOSSReader_h
6#define vtkIOSSReader_h
7
164
165#include "vtkIOIOSSModule.h" // for export macros
166#include "vtkNew.h" // for vtkNew
167#include "vtkReaderAlgorithm.h"
168
169#include <map> // for std::map
170
171VTK_ABI_NAMESPACE_BEGIN
173class vtkDataAssembly;
176class vtkStringArray;
177
178class VTKIOIOSS_EXPORT vtkIOSSReader : public vtkReaderAlgorithm
179{
180public:
183 void PrintSelf(ostream& os, vtkIndent indent) override;
184
186
189 void AddFileName(VTK_FILEPATH const char* fname);
191 VTK_FILEPATH const char* GetFileName(int index) const;
194
198 void SetFileName(VTK_FILEPATH const char* fname);
199
201
205 vtkSetStringMacro(DatabaseTypeOverride);
206 vtkGetStringMacro(DatabaseTypeOverride);
208
210
214 void SetCatalystConduitChannelName(const std::string& newString);
217
219
223 void SetDisplacementMagnitude(double magnitude);
226
228
239 vtkBooleanMacro(GroupNumericVectorFieldComponents, bool);
241
243
252 vtkBooleanMacro(GroupAlphabeticVectorFieldComponents, bool);
254
256
259 void SetFieldSuffixSeparator(const char* value);
262
264
268 void SetScanForRelatedFiles(bool value);
269 vtkGetMacro(ScanForRelatedFiles, bool);
270 vtkBooleanMacro(ScanForRelatedFiles, bool);
272
274
287 vtkSetVector2Macro(FileRange, int);
288 vtkGetVector2Macro(FileRange, int);
289 vtkSetClampMacro(FileStride, int, 1, VTK_INT_MAX);
290 vtkGetMacro(FileStride, int);
292
294
299 void SetCaching(bool value);
300 vtkGetMacro(Caching, bool);
301 vtkBooleanMacro(Caching, bool);
303
305
311 vtkGetMacro(MergeExodusEntityBlocks, bool);
312 vtkBooleanMacro(MergeExodusEntityBlocks, bool);
314
316
326 void SetElementAndSideIds(bool value);
327 vtkGetMacro(ElementAndSideIds, bool);
328 vtkBooleanMacro(ElementAndSideIds, bool);
330
332
339 vtkSetMacro(GenerateFileId, bool);
340 vtkGetMacro(GenerateFileId, bool);
341 vtkBooleanMacro(GenerateFileId, bool);
343
345
349 vtkSetMacro(ReadIds, bool);
350 vtkGetMacro(ReadIds, bool);
351 vtkBooleanMacro(ReadIds, bool);
353
355
359 vtkSetMacro(IncludeGhostNodes, bool);
360 vtkGetMacro(IncludeGhostNodes, bool);
361 vtkBooleanMacro(IncludeGhostNodes, bool);
363
365
374 vtkGetMacro(RemoveUnusedPoints, bool);
375 vtkBooleanMacro(RemoveUnusedPoints, bool);
377
379
383 vtkSetMacro(ApplyDisplacements, bool);
384 vtkGetMacro(ApplyDisplacements, bool);
385 vtkBooleanMacro(ApplyDisplacements, bool);
387
389
400 vtkGetMacro(ReadAllFilesToDetermineStructure, bool);
401 vtkBooleanMacro(ReadAllFilesToDetermineStructure, bool);
403
405
409 vtkSetMacro(ReadQAAndInformationRecords, bool);
410 vtkGetMacro(ReadQAAndInformationRecords, bool);
411 vtkBooleanMacro(ReadQAAndInformationRecords, bool);
413
415
427 vtkGetObjectMacro(Controller, vtkMultiProcessController);
429
431
437 void AddProperty(const char* name, int value);
438 void AddProperty(const char* name, double value);
439 void AddProperty(const char* name, void* value);
440 void AddProperty(const char* name, const char* value);
441 void RemoveProperty(const char* name);
444
466
467 static bool GetEntityTypeIsBlock(int type) { return (type >= BLOCK_START && type < BLOCK_END); }
468 static bool GetEntityTypeIsSet(int type) { return (type >= SET_START && type < SET_END); }
469 static const char* GetDataAssemblyNodeNameForEntityType(int type);
470 static const char* GetMergedEntityNameForEntityType(int type);
471
489
511
515 {
518 }
519
521
526 const std::map<std::string, vtkTypeInt64>& GetEntityIdMap(int type) const;
527 const std::map<std::string, vtkTypeInt64>& GetNodeBlockIdMap() const
528 {
529 return this->GetEntityIdMap(NODEBLOCK);
530 }
531 const std::map<std::string, vtkTypeInt64>& GetEdgeBlockIdMap() const
532 {
533 return this->GetEntityIdMap(EDGEBLOCK);
534 }
535 const std::map<std::string, vtkTypeInt64>& GetFaceBlockIdMap() const
536 {
537 return this->GetEntityIdMap(FACEBLOCK);
538 }
539 const std::map<std::string, vtkTypeInt64>& GetElementBlockIdMap() const
540 {
541 return this->GetEntityIdMap(ELEMENTBLOCK);
542 }
543 const std::map<std::string, vtkTypeInt64>& GetStructuredBlockIdMap() const
544 {
545 return this->GetEntityIdMap(STRUCTUREDBLOCK);
546 }
547 const std::map<std::string, vtkTypeInt64>& GetNodeSetIdMap() const
548 {
549 return this->GetEntityIdMap(NODESET);
550 }
551 const std::map<std::string, vtkTypeInt64>& GetEdgeSetIdMap() const
552 {
553 return this->GetEntityIdMap(EDGESET);
554 }
555 const std::map<std::string, vtkTypeInt64>& GetFaceSetIdMap() const
556 {
557 return this->GetEntityIdMap(FACESET);
558 }
559 const std::map<std::string, vtkTypeInt64>& GetElementSetIdMap() const
560 {
561 return this->GetEntityIdMap(ELEMENTSET);
562 }
563 const std::map<std::string, vtkTypeInt64>& GetSideSetIdMap() const
564 {
565 return this->GetEntityIdMap(SIDESET);
566 }
567
568
570
605
607
620
628 vtkGetMacro(AssemblyTag, int);
629
631
635 bool AddSelector(const char* selector);
637 void SetSelector(const char* selector);
639
641
645 const char* GetSelector(int index) const;
647
649
652 int ReadMetaData(vtkInformation* metadata) override;
653 int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
654 int ReadPoints(int, int, int, int, vtkDataObject*) override { return 1; }
655 int ReadArrays(int, int, int, int, vtkDataObject*) override { return 1; }
657
662
667
672 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
673
675
676protected:
678
680 ~vtkIOSSReader() override;
681
682 // For use by vtkIOSSReaderInternal.
683 std::map<std::string, vtkTypeInt64>& GetEntityIdMap(int type);
684
685 int FillOutputPortInformation(int port, vtkInformation* info) override;
686
688
691
692private:
693 vtkIOSSReader(const vtkIOSSReader&) = delete;
694 void operator=(const vtkIOSSReader&) = delete;
697 vtkNew<vtkDataArraySelection> GlobalFieldSelection;
698 std::map<std::string, vtkTypeInt64> EntityIdMap[NUMBER_OF_ENTITY_TYPES + 1];
699 vtkNew<vtkStringArray> EntityIdMapStrings[NUMBER_OF_ENTITY_TYPES + 1];
700
701 vtkMultiProcessController* Controller;
702 bool Caching;
703 bool MergeExodusEntityBlocks;
704 bool ElementAndSideIds;
705 bool GenerateFileId;
706 bool ScanForRelatedFiles;
707 bool ReadIds;
708 bool RemoveUnusedPoints;
709 bool ApplyDisplacements;
710 bool ReadAllFilesToDetermineStructure;
711 bool ReadQAAndInformationRecords;
712 char* DatabaseTypeOverride;
713 int FileRange[2];
714 int FileStride;
715 bool IncludeGhostNodes;
716};
717
718VTK_ABI_NAMESPACE_END
719#endif
Store on/off settings for data arrays, etc.
hierarchical representation to use with vtkPartitionedDataSetCollection
general representation of visualization data
Internal methods and state for the IOSS reader.
vtkStringArray * GetFaceSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
const std::map< std::string, vtkTypeInt64 > & GetFaceSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
void RemoveAllEntitySelections()
vtkDataArraySelection * GetFaceSetSelection()
vtkStringArray * GetElementBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
static const char * GetDataAssemblyNodeNameForEntityType(int type)
int GetNumberOfSelectors() const
API to access selectors.
int ReadArrays(int, int, int, int, vtkDataObject *) override
Implementation for vtkReaderAlgorithm API.
void RemoveAllFieldSelections()
void SetFileName(const char *fname)
Set a single filename.
void RemoveAllSelections()
void SetMergeExodusEntityBlocks(bool value)
When this flag is on, blocks/sets of exodus like types will be merged.
~vtkIOSSReader() override
vtkStringArray * GetEntityIdMapAsString(int type) const
This API is not really meant for public use and may change without notices.
int ReadPoints(int, int, int, int, vtkDataObject *) override
Implementation for vtkReaderAlgorithm API.
std::string GetFieldSuffixSeparator()
Set the character used to separate suffix from the field.
vtkDataArraySelection * GetSideSetFieldSelection()
vtkDataArraySelection * GetNodeBlockFieldSelection()
vtkDataArraySelection * GetEdgeSetFieldSelection()
vtkStringArray * GetStructuredBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
const std::map< std::string, vtkTypeInt64 > & GetEdgeSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkDataArraySelection * GetElementBlockSelection()
vtkStringArray * GetFaceBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
vtkDataArraySelection * GetEntitySelection(int type)
vtkStringArray * GetElementSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
void SetCatalystConduitChannelName(const std::string &newString)
Get/Set the IOSS Catalyst Conduit channel name when reading from IOSS Catalyst Conduit.
void ClearProperties()
IOSS databases support various properties that affect how the database is read.
void AddFileName(const char *fname)
API to set the filenames.
static vtkIOSSReader * New()
vtkDataArraySelection * GetFaceSetFieldSelection()
const std::map< std::string, vtkTypeInt64 > & GetElementBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkDataAssembly * GetAssembly()
Assemblies provide yet another way of selection blocks/sets to load, if available in the dataset.
vtkDataArraySelection * GetElementBlockFieldSelection()
vtkDataArraySelection * GetGlobalFieldSelection()
const std::map< std::string, vtkTypeInt64 > & GetSideSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
const std::map< std::string, vtkTypeInt64 > & GetEdgeBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
const std::map< std::string, vtkTypeInt64 > & GetNodeBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
static const char * GetMergedEntityNameForEntityType(int type)
static bool GetEntityTypeIsSet(int type)
const std::map< std::string, vtkTypeInt64 > & GetElementSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
void AddProperty(const char *name, int value)
IOSS databases support various properties that affect how the database is read.
vtkDataArraySelection * GetElementSetFieldSelection()
vtkDataArraySelection * GetEdgeBlockFieldSelection()
void SetFieldSuffixSeparator(const char *value)
Set the character used to separate suffix from the field.
static vtkInformationIntegerKey * ENTITY_TYPE()
void SetRemoveUnusedPoints(bool)
Node related data, including point coordinates, point field data etc.
vtkDataArraySelection * GetSideSetSelection()
vtkMTimeType GetMTime() override
Overridden to take into account mtimes for vtkDataArraySelection instances.
int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject *output) override
Implementation for vtkReaderAlgorithm API.
vtkDataArraySelection * GetFaceBlockSelection()
void SetCaching(bool value)
When this flag is on, caching of data across time-steps is enabled.
int ReadMetaData(vtkInformation *metadata) override
Implementation for vtkReaderAlgorithm API.
std::map< std::string, vtkTypeInt64 > & GetEntityIdMap(int type)
const char * GetSelector(int index) const
API to access selectors.
const char * GetFileName(int index) const
API to set the filenames.
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Overridden to release handles at the end of each pass.
void RemoveProperty(const char *name)
IOSS databases support various properties that affect how the database is read.
const std::map< std::string, vtkTypeInt64 > & GetEntityIdMap(int type) const
In IOSS entity blocks/sets may have unique ids.
vtkDataArraySelection * GetNodeBlockSelection()
vtkDataArraySelection * GetNodeSetFieldSelection()
vtkStringArray * GetNodeBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
void ClearFileNames()
API to set the filenames.
void AddProperty(const char *name, const char *value)
IOSS databases support various properties that affect how the database is read.
static bool GetEntityTypeIsBlock(int type)
void SetController(vtkMultiProcessController *controller)
Get/Set the controller to use when working in parallel.
vtkStringArray * GetEdgeSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
int GetNumberOfFileNames() const
API to set the filenames.
const std::map< std::string, vtkTypeInt64 > & GetNodeSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkDataArraySelection * GetStructuredBlockFieldSelection()
bool AddSelector(const char *selector)
API to specify selectors that indicate which branches on the assembly are chosen.
static vtkInformationIntegerKey * ENTITY_ID()
void SetElementAndSideIds(bool value)
When this flag is on and MergeExodusEntityBlocks is off, side sets of exodus data will be annotated w...
std::string GetCatalystConduitChannelName()
Get/Set the IOSS Catalyst Conduit channel name when reading from IOSS Catalyst Conduit.
bool GetGroupNumericVectorFieldComponents()
Set whether the reader should treat numeric suffixes for a vector field as vector components.
vtkDataArraySelection * GetNodeSetSelection()
void SetDisplacementMagnitude(double magnitude)
When displacements are being applied, they are scaled by this amount.
void SetScanForRelatedFiles(bool value)
When set to true, the reader can automatically locate and load additional files that are part of the ...
const std::map< std::string, vtkTypeInt64 > & GetStructuredBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkDataArraySelection * GetFieldSelection(int type)
vtkIOSSReaderInternal * Internals
double GetDisplacementMagnitude()
When displacements are being applied, they are scaled by this amount.
void AddProperty(const char *name, double value)
IOSS databases support various properties that affect how the database is read.
vtkDataArraySelection * GetFaceBlockFieldSelection()
vtkStringArray * GetSideSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
const std::map< std::string, vtkTypeInt64 > & GetFaceBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkStringArray * GetNodeSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
vtkDataArraySelection * GetEdgeBlockSelection()
vtkDataArraySelection * GetEdgeSetSelection()
void ClearSelectors()
API to specify selectors that indicate which branches on the assembly are chosen.
static bool DoTestFilePatternMatching()
Runs a bunch of tests for file pattern matching.
void AddProperty(const char *name, void *value)
IOSS databases support various properties that affect how the database is read.
friend class vtkIOSSReaderInternal
void SetGroupNumericVectorFieldComponents(bool value)
Set whether the reader should treat numeric suffixes for a vector field as vector components.
void SetSelector(const char *selector)
API to specify selectors that indicate which branches on the assembly are chosen.
bool GetGroupAlphabeticVectorFieldComponents()
Set whether the reader should recognize fields with suffixes such as X, Y, Z or x,...
vtkDataArraySelection * GetElementSetSelection()
vtkDataArraySelection * GetStructuredBlockSelection()
void SetReadAllFilesToDetermineStructure(bool)
When set to false (default), the reader will read only the first file to determine the structure,...
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
vtkStringArray * GetEdgeBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
void SetGroupAlphabeticVectorFieldComponents(bool value)
Set whether the reader should recognize fields with suffixes such as X, Y, Z or x,...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition vtkIndent.h:108
Key for integer values in vtkInformation.
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Multiprocessing communication superclass.
Allocate and hold a VTK object.
Definition vtkNew.h:168
a vtkAbstractArray subclass for strings
int vtkTypeBool
Definition vtkABI.h:64
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:318
#define VTK_INT_MAX
Definition vtkType.h:192
#define VTK_FILEPATH