Add "Deflection 2D" quality control

for GPUSPHGUI project
This commit is contained in:
eap 2017-10-12 19:52:03 +03:00
parent 85f0b9ca16
commit 05a257d4f4
33 changed files with 649 additions and 272 deletions

View File

@ -0,0 +1,45 @@
# Deflection 2D
import salome
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
import SMESH
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
# fuse a box and a sphere
Sphere_1 = geompy.MakeSphereR(100)
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
Fuse = geompy.MakeFuse( Sphere_1, Box_1, theName="box + sphere" )
# create a mesh
mesh = smesh.Mesh( Fuse, "Deflection_2D")
algo = mesh.Segment()
algo.LocalLength(35)
algo = mesh.Triangle()
mesh.Compute()
# get min and max deflection
minMax = mesh.GetMinMax( SMESH.FT_Deflection2D )
print "min and max deflection: ", minMax
# get deflection of a certain face
faceID = mesh.NbEdges() + mesh.NbFaces()
defl = mesh.FunctorValue( SMESH.FT_Deflection2D, faceID )
print "deflection of face %s = %s" % ( faceID, defl )
margin = minMax[1] / 2
# get all faces with deflection LESS than the margin
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Deflection2D, '<', margin, mesh=mesh)
anIds = aFilter.GetIDs()
print "%s faces have deflection less than %s" %( len(anIds), margin )
# create a group of faces with deflection MORE than the margin
aGroup = mesh.MakeGroup("Deflection > " + `margin`, SMESH.FACE, SMESH.FT_Deflection2D,'>',margin)
print "%s faces have deflection more than %s: %s ..." %( aGroup.Size(), margin, aGroup.GetIDs()[:10] )
salome.sg.updateObjBrowser(True)

View File

