Salome HOME
0021308: EDF 1923 SMESH: Remove hard-coded dependency of the external mesh plugins...
[modules/smesh.git] / doc / salome / gui / SMESH / input / tui_filters.doc
index 6677b2ab592bb5281c1e18b6fcd7237f4a9977aa..0eb41dd285ab53febe4c9b5e64c4dbac2e34d826 100755 (executable)
@@ -48,7 +48,7 @@ Filter 3D mesh elements (volumes) according to the aspect ratio value:
 \code
 # create mesh with volumes
 from SMESH_mechanic import *
-mesh.Tetrahedron( algo=smesh.NETGEN )
+mesh.Tetrahedron()
 mesh.Compute()
 # get volumes with aspect ratio < 2.0
 filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_AspectRatio3D, smesh.FT_LessThan, 2.0)
@@ -90,7 +90,7 @@ Filter 2D mesh elements (faces) according to the minimum angle value:
 # create mesh
 from SMESH_mechanic import *
 # get faces with minimum angle > 75
-filter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle, smesh.FT_MoreThan, 75)
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_MinimumAngle,">", 75)
 ids = mesh.GetIdsFromFilter(filter)
 print "Number of faces with minimum angle > 75:", len(ids)
 \endcode
@@ -165,7 +165,7 @@ Filter 3D mesh elements (volumes) according to the volume value:
 \code
 # create mesh with volumes
 from SMESH_mechanic import *
-mesh.Tetrahedron( algo=smesh.NETGEN )
+mesh.Tetrahedron()
 mesh.Compute()
 # get volumes faces with volume > 100
 filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_Volume3D, smesh.FT_MoreThan, 100)
@@ -237,7 +237,7 @@ from SMESH_mechanic import *
 # add node
 mesh.AddNode(0,0,0)
 # get all free nodes
-filter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeNodes)
+filter = smesh.GetFilter(smesh.NODE, smesh.FT_FreeNodes)
 ids = mesh.GetIdsFromFilter(filter)
 print "Number of free nodes:", len(ids)
 \endcode
@@ -255,13 +255,126 @@ Filter free faces:
 # create mesh
 from SMESH_mechanic import *
 # get all free faces
-filter = smesh.GetFilter(smesh.EDGE, smesh.FT_FreeFaces)
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_FreeFaces)
 ids = mesh.GetIdsFromFilter(filter)
 print "Number of free faces:", len(ids)
 \endcode
 
 \sa \ref tui_free_faces
 
+\section filter_bare_border_faces Bare border faces
+
+Filter faces with bare borders:
+- element type is \a smesh.FACE
+- functor type is \a smesh.FT_BareBorderFace
+- threshold value is not required
+
+\code
+# create mesh
+from SMESH_mechanic import *
+# remove some faces to have faces with bare borders
+mesh.RemoveElements( mesh.GetElementsByType(FACE)[0:5] )
+# get all faces bare borders
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_BareBorderFace)
+ids = mesh.GetIdsFromFilter(filter)
+print "Faces with bare borders:", ids
+\endcode
+
+\sa \ref tui_bare_border_faces
+
+\section filter_coplanar_faces Coplanar faces
+
+Filter faces with bare borders:
+- element type is \a smesh.FACE
+- functor type is \a smesh.FT_CoplanarFaces
+- threshold value is the face ID
+- tolerance is in degrees
+
+\code
+# create mesh
+from SMESH_mechanic import *
+faceID = mesh.GetElementsByType(FACE)[0]
+# get all faces co-planar to the first face with tolerance 5 degrees
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_CoplanarFaces,faceID,Tolerance=5.0)
+ids = mesh.GetIdsFromFilter(filter)
+print "Number of faces coplanar with the first one:", len(ids)
+\endcode
+
+\section filter_over_constrained_faces Over-constrained faces
+
+Filter over-constrained faces:
+- element type is \a smesh.FACE
+- functor type is \a smesh.FT_OverConstrainedFace
+- threshold value is not required
+
+\code
+# create mesh
+from SMESH_mechanic import *
+# get all over-constrained faces
+filter = smesh.GetFilter(smesh.FACE, smesh.FT_OverConstrainedFace)
+ids = mesh.GetIdsFromFilter(filter)
+print "Over-constrained faces:", ids
+\endcode
+
+\sa \ref tui_over_constrained_faces
+
+\section filter_double_elements Double edges, Double faces, Double volumes
+
+filter mesh elements basing on the same set of nodes:
+- element type is either \a smesh.EGDE, \a smesh.FACE or \a smesh.VOLUME
+- functor type is either \a smesh.FT_EqualEdges, \a
+          smesh.FT_EqualFaces or \a smesh.FT_EqualVolumes, 
+- threshold value is not required
+
+\code
+from smesh import *
+# make a mesh on a box
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+mesh = Mesh( box, "Box" )
+mesh.Segment().NumberOfSegments(10)
+mesh.Quadrangle()
+mesh.Hexahedron()
+mesh.Compute()
+# copy all elements with translation and Merge nodes
+mesh.TranslateObject( mesh, MakeDirStruct( 10,0,0), Copy=True )
+mesh.MergeNodes( mesh.FindCoincidentNodes(1e-7) )
+# create filters to find equal elements
+equalEdgesFilter   = GetFilter(SMESH.EDGE, FT_EqualEdges)
+equalFacesFilter   = GetFilter(SMESH.FACE, FT_EqualFaces)
+equalVolumesFilter = GetFilter(SMESH.VOLUME, FT_EqualVolumes)
+# get equal elements
+print "Number of equal edges:",   len( mesh.GetIdsFromFilter( equalEdgesFilter ))
+print "Number of equal faces:",   len( mesh.GetIdsFromFilter( equalFacesFilter ))
+print "Number of equal volumes:", len( mesh.GetIdsFromFilter( equalVolumesFilter ))
+\endcode
+
+
+\section tui_double_nodes_control Double nodes
+
+filters mesh nodes which are coincident with other nodes (within a given tolerance):
+- element type is \a smesh.NODE
+- functor type is \a smesh.FT_EqualNodes
+- threshold value is not required
+- default tolerance is 1.0e-7
+
+\code
+from smesh import *
+# make a mesh on a box
+box = geompy.MakeBoxDXDYDZ(100,100,100)
+mesh = Mesh( box, "Box" )
+mesh.Segment().NumberOfSegments(10)
+mesh.Quadrangle()
+mesh.Hexahedron()
+mesh.Compute()
+# copy all elements with translation
+mesh.TranslateObject( mesh, MakeDirStruct( 10,0,0), Copy=True )
+# create filters to find nodes equal within tolerance of 1e-5
+filter = GetFilter(SMESH.NODE, FT_EqualNodes, Tolerance=1e-5)
+# get equal nodes
+print "Number of equal nodes:", len( mesh.GetIdsFromFilter( filter ))
+\endcode
+
+
 \section filter_borders_multiconnection Borders at multi-connection
 
 Filter border 1D mesh elements (edges) according to the specified number of
