VTK  9.7.1
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 
172 VTK_ABI_NAMESPACE_BEGIN
174 class vtkDataAssembly;
177 class vtkStringArray;
178 
179 class VTKIOIOSS_EXPORT vtkIOSSReader : public vtkReaderAlgorithm
180 {
181 public:
182  static vtkIOSSReader* New();
184  void PrintSelf(ostream& os, vtkIndent indent) override;
185 
187 
190  void AddFileName(VTK_FILEPATH const char* fname);
191  void ClearFileNames();
192  VTK_FILEPATH const char* GetFileName(int index) const;
193  int GetNumberOfFileNames() const;
195 
199  void SetFileName(VTK_FILEPATH const char* fname);
200 
202 
206  vtkSetStringMacro(DatabaseTypeOverride);
207  vtkGetStringMacro(DatabaseTypeOverride);
209 
211 
215  void SetCatalystConduitChannelName(const std::string& newString);
216  std::string GetCatalystConduitChannelName();
218 
220 
224  void SetDisplacementMagnitude(double magnitude);
225  double GetDisplacementMagnitude();
227 
229 
238  void SetGroupNumericVectorFieldComponents(bool value);
239  bool GetGroupNumericVectorFieldComponents();
240  vtkBooleanMacro(GroupNumericVectorFieldComponents, bool);
242 
244 
251  void SetGroupAlphabeticVectorFieldComponents(bool value);
252  bool GetGroupAlphabeticVectorFieldComponents();
253  vtkBooleanMacro(GroupAlphabeticVectorFieldComponents, bool);
255 
257 
260  void SetFieldSuffixSeparator(const char* value);
261  std::string GetFieldSuffixSeparator();
263 
265 
269  void SetScanForRelatedFiles(bool value);
270  vtkGetMacro(ScanForRelatedFiles, bool);
271  vtkBooleanMacro(ScanForRelatedFiles, bool);
273 
275 
288  vtkSetVector2Macro(FileRange, int);
289  vtkGetVector2Macro(FileRange, int);
290  vtkSetClampMacro(FileStride, int, 1, VTK_INT_MAX);
291  vtkGetMacro(FileStride, int);
293 
295 
300  void SetCaching(bool value);
301  vtkGetMacro(Caching, bool);
302  vtkBooleanMacro(Caching, bool);
304 
306 
311  void SetMergeExodusEntityBlocks(bool value);
312  vtkGetMacro(MergeExodusEntityBlocks, bool);
313  vtkBooleanMacro(MergeExodusEntityBlocks, bool);
315 
317 
327  void SetElementAndSideIds(bool value);
328  vtkGetMacro(ElementAndSideIds, bool);
329  vtkBooleanMacro(ElementAndSideIds, bool);
331 
333 
340  vtkSetMacro(GenerateFileId, bool);
341  vtkGetMacro(GenerateFileId, bool);
342  vtkBooleanMacro(GenerateFileId, bool);
344 
346 
350  vtkSetMacro(ReadIds, bool);
351  vtkGetMacro(ReadIds, bool);
352  vtkBooleanMacro(ReadIds, bool);
354 
356 
360  vtkSetMacro(IncludeGhostNodes, bool);
361  vtkGetMacro(IncludeGhostNodes, bool);
362  vtkBooleanMacro(IncludeGhostNodes, bool);
364 
366 
374  void SetRemoveUnusedPoints(bool);
375  vtkGetMacro(RemoveUnusedPoints, bool);
376  vtkBooleanMacro(RemoveUnusedPoints, bool);
378 
380 
384  vtkSetMacro(ApplyDisplacements, bool);
385  vtkGetMacro(ApplyDisplacements, bool);
386  vtkBooleanMacro(ApplyDisplacements, bool);
388 
390 
393  VTK_DEPRECATED_IN_9_6_0("Use vtkDataArraySelection* GetGlobalFieldSelection() instead")
394  virtual void SetReadGlobalFields(bool value);
395  VTK_DEPRECATED_IN_9_6_0("Use vtkDataArraySelection* GetGlobalFieldSelection() instead")
396  virtual bool GetReadGlobalFields();
397  VTK_DEPRECATED_IN_9_6_0("Use vtkDataArraySelection* GetGlobalFieldSelection() instead")
398  virtual void ReadGlobalFieldsOn();
399  VTK_DEPRECATED_IN_9_6_0("Use vtkDataArraySelection* GetGlobalFieldSelection() instead")
400  virtual void ReadGlobalFieldsOff();
402 
404 
414  void SetReadAllFilesToDetermineStructure(bool);
415  vtkGetMacro(ReadAllFilesToDetermineStructure, bool);
416  vtkBooleanMacro(ReadAllFilesToDetermineStructure, bool);
418 
420 
424  vtkSetMacro(ReadQAAndInformationRecords, bool);
425  vtkGetMacro(ReadQAAndInformationRecords, bool);
426  vtkBooleanMacro(ReadQAAndInformationRecords, bool);
428 
430 
441  void SetController(vtkMultiProcessController* controller);
442  vtkGetObjectMacro(Controller, vtkMultiProcessController);
444 
446 
452  void AddProperty(const char* name, int value);
453  void AddProperty(const char* name, double value);
454  void AddProperty(const char* name, void* value);
455  void AddProperty(const char* name, const char* value);
456  void RemoveProperty(const char* name);
457  void ClearProperties();
459 
461  {
462  NODEBLOCK = 0,
463  EDGEBLOCK = 1,
464  FACEBLOCK = 2,
465  ELEMENTBLOCK = 3,
466  STRUCTUREDBLOCK = 4,
467  NODESET = 5,
468  EDGESET = 6,
469  FACESET = 7,
470  ELEMENTSET = 8,
471  SIDESET = 9,
472  NUMBER_OF_ENTITY_TYPES = 10,
473 
474  BLOCK_START = NODEBLOCK,
475  BLOCK_END = NODESET,
476  SET_START = NODESET,
477  SET_END = NUMBER_OF_ENTITY_TYPES,
478  ENTITY_START = NODEBLOCK,
479  ENTITY_END = NUMBER_OF_ENTITY_TYPES,
480  };
481 
482  static bool GetEntityTypeIsBlock(int type) { return (type >= BLOCK_START && type < BLOCK_END); }
483  static bool GetEntityTypeIsSet(int type) { return (type >= SET_START && type < SET_END); }
484  static const char* GetDataAssemblyNodeNameForEntityType(int type);
485  static const char* GetMergedEntityNameForEntityType(int type);
486 
487  vtkDataArraySelection* GetEntitySelection(int type);
488  vtkDataArraySelection* GetNodeBlockSelection() { return this->GetEntitySelection(NODEBLOCK); }
489  vtkDataArraySelection* GetEdgeBlockSelection() { return this->GetEntitySelection(EDGEBLOCK); }
490  vtkDataArraySelection* GetFaceBlockSelection() { return this->GetEntitySelection(FACEBLOCK); }
492  {
493  return this->GetEntitySelection(ELEMENTBLOCK);
494  }
496  {
497  return this->GetEntitySelection(STRUCTUREDBLOCK);
498  }
499  vtkDataArraySelection* GetNodeSetSelection() { return this->GetEntitySelection(NODESET); }
500  vtkDataArraySelection* GetEdgeSetSelection() { return this->GetEntitySelection(EDGESET); }
501  vtkDataArraySelection* GetFaceSetSelection() { return this->GetEntitySelection(FACESET); }
502  vtkDataArraySelection* GetElementSetSelection() { return this->GetEntitySelection(ELEMENTSET); }
503  vtkDataArraySelection* GetSideSetSelection() { return this->GetEntitySelection(SIDESET); }
504 
505  vtkDataArraySelection* GetFieldSelection(int type);
506  vtkDataArraySelection* GetNodeBlockFieldSelection() { return this->GetFieldSelection(NODEBLOCK); }
507  vtkDataArraySelection* GetEdgeBlockFieldSelection() { return this->GetFieldSelection(EDGEBLOCK); }
508  vtkDataArraySelection* GetFaceBlockFieldSelection() { return this->GetFieldSelection(FACEBLOCK); }
510  {
511  return this->GetFieldSelection(ELEMENTBLOCK);
512  }
514  {
515  return this->GetFieldSelection(STRUCTUREDBLOCK);
516  }
517  vtkDataArraySelection* GetNodeSetFieldSelection() { return this->GetFieldSelection(NODESET); }
518  vtkDataArraySelection* GetEdgeSetFieldSelection() { return this->GetFieldSelection(EDGESET); }
519  vtkDataArraySelection* GetFaceSetFieldSelection() { return this->GetFieldSelection(FACESET); }
521  {
522  return this->GetFieldSelection(ELEMENTSET);
523  }
524  vtkDataArraySelection* GetSideSetFieldSelection() { return this->GetFieldSelection(SIDESET); }
525  vtkDataArraySelection* GetGlobalFieldSelection();
526 
527  void RemoveAllEntitySelections();
528  void RemoveAllFieldSelections();
530  {
531  this->RemoveAllEntitySelections();
532  this->RemoveAllFieldSelections();
533  }
534 
536 
541  const std::map<std::string, vtkTypeInt64>& GetEntityIdMap(int type) const;
542  const std::map<std::string, vtkTypeInt64>& GetNodeBlockIdMap() const
543  {
544  return this->GetEntityIdMap(NODEBLOCK);
545  }
546  const std::map<std::string, vtkTypeInt64>& GetEdgeBlockIdMap() const
547  {
548  return this->GetEntityIdMap(EDGEBLOCK);
549  }
550  const std::map<std::string, vtkTypeInt64>& GetFaceBlockIdMap() const
551  {
552  return this->GetEntityIdMap(FACEBLOCK);
553  }
554  const std::map<std::string, vtkTypeInt64>& GetElementBlockIdMap() const
555  {
556  return this->GetEntityIdMap(ELEMENTBLOCK);
557  }
558  const std::map<std::string, vtkTypeInt64>& GetStructuredBlockIdMap() const
559  {
560  return this->GetEntityIdMap(STRUCTUREDBLOCK);
561  }
562  const std::map<std::string, vtkTypeInt64>& GetNodeSetIdMap() const
563  {
564  return this->GetEntityIdMap(NODESET);
565  }
566  const std::map<std::string, vtkTypeInt64>& GetEdgeSetIdMap() const
567  {
568  return this->GetEntityIdMap(EDGESET);
569  }
570  const std::map<std::string, vtkTypeInt64>& GetFaceSetIdMap() const
571  {
572  return this->GetEntityIdMap(FACESET);
573  }
574  const std::map<std::string, vtkTypeInt64>& GetElementSetIdMap() const
575  {
576  return this->GetEntityIdMap(ELEMENTSET);
577  }
578  const std::map<std::string, vtkTypeInt64>& GetSideSetIdMap() const
579  {
580  return this->GetEntityIdMap(SIDESET);
581  }
583 
585 
590  vtkStringArray* GetEntityIdMapAsString(int type) const;
592  {
593  return this->GetEntityIdMapAsString(NODEBLOCK);
594  }
596  {
597  return this->GetEntityIdMapAsString(EDGEBLOCK);
598  }
600  {
601  return this->GetEntityIdMapAsString(FACEBLOCK);
602  }
604  {
605  return this->GetEntityIdMapAsString(ELEMENTBLOCK);
606  }
608  {
609  return this->GetEntityIdMapAsString(STRUCTUREDBLOCK);
610  }
611  vtkStringArray* GetNodeSetIdMapAsString() const { return this->GetEntityIdMapAsString(NODESET); }
612  vtkStringArray* GetEdgeSetIdMapAsString() const { return this->GetEntityIdMapAsString(EDGESET); }
613  vtkStringArray* GetFaceSetIdMapAsString() const { return this->GetEntityIdMapAsString(FACESET); }
615  {
616  return this->GetEntityIdMapAsString(ELEMENTSET);
617  }
618  vtkStringArray* GetSideSetIdMapAsString() const { return this->GetEntityIdMapAsString(SIDESET); }
620 
622 
633  vtkDataAssembly* GetAssembly();
635 
643  vtkGetMacro(AssemblyTag, int);
644 
646 
650  bool AddSelector(const char* selector);
651  void ClearSelectors();
652  void SetSelector(const char* selector);
654 
656 
659  int GetNumberOfSelectors() const;
660  const char* GetSelector(int index) const;
662 
664 
667  int ReadMetaData(vtkInformation* metadata) override;
668  int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
669  int ReadPoints(int, int, int, int, vtkDataObject*) override { return 1; }
670  int ReadArrays(int, int, int, int, vtkDataObject*) override { return 1; }
672 
676  vtkMTimeType GetMTime() override;
677 
681  static bool DoTestFilePatternMatching();
682 
687  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
688 
689  static vtkInformationIntegerKey* ENTITY_ID();
690 
691 protected:
692  friend class vtkIOSSReaderInternal;
693 
694  vtkIOSSReader();
695  ~vtkIOSSReader() override;
696 
697  // For use by vtkIOSSReaderInternal.
698  std::map<std::string, vtkTypeInt64>& GetEntityIdMap(int type);
699 
701 
702  static vtkInformationIntegerKey* ENTITY_TYPE();
703 
706 
707 private:
708  vtkIOSSReader(const vtkIOSSReader&) = delete;
709  void operator=(const vtkIOSSReader&) = delete;
710  vtkNew<vtkDataArraySelection> EntitySelection[NUMBER_OF_ENTITY_TYPES];
711  vtkNew<vtkDataArraySelection> EntityFieldSelection[NUMBER_OF_ENTITY_TYPES];
712  vtkNew<vtkDataArraySelection> GlobalFieldSelection;
713  std::map<std::string, vtkTypeInt64> EntityIdMap[NUMBER_OF_ENTITY_TYPES + 1];
714  vtkNew<vtkStringArray> EntityIdMapStrings[NUMBER_OF_ENTITY_TYPES + 1];
715 
716  vtkMultiProcessController* Controller;
717  bool Caching;
718  bool MergeExodusEntityBlocks;
719  bool ElementAndSideIds;
720  bool GenerateFileId;
721  bool ScanForRelatedFiles;
722  bool ReadIds;
723  bool RemoveUnusedPoints;
724  bool ApplyDisplacements;
725  bool ReadAllFilesToDetermineStructure;
726  bool ReadQAAndInformationRecords;
727  char* DatabaseTypeOverride;
728  int FileRange[2];
729  int FileStride;
730  bool IncludeGhostNodes;
731 };
732 
733 VTK_ABI_NAMESPACE_END
734 #endif
std::string GetFileName(const std::string &fileName) noexcept
Set the appropriate file name based on recognized user input.
static bool GetEntityTypeIsSet(int type)
Store vtkAlgorithm input/output information.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
bool GenerateFileId(vtkDataSetAttributes *cellData, vtkIdType numberOfCells, Ioss::GroupingEntity *group_entity, const DatabaseHandle &handle)
Adds 'file_id' array to indicate which file the dataset was read from.
vtkDataArraySelection * GetEdgeSetFieldSelection()
#define VTK_INT_MAX
Definition: vtkType.h:192
vtkDataArraySelection * GetElementSetSelection()
a vtkAbstractArray subclass for strings
vtkDataArraySelection * GetNodeBlockFieldSelection()
Internal methods and state for the IOSS reader.
vtkDataArraySelection * GetFaceSetSelection()
vtkDataArraySelection * GetFaceSetFieldSelection()
const std::map< std::string, vtkTypeInt64 > & GetElementSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkStringArray * GetFaceBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
vtkDataArraySelection * GetEdgeSetSelection()
vtkDataArraySelection * GetElementBlockSelection()
int vtkTypeBool
Definition: vtkABI.h:64
vtkDataArraySelection * GetNodeBlockSelection()
vtkDataArraySelection * GetNodeSetSelection()
vtkStringArray * GetElementBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
#define VTK_DEPRECATED_IN_9_6_0(reason)
vtkStringArray * GetSideSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
vtkDataArraySelection * GetSideSetFieldSelection()
virtual int FillOutputPortInformation(int port, vtkInformation *info)
Fill the output port information objects for this algorithm.
const std::map< std::string, vtkTypeInt64 > & GetFaceBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkStringArray * GetEdgeSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
Key for integer values in vtkInformation.
Store on/off settings for data arrays, etc.
vtkStringArray * GetFaceSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
virtual vtkMTimeType GetMTime()
Return this object's modified time.
vtkDataArraySelection * GetElementSetFieldSelection()
const std::map< std::string, vtkTypeInt64 > & GetSideSetIdMap() 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.
vtkDataArraySelection * GetEdgeBlockFieldSelection()
vtkStringArray * GetElementSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
vtkDataArraySelection * GetNodeSetFieldSelection()
int ReadArrays(int, int, int, int, vtkDataObject *) override
Implementation for vtkReaderAlgorithm API.
#define VTK_FILEPATH
vtkDataArraySelection * GetFaceBlockSelection()
virtual int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject *output)=0
Read the mesh (connectivity) for a given set of data partitioning, number of ghost levels and time st...
Reader for IOSS (Sierra IO System)
int ReadPoints(int, int, int, int, vtkDataObject *) override
Implementation for vtkReaderAlgorithm API.
vtkDataArraySelection * GetElementBlockFieldSelection()
vtkDataArraySelection * GetEdgeBlockSelection()
vtkIOSSReaderInternal * Internals
const std::map< std::string, vtkTypeInt64 > & GetEdgeBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkDataArraySelection * GetFaceBlockFieldSelection()
const std::map< std::string, vtkTypeInt64 > & GetEdgeSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
virtual int ReadMetaData(vtkInformation *metadata)=0
Provide meta-data for the pipeline.
Store zero or more vtkInformation instances.
static vtkAlgorithm * New()
const std::map< std::string, vtkTypeInt64 > & GetElementBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
static bool GetEntityTypeIsBlock(int type)
hierarchical representation to use with vtkPartitionedDataSetCollection
bool ApplyDisplacements(vtkPointSet *grid, Ioss::Region *region, Ioss::GroupingEntity *group_entity, const DatabaseHandle &handle, int timestep, bool mergeExodusEntityBlocks=false)
Reads node block array with displacements and then transforms the points in the grid using those disp...
vtkStringArray * GetStructuredBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
vtkDataArraySelection * GetSideSetSelection()
vtkStringArray * GetNodeBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
general representation of visualization data
Definition: vtkDataObject.h:55
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
const std::map< std::string, vtkTypeInt64 > & GetStructuredBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
const std::map< std::string, vtkTypeInt64 > & GetNodeSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Overridden to call appropriate handle pipeline request from executive.
vtkStringArray * GetEdgeBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
vtkDataArraySelection * GetStructuredBlockFieldSelection()
const std::map< std::string, vtkTypeInt64 > & GetFaceSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkDataArraySelection * GetStructuredBlockSelection()
Superclass for readers that implement a simplified API.
void RemoveAllSelections()
vtkStringArray * GetNodeSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
Multiprocessing communication superclass.