VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkMeshQuality.h 00005 Language: C++ 00006 00007 Copyright 2003-2006 Sandia Corporation. 00008 Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00009 license for use of this work by or on behalf of the 00010 U.S. Government. Redistribution and use in source and binary forms, with 00011 or without modification, are permitted provided that this Notice and any 00012 statement of authorship are reproduced on all copies. 00013 00014 Contact: dcthomp@sandia.gov,pppebay@sandia.gov 00015 00016 =========================================================================*/ 00067 #ifndef __vtkMeshQuality_h 00068 #define __vtkMeshQuality_h 00069 00070 #include "vtkFiltersVerdictModule.h" // For export macro 00071 #include "vtkDataSetAlgorithm.h" 00072 00073 class vtkCell; 00074 class vtkDataArray; 00075 00076 #define VTK_QUALITY_EDGE_RATIO 0 00077 #define VTK_QUALITY_ASPECT_RATIO 1 00078 #define VTK_QUALITY_RADIUS_RATIO 2 00079 #define VTK_QUALITY_ASPECT_FROBENIUS 3 00080 #define VTK_QUALITY_MED_ASPECT_FROBENIUS 4 00081 #define VTK_QUALITY_MAX_ASPECT_FROBENIUS 5 00082 #define VTK_QUALITY_MIN_ANGLE 6 00083 #define VTK_QUALITY_COLLAPSE_RATIO 7 00084 #define VTK_QUALITY_MAX_ANGLE 8 00085 #define VTK_QUALITY_CONDITION 9 00086 #define VTK_QUALITY_SCALED_JACOBIAN 10 00087 #define VTK_QUALITY_SHEAR 11 00088 #define VTK_QUALITY_RELATIVE_SIZE_SQUARED 12 00089 #define VTK_QUALITY_SHAPE 13 00090 #define VTK_QUALITY_SHAPE_AND_SIZE 14 00091 #define VTK_QUALITY_DISTORTION 15 00092 #define VTK_QUALITY_MAX_EDGE_RATIO 16 00093 #define VTK_QUALITY_SKEW 17 00094 #define VTK_QUALITY_TAPER 18 00095 #define VTK_QUALITY_VOLUME 19 00096 #define VTK_QUALITY_STRETCH 20 00097 #define VTK_QUALITY_DIAGONAL 21 00098 #define VTK_QUALITY_DIMENSION 22 00099 #define VTK_QUALITY_ODDY 23 00100 #define VTK_QUALITY_SHEAR_AND_SIZE 24 00101 #define VTK_QUALITY_JACOBIAN 25 00102 #define VTK_QUALITY_WARPAGE 26 00103 #define VTK_QUALITY_ASPECT_GAMMA 27 00104 #define VTK_QUALITY_AREA 28 00105 #define VTK_QUALITY_ASPECT_BETA 29 00106 00107 class VTKFILTERSVERDICT_EXPORT vtkMeshQuality : public vtkDataSetAlgorithm 00108 { 00109 public: 00110 void PrintSelf(ostream& os, vtkIndent indent); 00111 vtkTypeMacro(vtkMeshQuality,vtkDataSetAlgorithm); 00112 static vtkMeshQuality* New(); 00113 00115 00118 vtkSetMacro(SaveCellQuality,int); 00119 vtkGetMacro(SaveCellQuality,int); 00120 vtkBooleanMacro(SaveCellQuality,int); 00122 00124 00132 vtkSetMacro(TriangleQualityMeasure,int); 00133 vtkGetMacro(TriangleQualityMeasure,int); 00134 void SetTriangleQualityMeasureToArea() 00135 { 00136 this->SetTriangleQualityMeasure( VTK_QUALITY_AREA ); 00137 } 00138 void SetTriangleQualityMeasureToEdgeRatio() 00139 { 00140 this->SetTriangleQualityMeasure( VTK_QUALITY_EDGE_RATIO ); 00141 } 00142 void SetTriangleQualityMeasureToAspectRatio() 00143 { 00144 this->SetTriangleQualityMeasure( VTK_QUALITY_ASPECT_RATIO ); 00145 } 00146 void SetTriangleQualityMeasureToRadiusRatio() 00147 { 00148 this->SetTriangleQualityMeasure( VTK_QUALITY_RADIUS_RATIO ); 00149 } 00150 void SetTriangleQualityMeasureToAspectFrobenius() 00151 { 00152 this->SetTriangleQualityMeasure( VTK_QUALITY_ASPECT_FROBENIUS ); 00153 } 00154 void SetTriangleQualityMeasureToMinAngle() 00155 { 00156 this->SetTriangleQualityMeasure( VTK_QUALITY_MIN_ANGLE ); 00157 } 00158 void SetTriangleQualityMeasureToMaxAngle() 00159 { 00160 this->SetTriangleQualityMeasure( VTK_QUALITY_MAX_ANGLE ); 00161 } 00162 void SetTriangleQualityMeasureToCondition() 00163 { 00164 this->SetTriangleQualityMeasure( VTK_QUALITY_CONDITION ); 00165 } 00166 void SetTriangleQualityMeasureToScaledJacobian() 00167 { 00168 this->SetTriangleQualityMeasure( VTK_QUALITY_SCALED_JACOBIAN ); 00169 } 00170 void SetTriangleQualityMeasureToRelativeSizeSquared() 00171 { 00172 this->SetTriangleQualityMeasure( VTK_QUALITY_RELATIVE_SIZE_SQUARED ); 00173 } 00174 void SetTriangleQualityMeasureToShape() 00175 { 00176 this->SetTriangleQualityMeasure( VTK_QUALITY_SHAPE ); 00177 } 00178 void SetTriangleQualityMeasureToShapeAndSize() 00179 { 00180 this->SetTriangleQualityMeasure( VTK_QUALITY_SHAPE_AND_SIZE ); 00181 } 00182 void SetTriangleQualityMeasureToDistortion() 00183 { 00184 this->SetTriangleQualityMeasure( VTK_QUALITY_DISTORTION ); 00185 } 00187 00189 00203 vtkSetMacro(QuadQualityMeasure,int); 00204 vtkGetMacro(QuadQualityMeasure,int); 00205 void SetQuadQualityMeasureToEdgeRatio() 00206 { 00207 this->SetQuadQualityMeasure( VTK_QUALITY_EDGE_RATIO ); 00208 } 00209 void SetQuadQualityMeasureToAspectRatio() 00210 { 00211 this->SetQuadQualityMeasure( VTK_QUALITY_ASPECT_RATIO ); 00212 } 00213 void SetQuadQualityMeasureToRadiusRatio() 00214 { 00215 this->SetQuadQualityMeasure( VTK_QUALITY_RADIUS_RATIO ); 00216 } 00217 void SetQuadQualityMeasureToMedAspectFrobenius() 00218 { 00219 this->SetQuadQualityMeasure( VTK_QUALITY_MED_ASPECT_FROBENIUS ); 00220 } 00221 void SetQuadQualityMeasureToMaxAspectFrobenius() 00222 { 00223 this->SetQuadQualityMeasure( VTK_QUALITY_MAX_ASPECT_FROBENIUS ); 00224 } 00225 void SetQuadQualityMeasureToMaxEdgeRatios() 00226 { 00227 this->SetQuadQualityMeasure( VTK_QUALITY_MAX_EDGE_RATIO ); 00228 } 00229 void SetQuadQualityMeasureToSkew() 00230 { 00231 this->SetQuadQualityMeasure( VTK_QUALITY_SKEW ); 00232 } 00233 void SetQuadQualityMeasureToTaper() 00234 { 00235 this->SetQuadQualityMeasure( VTK_QUALITY_TAPER ); 00236 } 00237 void SetQuadQualityMeasureToWarpage() 00238 { 00239 this->SetQuadQualityMeasure( VTK_QUALITY_WARPAGE ); 00240 } 00241 void SetQuadQualityMeasureToArea() 00242 { 00243 this->SetQuadQualityMeasure( VTK_QUALITY_AREA ); 00244 } 00245 void SetQuadQualityMeasureToStretch() 00246 { 00247 this->SetQuadQualityMeasure( VTK_QUALITY_STRETCH ); 00248 } 00249 void SetQuadQualityMeasureToMinAngle() 00250 { 00251 this->SetQuadQualityMeasure( VTK_QUALITY_MIN_ANGLE ); 00252 } 00253 void SetQuadQualityMeasureToMaxAngle() 00254 { 00255 this->SetQuadQualityMeasure( VTK_QUALITY_MAX_ANGLE ); 00256 } 00257 void SetQuadQualityMeasureToOddy() 00258 { 00259 this->SetQuadQualityMeasure( VTK_QUALITY_ODDY ); 00260 } 00261 void SetQuadQualityMeasureToCondition() 00262 { 00263 this->SetQuadQualityMeasure( VTK_QUALITY_CONDITION ); 00264 } 00265 void SetQuadQualityMeasureToJacobian() 00266 { 00267 this->SetQuadQualityMeasure( VTK_QUALITY_JACOBIAN ); 00268 } 00269 void SetQuadQualityMeasureToScaledJacobian() 00270 { 00271 this->SetQuadQualityMeasure( VTK_QUALITY_SCALED_JACOBIAN ); 00272 } 00273 void SetQuadQualityMeasureToShear() 00274 { 00275 this->SetQuadQualityMeasure( VTK_QUALITY_SHEAR ); 00276 } 00277 void SetQuadQualityMeasureToShape() 00278 { 00279 this->SetQuadQualityMeasure( VTK_QUALITY_SHAPE ); 00280 } 00281 void SetQuadQualityMeasureToRelativeSizeSquared() 00282 { 00283 this->SetQuadQualityMeasure( VTK_QUALITY_RELATIVE_SIZE_SQUARED ); 00284 } 00285 void SetQuadQualityMeasureToShapeAndSize() 00286 { 00287 this->SetQuadQualityMeasure( VTK_QUALITY_SHAPE_AND_SIZE ); 00288 } 00289 void SetQuadQualityMeasureToShearAndSize() 00290 { 00291 this->SetQuadQualityMeasure( VTK_QUALITY_SHEAR_AND_SIZE ); 00292 } 00293 void SetQuadQualityMeasureToDistortion() 00294 { 00295 this->SetQuadQualityMeasure( VTK_QUALITY_DISTORTION ); 00296 } 00298 00300 00310 vtkSetMacro(TetQualityMeasure,int); 00311 vtkGetMacro(TetQualityMeasure,int); 00312 void SetTetQualityMeasureToEdgeRatio() 00313 { 00314 this->SetTetQualityMeasure( VTK_QUALITY_EDGE_RATIO ); 00315 } 00316 void SetTetQualityMeasureToAspectRatio() 00317 { 00318 this->SetTetQualityMeasure( VTK_QUALITY_ASPECT_RATIO ); 00319 } 00320 void SetTetQualityMeasureToRadiusRatio() 00321 { 00322 this->SetTetQualityMeasure( VTK_QUALITY_RADIUS_RATIO ); 00323 } 00324 void SetTetQualityMeasureToAspectFrobenius() 00325 { 00326 this->SetTetQualityMeasure( VTK_QUALITY_ASPECT_FROBENIUS ); 00327 } 00328 void SetTetQualityMeasureToMinAngle() 00329 { 00330 this->SetTetQualityMeasure( VTK_QUALITY_MIN_ANGLE ); 00331 } 00332 void SetTetQualityMeasureToCollapseRatio() 00333 { 00334 this->SetTetQualityMeasure( VTK_QUALITY_COLLAPSE_RATIO ); 00335 } 00336 void SetTetQualityMeasureToAspectBeta() 00337 { 00338 this->SetTetQualityMeasure( VTK_QUALITY_ASPECT_BETA ); 00339 } 00340 void SetTetQualityMeasureToAspectGamma() 00341 { 00342 this->SetTetQualityMeasure( VTK_QUALITY_ASPECT_GAMMA ); 00343 } 00344 void SetTetQualityMeasureToVolume() 00345 { 00346 this->SetTetQualityMeasure( VTK_QUALITY_VOLUME ); 00347 } 00348 void SetTetQualityMeasureToCondition() 00349 { 00350 this->SetTetQualityMeasure( VTK_QUALITY_CONDITION ); 00351 } 00352 void SetTetQualityMeasureToJacobian() 00353 { 00354 this->SetTetQualityMeasure( VTK_QUALITY_JACOBIAN ); 00355 } 00356 void SetTetQualityMeasureToScaledJacobian() 00357 { 00358 this->SetTetQualityMeasure( VTK_QUALITY_SCALED_JACOBIAN ); 00359 } 00360 void SetTetQualityMeasureToShape() 00361 { 00362 this->SetTetQualityMeasure( VTK_QUALITY_SHAPE ); 00363 } 00364 void SetTetQualityMeasureToRelativeSizeSquared() 00365 { 00366 this->SetTetQualityMeasure( VTK_QUALITY_RELATIVE_SIZE_SQUARED ); 00367 } 00368 void SetTetQualityMeasureToShapeAndSize() 00369 { 00370 this->SetTetQualityMeasure( VTK_QUALITY_SHAPE_AND_SIZE ); 00371 } 00372 void SetTetQualityMeasureToDistortion() 00373 { 00374 this->SetTetQualityMeasure( VTK_QUALITY_DISTORTION ); 00375 } 00377 00379 00389 vtkSetMacro(HexQualityMeasure,int); 00390 vtkGetMacro(HexQualityMeasure,int); 00391 void SetHexQualityMeasureToEdgeRatio() 00392 { 00393 this->SetHexQualityMeasure( VTK_QUALITY_EDGE_RATIO ); 00394 } 00395 void SetHexQualityMeasureToMedAspectFrobenius() 00396 { 00397 this->SetHexQualityMeasure( VTK_QUALITY_MED_ASPECT_FROBENIUS ); 00398 } 00399 void SetHexQualityMeasureToMaxAspectFrobenius() 00400 { 00401 this->SetHexQualityMeasure( VTK_QUALITY_MAX_ASPECT_FROBENIUS ); 00402 } 00403 void SetHexQualityMeasureToMaxEdgeRatios() 00404 { 00405 this->SetHexQualityMeasure( VTK_QUALITY_MAX_EDGE_RATIO ); 00406 } 00407 void SetHexQualityMeasureToSkew() 00408 { 00409 this->SetHexQualityMeasure( VTK_QUALITY_SKEW ); 00410 } 00411 void SetHexQualityMeasureToTaper() 00412 { 00413 this->SetHexQualityMeasure( VTK_QUALITY_TAPER ); 00414 } 00415 void SetHexQualityMeasureToVolume() 00416 { 00417 this->SetHexQualityMeasure( VTK_QUALITY_VOLUME ); 00418 } 00419 void SetHexQualityMeasureToStretch() 00420 { 00421 this->SetHexQualityMeasure( VTK_QUALITY_STRETCH ); 00422 } 00423 void SetHexQualityMeasureToDiagonal() 00424 { 00425 this->SetHexQualityMeasure( VTK_QUALITY_DIAGONAL ); 00426 } 00427 void SetHexQualityMeasureToDimension() 00428 { 00429 this->SetHexQualityMeasure( VTK_QUALITY_DIMENSION ); 00430 } 00431 void SetHexQualityMeasureToOddy() 00432 { 00433 this->SetHexQualityMeasure( VTK_QUALITY_ODDY ); 00434 } 00435 void SetHexQualityMeasureToCondition() 00436 { 00437 this->SetHexQualityMeasure( VTK_QUALITY_CONDITION ); 00438 } 00439 void SetHexQualityMeasureToJacobian() 00440 { 00441 this->SetHexQualityMeasure( VTK_QUALITY_JACOBIAN ); 00442 } 00443 void SetHexQualityMeasureToScaledJacobian() 00444 { 00445 this->SetHexQualityMeasure( VTK_QUALITY_SCALED_JACOBIAN ); 00446 } 00447 void SetHexQualityMeasureToShear() 00448 { 00449 this->SetHexQualityMeasure( VTK_QUALITY_SHEAR ); 00450 } 00451 void SetHexQualityMeasureToShape() 00452 { 00453 this->SetHexQualityMeasure( VTK_QUALITY_SHAPE ); 00454 } 00455 void SetHexQualityMeasureToRelativeSizeSquared() 00456 { 00457 this->SetHexQualityMeasure( VTK_QUALITY_RELATIVE_SIZE_SQUARED ); 00458 } 00459 void SetHexQualityMeasureToShapeAndSize() 00460 { 00461 this->SetHexQualityMeasure( VTK_QUALITY_SHAPE_AND_SIZE ); 00462 } 00463 void SetHexQualityMeasureToShearAndSize() 00464 { 00465 this->SetHexQualityMeasure( VTK_QUALITY_SHEAR_AND_SIZE ); 00466 } 00467 void SetHexQualityMeasureToDistortion() 00468 { 00469 this->SetHexQualityMeasure( VTK_QUALITY_DISTORTION ); 00470 } 00472 00477 static double TriangleArea( vtkCell* cell ); 00478 00486 static double TriangleEdgeRatio( vtkCell* cell ); 00487 00495 static double TriangleAspectRatio( vtkCell* cell ); 00496 00503 static double TriangleRadiusRatio( vtkCell* cell ); 00504 00514 static double TriangleAspectFrobenius( vtkCell* cell ); 00515 00521 static double TriangleMinAngle( vtkCell* cell ); 00522 00528 static double TriangleMaxAngle( vtkCell* cell ); 00529 00534 static double TriangleCondition( vtkCell* cell ); 00535 00540 static double TriangleScaledJacobian( vtkCell* cell ); 00541 00546 static double TriangleRelativeSizeSquared( vtkCell* cell ); 00547 00552 static double TriangleShape( vtkCell* cell ); 00553 00558 static double TriangleShapeAndSize( vtkCell* cell ); 00559 00564 static double TriangleDistortion( vtkCell* cell ); 00565 00573 static double QuadEdgeRatio( vtkCell* cell ); 00574 00584 static double QuadAspectRatio( vtkCell* cell ); 00585 00599 static double QuadRadiusRatio( vtkCell* cell ); 00600 00612 static double QuadMedAspectFrobenius( vtkCell* cell ); 00613 00625 static double QuadMaxAspectFrobenius( vtkCell* cell ); 00626 00632 static double QuadMinAngle( vtkCell* cell ); 00633 00634 static double QuadMaxEdgeRatios( vtkCell* cell ); 00635 static double QuadSkew( vtkCell* cell ); 00636 static double QuadTaper( vtkCell* cell ); 00637 static double QuadWarpage( vtkCell* cell ); 00638 static double QuadArea( vtkCell* cell ); 00639 static double QuadStretch( vtkCell* cell ); 00640 static double QuadMaxAngle( vtkCell* cell ); 00641 static double QuadOddy( vtkCell* cell ); 00642 static double QuadCondition( vtkCell* cell ); 00643 static double QuadJacobian( vtkCell* cell ); 00644 static double QuadScaledJacobian( vtkCell* cell ); 00645 static double QuadShear( vtkCell* cell ); 00646 static double QuadShape( vtkCell* cell ); 00647 static double QuadRelativeSizeSquared( vtkCell* cell ); 00648 static double QuadShapeAndSize( vtkCell* cell ); 00649 static double QuadShearAndSize( vtkCell* cell ); 00650 static double QuadDistortion( vtkCell* cell ); 00651 00659 static double TetEdgeRatio( vtkCell* cell ); 00660 00668 static double TetAspectRatio( vtkCell* cell ); 00669 00676 static double TetRadiusRatio( vtkCell* cell ); 00677 00688 static double TetAspectFrobenius( vtkCell* cell ); 00689 00695 static double TetMinAngle( vtkCell* cell ); 00696 00698 00705 static double TetCollapseRatio( vtkCell* cell ); 00706 static double TetAspectBeta( vtkCell* cell ); 00707 static double TetAspectGamma( vtkCell* cell ); 00708 static double TetVolume( vtkCell* cell ); 00709 static double TetCondition( vtkCell* cell ); 00710 static double TetJacobian( vtkCell* cell ); 00711 static double TetScaledJacobian( vtkCell* cell ); 00712 static double TetShape( vtkCell* cell ); 00713 static double TetRelativeSizeSquared( vtkCell* cell ); 00714 static double TetShapeandSize( vtkCell* cell ); 00715 static double TetDistortion( vtkCell* cell ); 00717 00725 static double HexEdgeRatio( vtkCell* cell ); 00726 00733 static double HexMedAspectFrobenius( vtkCell* cell ); 00734 00736 00742 static double HexMaxAspectFrobenius( vtkCell* cell ); 00743 static double HexMaxEdgeRatio( vtkCell* cell ); 00744 static double HexSkew( vtkCell* cell ); 00745 static double HexTaper( vtkCell* cell ); 00746 static double HexVolume( vtkCell* cell ); 00747 static double HexStretch( vtkCell* cell ); 00748 static double HexDiagonal( vtkCell* cell ); 00749 static double HexDimension( vtkCell* cell ); 00750 static double HexOddy( vtkCell* cell ); 00751 static double HexCondition( vtkCell* cell ); 00752 static double HexJacobian( vtkCell* cell ); 00753 static double HexScaledJacobian( vtkCell* cell ); 00754 static double HexShear( vtkCell* cell ); 00755 static double HexShape( vtkCell* cell ); 00756 static double HexRelativeSizeSquared( vtkCell* cell ); 00757 static double HexShapeAndSize( vtkCell* cell ); 00758 static double HexShearAndSize( vtkCell* cell ); 00759 static double HexDistortion( vtkCell* cell ); 00761 00763 00769 virtual void SetRatio( int r ) { this->SetSaveCellQuality( r ); } 00770 int GetRatio() { return this->GetSaveCellQuality(); } 00771 vtkBooleanMacro(Ratio,int); 00773 00775 00787 virtual void SetVolume( int cv ) 00788 { 00789 if ( ! ((cv != 0) ^ (this->Volume != 0)) ) 00790 { 00791 return; 00792 } 00793 this->Modified(); 00794 this->Volume = cv; 00795 if ( this->Volume ) 00796 { 00797 this->CompatibilityModeOn(); 00798 } 00799 } 00800 int GetVolume() 00801 { 00802 return this->Volume; 00803 } 00804 vtkBooleanMacro(Volume,int); 00806 00808 00826 virtual void SetCompatibilityMode( int cm ) 00827 { 00828 if ( !((cm != 0) ^ (this->CompatibilityMode != 0)) ) 00829 { 00830 return; 00831 } 00832 this->CompatibilityMode = cm; 00833 this->Modified(); 00834 if ( this->CompatibilityMode ) 00835 { 00836 this->Volume = 1; 00837 this->TetQualityMeasure = VTK_QUALITY_RADIUS_RATIO; 00838 } 00839 } 00840 vtkGetMacro(CompatibilityMode,int); 00841 vtkBooleanMacro(CompatibilityMode,int); 00843 00844 protected: 00845 vtkMeshQuality(); 00846 ~vtkMeshQuality(); 00847 00848 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); 00849 00852 static int GetCurrentTriangleNormal( double point[3], double normal[3] ); 00853 00854 int SaveCellQuality; 00855 int TriangleQualityMeasure; 00856 int QuadQualityMeasure; 00857 int TetQualityMeasure; 00858 int HexQualityMeasure; 00859 00860 int CompatibilityMode; 00861 int Volume; 00862 00863 vtkDataArray* CellNormals; 00864 static double CurrentTriNormal[3]; 00865 00866 private: 00867 vtkMeshQuality( const vtkMeshQuality& ); // Not implemented. 00868 void operator = ( const vtkMeshQuality& ); // Not implemented. 00869 }; 00870 00871 #endif // vtkMeshQuality_h