0020946: EDF 1466 SMESH: Add a new control criteria: Max element length

This commit is contained in:
ouv 2010-10-14 11:08:31 +00:00
parent f0f625f609
commit 73770b22b2
38 changed files with 805 additions and 119 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -13,24 +13,25 @@ the meshing elements and these calculated values is shown with the
help of a scalar bar, which is displayed near the presentation of your
mesh.
There are 0D, 1D, 2D and 3D quality controls.
There are four types of quality controls, corresponding to node, edge,
face and volume entity type.
0D mesh quality controls:
<ul>
<li>\ref free_nodes_page "Free nodes"</li>
</ul>
1D mesh quality controls:
<ul>
<li>\subpage free_borders_page "Free borders"</li>
<li>\subpage borders_at_multi_connection_page "Borders at multi-connection"</li>
<li>\subpage length_page "Length"</li>
</ul>
2D mesh quality controls:
Node quality controls:
<ul>
<li>\subpage free_nodes_page "Free nodes"</li>
</ul>
Edge quality controls:
<ul>
<li>\subpage free_edges_page "Free edges"</li>
<li>\subpage free_borders_page "Free borders"</li>
<li>\subpage length_page "Length"</li>
<li>\subpage borders_at_multi_connection_page "Borders at multi-connection"</li>
</ul>
Face quality controls:
<ul>
<li>\subpage free_faces_page "Free faces"</li>
<li>\subpage length_2d_page "Length 2D"</li>
<li>\subpage borders_at_multi_connection_2d_page "Borders at multi-connection 2D"</li>
<li>\subpage area_page "Area"</li>
@ -39,13 +40,14 @@ There are 0D, 1D, 2D and 3D quality controls.
<li>\subpage minimum_angle_page "Minimum angle"</li>
<li>\subpage warping_page "Warping"</li>
<li>\subpage skew_page "Skew"</li>
<li>\subpage max_element_length_2d_page "Max element length 2D"</li>
</ul>
3D mesh quality controls:
Volume quality controls:
<ul>
<li>\subpage aspect_ratio_3d_page "Aspect ratio 3D"</li>
<li>\subpage volume_page "Volume"</li>
<li>\subpage free_faces_page "Free faces"</li>
<li>\subpage max_element_length_3d_page "Max element length 3D"</li>
</ul>
*/

View File

@ -11,7 +11,8 @@ quadrangles).
<ol>
<li>Display your mesh in the viewer.</li>
<li>Choose <b>Controls > Area</b> or click <em>"Area"</em> button.
<li>Choose <b>Controls > Face Controls > Area</b> or click
<em>"Area"</em> button.
\image html image35.png
<center><em>"Area" button</em></center>

View File

@ -24,8 +24,8 @@ nodes is calculated by the formula:
<ol>
<li>Display your mesh in the viewer.</li>
<li>Choose <b>Controls > Aspect Ratio</b> or click <em>"Aspect
Ratio"</em> button in the toolbar.
<li>Choose <b>Controls > Face Controls > Aspect Ratio</b> or click
<em>"Aspect Ratio"</em> button in the toolbar.
\image html image37.png
<center><em>"Aspect Ratio" button</em></center>

View File

@ -21,8 +21,8 @@ by the formula:
<ol>
<li>Display your mesh in the viewer.</li>
<li>Choose <b>Controls > Aspect Ratio 3D</b> or click <em>"Aspect Ratio 3D"</em>
button of the toolbar.
<li>Choose <b>Controls > Volume Controls > Aspect Ratio 3D</b> or click
<em>"Aspect Ratio 3D"</em> button of the toolbar.
\image html image144.png
<center><em>"Aspect Ratio 3D" button</em></center>

View File

@ -10,8 +10,8 @@ of your mesh.
<ol>
<li>Display your mesh in the viewer. </li>
<li>Choose <b>Controls > Length 2D</b> or click <em>"Length 2D"</em>
button in the toolbar.
<li>Choose <b>Controls > Face Controls > Length 2D</b> or click
<em>"Length 2D"</em> button in the toolbar.
\image html image34.png
<center><em>"Length 2D" button</em></center>

View File

@ -0,0 +1,29 @@
/*!
\page max_element_length_2d_page Max Element Length 2D
\n This quality control criterion consists of calculation of length of
the edges and diagonals combining the meshing elements (triangles and quadrangles)
of your mesh.
<em>To apply the Max Element Length 2D quality criterion to your mesh:</em>
<ol>
<li>Display your mesh in the viewer. </li>
<li>Choose <b>Controls > Face Controls > Max Element Length 2D</b> or click
<em>"Max Element Length 2D"</em> button in the toolbar.
\image html image42.png
<center><em>"Max Element Length 2D" button</em></center>
Your mesh will be displayed in the viewer with its elements colored according to the
applied mesh quality control criterion:
\image html max_element_length_2d.png
</li>
</ol>
<br><b>See Also</b> a sample TUI Script of a
\ref tui_max_element_length_2d "Max Element Length 2D quality control" operation.
*/

View File

@ -0,0 +1,30 @@
/*!
\page max_element_length_3d_page Max Element Length 3D
\n This quality control criterion consists of calculation of length of
the edges and diagonals combining the 3D meshing elements
(tetrahedrons, pyramids, pentahendrons, hexahedrons and polyhedrons)
of your mesh.
<em>To apply the Max Element Length 3D quality criterion to your mesh:</em>
<ol>
<li>Display your mesh in the viewer. </li>
<li>Choose <b>Controls > Volume Controls > Max Element Length 3D</b> or click
<em>"Max Element Length 3D"</em> button in the toolbar.
\image html image43.png
<center><em>"Max Element Length 3D" button</em></center>
Your mesh will be displayed in the viewer with its elements colored according to the
applied mesh quality control criterion:
\image html max_element_length_3d.png
</li>
</ol>
<br><b>See Also</b> a sample TUI Script of a
\ref tui_max_element_length_3d "Max Element Length 3D quality control" operation.
*/

View File

@ -10,7 +10,8 @@ element (triangle or quadrangle).
<ol>
<li>Display your mesh in the viewer.</li>
<li>Choose <b>Controls > Minimum angle</b> or click <em>"Minimum Angle"</em> button.
<li>Choose <b>Controls > Face Controls > Minimum angle</b> or click
<em>"Minimum Angle"</em> button.
\image html image38.png
<center><em>"Minimum Angle" button</em></center>

View File

