00001 #ifndef __vtkExodusIIReaderPrivate_h
00002 #define __vtkExodusIIReaderPrivate_h
00003
00004
00005
00006
00007 #include "vtkToolkits.h"
00008 #include "vtkExodusIICache.h"
00009 #ifdef VTK_USE_PARALLEL
00010 # include "vtkMultiProcessController.h"
00011 #else // VTK_USE_PARALLEL
00012 class vtkMultiProcessController;
00013 #endif // VTK_USE_PARALLEL
00014
00015 #include "vtksys/RegularExpression.hxx"
00016
00017 #include <vtkstd/map>
00018 #include <vtkstd/vector>
00019
00020 #include "exodusII.h"
00021
00022 class vtkExodusIIXMLParser;
00023
00027 class vtkExodusIIReaderPrivate : public vtkObject
00028 {
00029 public:
00030 static vtkExodusIIReaderPrivate* New();
00031 void PrintData( ostream& os, vtkIndent indent );
00032 vtkTypeRevisionMacro(vtkExodusIIReaderPrivate,vtkObject);
00033
00034
00036 int OpenFile( const char* filename );
00037
00039 int CloseFile();
00040
00042 int RequestInformation();
00043
00045 void Broadcast( vtkMultiProcessController* controller );
00046
00048 void Receive( vtkMultiProcessController* controller );
00049
00051 int RequestData( vtkIdType timeStep, vtkMultiBlockDataSet* output );
00052
00053
00054
00055
00056 int SetUpEmptyGrid( vtkMultiBlockDataSet* output );
00057
00069 void Reset();
00070
00075 void ResetSettings();
00076
00078 void ResetCache();
00079
00084 int GetNumberOfTimeSteps() { return (int) this->Times.size(); }
00085
00087 vtkGetMacro(TimeStep,int);
00088
00090 vtkSetMacro(TimeStep,int);
00091
00094 vtkGetMacro(SqueezePoints,int);
00095
00098 void SetSqueezePoints( int sp );
00099
00102 vtkBooleanMacro(SqueezePoints,int);
00103
00105 int GetNumberOfNodes();
00106
00111 int GetNumberOfObjectsOfType( int otype );
00112
00123 int GetNumberOfObjectArraysOfType( int otype );
00124
00129 const char* GetObjectName( int otype, int i );
00130
00135 int GetObjectId( int otype, int i );
00136
00143 int GetObjectSize( int otype, int i );
00144
00149 int GetObjectStatus( int otype, int i );
00150
00156 int GetUnsortedObjectStatus( int otype, int i );
00157
00162 void SetObjectStatus( int otype, int i, int stat );
00163
00169 void SetUnsortedObjectStatus( int otype, int i, int stat );
00170
00175 const char* GetObjectArrayName( int otype, int i );
00176
00181 int GetNumberOfObjectArrayComponents( int otype, int i );
00182
00187 int GetObjectArrayStatus( int otype, int i );
00188
00193 void SetObjectArrayStatus( int otype, int i, int stat );
00194
00201 int GetNumberOfObjectAttributes( int objectType, int objectIndex );
00202 const char* GetObjectAttributeName( int objectType,
00203 int objectIndex,
00204 int attributeIndex );
00205 int GetObjectAttributeIndex( int objectType,
00206 int objectIndex,
00207 const char* attribName );
00208 int GetObjectAttributeStatus( int objectType,
00209 int objectIndex,
00210 int attribIndex );
00211 void SetObjectAttributeStatus( int objectType,
00212 int objectIndex,
00213 int attribIndex, int status );
00214
00216 vtkGetMacro(GenerateObjectIdArray,int);
00217 vtkSetMacro(GenerateObjectIdArray,int);
00218 static const char* GetObjectIdArrayName() { return "ObjectId"; }
00219
00220 vtkSetMacro(GenerateGlobalElementIdArray,int);
00221 vtkGetMacro(GenerateGlobalElementIdArray,int);
00222 static const char* GetGlobalElementIdArrayName() { return "GlobalElementId"; }
00223
00224 vtkSetMacro(GenerateGlobalNodeIdArray,int);
00225 vtkGetMacro(GenerateGlobalNodeIdArray,int);
00226 static const char* GetGlobalNodeIdArrayName() { return "GlobalNodeId"; }
00227
00231 vtkSetMacro(GenerateFileIdArray,int);
00232 vtkGetMacro(GenerateFileIdArray,int);
00233 static const char* GetFileIdArrayName() { return "FileId"; }
00234
00236 vtkSetMacro(FileId,int);
00237 vtkGetMacro(FileId,int);
00238
00239 static const char *GetGlobalVariableValuesArrayName()
00240 { return "GlobalVariableValues"; }
00241 static const char *GetGlobalVariableNamesArrayName()
00242 { return "GlobalVariableNames"; }
00243
00244 virtual void SetApplyDisplacements( int d );
00245 vtkGetMacro(ApplyDisplacements,int);
00246
00247 virtual void SetDisplacementMagnitude( double s );
00248 vtkGetMacro(DisplacementMagnitude,double);
00249
00250 vtkSetMacro(HasModeShapes,int);
00251 vtkGetMacro(HasModeShapes,int);
00252
00253 vtkSetMacro(ModeShapeTime,double);
00254 vtkGetMacro(ModeShapeTime,double);
00255
00256 vtkDataArray* FindDisplacementVectors( int timeStep );
00257
00258 vtkSetMacro(EdgeFieldDecorations,int);
00259 vtkGetMacro(EdgeFieldDecorations,int);
00260
00261 vtkSetMacro(FaceFieldDecorations,int);
00262 vtkGetMacro(FaceFieldDecorations,int);
00263
00264 const struct ex_init_params* GetModelParams() const
00265 { return &this->ModelParameters; }
00266
00268 struct ArrayInfoType {
00270 vtkStdString Name;
00272 int Components;
00279 int GlomType;
00282 int StorageType;
00284 int Source;
00286 int Status;
00289 vtkstd::vector<vtkStdString> OriginalNames;
00292 vtkstd::vector<int> OriginalIndices;
00301 vtkstd::vector<int> ObjectTruth;
00303 void Reset();
00304 };
00305
00307 struct ObjectInfoType {
00309 int Size;
00311 int Status;
00313 int Id;
00315 vtkStdString Name;
00316 };
00317
00319 struct MapInfoType : public ObjectInfoType {
00320 };
00321
00324 struct BlockSetInfoType : public ObjectInfoType {
00326 vtkIdType FileOffset;
00331 vtkstd::map<vtkIdType,vtkIdType> PointMap;
00336 vtkstd::map<vtkIdType,vtkIdType> ReversePointMap;
00340 vtkIdType NextSqueezePoint;
00342 vtkUnstructuredGrid* CachedConnectivity;
00343
00344 BlockSetInfoType() { this->CachedConnectivity = 0; }
00345 };
00346
00348 struct BlockInfoType : public BlockSetInfoType {
00349 vtkStdString TypeName;
00350
00351
00352 int BdsPerEntry[3];
00353 int AttributesPerEntry;
00354 vtkstd::vector<vtkStdString> AttributeNames;
00355 vtkstd::vector<int> AttributeStatus;
00356
00357 int CellType;
00358
00359
00360 int PointsPerCell;
00361 };
00362
00364 struct PartInfoType : public ObjectInfoType {
00365 vtkstd::vector<int> BlockIndices;
00366 };
00367 struct AssemblyInfoType : public ObjectInfoType {
00368 vtkstd::vector<int> BlockIndices;
00369 };
00370 struct MaterialInfoType : public ObjectInfoType {
00371 vtkstd::vector<int> BlockIndices;
00372 };
00373
00375 struct SetInfoType : public BlockSetInfoType {
00376 int DistFact;
00377
00378 };
00379
00382 enum GlomTypes {
00383 Scalar=0,
00384 Vector2=1,
00385 Vector3=2,
00386 SymmetricTensor=3,
00387
00388 IntegrationPoint=4
00389 };
00390
00392 enum ArraySourceTypes {
00393 Result=0,
00394
00395 Attribute=1,
00396
00397 Map=2,
00398 Generated=3
00399 };
00400
00402 vtkTimeStamp InformationTimeStamp;
00403
00404 friend class vtkExodusIIReader;
00405
00406 virtual void SetParser( vtkExodusIIXMLParser* );
00407 vtkGetObjectMacro(Parser,vtkExodusIIXMLParser);
00408
00409
00410
00411
00412
00413 int GetNumberOfParts();
00414 const char* GetPartName(int idx);
00415 const char* GetPartBlockInfo(int idx);
00416 int GetPartStatus(int idx);
00417 int GetPartStatus(vtkStdString name);
00418 void SetPartStatus(int idx, int on);
00419 void SetPartStatus(vtkStdString name, int flag);
00420
00421 int GetNumberOfMaterials();
00422 const char* GetMaterialName(int idx);
00423 int GetMaterialStatus(int idx);
00424 int GetMaterialStatus(vtkStdString name);
00425 void SetMaterialStatus(int idx, int on);
00426 void SetMaterialStatus(vtkStdString name, int flag);
00427
00428 int GetNumberOfAssemblies();
00429 const char* GetAssemblyName(int idx);
00430 int GetAssemblyStatus(int idx);
00431 int GetAssemblyStatus(vtkStdString name);
00432 void SetAssemblyStatus(int idx, int on);
00433 void SetAssemblyStatus(vtkStdString name, int flag);
00434
00435 void SetFastPathObjectType(vtkExodusIIReader::ObjectType type)
00436 {this->FastPathObjectType = type;};
00437 void SetFastPathObjectId(vtkIdType id){this->FastPathObjectId = id;};
00438 vtkSetStringMacro(FastPathIdType);
00439
00440 bool IsXMLMetadataValid();
00441
00449 void GetInitialObjectStatus( int otype, ObjectInfoType *info );
00450
00458 void GetInitialObjectArrayStatus( int otype, ArrayInfoType *info );
00459
00466 void SetInitialObjectStatus( int otype, const char *name, int stat );
00467
00473 void SetInitialObjectArrayStatus( int otype, const char *name, int stat );
00474
00475 int UpdateTimeInformation();
00476
00477 protected:
00478 vtkExodusIIReaderPrivate();
00479 ~vtkExodusIIReaderPrivate();
00480
00483 int VerifyIntegrationPointGlom( int nn,
00484 char** np,
00485 vtksys::RegularExpression& re,
00486 vtkStdString& field,
00487 vtkStdString& ele );
00488
00490 void GlomArrayNames( int i,
00491 int num_obj,
00492 int num_vars,
00493 char** var_names,
00494 int* truth_tab );
00495
00497 void PrepareGeneratedArrayInfo();
00498
00514 int AssembleOutputConnectivity( vtkIdType timeStep,
00515 int otyp, int oidx, int conntypidx, BlockSetInfoType* bsinfop,
00516 vtkUnstructuredGrid* output );
00523 int AssembleOutputPoints( vtkIdType timeStep,
00524 BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00528 int AssembleOutputPointArrays( vtkIdType timeStep,
00529 BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00533 int AssembleOutputCellArrays( vtkIdType timeStep,
00534 int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00539 int AssembleOutputProceduralArrays( vtkIdType timeStep,
00540 int otyp, int oidx, vtkUnstructuredGrid* output );
00542 int AssembleOutputGlobalArrays( vtkIdType timeStep,
00543 int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00550 int AssembleOutputPointMaps( vtkIdType timeStep,
00551 BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00552 int AssembleOutputCellMaps( vtkIdType timeStep,
00553 int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00556 int AssembleArraysOverTime(
00557 int otyp, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00558
00559
00560 void AssembleOutputEdgeDecorations();
00561
00562
00563 void AssembleOutputFaceDecorations();
00564
00566 void InsertBlockCells(
00567 int otyp, int obj, int conn_type, int timeStep, BlockInfoType* binfop );
00568
00570 void InsertSetCells(
00571 int otyp, int obj, int conn_type, int timeStep, SetInfoType* sinfop );
00572
00574 void AddPointArray(
00575 vtkDataArray* src, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00576
00578 void InsertSetNodeCopies(
00579 vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
00580
00582 void InsertSetCellCopies(
00583 vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
00584
00586 void InsertSetSides(
00587 vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
00588
00594 vtkDataArray* GetCacheOrRead( vtkExodusIICacheKey );
00595
00600 int GetConnTypeIndexFromConnType( int ctyp );
00601
00606 int GetObjectTypeIndexFromObjectType( int otyp );
00607
00613 int GetNumberOfObjectsAtTypeIndex( int typeIndex );
00614
00622 ObjectInfoType* GetObjectInfo( int typeIndex, int objectIndex );
00623
00630 ObjectInfoType* GetSortedObjectInfo( int objectType, int objectIndex );
00631
00638 ObjectInfoType* GetUnsortedObjectInfo( int objectType, int objectIndex );
00639
00644 int GetBlockIndexFromFileGlobalId( int otyp, int refId );
00645
00650 BlockInfoType* GetBlockFromFileGlobalId( int otyp, int refId );
00651
00655 vtkIdType GetSqueezePointId( BlockSetInfoType* bsinfop, int i );
00656
00658 void DetermineVtkCellType( BlockInfoType& binfo );
00659
00663 ArrayInfoType* FindArrayInfoByName( int otyp, const char* name );
00664
00668 int IsObjectTypeBlock( int otyp );
00669 int IsObjectTypeSet( int otyp );
00670 int IsObjectTypeMap( int otyp );
00671
00675 int GetObjectTypeFromMapType( int mtyp );
00676 int GetMapTypeFromObjectType( int otyp );
00677 int GetTemporalTypeFromObjectType( int otyp );
00678
00682 int GetSetTypeFromSetConnType( int sctyp );
00683
00687 int GetBlockConnTypeFromBlockType( int btyp );
00688
00694 void RemoveBeginningAndTrailingSpaces( int len, char **names );
00695
00697 void ClearConnectivityCaches();
00698
00702 vtkstd::map<int,vtkstd::vector<BlockInfoType> > BlockInfo;
00706 vtkstd::map<int,vtkstd::vector<SetInfoType> > SetInfo;
00712 vtkstd::map<int,vtkstd::vector<MapInfoType> > MapInfo;
00713
00714 vtkstd::vector<PartInfoType> PartInfo;
00715 vtkstd::vector<MaterialInfoType> MaterialInfo;
00716 vtkstd::vector<AssemblyInfoType> AssemblyInfo;
00717
00722 vtkstd::map<int,vtkstd::vector<int> > SortedObjectIndices;
00724
00725 vtkstd::map<int,vtkstd::vector<ArrayInfoType> > ArrayInfo;
00726
00731 vtkstd::map<int,vtkstd::vector<ArrayInfoType> > InitialArrayInfo;
00732
00737 vtkstd::map<int,vtkstd::vector<ObjectInfoType> > InitialObjectInfo;
00738
00740 int AppWordSize;
00741 int DiskWordSize;
00742
00746 float ExodusVersion;
00747
00749 int Exoid;
00750
00752 struct ex_init_params ModelParameters;
00753
00755 vtkstd::vector<double> Times;
00756
00758 int TimeStep;
00759
00763 double ModeShapeTime;
00764
00765 int GenerateObjectIdArray;
00766 int GenerateGlobalIdArray;
00767 int GenerateFileIdArray;
00768 int GenerateGlobalElementIdArray;
00769 int GenerateGlobalNodeIdArray;
00770
00774 int FileId;
00775
00777 vtkExodusIICache* Cache;
00778
00779 int ApplyDisplacements;
00780 float DisplacementMagnitude;
00781 int HasModeShapes;
00782
00783
00784 int EdgeFieldDecorations;
00785 int FaceFieldDecorations;
00786
00787
00788 vtkPolyData* EdgeDecorationMesh;
00789 vtkPolyData* FaceDecorationMesh;
00790
00802 int SqueezePoints;
00803
00807 vtkExodusIIReader* Parent;
00808
00809 vtkExodusIIXMLParser* Parser;
00810
00811 vtkExodusIIReader::ObjectType FastPathObjectType;
00812 vtkIdType FastPathObjectId;
00813 char* FastPathIdType;
00814
00815 private:
00816 vtkExodusIIReaderPrivate( const vtkExodusIIReaderPrivate& );
00817 void operator = ( const vtkExodusIIReaderPrivate& );
00818 };
00819
00820 #endif // __vtkExodusIIReaderPrivate_h