Issue 0020947: EDF 1467 SMESH: Modify the formula to calculate Aspect Ratio on quadrangles

This commit is contained in:
ouv 2010-10-13 09:49:12 +00:00
parent 25b69822a1
commit f0f625f609
3 changed files with 86 additions and 40 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -13,10 +13,10 @@ nodes is calculated by the formula:
\image html formula4.png \image html formula4.png
- The <b>Aspect Ratio</b> of a \b quadrangle 2D element consisting of - The <b>Aspect Ratio</b> of a \b quadrangle 2D element consisting of 4
4 nodes is the worst (i.e. the greatest) value from all triangles nodes is calculated by the formula:
which can be built taking three nodes of the quadrangle. There are
four triangles to consider: \image html formula5.png
\image html image138.gif \image html image138.gif

View File

@ -465,46 +465,92 @@ double AspectRatio::GetValue( const TSequenceOfXYZ& P )
return alfa * maxLen * half_perimeter / anArea; return alfa * maxLen * half_perimeter / anArea;
} }
else if( nbNodes == 4 ) { // quadrangle else if( nbNodes == 4 ) { // quadrangle
// return aspect ratio of the worst triange which can be built // Compute lengths of the sides
std::vector< double > aLen (4);
aLen[0] = getDistance( P(1), P(2) );
aLen[1] = getDistance( P(2), P(3) );
aLen[2] = getDistance( P(3), P(4) );
aLen[3] = getDistance( P(4), P(1) );
// Compute lengths of the diagonals
std::vector< double > aDia (2);
aDia[0] = getDistance( P(1), P(3) );
aDia[1] = getDistance( P(2), P(4) );
// Compute areas of all triangles which can be built
// taking three nodes of the quadrangle // taking three nodes of the quadrangle
TSequenceOfXYZ triaPnts(3); std::vector< double > anArea (4);
// triangle on nodes 1 3 2 anArea[0] = getArea( P(1), P(2), P(3) );
triaPnts(1) = P(1); anArea[1] = getArea( P(1), P(2), P(4) );
triaPnts(2) = P(3); anArea[2] = getArea( P(1), P(3), P(4) );
triaPnts(3) = P(2); anArea[3] = getArea( P(2), P(3), P(4) );
double ar = GetValue( triaPnts ); // Q = alpha * L * C1 / C2, where
// triangle on nodes 1 3 4 //
triaPnts(3) = P(4); // alpha = sqrt( 1/32 )
ar = Max ( ar, GetValue( triaPnts )); // L = max( L1, L2, L3, L4, D1, D2 )
// triangle on nodes 1 2 4 // C1 = sqrt( ( L1^2 + L1^2 + L1^2 + L1^2 ) / 4 )
triaPnts(2) = P(2); // C2 = min( S1, S2, S3, S4 )
ar = Max ( ar, GetValue( triaPnts )); // Li - lengths of the edges
// triangle on nodes 3 2 4 // Di - lengths of the diagonals
triaPnts(1) = P(3); // Si - areas of the triangles
ar = Max ( ar, GetValue( triaPnts )); const double alpha = sqrt( 1 / 32. );
double L = Max( aLen[ 0 ],
return ar; Max( aLen[ 1 ],
Max( aLen[ 2 ],
Max( aLen[ 3 ],
Max( aDia[ 0 ], aDia[ 1 ] ) ) ) ) );
double C1 = sqrt( ( aLen[0] * aLen[0] +
aLen[1] * aLen[1] +
aLen[2] * aLen[2] +
aLen[3] * aLen[3] ) / 4. );
double C2 = Min( anArea[ 0 ],
Min( anArea[ 1 ],
Min( anArea[ 2 ], anArea[ 3 ] ) ) );
if ( C2 <= Precision::Confusion() )
return 0.;
return alpha * L * C1 / C2;
} }
else if( nbNodes == 8 ){ // nbNodes==8 - quadratic quadrangle else if( nbNodes == 8 ){ // nbNodes==8 - quadratic quadrangle
// return aspect ratio of the worst triange which can be built // Compute lengths of the sides
std::vector< double > aLen (4);
aLen[0] = getDistance( P(1), P(3) );
aLen[1] = getDistance( P(3), P(5) );
aLen[2] = getDistance( P(5), P(7) );
aLen[3] = getDistance( P(7), P(1) );
// Compute lengths of the diagonals
std::vector< double > aDia (2);
aDia[0] = getDistance( P(1), P(5) );
aDia[1] = getDistance( P(3), P(7) );
// Compute areas of all triangles which can be built
// taking three nodes of the quadrangle // taking three nodes of the quadrangle
TSequenceOfXYZ triaPnts(3); std::vector< double > anArea (4);
// triangle on nodes 1 3 2 anArea[0] = getArea( P(1), P(3), P(5) );
triaPnts(1) = P(1); anArea[1] = getArea( P(1), P(3), P(7) );
triaPnts(2) = P(5); anArea[2] = getArea( P(1), P(5), P(7) );
triaPnts(3) = P(3); anArea[3] = getArea( P(3), P(5), P(7) );
double ar = GetValue( triaPnts ); // Q = alpha * L * C1 / C2, where
// triangle on nodes 1 3 4 //
triaPnts(3) = P(7); // alpha = sqrt( 1/32 )
ar = Max ( ar, GetValue( triaPnts )); // L = max( L1, L2, L3, L4, D1, D2 )
// triangle on nodes 1 2 4 // C1 = sqrt( ( L1^2 + L1^2 + L1^2 + L1^2 ) / 4 )
triaPnts(2) = P(3); // C2 = min( S1, S2, S3, S4 )
ar = Max ( ar, GetValue( triaPnts )); // Li - lengths of the edges
// triangle on nodes 3 2 4 // Di - lengths of the diagonals
triaPnts(1) = P(5); // Si - areas of the triangles
ar = Max ( ar, GetValue( triaPnts )); const double alpha = sqrt( 1 / 32. );
double L = Max( aLen[ 0 ],
return ar; Max( aLen[ 1 ],
Max( aLen[ 2 ],
Max( aLen[ 3 ],
Max( aDia[ 0 ], aDia[ 1 ] ) ) ) ) );
double C1 = sqrt( ( aLen[0] * aLen[0] +
aLen[1] * aLen[1] +
aLen[2] * aLen[2] +
aLen[3] * aLen[3] ) / 4. );
double C2 = Min( anArea[ 0 ],
Min( anArea[ 1 ],
Min( anArea[ 2 ], anArea[ 3 ] ) ) );
if ( C2 <= Precision::Confusion() )
return 0.;
return alpha * L * C1 / C2;
} }
return 0; return 0;
} }