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 #ifdef VTK_USE_PARALLEL
11 #else // VTK_USE_PARALLEL
13 #endif // VTK_USE_PARALLEL
14 
15 #include "vtksys/RegularExpression.hxx"
16 
17 #include <map>
18 #include <vector>
19 
20 #include "vtk_exodusII.h"
21 
24 
29 {
30 public:
31  static vtkExodusIIReaderPrivate* New();
32  void PrintData( ostream& os, vtkIndent indent );
34  //virtual void Modified();
35 
37  int OpenFile( const char* filename );
38 
40  int CloseFile();
41 
43  int RequestInformation();
44 
47  { return this->SIL; }
48 
50  void Broadcast( vtkMultiProcessController* controller );
51 
53  void Receive( vtkMultiProcessController* controller );
54 
56  int RequestData( vtkIdType timeStep, vtkMultiBlockDataSet* output );
57 
62  int SetUpEmptyGrid( vtkMultiBlockDataSet* output );
63 
75  void Reset();
76 
81  void ResetSettings();
82 
84  void ResetCache();
85 
87  void SetCacheSize(double size);
88 
90  vtkGetMacro(CacheSize, double);
91 
96  int GetNumberOfTimeSteps() { return (int) this->Times.size(); }
97 
99  vtkGetMacro(TimeStep,int);
100 
102  vtkSetMacro(TimeStep,int);
103 
106  vtkGetMacro(SqueezePoints,int);
107 
110  void SetSqueezePoints( int sp );
111 
114  vtkBooleanMacro(SqueezePoints,int);
115 
117  int GetNumberOfNodes();
118 
123  int GetNumberOfObjectsOfType( int otype );
124 
135  int GetNumberOfObjectArraysOfType( int otype );
136 
141  const char* GetObjectName( int otype, int i );
142 
147  int GetObjectId( int otype, int i );
148 
155  int GetObjectSize( int otype, int i );
156 
161  int GetObjectStatus( int otype, int i );
162 
168  int GetUnsortedObjectStatus( int otype, int i );
169 
174  void SetObjectStatus( int otype, int i, int stat );
175 
181  void SetUnsortedObjectStatus( int otype, int i, int stat );
182 
187  const char* GetObjectArrayName( int otype, int i );
188 
193  int GetNumberOfObjectArrayComponents( int otype, int i );
194 
199  int GetObjectArrayStatus( int otype, int i );
200 
205  void SetObjectArrayStatus( int otype, int i, int stat );
206 
213  int GetNumberOfObjectAttributes( int objectType, int objectIndex );
214  const char* GetObjectAttributeName( int objectType,
215  int objectIndex,
216  int attributeIndex );
217  int GetObjectAttributeIndex( int objectType,
218  int objectIndex,
219  const char* attribName );
220  int GetObjectAttributeStatus( int objectType,
221  int objectIndex,
222  int attribIndex );
223  void SetObjectAttributeStatus( int objectType,
224  int objectIndex,
225  int attribIndex, int status );
226 
228  vtkGetMacro(GenerateObjectIdArray,int);
229  vtkSetMacro(GenerateObjectIdArray,int);
230  static const char* GetObjectIdArrayName() { return "ObjectId"; }
231 
232  vtkSetMacro(GenerateGlobalElementIdArray,int);
233  vtkGetMacro(GenerateGlobalElementIdArray,int);
234  static const char* GetGlobalElementIdArrayName() { return "GlobalElementId"; }
235 
236  vtkSetMacro(GenerateGlobalNodeIdArray,int);
237  vtkGetMacro(GenerateGlobalNodeIdArray,int);
238  static const char* GetGlobalNodeIdArrayName() { return "GlobalNodeId"; }
239 
240  vtkSetMacro(GenerateImplicitElementIdArray,int);
241  vtkGetMacro(GenerateImplicitElementIdArray,int);
242  static const char* GetImplicitElementIdArrayName() { return "ImplicitElementId"; }
243 
244  vtkSetMacro(GenerateImplicitNodeIdArray,int);
245  vtkGetMacro(GenerateImplicitNodeIdArray,int);
246  static const char* GetImplicitNodeIdArrayName() { return "ImplicitNodeId"; }
247 
251  vtkSetMacro(GenerateFileIdArray,int);
252  vtkGetMacro(GenerateFileIdArray,int);
253  static const char* GetFileIdArrayName() { return "FileId"; }
254 
256  vtkSetMacro(FileId,int);
257  vtkGetMacro(FileId,int);
258 
259  static const char *GetGlobalVariableValuesArrayName()
260  { return "GlobalVariableValues"; }
261  static const char *GetGlobalVariableNamesArrayName()
262  { return "GlobalVariableNames"; }
263 
264  virtual void SetApplyDisplacements( int d );
265  vtkGetMacro(ApplyDisplacements,int);
266 
267  virtual void SetDisplacementMagnitude( double s );
268  vtkGetMacro(DisplacementMagnitude,double);
269 
270  vtkSetMacro(HasModeShapes,int);
271  vtkGetMacro(HasModeShapes,int);
272 
273  vtkSetMacro(ModeShapeTime,double);
274  vtkGetMacro(ModeShapeTime,double);
275 
276  vtkSetMacro(AnimateModeShapes, int);
277  vtkGetMacro(AnimateModeShapes, int);
278 
279  vtkDataArray* FindDisplacementVectors( int timeStep );
280 
281  const struct ex_init_params* GetModelParams() const
282  { return &this->ModelParameters; }
283 
285  struct ArrayInfoType {
296  int GlomType;
301  int Source;
303  int Status;
306  std::vector<vtkStdString> OriginalNames;
309  std::vector<int> OriginalIndices;
318  std::vector<int> ObjectTruth;
320  void Reset();
321  };
322 
324  struct ObjectInfoType {
326  int Size;
328  int Status;
330  int Id;
333  };
334 
336  struct MapInfoType : public ObjectInfoType {
337  };
338 
348  std::map<vtkIdType,vtkIdType> PointMap;
353  std::map<vtkIdType,vtkIdType> ReversePointMap;
360 
362  BlockSetInfoType(const BlockSetInfoType& block);
364  };
365 
367  struct BlockInfoType : public BlockSetInfoType {
368  vtkStdString OriginalName; // useful to reset the name if XML metadata is invalid.
370  // number of boundaries per entry
371  // The index is the dimensionality of the entry. 0=node, 1=edge, 2=face
372  int BdsPerEntry[3];
374  std::vector<vtkStdString> AttributeNames;
375  std::vector<int> AttributeStatus;
376  // VTK cell type (a function of TypeName and BdsPerEntry...)
377  int CellType;
378  // Number of points per cell as used by VTK
379  // -- not what's in the file (i.e., BdsPerEntry[0] >= PointsPerCell)
381  };
382 
384  struct PartInfoType : public ObjectInfoType {
385  std::vector<int> BlockIndices;
386  };
388  std::vector<int> BlockIndices;
389  };
391  std::vector<int> BlockIndices;
392  };
393 
395  struct SetInfoType : public BlockSetInfoType {
396  int DistFact; // Number of distribution factors
397  // (for the entire block, not per array or entry)
398  };
399 
402  enum GlomTypes {
403  Scalar=0,
407  // (order xx, yy, zz, xy, yz, zx)
409  };
410 
413  Result=0,
414  // (that vary over time)
416  // (constants over time)
417  Map=2,
419  };
420 
423 
424  friend class vtkExodusIIReader;
425  friend class vtkPExodusIIReader;
426 
427  virtual void SetParser( vtkExodusIIReaderParser* );
428  vtkGetObjectMacro(Parser,vtkExodusIIReaderParser);
429 
430  // Because Parts, Materials, and assemblies are not stored as arrays,
431  // but rather as maps to the element blocks they make up,
432  // we cannot use the Get|SetObject__() methods directly.
433 
434  int GetNumberOfParts();
435  const char* GetPartName(int idx);
436  const char* GetPartBlockInfo(int idx);
437  int GetPartStatus(int idx);
439  void SetPartStatus(int idx, int on);
440  void SetPartStatus(vtkStdString name, int flag);
441 
442  int GetNumberOfMaterials();
443  const char* GetMaterialName(int idx);
444  int GetMaterialStatus(int idx);
446  void SetMaterialStatus(int idx, int on);
447  void SetMaterialStatus(vtkStdString name, int flag);
448 
449  int GetNumberOfAssemblies();
450  const char* GetAssemblyName(int idx);
451  int GetAssemblyStatus(int idx);
453  void SetAssemblyStatus(int idx, int on);
454  void SetAssemblyStatus(vtkStdString name, int flag);
455 
457  {this->FastPathObjectType = type;};
459  vtkSetStringMacro(FastPathIdType);
460 
461  bool IsXMLMetadataValid();
462 
470  void GetInitialObjectStatus( int otype, ObjectInfoType *info );
471 
479  void GetInitialObjectArrayStatus( int otype, ArrayInfoType *info );
480 
487  void SetInitialObjectStatus( int otype, const char *name, int stat );
488 
494  void SetInitialObjectArrayStatus( int otype, const char *name, int stat );
495 
496  int UpdateTimeInformation();
497 
499 
500 protected:
503 
505  void BuildSIL();
506 
509  int VerifyIntegrationPointGlom( int nn,
510  char** np,
511  vtksys::RegularExpression& re,
513  vtkStdString& ele );
514 
516  void GlomArrayNames( int i,
517  int num_obj,
518  int num_vars,
519  char** var_names,
520  int* truth_tab );
521 
524 
541  int otyp, int oidx, int conntypidx, BlockSetInfoType* bsinfop,
542  vtkUnstructuredGrid* output );
549  int AssembleOutputPoints( vtkIdType timeStep,
550  BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
554  int AssembleOutputPointArrays( vtkIdType timeStep,
555  BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
559  int AssembleOutputCellArrays( vtkIdType timeStep,
560  int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
566  int otyp, int oidx, vtkUnstructuredGrid* output );
569  int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
576  int AssembleOutputPointMaps( vtkIdType timeStep,
577  BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
578  int AssembleOutputCellMaps( vtkIdType timeStep,
579  int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
583 
585  void InsertBlockCells(
586  int otyp, int obj, int conn_type, int timeStep, BlockInfoType* binfop );
587 
589  void InsertSetCells(
590  int otyp, int obj, int conn_type, int timeStep, SetInfoType* sinfop );
591 
593  void AddPointArray(
594  vtkDataArray* src, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
595 
597  void InsertSetNodeCopies(
598  vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
599 
601  void InsertSetCellCopies(
602  vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
603 
605  void InsertSetSides(
606  vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
607 
614 
619  int GetConnTypeIndexFromConnType( int ctyp );
620 
625  int GetObjectTypeIndexFromObjectType( int otyp );
626 
632  int GetNumberOfObjectsAtTypeIndex( int typeIndex );
633 
641  ObjectInfoType* GetObjectInfo( int typeIndex, int objectIndex );
642 
649  ObjectInfoType* GetSortedObjectInfo( int objectType, int objectIndex );
650 
657  ObjectInfoType* GetUnsortedObjectInfo( int objectType, int objectIndex );
658 
663  int GetBlockIndexFromFileGlobalId( int otyp, int refId );
664 
669  BlockInfoType* GetBlockFromFileGlobalId( int otyp, int refId );
670 
674  vtkIdType GetSqueezePointId( BlockSetInfoType* bsinfop, int i );
675 
677  void DetermineVtkCellType( BlockInfoType& binfo );
678 
682  ArrayInfoType* FindArrayInfoByName( int otyp, const char* name );
683 
687  int IsObjectTypeBlock( int otyp );
688  int IsObjectTypeSet( int otyp );
689  int IsObjectTypeMap( int otyp );
690 
694  int GetObjectTypeFromMapType( int mtyp );
695  int GetMapTypeFromObjectType( int otyp );
696  int GetTemporalTypeFromObjectType( int otyp );
697 
701  int GetSetTypeFromSetConnType( int sctyp );
702 
706  int GetBlockConnTypeFromBlockType( int btyp );
707 
713  void RemoveBeginningAndTrailingSpaces( int len, char **names );
714 
717 
721  std::map<int,std::vector<BlockInfoType> > BlockInfo;
725  std::map<int,std::vector<SetInfoType> > SetInfo;
731  std::map<int,std::vector<MapInfoType> > MapInfo;
732 
733  std::vector<PartInfoType> PartInfo;
734  std::vector<MaterialInfoType> MaterialInfo;
735  std::vector<AssemblyInfoType> AssemblyInfo;
736 
741  std::map<int,std::vector<int> > SortedObjectIndices;
743  // defined on that type.
744  std::map<int,std::vector<ArrayInfoType> > ArrayInfo;
745 
750  std::map<int,std::vector<ArrayInfoType> > InitialArrayInfo;
751 
756  std::map<int,std::vector<ObjectInfoType> > InitialObjectInfo;
757 
761 
766 
768  int Exoid;
769 
771  struct ex_init_params ModelParameters;
772 
774  std::vector<double> Times;
775 
777  int TimeStep;
778 
783 
791 
795  int FileId;
796 
799  //
801  double CacheSize;
802 
807 
820 
825 
827 
831 
833 private:
834  vtkExodusIIReaderPrivate( const vtkExodusIIReaderPrivate& ); // Not implemented.
835  void operator = ( const vtkExodusIIReaderPrivate& ); // Not implemented.
836 };
837 
838 #endif // __vtkExodusIIReaderPrivate_h