From 45bfff6b5d1cb65cf2f9e989424eab34540f8969 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 26 May 2006 08:58:50 +0000 Subject: [PATCH] fix PAL12398. Make ToMap() check elements type --- src/SMESH_I/SMESH_MeshEditor_i.cxx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index acf9a4030..0ee6fd8cd 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -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<> // which is used in some methods //======================================================================= -static void ToMap(const SMESH::long_array & IDs, - const SMESHDS_Mesh* aMesh, - std::map& aMap) +static void ToMap(const SMESH::long_array & IDs, + const SMESHDS_Mesh* aMesh, + std::map& aMap, + const SMDSAbs_ElementType aType = SMDSAbs_All ) { for (int i=0; i::iterator It = aMap.find(ind); if(It==aMap.end()) { 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(); map faces; - ToMap(IDsOfElements, aMesh, faces); + ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face); SMESH::NumericalFunctor_i* aNumericalFunctor = dynamic_cast( 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(); map faces; - ToMap(IDsOfElements, aMesh, faces); + ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face); SMESH::NumericalFunctor_i* aNumericalFunctor = dynamic_cast( 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(); map faces; - ToMap(IDsOfElements, aMesh, faces); + ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face); // Update Python script TPythonDump() << "isDone = " << this << ".SplitQuad( " @@ -861,7 +863,7 @@ CORBA::Boolean SMESHDS_Mesh* aMesh = GetMeshDS(); map elements; - ToMap(IDsOfElements, aMesh, elements); + ToMap(IDsOfElements, aMesh, elements, SMDSAbs_Face); set fixedNodes; for (int i = 0; i < IDsOfFixedNodes.length(); i++) { -- 2.39.2