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 <vtkstd/map>
18 #include <vtkstd/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 
58  // Description:
59  // Prepare a data set with the proper structure and arrays but no cells.
60  // This is used by the parallel reader when a process has no files assigned to it.
61  int SetUpEmptyGrid( vtkMultiBlockDataSet* output );
62 
74  void Reset();
75 
80  void ResetSettings();
81 
83  void ResetCache();
84 
89  int GetNumberOfTimeSteps() { return (int) this->Times.size(); }
90 
92  vtkGetMacro(TimeStep,int);
93 
95  vtkSetMacro(TimeStep,int);
96 
99  vtkGetMacro(SqueezePoints,int);
100 
103  void SetSqueezePoints( int sp );
104 
107  vtkBooleanMacro(SqueezePoints,int);
108 
110  int GetNumberOfNodes();
111 
116  int GetNumberOfObjectsOfType( int otype );
117 
128  int GetNumberOfObjectArraysOfType( int otype );
129 
134  const char* GetObjectName( int otype, int i );
135 
140  int GetObjectId( int otype, int i );
141 
148  int GetObjectSize( int otype, int i );
149 
154  int GetObjectStatus( int otype, int i );
155 
161  int GetUnsortedObjectStatus( int otype, int i );
162 
167  void SetObjectStatus( int otype, int i, int stat );
168 
174  void SetUnsortedObjectStatus( int otype, int i, int stat );
175 
180  const char* GetObjectArrayName( int otype, int i );
181 
186  int GetNumberOfObjectArrayComponents( int otype, int i );
187 
192  int GetObjectArrayStatus( int otype, int i );
193 
198  void SetObjectArrayStatus( int otype, int i, int stat );
199 
206  int GetNumberOfObjectAttributes( int objectType, int objectIndex );
207  const char* GetObjectAttributeName( int objectType,
208  int objectIndex,
209  int attributeIndex );
210  int GetObjectAttributeIndex( int objectType,
211  int objectIndex,
212  const char* attribName );
213  int GetObjectAttributeStatus( int objectType,
214  int objectIndex,
215  int attribIndex );
216  void SetObjectAttributeStatus( int objectType,
217  int objectIndex,
218  int attribIndex, int status );
219 
221  vtkGetMacro(GenerateObjectIdArray,int);
222  vtkSetMacro(GenerateObjectIdArray,int);
223  static const char* GetObjectIdArrayName() { return "ObjectId"; }
224 
225  vtkSetMacro(GenerateGlobalElementIdArray,int);
226  vtkGetMacro(GenerateGlobalElementIdArray,int);
227  static const char* GetGlobalElementIdArrayName() { return "GlobalElementId"; }
228 
229  vtkSetMacro(GenerateGlobalNodeIdArray,int);
230  vtkGetMacro(GenerateGlobalNodeIdArray,int);
231  static const char* GetGlobalNodeIdArrayName() { return "GlobalNodeId"; }
232 
233  vtkSetMacro(GenerateImplicitElementIdArray,int);
234  vtkGetMacro(GenerateImplicitElementIdArray,int);
235  static const char* GetImplicitElementIdArrayName() { return "ImplicitElementId"; }
236 
237  vtkSetMacro(GenerateImplicitNodeIdArray,int);
238  vtkGetMacro(GenerateImplicitNodeIdArray,int);
239  static const char* GetImplicitNodeIdArrayName() { return "ImplicitNodeId"; }
240 
244  vtkSetMacro(GenerateFileIdArray,int);
245  vtkGetMacro(GenerateFileIdArray,int);
246  static const char* GetFileIdArrayName() { return "FileId"; }
247 
249  vtkSetMacro(FileId,int);
250  vtkGetMacro(FileId,int);
251 
252  static const char *GetGlobalVariableValuesArrayName()
253  { return "GlobalVariableValues"; }
254  static const char *GetGlobalVariableNamesArrayName()
255  { return "GlobalVariableNames"; }
256 
257  virtual void SetApplyDisplacements( int d );
258  vtkGetMacro(ApplyDisplacements,int);
259 
260  virtual void SetDisplacementMagnitude( double s );
261  vtkGetMacro(DisplacementMagnitude,double);
262 
263  vtkSetMacro(HasModeShapes,int);
264  vtkGetMacro(HasModeShapes,int);
265 
266  vtkSetMacro(ModeShapeTime,double);
267  vtkGetMacro(ModeShapeTime,double);
268 
269  vtkSetMacro(AnimateModeShapes, int);
270  vtkGetMacro(AnimateModeShapes, int);
271 
272  vtkDataArray* FindDisplacementVectors( int timeStep );
273 
274  vtkSetMacro(EdgeFieldDecorations,int);
275  vtkGetMacro(EdgeFieldDecorations,int);
276 
277  vtkSetMacro(FaceFieldDecorations,int);
278  vtkGetMacro(FaceFieldDecorations,int);
279 
280  const struct ex_init_params* GetModelParams() const
281  { return &this->ModelParameters; }
282 
284  struct ArrayInfoType {
295  int GlomType;
300  int Source;
302  int Status;
305  vtkstd::vector<vtkStdString> OriginalNames;
308  vtkstd::vector<int> OriginalIndices;
317  vtkstd::vector<int> ObjectTruth;
319  void Reset();
320  };
321 
323  struct ObjectInfoType {
325  int Size;
327  int Status;
329  int Id;
332  };
333 
335  struct MapInfoType : public ObjectInfoType {
336  };
337 
347  vtkstd::map<vtkIdType,vtkIdType> PointMap;
352  vtkstd::map<vtkIdType,vtkIdType> ReversePointMap;
359 
361  BlockSetInfoType(const BlockSetInfoType& block);
363  };
364 
366  struct BlockInfoType : public BlockSetInfoType {
367  vtkStdString OriginalName; // useful to reset the name if XML metadata is invalid.
369  // number of boundaries per entry
370  // The index is the dimensionality of the entry. 0=node, 1=edge, 2=face
371  int BdsPerEntry[3];
373  vtkstd::vector<vtkStdString> AttributeNames;
374  vtkstd::vector<int> AttributeStatus;
375  // VTK cell type (a function of TypeName and BdsPerEntry...)
376  int CellType;
377  // Number of points per cell as used by VTK
378  // -- not what's in the file (i.e., BdsPerEntry[0] >= PointsPerCell)
380  };
381 
383  struct PartInfoType : public ObjectInfoType {
384  vtkstd::vector<int> BlockIndices;
385  };
387  vtkstd::vector<int> BlockIndices;
388  };
390  vtkstd::vector<int> BlockIndices;
391  };
392 
394  struct SetInfoType : public BlockSetInfoType {
395  int DistFact; // Number of distribution factors
396  // (for the entire block, not per array or entry)
397  };
398 
401  enum GlomTypes {
402  Scalar=0,
406  // (order xx, yy, zz, xy, yz, zx)
408  };
409 
412  Result=0,
413  // (that vary over time)
415  // (constants over time)
416  Map=2,
418  };
419 
422 
423  friend class vtkExodusIIReader;
424  friend class vtkPExodusIIReader;
425 
426  virtual void SetParser( vtkExodusIIReaderParser* );
427  vtkGetObjectMacro(Parser,vtkExodusIIReaderParser);
428 
429  // Because Parts, Materials, and assemblies are not stored as arrays,
430  // but rather as maps to the element blocks they make up,
431  // we cannot use the Get|SetObject__() methods directly.
432 
433  int GetNumberOfParts();
434  const char* GetPartName(int idx);
435  const char* GetPartBlockInfo(int idx);
436  int GetPartStatus(int idx);
438  void SetPartStatus(int idx, int on);
439  void SetPartStatus(vtkStdString name, int flag);
440 
441  int GetNumberOfMaterials();
442  const char* GetMaterialName(int idx);
443  int GetMaterialStatus(int idx);
445  void SetMaterialStatus(int idx, int on);
446  void SetMaterialStatus(vtkStdString name, int flag);
447 
448  int GetNumberOfAssemblies();
449  const char* GetAssemblyName(int idx);
450  int GetAssemblyStatus(int idx);
452  void SetAssemblyStatus(int idx, int on);
453  void SetAssemblyStatus(vtkStdString name, int flag);
454 
456  {this->FastPathObjectType = type;};
458  vtkSetStringMacro(FastPathIdType);
459 
460  bool IsXMLMetadataValid();
461 
469  void GetInitialObjectStatus( int otype, ObjectInfoType *info );
470 
478  void GetInitialObjectArrayStatus( int otype, ArrayInfoType *info );
479 
486  void SetInitialObjectStatus( int otype, const char *name, int stat );
487 
493  void SetInitialObjectArrayStatus( int otype, const char *name, int stat );
494 
495  int UpdateTimeInformation();
496 
498 
499 protected:
502 
504  void BuildSIL();
505 
508  int VerifyIntegrationPointGlom( int nn,
509  char** np,
510  vtksys::RegularExpression& re,
512  vtkStdString& ele );
513 
515  void GlomArrayNames( int i,
516  int num_obj,
517  int num_vars,
518  char** var_names,
519  int* truth_tab );
520 
523 
540  int otyp, int oidx, int conntypidx, BlockSetInfoType* bsinfop,
541  vtkUnstructuredGrid* output );
548  int AssembleOutputPoints( vtkIdType timeStep,
549  BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
553  int AssembleOutputPointArrays( vtkIdType timeStep,
554  BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
558  int AssembleOutputCellArrays( vtkIdType timeStep,
559  int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
565  int otyp, int oidx, vtkUnstructuredGrid* output );
568  int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
575  int AssembleOutputPointMaps( vtkIdType timeStep,
576  BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
577  int AssembleOutputCellMaps( vtkIdType timeStep,
578  int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
582 
583  // Generate the decorations for edge fields.
585 
586  // Generate the decorations for face fields.
588 
590  void InsertBlockCells(
591  int otyp, int obj, int conn_type, int timeStep, BlockInfoType* binfop );
592 
594  void InsertSetCells(
595  int otyp, int obj, int conn_type, int timeStep, SetInfoType* sinfop );
596 
598  void AddPointArray(
599  vtkDataArray* src, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
600 
602  void InsertSetNodeCopies(
603  vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
604 
606  void InsertSetCellCopies(
607  vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
608 
610  void InsertSetSides(
611  vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
612 
619 
624  int GetConnTypeIndexFromConnType( int ctyp );
625 
630  int GetObjectTypeIndexFromObjectType( int otyp );
631 
637  int GetNumberOfObjectsAtTypeIndex( int typeIndex );
638 
646  ObjectInfoType* GetObjectInfo( int typeIndex, int objectIndex );
647 
654  ObjectInfoType* GetSortedObjectInfo( int objectType, int objectIndex );
655 
662  ObjectInfoType* GetUnsortedObjectInfo( int objectType, int objectIndex );
663 
668  int GetBlockIndexFromFileGlobalId( int otyp, int refId );
669 
674  BlockInfoType* GetBlockFromFileGlobalId( int otyp, int refId );
675 
679  vtkIdType GetSqueezePointId( BlockSetInfoType* bsinfop, int i );
680 
682  void DetermineVtkCellType( BlockInfoType& binfo );
683 
687  ArrayInfoType* FindArrayInfoByName( int otyp, const char* name );
688 
692  int IsObjectTypeBlock( int otyp );
693  int IsObjectTypeSet( int otyp );
694  int IsObjectTypeMap( int otyp );
695 
699  int GetObjectTypeFromMapType( int mtyp );
700  int GetMapTypeFromObjectType( int otyp );
701  int GetTemporalTypeFromObjectType( int otyp );
702 
706  int GetSetTypeFromSetConnType( int sctyp );
707 
711  int GetBlockConnTypeFromBlockType( int btyp );
712 
718  void RemoveBeginningAndTrailingSpaces( int len, char **names );
719 
722 
726  vtkstd::map<int,vtkstd::vector<BlockInfoType> > BlockInfo;
730  vtkstd::map<int,vtkstd::vector<SetInfoType> > SetInfo;
736  vtkstd::map<int,vtkstd::vector<MapInfoType> > MapInfo;
737 
738  vtkstd::vector<PartInfoType> PartInfo;
739  vtkstd::vector<MaterialInfoType> MaterialInfo;
740  vtkstd::vector<AssemblyInfoType> AssemblyInfo;
741 
746  vtkstd::map<int,vtkstd::vector<int> > SortedObjectIndices;
748  // defined on that type.
749  vtkstd::map<int,vtkstd::vector<ArrayInfoType> > ArrayInfo;
750 
755  vtkstd::map<int,vtkstd::vector<ArrayInfoType> > InitialArrayInfo;
756 
761  vtkstd::map<int,vtkstd::vector<ObjectInfoType> > InitialObjectInfo;
762 
766 
771 
773  int Exoid;
774 
776  struct ex_init_params ModelParameters;
777 
779  vtkstd::vector<double> Times;
780 
782  int TimeStep;
783 
788 
796 
800  int FileId;
801 
804 
809 
810  // Specify how to decorate edge and face variables.
813 
814  // Meshes to support edge and face glyph decorations.
817 
830 
835 
837 
841 
843 private:
844  vtkExodusIIReaderPrivate( const vtkExodusIIReaderPrivate& ); // Not implemented.
845  void operator = ( const vtkExodusIIReaderPrivate& ); // Not implemented.
846 };
847 
848 #endif // __vtkExodusIIReaderPrivate_h