IPAL54157: Empty bounding box of a non-empty mesh

This commit is contained in:
eap 2019-09-04 20:50:22 +03:00
parent 3f36e2f8be
commit 54d95073e1
2 changed files with 30 additions and 13 deletions

View File

@ -151,7 +151,8 @@ static SMESHDS_Mesh* getMesh(SMESH::SMESH_IDSource_ptr theSource)
{ {
if (!CORBA::is_nil( theSource )) if (!CORBA::is_nil( theSource ))
{ {
SMESH_Mesh_i* anImplPtr = DownCast<SMESH_Mesh_i*>(theSource->GetMesh()); SMESH::SMESH_Mesh_var mesh = theSource->GetMesh();
SMESH_Mesh_i* anImplPtr = DownCast<SMESH_Mesh_i*>( mesh );
if (anImplPtr) if (anImplPtr)
return anImplPtr->GetImpl().GetMeshDS(); return anImplPtr->GetImpl().GetMeshDS();
} }
@ -287,19 +288,28 @@ static void enlargeBoundingBox(const SMESH::SMESH_IDSource_ptr theObject,
const SMESHDS_Mesh* aMesh = getMesh( theObject ); const SMESHDS_Mesh* aMesh = getMesh( theObject );
if ( !aMesh ) if ( !aMesh )
return; return;
SMESH::array_of_ElementType_var types = theObject->GetTypes();
SMESH::long_array_var aElementsId = theObject->GetIDs(); if ( DownCast<SMESH_Mesh_i*>( theObject )) // theObject is mesh
// here we assume that type of all IDs defined by first type in array
const bool isNode = isNodeType( types );
for(int i = 0, n = aElementsId->length(); i < n; i++)
{ {
if (isNode) for (SMDS_NodeIteratorPtr aNodeIter = aMesh->nodesIterator(); aNodeIter->more(); )
enlargeBoundingBox( aMesh->FindNode( aElementsId[i] ), theMeasure); enlargeBoundingBox( aNodeIter->next(), theMeasure);
else }
else
{
SMESH::array_of_ElementType_var types = theObject->GetTypes();
SMESH::long_array_var aElementsId = theObject->GetIDs();
// here we assume that type of all IDs defined by first type in array
const bool isNode = isNodeType( types );
for(int i = 0, n = aElementsId->length(); i < n; i++)
{ {
if ( const SMDS_MeshElement* elem = aMesh->FindElement( aElementsId[i] )) if (isNode)
for (SMDS_NodeIteratorPtr aNodeIter = elem->nodeIterator(); aNodeIter->more(); ) enlargeBoundingBox( aMesh->FindNode( aElementsId[i] ), theMeasure);
enlargeBoundingBox( aNodeIter->next(), theMeasure); else
{
if ( const SMDS_MeshElement* elem = aMesh->FindElement( aElementsId[i] ))
for (SMDS_NodeIteratorPtr aNodeIter = elem->nodeIterator(); aNodeIter->more(); )
enlargeBoundingBox( aNodeIter->next(), theMeasure);
}
} }
} }
} }

View File

@ -2072,7 +2072,14 @@ class Mesh(metaclass = MeshMeta):
def SetMeshOrder(self, submeshes): def SetMeshOrder(self, submeshes):
""" """
Set order in which concurrent sub-meshes should be meshed Set priority of sub-meshes. It works in two ways:
* For sub-meshes with assigned algorithms of same dimension generating mesh of
*several dimensions*, it sets the order in which the sub-meshes are computed.
* For the rest sub-meshes, it sets the order in which the sub-meshes are checked
when looking for meshing parameters to apply to a sub-shape. To impose the
order in which sub-meshes with uni-dimensional algorithms are computed,
call **submesh.Compute()** in a desired order.
Parameters: Parameters:
submeshes: list of lists of :class:`sub-meshes <SMESH.SMESH_subMesh>` submeshes: list of lists of :class:`sub-meshes <SMESH.SMESH_subMesh>`