@@ -367,7 +480,7 @@ value of its edges and diagonals:
 \code
 # create mesh with volumes
 from SMESH_mechanic import *
-mesh.Tetrahedron( algo=smesh.NETGEN )
+mesh.Tetrahedron()
 mesh.Compute()
 # get all volumes that have elements with length > 10
 filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_MaxElementLength3D, smesh.FT_MoreThan, 10)
@@ -377,6 +490,48 @@ print "Number of volumes with maximum element length > 10:", len(ids)
 
 \sa \ref tui_max_element_length_3d
 
+\section filter_bare_border_volumes Bare border volumes
+
+Filter 3D mesh elements with bare borders:
+- element type is \a smesh.VOLUME
+- functor type is \a smesh.FT_BareBorderVolume
+- threshold value is not required
+
+\code
+# create mesh
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# remove some volumes to have volumes with bare borders
+mesh.RemoveElements( mesh.GetElementsByType(VOLUME)[0:5] )
+# get all volumes with bare borders
+filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_BareBorderVolume)
+ids = mesh.GetIdsFromFilter(filter)
+print "Volumes with bare borders:", ids
+\endcode
+
+\sa \ref tui_bare_border_volumes
+
+\section filter_over_constrained_volumes Over-constrained volumes
+
+Filter over-constrained volumes:
+- element type is \a smesh.VOLUME
+- functor type is \a smesh.FT_OverConstrainedVolume
+- threshold value is not required
+
+\code
+# create mesh
+from SMESH_mechanic import *
+mesh.Tetrahedron()
+mesh.Compute()
+# get all over-constrained volumes
+filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_OverConstrainedVolume)
+ids = mesh.GetIdsFromFilter(filter)
+print "Over-constrained volumes:", ids
+\endcode
+
+\sa \ref tui_over_constrained_faces
+
 \section filter_belong_to_geom Belong to Geom
 
 Filter mesh entities (nodes or elements) which all nodes lie on the
@@ -505,7 +660,7 @@ the point of view of MED convention.
 \code
 # create mesh with volumes
 from SMESH_mechanic import *
-mesh.Tetrahedron( algo=smesh.NETGEN )
+mesh.Tetrahedron()
 mesh.Compute()
 # get all badly oriented volumes
 filter = smesh.GetFilter(smesh.VOLUME, smesh.FT_BadOrientedVolume)
@@ -574,7 +729,7 @@ entity type.
 \code
 # create mesh with volumes
 from SMESH_mechanic import *
-mesh.Tetrahedron( algo=smesh.NETGEN )
+mesh.Tetrahedron()
 mesh.Compute()
 # get all triangles, quadrangles, tetrahedrons, pyramids
 filter_tri = smesh.GetFilter(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_TRIANGLE)
@@ -591,4 +746,25 @@ print "Number of tetrahedrons:", len(ids_tet)
 print "Number of pyramids:", len(ids_pyr)
 \endcode
 
+\section combining_filters How to combine filters with Criterion structures?
+
+Filters can be combined by making use of "criteria".
+
+Example :
+
+\code
+# create mesh
+from SMESH_mechanic import *
+# get all the quadrangle faces ...
+criterion1 = smesh.GetCriterion(smesh.FACE, smesh.FT_ElemGeomType, smesh.Geom_QUADRANGLE, smesh.FT_LogicalAND)
+# ... AND do NOT get those from sub_face3
+criterion2 = smesh.GetCriterion(smesh.FACE, smesh.FT_BelongToGeom, sub_face3, smesh.FT_LogicalNOT)
+filter = smesh.CreateFilterManager().CreateFilter()
+filter.SetCriteria([criterion1,criterion2])
+ids = mesh.GetIdsFromFilter(filter)
+
+myGroup = mesh.MakeGroupByIds("Quads_on_cylindrical_faces",smesh.FACE,ids)
+\endcode
+
+
 */