00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00061 #ifndef vtkMeshQuality_h
00062 #define vtkMeshQuality_h
00063
00064 #include "vtkDataSetAlgorithm.h"
00065
00066 class vtkCell;
00067
00068 #define VTK_QUALITY_EDGE_RATIO 0
00069 #define VTK_QUALITY_ASPECT_RATIO 1
00070 #define VTK_QUALITY_RADIUS_RATIO 2
00071 #define VTK_QUALITY_FROBENIUS_NORM 3
00072 #define VTK_QUALITY_MED_FROBENIUS_NORM 4
00073 #define VTK_QUALITY_MAX_FROBENIUS_NORM 5
00074 #define VTK_QUALITY_MIN_ANGLE 6
00075
00076 class VTK_GRAPHICS_EXPORT vtkMeshQuality : public vtkDataSetAlgorithm
00077 {
00078 public:
00079 void PrintSelf(ostream& os, vtkIndent indent);
00080 vtkTypeRevisionMacro(vtkMeshQuality,vtkDataSetAlgorithm);
00081 static vtkMeshQuality* New();
00082
00084
00087 vtkSetMacro(SaveCellQuality,int);
00088 vtkGetMacro(SaveCellQuality,int);
00089 vtkBooleanMacro(SaveCellQuality,int);
00091
00093
00097 vtkSetMacro(TriangleQualityMeasure,int);
00098 vtkGetMacro(TriangleQualityMeasure,int);
00099 void SetTriangleQualityMeasureToEdgeRatio()
00100 {
00101 this->SetTriangleQualityMeasure( VTK_QUALITY_EDGE_RATIO );
00102 }
00103 void SetTriangleQualityMeasureToAspectRatio()
00104 {
00105 this->SetTriangleQualityMeasure( VTK_QUALITY_ASPECT_RATIO );
00106 }
00107 void SetTriangleQualityMeasureToRadiusRatio()
00108 {
00109 this->SetTriangleQualityMeasure( VTK_QUALITY_RADIUS_RATIO );
00110 }
00111 void SetTriangleQualityMeasureToFrobeniusNorm()
00112 {
00113 this->SetTriangleQualityMeasure( VTK_QUALITY_FROBENIUS_NORM );
00114 }
00115 void SetTriangleQualityMeasureToMinAngle()
00116 {
00117 this->SetTriangleQualityMeasure( VTK_QUALITY_MIN_ANGLE );
00118 }
00120
00122
00129 vtkSetMacro(QuadQualityMeasure,int);
00130 vtkGetMacro(QuadQualityMeasure,int);
00131 void SetQuadQualityMeasureToEdgeRatio()
00132 {
00133 this->SetQuadQualityMeasure( VTK_QUALITY_EDGE_RATIO );
00134 }
00135 void SetQuadQualityMeasureToAspectRatio()
00136 {
00137 this->SetQuadQualityMeasure( VTK_QUALITY_ASPECT_RATIO );
00138 }
00139 void SetQuadQualityMeasureToRadiusRatio()
00140 {
00141 this->SetQuadQualityMeasure( VTK_QUALITY_RADIUS_RATIO );
00142 }
00143 void SetQuadQualityMeasureToMedFrobeniusNorm()
00144 {
00145 this->SetQuadQualityMeasure( VTK_QUALITY_MED_FROBENIUS_NORM );
00146 }
00147 void SetQuadQualityMeasureToMaxFrobeniusNorm()
00148 {
00149 this->SetQuadQualityMeasure( VTK_QUALITY_MAX_FROBENIUS_NORM );
00150 }
00151 void SetQuadQualityMeasureToMinAngle()
00152 {
00153 this->SetQuadQualityMeasure( VTK_QUALITY_MIN_ANGLE );
00154 }
00156
00158
00162 vtkSetMacro(TetQualityMeasure,int);
00163 vtkGetMacro(TetQualityMeasure,int);
00164 void SetTetQualityMeasureToEdgeRatio()
00165 {
00166 this->SetTetQualityMeasure( VTK_QUALITY_EDGE_RATIO );
00167 }
00168 void SetTetQualityMeasureToAspectRatio()
00169 {
00170 this->SetTetQualityMeasure( VTK_QUALITY_ASPECT_RATIO );
00171 }
00172 void SetTetQualityMeasureToRadiusRatio()
00173 {
00174 this->SetTetQualityMeasure( VTK_QUALITY_RADIUS_RATIO );
00175 }
00176 void SetTetQualityMeasureToFrobeniusNorm()
00177 {
00178 this->SetTetQualityMeasure( VTK_QUALITY_FROBENIUS_NORM );
00179 }
00180 void SetTetQualityMeasureToMinAngle()
00181 {
00182 this->SetTetQualityMeasure( VTK_QUALITY_MIN_ANGLE );
00183 }
00185
00187
00190 vtkSetMacro(HexQualityMeasure,int);
00191 vtkGetMacro(HexQualityMeasure,int);
00192 void SetHexQualityMeasureToEdgeRatio()
00193 {
00194 this->SetHexQualityMeasure( VTK_QUALITY_EDGE_RATIO );
00195 }
00197
00205 static double TriangleEdgeRatio( vtkCell* cell );
00206
00214 static double TriangleAspectRatio( vtkCell* cell );
00215
00222 static double TriangleRadiusRatio( vtkCell* cell );
00223
00233 static double TriangleFrobeniusNorm( vtkCell* cell );
00234
00240 static double TriangleMinAngle( vtkCell* cell );
00241
00249 static double QuadEdgeRatio( vtkCell* cell );
00250
00260 static double QuadAspectRatio( vtkCell* cell );
00261
00275 static double QuadRadiusRatio( vtkCell* cell );
00276
00288 static double QuadMedFrobeniusNorm( vtkCell* cell );
00289
00301 static double QuadMaxFrobeniusNorm( vtkCell* cell );
00302
00308 static double QuadMinAngle( vtkCell* cell );
00309
00317 static double TetEdgeRatio( vtkCell* cell );
00318
00326 static double TetAspectRatio( vtkCell* cell );
00327
00334 static double TetRadiusRatio( vtkCell* cell );
00335
00346 static double TetFrobeniusNorm( vtkCell* cell );
00347
00353 static double TetMinAngle( vtkCell* cell );
00354
00362 static double HexEdgeRatio( vtkCell* cell );
00363
00365
00371 virtual void SetRatio( int r ) { this->SetSaveCellQuality( r ); }
00372 int GetRatio() { return this->GetSaveCellQuality(); }
00373 vtkBooleanMacro(Ratio,int);
00375
00377
00389 virtual void SetVolume( int cv )
00390 {
00391 if ( ! ((cv != 0) ^ (this->Volume != 0)) )
00392 {
00393 return;
00394 }
00395 this->Modified();
00396 this->Volume = cv;
00397 if ( this->Volume )
00398 {
00399 this->CompatibilityModeOn();
00400 }
00401 }
00402 int GetVolume()
00403 {
00404 return this->Volume;
00405 }
00406 vtkBooleanMacro(Volume,int);
00408
00410
00428 virtual void SetCompatibilityMode( int cm )
00429 {
00430 if ( !((cm != 0) ^ (this->CompatibilityMode != 0)) )
00431 {
00432 return;
00433 }
00434 this->CompatibilityMode = cm;
00435 this->Modified();
00436 if ( this->CompatibilityMode )
00437 {
00438 this->Volume = 1;
00439 this->TetQualityMeasure = VTK_QUALITY_RADIUS_RATIO;
00440 }
00441 }
00442 vtkGetMacro(CompatibilityMode,int);
00443 vtkBooleanMacro(CompatibilityMode,int);
00445
00446 protected:
00447 vtkMeshQuality();
00448 ~vtkMeshQuality();
00449
00450 virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
00451
00452 int SaveCellQuality;
00453 int TriangleQualityMeasure;
00454 int QuadQualityMeasure;
00455 int TetQualityMeasure;
00456 int HexQualityMeasure;
00457
00458 int CompatibilityMode;
00459 int Volume;
00460
00461 private:
00462 vtkMeshQuality( const vtkMeshQuality& );
00463 void operator = ( const vtkMeshQuality& );
00464 };
00465
00466 #endif // vtkMeshQuality_h