VTK
vtkExodusIIReaderPrivate.h
Go to the documentation of this file.
1 #ifndef vtkExodusIIReaderPrivate_h
2 #define vtkExodusIIReaderPrivate_h
3 
4 // Do not include this file directly. It is only for use
5 // from inside the ExodusII reader and its descendants.
6 
7 #include "vtkToolkits.h" // make sure VTK_USE_PARALLEL is properly set
8 #include "vtkExodusIICache.h"
9 #include "vtksys/RegularExpression.hxx"
10 
11 #include <map>
12 #include <vector>
13 
14 #include "vtk_exodusII.h"
15 #include "vtkIOExodusModule.h" // For export macro
18 
22 class VTKIOEXODUS_EXPORT vtkExodusIIReaderPrivate : public vtkObject
23 {
24 public:
25  static vtkExodusIIReaderPrivate* New();
26  void PrintData( ostream& os, vtkIndent indent );
28  //virtual void Modified();
29 
31  int OpenFile( const char* filename );
32 
34  int CloseFile();
35 
37  int RequestInformation();
38 
41  { return this->SIL; }
42 
44  int RequestData( vtkIdType timeStep, vtkMultiBlockDataSet* output );
45 
50  int SetUpEmptyGrid( vtkMultiBlockDataSet* output );
51 
63  void Reset();
64 
69  void ResetSettings();
70 
72  void ResetCache();
73 
75  void SetCacheSize(double size);
76 
78  vtkGetMacro(CacheSize, double);
79 
84  int GetNumberOfTimeSteps() { return (int) this->Times.size(); }
85 
86 
89  vtkGetMacro(SqueezePoints,int);
90 
93  void SetSqueezePoints( int sp );
94 
97  vtkBooleanMacro(SqueezePoints,int);
98 
100  int GetNumberOfNodes();
101 
106  int GetNumberOfObjectsOfType( int otype );
107 
118  int GetNumberOfObjectArraysOfType( int otype );
119 
124  const char* GetObjectName( int otype, int i );
125 
130  int GetObjectId( int otype, int i );
131 
138  int GetObjectSize( int otype, int i );
139 
144  int GetObjectStatus( int otype, int i );
145 
151  int GetUnsortedObjectStatus( int otype, int i );
152 
157  void SetObjectStatus( int otype, int i, int stat );
158 
164  void SetUnsortedObjectStatus( int otype, int i, int stat );
165 
170  const char* GetObjectArrayName( int otype, int i );
171 
176  int GetNumberOfObjectArrayComponents( int otype, int i );
177 
182  int GetObjectArrayStatus( int otype, int i );
183 
188  void SetObjectArrayStatus( int otype, int i, int stat );
189 
196  int GetNumberOfObjectAttributes( int objectType, int objectIndex );
197  const char* GetObjectAttributeName( int objectType,
198  int objectIndex,
199  int attributeIndex );
200  int GetObjectAttributeIndex( int objectType,
201  int objectIndex,
202  const char* attribName );
203  int GetObjectAttributeStatus( int objectType,
204  int objectIndex,
205  int attribIndex );
206  void SetObjectAttributeStatus( int objectType,
207  int objectIndex,
208  int attribIndex, int status );
209 
211  vtkGetMacro(GenerateObjectIdArray,int);
212  vtkSetMacro(GenerateObjectIdArray,int);
213  static const char* GetObjectIdArrayName() { return "ObjectId"; }
214 
215  vtkSetMacro(GenerateGlobalElementIdArray,int);
216  vtkGetMacro(GenerateGlobalElementIdArray,int);
217  static const char* GetGlobalElementIdArrayName() { return "GlobalElementId"; }
218 
219  vtkSetMacro(GenerateGlobalNodeIdArray,int);
220  vtkGetMacro(GenerateGlobalNodeIdArray,int);
221  static const char* GetGlobalNodeIdArrayName() { return "GlobalNodeId"; }
222 
223  vtkSetMacro(GenerateImplicitElementIdArray,int);
224  vtkGetMacro(GenerateImplicitElementIdArray,int);
225  static const char* GetImplicitElementIdArrayName() { return "ImplicitElementId"; }
226 
227  vtkSetMacro(GenerateImplicitNodeIdArray,int);
228  vtkGetMacro(GenerateImplicitNodeIdArray,int);
229  static const char* GetImplicitNodeIdArrayName() { return "ImplicitNodeId"; }
230 
234  vtkSetMacro(GenerateFileIdArray,int);
235  vtkGetMacro(GenerateFileIdArray,int);
236  static const char* GetFileIdArrayName() { return "FileId"; }
237 
239  vtkSetMacro(FileId,int);
240  vtkGetMacro(FileId,int);
241 
242  static const char *GetGlobalVariableValuesArrayName()
243  { return "GlobalVariableValues"; }
244  static const char *GetGlobalVariableNamesArrayName()
245  { return "GlobalVariableNames"; }
246 
247  virtual void SetApplyDisplacements( int d );
248  vtkGetMacro(ApplyDisplacements,int);
249 
250  virtual void SetDisplacementMagnitude( double s );
251  vtkGetMacro(DisplacementMagnitude,double);
252 
253  vtkSetMacro(HasModeShapes,int);
254  vtkGetMacro(HasModeShapes,int);
255 
256  vtkSetMacro(ModeShapeTime,double);
257  vtkGetMacro(ModeShapeTime,double);
258 
259  vtkSetMacro(AnimateModeShapes, int);
260  vtkGetMacro(AnimateModeShapes, int);
261 
262  vtkDataArray* FindDisplacementVectors( int timeStep );
263 
264  const struct ex_init_params* GetModelParams() const
265  { return &this->ModelParameters; }
266 
268  struct VTKIOEXODUS_EXPORT ArrayInfoType {
279  int GlomType;
284  int Source;
286  int Status;
289  std::vector<vtkStdString> OriginalNames;
292  std::vector<int> OriginalIndices;
301  std::vector<int> ObjectTruth;
303  void Reset();
304  };
305 
307  struct VTKIOEXODUS_EXPORT ObjectInfoType {
309  int Size;
311  int Status;
313  int Id;
316  };
317 
319  struct VTKIOEXODUS_EXPORT MapInfoType : public ObjectInfoType {
320  };
321 
324  struct VTKIOEXODUS_EXPORT BlockSetInfoType : public ObjectInfoType {
331  std::map<vtkIdType,vtkIdType> PointMap;
336  std::map<vtkIdType,vtkIdType> ReversePointMap;
343 
344  BlockSetInfoType(){this->CachedConnectivity=0;}
345  BlockSetInfoType(const BlockSetInfoType& block);
346  ~BlockSetInfoType();
347  BlockSetInfoType& operator=(const BlockSetInfoType& block);
348  };
349 
351  struct VTKIOEXODUS_EXPORT BlockInfoType : public BlockSetInfoType {
352  vtkStdString OriginalName; // useful to reset the name if XML metadata is invalid.
354  // number of boundaries per entry
355  // The index is the dimensionality of the entry. 0=node, 1=edge, 2=face
356  int BdsPerEntry[3];
358  std::vector<vtkStdString> AttributeNames;
359  std::vector<int> AttributeStatus;
360  // VTK cell type (a function of TypeName and BdsPerEntry...)
361  int CellType;
362  // Number of points per cell as used by VTK
363  // -- not what's in the file (i.e., BdsPerEntry[0] >= PointsPerCell)
365  };
366 
368  struct PartInfoType : public ObjectInfoType {
369  std::vector<int> BlockIndices;
370  };
372  std::vector<int> BlockIndices;
373  };
375  std::vector<int> BlockIndices;
376  };
377 
379  struct SetInfoType : public BlockSetInfoType {
380  int DistFact; // Number of distribution factors
381  // (for the entire block, not per array or entry)
382  };
383 
386  enum GlomTypes {
387  Scalar=0,
388  Vector2=1,
389  Vector3=2,
390  SymmetricTensor=3,
391  // (order xx, yy, zz, xy, yz, zx)
392  IntegrationPoint=4
393  };
394 
397  Result=0,
398  // (that vary over time)
399  Attribute=1,
400  // (constants over time)
401  Map=2,
402  Generated=3
403  };
404 
407 
408  friend class vtkExodusIIReader;
409  friend class vtkPExodusIIReader;
410 
411  virtual void SetParser( vtkExodusIIReaderParser* );
412  vtkGetObjectMacro(Parser,vtkExodusIIReaderParser);
413 
414  // BUG #15632: This method allows vtkPExodusIIReader to pass time information
415  // from one spatial file to another and avoiding have to read it for each of
416  // the files.
417  void SetTimesOverrides(const std::vector<double>& times)
418  {
419  this->Times = times;
420  this->SkipUpdateTimeInformation = true;
421  }
422 
423  // Because Parts, Materials, and assemblies are not stored as arrays,
424  // but rather as maps to the element blocks they make up,
425  // we cannot use the Get|SetObject__() methods directly.
426 
427  int GetNumberOfParts();
428  const char* GetPartName(int idx);
429  const char* GetPartBlockInfo(int idx);
430  int GetPartStatus(int idx);
432  void SetPartStatus(int idx, int on);
433  void SetPartStatus(vtkStdString name, int flag);
434 
435  int GetNumberOfMaterials();
436  const char* GetMaterialName(int idx);
437  int GetMaterialStatus(int idx);
439  void SetMaterialStatus(int idx, int on);
440  void SetMaterialStatus(vtkStdString name, int flag);
441 
442  int GetNumberOfAssemblies();
443  const char* GetAssemblyName(int idx);
444  int GetAssemblyStatus(int idx);
446  void SetAssemblyStatus(int idx, int on);
447  void SetAssemblyStatus(vtkStdString name, int flag);
448 
450  {this->FastPathObjectType = type;};
451  void SetFastPathObjectId(vtkIdType id){this->FastPathObjectId = id;};
452  vtkSetStringMacro(FastPathIdType);
453 
454  bool IsXMLMetadataValid();
455 
463  void GetInitialObjectStatus( int otype, ObjectInfoType *info );
464 
472  void GetInitialObjectArrayStatus( int otype, ArrayInfoType *info );
473 
480  void SetInitialObjectStatus( int otype, const char *name, int stat );
481 
487  void SetInitialObjectArrayStatus( int otype, const char *name, int stat );
488 
489  int UpdateTimeInformation();
490 
492 
493 protected:
495  ~vtkExodusIIReaderPrivate() VTK_OVERRIDE;
496 
498  void BuildSIL();
499 
502  int VerifyIntegrationPointGlom( int nn,
503  char** np,
504  vtksys::RegularExpression& re,
506  vtkStdString& ele );
507 
509  void GlomArrayNames( int i,
510  int num_obj,
511  int num_vars,
512  char** var_names,
513  int* truth_tab );
514 
516  void PrepareGeneratedArrayInfo();
517 
533  int AssembleOutputConnectivity( vtkIdType timeStep,
534  int otyp, int oidx, int conntypidx, BlockSetInfoType* bsinfop,
535  vtkUnstructuredGrid* output );
542  int AssembleOutputPoints( vtkIdType timeStep,
543  BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
547  int AssembleOutputPointArrays( vtkIdType timeStep,
548  BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
552  int AssembleOutputCellArrays( vtkIdType timeStep,
553  int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
558  int AssembleOutputProceduralArrays( vtkIdType timeStep,
559  int otyp, int oidx, vtkUnstructuredGrid* output );
561  int AssembleOutputGlobalArrays( vtkIdType timeStep,
562  int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
569  int AssembleOutputPointMaps( vtkIdType timeStep,
570  BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
571  int AssembleOutputCellMaps( vtkIdType timeStep,
572  int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
575  int AssembleArraysOverTime(vtkMultiBlockDataSet* output);
576 
593  vtkIdType GetPolyhedronFaceConnectivity(
594  vtkIdType fileLocalFaceId,
595  vtkIdType*& facePtIds);
596 
598  void FreePolyhedronFaceArrays();
599 
601  void InsertBlockPolyhedra(
602  BlockInfoType* binfo,
603  vtkIntArray* facesPerCell,
604  vtkIntArray* exoCellConn);
605 
607  void InsertBlockCells(
608  int otyp, int obj, int conn_type, int timeStep, BlockInfoType* binfop );
609 
611  void InsertSetCells(
612  int otyp, int obj, int conn_type, int timeStep, SetInfoType* sinfop );
613 
615  void AddPointArray(
616  vtkDataArray* src, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
617 
619  void InsertSetNodeCopies(
620  vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
621 
623  void InsertSetCellCopies(
624  vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
625 
627  void InsertSetSides(
628  vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
629 
635  vtkDataArray* GetCacheOrRead( vtkExodusIICacheKey );
636 
641  int GetConnTypeIndexFromConnType( int ctyp );
642 
647  int GetObjectTypeIndexFromObjectType( int otyp );
648 
654  int GetNumberOfObjectsAtTypeIndex( int typeIndex );
655 
663  ObjectInfoType* GetObjectInfo( int typeIndex, int objectIndex );
664 
671  ObjectInfoType* GetSortedObjectInfo( int objectType, int objectIndex );
672 
679  ObjectInfoType* GetUnsortedObjectInfo( int objectType, int objectIndex );
680 
685  int GetBlockIndexFromFileGlobalId( int otyp, int refId );
686 
691  BlockInfoType* GetBlockFromFileGlobalId( int otyp, int refId );
692 
696  vtkIdType GetSqueezePointId( BlockSetInfoType* bsinfop, int i );
697 
699  void DetermineVtkCellType( BlockInfoType& binfo );
700 
704  ArrayInfoType* FindArrayInfoByName( int otyp, const char* name );
705 
709  int IsObjectTypeBlock( int otyp );
710  int IsObjectTypeSet( int otyp );
711  int IsObjectTypeMap( int otyp );
712 
716  int GetObjectTypeFromMapType( int mtyp );
717  int GetMapTypeFromObjectType( int otyp );
718  int GetTemporalTypeFromObjectType( int otyp );
719 
723  int GetSetTypeFromSetConnType( int sctyp );
724 
728  int GetBlockConnTypeFromBlockType( int btyp );
729 
735  void RemoveBeginningAndTrailingSpaces( int len, char **names );
736 
738  void ClearConnectivityCaches();
739 
743  std::map<int,std::vector<BlockInfoType> > BlockInfo;
747  std::map<int,std::vector<SetInfoType> > SetInfo;
753  std::map<int,std::vector<MapInfoType> > MapInfo;
754 
755  std::vector<PartInfoType> PartInfo;
756  std::vector<MaterialInfoType> MaterialInfo;
757  std::vector<AssemblyInfoType> AssemblyInfo;
758 
763  std::map<int,std::vector<int> > SortedObjectIndices;
765  // defined on that type.
766  std::map<int,std::vector<ArrayInfoType> > ArrayInfo;
767 
772  std::map<int,std::vector<ArrayInfoType> > InitialArrayInfo;
773 
778  std::map<int,std::vector<ObjectInfoType> > InitialObjectInfo;
779 
781  int AppWordSize;
782  int DiskWordSize;
783 
787  float ExodusVersion;
788 
790  int Exoid;
791 
793  struct ex_init_params ModelParameters;
794 
796  std::vector<double> Times;
797  bool SkipUpdateTimeInformation;
798 
802  double ModeShapeTime;
803 
804  int GenerateObjectIdArray;
805  int GenerateGlobalIdArray;
806  int GenerateFileIdArray;
807  int GenerateGlobalElementIdArray;
808  int GenerateGlobalNodeIdArray;
809  int GenerateImplicitElementIdArray;
810  int GenerateImplicitNodeIdArray;
811 
815  int FileId;
816 
819  //
821  double CacheSize;
822 
823  int ApplyDisplacements;
824  float DisplacementMagnitude;
825  int HasModeShapes;
826  int AnimateModeShapes;
827 
839  int SqueezePoints;
840 
845 
847 
856  std::map<int, std::vector< std::vector< vtkIdType > > > PolyhedralFaceConnArrays;
857 
858  vtkExodusIIReader::ObjectType FastPathObjectType;
859  vtkIdType FastPathObjectId;
860  char* FastPathIdType;
861 
863 private:
864  vtkExodusIIReaderPrivate( const vtkExodusIIReaderPrivate& ) VTK_DELETE_FUNCTION;
865  void operator = ( const vtkExodusIIReaderPrivate& ) VTK_DELETE_FUNCTION;
866 };
867 
868 #endif // vtkExodusIIReaderPrivate_h
869 // VTK-HeaderTest-Exclude: vtkExodusIIReaderPrivate.h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:41
std::vector< int > OriginalIndices
The index of each component of the array as ordered by the Exodus file.
std::map< vtkIdType, vtkIdType > ReversePointMap
A map from nodal ids in the output mesh to those in an Exodus file.
int Components
The number of components in the array.
static const char * GetObjectIdArrayName()
const char * GetAssemblyName(int idx)
void SetFastPathObjectType(vtkExodusIIReader::ObjectType type)
const char * GetPartName(int idx)
abstract base class for most VTK objects
Definition: vtkObject.h:53
A struct to hold information about Exodus objects (blocks, sets, maps)
void SetFastPathObjectId(vtkIdType id)
int GetNumberOfTimeSteps()
Return the number of time steps in the open file.
void GetInitialObjectStatus(int otype, ObjectInfoType *info)
For a given object type, looks for an object in the collection of initial objects of the same name...
record modification and/or execution time
Definition: vtkTimeStamp.h:32
std::vector< int > ObjectTruth
A map describing which objects the variable is defined on.
A struct to hold information about Exodus maps.
void SetTimesOverrides(const std::vector< double > &times)
ObjectType
Extra cell data array that can be generated.
int vtkIdType
Definition: vtkType.h:345
This class holds metadata for an Exodus file.
vtkUnstructuredGrid * CachedConnectivity
Cached cell connectivity arrays for mesh.
vtkMutableDirectedGraph * GetSIL()
Returns the SIL. This valid only after BuildSIL() has been called.
static const char * GetGlobalVariableValuesArrayName()
vtkTimeStamp InformationTimeStamp
Time stamp from last time we were in RequestInformation.
void GetInitialObjectArrayStatus(int otype, ArrayInfoType *info)
For a given array type, looks for an object in the collection of initial objects of the same name...
int Source
The source of the array (Result or Attribute)
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:39
static const char * GetFileIdArrayName()
int StorageType
Storage type of array (a type that can be passed to vtkDataArray::Create())
vtkStdString Name
The name of the array.
a simple class to control print indentation
Definition: vtkIndent.h:33
Read Exodus II files (.exii)
std::map< vtkIdType, vtkIdType > PointMap
A map from nodal IDs in an Exodus file to nodal IDs in the output mesh.
GlomTypes
Tags to indicate how single-component Exodus arrays are glommed (aggregated) into multi-component VTK...
dataset represents arbitrary combinations of all possible cell types
vtkIdType FileOffset
Id (1-based) of first entry in file-local list across all blocks in file.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
static const char * GetGlobalElementIdArrayName()
void SetAssemblyStatus(int idx, int on)
An editable directed graph.
int GetPartStatus(int idx)
int Status
Whether or not the array should be loaded by RequestData.
int GetMaterialStatus(int idx)
virtual void SetParser(vtkExodusIIReaderParser *)
~vtkExodusIIReaderPrivate() override
A struct to hold information about Exodus blocks.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
int Id
User-assigned identification number.
int GetAssemblyStatus(int idx)
A struct to hold information about Exodus blocks or sets (they have some members in common) ...
static const char * GetImplicitElementIdArrayName()
internal parser used by vtkExodusIIReader.
Read exodus 2 files .ex2.
std::vector< vtkStdString > OriginalNames
The name of each component of the array as defined by the Exodus file.
void SetInitialObjectArrayStatus(int otype, const char *name, int stat)
For a given array type, creates and stores an ArrayInfoType object using the given name and status...
Composite dataset that organizes datasets into blocks.
static const char * GetGlobalNodeIdArrayName()
void SetPartStatus(int idx, int on)
const struct ex_init_params * GetModelParams() const
int Status
Should the reader load this block?
A struct to hold information about Exodus sets.
static const char * GetImplicitNodeIdArrayName()
A struct to hold information about Exodus blocks.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
ArraySourceTypes
Tags to indicate the source of values for an array.
const char * GetPartBlockInfo(int idx)
vtkIdType NextSqueezePoint
The next vtk ID to use for a connectivity entry when point squeezing is on and no point ID exists...
int Size
Number of entries in this block.
void SetMaterialStatus(int idx, int on)
A struct to hold information about time-varying arrays.
int GlomType
The type of "glomming" performed.
static const char * GetGlobalVariableNamesArrayName()
void SetInitialObjectStatus(int otype, const char *name, int stat)
For a given object type, creates and stores an ObjectInfoType object using the given name and status...
const char * GetMaterialName(int idx)