Fix MinDistance for node-group (SALOME_TESTS/Grids/smesh/imps_09/K0)

+ Minor doc improvement
This commit is contained in:
eap 2019-03-06 16:59:54 +03:00
parent 0bbec902ba
commit 98ec6be586
6 changed files with 64 additions and 13 deletions

View File

@ -169,14 +169,16 @@ Creating groups
Mesh.MakeGroupByCriteria Mesh.MakeGroupByCriteria
Mesh.MakeGroupByFilter Mesh.MakeGroupByFilter
Mesh.FaceGroupsSeparatedByEdges Mesh.FaceGroupsSeparatedByEdges
Mesh.CreateDimGroup
Mesh.ConvertToStandalone
Mesh.GetGroups Mesh.GetGroups
Mesh.NbGroups Mesh.NbGroups
Mesh.GetGroupNames Mesh.GetGroupNames
Mesh.GetGroupByName Mesh.GetGroupByName
Using operations on groups Operations on groups
========================== ====================
.. autosummary:: .. autosummary::
@ -186,8 +188,6 @@ Using operations on groups
Mesh.IntersectListOfGroups Mesh.IntersectListOfGroups
Mesh.CutGroups Mesh.CutGroups
Mesh.CutListOfGroups Mesh.CutListOfGroups
Mesh.CreateDimGroup
Mesh.ConvertToStandalone
Deleting Groups Deleting Groups
=============== ===============
@ -204,6 +204,8 @@ Mesh Information
.. autosummary:: .. autosummary::
smeshBuilder.GetMeshInfo smeshBuilder.GetMeshInfo
Mesh.GetEngine
Mesh.GetGeomEngine
Mesh.GetGeometryByMeshElement Mesh.GetGeometryByMeshElement
Mesh.MeshDimension Mesh.MeshDimension
Mesh.GetMeshInfo Mesh.GetMeshInfo
@ -269,6 +271,7 @@ Mesh Information
Mesh.FindNodeClosestTo Mesh.FindNodeClosestTo
Mesh.FindElementsByPoint Mesh.FindElementsByPoint
Mesh.GetPointState Mesh.GetPointState
Mesh.Get1DBranches
Mesh.Dump Mesh.Dump
****************************** ******************************
@ -352,6 +355,7 @@ Adding nodes and elements
Mesh.Make2DMeshFrom3D Mesh.Make2DMeshFrom3D
Mesh.MakeBoundaryMesh Mesh.MakeBoundaryMesh
Mesh.MakeBoundaryElements Mesh.MakeBoundaryElements
Mesh.Append
Mesh.GetLastCreatedNodes Mesh.GetLastCreatedNodes
Mesh.GetLastCreatedElems Mesh.GetLastCreatedElems
Mesh.ClearLastCreated Mesh.ClearLastCreated

View File

@ -791,7 +791,11 @@ SMESH_GroupBase
.. py:class:: SMESH_GroupBase .. py:class:: SMESH_GroupBase
:doc:`Mesh group <grouping_elements>` :doc:`Mesh group <grouping_elements>`.
Base class of :class:`standalone group <SMESH_Group>`,
:class:`group on geometry <SMESH_GroupOnGeom>` and
:class:`group on filter <SMESH_GroupOnFilter>`.
Inherit all methods from :class:`SMESH_IDSource`.
.. py:function:: SetName( name ) .. py:function:: SetName( name )

View File

@ -55,7 +55,7 @@ A usual workflow to generate a mesh on geometry is following:
netgen.SetMaxSize( 20. ) netgen.SetMaxSize( 20. )
netgen.SetFineness( smeshBuilder.VeryCoarse ) netgen.SetFineness( smeshBuilder.VeryCoarse )
#. :ref:`compute_anchor` the mesh (generate mesh nodes and elements): #. :ref:`Compute the mesh <compute_anchor>` (generate mesh nodes and elements):
.. code-block:: python .. code-block:: python
mesh.Compute() mesh.Compute()
@ -66,10 +66,10 @@ GUI and then to get a corresponding Python script via
all methods of any object in hand (e.g. a mesh group or a hypothesis) all methods of any object in hand (e.g. a mesh group or a hypothesis)
by calling *dir()* Python built-in function. by calling *dir()* Python built-in function.
All methods of the Mesh Group can be found in :ref:`tui_create_standalone_group` sample script. All methods of the :class:`Mesh Group <SMESH.SMESH_GroupBase>` can be found in :ref:`tui_create_standalone_group` sample script.
An example below demonstrates usage of the Python API for 3D mesh An example below demonstrates usage of the Python API for 3D mesh
generation and for retrieving information on mesh nodes and elements. generation and for retrieving basic information on mesh nodes, elements and groups.
.. _example_3d_mesh: .. _example_3d_mesh:

View File