@ -156,6 +156,11 @@ See also a
length, which is more, less or equal (within a given <b>Tolerance</b>) to the predefined
<b>Threshold Value</b>. See also a
\ref length_2d_page "Length 2D quality control".
</li><li>
<b>Max Element Length 2D</b> selects triangles and quadrangles combining of the edges and
diagonals with a value of length, which is more, less or equal
(within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>. See also a
\ref max_element_length_2d_page "Max Element Length 2D quality control".
</li>
</ul>
@ -169,6 +174,11 @@ Additional criteria to select mesh <b>Volumes</b> are the following:
\ref volume_page "Volume quality control"), which is more, less or equal (within a given
<b>Tolerance</b>) to the predefined <b>Threshold Value</b>.
</li><li>
<b>Max Element Length 3D</b> selects 3D mesh elements combining of the edges and
diagonals with a value of length, which is more, less or equal
(within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>. See also a
\ref max_element_length_3d_page "Max Element Length 3D quality control".
</li><li>
<b>Bad oriented volume</b> selects mesh volumes, which are incorrectly oriented from
the point of view of MED convention.
</li>

View File

@ -14,7 +14,8 @@ criterion can be applied to elements composed of 4 and 3 nodes
<ol>
<li>Display your mesh in the viewer.</li>
<li>Choose <b>Controls > Skew</b> or click <em>"Skew"</em> button of the toolbar.
<li>Choose <b>Controls > Face Controls > Skew</b> or click
<em>"Skew"</em> button of the toolbar.
\image html image40.png
<center><em>"Skew" button </em></center>

View File

@ -13,8 +13,8 @@ for elements consisting of 4 nodes.
<ol>
<li>Display your mesh in the viewer.</li>
<li>Choose <b>Controls > Taper</b> or click <em>"Taper"</em> button in
the toolbar.
<li>Choose <b>Controls > Face Controls > Taper</b> or click
<em>"Taper"</em> button in the toolbar.
\image html image36.png
<center><em>"Taper" button</em></center>

View File

@ -337,6 +337,46 @@ print "Number of faces with maximum edge length > 14:", len(ids)
\sa \ref tui_length_2d
\section filter_max_element_length_2d Max Element Length 2D
Filter 2D mesh elements (faces) corresponding to the maximum length
value of its edges and diagonals:
- element type should be \a smesh.FACE
- functor type should be \a smesh.FT_MaxElementLength2D
- threshold is floating point value (edge/diagonal length)
\code
# create mesh
from SMESH_mechanic import *
# get all faces that have elements with length > 10
filter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, 10)
ids = mesh.GetIdsFromFilter(filter)
print "Number of faces with maximum element length > 10:", len(ids)
\endcode
\sa \ref tui_max_element_length_2d
\section filter_max_element_length_3d Max Element Length 3D
Filter 3D mesh elements (volumes) corresponding to the maximum length
value of its edges and diagonals:
- element type should be \a smesh.VOLUME
- functor type should be \a smesh.FT_MaxElementLength3D
- threshold is floating point value (edge/diagonal length)
\code
# create mesh with volumes
from SMESH_mechanic import *
mesh.Tetrahedron( algo=smesh.NETGEN )
mesh.Compute()
# get all volumes that have elements with length > 10
filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, 10)
ids = mesh.GetIdsFromFilter(filter)
print "Number of volumes with maximum element length > 10:", len(ids)
\endcode
\sa \ref tui_max_element_length_3d
\section filter_belong_to_geom Belong to Geom
Filter mesh entities (nodes or elements) which all nodes lie on the

View File

@ -603,6 +603,39 @@ aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
\endcode
\section tui_max_element_length_2d Max Element Length 2D
\code
import SMESH_mechanic
smesh = SMESH_mechanic.smesh
mesh = SMESH_mechanic.mesh
salome = SMESH_mechanic.salome
# Criterion : MAX ELEMENT LENGTH 2D > 10
mel_2d_margin = 10
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, mel_2d_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
# print the result
print "Criterion: Max Element Length 2D Ratio > ", mel_2d_margin, " Nb = ", len(anIds)
j = 1
for i in range(len(anIds)):
if j > 20: j = 1; print ""
print anIds[i],
j = j + 1
pass
print ""
# create a group
aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Max Element Length 2D > " + `mel_2d_margin`)
aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
\endcode
\section tui_aspect_ratio_3d Aspect Ratio 3D
\code
@ -672,4 +705,37 @@ aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
\endcode
\section tui_max_element_length_3d Max Element Length 3D
\code
import SMESH_mechanic_tetra
smesh = SMESH_mechanic_tetra.smesh
mesh = SMESH_mechanic_tetra.mesh
salome = SMESH_mechanic_tetra.salome
# Criterion : MAX ELEMENT LENGTH 3D > 10
mel_3d_margin = 10
aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, mel_3d_margin)
anIds = mesh.GetIdsFromFilter(aFilter)
# print the result
print "Criterion: Max Element Length 3D Ratio > ", mel_3d_margin, " Nb = ", len(anIds)
j = 1
for i in range(len(anIds)):
if j > 20: j = 1; print ""
print anIds[i],
j = j + 1
pass
print ""
# create a group
aGroup = mesh.CreateEmptyGroup(smesh.FACE, "Max Element Length 3D > " + `mel_3d_margin`)
aGroup.Add(anIds)
salome.sg.updateObjBrowser(1)
\endcode
*/

View File

@ -9,8 +9,8 @@
<ol>
<li>Display your mesh in the viewer.</li>
<li>Choose <b>Controls > Volume</b> or click <em>"Volume"</em> button
in the toolbar.
<li>Choose <b>Controls > Volume Controls > Volume</b> or click
<em>"Volume"</em> button in the toolbar.
\image html image145.png
<center><em>"Volume" button</em></center>

View File

@ -24,8 +24,8 @@ projection height ?h? to the half edge length ?l?.
<ol>
<li>Display your mesh in the viewer.</li>
<li>Choose <b>Controls > Warping Angle</b> or click <em>"Warping angle"</em>
button of the toolbar.
<li>Choose <b>Controls > Face Controls > Warping Angle</b> or click
<em>"Warping angle"</em> button of the toolbar.
\image html image39.png
<center><em>"Warping angle" button</em></center>

View File

