VTK  9.3.0
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 
162 #ifndef vtkIOSSReader_h
163 #define vtkIOSSReader_h
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 
171 VTK_ABI_NAMESPACE_BEGIN
173 class vtkDataAssembly;
175 class vtkStringArray;
176 
177 class VTKIOIOSS_EXPORT vtkIOSSReader : public vtkReaderAlgorithm
178 {
179 public:
180  static vtkIOSSReader* New();
182  void PrintSelf(ostream& os, vtkIndent indent) override;
183 
185 
188  void AddFileName(VTK_FILEPATH const char* fname);
190  VTK_FILEPATH const char* GetFileName(int index) const;
191  int GetNumberOfFileNames() const;
193 
197  void SetFileName(VTK_FILEPATH const char* fname);
198 
200 
204  vtkSetStringMacro(DatabaseTypeOverride);
205  vtkGetStringMacro(DatabaseTypeOverride);
207 
209 
213  void SetDisplacementMagnitude(double magnitude);
216 
218 
230 
232 
235  void SetFieldSuffixSeparator(const char* value);
238 
240 
245  vtkGetMacro(ScanForRelatedFiles, bool);
246  vtkBooleanMacro(ScanForRelatedFiles, bool);
248 
250 
263  vtkSetVector2Macro(FileRange, int);
264  vtkGetVector2Macro(FileRange, int);
265  vtkSetClampMacro(FileStride, int, 1, VTK_INT_MAX);
266  vtkGetMacro(FileStride, int);
268 
270 
276  vtkGetMacro(MergeExodusEntityBlocks, bool);
277  vtkBooleanMacro(MergeExodusEntityBlocks, bool);
279 
281 
288  vtkSetMacro(GenerateFileId, bool);
289  vtkGetMacro(GenerateFileId, bool);
290  vtkBooleanMacro(GenerateFileId, bool);
292 
294 
298  vtkSetMacro(ReadIds, bool);
299  vtkGetMacro(ReadIds, bool);
300  vtkBooleanMacro(ReadIds, bool);
302 
304 
313  vtkGetMacro(RemoveUnusedPoints, bool);
314  vtkBooleanMacro(RemoveUnusedPoints, bool);
316 
318 
322  vtkSetMacro(ApplyDisplacements, bool);
323  vtkGetMacro(ApplyDisplacements, bool);
324  vtkBooleanMacro(ApplyDisplacements, bool);
326 
328 
331  vtkSetMacro(ReadGlobalFields, bool);
332  vtkGetMacro(ReadGlobalFields, bool);
333  vtkBooleanMacro(ReadGlobalFields, bool);
335 
337 
346  vtkGetMacro(ReadAllFilesToDetermineStructure, bool);
347  vtkBooleanMacro(ReadAllFilesToDetermineStructure, bool);
349 
351 
355  vtkSetMacro(ReadQAAndInformationRecords, bool);
356  vtkGetMacro(ReadQAAndInformationRecords, bool);
357  vtkBooleanMacro(ReadQAAndInformationRecords, bool);
359 
361 
373  vtkGetObjectMacro(Controller, vtkMultiProcessController);
375 
377 
383  void AddProperty(const char* name, int value);
384  void AddProperty(const char* name, double value);
385  void AddProperty(const char* name, void* value);
386  void AddProperty(const char* name, const char* value);
387  void RemoveProperty(const char* name);
390 
392  {
404 
405  BLOCK_START = NODEBLOCK,
406  BLOCK_END = NODESET,
407  SET_START = NODESET,
408  SET_END = NUMBER_OF_ENTITY_TYPES,
409  ENTITY_START = NODEBLOCK,
410  ENTITY_END = NUMBER_OF_ENTITY_TYPES,
411  };
412 
413  static bool GetEntityTypeIsBlock(int type) { return (type >= BLOCK_START && type < BLOCK_END); }
414  static bool GetEntityTypeIsSet(int type) { return (type >= SET_START && type < SET_END); }
416  static const char* GetMergedEntityNameForEntityType(int type);
417 
419  vtkDataArraySelection* GetNodeBlockSelection() { return this->GetEntitySelection(NODEBLOCK); }
420  vtkDataArraySelection* GetEdgeBlockSelection() { return this->GetEntitySelection(EDGEBLOCK); }
421  vtkDataArraySelection* GetFaceBlockSelection() { return this->GetEntitySelection(FACEBLOCK); }
423  {
424  return this->GetEntitySelection(ELEMENTBLOCK);
425  }
427  {
428  return this->GetEntitySelection(STRUCTUREDBLOCK);
429  }
430  vtkDataArraySelection* GetNodeSetSelection() { return this->GetEntitySelection(NODESET); }
431  vtkDataArraySelection* GetEdgeSetSelection() { return this->GetEntitySelection(EDGESET); }
432  vtkDataArraySelection* GetFaceSetSelection() { return this->GetEntitySelection(FACESET); }
433  vtkDataArraySelection* GetElementSetSelection() { return this->GetEntitySelection(ELEMENTSET); }
434  vtkDataArraySelection* GetSideSetSelection() { return this->GetEntitySelection(SIDESET); }
435 
437  vtkDataArraySelection* GetNodeBlockFieldSelection() { return this->GetFieldSelection(NODEBLOCK); }
438  vtkDataArraySelection* GetEdgeBlockFieldSelection() { return this->GetFieldSelection(EDGEBLOCK); }
439  vtkDataArraySelection* GetFaceBlockFieldSelection() { return this->GetFieldSelection(FACEBLOCK); }
441  {
442  return this->GetFieldSelection(ELEMENTBLOCK);
443  }
445  {
446  return this->GetFieldSelection(STRUCTUREDBLOCK);
447  }
448  vtkDataArraySelection* GetNodeSetFieldSelection() { return this->GetFieldSelection(NODESET); }
449  vtkDataArraySelection* GetEdgeSetFieldSelection() { return this->GetFieldSelection(EDGESET); }
450  vtkDataArraySelection* GetFaceSetFieldSelection() { return this->GetFieldSelection(FACESET); }
452  {
453  return this->GetFieldSelection(ELEMENTSET);
454  }
455  vtkDataArraySelection* GetSideSetFieldSelection() { return this->GetFieldSelection(SIDESET); }
456 
460  {
461  this->RemoveAllEntitySelections();
462  this->RemoveAllFieldSelections();
463  }
464 
466 
471  const std::map<std::string, vtkTypeInt64>& GetEntityIdMap(int type) const;
472  const std::map<std::string, vtkTypeInt64>& GetNodeBlockIdMap() const
473  {
474  return this->GetEntityIdMap(NODEBLOCK);
475  }
476  const std::map<std::string, vtkTypeInt64>& GetEdgeBlockIdMap() const
477  {
478  return this->GetEntityIdMap(EDGEBLOCK);
479  }
480  const std::map<std::string, vtkTypeInt64>& GetFaceBlockIdMap() const
481  {
482  return this->GetEntityIdMap(FACEBLOCK);
483  }
484  const std::map<std::string, vtkTypeInt64>& GetElementBlockIdMap() const
485  {
486  return this->GetEntityIdMap(ELEMENTBLOCK);
487  }
488  const std::map<std::string, vtkTypeInt64>& GetStructuredBlockIdMap() const
489  {
490  return this->GetEntityIdMap(STRUCTUREDBLOCK);
491  }
492  const std::map<std::string, vtkTypeInt64>& GetNodeSetIdMap() const
493  {
494  return this->GetEntityIdMap(NODESET);
495  }
496  const std::map<std::string, vtkTypeInt64>& GetEdgeSetIdMap() const
497  {
498  return this->GetEntityIdMap(EDGESET);
499  }
500  const std::map<std::string, vtkTypeInt64>& GetFaceSetIdMap() const
501  {
502  return this->GetEntityIdMap(FACESET);
503  }
504  const std::map<std::string, vtkTypeInt64>& GetElementSetIdMap() const
505  {
506  return this->GetEntityIdMap(ELEMENTSET);
507  }
508  const std::map<std::string, vtkTypeInt64>& GetSideSetIdMap() const
509  {
510  return this->GetEntityIdMap(SIDESET);
511  }
513 
515 
522  {
523  return this->GetEntityIdMapAsString(NODEBLOCK);
524  }
526  {
527  return this->GetEntityIdMapAsString(EDGEBLOCK);
528  }
530  {
531  return this->GetEntityIdMapAsString(FACEBLOCK);
532  }
534  {
535  return this->GetEntityIdMapAsString(ELEMENTBLOCK);
536  }
538  {
539  return this->GetEntityIdMapAsString(STRUCTUREDBLOCK);
540  }
541  vtkStringArray* GetNodeSetIdMapAsString() const { return this->GetEntityIdMapAsString(NODESET); }
542  vtkStringArray* GetEdgeSetIdMapAsString() const { return this->GetEntityIdMapAsString(EDGESET); }
543  vtkStringArray* GetFaceSetIdMapAsString() const { return this->GetEntityIdMapAsString(FACESET); }
545  {
546  return this->GetEntityIdMapAsString(ELEMENTSET);
547  }
548  vtkStringArray* GetSideSetIdMapAsString() const { return this->GetEntityIdMapAsString(SIDESET); }
550 
552 
565 
573  vtkGetMacro(AssemblyTag, int);
574 
576 
580  bool AddSelector(const char* selector);
582  void SetSelector(const char* selector);
584 
586 
589  int GetNumberOfSelectors() const;
590  const char* GetSelector(int index) const;
592 
594 
597  int ReadMetaData(vtkInformation* metadata) override;
598  int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
599  int ReadPoints(int, int, int, int, vtkDataObject*) override { return 1; }
600  int ReadArrays(int, int, int, int, vtkDataObject*) override { return 1; }
602 
606  vtkMTimeType GetMTime() override;
607 
612 
617  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
618 
620 
621 protected:
623  ~vtkIOSSReader() override;
624 
626 
627 private:
628  vtkIOSSReader(const vtkIOSSReader&) = delete;
629  void operator=(const vtkIOSSReader&) = delete;
630  vtkNew<vtkDataArraySelection> EntitySelection[NUMBER_OF_ENTITY_TYPES];
631  vtkNew<vtkDataArraySelection> EntityFieldSelection[NUMBER_OF_ENTITY_TYPES];
632  std::map<std::string, vtkTypeInt64> EntityIdMap[NUMBER_OF_ENTITY_TYPES + 1];
633  vtkNew<vtkStringArray> EntityIdMapStrings[NUMBER_OF_ENTITY_TYPES + 1];
634 
635  vtkMultiProcessController* Controller;
636  bool MergeExodusEntityBlocks;
637  bool GenerateFileId;
638  bool ScanForRelatedFiles;
639  bool ReadIds;
640  bool RemoveUnusedPoints;
641  bool ApplyDisplacements;
642  bool ReadAllFilesToDetermineStructure;
643  bool ReadGlobalFields;
644  bool ReadQAAndInformationRecords;
645  char* DatabaseTypeOverride;
646  int AssemblyTag;
647  int FileRange[2];
648  int FileStride;
649 
650  class vtkInternals;
651  vtkInternals* Internals;
652 
653  static vtkInformationIntegerKey* ENTITY_TYPE();
654 };
655 
656 VTK_ABI_NAMESPACE_END
657 #endif
Store on/off settings for data arrays, etc.
hierarchical representation to use with vtkPartitionedDataSetCollection
general representation of visualization data
Definition: vtkDataObject.h:55
Reader for IOSS (Sierra IO System)
vtkStringArray * GetNodeBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
const std::map< std::string, vtkTypeInt64 > & GetSideSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkDataArraySelection * GetEdgeSetSelection()
void RemoveAllEntitySelections()
vtkDataArraySelection * GetEdgeBlockFieldSelection()
static vtkInformationIntegerKey * ENTITY_ID()
vtkDataArraySelection * GetNodeBlockFieldSelection()
const std::map< std::string, vtkTypeInt64 > & GetNodeSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
void AddFileName(VTK_FILEPATH const char *fname)
API to set the filenames.
int GetNumberOfSelectors() const
API to access selectors.
vtkStringArray * GetEdgeBlockIdMapAsString() 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.
void RemoveAllFieldSelections()
void RemoveAllSelections()
static const char * GetMergedEntityNameForEntityType(int type)
void SetMergeExodusEntityBlocks(bool value)
When this flag on blocks of entities of exodus data will be merged.
~vtkIOSSReader() override
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 * GetElementSetFieldSelection()
vtkDataArraySelection * GetEntitySelection(int type)
vtkDataArraySelection * GetSideSetFieldSelection()
void ClearProperties()
IOSS databases support various properties that affect how the database is read.
const std::map< std::string, vtkTypeInt64 > & GetEdgeBlockIdMap() 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 * GetElementSetSelection()
const std::map< std::string, vtkTypeInt64 > & GetEdgeSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
vtkDataArraySelection * GetFieldSelection(int type)
static const char * GetDataAssemblyNodeNameForEntityType(int type)
vtkDataArraySelection * GetFaceSetFieldSelection()
vtkDataArraySelection * GetFaceBlockSelection()
vtkDataArraySelection * GetStructuredBlockFieldSelection()
vtkStringArray * GetSideSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
vtkStringArray * GetElementBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
vtkDataArraySelection * GetFaceBlockFieldSelection()
vtkStringArray * GetEdgeSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
static bool GetEntityTypeIsSet(int type)
void AddProperty(const char *name, int value)
IOSS databases support various properties that affect how the database is read.
vtkDataArraySelection * GetEdgeSetFieldSelection()
const std::map< std::string, vtkTypeInt64 > & GetElementBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
void SetFieldSuffixSeparator(const char *value)
Set the character used to separate suffix from the field.
vtkStringArray * GetNodeSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
vtkDataArraySelection * GetStructuredBlockSelection()
void SetRemoveUnusedPoints(bool)
Node related data, including point coordinates, point field data etc.
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.
int ReadMetaData(vtkInformation *metadata) override
Implementation for vtkReaderAlgorithm API.
vtkDataArraySelection * GetElementBlockSelection()
vtkStringArray * GetElementSetIdMapAsString() const
This API is not really meant for public use and may change without notices.
const char * GetSelector(int index) const
API to access selectors.
const std::map< std::string, vtkTypeInt64 > & GetStructuredBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
void SetFileName(VTK_FILEPATH const char *fname)
Set a single filename.
vtkDataArraySelection * GetNodeBlockSelection()
vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo) override
Overridden to release handles at the end of each pass.
vtkStringArray * GetEntityIdMapAsString(int type) const
This API is not really meant for public use and may change without notices.
vtkStringArray * GetStructuredBlockIdMapAsString() const
This API is not really meant for public use and may change without notices.
void RemoveProperty(const char *name)
IOSS databases support various properties that affect how the database is read.
vtkStringArray * GetFaceSetIdMapAsString() 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.
vtkDataArraySelection * GetElementBlockFieldSelection()
static bool GetEntityTypeIsBlock(int type)
void SetController(vtkMultiProcessController *controller)
Get/Set the controller to use when working in parallel.
int GetNumberOfFileNames() const
API to set the filenames.
vtkDataArraySelection * GetFaceSetSelection()
bool AddSelector(const char *selector)
API to specify selectors that indicate which branches on the assembly are chosen.
static vtkIOSSReader * New()
bool GetGroupNumericVectorFieldComponents()
Set whether the reader should treat numeric suffixes for a vector field as vector components.
void SetDisplacementMagnitude(double magnitude)
When displacements are being applied, they are scaled by this amount.
vtkDataArraySelection * GetSideSetSelection()
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 > & GetFaceSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
const std::map< std::string, vtkTypeInt64 > & GetElementSetIdMap() const
In IOSS entity blocks/sets may have unique ids.
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.
VTK_FILEPATH const char * GetFileName(int index) const
API to set the filenames.
vtkDataArraySelection * GetNodeSetSelection()
vtkDataArraySelection * GetEdgeBlockSelection()
vtkDataAssembly * GetAssembly()
Assemblies provide yet another way of selection blocks/sets to load, if available in the dataset.
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.
const std::map< std::string, vtkTypeInt64 > & GetNodeBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
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.
const std::map< std::string, vtkTypeInt64 > & GetFaceBlockIdMap() const
In IOSS entity blocks/sets may have unique ids.
void SetReadAllFilesToDetermineStructure(bool)
When set to true (default), the reader will read all files to determine structure of the dataset beca...
int FillOutputPortInformation(int port, vtkInformation *info) override
Fill the output port information objects for this algorithm.
const std::map< std::string, vtkTypeInt64 > & GetEntityIdMap(int type) const
In IOSS entity blocks/sets may have unique ids.
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:29
Key for integer values in vtkInformation.
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Multiprocessing communication superclass.
Superclass for readers that implement a simplified API.
a vtkAbstractArray subclass for strings
@ info
Definition: vtkX3D.h:376
@ value
Definition: vtkX3D.h:220
@ port
Definition: vtkX3D.h:447
@ type
Definition: vtkX3D.h:516
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
@ string
Definition: vtkX3D.h:490
int vtkTypeBool
Definition: vtkABI.h:64
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270
#define VTK_INT_MAX
Definition: vtkType.h:144
#define VTK_FILEPATH