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 class vtkTypeInt64Array;
19 
23 class VTKIOEXODUS_EXPORT vtkExodusIIReaderPrivate : public vtkObject
24 {
25 public:
26  static vtkExodusIIReaderPrivate* New();
27  void PrintData( ostream& os, vtkIndent indent );
29  //virtual void Modified();
30 
32  int OpenFile( const char* filename );
33 
35  int CloseFile();
36 
38  int RequestInformation();
39 
42  { return this->SIL; }
43 
45  int RequestData( vtkIdType timeStep, vtkMultiBlockDataSet* output );
46 
51  int SetUpEmptyGrid( vtkMultiBlockDataSet* output );
52 
64  void Reset();
65 
70  void ResetSettings();
71 
73  void ResetCache();
74 
76  void SetCacheSize(double size);
77 
79  vtkGetMacro(CacheSize, double);
80 
85  int GetNumberOfTimeSteps() { return (int) this->Times.size(); }
86 
87 
90  vtkGetMacro(SqueezePoints,int);
91 
94  void SetSqueezePoints( int sp );
95 
98  vtkBooleanMacro(SqueezePoints,int);
99 
101  int GetNumberOfNodes();
102 
107  int GetNumberOfObjectsOfType( int otype );
108 
119  int GetNumberOfObjectArraysOfType( int otype );
120 
125  const char* GetObjectName( int otype, int i );
126 
131  int GetObjectId( int otype, int i );
132 
139  int GetObjectSize( int otype, int i );
140 
145  int GetObjectStatus( int otype, int i );
146 
152  int GetUnsortedObjectStatus( int otype, int i );
153 
158  void SetObjectStatus( int otype, int i, int stat );
159 
165  void SetUnsortedObjectStatus( int otype, int i, int stat );
166 
171  const char* GetObjectArrayName( int otype, int i );
172 
177  int GetNumberOfObjectArrayComponents( int otype, int i );
178 
183  int GetObjectArrayStatus( int otype, int i );
184 
189  void SetObjectArrayStatus( int otype, int i, int stat );
190 
197  int GetNumberOfObjectAttributes( int objectType, int objectIndex );
198  const char* GetObjectAttributeName( int objectType,
199  int objectIndex,
200  int attributeIndex );
201  int GetObjectAttributeIndex( int objectType,
202  int objectIndex,
203  const char* attribName );
204  int GetObjectAttributeStatus( int objectType,
205  int objectIndex,
206  int attribIndex );
207  void SetObjectAttributeStatus( int objectType,
208  int objectIndex,
209  int attribIndex, int status );
210 
212  vtkGetMacro(GenerateObjectIdArray,vtkTypeBool);
213  vtkSetMacro(GenerateObjectIdArray,vtkTypeBool);
214  static const char* GetObjectIdArrayName() { return "ObjectId"; }
215 
216  vtkSetMacro(GenerateGlobalElementIdArray,vtkTypeBool);
217  vtkGetMacro(GenerateGlobalElementIdArray,vtkTypeBool);
218  static const char* GetGlobalElementIdArrayName() { return "GlobalElementId"; }
219 
220  vtkSetMacro(GenerateGlobalNodeIdArray,vtkTypeBool);
221  vtkGetMacro(GenerateGlobalNodeIdArray,vtkTypeBool);
222  static const char* GetGlobalNodeIdArrayName() { return "GlobalNodeId"; }
223 
224  vtkSetMacro(GenerateImplicitElementIdArray,vtkTypeBool);
225  vtkGetMacro(GenerateImplicitElementIdArray,vtkTypeBool);
226  static const char* GetImplicitElementIdArrayName() { return "ImplicitElementId"; }
227 
228  vtkSetMacro(GenerateImplicitNodeIdArray,vtkTypeBool);
229  vtkGetMacro(GenerateImplicitNodeIdArray,vtkTypeBool);
230  static const char* GetImplicitNodeIdArrayName() { return "ImplicitNodeId"; }
231 
235  vtkSetMacro(GenerateFileIdArray,vtkTypeBool);
236  vtkGetMacro(GenerateFileIdArray,vtkTypeBool);
237  static const char* GetFileIdArrayName() { return "FileId"; }
238 
240  vtkSetMacro(FileId,int);
241  vtkGetMacro(FileId,int);
242 
243  static const char *GetGlobalVariableValuesArrayName()
244  { return "GlobalVariableValues"; }
245  static const char *GetGlobalVariableNamesArrayName()
246  { return "GlobalVariableNames"; }
247 
248  virtual void SetApplyDisplacements( vtkTypeBool d );
249  vtkGetMacro(ApplyDisplacements,vtkTypeBool);
250 
251  virtual void SetDisplacementMagnitude( double s );
252  vtkGetMacro(DisplacementMagnitude,double);
253 
254  vtkSetMacro(HasModeShapes,int);
255  vtkGetMacro(HasModeShapes,int);
256 
257  vtkSetMacro(ModeShapeTime,double);
258  vtkGetMacro(ModeShapeTime,double);
259 
260  vtkSetMacro(AnimateModeShapes, int);
261  vtkGetMacro(AnimateModeShapes, int);
262 
263  vtkSetMacro(IgnoreFileTime, bool);
264  vtkGetMacro(IgnoreFileTime, bool);
265 
266  vtkDataArray* FindDisplacementVectors( int timeStep );
267 
268  const struct ex_init_params* GetModelParams() const
269  { return &this->ModelParameters; }
270 
272  struct VTKIOEXODUS_EXPORT ArrayInfoType {
283  int GlomType;
288  int Source;
290  int Status;
293  std::vector<vtkStdString> OriginalNames;
296  std::vector<int> OriginalIndices;
305  std::vector<int> ObjectTruth;
307  void Reset();
308  };
309 
311  struct VTKIOEXODUS_EXPORT ObjectInfoType {
313  int Size;
315  int Status;
317  int Id;
320  };
321 
323  struct VTKIOEXODUS_EXPORT MapInfoType : public ObjectInfoType {
324  };
325 
328  struct VTKIOEXODUS_EXPORT BlockSetInfoType : public ObjectInfoType {
335  std::map<vtkIdType,vtkIdType> PointMap;
340  std::map<vtkIdType,vtkIdType> ReversePointMap;
347 
348  BlockSetInfoType(){this->CachedConnectivity=nullptr;}
349  BlockSetInfoType(const BlockSetInfoType& block);
350  ~BlockSetInfoType();
351  BlockSetInfoType& operator=(const BlockSetInfoType& block);
352  };
353 
355  struct VTKIOEXODUS_EXPORT BlockInfoType : public BlockSetInfoType {
356  vtkStdString OriginalName; // useful to reset the name if XML metadata is invalid.
358  // number of boundaries per entry
359  // The index is the dimensionality of the entry. 0=node, 1=edge, 2=face
360  int BdsPerEntry[3];
362  std::vector<vtkStdString> AttributeNames;
363  std::vector<int> AttributeStatus;
364  // VTK cell type (a function of TypeName and BdsPerEntry...)
365  int CellType;
366  // Number of points per cell as used by VTK
367  // -- not what's in the file (i.e., BdsPerEntry[0] >= PointsPerCell)
369  };
370 
372  struct PartInfoType : public ObjectInfoType {
373  std::vector<int> BlockIndices;
374  };
376  std::vector<int> BlockIndices;
377  };
379  std::vector<int> BlockIndices;
380  };
381 
383  struct SetInfoType : public BlockSetInfoType {
384  int DistFact; // Number of distribution factors
385  // (for the entire block, not per array or entry)
386  };
387 
390  enum GlomTypes {
391  Scalar=0,
392  Vector2=1,
393  Vector3=2,
394  SymmetricTensor=3,
395  // (order xx, yy, zz, xy, yz, zx)
396  IntegrationPoint=4
397  };
398 
401  Result=0,
402  // (that vary over time)
403  Attribute=1,
404  // (constants over time)
405  Map=2,
406  Generated=3
407  };
408 
411 
412  friend class vtkExodusIIReader;
413  friend class vtkPExodusIIReader;
414 
415  virtual void SetParser( vtkExodusIIReaderParser* );
416  vtkGetObjectMacro(Parser,vtkExodusIIReaderParser);
417 
418  // BUG #15632: This method allows vtkPExodusIIReader to pass time information
419  // from one spatial file to another and avoiding have to read it for each of
420  // the files.
421  void SetTimesOverrides(const std::vector<double>& times)
422  {
423  this->Times = times;
424  this->SkipUpdateTimeInformation = true;
425  }
426 
427  // Because Parts, Materials, and assemblies are not stored as arrays,
428  // but rather as maps to the element blocks they make up,
429  // we cannot use the Get|SetObject__() methods directly.
430 
431  int GetNumberOfParts();
432  const char* GetPartName(int idx);
433  const char* GetPartBlockInfo(int idx);
434  int GetPartStatus(int idx);
435  int GetPartStatus(const vtkStdString& name);
436  void SetPartStatus(int idx, int on);
437  void SetPartStatus(const vtkStdString& name, int flag);
438 
439  int GetNumberOfMaterials();
440  const char* GetMaterialName(int idx);
441  int GetMaterialStatus(int idx);
442  int GetMaterialStatus(const vtkStdString& name);
443  void SetMaterialStatus(int idx, int on);
444  void SetMaterialStatus(const vtkStdString& name, int flag);
445 
446  int GetNumberOfAssemblies();
447  const char* GetAssemblyName(int idx);
448  int GetAssemblyStatus(int idx);
449  int GetAssemblyStatus(const vtkStdString& name);
450  void SetAssemblyStatus(int idx, int on);
451  void SetAssemblyStatus(const vtkStdString& name, int flag);
452 
454  {this->FastPathObjectType = type;};
455  void SetFastPathObjectId(vtkIdType id){this->FastPathObjectId = id;};
456  vtkSetStringMacro(FastPathIdType);
457 
458  bool IsXMLMetadataValid();
459 
467  void GetInitialObjectStatus( int otype, ObjectInfoType *info );
468 
476  void GetInitialObjectArrayStatus( int otype, ArrayInfoType *info );
477 
484  void SetInitialObjectStatus( int otype, const char *name, int stat );
485 
491  void SetInitialObjectArrayStatus( int otype, const char *name, int stat );
492 
493  int UpdateTimeInformation();
494 
496 
497 protected:
499  ~vtkExodusIIReaderPrivate() override;
500 
502  void BuildSIL();
503 
506  int VerifyIntegrationPointGlom( int nn,
507  char** np,
508  vtksys::RegularExpression& re,
510  vtkStdString& ele );
511 
513  void GlomArrayNames( int i,
514  int num_obj,
515  int num_vars,
516  char** var_names,
517  int* truth_tab );
518 
520  void PrepareGeneratedArrayInfo();
521 
537  int AssembleOutputConnectivity( vtkIdType timeStep,
538  int otyp, int oidx, int conntypidx, BlockSetInfoType* bsinfop,
539  vtkUnstructuredGrid* output );
546  int AssembleOutputPoints( vtkIdType timeStep,
547  BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
551  int AssembleOutputPointArrays( vtkIdType timeStep,
552  BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
556  int AssembleOutputCellArrays( vtkIdType timeStep,
557  int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
562  int AssembleOutputProceduralArrays( vtkIdType timeStep,
563  int otyp, int oidx, vtkUnstructuredGrid* output );
565  int AssembleOutputGlobalArrays( vtkIdType timeStep,
566  int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
573  int AssembleOutputPointMaps( vtkIdType timeStep,
574  BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
575  int AssembleOutputCellMaps( vtkIdType timeStep,
576  int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
579  int AssembleArraysOverTime(vtkMultiBlockDataSet* output);
580 
597  vtkIdType GetPolyhedronFaceConnectivity(
598  vtkIdType fileLocalFaceId,
599  vtkIdType*& facePtIds);
600 
602  void FreePolyhedronFaceArrays();
603 
605  void InsertBlockPolyhedra(
606  BlockInfoType* binfo,
607  vtkIntArray* facesPerCell,
608  vtkIdTypeArray* exoCellConn);
609 
611  void InsertBlockCells(
612  int otyp, int obj, int conn_type, int timeStep, BlockInfoType* binfop );
613 
615  void InsertSetCells(
616  int otyp, int obj, int conn_type, int timeStep, SetInfoType* sinfop );
617 
619  void AddPointArray(
620  vtkDataArray* src, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
621 
623  void InsertSetNodeCopies(
624  vtkIdTypeArray* refs, int otyp, int obj, SetInfoType* sinfo );
625 
627  void InsertSetCellCopies(
628  vtkIdTypeArray* refs, int otyp, int obj, SetInfoType* sinfo );
629 
631  void InsertSetSides(
632  vtkIdTypeArray* refs, int otyp, int obj, SetInfoType* sinfo );
633 
639  vtkDataArray* GetCacheOrRead( vtkExodusIICacheKey );
640 
645  int GetConnTypeIndexFromConnType( int ctyp );
646 
651  int GetObjectTypeIndexFromObjectType( int otyp );
652 
658  int GetNumberOfObjectsAtTypeIndex( int typeIndex );
659 
667  ObjectInfoType* GetObjectInfo( int typeIndex, int objectIndex );
668 
675  ObjectInfoType* GetSortedObjectInfo( int objectType, int objectIndex );
676 
683  ObjectInfoType* GetUnsortedObjectInfo( int objectType, int objectIndex );
684 
689  int GetBlockIndexFromFileGlobalId( int otyp, int refId );
690 
695  BlockInfoType* GetBlockFromFileGlobalId( int otyp, int refId );
696 
700  vtkIdType GetSqueezePointId( BlockSetInfoType* bsinfop, int i );
701 
703  void DetermineVtkCellType( BlockInfoType& binfo );
704 
708  ArrayInfoType* FindArrayInfoByName( int otyp, const char* name );
709 
713  int IsObjectTypeBlock( int otyp );
714  int IsObjectTypeSet( int otyp );
715  int IsObjectTypeMap( int otyp );
716 
720  int GetObjectTypeFromMapType( int mtyp );
721  int GetMapTypeFromObjectType( int otyp );
722  int GetTemporalTypeFromObjectType( int otyp );
723 
727  int GetSetTypeFromSetConnType( int sctyp );
728 
732  int GetBlockConnTypeFromBlockType( int btyp );
733 
739  void RemoveBeginningAndTrailingSpaces( int len, char **names, int maxNameLength );
740 
742  void ClearConnectivityCaches();
743 
747  std::map<int,std::vector<BlockInfoType> > BlockInfo;
751  std::map<int,std::vector<SetInfoType> > SetInfo;
757  std::map<int,std::vector<MapInfoType> > MapInfo;
758 
759  std::vector<PartInfoType> PartInfo;
760  std::vector<MaterialInfoType> MaterialInfo;
761  std::vector<AssemblyInfoType> AssemblyInfo;
762 
767  std::map<int,std::vector<int> > SortedObjectIndices;
769  // defined on that type.
770  std::map<int,std::vector<ArrayInfoType> > ArrayInfo;
771 
776  std::map<int,std::vector<ArrayInfoType> > InitialArrayInfo;
777 
782  std::map<int,std::vector<ObjectInfoType> > InitialObjectInfo;
783 
787 
792 
794  int Exoid;
795 
797  struct ex_init_params ModelParameters;
798 
800  std::vector<double> Times;
802 
807 
815 
819  int FileId;
820 
823  //
825  double CacheSize;
826 
831 
833 
846 
851 
853 
862  std::map<int, std::vector< std::vector< vtkIdType > > > PolyhedralFaceConnArrays;
863 
867 
869 private:
871  void operator = ( const vtkExodusIIReaderPrivate& ) = delete;
872 };
873 
874 #endif // vtkExodusIIReaderPrivate_h
875 // VTK-HeaderTest-Exclude: vtkExodusIIReaderPrivate.h
std::map< int, std::vector< ArrayInfoType > > ArrayInfo
Maps an object type (EX_ELEM_BLOCK, EX_NODE_SET, ...) to a list of arrays.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:40
std::vector< int > OriginalIndices
The index of each component of the array as ordered by the Exodus file.
std::vector< MaterialInfoType > MaterialInfo
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()
vtkMutableDirectedGraph * SIL
void SetFastPathObjectType(vtkExodusIIReader::ObjectType type)
abstract base class for most VTK objects
Definition: vtkObject.h:59
A struct to hold information about Exodus objects (blocks, sets, maps)
std::map< int, std::vector< std::vector< vtkIdType > > > PolyhedralFaceConnArrays
Face connectivity for polyhedra.
std::map< int, std::vector< BlockInfoType > > BlockInfo
Maps a block type (EX_ELEM_BLOCK, EX_FACE_BLOCK, ...) to a list of blocks of that type...
void SetFastPathObjectId(vtkIdType id)
int GetNumberOfTimeSteps()
Return the number of time steps in the open file.
record modification and/or execution time
Definition: vtkTimeStamp.h:35
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)
vtkExodusIIReader * Parent
Pointer to owning reader...
dynamic, self-adjusting array of vtkIdType
ObjectType
Extra cell data array that can be generated.
int vtkIdType
Definition: vtkType.h:347
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.
std::map< int, std::vector< ObjectInfoType > > InitialObjectInfo
Maps an object type (EX_ELEM_BLOCK, EX_NODE_SET, ...) to a list of objects defined on that type...
std::map< int, std::vector< int > > SortedObjectIndices
Maps an object type to vector of indices that reorder objects of that type by their IDs...
static const char * GetGlobalVariableValuesArrayName()
int vtkTypeBool
Definition: vtkABI.h:69
double CacheSize
The size of the cache in MiB.
vtkTimeStamp InformationTimeStamp
Time stamp from last time we were in RequestInformation.
int Source
The source of the array (Result or Attribute)
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:45
static const char * GetFileIdArrayName()
int StorageType
Storage type of array (a type that can be passed to vtkDataArray::Create())
double ModeShapeTime
The time value.
std::vector< AssemblyInfoType > AssemblyInfo
vtkStdString Name
The name of the array.
a simple class to control print indentation
Definition: vtkIndent.h:39
float ExodusVersion
The version of Exodus that wrote the currently open file (or a negative number otherwise).
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:54
static const char * GetGlobalElementIdArrayName()
const struct ex_init_params * GetModelParams() const
An editable directed graph.
vtkExodusIIReader::ObjectType FastPathObjectType
int Status
Whether or not the array should be loaded by RequestData.
A struct to hold information about Exodus blocks.
int Id
User-assigned identification number.
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.
const char * GetPartBlockInfo(int arrayIdx)
By default all parts are loaded.
std::map< int, std::vector< ArrayInfoType > > InitialArrayInfo
Maps an object type (EX_ELEM_BLOCK, EX_NODE_SET, ...) to a list of arrays defined on that type...
Read exodus 2 files .ex2.
std::vector< vtkStdString > OriginalNames
The name of each component of the array as defined by the Exodus file.
vtkExodusIICache * Cache
A least-recently-used cache to hold raw arrays.
Composite dataset that organizes datasets into blocks.
static const char * GetGlobalNodeIdArrayName()
std::map< int, std::vector< MapInfoType > > MapInfo
Maps a map type (EX_ELEM_MAP, ..., EX_NODE_MAP) to a list of maps of that type.
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.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
std::map< int, std::vector< SetInfoType > > SetInfo
Maps a set type (EX_ELEM_SET, ..., EX_NODE_SET) to a list of sets of that type.
int AppWordSize
These aren&#39;t the variables you&#39;re looking for.
int SqueezePoints
Should the reader output only points used by elements in the output mesh, or all the points...
ArraySourceTypes
Tags to indicate the source of values for an array.
int Exoid
The handle of the currently open file.
std::vector< double > Times
A list of time steps for which results variables are stored.
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.
std::vector< PartInfoType > PartInfo
vtkExodusIIReaderParser * Parser
A struct to hold information about time-varying arrays.
int GlomType
The type of "glomming" performed.
static const char * GetGlobalVariableNamesArrayName()