@ -47,6 +47,8 @@ module SMESH
FT_Skew,
FT_Area,
FT_Volume3D,
FT_MaxElementLength2D,
FT_MaxElementLength3D,
FT_FreeBorders,
FT_FreeEdges,
FT_FreeNodes,
@ -121,6 +123,8 @@ module SMESH
interface Skew : NumericalFunctor{};
interface Area : NumericalFunctor{};
interface Volume3D : NumericalFunctor{};
interface MaxElementLength2D : NumericalFunctor{};
interface MaxElementLength3D : NumericalFunctor{};
interface Length : NumericalFunctor{};
interface Length2D : NumericalFunctor
{
@ -463,6 +467,8 @@ module SMESH
Skew CreateSkew();
Area CreateArea();
Volume3D CreateVolume3D();
MaxElementLength2D CreateMaxElementLength2D();
MaxElementLength3D CreateMaxElementLength3D();
Length CreateLength();
Length2D CreateLength2D();
MultiConnection CreateMultiConnection();

View File

@ -57,6 +57,8 @@ dist_salomeres_DATA = \
mesh_free_edges.png \
mesh_free_edges_2d.png \
mesh_free_nodes.png \
mesh_max_element_length_2d.png \
mesh_max_element_length_3d.png \
mesh_multi_edges.png \
mesh_multi_edges_2d.png \
mesh_line_n.png \

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

View File

@ -31,6 +31,8 @@ int main(int argc, char** argv)
new Taper();
new Skew();
new Area();
new MaxElementLength2D();
new MaxElementLength3D();
new Length();
// new Length2D();
new MultiConnection();

View File

@ -370,6 +370,246 @@ SMDSAbs_ElementType Volume::GetType() const
}
/*
Class : MaxElementLength2D
Description : Functor calculating maximum length of 2D element
*/
double MaxElementLength2D::GetValue( long theElementId )
{
TSequenceOfXYZ P;
if( GetPoints( theElementId, P ) ) {
double aVal = 0;
const SMDS_MeshElement* aElem = myMesh->FindElement( theElementId );
SMDSAbs_ElementType aType = aElem->GetType();
int len = P.size();
switch( aType ) {
case SMDSAbs_Face:
if( len == 3 ) { // triangles
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
aVal = Max(L1,Max(L2,L3));
break;
}
else if( len == 4 ) { // quadrangles
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 1 ));
double D1 = getDistance(P( 1 ),P( 3 ));
double D2 = getDistance(P( 2 ),P( 4 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(D1,D2));
break;
}
else if( len == 6 ) { // quadratic triangles
double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 1 ));
aVal = Max(L1,Max(L2,L3));
break;
}
else if( len == 8 ) { // quadratic quadrangles
double L1 = getDistance(P( 1 ),P( 2 )) + getDistance(P( 2 ),P( 3 ));
double L2 = getDistance(P( 3 ),P( 4 )) + getDistance(P( 4 ),P( 5 ));
double L3 = getDistance(P( 5 ),P( 6 )) + getDistance(P( 6 ),P( 7 ));
double L4 = getDistance(P( 7 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
double D1 = getDistance(P( 1 ),P( 5 ));
double D2 = getDistance(P( 3 ),P( 7 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(D1,D2));
break;
}
}
if( myPrecision >= 0 )
{
double prec = pow( 10., (double)myPrecision );
aVal = floor( aVal * prec + 0.5 ) / prec;
}
return aVal;
}
return 0.;
}
double MaxElementLength2D::GetBadRate( double Value, int /*nbNodes*/ ) const
{
return Value;
}
SMDSAbs_ElementType MaxElementLength2D::GetType() const
{
return SMDSAbs_Face;
}
/*
Class : MaxElementLength3D
Description : Functor calculating maximum length of 3D element
*/
double MaxElementLength3D::GetValue( long theElementId )
{
TSequenceOfXYZ P;
if( GetPoints( theElementId, P ) ) {
double aVal = 0;
const SMDS_MeshElement* aElem = myMesh->FindElement( theElementId );
SMDSAbs_ElementType aType = aElem->GetType();
int len = P.size();
switch( aType ) {
case SMDSAbs_Volume:
if( len == 4 ) { // tetras
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
double L4 = getDistance(P( 1 ),P( 4 ));
double L5 = getDistance(P( 2 ),P( 4 ));
double L6 = getDistance(P( 3 ),P( 4 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
break;
}
else if( len == 5 ) { // pyramids
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 1 ));
double L5 = getDistance(P( 1 ),P( 5 ));
double L6 = getDistance(P( 2 ),P( 5 ));
double L7 = getDistance(P( 3 ),P( 5 ));
double L8 = getDistance(P( 4 ),P( 5 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(L7,L8));
break;
}
else if( len == 6 ) { // pentas
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
double L4 = getDistance(P( 4 ),P( 5 ));
double L5 = getDistance(P( 5 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 4 ));
double L7 = getDistance(P( 1 ),P( 4 ));
double L8 = getDistance(P( 2 ),P( 5 ));
double L9 = getDistance(P( 3 ),P( 6 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),L9));
break;
}
else if( len == 8 ) { // hexas
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 1 ));
double L5 = getDistance(P( 5 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 7 ));
double L7 = getDistance(P( 7 ),P( 8 ));
double L8 = getDistance(P( 8 ),P( 5 ));
double L9 = getDistance(P( 1 ),P( 5 ));
double L10= getDistance(P( 2 ),P( 6 ));
double L11= getDistance(P( 3 ),P( 7 ));
double L12= getDistance(P( 4 ),P( 8 ));
double D1 = getDistance(P( 1 ),P( 7 ));
double D2 = getDistance(P( 2 ),P( 8 ));
double D3 = getDistance(P( 3 ),P( 5 ));
double D4 = getDistance(P( 4 ),P( 6 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
aVal = Max(aVal,Max(L11,L12));
aVal = Max(aVal,Max(Max(D1,D2),Max(D3,D4)));
break;
}
else if( len == 10 ) { // quadratic tetras
double L1 = getDistance(P( 1 ),P( 5 )) + getDistance(P( 5 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 6 )) + getDistance(P( 6 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 7 )) + getDistance(P( 7 ),P( 1 ));
double L4 = getDistance(P( 1 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
double L5 = getDistance(P( 2 ),P( 9 )) + getDistance(P( 9 ),P( 4 ));
double L6 = getDistance(P( 3 ),P( 10 )) + getDistance(P( 10 ),P( 4 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
break;
}
else if( len == 13 ) { // quadratic pyramids
double L1 = getDistance(P( 1 ),P( 6 )) + getDistance(P( 6 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 7 )) + getDistance(P( 7 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
double L5 = getDistance(P( 1 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
double L6 = getDistance(P( 2 ),P( 11 )) + getDistance(P( 11 ),P( 5 ));
double L7 = getDistance(P( 3 ),P( 12 )) + getDistance(P( 12 ),P( 5 ));
double L8 = getDistance(P( 4 ),P( 13 )) + getDistance(P( 13 ),P( 5 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(L7,L8));
break;
}
else if( len == 15 ) { // quadratic pentas
double L1 = getDistance(P( 1 ),P( 7 )) + getDistance(P( 7 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 8 )) + getDistance(P( 8 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
double L4 = getDistance(P( 4 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
double L5 = getDistance(P( 5 ),P( 11 )) + getDistance(P( 11 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 12 )) + getDistance(P( 12 ),P( 4 ));
double L7 = getDistance(P( 1 ),P( 13 )) + getDistance(P( 13 ),P( 4 ));
double L8 = getDistance(P( 2 ),P( 14 )) + getDistance(P( 14 ),P( 5 ));
double L9 = getDistance(P( 3 ),P( 15 )) + getDistance(P( 15 ),P( 6 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),L9));
break;
}
else if( len == 20 ) { // quadratic hexas
double L1 = getDistance(P( 1 ),P( 9 )) + getDistance(P( 9 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 10 )) + getDistance(P( 10 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 11 )) + getDistance(P( 11 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 12 )) + getDistance(P( 12 ),P( 1 ));
double L5 = getDistance(P( 5 ),P( 13 )) + getDistance(P( 13 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 14 )) + getDistance(P( 14 ),P( 7 ));
double L7 = getDistance(P( 7 ),P( 15 )) + getDistance(P( 15 ),P( 8 ));
double L8 = getDistance(P( 8 ),P( 16 )) + getDistance(P( 16 ),P( 5 ));
double L9 = getDistance(P( 1 ),P( 17 )) + getDistance(P( 17 ),P( 5 ));
double L10= getDistance(P( 2 ),P( 18 )) + getDistance(P( 18 ),P( 6 ));
double L11= getDistance(P( 3 ),P( 19 )) + getDistance(P( 19 ),P( 7 ));
double L12= getDistance(P( 4 ),P( 20 )) + getDistance(P( 20 ),P( 8 ));
double D1 = getDistance(P( 1 ),P( 7 ));
double D2 = getDistance(P( 2 ),P( 8 ));
double D3 = getDistance(P( 3 ),P( 5 ));
double D4 = getDistance(P( 4 ),P( 6 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
aVal = Max(aVal,Max(L11,L12));
aVal = Max(aVal,Max(Max(D1,D2),Max(D3,D4)));
break;
}
else if( len > 1 && aElem->IsPoly() ) { // polys
// get the maximum distance between all pairs of nodes
for( int i = 1; i <= len; i++ ) {
for( int j = 1; j <= len; j++ ) {
if( j > i ) { // optimization of the loop
double D = getDistance( P(i), P(j) );
aVal = Max( aVal, D );
}
}
}
}
}
if( myPrecision >= 0 )
{
double prec = pow( 10., (double)myPrecision );
aVal = floor( aVal * prec + 0.5 ) / prec;
}
return aVal;
}
return 0.;
}
double MaxElementLength3D::GetBadRate( double Value, int /*nbNodes*/ ) const
{
return Value;
}
SMDSAbs_ElementType MaxElementLength3D::GetType() const
{
return SMDSAbs_Volume;
}
/*
Class : MinimumAngle
Description : Functor for calculation of minimum angle
@ -1198,7 +1438,7 @@ double Length2D::GetValue( long theElementId)
else if (len == 5){ // piramids
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
double L3 = getDistance(P( 3 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 1 ));
double L5 = getDistance(P( 1 ),P( 5 ));
double L6 = getDistance(P( 2 ),P( 5 ));
@ -1258,7 +1498,7 @@ double Length2D::GetValue( long theElementId)
else if (len == 13){ // quadratic piramids
double L1 = getDistance(P( 1 ),P( 6 )) + getDistance(P( 6 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 7 )) + getDistance(P( 7 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 1 ));
double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
double L5 = getDistance(P( 1 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
double L6 = getDistance(P( 2 ),P( 11 )) + getDistance(P( 11 ),P( 5 ));

View File

@ -159,6 +159,30 @@ namespace SMESH{
};
/*
Class : MaxElementLength2D
Description : Functor calculating maximum length of 2D element
*/
class SMESHCONTROLS_EXPORT MaxElementLength2D: public virtual NumericalFunctor{
public:
virtual double GetValue( long theElementId );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : MaxElementLength3D
Description : Functor calculating maximum length of 3D element
*/
class SMESHCONTROLS_EXPORT MaxElementLength3D: public virtual NumericalFunctor{
public:
virtual double GetValue( long theElementId );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : SMESH_MinimumAngle
Description : Functor for calculation of minimum angle

View File

@ -801,6 +801,22 @@ SetControlMode(eControl theMode,
myControlActor = my3DActor;
break;
}
case eMaxElementLength2D:
{
SMESH::Controls::MaxElementLength2D* aControl = new SMESH::Controls::MaxElementLength2D();
aControl->SetPrecision( myControlsPrecision );
aFunctor.reset( aControl );
myControlActor = my2DActor;
break;
}
case eMaxElementLength3D:
{
SMESH::Controls::MaxElementLength3D* aControl = new SMESH::Controls::MaxElementLength3D();
aControl->SetPrecision( myControlsPrecision );
aFunctor.reset( aControl );
myControlActor = my3DActor;
break;
}
case eMinimumAngle:
{
SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle();

View File

@ -115,7 +115,8 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eFreeNodes,
eFreeFaces, eMultiConnection, eArea, eTaper, eAspectRatio,
eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D};
eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D,
eMaxElementLength2D, eMaxElementLength3D};
virtual void SetControlMode(eControl theMode) = 0;
virtual eControl GetControlMode() = 0;

View File

@ -1062,6 +1062,14 @@
aTitle = QObject::tr( "FREE_FACES" );
aControl = SMESH_Actor::eFreeFaces;
break;
case 6022:
aTitle = QObject::tr( "MAX_ELEMENT_LENGTH_2D" );
aControl = SMESH_Actor::eMaxElementLength2D;
break;
case 6023:
aTitle = QObject::tr( "MAX_ELEMENT_LENGTH_3D" );
aControl = SMESH_Actor::eMaxElementLength3D;
break;
}
anActor->SetControlMode(aControl);
anActor->GetScalarBarActor()->SetTitle(aTitle.toLatin1().data());
@ -2812,6 +2820,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case 6005:
case 6009:
case 6021:
case 6022:
case 6023:
if ( vtkwnd ) {
LightApp_SelectionMgr* mgr = selectionMgr();
@ -3042,6 +3052,8 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 6001, "LENGTH", "ICON_LENGTH", 0, true );
createSMESHAction( 6002, "FREE_EDGE", "ICON_FREE_EDGE", 0, true );
createSMESHAction( 6021, "FREE_FACES", "ICON_FREE_FACES", 0, true );
createSMESHAction( 6022, "MAX_ELEMENT_LENGTH_2D", "ICON_MAX_ELEMENT_LENGTH_2D", 0, true );
createSMESHAction( 6023, "MAX_ELEMENT_LENGTH_3D", "ICON_MAX_ELEMENT_LENGTH_3D", 0, true );
createSMESHAction( 6003, "FREE_BORDER", "ICON_FREE_EDGE_2D", 0, true );
createSMESHAction( 6004, "CONNECTION", "ICON_CONNECTION", 0, true );
createSMESHAction( 6005, "FREE_NODE", "ICON_FREE_NODE", 0, true );
@ -3147,6 +3159,10 @@ void SMESHGUI::initialize( CAM_Application* app )
int importId = createMenu( tr( "MEN_IMPORT" ), fileId, -1, 10 ),
exportId = createMenu( tr( "MEN_EXPORT" ), fileId, -1, 10 ),
nodeId = createMenu( tr( "MEN_NODE_CTRL" ), ctrlId, -1, 10 ),
edgeId = createMenu( tr( "MEN_EDGE_CTRL" ), ctrlId, -1, 10 ),
faceId = createMenu( tr( "MEN_FACE_CTRL" ), ctrlId, -1, 10 ),
volumeId = createMenu( tr( "MEN_VOLUME_CTRL" ), ctrlId, -1, 10 ),
addId = createMenu( tr( "MEN_ADD" ), modifyId, 402 ),
removeId = createMenu( tr( "MEN_REMOVE" ), modifyId, 403 ),
renumId = createMenu( tr( "MEN_RENUM" ), modifyId, 404 ),
@ -3197,25 +3213,24 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( 904, meshId, -1 );
createMenu( separator(), meshId, -1 );
createMenu( 6003, ctrlId, -1 );
createMenu( 6001, ctrlId, -1 );
createMenu( 6004, ctrlId, -1 );
createMenu( separator(), ctrlId, -1 );
createMenu( 6005, ctrlId, -1 );
createMenu( 6002, ctrlId, -1 );
createMenu( 6018, ctrlId, -1 );
createMenu( 6019, ctrlId, -1 );
createMenu( 6011, ctrlId, -1 );
createMenu( 6012, ctrlId, -1 );
createMenu( 6013, ctrlId, -1 );
createMenu( 6014, ctrlId, -1 );
createMenu( 6015, ctrlId, -1 );
createMenu( 6016, ctrlId, -1 );
createMenu( separator(), ctrlId, -1 );
createMenu( 6017, ctrlId, -1 );
createMenu( 6009, ctrlId, -1 );
createMenu( 6021, ctrlId, -1 );
createMenu( separator(), ctrlId, -1 );
createMenu( 6005, nodeId, -1 );
createMenu( 6002, edgeId, -1 );
createMenu( 6003, edgeId, -1 );
createMenu( 6001, edgeId, -1 );
createMenu( 6004, edgeId, -1 );
createMenu( 6021, faceId, -1 );
createMenu( 6018, faceId, -1 );
createMenu( 6019, faceId, -1 );
createMenu( 6011, faceId, -1 );
createMenu( 6012, faceId, -1 );
createMenu( 6013, faceId, -1 );
createMenu( 6014, faceId, -1 );
createMenu( 6015, faceId, -1 );
createMenu( 6016, faceId, -1 );
createMenu( 6022, faceId, -1 );
createMenu( 6017, volumeId, -1 );
createMenu( 6009, volumeId, -1 );
createMenu( 6023, volumeId, -1 );
createMenu( 4000, addId, -1 );
createMenu( 4009, addId, -1 );
@ -3299,12 +3314,14 @@ void SMESHGUI::initialize( CAM_Application* app )
createTool( 904, meshTb );
createTool( separator(), meshTb );
createTool( 6001, ctrlTb );
createTool( 6005, ctrlTb );
createTool( separator(), ctrlTb );
createTool( 6002, ctrlTb );
createTool( 6003, ctrlTb );
createTool( 6001, ctrlTb );
createTool( 6004, ctrlTb );
createTool( separator(), ctrlTb );
createTool( 6005, ctrlTb );
createTool( 6002, ctrlTb );
createTool( 6021, ctrlTb );
createTool( 6018, ctrlTb );
createTool( 6019, ctrlTb );
createTool( 6011, ctrlTb );
@ -3313,10 +3330,11 @@ void SMESHGUI::initialize( CAM_Application* app )
createTool( 6014, ctrlTb );
createTool( 6015, ctrlTb );
createTool( 6016, ctrlTb );
createTool( 6022, ctrlTb );
createTool( separator(), ctrlTb );
createTool( 6017, ctrlTb );
createTool( 6009, ctrlTb );
createTool( 6021, ctrlTb );
createTool( 6023, ctrlTb );
createTool( separator(), ctrlTb );
createTool( 4000, addRemTb );
@ -3601,75 +3619,87 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( 6003 ), anId, -1 ); // FREE_BORDER
popupMgr()->setRule( action( 6003 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6003 ), "controlMode = 'eFreeBorders'", QtxPopupMgr::ToggleRule );
int aSubId = popupMgr()->insert( tr( "MEN_NODE_CTRL" ), anId, -1 ); // NODE CONTROLS
popupMgr()->insert( action( 6001 ), anId, -1 ); // LENGTH
popupMgr()->setRule( action( 6001 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6001 ), "controlMode = 'eLength'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6004 ), anId, -1 ); // CONNECTION
popupMgr()->setRule( action( 6004 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6004 ), "controlMode = 'eMultiConnection'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( 6005 ), anId, -1 ); // FREE_NODE
popupMgr()->insert( action( 6005 ), aSubId, -1 ); // FREE_NODE
popupMgr()->setRule( action( 6005 ), aMeshInVtkHasNodes, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6005 ), "controlMode = 'eFreeNodes'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6002 ), anId, -1 ); // FREE_EDGE
aSubId = popupMgr()->insert( tr( "MEN_EDGE_CTRL" ), anId, -1 ); // EDGE CONTROLS
popupMgr()->insert( action( 6002 ), aSubId, -1 ); // FREE_EDGE
popupMgr()->setRule( action( 6002 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6002 ), "controlMode = 'eFreeEdges'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6018 ), anId, -1 ); // LENGTH_2D
popupMgr()->setRule( action( 6018 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6018 ), "controlMode = 'eLength2D'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6003 ), aSubId, -1 ); // FREE_BORDER
popupMgr()->setRule( action( 6003 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6003 ), "controlMode = 'eFreeBorders'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6019 ), anId, -1 ); // CONNECTION_2D
popupMgr()->setRule( action( 6019 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6019 ), "controlMode = 'eMultiConnection2D'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6001 ), aSubId, -1 ); // LENGTH
popupMgr()->setRule( action( 6001 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6001 ), "controlMode = 'eLength'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6011 ), anId, -1 ); // AREA
popupMgr()->setRule( action( 6011 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6011 ), "controlMode = 'eArea'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6004 ), aSubId, -1 ); // CONNECTION
popupMgr()->setRule( action( 6004 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6004 ), "controlMode = 'eMultiConnection'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6012 ), anId, -1 ); // TAPER
popupMgr()->setRule( action( 6012 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6012 ), "controlMode = 'eTaper'", QtxPopupMgr::ToggleRule );
aSubId = popupMgr()->insert( tr( "MEN_FACE_CTRL" ), anId, -1 ); // FACE CONTROLS
popupMgr()->insert( action( 6013 ), anId, -1 ); // ASPECT
popupMgr()->setRule( action( 6013 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6013 ), "controlMode = 'eAspectRatio'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6014 ), anId, -1 ); // MIN_ANG
popupMgr()->setRule( action( 6014 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6014 ), "controlMode = 'eMinimumAngle'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6015 ), anId, -1 ); // WARP
popupMgr()->setRule( action( 6015 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6015 ), "controlMode = 'eWarping'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6016 ), anId, -1 ); // SKEW
popupMgr()->setRule( action( 6016 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6016 ), "controlMode = 'eSkew'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( 6017 ), anId, -1 ); // ASPECT_3D
popupMgr()->setRule( action( 6017 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6017 ), "controlMode = 'eAspectRatio3D'", QtxPopupMgr::ToggleRule );
popupMgr()->insert ( action( 6009 ), anId, -1 ); // VOLUME_3D
popupMgr()->setRule( action( 6009 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6009 ), "controlMode = 'eVolume3D'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6021 ), anId, -1 ); // FREE_FACE
popupMgr()->insert( action( 6021 ), aSubId, -1 ); // FREE_FACE
popupMgr()->setRule( action( 6021 ), aMeshInVtkHasFaces /*aMeshInVtkHasVolumes*/,
QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6021 ), "controlMode = 'eFreeFaces'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6018 ), aSubId, -1 ); // LENGTH_2D
popupMgr()->setRule( action( 6018 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6018 ), "controlMode = 'eLength2D'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6019 ), aSubId, -1 ); // CONNECTION_2D
popupMgr()->setRule( action( 6019 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6019 ), "controlMode = 'eMultiConnection2D'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6011 ), aSubId, -1 ); // AREA
popupMgr()->setRule( action( 6011 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6011 ), "controlMode = 'eArea'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6012 ), aSubId, -1 ); // TAPER
popupMgr()->setRule( action( 6012 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6012 ), "controlMode = 'eTaper'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6013 ), aSubId, -1 ); // ASPECT
popupMgr()->setRule( action( 6013 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6013 ), "controlMode = 'eAspectRatio'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6014 ), aSubId, -1 ); // MIN_ANG
popupMgr()->setRule( action( 6014 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6014 ), "controlMode = 'eMinimumAngle'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6015 ), aSubId, -1 ); // WARP
popupMgr()->setRule( action( 6015 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6015 ), "controlMode = 'eWarping'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6016 ), aSubId, -1 ); // SKEW
popupMgr()->setRule( action( 6016 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6016 ), "controlMode = 'eSkew'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6022 ), aSubId, -1 ); // MAX_ELEMENT_LENGTH_2D
popupMgr()->setRule( action( 6022 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6022 ), "controlMode = 'eMaxElementLength2D'", QtxPopupMgr::ToggleRule );
aSubId = popupMgr()->insert( tr( "MEN_VOLUME_CTRL" ), anId, -1 ); // VOLUME CONTROLS
popupMgr()->insert( action( 6017 ), aSubId, -1 ); // ASPECT_3D
popupMgr()->setRule( action( 6017 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6017 ), "controlMode = 'eAspectRatio3D'", QtxPopupMgr::ToggleRule );
popupMgr()->insert ( action( 6009 ), aSubId, -1 ); // VOLUME_3D
popupMgr()->setRule( action( 6009 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6009 ), "controlMode = 'eVolume3D'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( action( 6023 ), aSubId, -1 ); // MAX_ELEMENT_LENGTH_3D
popupMgr()->setRule( action( 6023 ), aMeshInVtkHasVolumes, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( 6023 ), "controlMode = 'eMaxElementLength3D'", QtxPopupMgr::ToggleRule );
popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( 201 ), anId, -1 ); // SCALAR_BAR_PROP

View File

@ -1363,6 +1363,8 @@ const char* SMESHGUI_FilterTable::getPrecision( const int aType )
retval = "len_tol_precision"; break;
case SMESH::FT_Length:
case SMESH::FT_Length2D:
case SMESH::FT_MaxElementLength2D:
case SMESH::FT_MaxElementLength3D:
retval = "length_precision"; break;
case SMESH::FT_Volume3D:
retval = "vol_precision"; break;
@ -1776,6 +1778,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_Taper ] = tr("TAPER");
aCriteria[ SMESH::FT_Skew ] = tr("SKEW");
aCriteria[ SMESH::FT_Area ] = tr("AREA");
aCriteria[ SMESH::FT_MaxElementLength2D ] = tr("MAX_ELEMENT_LENGTH_2D");
aCriteria[ SMESH::FT_FreeEdges ] = tr("FREE_EDGES");
aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS");
aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM");
@ -1797,14 +1800,15 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
static QMap<int, QString> aCriteria;
if (aCriteria.isEmpty())
{
aCriteria[ SMESH::FT_AspectRatio3D ] = tr("ASPECT_RATIO_3D");
aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS");
aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM");
aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
aCriteria[ SMESH::FT_BadOrientedVolume ] = tr("BAD_ORIENTED_VOLUME");
aCriteria[ SMESH::FT_Volume3D ] = tr("VOLUME_3D");
aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR");
aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
aCriteria[ SMESH::FT_AspectRatio3D ] = tr("ASPECT_RATIO_3D");
aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS");
aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM");
aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
aCriteria[ SMESH::FT_BadOrientedVolume ] = tr("BAD_ORIENTED_VOLUME");
aCriteria[ SMESH::FT_Volume3D ] = tr("VOLUME_3D");
aCriteria[ SMESH::FT_MaxElementLength3D ] = tr("MAX_ELEMENT_LENGTH_3D");
aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR");
aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE");
}
return aCriteria;

View File

@ -271,6 +271,8 @@ QString SMESHGUI_Selection::controlMode( int ind ) const
case SMESH_Actor::eMultiConnection2D: return "eMultiConnection2D";
case SMESH_Actor::eArea: return "eArea";
case SMESH_Actor::eVolume3D: return "eVolume3D";
case SMESH_Actor::eMaxElementLength2D: return "eMaxElementLength2D";
case SMESH_Actor::eMaxElementLength3D: return "eMaxElementLength3D";
case SMESH_Actor::eTaper: return "eTaper";
case SMESH_Actor::eAspectRatio: return "eAspectRatio";
case SMESH_Actor::eAspectRatio3D: return "eAspectRatio3D";

View File

@ -289,6 +289,14 @@
<source>ICON_MAP</source>
<translation>mesh_pattern.png</translation>
</message>
<message>
<source>ICON_MAX_ELEMENT_LENGTH_2D</source>
<translation>mesh_max_element_length_2d.png</translation>
</message>
<message>
<source>ICON_MAX_ELEMENT_LENGTH_3D</source>
<translation>mesh_max_element_length_3d.png</translation>
</message>
<message>
<source>ICON_OBJBROWSER_SMESH</source>
<translation>mesh.png</translation>

View File

@ -107,6 +107,14 @@
<source>LOCAL_ALGO</source>
<translation>Local</translation>
</message>
<message>
<source>MAX_ELEMENT_LENGTH_2D</source>
<translation>Max Element Length 2D</translation>
</message>
<message>
<source>MAX_ELEMENT_LENGTH_3D</source>
<translation>Max Element Length 3D</translation>
</message>
<message>
<source>MEN_ADD</source>
<translation>Add</translation>
@ -207,6 +215,22 @@
<source>MEN_CTRL</source>
<translation>Controls</translation>
</message>
<message>
<source>MEN_NODE_CTRL</source>
<translation>Node Controls</translation>
</message>
<message>
<source>MEN_EDGE_CTRL</source>
<translation>Edge Controls</translation>
</message>
<message>
<source>MEN_FACE_CTRL</source>
<translation>Face Controls</translation>
</message>
<message>
<source>MEN_VOLUME_CTRL</source>
<translation>Volume Controls</translation>
</message>
<message>
<source>MEN_CUT</source>
<translation>Cutting of Quadrangles</translation>
@ -387,6 +411,14 @@
<source>MEN_MAP</source>
<translation>Pattern Mapping</translation>
</message>
<message>
<source>MEN_MAX_ELEMENT_LENGTH_2D</source>
<translation>Max Element Length 2D</translation>
</message>
<message>
<source>MEN_MAX_ELEMENT_LENGTH_3D</source>
<translation>Max Element Length 3D</translation>
</message>
<message>
<source>MEN_MED</source>
<translation>MED file</translation>
@ -2344,6 +2376,14 @@ Consider saving your work before application crash</translation>
<source>STB_MAP</source>
<translation>Pattern mapping</translation>
</message>
<message>
<source>STB_MAX_ELEMENT_LENGTH_2D</source>
<translation>Max Element Length 2D</translation>
</message>
<message>
<source>STB_MAX_ELEMENT_LENGTH_3D</source>
<translation>Max Element Length 3D</translation>
</message>
<message>
<source>STB_MED</source>
<translation>Import MED file</translation>
@ -2864,6 +2904,14 @@ Consider saving your work before application crash</translation>
<source>TOP_MAP</source>
<translation>Pattern mapping</translation>
</message>
<message>
<source>TOP_MAX_ELEMENT_LENGTH_2D</source>
<translation>Max Element Length 2D</translation>
</message>
<message>
<source>TOP_MAX_ELEMENT_LENGTH_3D</source>
<translation>Max Element Length 3D</translation>
</message>
<message>
<source>TOP_MED</source>
<translation>Import MED file</translation>
@ -4204,6 +4252,14 @@ Please enter correct value and try again</translation>
<source>LYING_ON_GEOM</source>
<translation>Lying on Geom</translation>
</message>
<message>
<source>MAX_ELEMENT_LENGTH_2D</source>
<translation>Max Element Length 2D</translation>
</message>
<message>
<source>MAX_ELEMENT_LENGTH_3D</source>
<translation>Max Element Length 3D</translation>
</message>
<message>
<source>MINIMUM_ANGLE</source>
<translation>Minimum angle</translation>

View File

@ -274,6 +274,8 @@ namespace SMESH
case FT_Skew: myStream<< "aSkew"; break;
case FT_Area: myStream<< "aArea"; break;
case FT_Volume3D: myStream<< "aVolume3D"; break;
case FT_MaxElementLength2D:myStream<< "aMaxElementLength2D";break;
case FT_MaxElementLength3D:myStream<< "aMaxElementLength3D";break;
case FT_FreeBorders: myStream<< "aFreeBorders"; break;
case FT_FreeEdges: myStream<< "aFreeEdges"; break;
case FT_FreeNodes: myStream<< "aFreeNodes"; break;

View File

@ -760,6 +760,36 @@ FunctorType Volume3D_i::GetFunctorType()
return SMESH::FT_Volume3D;
}
/*
Class : MaxElementLength2D_i
Description : Functor for calculating maximum length of 2D element
*/
MaxElementLength2D_i::MaxElementLength2D_i()
{
myNumericalFunctorPtr.reset( new Controls::MaxElementLength2D() );
myFunctorPtr = myNumericalFunctorPtr;
}
FunctorType MaxElementLength2D_i::GetFunctorType()
{
return SMESH::FT_MaxElementLength2D;
}
/*
Class : MaxElementLength3D_i
Description : Functor for calculating maximum length of 3D element
*/
MaxElementLength3D_i::MaxElementLength3D_i()
{
myNumericalFunctorPtr.reset( new Controls::MaxElementLength3D() );
myFunctorPtr = myNumericalFunctorPtr;
}
FunctorType MaxElementLength3D_i::GetFunctorType()
{
return SMESH::FT_MaxElementLength3D;
}
/*
Class : Length_i
Description : Functor for calculating length off edge
@ -1817,6 +1847,24 @@ Volume3D_ptr FilterManager_i::CreateVolume3D()
}
MaxElementLength2D_ptr FilterManager_i::CreateMaxElementLength2D()
{
SMESH::MaxElementLength2D_i* aServant = new SMESH::MaxElementLength2D_i();
SMESH::MaxElementLength2D_var anObj = aServant->_this();
TPythonDump()<<aServant<<" = "<<this<<".CreateMaxElementLength2D()";
return anObj._retn();
}
MaxElementLength3D_ptr FilterManager_i::CreateMaxElementLength3D()
{
SMESH::MaxElementLength3D_i* aServant = new SMESH::MaxElementLength3D_i();
SMESH::MaxElementLength3D_var anObj = aServant->_this();
TPythonDump()<<aServant<<" = "<<this<<".CreateMaxElementLength3D()";
return anObj._retn();
}
Length_ptr FilterManager_i::CreateLength()
{
SMESH::Length_i* aServant = new SMESH::Length_i();
@ -2528,6 +2576,12 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
case SMESH::FT_Volume3D:
aFunctor = aFilterMgr->CreateVolume3D();
break;
case SMESH::FT_MaxElementLength2D:
aFunctor = aFilterMgr->CreateMaxElementLength2D();
break;
case SMESH::FT_MaxElementLength3D:
aFunctor = aFilterMgr->CreateMaxElementLength3D();
break;
// Predicates
@ -2817,6 +2871,8 @@ static inline LDOMString toString( CORBA::Long theType )
case FT_Skew : return "Skew";
case FT_Area : return "Area";
case FT_Volume3D : return "Volume3D";
case FT_MaxElementLength2D: return "Max element length 2D";
case FT_MaxElementLength3D: return "Max element length 3D";
case FT_BelongToGeom : return "Belong to Geom";
case FT_BelongToPlane : return "Belong to Plane";
case FT_BelongToCylinder: return "Belong to Cylinder";
@ -2859,6 +2915,8 @@ static inline SMESH::FunctorType toFunctorType( const LDOMString& theStr )
else if ( theStr.equals( "Skew" ) ) return FT_Skew;
else if ( theStr.equals( "Area" ) ) return FT_Area;
else if ( theStr.equals( "Volume3D" ) ) return FT_Volume3D;
else if ( theStr.equals( "Max element length 2D" ) ) return FT_MaxElementLength2D;
else if ( theStr.equals( "Max element length 3D" ) ) return FT_MaxElementLength3D;
else if ( theStr.equals( "Belong to Geom" ) ) return FT_BelongToGeom;
else if ( theStr.equals( "Belong to Plane" ) ) return FT_BelongToPlane;
else if ( theStr.equals( "Belong to Cylinder" ) ) return FT_BelongToCylinder;

View File

@ -271,6 +271,32 @@ namespace SMESH
};
/*
Class : MaxElementLength2D_i
Description : Functor for calculating maximum length of 2D element
*/
class SMESH_I_EXPORT MaxElementLength2D_i: public virtual POA_SMESH::MaxElementLength2D,
public virtual NumericalFunctor_i
{
public:
MaxElementLength2D_i();
FunctorType GetFunctorType();
};
/*
Class : MaxElementLength3D_i
Description : Functor for calculating maximum length of 3D element
*/
class SMESH_I_EXPORT MaxElementLength3D_i: public virtual POA_SMESH::MaxElementLength3D,
public virtual NumericalFunctor_i
{
public:
MaxElementLength3D_i();
FunctorType GetFunctorType();
};
/*
Class : Length_i
Description : Functor for calculating length of edge
@ -891,6 +917,8 @@ namespace SMESH
Skew_ptr CreateSkew();
Area_ptr CreateArea();
Volume3D_ptr CreateVolume3D();
MaxElementLength2D_ptr CreateMaxElementLength2D();
MaxElementLength3D_ptr CreateMaxElementLength3D();
Length_ptr CreateLength();
Length2D_ptr CreateLength2D();
MultiConnection_ptr CreateMultiConnection();

View File

@ -128,4 +128,16 @@ print "Criterion: Borders at multi-connections = 2 Nb = ", len( anIds )
#print anIds[ i ]
# Criterion : Max Element Length 2D > 10
# create group
aGroup = mesh.MakeGroup("Max Element Length 2D > 10", smesh.FACE, smesh.FT_MaxElementLength2D, smesh.FT_MoreThan, 10 )
# print result
anIds = aGroup.GetIDs()
print "Criterion: Max Element Length 2D > 10 Nb = ", len( anIds )
#for i in range( len( anIds ) ):
#print anIds[ i ]
salome.sg.updateObjBrowser(1)

View File

@ -866,6 +866,10 @@ class smeshDC(SMESH._objref_SMESH_Gen):
return aFilterMgr.CreateArea()
elif theCriterion == FT_Volume3D:
return aFilterMgr.CreateVolume3D()
elif theCriterion == FT_MaxElementLength2D:
return aFilterMgr.CreateMaxElementLength2D()
elif theCriterion == FT_MaxElementLength3D:
return aFilterMgr.CreateMaxElementLength3D()
elif theCriterion == FT_MultiConnection:
return aFilterMgr.CreateMultiConnection()
elif theCriterion == FT_MultiConnection2D:
@ -3823,6 +3827,17 @@ class Mesh:
def GetVolume(self, elemId):
return self._valueFromFunctor(SMESH.FT_Volume3D, elemId)
## Get maximum element length.
# @param elemId mesh element ID
# @return element's maximum length value
# @ingroup l1_measurements
def GetMaxElementLength(self, elemId):
if self.GetElementType(elemId, True) == SMESH.VOLUME:
ftype = SMESH.FT_MaxElementLength3D
else:
ftype = SMESH.FT_MaxElementLength2D
return self._valueFromFunctor(ftype, elemId)
## Get aspect ratio of 2D or 3D element.
# @param elemId mesh element ID
# @return element's aspect ratio value