@ -156,6 +156,7 @@ SET(GOOD_TESTS
quality_controls_ex17.py
quality_controls_ex18.py
quality_controls_ex19.py
quality_controls_defl.py
transforming_meshes_ex01.py
transforming_meshes_ex02.py
transforming_meshes_ex03.py

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -7,21 +7,22 @@ specific condition or a set of conditions. Filters can be used to create
or edit mesh groups, remove elements from the mesh, control
mesh quality by different parameters, etc.
Several criteria can be combined together by using logical operators \a
AND and \a OR. In addition, a filter criterion can be reverted
using logical operator \a NOT.
Several \ref filtering_criteria "filtering criteria" can be combined
together by using logical operators \a AND and \a OR. In addition, a
filter criterion can be reverted using logical operator \a NOT.
Some filtering criteria use the functionality of \ref quality_page "mesh quality controls"
to filter mesh nodes / elements by specific characteristic (Area, Length, etc).
Some filtering criteria use the functionality of \ref quality_page
"mesh quality controls" to filter mesh nodes / elements by specific
characteristic (Area, Length, etc).
The functinality of mesh filters is available in both GUI and TUI
modes:
- In GUI, filters are available in some dialog boxes via
"Set Filters" button, clicking on which opens the dialog box
- In GUI, filters are available in some dialog boxes via "Set Filters"
button, clicking on which opens the \ref filtering_elements "dialog box"
allowing to specify the list of filter criteria to be applied to the
current selection. See \subpage selection_filter_library_page page to learn more
about selection filters and their usage in GUI.
current selection. See \subpage selection_filter_library_page page to
learn more about selection filters and their usage in GUI.
- In Python scripts, filters can be used to choose only some mesh
entities (nodes or elements) for the operations, which require the

View File

@ -37,6 +37,7 @@ Face quality controls:
<li>\subpage bare_border_faces_page "Bare border faces"</li>
<li>\subpage over_constrained_faces_page "Over-constrained faces"</li>
<li>\subpage length_2d_page "Length 2D"</li>
<li>\subpage deflection_2d_page "Deflection 2D"</li>
<li>\subpage borders_at_multi_connection_2d_page "Borders at multi-connection 2D"</li>
<li>\subpage area_page "Area"</li>
<li>\subpage taper_page "Taper"</li>

View File

@ -0,0 +1,25 @@
/*!
\page deflection_2d_page Deflection 2D
\n This quality control criterion consists of calculation of distance
between a mesh face gravity corner and the surface the face discretizes.
<em>To apply the Deflection 2D quality criterion to your mesh:</em>
<ol>
<li>Display your mesh in the viewer. </li>
<li>Choose <b>Controls > Face Controls > Deflection 2D</b> or click
<em>"Deflection 2D"</em> button in the toolbar.
Your mesh will be displayed in the viewer with faces colored according
to the applied mesh quality control criterion:
\image html deflection_2d.png
</li>
</ol>
<br><b>See Also</b> a sample TUI Script of a
\ref tui_deflection_2d "Deflection 2D quality control" operation.
*/

View File

@ -2,6 +2,10 @@
\page selection_filter_library_page Selection filter library
\tableofcontents
\section selection_filter_library Filter library
\n Selection filter library allows creating and storing in files
the filters that can be later reused for operations on meshes. You can
access it from the Main Menu via <b>Tools / Selection filter library</b>.
@ -18,8 +22,7 @@ the current study. You can \b Add or \b Delete filters.
\n In <b>Filter name</b> box you can specify the name for your
filter. By default it is prefixed with the corresponding entity type.
\anchor filtering_elements
<h2>Filter Dialog</h2>
\section filtering_elements Filter Dialog
When we use filters during group creation or another operation (by
clicking <b>Set Filter</b> button in the corresponding dialog), the
@ -64,6 +67,8 @@ in the Library.
is no selected mesh in the Object Browser and the filter can not be
created. You have to select the mesh and the button will be enabled.
\section filtering_criteria Filtering Criteria
Some criteria are applicable to all <b>Entity types</b>:
<ul><li>
<b>Belong to Geom</b> selects entities whose all nodes lie on the
@ -231,6 +236,10 @@ normal to the neighboring face and the normal to the selected face is less then
angular tolerance (defined in degrees). Selection continues among all neighbor faces of already
selected ones.<br>
</li><li>
<b>Deflection 2D</b> selects 2D mesh elements having distance between their gravity
centers and underlying surfaces, which is more, less or equal (within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>. See also a
\ref deflection_2d_page "Deflection 2D quality control".
</li><li>
<b>Element Diameter 2D</b> selects triangles and quadrangles composed 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

View File

@ -37,6 +37,9 @@
\section tui_length_2d Length 2D
\tui_script{quality_controls_ex11.py}
\section tui_deflection_2d Deflection 2D
\tui_script{quality_controls_defl.py}
\section tui_borders_at_multiconnection_2d Borders at Multiconnection 2D
\tui_script{quality_controls_ex12.py}

View File

@ -61,6 +61,7 @@ module SMESH
FT_MultiConnection2D,
FT_Length,
FT_Length2D,
FT_Deflection2D,
FT_NodeConnectivityNumber,
FT_BelongToMeshGroup,
FT_BelongToGeom,
@ -150,6 +151,7 @@ module SMESH
typedef sequence<Value> Values;
Values GetValues();
};
interface Deflection2D : NumericalFunctor{};
interface MultiConnection : NumericalFunctor{};
interface MultiConnection2D : NumericalFunctor
{
@ -585,6 +587,7 @@ module SMESH
MaxElementLength3D CreateMaxElementLength3D();
Length CreateLength();
Length2D CreateLength2D();
Deflection2D CreateDeflection2D();
MultiConnection CreateMultiConnection();
MultiConnection2D CreateMultiConnection2D();
BallDiameter CreateBallDiameter();

View File

@ -228,6 +228,7 @@ SET(SMESH_RESOURCES_FILES
mesh_quality.png
mesh_show.png
mesh_hide.png
mesh_deflection.png
)
INSTALL(FILES ${SMESH_RESOURCES_FILES} DESTINATION ${SALOME_SMESH_INSTALL_RES_DATA})

Binary file not shown.

After

Width:  |  Height:  |  Size: 827 B

View File

@ -23,6 +23,7 @@
#include "SMESH_ControlsDef.hxx"
#include "SMDS_BallElement.hxx"
#include "SMDS_FacePosition.hxx"
#include "SMDS_Iterator.hxx"
#include "SMDS_Mesh.hxx"
#include "SMDS_MeshElement.hxx"
@ -41,6 +42,7 @@
#include <BRepAdaptor_Surface.hxx>
#include <BRepBndLib.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <BRep_Tool.hxx>
#include <Geom_CylindricalSurface.hxx>
@ -48,6 +50,7 @@
#include <Geom_Surface.hxx>
#include <NCollection_Map.hxx>
#include <Precision.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_SequenceOfAsciiString.hxx>
@ -261,13 +264,10 @@ bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
}
if ( anIter ) {
double xyz[3];
SMESH_NodeXYZ p;
while( anIter->more() ) {
if ( const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>( anIter->next() ))
{
aNode->GetXYZ( xyz );
theRes.push_back( gp_XYZ( xyz[0], xyz[1], xyz[2] ));
}
if ( p.Set( anIter->next() ))
theRes.push_back( p );
}
}
@ -1553,247 +1553,240 @@ SMDSAbs_ElementType Length::GetType() const
*/
//================================================================================
double Length2D::GetValue( long theElementId )
double Length2D::GetValue( const TSequenceOfXYZ& P )
{
TSequenceOfXYZ P;
double aVal = 0;
int len = P.size();
SMDSAbs_EntityType aType = P.getElementEntity();
if ( GetPoints( theElementId, P ))
{
double aVal = 0;
int len = P.size();
SMDSAbs_EntityType aType = P.getElementEntity();
switch (aType) {
case SMDSEntity_Edge:
if (len == 2)
aVal = getDistance( P( 1 ), P( 2 ) );
break;
case SMDSEntity_Quad_Edge:
if (len == 3) // quadratic edge
aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 ));
break;
case SMDSEntity_Triangle:
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 = Min(L1,Min(L2,L3));
}
break;
case SMDSEntity_Quadrangle:
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 ));
aVal = Min(Min(L1,L2),Min(L3,L4));
}
break;
case SMDSEntity_Quad_Triangle:
case SMDSEntity_BiQuad_Triangle:
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 = Min(L1,Min(L2,L3));
}
break;
case SMDSEntity_Quad_Quadrangle:
case SMDSEntity_BiQuad_Quadrangle:
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 ));
aVal = Min(Min(L1,L2),Min(L3,L4));
}
break;
case SMDSEntity_Tetra:
if (len == 4){ // tetrahedra
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 = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
}
break;
case SMDSEntity_Pyramid:
if (len == 5){ // pyramid
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 = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
aVal = Min(aVal,Min(L7,L8));
}
break;
case SMDSEntity_Penta:
if (len == 6) { // pentahedron
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 = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
aVal = Min(aVal,Min(Min(L7,L8),L9));
}
break;
case SMDSEntity_Hexa:
if (len == 8){ // hexahedron
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 ));
aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
aVal = Min(aVal,Min(Min(L7,L8),Min(L9,L10)));
aVal = Min(aVal,Min(L11,L12));
}
break;
case SMDSEntity_Quad_Tetra:
if (len == 10){ // quadratic tetrahedron
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 = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
}
break;
case SMDSEntity_Quad_Pyramid:
if (len == 13){ // quadratic pyramid
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 = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
aVal = Min(aVal,Min(L7,L8));
}
break;
case SMDSEntity_Quad_Penta:
case SMDSEntity_BiQuad_Penta:
if (len >= 15){ // quadratic pentahedron
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 = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
aVal = Min(aVal,Min(Min(L7,L8),L9));
}
break;
case SMDSEntity_Quad_Hexa:
case SMDSEntity_TriQuad_Hexa:
if (len >= 20) { // quadratic hexahedron
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 ));
aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
aVal = Min(aVal,Min(Min(L7,L8),Min(L9,L10)));
aVal = Min(aVal,Min(L11,L12));
}
break;
case SMDSEntity_Polygon:
if ( len > 1 ) {
aVal = getDistance( P(1), P( P.size() ));
for ( size_t i = 1; i < P.size(); ++i )
aVal = Min( aVal, getDistance( P( i ), P( i+1 )));
}
break;
case SMDSEntity_Quad_Polygon:
if ( len > 2 ) {
aVal = getDistance( P(1), P( P.size() )) + getDistance( P(P.size()), P( P.size()-1 ));
for ( size_t i = 1; i < P.size()-1; i += 2 )
aVal = Min( aVal, getDistance( P( i ), P( i+1 )) + getDistance( P( i+1 ), P( i+2 )));
}
break;
case SMDSEntity_Hexagonal_Prism:
if (len == 12) { // hexagonal prism
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( 5 ));
double L5 = getDistance(P( 5 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 1 ));
double L7 = getDistance(P( 7 ), P( 8 ));
double L8 = getDistance(P( 8 ), P( 9 ));
double L9 = getDistance(P( 9 ), P( 10 ));
double L10= getDistance(P( 10 ),P( 11 ));
double L11= getDistance(P( 11 ),P( 12 ));
double L12= getDistance(P( 12 ),P( 7 ));
double L13 = getDistance(P( 1 ),P( 7 ));
double L14 = getDistance(P( 2 ),P( 8 ));
double L15 = getDistance(P( 3 ),P( 9 ));
double L16 = getDistance(P( 4 ),P( 10 ));
double L17 = getDistance(P( 5 ),P( 11 ));
double L18 = getDistance(P( 6 ),P( 12 ));
aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
aVal = Min(aVal, Min(Min(Min(L7,L8),Min(L9,L10)),Min(L11,L12)));
aVal = Min(aVal, Min(Min(Min(L13,L14),Min(L15,L16)),Min(L17,L18)));
}
break;
case SMDSEntity_Polyhedra:
{
switch (aType) {
case SMDSEntity_Edge:
if (len == 2)
aVal = getDistance( P( 1 ), P( 2 ) );
break;
case SMDSEntity_Quad_Edge:
if (len == 3) // quadratic edge
aVal = getDistance(P( 1 ),P( 3 )) + getDistance(P( 3 ),P( 2 ));
break;
case SMDSEntity_Triangle:
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 = Min(L1,Min(L2,L3));
}
break;
default:
return 0;
case SMDSEntity_Quadrangle:
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 ));
aVal = Min(Min(L1,L2),Min(L3,L4));
}
if (aVal < 0 ) {
return 0.;
break;
case SMDSEntity_Quad_Triangle:
case SMDSEntity_BiQuad_Triangle:
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 = Min(L1,Min(L2,L3));
}
if ( myPrecision >= 0 )
{
double prec = pow( 10., (double)( myPrecision ) );
aVal = floor( aVal * prec + 0.5 ) / prec;
break;
case SMDSEntity_Quad_Quadrangle:
case SMDSEntity_BiQuad_Quadrangle:
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 ));
aVal = Min(Min(L1,L2),Min(L3,L4));
}
break;
case SMDSEntity_Tetra:
if (len == 4){ // tetrahedra
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 = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
}
break;
case SMDSEntity_Pyramid:
if (len == 5){ // pyramid
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 ));
return aVal;
aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
aVal = Min(aVal,Min(L7,L8));
}
break;
case SMDSEntity_Penta:
if (len == 6) { // pentahedron
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 = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
aVal = Min(aVal,Min(Min(L7,L8),L9));
}
break;
case SMDSEntity_Hexa:
if (len == 8){ // hexahedron
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 ));
aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
aVal = Min(aVal,Min(Min(L7,L8),Min(L9,L10)));
aVal = Min(aVal,Min(L11,L12));
}
break;
case SMDSEntity_Quad_Tetra:
if (len == 10){ // quadratic tetrahedron
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 = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
}
break;
case SMDSEntity_Quad_Pyramid:
if (len == 13){ // quadratic pyramid
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 = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
aVal = Min(aVal,Min(L7,L8));
}
break;
case SMDSEntity_Quad_Penta:
case SMDSEntity_BiQuad_Penta:
if (len >= 15){ // quadratic pentahedron
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 = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
aVal = Min(aVal,Min(Min(L7,L8),L9));
}
break;
case SMDSEntity_Quad_Hexa:
case SMDSEntity_TriQuad_Hexa:
if (len >= 20) { // quadratic hexahedron
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 ));
aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
aVal = Min(aVal,Min(Min(L7,L8),Min(L9,L10)));
aVal = Min(aVal,Min(L11,L12));
}
break;
case SMDSEntity_Polygon:
if ( len > 1 ) {
aVal = getDistance( P(1), P( P.size() ));
for ( size_t i = 1; i < P.size(); ++i )
aVal = Min( aVal, getDistance( P( i ), P( i+1 )));
}
break;
case SMDSEntity_Quad_Polygon:
if ( len > 2 ) {
aVal = getDistance( P(1), P( P.size() )) + getDistance( P(P.size()), P( P.size()-1 ));
for ( size_t i = 1; i < P.size()-1; i += 2 )
aVal = Min( aVal, getDistance( P( i ), P( i+1 )) + getDistance( P( i+1 ), P( i+2 )));
}
break;
case SMDSEntity_Hexagonal_Prism:
if (len == 12) { // hexagonal prism
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( 5 ));
double L5 = getDistance(P( 5 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 1 ));
double L7 = getDistance(P( 7 ), P( 8 ));
double L8 = getDistance(P( 8 ), P( 9 ));
double L9 = getDistance(P( 9 ), P( 10 ));
double L10= getDistance(P( 10 ),P( 11 ));
double L11= getDistance(P( 11 ),P( 12 ));
double L12= getDistance(P( 12 ),P( 7 ));
double L13 = getDistance(P( 1 ),P( 7 ));
double L14 = getDistance(P( 2 ),P( 8 ));
double L15 = getDistance(P( 3 ),P( 9 ));
double L16 = getDistance(P( 4 ),P( 10 ));
double L17 = getDistance(P( 5 ),P( 11 ));
double L18 = getDistance(P( 6 ),P( 12 ));
aVal = Min(Min(Min(L1,L2),Min(L3,L4)),Min(L5,L6));
aVal = Min(aVal, Min(Min(Min(L7,L8),Min(L9,L10)),Min(L11,L12)));
aVal = Min(aVal, Min(Min(Min(L13,L14),Min(L15,L16)),Min(L17,L18)));
}
break;
case SMDSEntity_Polyhedra:
{
}
return 0.;
break;
default:
return 0;
}
if (aVal < 0 ) {
return 0.;
}
if ( myPrecision >= 0 )
{
double prec = pow( 10., (double)( myPrecision ) );
aVal = floor( aVal * prec + 0.5 ) / prec;
}
return aVal;
}
double Length2D::GetBadRate( double Value, int /*nbNodes*/ ) const
@ -1908,6 +1901,80 @@ void Length2D::GetValues(TValues& theValues)
}
}
//================================================================================
/*
Class : Deflection2D
Description : Functor for calculating number of faces conneted to the edge
*/
//================================================================================
double Deflection2D::GetValue( const TSequenceOfXYZ& P )
{
if ( myMesh && P.getElement() )
{
// get underlying surface
if ( myShapeIndex != P.getElement()->getshapeId() )
{
mySurface.Nullify();
myShapeIndex = P.getElement()->getshapeId();
const TopoDS_Shape& S =
static_cast< const SMESHDS_Mesh* >( myMesh )->IndexToShape( myShapeIndex );
if ( !S.IsNull() && S.ShapeType() == TopAbs_FACE )
{
mySurface = new ShapeAnalysis_Surface( BRep_Tool::Surface( TopoDS::Face( S )));
}
}
// project gravity center to the surface
if ( !mySurface.IsNull() )
{
gp_XYZ gc(0,0,0);
gp_XY uv(0,0);
int nbUV = 0;
for ( size_t i = 0; i < P.size(); ++i )
{
gc += P(i+1);
if ( const SMDS_FacePosition* fPos = dynamic_cast<const SMDS_FacePosition*>
( P.getElement()->GetNode( i )->GetPosition() ))
{
uv.ChangeCoord(1) += fPos->GetUParameter();
uv.ChangeCoord(2) += fPos->GetVParameter();
++nbUV;
}
}
gc /= P.size();
if ( nbUV ) uv /= nbUV;
double maxLen = MaxElementLength2D().GetValue( P );
double tol = 1e-3 * maxLen;
if ( uv.X() != 0 && uv.Y() != 0 ) // faster way
mySurface->NextValueOfUV( uv, gc, tol, 0.5 * maxLen );
else
mySurface->ValueOfUV( gc, tol );
return Round( mySurface->Gap() );
}
}
return 0;
}
void Deflection2D::SetMesh( const SMDS_Mesh* theMesh )
{
NumericalFunctor::SetMesh( dynamic_cast<const SMESHDS_Mesh* >( theMesh ));
myShapeIndex = -100;
}
SMDSAbs_ElementType Deflection2D::GetType() const
{
return SMDSAbs_Face;
}
double Deflection2D::GetBadRate( double Value, int /*nbNodes*/ ) const
{
// meaningless as it is not quality control functor
return Value;
}
//================================================================================
/*
Class : MultiConnection

View File

@ -27,7 +27,6 @@
#include "SMESH_TypeDefs.hxx"
#include <BRepClass3d_SolidClassifier.hxx>
#include <Bnd_B3d.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
@ -55,6 +54,8 @@ class SMESHDS_SubMesh;
class SMESHDS_GroupBase;
class gp_Pnt;
class BRepClass3d_SolidClassifier;
class ShapeAnalysis_Surface;
namespace SMESH{
namespace Controls{
@ -293,7 +294,7 @@ namespace SMESH{
*/
class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{
public:
virtual double GetValue( long theElementId );
virtual double GetValue( const TSequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
struct Value{
@ -307,6 +308,21 @@ namespace SMESH{
};
typedef boost::shared_ptr<Length2D> Length2DPtr;
/*
Class : Deflection2D
Description : Functor for calculating distance between a face and geometry
*/
class SMESHCONTROLS_EXPORT Deflection2D: public virtual NumericalFunctor{
public:
virtual void SetMesh( const SMDS_Mesh* theMesh );
virtual double GetValue( const TSequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
private:
Handle(ShapeAnalysis_Surface) mySurface;
int myShapeIndex;
};
/*
Class : MultiConnection
Description : Functor for calculating number of faces connected to the edge

View File

@ -844,11 +844,9 @@ void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode )
break;
}
case eLength2D:
{
myFunctor.reset(new SMESH::Controls::Length2D());
myControlActor = my2DActor;
break;
}
case eFreeBorders:
myFunctor.reset(new SMESH::Controls::FreeBorders());
myControlActor = my1DActor;
@ -958,6 +956,14 @@ void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode )
myControlActor = my3DActor;
break;
}
case eDeflection2D:
{
SMESH::Controls::Deflection2D* aControl = new SMESH::Controls::Deflection2D();
aControl->SetPrecision( myControlsPrecision );
myFunctor.reset( aControl );
myControlActor = my2DActor;
break;
}
case eBareBorderVolume:
{
myFunctor.reset(new SMESH::Controls::BareBorderVolume());

View File

@ -141,7 +141,7 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
virtual void SetFacesOrientation3DVectors(bool theState) = 0;
virtual bool GetFacesOrientation3DVectors() = 0;
enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eFreeNodes,
enum eControl{eNone, eLength, eLength2D, eDeflection2D, eFreeBorders, eFreeEdges, eFreeNodes,
eFreeFaces, eMultiConnection, eArea, eTaper, eAspectRatio,
eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D,
eMaxElementLength2D, eMaxElementLength3D, eBareBorderFace, eBareBorderVolume,

View File

@ -701,7 +701,7 @@ public:
int idnode4, int idnode5, int idnode6) const;
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4,
int idnode5, int idnode6, int idnode7, int idnode8) const;
const SMDS_MeshElement *FindElement(int IDelem) const;
virtual const SMDS_MeshElement * FindElement(int IDelem) const;
static const SMDS_Mesh0DElement* Find0DElement(const SMDS_MeshNode * n);
static const SMDS_BallElement* FindBall(const SMDS_MeshNode * n);
static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,

View File

@ -51,6 +51,11 @@ namespace SMDS {
static VALUE value(VALUE_SET_ITERATOR it) { return (VALUE) it->second; }
};
template<typename VALUE,typename VALUE_SET_ITERATOR>
struct PointerAccessor {
static VALUE value(VALUE_SET_ITERATOR it) { return (VALUE) &(*it); }
};
///////////////////////////////////////////////////////////////////////////////
/// Filters of value pointed by iterator
///////////////////////////////////////////////////////////////////////////////

View File

@ -627,7 +627,7 @@ namespace
"SMESH_TETRAHEDRA","SMESH_QUADRATIC_TETRAHEDRONS","SMESH_PYRAMIDS",
"SMESH_QUADRATIC_PYRAMIDS","SMESH_HEXAHEDRA","SMESH_QUADRATIC_HEXAHEDRONS",
"SMESH_TRIQUADRATIC_HEXAHEDRONS","SMESH_PENTAHEDRA","SMESH_QUADRATIC_PENTAHEDRONS",
"SMESH_BIQUADRATIC_PENTAHEDRONS",
"SMESH_BIQUADRATIC_PENTAHEDRONS",
"SMESH_OCTAHEDRA","SMESH_POLYEDRONS","SMESH_QUADRATIC_POLYEDRONS","SMESH_BALLS"
};
// is typeMsg complete? (compilation failure mains that enum SMDSAbs_EntityType changed)
@ -1138,6 +1138,8 @@ namespace
type = QObject::tr( "LENGTH_EDGES" );
else if ( dynamic_cast< SMESH::Controls::Length2D* >( f.get() ) )
type = QObject::tr( "LENGTH2D_EDGES" );
else if ( dynamic_cast< SMESH::Controls::Deflection2D* >( f.get() ) )
type = QObject::tr( "DEFLECTION2D_FACES" );
else if ( dynamic_cast< SMESH::Controls::MultiConnection* >( f.get() ) )
type = QObject::tr( "MULTI_BORDERS" );
else if ( dynamic_cast< SMESH::Controls::MultiConnection2D* >( f.get() ) )
@ -1673,6 +1675,7 @@ namespace
ActionControl.Bind( SMESHOp::OpBareBorderFace, SMESH_Actor::eBareBorderFace );
ActionControl.Bind( SMESHOp::OpOverConstrainedFace, SMESH_Actor::eOverConstrainedFace );
ActionControl.Bind( SMESHOp::OpLength2D, SMESH_Actor::eLength2D );
ActionControl.Bind( SMESHOp::OpDeflection2D, SMESH_Actor::eDeflection2D );
ActionControl.Bind( SMESHOp::OpConnection2D, SMESH_Actor::eMultiConnection2D );
ActionControl.Bind( SMESHOp::OpArea, SMESH_Actor::eArea );
ActionControl.Bind( SMESHOp::OpTaper, SMESH_Actor::eTaper );
@ -3617,6 +3620,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpBareBorderFace:
case SMESHOp::OpOverConstrainedFace:
case SMESHOp::OpLength2D:
case SMESHOp::OpDeflection2D:
case SMESHOp::OpConnection2D:
case SMESHOp::OpArea:
case SMESHOp::OpTaper:
@ -3918,6 +3922,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( SMESHOp::OpBareBorderFace, "BARE_BORDER_FACE", "ICON_BARE_BORDER_FACE", 0, true );
createSMESHAction( SMESHOp::OpOverConstrainedFace, "OVER_CONSTRAINED_FACE", "ICON_OVER_CONSTRAINED_FACE", 0, true );
createSMESHAction( SMESHOp::OpLength2D, "LENGTH_2D", "ICON_LENGTH_2D", 0, true );
createSMESHAction( SMESHOp::OpDeflection2D, "DEFLECTION_2D", "ICON_DEFLECTION_2D", 0, true );
createSMESHAction( SMESHOp::OpConnection2D, "CONNECTION_2D", "ICON_CONNECTION_2D", 0, true );
createSMESHAction( SMESHOp::OpArea, "AREA", "ICON_AREA", 0, true );
createSMESHAction( SMESHOp::OpTaper, "TAPER", "ICON_TAPER", 0, true );
@ -4047,6 +4052,7 @@ void SMESHGUI::initialize( CAM_Application* app )
<< SMESHOp::OpNodeConnectivityNb // node controls
<< SMESHOp::OpFreeEdge << SMESHOp::OpFreeBorder
<< SMESHOp::OpLength << SMESHOp::OpConnection << SMESHOp::OpEqualEdge // edge controls
<< SMESHOp::OpDeflection2D
<< SMESHOp::OpFreeFace << SMESHOp::OpLength2D << SMESHOp::OpConnection2D
<< SMESHOp::OpArea << SMESHOp::OpTaper << SMESHOp::OpAspectRatio
<< SMESHOp::OpMinimumAngle << SMESHOp::OpWarpingAngle << SMESHOp::OpSkew
@ -4160,6 +4166,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( SMESHOp::OpSkew, faceId, -1 );
createMenu( SMESHOp::OpMaxElementLength2D, faceId, -1 );
createMenu( SMESHOp::OpEqualFace, faceId, -1 );
createMenu( SMESHOp::OpDeflection2D, faceId, -1 );
createMenu( SMESHOp::OpAspectRatio3D, volumeId, -1 );
createMenu( SMESHOp::OpVolume, volumeId, -1 );
createMenu( SMESHOp::OpMaxElementLength3D, volumeId, -1 );
@ -4309,6 +4316,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createTool( SMESHOp::OpSkew, ctrl2dTb );
createTool( SMESHOp::OpMaxElementLength2D, ctrl2dTb );
createTool( SMESHOp::OpEqualFace, ctrl2dTb );
createTool( SMESHOp::OpDeflection2D, ctrl2dTb );
createTool( SMESHOp::OpAspectRatio3D, ctrl3dTb );
createTool( SMESHOp::OpVolume, ctrl3dTb );
@ -4720,10 +4728,15 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->insert ( action( SMESHOp::OpOverConstrainedFace ), aSubId, -1 );
popupMgr()->setRule( action( SMESHOp::OpOverConstrainedFace ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( SMESHOp::OpOverConstrainedFace ), "controlMode = 'eOverConstrainedFace'", QtxPopupMgr::ToggleRule );
popupMgr()->insert ( action( SMESHOp::OpEqualFace ), aSubId, -1 );
popupMgr()->setRule( action( SMESHOp::OpEqualFace ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( SMESHOp::OpEqualFace ), "controlMode = 'eCoincidentElems2D'", QtxPopupMgr::ToggleRule );
popupMgr()->insert ( action( SMESHOp::OpDeflection2D ), aSubId, -1 );
popupMgr()->setRule( action( SMESHOp::OpDeflection2D ), aMeshInVtkHasFaces + " && hasGeomReference", QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( SMESHOp::OpDeflection2D ), "controlMode = 'eDeflection2D'", QtxPopupMgr::ToggleRule );
aSubId = popupMgr()->insert( tr( "MEN_VOLUME_CTRL" ), anId, -1 ); // VOLUME CONTROLS
popupMgr()->insert ( action( SMESHOp::OpAspectRatio3D ), aSubId, -1 );

View File

@ -1572,6 +1572,7 @@ void SMESHGUI_FilterTable::updateAdditionalWidget()
aCriterion == SMESH::FT_MaxElementLength3D ||
aCriterion == SMESH::FT_Length ||
aCriterion == SMESH::FT_Length2D ||
aCriterion == SMESH::FT_Deflection2D ||
aCriterion == SMESH::FT_BallDiameter );
bool toEnable = (( isDbl && ((ComboItem*)aTable->item(aRow, 1))->value() == SMESH::FT_EqualTo) ||
@ -1618,6 +1619,7 @@ const char* SMESHGUI_FilterTable::getPrecision( const int aType )
retval = "len_tol_precision"; break;
case SMESH::FT_Length:
case SMESH::FT_Length2D:
case SMESH::FT_Deflection2D:
case SMESH::FT_MaxElementLength2D:
case SMESH::FT_MaxElementLength3D:
case SMESH::FT_BallDiameter:
@ -1793,13 +1795,13 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
}
// find out a type of item required by a new criterion and other table features
int aCriterionType = GetCriterionType(row);
int aCriterionType = GetCriterionType(row);
bool anIsDoubleCriterion = false;
bool anIsIntCriterion = false;
bool anIsComboCriterion = false;
// other features:
QList<int> comboIDs; // values to show in a combo item
int nbCompareSigns = 0; // possible values are 0,1,3
int nbCompareSigns = 0; // possible values are 0,1,3
bool isThresholdEditable = false; // actual for "simple" item types
switch ( aCriterionType )
{
@ -1812,8 +1814,7 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
case SMESH::FT_Area:
case SMESH::FT_Volume3D:
case SMESH::FT_MaxElementLength2D:
case SMESH::FT_MaxElementLength3D:
anIsDoubleCriterion = true; break;
case SMESH::FT_MaxElementLength3D: anIsDoubleCriterion = true; break;
case SMESH::FT_FreeBorders:
case SMESH::FT_FreeEdges:
@ -1829,7 +1830,8 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
case SMESH::FT_MultiConnection2D: anIsIntCriterion = true; nbCompareSigns = 3; break;
case SMESH::FT_Length:
case SMESH::FT_Length2D: anIsDoubleCriterion = true; break;
case SMESH::FT_Length2D:
case SMESH::FT_Deflection2D: anIsDoubleCriterion = true; break;
case SMESH::FT_BelongToMeshGroup: break;
@ -2241,6 +2243,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE");
aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
aCriteria[ SMESH::FT_Length2D ] = tr("LENGTH2D");
aCriteria[ SMESH::FT_Deflection2D ] = tr("DEFLECTION2D");
aCriteria[ SMESH::FT_MultiConnection2D ] = tr("MULTI2D_BORDERS");
aCriteria[ SMESH::FT_FreeFaces ] = tr("FREE_FACES");
aCriteria[ SMESH::FT_BareBorderFace ] = tr("BARE_BORDER_FACE");

View File

@ -966,11 +966,13 @@ SMESHGUI_ElemInfo::~SMESHGUI_ElemInfo()
\brief Set mesh data source (actor)
\param actor mesh object actor
*/
void SMESHGUI_ElemInfo::setSource( SMESH_Actor* actor )
void SMESHGUI_ElemInfo::setSource( SMESH_Actor* actor, SMESH::SMESH_IDSource_var obj )
{
if ( myActor != actor ) {
myActor = actor;
myIsElement = -1;
SMESH::SMESH_Mesh_var mesh = obj->GetMesh();
myMeshHasShape = ( !mesh->_is_nil() && mesh->HasShapeToMesh() );
clear();
}
}
@ -1479,7 +1481,12 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
//ElemDiam2D
afunctor.reset( new SMESH::Controls::MaxElementLength2D() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MAX_ELEMENT_LENGTH_2D" )).arg( afunctor->GetValue( id )) );
//min edge length
afunctor.reset( new SMESH::Controls::Length2D() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MIN_ELEM_EDGE" )).arg( afunctor->GetValue( id )) );
}
if( e->GetType() == SMDSAbs_Volume ) {
//AspectRatio3D
@ -2026,6 +2033,15 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
skewItem->setText( 0, tr( "SKEW_ELEMENTS" ));
skewItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
}
//Deflection
if ( hasShapeToMesh() )
{
afunctor.reset( new SMESH::Controls::Deflection2D() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
QTreeWidgetItem* deflItem = createItem( cntrItem, Bold );
deflItem->setText( 0, tr( "DEFLECTION_2D" ));
deflItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
}
//ElemDiam2D
if ( !e->IsPoly() )
{
@ -2060,6 +2076,13 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
}
//min edge length
afunctor.reset( new SMESH::Controls::Length2D() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
QTreeWidgetItem* minEdgeItem = createItem( cntrItem, Bold );
minEdgeItem->setText( 0, tr( "MIN_ELEM_EDGE" ));
minEdgeItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
// gravity center
XYZ gc = gravityCenter( e );
QTreeWidgetItem* gcItem = createItem( elemItem, Bold );
@ -2990,7 +3013,7 @@ void SMESHGUI_MeshInfoDlg::showInfo( const Handle(SALOME_InteractiveObject)& IO
SMESH::GetNameOfSelectedElements( selector, IO, ID ) :
SMESH::GetNameOfSelectedNodes( selector, IO, ID );
}
myElemInfo->setSource( myActor ) ;
myElemInfo->setSource( myActor, obj ) ;
if ( nb > 0 ) {
myID->setText( ID.trimmed() );
QSet<long> ids;

View File

@ -153,7 +153,7 @@ public:
SMESHGUI_ElemInfo( QWidget* = 0 );
~SMESHGUI_ElemInfo();
void setSource( SMESH_Actor* );
void setSource( SMESH_Actor*, SMESH::SMESH_IDSource_var );
void showInfo( long, bool );
void showInfo( QSet<long>, bool );
void clear();
@ -179,6 +179,7 @@ protected:
QWidget* frame() const;
SMESH_Actor* actor() const;
bool isElements() const;
bool hasShapeToMesh() const { return myMeshHasShape; }
virtual void information( const QList<long>& ) = 0;
virtual void clearInternal();
@ -204,6 +205,7 @@ private:
QWidget* myFrame;
ExtraWidget* myExtra;
int myIndex;
bool myMeshHasShape;
};
class SMESHGUI_EXPORT SMESHGUI_SimpleElemInfo : public SMESHGUI_ElemInfo

View File

@ -116,6 +116,7 @@ namespace SMESHOp {
OpSkew = 3210, // MENU CONTROLS - SKEW
OpMaxElementLength2D = 3211, // MENU CONTROLS - ELEMENT DIAMETER 2D
OpEqualFace = 3212, // MENU CONTROLS - DOUBLE FACES
OpDeflection2D = 3213, // MENU CONTROLS - DEFLECTION 2D
OpAspectRatio3D = 3300, // MENU CONTROLS - ASPECT RATIO 3D
OpVolume = 3301, // MENU CONTROLS - VOLUME
OpMaxElementLength3D = 3302, // MENU CONTROLS - ELEMENT DIAMETER 3D

View File

@ -364,6 +364,7 @@ QString SMESHGUI_Selection::controlMode( int ind ) const
switch( actor->GetControlMode() ) {
case SMESH_Actor::eLength: mode = "eLength"; break;
case SMESH_Actor::eLength2D: mode = "eLength2D"; break;
case SMESH_Actor::eDeflection2D: mode = "eDeflection2D"; break;
case SMESH_Actor::eFreeEdges: mode = "eFreeEdges"; break;
case SMESH_Actor::eFreeNodes: mode = "eFreeNodes"; break;
case SMESH_Actor::eFreeBorders: mode = "eFreeBorders"; break;
@ -411,6 +412,11 @@ QString SMESHGUI_Selection::controlMode() const
return "eNone";
}
//=======================================================================
//function : isNumFunctor
//purpose : return true if a given actor is shown using a numeric functor
//=======================================================================
bool SMESHGUI_Selection::isNumFunctor( int ind ) const
{
bool result = false;
@ -419,6 +425,7 @@ bool SMESHGUI_Selection::isNumFunctor( int ind ) const
switch( actor->GetControlMode() ) {
case SMESH_Actor::eLength:
case SMESH_Actor::eLength2D:
case SMESH_Actor::eDeflection2D:
case SMESH_Actor::eMultiConnection:
case SMESH_Actor::eMultiConnection2D:
case SMESH_Actor::eArea:
@ -442,7 +449,7 @@ bool SMESHGUI_Selection::isNumFunctor( int ind ) const
//=======================================================================
//function : facesOrientationMode
//purpose :
//purpose :
//=======================================================================
QString SMESHGUI_Selection::facesOrientationMode( int ind ) const

View File

@ -347,6 +347,10 @@
<source>ICON_LENGTH_2D</source>
<translation>mesh_length_2d.png</translation>
</message>
<message>
<source>ICON_DEFLECTION_2D</source>
<translation>mesh_deflection.png</translation>
</message>
<message>
<source>ICON_MAP</source>
<translation>mesh_pattern.png</translation>

View File

@ -103,6 +103,10 @@
<source>MIN_DIAG_ELEMENTS</source>
<translation>Minimum diagonal</translation>
</message>
<message>
<source>MIN_ELEM_EDGE</source>
<translation>Minimum Edge Length</translation>
</message>
<message>
<source>ASPECTRATIO_3D_ELEMENTS</source>
<translation>Aspect Ratio 3D</translation>
@ -224,6 +228,10 @@
<source>LENGTH2D_EDGES</source>
<translation>Length 2D</translation>
</message>
<message>
<source>DEFLECTION2D_FACES</source>
<translation>Deflection 2D</translation>
</message>
<message>
<source>LENGTH_EDGES</source>
<translation>Length</translation>
@ -240,6 +248,10 @@
<source>MAX_ELEMENT_LENGTH_3D</source>
<translation>Element Diameter 3D</translation>
</message>
<message>
<source>DEFLECTION_2D</source>
<translation>Deflection 2D</translation>
</message>
<message>
<source>MEN_ADD</source>
<translation>Add</translation>
@ -692,6 +704,10 @@
<source>MEN_LENGTH_2D</source>
<translation>Length 2D</translation>
</message>
<message>
<source>MEN_DEFLECTION_2D</source>
<translation>Deflection 2D</translation>
</message>
<message>
<source>MEN_MAP</source>
<translation>Pattern Mapping</translation>
@ -3278,6 +3294,10 @@ Use Display Entity menu command to show them.
<source>STB_LENGTH_2D</source>
<translation>Length 2D</translation>
</message>
<message>
<source>STB_DEFLECTION_2D</source>
<translation>Deflection 2D</translation>
</message>
<message>
<source>STB_MAP</source>
<translation>Pattern mapping</translation>
@ -3958,6 +3978,10 @@ Use Display Entity menu command to show them.
<source>TOP_LENGTH_2D</source>
<translation>Length 2D</translation>
</message>
<message>
<source>TOP_DEFLECTION_2D</source>
<translation>Deflection 2D</translation>
</message>
<message>
<source>TOP_MAP</source>
<translation>Pattern mapping</translation>
@ -5869,6 +5893,10 @@ Please enter correct value and try again</translation>
<source>LENGTH2D</source>
<translation>Length 2D</translation>
</message>
<message>
<source>DEFLECTION2D</source>
<translation>Deflection 2D</translation>
</message>
<message>
<source>LESS_THAN</source>
<translation>Less than</translation>

View File

@ -294,6 +294,8 @@ namespace {
// - FT_BelongToMeshGroup = 22
// v 8.1.0: FT_Undefined == 48, new items:
// - FT_NodeConnectivityNumber= 22
// v 8.5.0: FT_Undefined == 49, new items:
// - FT_Deflection2D = 22
//
// It's necessary to continue recording this history and to fill
// undef2newItems (see below) accordingly.
@ -316,6 +318,7 @@ namespace {
undef2newItems[ 46 ].push_back( 39 );
undef2newItems[ 47 ].push_back( 22 );
undef2newItems[ 48 ].push_back( 22 );
undef2newItems[ 49 ].push_back( 22 );
ASSERT( undef2newItems.rbegin()->first == SMESH::FT_Undefined );
}

View File

@ -431,6 +431,7 @@ namespace SMESH
case FT_MultiConnection2D: myStream<< "aMultiConnection2D"; break;
case FT_Length: myStream<< "aLength"; break;
case FT_Length2D: myStream<< "aLength2D"; break;
case FT_Deflection2D: myStream<< "aDeflection2D"; break;
case FT_NodeConnectivityNumber:myStream<< "aNodeConnectivityNumber";break;
case FT_BelongToMeshGroup: myStream<< "aBelongToMeshGroup"; break;
case FT_BelongToGeom: myStream<< "aBelongToGeom"; break;

View File

@ -534,6 +534,21 @@ SMESH::Length2D::Values* Length2D_i::GetValues()
return aResult._retn();
}
/*
Class : Deflection2D_i
Description : Functor for calculating distance between a face and geometry
*/
Deflection2D_i::Deflection2D_i()
{
myNumericalFunctorPtr.reset( new Controls::Deflection2D() );
myFunctorPtr = myNumericalFunctorPtr;
}
FunctorType Deflection2D_i::GetFunctorType()
{
return SMESH::FT_Deflection2D;
}
/*
Class : MultiConnection_i
Description : Functor for calculating number of faces conneted to the edge
@ -2113,6 +2128,14 @@ Length2D_ptr FilterManager_i::CreateLength2D()
return anObj._retn();
}
Deflection2D_ptr FilterManager_i::CreateDeflection2D()
{
SMESH::Deflection2D_i* aServant = new SMESH::Deflection2D_i();
SMESH::Deflection2D_var anObj = aServant->_this();
TPythonDump()<<aServant<<" = "<<this<<".CreateLength2D()";
return anObj._retn();
}
MultiConnection_ptr FilterManager_i::CreateMultiConnection()
{
SMESH::MultiConnection_i* aServant = new SMESH::MultiConnection_i();
@ -2956,6 +2979,9 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
case SMESH::FT_Length2D:
aFunctor = aFilterMgr->CreateLength2D();
break;
case SMESH::FT_Deflection2D:
aFunctor = aFilterMgr->CreateDeflection2D();
break;
case SMESH::FT_AspectRatio:
aFunctor = aFilterMgr->CreateAspectRatio();
break;
@ -3451,9 +3477,10 @@ static inline LDOMString toString( CORBA::Long theType )
case FT_EqualFaces : return "Equal faces";
case FT_EqualVolumes : return "Equal volumes";
case FT_MultiConnection : return "Borders at multi-connections";
case FT_MultiConnection2D :return "Borders at multi-connections 2D";
case FT_MultiConnection2D : return "Borders at multi-connections 2D";
case FT_Length : return "Length";
case FT_Length2D : return "Length 2D";
case FT_Deflection2D : return "Deflection 2D";
case FT_LessThan : return "Less than";
case FT_MoreThan : return "More than";
case FT_EqualTo : return "Equal to";
@ -3502,6 +3529,7 @@ static inline SMESH::FunctorType toFunctorType( const LDOMString& theStr )
// else if ( theStr.equals( "Borders at multi-connections 2D" ) ) return FT_MultiConnection2D;
else if ( theStr.equals( "Length" ) ) return FT_Length;
// else if ( theStr.equals( "Length2D" ) ) return FT_Length2D;
else if ( theStr.equals( "Deflection" ) ) return FT_Deflection2D;
else if ( theStr.equals( "Range of IDs" ) ) return FT_RangeOfIds;
else if ( theStr.equals( "Bad Oriented Volume" ) ) return FT_BadOrientedVolume;
else if ( theStr.equals( "Volumes with bare border" ) ) return FT_BareBorderVolume;
@ -4078,6 +4106,7 @@ static const char** getFunctNames()
"FT_MultiConnection2D",
"FT_Length",
"FT_Length2D",
"FT_Deflection2D",
"FT_NodeConnectivityNumber",
"FT_BelongToMeshGroup",
"FT_BelongToGeom",
@ -4094,7 +4123,7 @@ static const char** getFunctNames()
"FT_LinearOrQuadratic",
"FT_GroupColor",
"FT_ElemGeomType",
"FT_EntityType",
"FT_EntityType",
"FT_CoplanarFaces",
"FT_BallDiameter",
"FT_ConnectedElements",

View File

@ -266,11 +266,23 @@ namespace SMESH
Length2D_i();
SMESH::Length2D::Values* GetValues();
FunctorType GetFunctorType();
protected:
Controls::Length2DPtr myLength2DPtr;
};
/*
Class : Deflection2D_i
Description : Functor for calculating distance between a face and geometry
*/
class SMESH_I_EXPORT Deflection2D_i: public virtual POA_SMESH::Deflection2D,
public virtual NumericalFunctor_i
{
public:
Deflection2D_i();
FunctorType GetFunctorType();
};
/*
Class : MultiConnection_i
Description : Functor for calculating number of faces conneted to the edge
@ -1087,6 +1099,7 @@ namespace SMESH
MaxElementLength3D_ptr CreateMaxElementLength3D();
Length_ptr CreateLength();
Length2D_ptr CreateLength2D();
Deflection2D_ptr CreateDeflection2D();
NodeConnectivityNumber_ptr CreateNodeConnectivityNumber();
MultiConnection_ptr CreateMultiConnection();
MultiConnection2D_ptr CreateMultiConnection2D();

View File

@ -27,6 +27,7 @@
#define __SMESH_MeshPartDS_HXX__
#include "SMESHDS_Mesh.hxx"
#include "SMESH_TypeDefs.hxx"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
@ -55,6 +56,8 @@ public:
virtual SMDS_ElemIteratorPtr elementGeomIterator(SMDSAbs_GeometryType type) const;
virtual SMDS_ElemIteratorPtr elementEntityIterator(SMDSAbs_EntityType type) const;
virtual const SMDS_MeshElement *FindElement(int IDelem) const;
private:
TIDSortedElemSet _elements[ SMDSAbs_NbElementTypes ];
SMESHDS_Mesh* _meshDS;
@ -65,6 +68,17 @@ private:
{
void Add(const SMDS_MeshElement* e) { SMDS_MeshInfo::addWithPoly( e ); }
};
/*!
* \brief Element holing its ID only
*/
struct TElemID : public SMDS_MeshElement
{
TElemID(int ID) : SMDS_MeshElement( ID ) {}
virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_All; }
virtual SMDSAbs_EntityType GetEntityType() const { return SMDSEntity_Last; }
virtual SMDSAbs_GeometryType GetGeomType() const { return SMDSGeom_NONE; }
virtual vtkIdType GetVtkType() const { return -1; }
};
};
#endif

View File

@ -6119,6 +6119,7 @@ SMESH_MeshPartDS::SMESH_MeshPartDS(SMESH::SMESH_IDSource_ptr meshPart):
SMESH::SMESH_Mesh_var mesh = meshPart->GetMesh();
SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
mesh_i->Load();
_meshDS = mesh_i->GetImpl().GetMeshDS();
SetPersistentId( _meshDS->GetPersistentId() );
@ -6188,6 +6189,21 @@ SMESH_MeshPartDS::SMESH_MeshPartDS(const std::list< const SMDS_MeshElement* > &
myInfo = tmpInfo;
}
// -------------------------------------------------------------------------------------
const SMDS_MeshElement * SMESH_MeshPartDS::FindElement(int IDelem) const
{
if ( _meshDS ) return _meshDS->FindElement( IDelem );
TElemID elem( IDelem );
for ( int iType = SMDSAbs_Edge; iType < SMDSAbs_NbElementTypes; ++iType )
if ( !_elements[ iType ].empty() )
{
TIDSortedElemSet::const_iterator it = _elements[ iType ].find( &elem );
if ( it != _elements[ iType ].end() )
return *it;
}
return 0;
}
// -------------------------------------------------------------------------------------
SMDS_ElemIteratorPtr SMESH_MeshPartDS::elementGeomIterator(SMDSAbs_GeometryType geomType) const
{
if ( _meshDS ) return _meshDS->elementGeomIterator( geomType );

View File

@ -966,6 +966,8 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
functor = aFilterMgr.CreateLength()
elif theCriterion == FT_Length2D:
functor = aFilterMgr.CreateLength2D()
elif theCriterion == FT_Deflection2D:
functor = aFilterMgr.CreateDeflection2D()
elif theCriterion == FT_NodeConnectivityNumber:
functor = aFilterMgr.CreateNodeConnectivityNumber()
elif theCriterion == FT_BallDiameter:
@ -3117,6 +3119,16 @@ class Mesh:
def GetPointState(self, x, y, z):
return self.editor.GetPointState(x, y, z)
## Check if a 2D mesh is manifold
# @ingroup l1_controls
def IsManifold(self):
return self.editor.IsManifold()
## Check if orientation of 2D elements is coherent
# @ingroup l1_controls
def IsCoherentOrientation2D(self):
return self.editor.IsCoherentOrientation2D()
## Find the node closest to a point and moves it to a point location
# @param x the X coordinate of a point
# @param y the Y coordinate of a point
@ -4619,6 +4631,24 @@ class Mesh:
def MergeEqualElements(self):
self.editor.MergeEqualElements()
## Returns all or only closed free borders
# @return list of SMESH.FreeBorder's
# @ingroup l2_modif_trsf
def FindFreeBorders(self, ClosedOnly=True):
return self.editor.FindFreeBorders( ClosedOnly )
## Fill with 2D elements a hole defined by a SMESH.FreeBorder.
# @param FreeBorder either a SMESH.FreeBorder or a list on node IDs. These nodes
# must describe all sequential nodes of the hole border. The first and the last
# nodes must be the same. Use FindFreeBorders() to get nodes of holes.
# @ingroup l2_modif_trsf
def FillHole(self, holeNodes):
if holeNodes and isinstance( holeNodes, list ) and isinstance( holeNodes[0], int ):
holeNodes = SMESH.FreeBorder(nodeIDs=holeNodes)
if not isinstance( holeNodes, SMESH.FreeBorder ):
raise TypeError, "holeNodes must be either SMESH.FreeBorder or list of integer and not %s" % holeNodes
self.editor.FillHole( holeNodes )
## Return groups of FreeBorder's coincident within the given tolerance.
# @param tolerance the tolerance. If the tolerance <= 0.0 then one tenth of an average
# size of elements adjacent to free borders being compared is used.
@ -4934,7 +4964,14 @@ class Mesh:
def CreateHoleSkin(self, radius, theShape, groupName, theNodesCoords):
return self.editor.CreateHoleSkin( radius, theShape, groupName, theNodesCoords )
def _getFunctor(self, funcType ):
## Return a cached numerical functor by its type.
# @param theCriterion functor type - an item of SMESH.FunctorType enumeration.
# Type SMESH.FunctorType._items in the Python Console to see all items.
# Note that not all items correspond to numerical functors.
# @return SMESH_NumericalFunctor. The functor is already initialized
# with a mesh
# @ingroup l1_measurements
def GetFunctor(self, funcType ):
fn = self.functors[ funcType._v ]
if not fn:
fn = self.smeshpyD.GetFunctor(funcType)
@ -4950,7 +4987,7 @@ class Mesh:
# @return the functor value or zero in case of invalid arguments
# @ingroup l1_measurements
def FunctorValue(self, funcType, elemId, isElem=True):
fn = self._getFunctor( funcType )
fn = self.GetFunctor( funcType )
if fn.GetElementType() == self.GetElementType(elemId, isElem):
val = fn.GetValue(elemId)
else:
@ -5056,7 +5093,7 @@ class Mesh:
unRegister.set( meshPart )
if isinstance( meshPart, Mesh ):
meshPart = meshPart.mesh
fun = self._getFunctor( funType )
fun = self.GetFunctor( funType )
if fun:
if meshPart:
if hasattr( meshPart, "SetMesh" ):

View File

@ -136,7 +136,7 @@ this one for this mesh/sub-mesh.</translation>
</message>
<message>
<source>SMESH_DISTR_EXPR</source>
<translation>Distribution with analitic density</translation>
<translation>Distribution with analytic density</translation>
</message>
<message>
<source>SMESH_DISTR_REGULAR</source>