From: eap Date: Fri, 29 Dec 2006 14:37:28 +0000 (+0000) Subject: NPAL14335 (EDF 344 SMESH : "ERROR : Iterator not implemented " when loading a script) X-Git-Tag: V3_2_5pre1~31 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6de9a2197d71492b87607321947426e4cd07670f;p=modules%2Fsmesh.git NPAL14335 (EDF 344 SMESH : "ERROR : Iterator not implemented " when loading a script) use set instead of map to have elements sorted by ID --- diff --git a/src/SMESH/SMESH_MesherHelper.cxx b/src/SMESH/SMESH_MesherHelper.cxx index c3e420317..0d3779585 100644 --- a/src/SMESH/SMESH_MesherHelper.cxx +++ b/src/SMESH/SMESH_MesherHelper.cxx @@ -914,12 +914,12 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap & theParam2ColumnMap, // try to load the rest nodes // get all faces from theFace - map allFaces, foundFaces; + TIDSortedElemSet allFaces, foundFaces; eIt = smFace->GetElements(); while ( eIt->more() ) { const SMDS_MeshElement* e = eIt->next(); if ( e->GetType() == SMDSAbs_Face ) - allFaces.insert( make_pair(e->GetID(),e) ); + allFaces.insert( e ); } // Starting from 2 neighbour nodes on theBaseEdge, look for a face // the nodes belong to, and between the nodes of the found face, @@ -967,7 +967,7 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap & theParam2ColumnMap, RETURN_BAD_RESULT( "Too many nodes in column "<< col <<": "<< row+1); } par_nVec_2->second[ row ] = node; - foundFaces.insert( make_pair(face->GetID(),face) ); + foundFaces.insert( face ); n2 = node; if ( nbFaceNodes==4 ) { n1 = par_nVec_1->second[ row ]; diff --git a/src/SMESH/SMESH_Pattern.cxx b/src/SMESH/SMESH_Pattern.cxx index 03bce5e4e..44396d2af 100644 --- a/src/SMESH/SMESH_Pattern.cxx +++ b/src/SMESH/SMESH_Pattern.cxx @@ -3257,11 +3257,11 @@ void SMESH_Pattern:: myPolyElems.reserve( myIdsOnBoundary.size() ); // make a set of refined elements - map avoidSet, elemSet; + TIDSortedElemSet avoidSet, elemSet; std::vector::iterator itv = myElements.begin(); for(; itv!=myElements.end(); itv++) { const SMDS_MeshElement* el = (*itv); - avoidSet.insert( make_pair(el->GetID(),el) ); + avoidSet.insert( el ); } //avoidSet.insert( myElements.begin(), myElements.end() ); @@ -3293,7 +3293,7 @@ void SMESH_Pattern:: SMESH_MeshEditor::FindFaceInSet( n1, n2, elemSet, avoidSet ); if ( face ) { - avoidSet.insert ( make_pair(face->GetID(),face) ); + avoidSet.insert ( face ); myPolyElems.push_back( face ); // some links of are split; @@ -3414,7 +3414,7 @@ void SMESH_Pattern:: while ( eIt->more() ) { const SMDS_MeshElement* elem = eIt->next(); - if ( !volTool.Set( elem ) || !avoidSet.insert( make_pair(elem->GetID(),elem) ).second ) + if ( !volTool.Set( elem ) || !avoidSet.insert( elem ).second ) continue; // skip faces or refined elements // add polyhedron definition myPolyhedronQuantities.push_back(vector ()); diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 9673f56b4..77cdfad14 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -2749,7 +2749,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent, aDataset->CloseOnDisk(); // get elements sorted by ID - ::SMESH_MeshEditor::TIDSortedElemSet elemSet; + TIDSortedElemSet elemSet; if ( isNode ) while ( nIt->more() ) elemSet.insert( nIt->next() ); else @@ -2757,7 +2757,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent, ASSERT( elemSet.size() == nbElems ); // add elements to submeshes - ::SMESH_MeshEditor::TIDSortedElemSet::iterator iE = elemSet.begin(); + TIDSortedElemSet::iterator iE = elemSet.begin(); for ( int i = 0; i < nbElems; ++i, ++iE ) { int smID = smIDs[ i ]; diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index 55fc2330d..8447ab89e 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -524,29 +524,32 @@ CORBA::Boolean SMESH_MeshEditor_i::ReorientObject(SMESH::SMESH_IDSource_ptr theO return isDone; } - -//======================================================================= -//function : ToMap -//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, - const SMDSAbs_ElementType aType = SMDSAbs_All ) -{ - for (int i=0; i::iterator It = aMap.find(ind); - if(It==aMap.end()) { +namespace +{ + //================================================================================ + /*! + * \brief function for conversion long_array to TIDSortedElemSet + * \param IDs - array of IDs + * \param aMesh - mesh + * \param aMap - collection to fill + * \param aType - element type + */ + //================================================================================ + + void ToMap(const SMESH::long_array & IDs, + const SMESHDS_Mesh* aMesh, + TIDSortedElemSet& aMap, + const SMDSAbs_ElementType aType = SMDSAbs_All ) + { + for (int i=0; iFindElement(ind); if ( elem && ( aType == SMDSAbs_All || elem->GetType() == aType )) - aMap.insert( make_pair( elem->GetID(), elem )); + aMap.insert( elem ); } } } - //============================================================================= /*! * @@ -560,7 +563,7 @@ CORBA::Boolean SMESH_MeshEditor_i::TriToQuad (const SMESH::long_array & IDsOfE myLastCreatedNodes = new SMESH::long_array(); SMESHDS_Mesh* aMesh = GetMeshDS(); - map faces; + TIDSortedElemSet faces; ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face); SMESH::NumericalFunctor_i* aNumericalFunctor = @@ -636,7 +639,7 @@ CORBA::Boolean SMESH_MeshEditor_i::QuadToTri (const SMESH::long_array & IDsOfE myLastCreatedNodes = new SMESH::long_array(); SMESHDS_Mesh* aMesh = GetMeshDS(); - map faces; + TIDSortedElemSet faces; ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face); SMESH::NumericalFunctor_i* aNumericalFunctor = @@ -709,7 +712,7 @@ CORBA::Boolean SMESH_MeshEditor_i::SplitQuad (const SMESH::long_array & IDsOfEle myLastCreatedNodes = new SMESH::long_array(); SMESHDS_Mesh* aMesh = GetMeshDS(); - map faces; + TIDSortedElemSet faces; ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face); // Update Python script @@ -873,7 +876,7 @@ CORBA::Boolean SMESHDS_Mesh* aMesh = GetMeshDS(); - map elements; + TIDSortedElemSet elements; ToMap(IDsOfElements, aMesh, elements, SMDSAbs_Face); set fixedNodes; @@ -999,7 +1002,7 @@ void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElement SMESHDS_Mesh* aMesh = GetMeshDS(); - map elements; + TIDSortedElemSet elements; ToMap(theIDsOfElements, aMesh, elements); gp_Ax1 Ax1 (gp_Pnt( theAxis.x, theAxis.y, theAxis.z ), @@ -1071,7 +1074,7 @@ void SMESH_MeshEditor_i::ExtrusionSweep(const SMESH::long_array & theIDsOfElemen #endif SMESHDS_Mesh* aMesh = GetMeshDS(); - map elements; + TIDSortedElemSet elements; ToMap(theIDsOfElements, aMesh, elements); const SMESH::PointStruct * P = &theStepVector.PS; @@ -1139,7 +1142,7 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject1D(SMESH::SMESH_IDSource_ptr theObj SMESH::long_array_var allElementsId = theObject->GetIDs(); - map elements; + TIDSortedElemSet elements; ToMap(allElementsId, aMesh, elements); const SMESH::PointStruct * P = &theStepVector.PS; @@ -1174,7 +1177,7 @@ void SMESH_MeshEditor_i::ExtrusionSweepObject2D(SMESH::SMESH_IDSource_ptr theObj SMESH::long_array_var allElementsId = theObject->GetIDs(); - map elements; + TIDSortedElemSet elements; ToMap(allElementsId, aMesh, elements); const SMESH::PointStruct * P = &theStepVector.PS; @@ -1210,7 +1213,7 @@ void SMESH_MeshEditor_i::AdvancedExtrusion(const SMESH::long_array & theIDsOfEle SMESHDS_Mesh* aMesh = GetMeshDS(); - map elements; + TIDSortedElemSet elements; ToMap(theIDsOfElements, aMesh, elements); const SMESH::PointStruct * P = &theStepVector.PS; @@ -1284,7 +1287,7 @@ SMESH::SMESH_MeshEditor::Extrusion_Error if ( !nodeStart ) return SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE; - map elements; + TIDSortedElemSet elements; ToMap(theIDsOfElements, aMesh, elements); list angles; @@ -1374,7 +1377,7 @@ void SMESH_MeshEditor_i::Mirror(const SMESH::long_array & theIDsOfElem SMESHDS_Mesh* aMesh = GetMeshDS(); - map elements; + TIDSortedElemSet elements; ToMap(theIDsOfElements, aMesh, elements); gp_Pnt P ( theAxis.x, theAxis.y, theAxis.z ); @@ -1466,7 +1469,7 @@ void SMESH_MeshEditor_i::Translate(const SMESH::long_array & theIDsOfElements, SMESHDS_Mesh* aMesh = GetMeshDS(); - map elements; + TIDSortedElemSet elements; ToMap(theIDsOfElements, aMesh, elements); gp_Trsf aTrsf; @@ -1529,7 +1532,7 @@ void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements, SMESHDS_Mesh* aMesh = GetMeshDS(); - map elements; + TIDSortedElemSet elements; ToMap(theIDsOfElements, aMesh, elements); gp_Pnt P ( theAxis.x, theAxis.y, theAxis.z ); @@ -1909,7 +1912,7 @@ SMESH_MeshEditor_i::SewSideElements(const SMESH::long_array& IDsOfSide1Elements, !aSecondNode2ToMerge) return SMESH::SMESH_MeshEditor::SEW_BAD_SIDE2_NODES; - map aSide1Elems, aSide2Elems; + TIDSortedElemSet aSide1Elems, aSide2Elems; ToMap(IDsOfSide1Elements, aMesh, aSide1Elems); ToMap(IDsOfSide2Elements, aMesh, aSide2Elems); diff --git a/src/StdMeshers/StdMeshers_Penta_3D.cxx b/src/StdMeshers/StdMeshers_Penta_3D.cxx index f183a80da..51b33214f 100644 --- a/src/StdMeshers/StdMeshers_Penta_3D.cxx +++ b/src/StdMeshers/StdMeshers_Penta_3D.cxx @@ -1554,12 +1554,12 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes, // try to load the rest nodes // get all faces from theFace - map allFaces, foundFaces; + TIDSortedElemSet allFaces, foundFaces; SMDS_ElemIteratorPtr eIt = smFace->GetElements(); while ( eIt->more() ) { const SMDS_MeshElement* e = eIt->next(); if ( e->GetType() == SMDSAbs_Face ) - allFaces.insert( make_pair(e->GetID(),e) ); + allFaces.insert( e ); } // Starting from 2 neighbour nodes on theBaseEdge, look for a face // the nodes belong to, and between the nodes of the found face, @@ -1606,7 +1606,7 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes, return false; } par_nVec_2->second[ row ] = node; - foundFaces.insert( make_pair(face->GetID(),face) ); + foundFaces.insert( face ); n2 = node; if ( nbFaceNodes==4 || (myCreateQuadratic && nbFaceNodes==8) ) { n1 = par_nVec_1->second[ row ]; diff --git a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx index 2afedd4ce..b1d3500c6 100644 --- a/src/StdMeshers/StdMeshers_ProjectionUtils.cxx +++ b/src/StdMeshers/StdMeshers_ProjectionUtils.cxx @@ -976,12 +976,12 @@ FindMatchingNodesOnFaces( const TopoDS_Face& face1, const SMDS_MeshElement* faceToKeep = 0; const SMDS_MeshNode* vNode = is2 ? vNode2 : vNode1; const SMDS_MeshNode* eNode = is2 ? eNode2[0] : eNode1[0]; - std::map inSet, notInSet; + TIDSortedElemSet inSet, notInSet; const SMDS_MeshElement* f1 = SMESH_MeshEditor::FindFaceInSet( vNode, eNode, inSet, notInSet ); if ( !f1 ) RETURN_BAD_RESULT("The first face on seam not found"); - SMESH_MeshEditor::Insert( f1, notInSet ); + notInSet.insert( f1 ); const SMDS_MeshElement* f2 = SMESH_MeshEditor::FindFaceInSet( vNode, eNode, inSet, notInSet );