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