VTK  9.5.20251110
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
165#include "vtkDeprecation.h" // for VTK_DEPRECATED_IN_9_6_0
166#include "vtkIOIOSSModule.h" // for export macros
167#include "vtkNew.h" // for vtkNew
168#include "vtkReaderAlgorithm.h"
169
170#include <map> // for std::map
171
172VTK_ABI_NAMESPACE_BEGIN
174class vtkDataAssembly;
177class vtkStringArray;
178
179class VTKIOIOSS_EXPORT vtkIOSSReader : public vtkReaderAlgorithm
180{
181public:
184 void PrintSelf(ostream& os, vtkIndent indent) override;
185
187
190 void AddFileName(VTK_FILEPATH const char* fname);
192 VTK_FILEPATH const char* GetFileName(int index) const;
195
199 void SetFileName(VTK_FILEPATH const char* fname);
200
202
206 vtkSetStringMacro(DatabaseTypeOverride);
207 vtkGetStringMacro(DatabaseTypeOverride);
209
211
215 void SetDisplacementMagnitude(double magnitude);
218
220
231 vtkBooleanMacro(GroupNumericVectorFieldComponents, bool);
233
235
244 vtkBooleanMacro(GroupAlphabeticVectorFieldComponents, bool);
246
248
251 void SetFieldSuffixSeparator(const char* value);
254
256
260 void SetScanForRelatedFiles(bool value);
261 vtkGetMacro(ScanForRelatedFiles, bool);
262 vtkBooleanMacro(ScanForRelatedFiles, bool);
264
266
279 vtkSetVector2Macro(FileRange, int);
280 vtkGetVector2Macro(FileRange, int);
281 vtkSetClampMacro(FileStride, int, 1, VTK_INT_MAX);
282 vtkGetMacro(FileStride, int);
284
286
291 void SetCaching(bool value);
292 vtkGetMacro(Caching, bool);
293 vtkBooleanMacro(Caching, bool);
295
297
303 vtkGetMacro(MergeExodusEntityBlocks, bool);
304 vtkBooleanMacro(MergeExodusEntityBlocks, bool);
306
308
318 void SetElementAndSideIds(bool value);
319 vtkGetMacro(ElementAndSideIds, bool);
320 vtkBooleanMacro(ElementAndSideIds, bool);
322
324
331 vtkSetMacro(GenerateFileId, bool);
332 vtkGetMacro(GenerateFileId, bool);
333 vtkBooleanMacro(GenerateFileId, bool);
335
337
341 vtkSetMacro(ReadIds, bool);
342 vtkGetMacro(ReadIds, bool);
343 vtkBooleanMacro(ReadIds, bool);
345
347
356 vtkGetMacro(RemoveUnusedPoints, bool);
357 vtkBooleanMacro(RemoveUnusedPoints, bool);
359
361
365 vtkSetMacro(ApplyDisplacements, bool);
366 vtkGetMacro(ApplyDisplacements, bool);
367 vtkBooleanMacro(ApplyDisplacements, bool);
369
371
374 VTK_DEPRECATED_IN_9_6_0("Use vtkDataArraySelection* GetGlobalFieldSelection() instead")
375 virtual void SetReadGlobalFields(bool value);
376 VTK_DEPRECATED_IN_9_6_0("Use vtkDataArraySelection* GetGlobalFieldSelection() instead")
377 virtual bool GetReadGlobalFields();
378 VTK_DEPRECATED_IN_9_6_0("Use vtkDataArraySelection* GetGlobalFieldSelection() instead")
379 virtual void ReadGlobalFieldsOn();
380 VTK_DEPRECATED_IN_9_6_0("Use vtkDataArraySelection* GetGlobalFieldSelection() instead")
381 virtual void ReadGlobalFieldsOff();
383
385
395 void SetReadAllFilesToDetermineStructure(bool);
396 vtkGetMacro(ReadAllFilesToDetermineStructure, bool);
397 vtkBooleanMacro(ReadAllFilesToDetermineStructure, bool);
399
401
405 vtkSetMacro(ReadQAAndInformationRecords, bool);
406 vtkGetMacro(ReadQAAndInformationRecords, bool);
407 vtkBooleanMacro(ReadQAAndInformationRecords, bool);
409
411
422 void SetController(vtkMultiProcessController* controller);
423 vtkGetObjectMacro(Controller, vtkMultiProcessController);
425
427
433 void AddProperty(const char* name, int value);
434 void AddProperty(const char* name, double value);
435 void AddProperty(const char* name, void* value);
436 void AddProperty(const char* name, const char* value);
437 void RemoveProperty(const char* name);
438 void ClearProperties();
440
442 {
443 NODEBLOCK = 0,
444 EDGEBLOCK = 1,
445 FACEBLOCK = 2,
446 ELEMENTBLOCK = 3,
447 STRUCTUREDBLOCK = 4,
448 NODESET = 5,
449 EDGESET = 6,
450 FACESET = 7,
451 ELEMENTSET = 8,
452 SIDESET = 9,
453 NUMBER_OF_ENTITY_TYPES = 10,
454
455 BLOCK_START = NODEBLOCK,
456 BLOCK_END = NODESET,
457 SET_START = NODESET,
458 SET_END = NUMBER_OF_ENTITY_TYPES,
459 ENTITY_START = NODEBLOCK,
460 ENTITY_END = NUMBER_OF_ENTITY_TYPES,
461 };
462
463 static bool GetEntityTypeIsBlock(int type) { return (type >= BLOCK_START && type < BLOCK_END); }
464 static bool GetEntityTypeIsSet(int type) { return (type >= SET_START && type < SET_END); }
465 static const char* GetDataAssemblyNodeNameForEntityType(int type);
466 static const char* GetMergedEntityNameForEntityType(int type);
467
469 vtkDataArraySelection* GetNodeBlockSelection() { return this->GetEntitySelection(NODEBLOCK); }
470 vtkDataArraySelection* GetEdgeBlockSelection() { return this->GetEntitySelection(EDGEBLOCK); }
471 vtkDataArraySelection* GetFaceBlockSelection() { return this->GetEntitySelection(FACEBLOCK); }
473 {
474 return this->GetEntitySelection(ELEMENTBLOCK);
475 }
477 {
478 return this->GetEntitySelection(STRUCTUREDBLOCK);
479 }
480 vtkDataArraySelection* GetNodeSetSelection() { return this->GetEntitySelection(NODESET); }
481 vtkDataArraySelection* GetEdgeSetSelection() { return this->GetEntitySelection(EDGESET); }
482 vtkDataArraySelection* GetFaceSetSelection() { return this->GetEntitySelection(FACESET); }
483 vtkDataArraySelection* GetElementSetSelection() { return this->GetEntitySelection(ELEMENTSET); }
484 vtkDataArraySelection* GetSideSetSelection() { return this->GetEntitySelection(SIDESET); }
485
487 vtkDataArraySelection* GetNodeBlockFieldSelection() { return this->GetFieldSelection(NODEBLOCK); }
488 vtkDataArraySelection* GetEdgeBlockFieldSelection() { return this->GetFieldSelection(EDGEBLOCK); }
489 vtkDataArraySelection* GetFaceBlockFieldSelection() { return this->GetFieldSelection(FACEBLOCK); }
491 {
492 return this->GetFieldSelection(ELEMENTBLOCK);
493 }
495 {
496 return this->GetFieldSelection(STRUCTUREDBLOCK);
497 }
498 vtkDataArraySelection* GetNodeSetFieldSelection() { return this->GetFieldSelection(NODESET); }
499 vtkDataArraySelection* GetEdgeSetFieldSelection() { return this->GetFieldSelection(EDGESET); }
500 vtkDataArraySelection* GetFaceSetFieldSelection() { return this->GetFieldSelection(FACESET); }
502 {
503 return this->GetFieldSelection(ELEMENTSET);
504 }
505 vtkDataArraySelection* GetSideSetFieldSelection() { return this->GetFieldSelection(SIDESET); }
507
511 {
512 this->RemoveAllEntitySelections();
513 this->RemoveAllFieldSelections();
514 }
515
517
522 const std::map<std::string, vtkTypeInt64>& GetEntityIdMap(int type) const;
523 const std::map<std::string, vtkTypeInt64>& GetNodeBlockIdMap() const
524 {
525 return this->GetEntityIdMap(NODEBLOCK);
526 }
527 const std::map<std::string, vtkTypeInt64>& GetEdgeBlockIdMap() const
528 {
529 return this->GetEntityIdMap(EDGEBLOCK);
530 }
531 const std::map<std::string, vtkTypeInt64>& GetFaceBlockIdMap() const
532 {
533 return this->GetEntityIdMap(FACEBLOCK);
534 }
535 const std::map<std::string, vtkTypeInt64>& GetElementBlockIdMap() const
536 {
537 return this->GetEntityIdMap(ELEMENTBLOCK);
538 }
539 const std::map<std::string, vtkTypeInt64>& GetStructuredBlockIdMap() const
540 {
541 return this->GetEntityIdMap(STRUCTUREDBLOCK);
542 }
543 const std::map<std::string, vtkTypeInt64>& GetNodeSetIdMap() const
544 {
545 return this->GetEntityIdMap(NODESET);
546 }
547 const std::map<std::string, vtkTypeInt64>& GetEdgeSetIdMap() const
548 {
549 return this->GetEntityIdMap(EDGESET);
550 }
551 const std::map<std::string, vtkTypeInt64>& GetFaceSetIdMap() const
552 {
553 return this->GetEntityIdMap(FACESET);
554 }
555 const std::map<std::string, vtkTypeInt64>& GetElementSetIdMap() const
556 {
557 return this->GetEntityIdMap(ELEMENTSET);
558 }
559 const std::map<std::string, vtkTypeInt64>& GetSideSetIdMap() const
560 {
561 return this->GetEntityIdMap(SIDESET);
562 }
564
566
573 {
574 return this->GetEntityIdMapAsString(NODEBLOCK);
575 }
577 {
578 return this->GetEntityIdMapAsString(EDGEBLOCK);
579 }
581 {
582 return this->GetEntityIdMapAsString(FACEBLOCK);
583 }
585 {
586 return this->GetEntityIdMapAsString(ELEMENTBLOCK);
587 }
589 {
590 return this->GetEntityIdMapAsString(STRUCTUREDBLOCK);
591 }
592 vtkStringArray* GetNodeSetIdMapAsString() const { return this->GetEntityIdMapAsString(NODESET); }
593 vtkStringArray* GetEdgeSetIdMapAsString() const { return this->GetEntityIdMapAsString(EDGESET); }
594 vtkStringArray* GetFaceSetIdMapAsString() const { return this->GetEntityIdMapAsString(FACESET); }
596 {
597 return this->GetEntityIdMapAsString(ELEMENTSET);
598 }
599 vtkStringArray* GetSideSetIdMapAsString() const { return this->GetEntityIdMapAsString(SIDESET); }
601
603
616
624 vtkGetMacro(AssemblyTag, int);
625
627
631 bool AddSelector(const char* selector);
633 void SetSelector(const char* selector);
635
637
641 const char* GetSelector(int index) const;
643
645
648 int ReadMetaData(vtkInformation* metadata) override;
649 int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
650 int ReadPoints(int, int, int, int, vtkDataObject*) override { return 1; }
651 int ReadArrays(int, int, int, int, vtkDataObject*) override { return 1; }
653
658
663
668 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
669
671
672protected:
674
676 ~vtkIOSSReader() override;
677
678 // For use by vtkIOSSReaderInternal.
679 std::map<std::string, vtkTypeInt64>& GetEntityIdMap(int type);
680
681 int FillOutputPortInformation(int port, vtkInformation* info) override;
682
684
687
688private:
689 vtkIOSSReader(const vtkIOSSReader&) = delete;
690 void operator=(const vtkIOSSReader&) = delete;
691 vtkNew<vtkDataArraySelection> EntitySelection[NUMBER_OF_ENTITY_TYPES];
692 vtkNew<vtkDataArraySelection> EntityFieldSelection[NUMBER_OF_ENTITY_TYPES];
693 vtkNew<vtkDataArraySelection> GlobalFieldSelection;
694 std::map<std::string, vtkTypeInt64> EntityIdMap[NUMBER_OF_ENTITY_TYPES + 1];
695 vtkNew<vtkStringArray> EntityIdMapStrings[NUMBER_OF_ENTITY_TYPES + 1];
696
697 vtkMultiProcessController* Controller;
698 bool Caching;
699 bool MergeExodusEntityBlocks;
700 bool ElementAndSideIds;
701 bool GenerateFileId;
702 bool ScanForRelatedFiles;
703 bool ReadIds;
704 bool RemoveUnusedPoints;
705 bool ApplyDisplacements;
706 bool ReadAllFilesToDetermineStructure;
707 bool ReadQAAndInformationRecords;
708 char* DatabaseTypeOverride;
709 int FileRange[2];
710 int FileStride;
711};
712
713VTK_ABI_NAMESPACE_END
714#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.
Reader for IOSS (Sierra IO System)
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 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.
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.
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.
static bool GetEntityTypeIsBlock(int type)
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...
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.
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 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()
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:167
Superclass for readers that implement a simplified API.
a vtkAbstractArray subclass for strings
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_DEPRECATED_IN_9_6_0(reason)
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:322
#define VTK_INT_MAX
Definition vtkType.h:196
#define VTK_FILEPATH