00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00150 #ifndef __vtkLSDynaReader_h
00151 #define __vtkLSDynaReader_h
00152
00153 #include <vtkMultiBlockDataSetAlgorithm.h>
00154
00155 class vtkLSDynaReaderPrivate;
00156 class vtkPoints;
00157 class vtkDataArray;
00158 class vtkUnstructuredGrid;
00159
00160 class VTK_HYBRID_EXPORT vtkLSDynaReader : public vtkMultiBlockDataSetAlgorithm
00161 {
00162 public:
00163 vtkTypeMacro(vtkLSDynaReader,vtkMultiBlockDataSetAlgorithm);
00164 virtual void PrintSelf(ostream &os, vtkIndent indent);
00165 static vtkLSDynaReader *New();
00166
00167
00175 enum {
00176 PARTICLE = 0,
00177 BEAM = 1,
00178 SHELL = 2,
00179 THICK_SHELL = 3,
00180 SOLID = 4,
00181 RIGID_BODY = 5,
00182 ROAD_SURFACE = 6,
00183 NUM_CELL_TYPES
00184 };
00185
00186
00189 void Dump( ostream &os );
00190
00193 void DebugDump();
00194
00196 int CanReadFile( const char* fname );
00197
00199
00201 virtual void SetDatabaseDirectory( const char* );
00202 const char* GetDatabaseDirectory();
00203 int IsDatabaseValid();
00205
00207
00211 virtual void SetFileName( const char* );
00212 const char* GetFileName();
00214
00219 char* GetTitle();
00220
00224 int GetDimensionality();
00225
00229 vtkIdType GetNumberOfNodes();
00230
00235 vtkIdType GetNumberOfCells();
00236
00243 vtkIdType GetNumberOfContinuumCells();
00244
00248 vtkIdType GetNumberOfSolidCells();
00249
00253 vtkIdType GetNumberOfThickShellCells();
00254
00258 vtkIdType GetNumberOfShellCells();
00259
00263 vtkIdType GetNumberOfRigidBodyCells();
00264
00268 vtkIdType GetNumberOfRoadSurfaceCells();
00269
00273 vtkIdType GetNumberOfBeamCells();
00274
00278 vtkIdType GetNumberOfParticleCells();
00279
00281
00284 vtkIdType GetNumberOfTimeSteps();
00285 virtual void SetTimeStep( vtkIdType );
00286 vtkIdType GetTimeStep();
00287 double GetTimeValue( vtkIdType );
00288 vtkGetVector2Macro(TimeStepRange,int);
00289 vtkSetVector2Macro(TimeStepRange,int);
00291
00293
00295 int GetNumberOfPointArrays();
00296 const char* GetPointArrayName(int);
00297 virtual void SetPointArrayStatus( int arr, int status );
00298 virtual void SetPointArrayStatus( const char* arrName, int status );
00299 int GetPointArrayStatus( int arr );
00300 int GetPointArrayStatus( const char* arrName );
00301 int GetNumberOfComponentsInPointArray( int arr );
00302 int GetNumberOfComponentsInPointArray( const char* arrName );
00304
00306
00310 int GetNumberOfCellArrays( int cellType );
00311 const char* GetCellArrayName( int cellType, int arr );
00312 virtual void SetCellArrayStatus( int cellType, int arr, int status );
00313 virtual void SetCellArrayStatus( int cellType, const char* arrName, int status );
00314 int GetCellArrayStatus( int cellType, int arr );
00315 int GetCellArrayStatus( int cellType, const char* arrName );
00316 int GetNumberOfComponentsInCellArray( int cellType, int arr );
00317 int GetNumberOfComponentsInCellArray( int cellType, const char* arrName );
00319
00321
00323 int GetNumberOfSolidArrays();
00324 const char* GetSolidArrayName(int);
00325 virtual void SetSolidArrayStatus( int arr, int status );
00326 virtual void SetSolidArrayStatus( const char* arrName, int status );
00327 int GetSolidArrayStatus( int arr );
00328 int GetSolidArrayStatus( const char* arrName );
00330
00331 int GetNumberOfComponentsInSolidArray( int a );
00332 int GetNumberOfComponentsInSolidArray( const char* arrName );
00333
00335
00337 int GetNumberOfThickShellArrays();
00338 const char* GetThickShellArrayName(int);
00339 virtual void SetThickShellArrayStatus( int arr, int status );
00340 virtual void SetThickShellArrayStatus( const char* arrName, int status );
00341 int GetThickShellArrayStatus( int arr );
00342 int GetThickShellArrayStatus( const char* arrName );
00344
00345 int GetNumberOfComponentsInThickShellArray( int a );
00346 int GetNumberOfComponentsInThickShellArray( const char* arrName );
00347
00349
00351 int GetNumberOfShellArrays();
00352 const char* GetShellArrayName(int);
00353 virtual void SetShellArrayStatus( int arr, int status );
00354 virtual void SetShellArrayStatus( const char* arrName, int status );
00355 int GetShellArrayStatus( int arr );
00356 int GetShellArrayStatus( const char* arrName );
00358
00359 int GetNumberOfComponentsInShellArray( int a );
00360 int GetNumberOfComponentsInShellArray( const char* arrName );
00361
00363
00365 int GetNumberOfRigidBodyArrays();
00366 const char* GetRigidBodyArrayName(int);
00367 virtual void SetRigidBodyArrayStatus( int arr, int status );
00368 virtual void SetRigidBodyArrayStatus( const char* arrName, int status );
00369 int GetRigidBodyArrayStatus( int arr );
00370 int GetRigidBodyArrayStatus( const char* arrName );
00372
00373 int GetNumberOfComponentsInRigidBodyArray( int a );
00374 int GetNumberOfComponentsInRigidBodyArray( const char* arrName );
00375
00377
00379 int GetNumberOfRoadSurfaceArrays();
00380 const char* GetRoadSurfaceArrayName(int);
00381 virtual void SetRoadSurfaceArrayStatus( int arr, int status );
00382 virtual void SetRoadSurfaceArrayStatus( const char* arrName, int status );
00383 int GetRoadSurfaceArrayStatus( int arr );
00384 int GetRoadSurfaceArrayStatus( const char* arrName );
00386
00387 int GetNumberOfComponentsInRoadSurfaceArray( int a );
00388 int GetNumberOfComponentsInRoadSurfaceArray( const char* arrName );
00389
00391
00393 int GetNumberOfBeamArrays();
00394 const char* GetBeamArrayName(int);
00395 virtual void SetBeamArrayStatus( int arr, int status );
00396 virtual void SetBeamArrayStatus( const char* arrName, int status );
00397 int GetBeamArrayStatus( int arr );
00398 int GetBeamArrayStatus( const char* arrName );
00400
00401 int GetNumberOfComponentsInBeamArray( int a );
00402 int GetNumberOfComponentsInBeamArray( const char* arrName );
00403
00405
00407 int GetNumberOfParticleArrays();
00408 const char* GetParticleArrayName(int);
00409 virtual void SetParticleArrayStatus( int arr, int status );
00410 virtual void SetParticleArrayStatus( const char* arrName, int status );
00411 int GetParticleArrayStatus( int arr );
00412 int GetParticleArrayStatus( const char* arrName );
00414
00415 int GetNumberOfComponentsInParticleArray( int a );
00416 int GetNumberOfComponentsInParticleArray( const char* arrName );
00417
00419
00422 vtkSetMacro(DeformedMesh,int);
00423 vtkGetMacro(DeformedMesh,int);
00424 vtkBooleanMacro(DeformedMesh,int);
00426
00428
00436 vtkSetMacro(RemoveDeletedCells,int);
00437 vtkGetMacro(RemoveDeletedCells,int);
00438 vtkBooleanMacro(RemoveDeletedCells,int);
00440
00442
00445 vtkSetMacro(SplitByMaterialId,int);
00446 vtkGetMacro(SplitByMaterialId,int);
00447 vtkBooleanMacro(SplitByMaterialId,int);
00449
00451
00460 vtkSetStringMacro(InputDeck);
00461 vtkGetStringMacro(InputDeck);
00463
00465
00473 int GetNumberOfPartArrays();
00474 const char* GetPartArrayName(int);
00475 virtual void SetPartArrayStatus( int arr, int status );
00476 virtual void SetPartArrayStatus( const char* partName, int status );
00477 int GetPartArrayStatus( int arr );
00478 int GetPartArrayStatus( const char* partName );
00480
00481 protected:
00482
00483 vtkUnstructuredGrid* OutputParticles;
00484 vtkUnstructuredGrid* OutputBeams;
00485 vtkUnstructuredGrid* OutputShell;
00486 vtkUnstructuredGrid* OutputThickShell;
00487 vtkUnstructuredGrid* OutputSolid;
00488 vtkUnstructuredGrid* OutputRigidBody;
00489 vtkUnstructuredGrid* OutputRoadSurface;
00490
00493 int DeformedMesh;
00494
00497 int RemoveDeletedCells;
00498
00500 int SplitByMaterialId;
00501
00504 int TimeStepRange[2];
00505
00507 char* InputDeck;
00508
00509 vtkLSDynaReader();
00510 virtual ~vtkLSDynaReader();
00511
00518 int ReadHeaderInformation( int currentAdaptLevel );
00519
00527 int ScanDatabaseTimeSteps();
00528
00529 virtual int RequestInformation( vtkInformation*, vtkInformationVector**, vtkInformationVector* );
00530 virtual int RequestData( vtkInformation*, vtkInformationVector**, vtkInformationVector* );
00531
00533
00539 virtual int ReadNodes();
00540 virtual int ReadConnectivityAndMaterial();
00541 virtual int ReadUserIds();
00542 virtual int ReadState( vtkIdType );
00543 virtual int ReadDeletion();
00544 virtual int ReadSPHState( vtkIdType );
00546
00549 virtual int ReadInputDeck();
00550
00554 virtual int ReadUserMaterialIds();
00555
00557
00559 int ReadInputDeckXML( ifstream& deck );
00560 int ReadInputDeckKeywords( ifstream& deck );
00562
00565 int WriteInputDeckSummary( const char* fname );
00566
00567 void PartFilter( vtkMultiBlockDataSet* mbds, int celltype );
00575 virtual int ReadDeletionArray( vtkDataArray* arr, int& anyDeleted );
00576
00577 private:
00578 vtkLSDynaReader( const vtkLSDynaReader& );
00579 void operator = ( const vtkLSDynaReader& );
00580
00581 vtkLSDynaReaderPrivate* P;
00582 };
00583
00584 inline void vtkLSDynaReader::SetPointArrayStatus( const char* arrName, int status )
00585 {
00586 for ( int a=0; a<this->GetNumberOfPointArrays(); ++a )
00587 {
00588 if ( strcmp( arrName, this->GetPointArrayName(a) ) == 0 )
00589 {
00590 this->SetPointArrayStatus( a, status );
00591 return;
00592 }
00593 }
00594 vtkWarningMacro( "Point array \"" << arrName << "\" does not exist" );
00595 }
00596
00597 inline int vtkLSDynaReader::GetPointArrayStatus( const char* arrName )
00598 {
00599 for ( int a=0; a<this->GetNumberOfPointArrays(); ++a )
00600 {
00601 if ( strcmp( arrName, this->GetPointArrayName(a) ) == 0 )
00602 {
00603 return this->GetPointArrayStatus( a );
00604 }
00605 }
00606
00607 return 0;
00608 }
00609
00610 inline int vtkLSDynaReader::GetNumberOfComponentsInPointArray( const char* arrName )
00611 {
00612 for ( int a=0; a<this->GetNumberOfPointArrays(); ++a )
00613 {
00614 if ( strcmp( arrName, this->GetPointArrayName( a ) ) == 0 )
00615 {
00616 return this->GetNumberOfComponentsInPointArray( a );
00617 }
00618 }
00619
00620 return 0;
00621 }
00622
00623 inline void vtkLSDynaReader::SetCellArrayStatus( int cellType, const char* arrName, int status )
00624 {
00625 for ( int a=0; a<this->GetNumberOfCellArrays( cellType ); ++a )
00626 {
00627 if ( strcmp( arrName, this->GetCellArrayName( cellType, a ) ) == 0 )
00628 {
00629 this->SetCellArrayStatus( cellType, a, status );
00630 return;
00631 }
00632 }
00633 vtkWarningMacro( "Cell array \"" << arrName << "\" (type " << cellType << ") does not exist" );
00634 }
00635
00636 inline int vtkLSDynaReader::GetCellArrayStatus( int cellType, const char* arrName )
00637 {
00638 for ( int a=0; a<this->GetNumberOfCellArrays( cellType ); ++a )
00639 {
00640 if ( strcmp( arrName, this->GetCellArrayName( cellType, a ) ) == 0 )
00641 {
00642 return this->GetCellArrayStatus( cellType, a );
00643 }
00644 }
00645
00646 return 0;
00647 }
00648
00649 inline int vtkLSDynaReader::GetNumberOfComponentsInCellArray( int cellType, const char* arrName )
00650 {
00651 for ( int a=0; a<this->GetNumberOfCellArrays( cellType ); ++a )
00652 {
00653 if ( strcmp( arrName, this->GetCellArrayName( cellType, a ) ) == 0 )
00654 {
00655 return this->GetNumberOfComponentsInCellArray( cellType, a );
00656 }
00657 }
00658
00659 return 0;
00660 }
00661
00662 inline void vtkLSDynaReader::SetSolidArrayStatus( const char* arrName, int status )
00663 {
00664 for ( int a=0; a<this->GetNumberOfSolidArrays(); ++a )
00665 {
00666 if ( strcmp( arrName, this->GetSolidArrayName(a) ) == 0 )
00667 {
00668 this->SetSolidArrayStatus( a, status );
00669 return;
00670 }
00671 }
00672 vtkWarningMacro( "Solid array \"" << arrName << "\" does not exist" );
00673 }
00674
00675 inline int vtkLSDynaReader::GetSolidArrayStatus( const char* arrName )
00676 {
00677 for ( int a=0; a<this->GetNumberOfSolidArrays(); ++a )
00678 {
00679 if ( strcmp( arrName, this->GetSolidArrayName(a) ) == 0 )
00680 {
00681 return this->GetSolidArrayStatus( a );
00682 }
00683 }
00684
00685 return 0;
00686 }
00687
00688 inline int vtkLSDynaReader::GetNumberOfComponentsInSolidArray( const char* arrName )
00689 {
00690 for ( int a=0; a<this->GetNumberOfSolidArrays(); ++a )
00691 {
00692 if ( strcmp( arrName, this->GetSolidArrayName(a) ) == 0 )
00693 {
00694 return this->GetNumberOfComponentsInSolidArray( a );
00695 }
00696 }
00697
00698 return 0;
00699 }
00700
00701 inline void vtkLSDynaReader::SetThickShellArrayStatus( const char* arrName, int status )
00702 {
00703 for ( int a=0; a<this->GetNumberOfThickShellArrays(); ++a )
00704 {
00705 if ( strcmp( arrName, this->GetThickShellArrayName(a) ) == 0 )
00706 {
00707 this->SetThickShellArrayStatus( a, status );
00708 return;
00709 }
00710 }
00711 vtkWarningMacro( "Thick shell array \"" << arrName << "\" does not exist" );
00712 }
00713
00714 inline int vtkLSDynaReader::GetThickShellArrayStatus( const char* arrName )
00715 {
00716 for ( int a=0; a<this->GetNumberOfThickShellArrays(); ++a )
00717 {
00718 if ( strcmp( arrName, this->GetThickShellArrayName(a) ) == 0 )
00719 {
00720 return this->GetThickShellArrayStatus( a );
00721 }
00722 }
00723
00724 return 0;
00725 }
00726
00727 inline int vtkLSDynaReader::GetNumberOfComponentsInThickShellArray( const char* arrName )
00728 {
00729 for ( int a=0; a<this->GetNumberOfThickShellArrays(); ++a )
00730 {
00731 if ( strcmp( arrName, this->GetThickShellArrayName(a) ) == 0 )
00732 {
00733 return this->GetNumberOfComponentsInThickShellArray( a );
00734 }
00735 }
00736
00737 return 0;
00738 }
00739
00740 inline void vtkLSDynaReader::SetShellArrayStatus( const char* arrName, int status )
00741 {
00742 for ( int a=0; a<this->GetNumberOfShellArrays(); ++a )
00743 {
00744 if ( strcmp( arrName, this->GetShellArrayName(a) ) == 0 )
00745 {
00746 this->SetShellArrayStatus( a, status );
00747 return;
00748 }
00749 }
00750 vtkWarningMacro( "Shell array \"" << arrName << "\" does not exist" );
00751 }
00752
00753 inline int vtkLSDynaReader::GetShellArrayStatus( const char* arrName )
00754 {
00755 for ( int a=0; a<this->GetNumberOfShellArrays(); ++a )
00756 {
00757 if ( strcmp( arrName, this->GetShellArrayName(a) ) == 0 )
00758 {
00759 return this->GetShellArrayStatus( a );
00760 }
00761 }
00762
00763 return 0;
00764 }
00765
00766 inline int vtkLSDynaReader::GetNumberOfComponentsInShellArray( const char* arrName )
00767 {
00768 for ( int a=0; a<this->GetNumberOfShellArrays(); ++a )
00769 {
00770 if ( strcmp( arrName, this->GetShellArrayName(a) ) == 0 )
00771 {
00772 return this->GetNumberOfComponentsInShellArray( a );
00773 }
00774 }
00775
00776 return 0;
00777 }
00778
00779 inline void vtkLSDynaReader::SetBeamArrayStatus( const char* arrName, int status )
00780 {
00781 for ( int a=0; a<this->GetNumberOfBeamArrays(); ++a )
00782 {
00783 if ( strcmp( arrName, this->GetBeamArrayName(a) ) == 0 )
00784 {
00785 this->SetBeamArrayStatus( a, status );
00786 return;
00787 }
00788 }
00789 vtkWarningMacro( "Beam array \"" << arrName << "\" does not exist" );
00790 }
00791
00792 inline int vtkLSDynaReader::GetBeamArrayStatus( const char* arrName )
00793 {
00794 for ( int a=0; a<this->GetNumberOfBeamArrays(); ++a )
00795 {
00796 if ( strcmp( arrName, this->GetBeamArrayName(a) ) == 0 )
00797 {
00798 return this->GetBeamArrayStatus( a );
00799 }
00800 }
00801
00802 return 0;
00803 }
00804
00805 inline int vtkLSDynaReader::GetNumberOfComponentsInBeamArray( const char* arrName )
00806 {
00807 for ( int a=0; a<this->GetNumberOfBeamArrays(); ++a )
00808 {
00809 if ( strcmp( arrName, this->GetBeamArrayName(a) ) == 0 )
00810 {
00811 return this->GetNumberOfComponentsInBeamArray( a );
00812 }
00813 }
00814
00815 return 0;
00816 }
00817
00818 inline void vtkLSDynaReader::SetParticleArrayStatus( const char* arrName, int status )
00819 {
00820 for ( int a=0; a<this->GetNumberOfParticleArrays(); ++a )
00821 {
00822 if ( strcmp( arrName, this->GetParticleArrayName(a) ) == 0 )
00823 {
00824 this->SetParticleArrayStatus( a, status );
00825 return;
00826 }
00827 }
00828 vtkWarningMacro( "Particle array \"" << arrName << "\" does not exist" );
00829 }
00830
00831 inline int vtkLSDynaReader::GetParticleArrayStatus( const char* arrName )
00832 {
00833 for ( int a=0; a<this->GetNumberOfParticleArrays(); ++a )
00834 {
00835 if ( strcmp( arrName, this->GetParticleArrayName(a) ) == 0 )
00836 {
00837 return this->GetParticleArrayStatus( a );
00838 }
00839 }
00840
00841 return 0;
00842 }
00843
00844 inline int vtkLSDynaReader::GetNumberOfComponentsInParticleArray( const char* arrName )
00845 {
00846 for ( int a=0; a<this->GetNumberOfParticleArrays(); ++a )
00847 {
00848 if ( strcmp( arrName, this->GetParticleArrayName(a) ) == 0 )
00849 {
00850 return this->GetNumberOfComponentsInParticleArray( a );
00851 }
00852 }
00853
00854 return 0;
00855 }
00856
00857 inline void vtkLSDynaReader::SetRigidBodyArrayStatus( const char* arrName, int status )
00858 {
00859 for ( int a=0; a<this->GetNumberOfRigidBodyArrays(); ++a )
00860 {
00861 if ( strcmp( arrName, this->GetRigidBodyArrayName(a) ) == 0 )
00862 {
00863 this->SetRigidBodyArrayStatus( a, status );
00864 return;
00865 }
00866 }
00867 vtkWarningMacro( "Rigid body array \"" << arrName << "\" does not exist" );
00868 }
00869
00870 inline int vtkLSDynaReader::GetRigidBodyArrayStatus( const char* arrName )
00871 {
00872 for ( int a=0; a<this->GetNumberOfRigidBodyArrays(); ++a )
00873 {
00874 if ( strcmp( arrName, this->GetRigidBodyArrayName(a) ) == 0 )
00875 {
00876 return this->GetRigidBodyArrayStatus( a );
00877 }
00878 }
00879
00880 return 0;
00881 }
00882
00883 inline int vtkLSDynaReader::GetNumberOfComponentsInRigidBodyArray( const char* arrName )
00884 {
00885 for ( int a=0; a<this->GetNumberOfRigidBodyArrays(); ++a )
00886 {
00887 if ( strcmp( arrName, this->GetRigidBodyArrayName(a) ) == 0 )
00888 {
00889 return this->GetNumberOfComponentsInRigidBodyArray( a );
00890 }
00891 }
00892
00893 return 0;
00894 }
00895
00896 inline void vtkLSDynaReader::SetRoadSurfaceArrayStatus( const char* arrName, int status )
00897 {
00898 for ( int a=0; a<this->GetNumberOfRoadSurfaceArrays(); ++a )
00899 {
00900 if ( strcmp( arrName, this->GetRoadSurfaceArrayName(a) ) == 0 )
00901 {
00902 this->SetRoadSurfaceArrayStatus( a, status );
00903 return;
00904 }
00905 }
00906 vtkWarningMacro( "Road surface array \"" << arrName << "\" does not exist" );
00907 }
00908
00909 inline int vtkLSDynaReader::GetRoadSurfaceArrayStatus( const char* arrName )
00910 {
00911 for ( int a=0; a<this->GetNumberOfRoadSurfaceArrays(); ++a )
00912 {
00913 if ( strcmp( arrName, this->GetRoadSurfaceArrayName(a) ) == 0 )
00914 {
00915 return this->GetRoadSurfaceArrayStatus( a );
00916 }
00917 }
00918
00919 return 0;
00920 }
00921
00922 inline int vtkLSDynaReader::GetNumberOfComponentsInRoadSurfaceArray( const char* arrName )
00923 {
00924 for ( int a=0; a<this->GetNumberOfRoadSurfaceArrays(); ++a )
00925 {
00926 if ( strcmp( arrName, this->GetRoadSurfaceArrayName(a) ) == 0 )
00927 {
00928 return this->GetNumberOfComponentsInRoadSurfaceArray( a );
00929 }
00930 }
00931
00932 return 0;
00933 }
00934
00935 inline void vtkLSDynaReader::SetPartArrayStatus( const char* arrName, int status )
00936 {
00937 for ( int a=0; a<this->GetNumberOfPartArrays(); ++a )
00938 {
00939 if ( strcmp( arrName, this->GetPartArrayName(a) ) == 0 )
00940 {
00941 this->SetPartArrayStatus( a, status );
00942 return;
00943 }
00944 }
00945 vtkWarningMacro( "Part \"" << arrName << "\" does not exist" );
00946 }
00947
00948 inline int vtkLSDynaReader::GetPartArrayStatus( const char* partName )
00949 {
00950 for ( int a=0; a<this->GetNumberOfPartArrays(); ++a )
00951 {
00952 if ( strcmp( partName, this->GetPartArrayName(a) ) == 0 )
00953 {
00954 return this->GetPartArrayStatus( a );
00955 }
00956 }
00957
00958 return 0;
00959 }
00960
00961 #endif // __vtkLSDynaReader_h