VTK  9.2.20221001
vtkIOSSReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkIOSSReader.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*----------------------------------------------------------------------------
16  Copyright (c) Sandia Corporation
17  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
18 ----------------------------------------------------------------------------*/
19 
174 #ifndef vtkIOSSReader_h
175 #define vtkIOSSReader_h
176 
177 #include "vtkIOIOSSModule.h" // for export macros
178 #include "vtkNew.h" // for vtkNew
179 #include "vtkReaderAlgorithm.h"
180 
181 #include <map> // for std::map
182 
183 VTK_ABI_NAMESPACE_BEGIN
185 class vtkDataAssembly;
187 class vtkStringArray;
188 
189 class VTKIOIOSS_EXPORT vtkIOSSReader : public vtkReaderAlgorithm
190 {
191 public:
192  static vtkIOSSReader* New();
194  void PrintSelf(ostream& os, vtkIndent indent) override;
195 
197 
200  void AddFileName(VTK_FILEPATH const char* fname);
202  VTK_FILEPATH const char* GetFileName(int index) const;
203  int GetNumberOfFileNames() const;
205 
209  void SetFileName(VTK_FILEPATH const char* fname);
210 
212 
216  vtkSetStringMacro(DatabaseTypeOverride);
217  vtkGetStringMacro(DatabaseTypeOverride);
219 
221 
225  void SetDisplacementMagnitude(double magnitude);
228 
230 
242 
244 
247  void SetFieldSuffixSeparator(const char* value);
250 
252 
257  vtkGetMacro(ScanForRelatedFiles, bool);
258  vtkBooleanMacro(ScanForRelatedFiles, bool);
260 
262 
275  vtkSetVector2Macro(FileRange, int);
276  vtkGetVector2Macro(FileRange, int);
277  vtkSetClampMacro(FileStride, int, 1, VTK_INT_MAX);
278  vtkGetMacro(FileStride, int);
280 
282 
289  vtkSetMacro(GenerateFileId, bool);
290  vtkGetMacro(GenerateFileId, bool);
291  vtkBooleanMacro(GenerateFileId, bool);
293 
295 
299  vtkSetMacro(ReadIds, bool);
300  vtkGetMacro(ReadIds, bool);
301  vtkBooleanMacro(ReadIds, bool);
303 
305 
314  vtkGetMacro(RemoveUnusedPoints, bool);
315  vtkBooleanMacro(RemoveUnusedPoints, bool);
317 
319 
323  vtkSetMacro(ApplyDisplacements, bool);
324  vtkGetMacro(ApplyDisplacements, bool);
325  vtkBooleanMacro(ApplyDisplacements, bool);
327 
329 
332  vtkSetMacro(ReadGlobalFields, bool);
333  vtkGetMacro(ReadGlobalFields, bool);
334  vtkBooleanMacro(ReadGlobalFields, bool);
336 
338 
342  vtkSetMacro(ReadQAAndInformationRecords, bool);
343  vtkGetMacro(ReadQAAndInformationRecords, bool);
344  vtkBooleanMacro(ReadQAAndInformationRecords, bool);
346 
348 
360  vtkGetObjectMacro(Controller, vtkMultiProcessController);
362 
364 
370  void AddProperty(const char* name, int value);
371  void AddProperty(const char* name, double value);
372  void AddProperty(const char* name, void* value);
373  void AddProperty(const char* name, const char* value);
374  void RemoveProperty(const char* name);
377 
379  {
391 
392  BLOCK_START = NODEBLOCK,
393  BLOCK_END = NODESET,
394  SET_START = NODESET,
395  SET_END = NUMBER_OF_ENTITY_TYPES,
396  ENTITY_START = NODEBLOCK,
397  ENTITY_END = NUMBER_OF_ENTITY_TYPES,
398  };
399 
400  static bool GetEntityTypeIsBlock(int type) { return (type >= BLOCK_START && type < BLOCK_END); }
401  static bool GetEntityTypeIsSet(int type) { return (type >= SET_START && type < SET_END); }
403 
405  vtkDataArraySelection* GetNodeBlockSelection() { return this->GetEntitySelection(NODEBLOCK); }
406  vtkDataArraySelection* GetEdgeBlockSelection() { return this->GetEntitySelection(EDGEBLOCK); }
407  vtkDataArraySelection* GetFaceBlockSelection() { return this->GetEntitySelection(FACEBLOCK); }
409  {
410  return this->GetEntitySelection(ELEMENTBLOCK);
411  }
413  {
414  return this->GetEntitySelection(STRUCTUREDBLOCK);
415  }
416  vtkDataArraySelection* GetNodeSetSelection() { return this->GetEntitySelection(NODESET); }
417  vtkDataArraySelection* GetEdgeSetSelection() { return this->GetEntitySelection(EDGESET); }
418  vtkDataArraySelection* GetFaceSetSelection() { return this->GetEntitySelection(FACESET); }
419  vtkDataArraySelection* GetElementSetSelection() { return this->GetEntitySelection(ELEMENTSET); }
420  vtkDataArraySelection* GetSideSetSelection() { return this->GetEntitySelection(SIDESET); }
421 
423  vtkDataArraySelection* GetNodeBlockFieldSelection() { return this->GetFieldSelection(NODEBLOCK); }
424  vtkDataArraySelection* GetEdgeBlockFieldSelection() { return this->GetFieldSelection(EDGEBLOCK); }
425  vtkDataArraySelection* GetFaceBlockFieldSelection() { return this->GetFieldSelection(FACEBLOCK); }
427  {
428  return this->GetFieldSelection(ELEMENTBLOCK);
429  }
431  {
432  return this->GetFieldSelection(STRUCTUREDBLOCK);
433  }
434  vtkDataArraySelection* GetNodeSetFieldSelection() { return this->GetFieldSelection(NODESET); }
435  vtkDataArraySelection* GetEdgeSetFieldSelection() { return this->GetFieldSelection(EDGESET); }
436  vtkDataArraySelection* GetFaceSetFieldSelection() { return this->GetFieldSelection(FACESET); }
438  {
439  return this->GetFieldSelection(ELEMENTSET);
440  }
441  vtkDataArraySelection* GetSideSetFieldSelection() { return this->GetFieldSelection(SIDESET); }
442 
446  {
447  this->RemoveAllEntitySelections();
448  this->RemoveAllFieldSelections();
449  }
450 
452 
457  const std::map<std::string, vtkTypeInt64>& GetEntityIdMap(int type) const;
458  const std::map<std::string, vtkTypeInt64>& GetNodeBlockIdMap() const
459  {
460  return this->GetEntityIdMap(NODEBLOCK);
461  }
462  const std::map<std::string, vtkTypeInt64>& GetEdgeBlockIdMap() const
463  {
464  return this->GetEntityIdMap(EDGEBLOCK);
465  }
466  const std::map<std::string, vtkTypeInt64>& GetFaceBlockIdMap() const
467  {
468  return this->GetEntityIdMap(FACEBLOCK);
469  }
470  const std::map<std::string, vtkTypeInt64>& GetElementBlockIdMap() const
471  {
472  return this->GetEntityIdMap(ELEMENTBLOCK);
473  }
474  const std::map<std::string, vtkTypeInt64>& GetStructuredBlockIdMap() const
475  {
476  return this->GetEntityIdMap(STRUCTUREDBLOCK);
477  }
478  const std::map<std::string, vtkTypeInt64>& GetNodeSetIdMap() const
479  {
480  return this->GetEntityIdMap(NODESET);
481  }
482  const std::map<std::string, vtkTypeInt64>& GetEdgeSetIdMap() const
483  {
484  return this->GetEntityIdMap(EDGESET);
485  }
486  const std::map<std::string, vtkTypeInt64>& GetFaceSetIdMap() const
487  {
488  return this->GetEntityIdMap(FACESET);
489  }
490  const std::map<std::string, vtkTypeInt64>& GetElementSetIdMap() const
491  {
492  return this->GetEntityIdMap(ELEMENTSET);
493  }
494  const std::map<std::string, vtkTypeInt64>& GetSideSetIdMap() const
495  {
496  return this->GetEntityIdMap(SIDESET);
497  }
499 
501 
508  {
509  return this->GetEntityIdMapAsString(NODEBLOCK);
510  }
512  {
513  return this->GetEntityIdMapAsString(EDGEBLOCK);
514  }
516  {
517  return this->GetEntityIdMapAsString(FACEBLOCK);
518  }
520  {
521  return this->GetEntityIdMapAsString(ELEMENTBLOCK);
522  }
524  {
525  return this->GetEntityIdMapAsString(STRUCTUREDBLOCK);
526  }
527  vtkStringArray* GetNodeSetIdMapAsString() const { return this->GetEntityIdMapAsString(NODESET); }
528  vtkStringArray* GetEdgeSetIdMapAsString() const { return this->GetEntityIdMapAsString(EDGESET); }
529  vtkStringArray* GetFaceSetIdMapAsString() const { return this->GetEntityIdMapAsString(FACESET); }
531  {
532  return this->GetEntityIdMapAsString(ELEMENTSET);
533  }
534  vtkStringArray* GetSideSetIdMapAsString() const { return this->GetEntityIdMapAsString(SIDESET); }
536 
538 
551 
559  vtkGetMacro(AssemblyTag, int);
560 
562 
566  bool AddSelector(const char* selector);
568  void SetSelector(const char* selector);
570 
572 
575  int GetNumberOfSelectors() const;
576  const char* GetSelector(int index) const;
578 
580 
583  int ReadMetaData(vtkInformation* metadata) override;
584  int ReadMesh(int piece, int npieces, int nghosts, int timestep, vtkDataObject* output) override;
585  int ReadPoints(int, int, int, int, vtkDataObject*) override { return 1; }
586  int ReadArrays(int, int, int, int, vtkDataObject*) override { return 1; }
588 
592  vtkMTimeType GetMTime() override;
593 
598 
603  vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo) override;
604 
605 protected:
607  ~vtkIOSSReader() override;
608 
610 
611 private:
612  vtkIOSSReader(const vtkIOSSReader&) = delete;
613  void operator=(const vtkIOSSReader&) = delete;
614  vtkNew<vtkDataArraySelection> EntitySelection[NUMBER_OF_ENTITY_TYPES];
615  vtkNew<vtkDataArraySelection> EntityFieldSelection[NUMBER_OF_ENTITY_TYPES];
616  std::map<std::string, vtkTypeInt64> EntityIdMap[NUMBER_OF_ENTITY_TYPES + 1];
617  vtkNew<vtkStringArray> EntityIdMapStrings[NUMBER_OF_ENTITY_TYPES + 1];
618 
619  vtkMultiProcessController* Controller;
620  bool GenerateFileId;
621  bool ScanForRelatedFiles;
622  bool ReadIds;
623  bool RemoveUnusedPoints;
624  bool ApplyDisplacements;
625  bool ReadGlobalFields;
626  bool ReadQAAndInformationRecords;
627  char* DatabaseTypeOverride;
628  int AssemblyTag;
629  int FileRange[2];
630  int FileStride;
631 
632  class vtkInternals;
633  vtkInternals* Internals;
634 
635  static vtkInformationIntegerKey* ENTITY_TYPE();
636 };
637 
638 VTK_ABI_NAMESPACE_END
639 #endif
Store on/off settings for data arrays, etc.
hierarchical representation to use with vtkPartitionedDataSetCollection
general representation of visualization data
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()
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()
~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.
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:120
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:388
@ value
Definition: vtkX3D.h:232
@ port
Definition: vtkX3D.h:459
@ type
Definition: vtkX3D.h:528
@ name
Definition: vtkX3D.h:231
@ index
Definition: vtkX3D.h:258
@ string
Definition: vtkX3D.h:502
int vtkTypeBool
Definition: vtkABI.h:71
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:281
#define VTK_INT_MAX
Definition: vtkType.h:155
#define VTK_FILEPATH