fix PAL12398. Make ToMap() check elements type

This commit is contained in:
eap 2006-05-26 08:58:50 +00:00
parent 1827b4ef32
commit 45bfff6b5d

View File

@ -519,16 +519,18 @@ CORBA::Boolean SMESH_MeshEditor_i::ReorientObject(SMESH::SMESH_IDSource_ptr theO
//purpose : auxilary function for conversion long_array to std::map<> //purpose : auxilary function for conversion long_array to std::map<>
// which is used in some methods // which is used in some methods
//======================================================================= //=======================================================================
static void ToMap(const SMESH::long_array & IDs, static void ToMap(const SMESH::long_array & IDs,
const SMESHDS_Mesh* aMesh, const SMESHDS_Mesh* aMesh,
std::map<int,const SMDS_MeshElement*>& aMap) std::map<int,const SMDS_MeshElement*>& aMap,
const SMDSAbs_ElementType aType = SMDSAbs_All )
{ {
for (int i=0; i<IDs.length(); i++) { for (int i=0; i<IDs.length(); i++) {
CORBA::Long ind = IDs[i]; CORBA::Long ind = IDs[i];
std::map<int,const SMDS_MeshElement*>::iterator It = aMap.find(ind); std::map<int,const SMDS_MeshElement*>::iterator It = aMap.find(ind);
if(It==aMap.end()) { if(It==aMap.end()) {
const SMDS_MeshElement * elem = aMesh->FindElement(ind); const SMDS_MeshElement * elem = aMesh->FindElement(ind);
aMap.insert( make_pair(ind,elem) ); if ( elem && ( aType == SMDSAbs_All || elem->GetType() == aType ))
aMap.insert( make_pair( elem->GetID(), elem ));
} }
} }
} }
@ -548,7 +550,7 @@ CORBA::Boolean SMESH_MeshEditor_i::TriToQuad (const SMESH::long_array & IDsOfE
SMESHDS_Mesh* aMesh = GetMeshDS(); SMESHDS_Mesh* aMesh = GetMeshDS();
map<int,const SMDS_MeshElement*> faces; map<int,const SMDS_MeshElement*> faces;
ToMap(IDsOfElements, aMesh, faces); ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
SMESH::NumericalFunctor_i* aNumericalFunctor = SMESH::NumericalFunctor_i* aNumericalFunctor =
dynamic_cast<SMESH::NumericalFunctor_i*>( SMESH_Gen_i::GetServant( Criterion ).in() ); dynamic_cast<SMESH::NumericalFunctor_i*>( SMESH_Gen_i::GetServant( Criterion ).in() );
@ -624,7 +626,7 @@ CORBA::Boolean SMESH_MeshEditor_i::QuadToTri (const SMESH::long_array & IDsOfE
SMESHDS_Mesh* aMesh = GetMeshDS(); SMESHDS_Mesh* aMesh = GetMeshDS();
map<int,const SMDS_MeshElement*> faces; map<int,const SMDS_MeshElement*> faces;
ToMap(IDsOfElements, aMesh, faces); ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
SMESH::NumericalFunctor_i* aNumericalFunctor = SMESH::NumericalFunctor_i* aNumericalFunctor =
dynamic_cast<SMESH::NumericalFunctor_i*>( SMESH_Gen_i::GetServant( Criterion ).in() ); dynamic_cast<SMESH::NumericalFunctor_i*>( SMESH_Gen_i::GetServant( Criterion ).in() );
@ -697,7 +699,7 @@ CORBA::Boolean SMESH_MeshEditor_i::SplitQuad (const SMESH::long_array & IDsOfEle
SMESHDS_Mesh* aMesh = GetMeshDS(); SMESHDS_Mesh* aMesh = GetMeshDS();
map<int,const SMDS_MeshElement*> faces; map<int,const SMDS_MeshElement*> faces;
ToMap(IDsOfElements, aMesh, faces); ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
// Update Python script // Update Python script
TPythonDump() << "isDone = " << this << ".SplitQuad( " TPythonDump() << "isDone = " << this << ".SplitQuad( "
@ -861,7 +863,7 @@ CORBA::Boolean
SMESHDS_Mesh* aMesh = GetMeshDS(); SMESHDS_Mesh* aMesh = GetMeshDS();
map<int,const SMDS_MeshElement*> elements; map<int,const SMDS_MeshElement*> elements;
ToMap(IDsOfElements, aMesh, elements); ToMap(IDsOfElements, aMesh, elements, SMDSAbs_Face);
set<const SMDS_MeshNode*> fixedNodes; set<const SMDS_MeshNode*> fixedNodes;
for (int i = 0; i < IDsOfFixedNodes.length(); i++) { for (int i = 0; i < IDsOfFixedNodes.length(); i++) {