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 vtkExodusIIReaderParser;
00023 class vtkMutableDirectedGraph;
00024
00028 class vtkExodusIIReaderPrivate : public vtkObject
00029 {
00030 public:
00031 static vtkExodusIIReaderPrivate* New();
00032 void PrintData( ostream& os, vtkIndent indent );
00033 vtkTypeRevisionMacro(vtkExodusIIReaderPrivate,vtkObject);
00034
00035
00037 int OpenFile( const char* filename );
00038
00040 int CloseFile();
00041
00043 int RequestInformation();
00044
00046 vtkMutableDirectedGraph* GetSIL()
00047 { return this->SIL; }
00048
00050 void Broadcast( vtkMultiProcessController* controller );
00051
00053 void Receive( vtkMultiProcessController* controller );
00054
00056 int RequestData( vtkIdType timeStep, vtkMultiBlockDataSet* output );
00057
00058
00059
00060
00061 int SetUpEmptyGrid( vtkMultiBlockDataSet* output );
00062
00074 void Reset();
00075
00080 void ResetSettings();
00081
00083 void ResetCache();
00084
00089 int GetNumberOfTimeSteps() { return (int) this->Times.size(); }
00090
00092 vtkGetMacro(TimeStep,int);
00093
00095 vtkSetMacro(TimeStep,int);
00096
00099 vtkGetMacro(SqueezePoints,int);
00100
00103 void SetSqueezePoints( int sp );
00104
00107 vtkBooleanMacro(SqueezePoints,int);
00108
00110 int GetNumberOfNodes();
00111
00116 int GetNumberOfObjectsOfType( int otype );
00117
00128 int GetNumberOfObjectArraysOfType( int otype );
00129
00134 const char* GetObjectName( int otype, int i );
00135
00140 int GetObjectId( int otype, int i );
00141
00148 int GetObjectSize( int otype, int i );
00149
00154 int GetObjectStatus( int otype, int i );
00155
00161 int GetUnsortedObjectStatus( int otype, int i );
00162
00167 void SetObjectStatus( int otype, int i, int stat );
00168
00174 void SetUnsortedObjectStatus( int otype, int i, int stat );
00175
00180 const char* GetObjectArrayName( int otype, int i );
00181
00186 int GetNumberOfObjectArrayComponents( int otype, int i );
00187
00192 int GetObjectArrayStatus( int otype, int i );
00193
00198 void SetObjectArrayStatus( int otype, int i, int stat );
00199
00206 int GetNumberOfObjectAttributes( int objectType, int objectIndex );
00207 const char* GetObjectAttributeName( int objectType,
00208 int objectIndex,
00209 int attributeIndex );
00210 int GetObjectAttributeIndex( int objectType,
00211 int objectIndex,
00212 const char* attribName );
00213 int GetObjectAttributeStatus( int objectType,
00214 int objectIndex,
00215 int attribIndex );
00216 void SetObjectAttributeStatus( int objectType,
00217 int objectIndex,
00218 int attribIndex, int status );
00219
00221 vtkGetMacro(GenerateObjectIdArray,int);
00222 vtkSetMacro(GenerateObjectIdArray,int);
00223 static const char* GetObjectIdArrayName() { return "ObjectId"; }
00224
00225 vtkSetMacro(GenerateGlobalElementIdArray,int);
00226 vtkGetMacro(GenerateGlobalElementIdArray,int);
00227 static const char* GetGlobalElementIdArrayName() { return "GlobalElementId"; }
00228
00229 vtkSetMacro(GenerateGlobalNodeIdArray,int);
00230 vtkGetMacro(GenerateGlobalNodeIdArray,int);
00231 static const char* GetGlobalNodeIdArrayName() { return "GlobalNodeId"; }
00232
00236 vtkSetMacro(GenerateFileIdArray,int);
00237 vtkGetMacro(GenerateFileIdArray,int);
00238 static const char* GetFileIdArrayName() { return "FileId"; }
00239
00241 vtkSetMacro(FileId,int);
00242 vtkGetMacro(FileId,int);
00243
00244 static const char *GetGlobalVariableValuesArrayName()
00245 { return "GlobalVariableValues"; }
00246 static const char *GetGlobalVariableNamesArrayName()
00247 { return "GlobalVariableNames"; }
00248
00249 virtual void SetApplyDisplacements( int d );
00250 vtkGetMacro(ApplyDisplacements,int);
00251
00252 virtual void SetDisplacementMagnitude( double s );
00253 vtkGetMacro(DisplacementMagnitude,double);
00254
00255 vtkSetMacro(HasModeShapes,int);
00256 vtkGetMacro(HasModeShapes,int);
00257
00258 vtkSetMacro(ModeShapeTime,double);
00259 vtkGetMacro(ModeShapeTime,double);
00260
00261 vtkDataArray* FindDisplacementVectors( int timeStep );
00262
00263 vtkSetMacro(EdgeFieldDecorations,int);
00264 vtkGetMacro(EdgeFieldDecorations,int);
00265
00266 vtkSetMacro(FaceFieldDecorations,int);
00267 vtkGetMacro(FaceFieldDecorations,int);
00268
00269 const struct ex_init_params* GetModelParams() const
00270 { return &this->ModelParameters; }
00271
00273 struct ArrayInfoType {
00275 vtkStdString Name;
00277 int Components;
00284 int GlomType;
00287 int StorageType;
00289 int Source;
00291 int Status;
00294 vtkstd::vector<vtkStdString> OriginalNames;
00297 vtkstd::vector<int> OriginalIndices;
00306 vtkstd::vector<int> ObjectTruth;
00308 void Reset();
00309 };
00310
00312 struct ObjectInfoType {
00314 int Size;
00316 int Status;
00318 int Id;
00320 vtkStdString Name;
00321 };
00322
00324 struct MapInfoType : public ObjectInfoType {
00325 };
00326
00329 struct BlockSetInfoType : public ObjectInfoType {
00331 vtkIdType FileOffset;
00336 vtkstd::map<vtkIdType,vtkIdType> PointMap;
00341 vtkstd::map<vtkIdType,vtkIdType> ReversePointMap;
00345 vtkIdType NextSqueezePoint;
00347 vtkUnstructuredGrid* CachedConnectivity;
00348
00349 BlockSetInfoType() { this->CachedConnectivity = 0; }
00350 };
00351
00353 struct BlockInfoType : public BlockSetInfoType {
00354 vtkStdString OriginalName;
00355 vtkStdString TypeName;
00356
00357
00358 int BdsPerEntry[3];
00359 int AttributesPerEntry;
00360 vtkstd::vector<vtkStdString> AttributeNames;
00361 vtkstd::vector<int> AttributeStatus;
00362
00363 int CellType;
00364
00365
00366 int PointsPerCell;
00367 };
00368
00370 struct PartInfoType : public ObjectInfoType {
00371 vtkstd::vector<int> BlockIndices;
00372 };
00373 struct AssemblyInfoType : public ObjectInfoType {
00374 vtkstd::vector<int> BlockIndices;
00375 };
00376 struct MaterialInfoType : public ObjectInfoType {
00377 vtkstd::vector<int> BlockIndices;
00378 };
00379
00381 struct SetInfoType : public BlockSetInfoType {
00382 int DistFact;
00383
00384 };
00385
00388 enum GlomTypes {
00389 Scalar=0,
00390 Vector2=1,
00391 Vector3=2,
00392 SymmetricTensor=3,
00393
00394 IntegrationPoint=4
00395 };
00396
00398 enum ArraySourceTypes {
00399 Result=0,
00400
00401 Attribute=1,
00402
00403 Map=2,
00404 Generated=3
00405 };
00406
00408 vtkTimeStamp InformationTimeStamp;
00409
00410 friend class vtkExodusIIReader;
00411
00412 virtual void SetParser( vtkExodusIIReaderParser* );
00413 vtkGetObjectMacro(Parser,vtkExodusIIReaderParser);
00414
00415
00416
00417
00418
00419 int GetNumberOfParts();
00420 const char* GetPartName(int idx);
00421 const char* GetPartBlockInfo(int idx);
00422 int GetPartStatus(int idx);
00423 int GetPartStatus(vtkStdString name);
00424 void SetPartStatus(int idx, int on);
00425 void SetPartStatus(vtkStdString name, int flag);
00426
00427 int GetNumberOfMaterials();
00428 const char* GetMaterialName(int idx);
00429 int GetMaterialStatus(int idx);
00430 int GetMaterialStatus(vtkStdString name);
00431 void SetMaterialStatus(int idx, int on);
00432 void SetMaterialStatus(vtkStdString name, int flag);
00433
00434 int GetNumberOfAssemblies();
00435 const char* GetAssemblyName(int idx);
00436 int GetAssemblyStatus(int idx);
00437 int GetAssemblyStatus(vtkStdString name);
00438 void SetAssemblyStatus(int idx, int on);
00439 void SetAssemblyStatus(vtkStdString name, int flag);
00440
00441 void SetFastPathObjectType(vtkExodusIIReader::ObjectType type)
00442 {this->FastPathObjectType = type;};
00443 void SetFastPathObjectId(vtkIdType id){this->FastPathObjectId = id;};
00444 vtkSetStringMacro(FastPathIdType);
00445
00446 bool IsXMLMetadataValid();
00447
00455 void GetInitialObjectStatus( int otype, ObjectInfoType *info );
00456
00464 void GetInitialObjectArrayStatus( int otype, ArrayInfoType *info );
00465
00472 void SetInitialObjectStatus( int otype, const char *name, int stat );
00473
00479 void SetInitialObjectArrayStatus( int otype, const char *name, int stat );
00480
00481 int UpdateTimeInformation();
00482
00483 protected:
00484 vtkExodusIIReaderPrivate();
00485 ~vtkExodusIIReaderPrivate();
00486
00488 void BuildSIL();
00489
00492 int VerifyIntegrationPointGlom( int nn,
00493 char** np,
00494 vtksys::RegularExpression& re,
00495 vtkStdString& field,
00496 vtkStdString& ele );
00497
00499 void GlomArrayNames( int i,
00500 int num_obj,
00501 int num_vars,
00502 char** var_names,
00503 int* truth_tab );
00504
00506 void PrepareGeneratedArrayInfo();
00507
00523 int AssembleOutputConnectivity( vtkIdType timeStep,
00524 int otyp, int oidx, int conntypidx, BlockSetInfoType* bsinfop,
00525 vtkUnstructuredGrid* output );
00532 int AssembleOutputPoints( vtkIdType timeStep,
00533 BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00537 int AssembleOutputPointArrays( vtkIdType timeStep,
00538 BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00542 int AssembleOutputCellArrays( vtkIdType timeStep,
00543 int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00548 int AssembleOutputProceduralArrays( vtkIdType timeStep,
00549 int otyp, int oidx, vtkUnstructuredGrid* output );
00551 int AssembleOutputGlobalArrays( vtkIdType timeStep,
00552 int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00559 int AssembleOutputPointMaps( vtkIdType timeStep,
00560 BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00561 int AssembleOutputCellMaps( vtkIdType timeStep,
00562 int otyp, int oidx, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00565 int AssembleArraysOverTime(vtkMultiBlockDataSet* output);
00566
00567
00568 void AssembleOutputEdgeDecorations();
00569
00570
00571 void AssembleOutputFaceDecorations();
00572
00574 void InsertBlockCells(
00575 int otyp, int obj, int conn_type, int timeStep, BlockInfoType* binfop );
00576
00578 void InsertSetCells(
00579 int otyp, int obj, int conn_type, int timeStep, SetInfoType* sinfop );
00580
00582 void AddPointArray(
00583 vtkDataArray* src, BlockSetInfoType* bsinfop, vtkUnstructuredGrid* output );
00584
00586 void InsertSetNodeCopies(
00587 vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
00588
00590 void InsertSetCellCopies(
00591 vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
00592
00594 void InsertSetSides(
00595 vtkIntArray* refs, int otyp, int obj, SetInfoType* sinfo );
00596
00602 vtkDataArray* GetCacheOrRead( vtkExodusIICacheKey );
00603
00608 int GetConnTypeIndexFromConnType( int ctyp );
00609
00614 int GetObjectTypeIndexFromObjectType( int otyp );
00615
00621 int GetNumberOfObjectsAtTypeIndex( int typeIndex );
00622
00630 ObjectInfoType* GetObjectInfo( int typeIndex, int objectIndex );
00631
00638 ObjectInfoType* GetSortedObjectInfo( int objectType, int objectIndex );
00639
00646 ObjectInfoType* GetUnsortedObjectInfo( int objectType, int objectIndex );
00647
00652 int GetBlockIndexFromFileGlobalId( int otyp, int refId );
00653
00658 BlockInfoType* GetBlockFromFileGlobalId( int otyp, int refId );
00659
00663 vtkIdType GetSqueezePointId( BlockSetInfoType* bsinfop, int i );
00664
00666 void DetermineVtkCellType( BlockInfoType& binfo );
00667
00671 ArrayInfoType* FindArrayInfoByName( int otyp, const char* name );
00672
00676 int IsObjectTypeBlock( int otyp );
00677 int IsObjectTypeSet( int otyp );
00678 int IsObjectTypeMap( int otyp );
00679
00683 int GetObjectTypeFromMapType( int mtyp );
00684 int GetMapTypeFromObjectType( int otyp );
00685 int GetTemporalTypeFromObjectType( int otyp );
00686
00690 int GetSetTypeFromSetConnType( int sctyp );
00691
00695 int GetBlockConnTypeFromBlockType( int btyp );
00696
00702 void RemoveBeginningAndTrailingSpaces( int len, char **names );
00703
00705 void ClearConnectivityCaches();
00706
00710 vtkstd::map<int,vtkstd::vector<BlockInfoType> > BlockInfo;
00714 vtkstd::map<int,vtkstd::vector<SetInfoType> > SetInfo;
00720 vtkstd::map<int,vtkstd::vector<MapInfoType> > MapInfo;
00721
00722 vtkstd::vector<PartInfoType> PartInfo;
00723 vtkstd::vector<MaterialInfoType> MaterialInfo;
00724 vtkstd::vector<AssemblyInfoType> AssemblyInfo;
00725
00730 vtkstd::map<int,vtkstd::vector<int> > SortedObjectIndices;
00732
00733 vtkstd::map<int,vtkstd::vector<ArrayInfoType> > ArrayInfo;
00734
00739 vtkstd::map<int,vtkstd::vector<ArrayInfoType> > InitialArrayInfo;
00740
00745 vtkstd::map<int,vtkstd::vector<ObjectInfoType> > InitialObjectInfo;
00746
00748 int AppWordSize;
00749 int DiskWordSize;
00750
00754 float ExodusVersion;
00755
00757 int Exoid;
00758
00760 struct ex_init_params ModelParameters;
00761
00763 vtkstd::vector<double> Times;
00764
00766 int TimeStep;
00767
00771 double ModeShapeTime;
00772
00773 int GenerateObjectIdArray;
00774 int GenerateGlobalIdArray;
00775 int GenerateFileIdArray;
00776 int GenerateGlobalElementIdArray;
00777 int GenerateGlobalNodeIdArray;
00778
00782 int FileId;
00783
00785 vtkExodusIICache* Cache;
00786
00787 int ApplyDisplacements;
00788 float DisplacementMagnitude;
00789 int HasModeShapes;
00790
00791
00792 int EdgeFieldDecorations;
00793 int FaceFieldDecorations;
00794
00795
00796 vtkPolyData* EdgeDecorationMesh;
00797 vtkPolyData* FaceDecorationMesh;
00798
00810 int SqueezePoints;
00811
00815 vtkExodusIIReader* Parent;
00816
00817 vtkExodusIIReaderParser* Parser;
00818
00819 vtkExodusIIReader::ObjectType FastPathObjectType;
00820 vtkIdType FastPathObjectId;
00821 char* FastPathIdType;
00822
00823 vtkMutableDirectedGraph* SIL;
00824 private:
00825 vtkExodusIIReaderPrivate( const vtkExodusIIReaderPrivate& );
00826 void operator = ( const vtkExodusIIReaderPrivate& );
00827 };
00828
00829 #endif // __vtkExodusIIReaderPrivate_h