X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_subMesh_i.cxx;h=4737a7b0e8eb28a7a8060d80a29beea5b64750e8;hp=a660013ed3b98aca2e1b523398a7c3c2c8bd1056;hb=2f529dcd2629679dadcca3047583bfcf28ca7b1a;hpb=c26e9bf6e21bac0b0730482c92158dcd0ebbfe13 diff --git a/src/SMESH_I/SMESH_subMesh_i.cxx b/src/SMESH_I/SMESH_subMesh_i.cxx index a660013ed..4737a7b0e 100644 --- a/src/SMESH_I/SMESH_subMesh_i.cxx +++ b/src/SMESH_I/SMESH_subMesh_i.cxx @@ -20,16 +20,19 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses +// SMESH SMESH_I : idl implementation based on 'SMESH' unit's classes // File : SMESH_subMesh_i.cxx // Author : Paul RASCLE, EDF // Module : SMESH // #include "SMESH_subMesh_i.hxx" + +#include "SMESHDS_Mesh.hxx" +#include "SMESHDS_SubMesh.hxx" #include "SMESH_Gen_i.hxx" #include "SMESH_Mesh_i.hxx" -#include "SMESH_PreMeshInfo.hxx" #include "SMESH_MesherHelper.hxx" +#include "SMESH_PreMeshInfo.hxx" #include "Utils_CorbaException.hxx" #include "utilities.h" @@ -78,7 +81,6 @@ SMESH_subMesh_i::SMESH_subMesh_i( PortableServer::POA_ptr thePOA, SMESH_subMesh_i::~SMESH_subMesh_i() { - MESSAGE("SMESH_subMesh_i::~SMESH_subMesh_i"); if ( _preMeshInfo ) delete _preMeshInfo; _preMeshInfo = NULL; } @@ -483,14 +485,19 @@ SMESH::long_array* SMESH_subMesh_i::GetNbElementsByType() aRes[ SMESH::NODE ] = GetNumberOfNodes(true); ::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId]; - if ( SMESHDS_SubMesh* smDS = aSubMesh->GetSubMeshDS() ) + TListOfSubMeshes smList; + if ( getSubMeshes( aSubMesh, smList )) { - SMDS_ElemIteratorPtr eIt = smDS->GetElements(); - if ( eIt->more() ) - aRes[ eIt->next()->GetType() ] = smDS->NbElements(); + TListOfSubMeshes::iterator smDS = smList.begin(); + for ( ; smDS != smList.end(); ++smDS ) + { + SMDS_ElemIteratorPtr eIt = (*smDS)->GetElements(); + if ( eIt->more() ) + aRes[ eIt->next()->GetType() ] = (*smDS)->NbElements(); + } } } - return aRes._retn(); + return aRes._retn(); } @@ -507,26 +514,37 @@ SMESH::array_of_ElementType* SMESH_subMesh_i::GetTypes() SMESH::array_of_ElementType_var types = new SMESH::array_of_ElementType; ::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId]; - if ( SMESHDS_SubMesh* smDS = aSubMesh->GetSubMeshDS() ) + + TListOfSubMeshes smList; + if ( getSubMeshes( aSubMesh, smList )) { - SMDS_ElemIteratorPtr eIt = smDS->GetElements(); - if ( eIt->more() ) + TListOfSubMeshes::iterator smDS = smList.begin(); + for ( ; smDS != smList.end(); ++smDS ) { - types->length( 1 ); - types[0] = SMESH::ElementType( eIt->next()->GetType()); - } - else if ( smDS->GetNodes()->more() ) - { - TopoDS_Shape shape = aSubMesh->GetSubShape(); - while ( !shape.IsNull() && shape.ShapeType() == TopAbs_COMPOUND ) + SMDS_ElemIteratorPtr eIt = (*smDS)->GetElements(); + if ( eIt->more() ) { - TopoDS_Iterator it( shape ); - shape = it.More() ? it.Value() : TopoDS_Shape(); + types->length( 1 ); + types[0] = SMESH::ElementType( eIt->next()->GetType()); + break; } - if ( !shape.IsNull() && shape.ShapeType() == TopAbs_VERTEX ) + } + + if ( types->length() == 0 ) + { + for ( smDS = smList.begin(); smDS != smList.end(); ++smDS ) { - types->length( 1 ); - types[0] = SMESH::NODE; + if ( (*smDS)->GetNodes()->more() ) + { + int smID = (*smDS)->GetID(); + TopoDS_Shape shape = (*smDS)->GetParent()->IndexToShape( smID ); + if ( !shape.IsNull() && shape.ShapeType() == TopAbs_VERTEX ) + { + types->length( 1 ); + types[0] = SMESH::NODE; + break; + } + } } } }