VTK  9.3.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 
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);
189  void ClearFileNames();
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);
214  double GetDisplacementMagnitude();
216 
218 
227  void SetGroupNumericVectorFieldComponents(bool value);
228  bool GetGroupNumericVectorFieldComponents();
230 
232 
235  void SetFieldSuffixSeparator(const char* value);
236  std::string GetFieldSuffixSeparator();
238 
240 
244  void SetScanForRelatedFiles(bool value);
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 
275  void SetMergeExodusEntityBlocks(bool value);
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 
312  void SetRemoveUnusedPoints(bool);
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 
345  void SetReadAllFilesToDetermineStructure(bool);
346  vtkGetMacro(ReadAllFilesToDetermineStructure, bool);
347  vtkBooleanMacro(ReadAllFilesToDetermineStructure, bool);
349 
351 
355  vtkSetMacro(ReadQAAndInformationRecords, bool);
356  vtkGetMacro(ReadQAAndInformationRecords, bool);
357  vtkBooleanMacro(ReadQAAndInformationRecords, bool);
359 
361 
372  void SetController(vtkMultiProcessController* controller);
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);
388  void ClearProperties();
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); }
415  static const char* GetDataAssemblyNodeNameForEntityType(int type);
416  static const char* GetMergedEntityNameForEntityType(int type);
417 
418  vtkDataArraySelection* GetEntitySelection(int type);
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 
436  vtkDataArraySelection* GetFieldSelection(int type);
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 
457  void RemoveAllEntitySelections();
458  void RemoveAllFieldSelections();
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 
520  vtkStringArray* GetEntityIdMapAsString(int type) const;
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 
563  vtkDataAssembly* GetAssembly();
565 
573  vtkGetMacro(AssemblyTag, int);
574 
576 
580  bool AddSelector(const char* selector);
581  void ClearSelectors();
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 
611  static bool DoTestFilePatternMatching();
612 
617  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
618 
619  static vtkInformationIntegerKey* ENTITY_ID();
620 
621 protected:
622  vtkIOSSReader();
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
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:270
vtkDataArraySelection * GetEdgeSetFieldSelection()
#define VTK_INT_MAX
Definition: vtkType.h:144
vtkDataArraySelection * GetElementSetSelection()
a vtkAbstractArray subclass for strings
vtkDataArraySelection * GetNodeBlockFieldSelection()
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.
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()
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
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:54
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.