NPAL14335 (EDF 344 SMESH : "ERROR : Iterator not implemented " when loading a script)

use set<element,comparator> instead of map<ID,element> to
        have elements sorted by ID
This commit is contained in:
eap 2006-12-29 14:37:28 +00:00
parent d2cde5340a
commit 6de9a2197d
6 changed files with 47 additions and 44 deletions

View File

@ -914,12 +914,12 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap & theParam2ColumnMap,
// try to load the rest nodes
// get all faces from theFace
map<int,const SMDS_MeshElement*> 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 ];

View File

@ -3257,11 +3257,11 @@ void SMESH_Pattern::
myPolyElems.reserve( myIdsOnBoundary.size() );
// make a set of refined elements
map<int,const SMDS_MeshElement* > avoidSet, elemSet;
TIDSortedElemSet avoidSet, elemSet;
std::vector<const SMDS_MeshElement*>::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 <face> 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<int> ());

View File

@ -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 ];

View File

@ -524,29 +524,32 @@ CORBA::Boolean SMESH_MeshEditor_i::ReorientObject(SMESH::SMESH_IDSource_ptr theO
return isDone;
}
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
*/
//================================================================================
//=======================================================================
//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,
void ToMap(const SMESH::long_array & IDs,
const SMESHDS_Mesh* aMesh,
std::map<int,const SMDS_MeshElement*>& aMap,
TIDSortedElemSet& aMap,
const SMDSAbs_ElementType aType = SMDSAbs_All )
{
for (int i=0; i<IDs.length(); i++) {
CORBA::Long ind = IDs[i];
std::map<int,const SMDS_MeshElement*>::iterator It = aMap.find(ind);
if(It==aMap.end()) {
const SMDS_MeshElement * elem = aMesh->FindElement(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<int,const SMDS_MeshElement*> 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<int,const SMDS_MeshElement*> 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<int,const SMDS_MeshElement*> faces;
TIDSortedElemSet faces;
ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
// Update Python script
@ -873,7 +876,7 @@ CORBA::Boolean
SMESHDS_Mesh* aMesh = GetMeshDS();
map<int,const SMDS_MeshElement*> elements;
TIDSortedElemSet elements;
ToMap(IDsOfElements, aMesh, elements, SMDSAbs_Face);
set<const SMDS_MeshNode*> fixedNodes;
@ -999,7 +1002,7 @@ void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElement
SMESHDS_Mesh* aMesh = GetMeshDS();
map<int,const SMDS_MeshElement*> 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<int,const SMDS_MeshElement*> 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<int,const SMDS_MeshElement*> 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<int,const SMDS_MeshElement*> 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<int,const SMDS_MeshElement*> 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<int,const SMDS_MeshElement*> elements;
TIDSortedElemSet elements;
ToMap(theIDsOfElements, aMesh, elements);
list<double> angles;
@ -1374,7 +1377,7 @@ void SMESH_MeshEditor_i::Mirror(const SMESH::long_array & theIDsOfElem
SMESHDS_Mesh* aMesh = GetMeshDS();
map<int,const SMDS_MeshElement*> 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<int,const SMDS_MeshElement*> 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<int,const SMDS_MeshElement*> 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<int,const SMDS_MeshElement*> aSide1Elems, aSide2Elems;
TIDSortedElemSet aSide1Elems, aSide2Elems;
ToMap(IDsOfSide1Elements, aMesh, aSide1Elems);
ToMap(IDsOfSide2Elements, aMesh, aSide2Elems);

View File

@ -1554,12 +1554,12 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
// try to load the rest nodes
// get all faces from theFace
map<int,const SMDS_MeshElement*> 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 ];

View File

@ -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<int,const SMDS_MeshElement*> 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 );