mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-26 16:20:32 +05:00
Fix bug 10390. fix getting submesh for a shell
This commit is contained in:
parent
8b1761d4a6
commit
d5f8c39955
@ -46,6 +46,7 @@
|
|||||||
#include <TopoDS_Shell.hxx>
|
#include <TopoDS_Shell.hxx>
|
||||||
#include <TopoDS_Vertex.hxx>
|
#include <TopoDS_Vertex.hxx>
|
||||||
#include <TopoDS_Wire.hxx>
|
#include <TopoDS_Wire.hxx>
|
||||||
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
#include <gp_Ax2.hxx>
|
#include <gp_Ax2.hxx>
|
||||||
#include <gp_Lin2d.hxx>
|
#include <gp_Lin2d.hxx>
|
||||||
#include <gp_Pnt2d.hxx>
|
#include <gp_Pnt2d.hxx>
|
||||||
@ -2839,7 +2840,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
|
|||||||
MESSAGE(" ::Load(volume) " );
|
MESSAGE(" ::Load(volume) " );
|
||||||
Clear();
|
Clear();
|
||||||
myIs2D = false;
|
myIs2D = false;
|
||||||
SMESHDS_Mesh * aMeshDS = theMesh->GetMeshDS();
|
SMESHDS_SubMesh * aSubMesh;
|
||||||
|
|
||||||
// load shapes in myShapeIDMap
|
// load shapes in myShapeIDMap
|
||||||
SMESH_Block block;
|
SMESH_Block block;
|
||||||
@ -2852,7 +2853,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
|
|||||||
for ( shapeID = 1; shapeID <= myShapeIDMap.Extent(); shapeID++ )
|
for ( shapeID = 1; shapeID <= myShapeIDMap.Extent(); shapeID++ )
|
||||||
{
|
{
|
||||||
const TopoDS_Shape& S = myShapeIDMap( shapeID );
|
const TopoDS_Shape& S = myShapeIDMap( shapeID );
|
||||||
SMESHDS_SubMesh * aSubMesh = aMeshDS->MeshElements( S );
|
aSubMesh = getSubmeshWithElements( theMesh, S );
|
||||||
if ( aSubMesh )
|
if ( aSubMesh )
|
||||||
nbNodes += aSubMesh->NbNodes();
|
nbNodes += aSubMesh->NbNodes();
|
||||||
}
|
}
|
||||||
@ -2865,7 +2866,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
|
|||||||
{
|
{
|
||||||
const TopoDS_Shape& S = myShapeIDMap( shapeID );
|
const TopoDS_Shape& S = myShapeIDMap( shapeID );
|
||||||
list< TPoint* > & shapePoints = getShapePoints( shapeID );
|
list< TPoint* > & shapePoints = getShapePoints( shapeID );
|
||||||
SMESHDS_SubMesh * aSubMesh = aMeshDS->MeshElements( S );
|
aSubMesh = getSubmeshWithElements( theMesh, S );
|
||||||
if ( ! aSubMesh ) continue;
|
if ( ! aSubMesh ) continue;
|
||||||
SMDS_NodeIteratorPtr nIt = aSubMesh->GetNodes();
|
SMDS_NodeIteratorPtr nIt = aSubMesh->GetNodes();
|
||||||
if ( !nIt->more() ) continue;
|
if ( !nIt->more() ) continue;
|
||||||
@ -2929,7 +2930,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
|
|||||||
|
|
||||||
// load elements
|
// load elements
|
||||||
|
|
||||||
SMESHDS_SubMesh * aSubMesh = aMeshDS->MeshElements( theBlock );
|
aSubMesh = getSubmeshWithElements( theMesh, theBlock );
|
||||||
if ( aSubMesh )
|
if ( aSubMesh )
|
||||||
{
|
{
|
||||||
SMDS_ElemIteratorPtr elemIt = aSubMesh->GetElements();
|
SMDS_ElemIteratorPtr elemIt = aSubMesh->GetElements();
|
||||||
@ -2947,6 +2948,32 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
|
|||||||
return setErrorCode( ERR_OK );
|
return setErrorCode( ERR_OK );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : getSubmeshWithElements
|
||||||
|
//purpose : return submesh containing elements bound to theBlock in theMesh
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
SMESHDS_SubMesh * SMESH_Pattern::getSubmeshWithElements(SMESH_Mesh* theMesh,
|
||||||
|
const TopoDS_Shape& theShape)
|
||||||
|
{
|
||||||
|
SMESHDS_SubMesh * aSubMesh = theMesh->GetMeshDS()->MeshElements( theShape );
|
||||||
|
if ( aSubMesh && ( aSubMesh->GetElements()->more() || aSubMesh->GetNodes()->more() ))
|
||||||
|
return aSubMesh;
|
||||||
|
|
||||||
|
if ( theShape.ShapeType() == TopAbs_SHELL )
|
||||||
|
{
|
||||||
|
// look for submesh of VOLUME
|
||||||
|
TopTools_ListIteratorOfListOfShape it( theMesh->GetAncestors( theShape ));
|
||||||
|
for (; it.More(); it.Next()) {
|
||||||
|
aSubMesh = theMesh->GetMeshDS()->MeshElements( it.Value() );
|
||||||
|
if ( aSubMesh && ( aSubMesh->GetElements()->more() || aSubMesh->GetNodes()->more() ))
|
||||||
|
return aSubMesh;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Apply
|
//function : Apply
|
||||||
//purpose : Compute nodes coordinates applying
|
//purpose : Compute nodes coordinates applying
|
||||||
|
@ -41,6 +41,7 @@ class SMDS_MeshFace;
|
|||||||
class SMDS_MeshVolume;
|
class SMDS_MeshVolume;
|
||||||
class SMDS_MeshNode;
|
class SMDS_MeshNode;
|
||||||
class SMESH_Mesh;
|
class SMESH_Mesh;
|
||||||
|
class SMESHDS_SubMesh;
|
||||||
class TopoDS_Shell;
|
class TopoDS_Shell;
|
||||||
class TopoDS_Vertex;
|
class TopoDS_Vertex;
|
||||||
class TopoDS_Face;
|
class TopoDS_Face;
|
||||||
@ -305,6 +306,10 @@ class SMESH_Pattern {
|
|||||||
void clearMesh(SMESH_Mesh* theMesh) const;
|
void clearMesh(SMESH_Mesh* theMesh) const;
|
||||||
// clear mesh elements existing on myShape in theMesh
|
// clear mesh elements existing on myShape in theMesh
|
||||||
|
|
||||||
|
static SMESHDS_SubMesh * getSubmeshWithElements(SMESH_Mesh* theMesh,
|
||||||
|
const TopoDS_Shape& theShape);
|
||||||
|
// return submesh containing elements bound to theShape in theMesh
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// fields
|
// fields
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user