@ -238,6 +238,7 @@ namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint()
void getElementsInBox ( const Bnd_B3d& box, TElemSeq& foundElems ); void getElementsInBox ( const Bnd_B3d& box, TElemSeq& foundElems );
void getElementsInSphere ( const gp_XYZ& center, const double radius, TElemSeq& foundElems ); void getElementsInSphere ( const gp_XYZ& center, const double radius, TElemSeq& foundElems );
ElementBndBoxTree* getLeafAtPoint( const gp_XYZ& point ); ElementBndBoxTree* getLeafAtPoint( const gp_XYZ& point );
int getNbElements();
protected: protected:
ElementBndBoxTree() {} ElementBndBoxTree() {}
@ -466,6 +467,27 @@ namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint()
return 0; return 0;
} }
//================================================================================
/*!
* \brief Return number of elements
*/
//================================================================================
int ElementBndBoxTree::getNbElements()
{
int nb = 0;
if ( isLeaf() )
{
nb = _elements.size();
}
else
{
for (int i = 0; i < 8; i++)
nb += ((ElementBndBoxTree*) myChildren[i])->getNbElements();
}
return nb;
}
//================================================================================ //================================================================================
/*! /*!
* \brief Construct the element box * \brief Construct the element box
@ -1302,6 +1324,23 @@ gp_XYZ SMESH_ElementSearcherImpl::Project(const gp_Pnt& point,
minDist = d; minDist = d;
} }
} }
if ( minDist > radius )
{
ElementBndBoxTree::TElemSeq elems2;
ebbTree->getElementsInSphere( p, minDist, elems2 );
for ( e = elems2.begin(); e != elems2.end(); ++e )
{
if ( elems.count( *e ))
continue;
double d = SMESH_MeshAlgos::GetDistance( *e, point, &proj );
if ( d < minDist )
{
bestProj = proj;
elem = *e;
minDist = d;
}
}
}
if ( closestElem ) *closestElem = elem; if ( closestElem ) *closestElem = elem;
return bestProj; return bestProj;

View File

@ -154,7 +154,10 @@ namespace
if ( !path.SetCutAtCorner( cornerNode, fIt->next(), plnNorm, plnOrig )) if ( !path.SetCutAtCorner( cornerNode, fIt->next(), plnNorm, plnOrig ))
continue; continue;
if ( !myAvoidSet.insert( path.myNode1.Node() ).second || if ( path.myDot1 == 0 &&
!myAvoidSet.insert( path.myNode1.Node() ).second )
continue;
if ( path.myDot2 == 0 &&
!myAvoidSet.insert( path.myNode2.Node() ).second ) !myAvoidSet.insert( path.myNode2.Node() ).second )
continue; continue;

View File

@ -4384,7 +4384,8 @@ class Mesh(metaclass = MeshMeta):
Returns: Returns:
A list of edge groups and a list of corresponding node groups, A list of edge groups and a list of corresponding node groups,
where the group is a list of IDs of edges or elements. where the group is a list of IDs of edges or elements, like follows
[[[branch_edges_1],[branch_edges_2]], [[branch_nodes_1],[branch_nodes_2]]].
If a group is closed, the first and last nodes of the group are same. If a group is closed, the first and last nodes of the group are same.
""" """
if isinstance( edges, Mesh ): if isinstance( edges, Mesh ):
@ -6947,7 +6948,7 @@ class Mesh(metaclass = MeshMeta):
def GetLength(self, elemId=None): def GetLength(self, elemId=None):
""" """
Get length of all given 1D elements or sum length of all 1D mesh elements Get length of given 1D elements or of all 1D mesh elements
Parameters: Parameters:
elemId: either a mesh element ID or a list of IDs or :class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`. By default sum length of all 1D elements will be calculated. elemId: either a mesh element ID or a list of IDs or :class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`. By default sum length of all 1D elements will be calculated.
@ -6977,7 +6978,7 @@ class Mesh(metaclass = MeshMeta):
def GetArea(self, elemId=None): def GetArea(self, elemId=None):
""" """
Get area of given 2D elements or sum area of all 2D mesh elements Get area of given 2D elements or of all 2D mesh elements
Parameters: Parameters:
elemId: either a mesh element ID or a list of IDs or :class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`. By default sum area of all 2D elements will be calculated. elemId: either a mesh element ID or a list of IDs or :class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`. By default sum area of all 2D elements will be calculated.
@ -7007,7 +7008,7 @@ class Mesh(metaclass = MeshMeta):
def GetVolume(self, elemId=None): def GetVolume(self, elemId=None):
""" """
Get volume of a 3D element or sum of volumes of all 3D mesh elements Get volume of given 3D elements or of all 3D mesh elements
Parameters: Parameters:
elemId: either a mesh element ID or a list of IDs or :class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`. By default sum volume of all 3D elements will be calculated. elemId: either a mesh element ID or a list of IDs or :class:`sub-mesh, group or filter <SMESH.SMESH_IDSource>`. By default sum volume of all 3D elements will be calculated.