VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/IO/Exodus/vtkExodusIIReaderPrivate.h
Go to the documentation of this file.
00001 #ifndef vtkExodusIIReaderPrivate_h
00002 #define vtkExodusIIReaderPrivate_h
00003 
00004 // Do not include this file directly. It is only for use
00005 // from inside the ExodusII reader and its descendants.
00006 
00007 #include "vtkToolkits.h" // make sure VTK_USE_PARALLEL is properly set
00008 #include "vtkExodusIICache.h"
00009 #include "vtksys/RegularExpression.hxx"
00010 
00011 #include <map>
00012 #include <vector>
00013 
00014 #include "vtk_exodusII.h"
00015 #include "vtkIOExodusModule.h" // For export macro
00016 class vtkExodusIIReaderParser;
00017 class vtkMutableDirectedGraph;
00018 
00022 class VTKIOEXODUS_EXPORT vtkExodusIIReaderPrivate : public vtkObject
00023 {
00024 public:
00025   static vtkExodusIIReaderPrivate* New();
00026   void PrintData( ostream& os, vtkIndent indent );
00027   vtkTypeMacro(vtkExodusIIReaderPrivate,vtkObject);
00028   //virtual void Modified();
00029 
00031   int OpenFile( const char* filename );
00032 
00034   int CloseFile();
00035 
00037   int RequestInformation();
00038 
00040   vtkMutableDirectedGraph* GetSIL()
00041     { return this->SIL; }
00042 
00044   int RequestData( vtkIdType timeStep, vtkMultiBlockDataSet* output );
00045 
00050   int SetUpEmptyGrid( vtkMultiBlockDataSet* output );
00051 
00063   void Reset();
00064 
00069   void ResetSettings();
00070 
00072   void ResetCache();
00073 
00075   void SetCacheSize(double size);
00076 
00078   vtkGetMacro(CacheSize, double);
00079 
00084   int GetNumberOfTimeSteps() { return (int) this->Times.size(); }
00085 
00086 
00089   vtkGetMacro(SqueezePoints,int);
00090 
00093   void SetSqueezePoints( int sp );
00094 
00097   vtkBooleanMacro(SqueezePoints,int);
00098 
00100   int GetNumberOfNodes();
00101 
00106   int GetNumberOfObjectsOfType( int otype );
00107 
00118   int GetNumberOfObjectArraysOfType( int otype );
00119 
00124   const char* GetObjectName( int otype, int i );
00125 
00130   int GetObjectId( int otype, int i );
00131 
00138   int GetObjectSize( int otype, int i );
00139 
00144   int GetObjectStatus( int otype, int i );
00145 
00151   int GetUnsortedObjectStatus( int otype, int i );
00152 
00157   void SetObjectStatus( int otype, int i, int stat );
00158 
00164   void SetUnsortedObjectStatus( int otype, int i, int stat );
00165 
00170   const char* GetObjectArrayName( int otype, int i );
00171 
00176   int GetNumberOfObjectArrayComponents( int otype, int i );
00177 
00182   int GetObjectArrayStatus( int otype, int i );
00183 
00188   void SetObjectArrayStatus( int otype, int i, int stat );
00189 
00196   int GetNumberOfObjectAttributes( int objectType, int objectIndex );
00197   const char* GetObjectAttributeName( int objectType,
00198                                       int objectIndex,
00199                                       int attributeIndex );
00200   int GetObjectAttributeIndex( int objectType,
00201                                int objectIndex,
00202                                const char* attribName );
00203   int GetObjectAttributeStatus( int objectType,
00204                                 int objectIndex,
00205                                 int attribIndex );
00206   void SetObjectAttributeStatus( int objectType,
00207                                  int objectIndex,
00208                                  int attribIndex, int status );
00209 
00211   vtkGetMacro(GenerateObjectIdArray,int);
00212   vtkSetMacro(GenerateObjectIdArray,int);
00213   static const char* GetObjectIdArrayName() { return "ObjectId"; }
00214 
00215   vtkSetMacro(GenerateGlobalElementIdArray,int);
00216   vtkGetMacro(GenerateGlobalElementIdArray,int);
00217   static const char* GetGlobalElementIdArrayName() { return "GlobalElementId"; }
00218 
00219   vtkSetMacro(GenerateGlobalNodeIdArray,int);
00220   vtkGetMacro(GenerateGlobalNodeIdArray,int);
00221   static const char* GetGlobalNodeIdArrayName() { return "GlobalNodeId"; }
00222 
00223   vtkSetMacro(GenerateImplicitElementIdArray,int);
00224   vtkGetMacro(GenerateImplicitElementIdArray,int);
00225   static const char* GetImplicitElementIdArrayName() { return "ImplicitElementId"; }
00226 
00227   vtkSetMacro(GenerateImplicitNodeIdArray,int);
00228   vtkGetMacro(GenerateImplicitNodeIdArray,int);
00229   static const char* GetImplicitNodeIdArrayName() { return "ImplicitNodeId"; }
00230 
00234   vtkSetMacro(GenerateFileIdArray,int);
00235   vtkGetMacro(GenerateFileIdArray,int);
00236   static const char* GetFileIdArrayName() { return "FileId"; }
00237 
00239   vtkSetMacro(FileId,int);
00240   vtkGetMacro(FileId,int);
00241 
00242   static const char *GetGlobalVariableValuesArrayName()
00243     { return "GlobalVariableValues"; }
00244   static const char *GetGlobalVariableNamesArrayName()
00245     { return "GlobalVariableNames"; }
00246 
00247   virtual void SetApplyDisplacements( int d );
00248   vtkGetMacro(ApplyDisplacements,int);
00249 
00250   virtual void SetDisplacementMagnitude( double s );
00251   vtkGetMacro(DisplacementMagnitude,double);
00252 
00253   vtkSetMacro(HasModeShapes,int);
00254   vtkGetMacro(HasModeShapes,int);
00255 
00256   vtkSetMacro(ModeShapeTime,double);
00257   vtkGetMacro(ModeShapeTime,double);
00258 
00259   vtkSetMacro(AnimateModeShapes, int);
00260   vtkGetMacro(AnimateModeShapes, int);
00261 
00262   vtkDataArray* FindDisplacementVectors( int timeStep );
00263 
00264   const struct ex_init_params* GetModelParams() const
00265     { return &this->ModelParameters; }
00266 
00268   struct VTKIOEXODUS_EXPORT ArrayInfoType {
00270     vtkStdString Name;
00272     int Components;
00279     int GlomType;
00282     int StorageType;
00284     int Source;
00286     int Status;
00289     std::vector<vtkStdString> OriginalNames;
00292     std::vector<int> OriginalIndices;
00301     std::vector<int> ObjectTruth;
00303     void Reset();
00304   };
00305 
00307   struct VTKIOEXODUS_EXPORT ObjectInfoType {
00309     int Size;
00311     int Status;
00313     int Id;
00315     vtkStdString Name;
00316   };
00317 
00319   struct VTKIOEXODUS_EXPORT MapInfoType : public ObjectInfoType {
00320   };
00321 
00324   struct VTKIOEXODUS_EXPORT BlockSetInfoType : public ObjectInfoType {
00326     vtkIdType FileOffset;
00331     std::map<vtkIdType,vtkIdType> PointMap;
00336     std::map<vtkIdType,vtkIdType> ReversePointMap;
00340     vtkIdType NextSqueezePoint;
00342     vtkUnstructuredGrid* CachedConnectivity;
00343 
00344     BlockSetInfoType(){this->CachedConnectivity=0;}
00345     BlockSetInfoType(const BlockSetInfoType& block);
00346     ~BlockSetInfoType();
00347     BlockSetInfoType& operator=(const BlockSetInfoType& block);
00348   };
00349 
00351   struct VTKIOEXODUS_EXPORT BlockInfoType : public BlockSetInfoType {
00352     vtkStdString OriginalName; // useful to reset the name if XML metadata is invalid.
00353     vtkStdString TypeName;
00354     // number of boundaries per entry
00355     // The index is the dimensionality of the entry. 0=node, 1=edge, 2=face
00356     int BdsPerEntry[3];
00357     int AttributesPerEntry;
00358     std::vector<vtkStdString> AttributeNames;
00359     std::vector<int> AttributeStatus;
00360     // VTK cell type (a function of TypeName and BdsPerEntry...)
00361     int CellType;
00362     // Number of points per cell as used by VTK
00363     // -- not what's in the file (i.e., BdsPerEntry[0] >= PointsPerCell)
00364     int PointsPerCell;
00365   };
00366 
00368   struct PartInfoType : public ObjectInfoType {
00369     std::vector<int> BlockIndices;
00370   };
00371   struct AssemblyInfoType : public ObjectInfoType {
00372     std::vector<int> BlockIndices;
00373   };
00374   struct MaterialInfoType : public ObjectInfoType {
00375     std::vector<int> BlockIndices;
00376   };
00377 
00379   struct SetInfoType : public BlockSetInfoType {
00380     int DistFact;     // Number of distribution factors
00381                       // (for the entire block, not per array or entry)
00382   };
00383 
00386   enum GlomTypes {
00387     Scalar=0,          
00388     Vector2=1,         
00389     Vector3=2,         
00390     SymmetricTensor=3, 
00391                        //   (order xx, yy, zz, xy, yz, zx)
00392     IntegrationPoint=4 
00393   };
00394 
00396   enum ArraySourceTypes {
00397     Result=0,        
00398                      //   (that vary over time)
00399     Attribute=1,     
00400                      //   (constants over time)
00401     Map=2,           
00402     Generated=3      
00403   };
00404 
00406   vtkTimeStamp InformationTimeStamp;
00407 
00408   friend class vtkExodusIIReader;
00409   friend class vtkPExodusIIReader;
00410 
00411   virtual void SetParser( vtkExodusIIReaderParser* );
00412   vtkGetObjectMacro(Parser,vtkExodusIIReaderParser);
00413 
00414   // Because Parts, Materials, and assemblies are not stored as arrays,
00415   // but rather as maps to the element blocks they make up,
00416   // we cannot use the Get|SetObject__() methods directly.
00417 
00418   int GetNumberOfParts();
00419   const char* GetPartName(int idx);
00420   const char* GetPartBlockInfo(int idx);
00421   int GetPartStatus(int idx);
00422   int GetPartStatus(vtkStdString name);
00423   void SetPartStatus(int idx, int on);
00424   void SetPartStatus(vtkStdString name, int flag);
00425 
00426   int GetNumberOfMaterials();
00427   const char* GetMaterialName(int idx);
00428   int GetMaterialStatus(int idx);
00429   int GetMaterialStatus(vtkStdString name);
00430   void SetMaterialStatus(int idx, int on);
00431   void SetMaterialStatus(vtkStdString name, int flag);
00432 
00433   int GetNumberOfAssemblies();
00434   const char* GetAssemblyName(int idx);
00435   int GetAssemblyStatus(int idx);
00436   int GetAssemblyStatus(vtkStdString name);
00437   void SetAssemblyStatus(int idx, int on);
00438   void SetAssemblyStatus(vtkStdString name, int flag);
00439 
00440   void SetFastPathObjectType(vtkExodusIIReader::ObjectType type)
00441     {this->FastPathObjectType = type;};
00442   void SetFastPathObjectId(vtkIdType id){this->FastPathObjectId = id;};
00443   vtkSetStringMacro(FastPathIdType);
00444 
00445   bool IsXMLMetadataValid();
00446 
00454   void GetInitialObjectStatus( int otype, ObjectInfoType *info );
00455 
00463   void GetInitialObjectArrayStatus( int otype, ArrayInfoType *info );
00464 
00471   void SetInitialObjectStatus( int otype, const char *name, int stat );
00472 
00478   void SetInitialObjectArrayStatus( int otype, const char *name, int stat );
00479 
00480   int UpdateTimeInformation();
00481 
00482   bool ProducedFastPathOutput;
00483 
00484 protected:
00485   vtkExodusIIReaderPrivate();
00486   ~vtkExodusIIReaderPrivate();
00487 
00489   void BuildSIL();
00490 
00493   int VerifyIntegrationPointGlom( int nn,
00494                                   char** np,
00495                                   vtksys::RegularExpression& re,
00496                                   vtkStdString& field,
00497                                   vtkStdString& ele );
00498 
00500   void GlomArrayNames( int i,
00501                        int num_obj,
00502                        int num_vars,
00503                        char** var_names,
00504                        int* truth_tab );
00505 
00507   void PrepareGeneratedArrayInfo();
00508 
00524   int AssembleOutputConnectivity( vtkIdType timeStep,
00525     int otyp, int oidx, int conntypidx, BlockSetInfoType* bsinfop,
00526     vtkUnstructuredGrid* output );
00533   int AssembleOutputPoints( vtkIdType timeStep,
00534     BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00538   int AssembleOutputPointArrays( vtkIdType timeStep,
00539     BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00543   int AssembleOutputCellArrays( vtkIdType timeStep,
00544     int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00549   int AssembleOutputProceduralArrays( vtkIdType timeStep,
00550     int otyp, int oidx, vtkUnstructuredGrid* output );
00552   int AssembleOutputGlobalArrays( vtkIdType timeStep,
00553     int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00560   int AssembleOutputPointMaps( vtkIdType timeStep,
00561     BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00562   int AssembleOutputCellMaps( vtkIdType timeStep,
00563     int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00566   int AssembleArraysOverTime(vtkMultiBlockDataSet* output);
00567 
00569   void InsertBlockPolyhedra(
00570     BlockInfoType* binfo,
00571     vtkIntArray* facesPerCell,
00572     vtkIntArray* pointsPerFace,
00573     vtkIntArray* exoCellConn,
00574     vtkIntArray* exoFaceConn);
00575 
00577   void InsertBlockCells(
00578     int otyp, int obj, int conn_type, int timeStep, BlockInfoType* binfop );
00579 
00581   void InsertSetCells(
00582     int otyp, int obj, int conn_type, int timeStep, SetInfoType* sinfop );
00583 
00585   void AddPointArray(
00586     vtkDataArray* src, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00587 
00589   void InsertSetNodeCopies(
00590     vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
00591 
00593   void InsertSetCellCopies(
00594     vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
00595 
00597   void InsertSetSides(
00598     vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
00599 
00605   vtkDataArray* GetCacheOrRead( vtkExodusIICacheKey );
00606 
00611   int GetConnTypeIndexFromConnType( int ctyp );
00612 
00617   int GetObjectTypeIndexFromObjectType( int otyp );
00618 
00624   int GetNumberOfObjectsAtTypeIndex( int typeIndex );
00625 
00633   ObjectInfoType* GetObjectInfo( int typeIndex, int objectIndex );
00634 
00641   ObjectInfoType* GetSortedObjectInfo( int objectType, int objectIndex );
00642 
00649   ObjectInfoType* GetUnsortedObjectInfo( int objectType, int objectIndex );
00650 
00655   int GetBlockIndexFromFileGlobalId( int otyp, int refId );
00656 
00661   BlockInfoType* GetBlockFromFileGlobalId( int otyp, int refId );
00662 
00666   vtkIdType GetSqueezePointId( BlockSetInfoType* bsinfop, int i );
00667 
00669   void DetermineVtkCellType( BlockInfoType& binfo );
00670 
00674   ArrayInfoType* FindArrayInfoByName( int otyp, const char* name );
00675 
00679   int IsObjectTypeBlock( int otyp );
00680   int IsObjectTypeSet( int otyp );
00681   int IsObjectTypeMap( int otyp );
00682 
00686   int GetObjectTypeFromMapType( int mtyp );
00687   int GetMapTypeFromObjectType( int otyp );
00688   int GetTemporalTypeFromObjectType( int otyp );
00689 
00693   int GetSetTypeFromSetConnType( int sctyp );
00694 
00698   int GetBlockConnTypeFromBlockType( int btyp );
00699 
00705   void RemoveBeginningAndTrailingSpaces( int len, char **names );
00706 
00708   void ClearConnectivityCaches();
00709 
00713   std::map<int,std::vector<BlockInfoType> > BlockInfo;
00717   std::map<int,std::vector<SetInfoType> > SetInfo;
00723   std::map<int,std::vector<MapInfoType> > MapInfo;
00724 
00725   std::vector<PartInfoType> PartInfo;
00726   std::vector<MaterialInfoType> MaterialInfo;
00727   std::vector<AssemblyInfoType> AssemblyInfo;
00728 
00733   std::map<int,std::vector<int> > SortedObjectIndices;
00735   //  defined on that type.
00736   std::map<int,std::vector<ArrayInfoType> > ArrayInfo;
00737 
00742   std::map<int,std::vector<ArrayInfoType> > InitialArrayInfo;
00743 
00748   std::map<int,std::vector<ObjectInfoType> > InitialObjectInfo;
00749 
00751   int AppWordSize;
00752   int DiskWordSize;
00753 
00757   float ExodusVersion;
00758 
00760   int Exoid;
00761 
00763   struct ex_init_params ModelParameters;
00764 
00766   std::vector<double> Times;
00767 
00768 
00772   double ModeShapeTime;
00773 
00774   int GenerateObjectIdArray;
00775   int GenerateGlobalIdArray;
00776   int GenerateFileIdArray;
00777   int GenerateGlobalElementIdArray;
00778   int GenerateGlobalNodeIdArray;
00779   int GenerateImplicitElementIdArray;
00780   int GenerateImplicitNodeIdArray;
00781 
00785   int FileId;
00786 
00788   vtkExodusIICache* Cache;
00789   //
00791   double CacheSize;
00792 
00793   int ApplyDisplacements;
00794   float DisplacementMagnitude;
00795   int HasModeShapes;
00796   int AnimateModeShapes;
00797 
00809   int SqueezePoints;
00810 
00814   vtkExodusIIReader* Parent;
00815 
00816   vtkExodusIIReaderParser* Parser;
00817 
00818   vtkExodusIIReader::ObjectType FastPathObjectType;
00819   vtkIdType FastPathObjectId;
00820   char* FastPathIdType;
00821 
00822   vtkMutableDirectedGraph* SIL;
00823 private:
00824   vtkExodusIIReaderPrivate( const vtkExodusIIReaderPrivate& ); // Not implemented.
00825   void operator = ( const vtkExodusIIReaderPrivate& ); // Not implemented.
00826 };
00827 
00828 #endif // vtkExodusIIReaderPrivate_h
00829 // VTK-HeaderTest-Exclude: vtkExodusIIReaderPrivate.h