mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-30 19:30:35 +05:00
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:
parent
d2cde5340a
commit
6de9a2197d
@ -914,12 +914,12 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap & theParam2ColumnMap,
|
|||||||
// try to load the rest nodes
|
// try to load the rest nodes
|
||||||
|
|
||||||
// get all faces from theFace
|
// get all faces from theFace
|
||||||
map<int,const SMDS_MeshElement*> allFaces, foundFaces;
|
TIDSortedElemSet allFaces, foundFaces;
|
||||||
eIt = smFace->GetElements();
|
eIt = smFace->GetElements();
|
||||||
while ( eIt->more() ) {
|
while ( eIt->more() ) {
|
||||||
const SMDS_MeshElement* e = eIt->next();
|
const SMDS_MeshElement* e = eIt->next();
|
||||||
if ( e->GetType() == SMDSAbs_Face )
|
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
|
// Starting from 2 neighbour nodes on theBaseEdge, look for a face
|
||||||
// the nodes belong to, and between the nodes of the found 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);
|
RETURN_BAD_RESULT( "Too many nodes in column "<< col <<": "<< row+1);
|
||||||
}
|
}
|
||||||
par_nVec_2->second[ row ] = node;
|
par_nVec_2->second[ row ] = node;
|
||||||
foundFaces.insert( make_pair(face->GetID(),face) );
|
foundFaces.insert( face );
|
||||||
n2 = node;
|
n2 = node;
|
||||||
if ( nbFaceNodes==4 ) {
|
if ( nbFaceNodes==4 ) {
|
||||||
n1 = par_nVec_1->second[ row ];
|
n1 = par_nVec_1->second[ row ];
|
||||||
|
@ -3257,11 +3257,11 @@ void SMESH_Pattern::
|
|||||||
myPolyElems.reserve( myIdsOnBoundary.size() );
|
myPolyElems.reserve( myIdsOnBoundary.size() );
|
||||||
|
|
||||||
// make a set of refined elements
|
// 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();
|
std::vector<const SMDS_MeshElement*>::iterator itv = myElements.begin();
|
||||||
for(; itv!=myElements.end(); itv++) {
|
for(; itv!=myElements.end(); itv++) {
|
||||||
const SMDS_MeshElement* el = (*itv);
|
const SMDS_MeshElement* el = (*itv);
|
||||||
avoidSet.insert( make_pair(el->GetID(),el) );
|
avoidSet.insert( el );
|
||||||
}
|
}
|
||||||
//avoidSet.insert( myElements.begin(), myElements.end() );
|
//avoidSet.insert( myElements.begin(), myElements.end() );
|
||||||
|
|
||||||
@ -3293,7 +3293,7 @@ void SMESH_Pattern::
|
|||||||
SMESH_MeshEditor::FindFaceInSet( n1, n2, elemSet, avoidSet );
|
SMESH_MeshEditor::FindFaceInSet( n1, n2, elemSet, avoidSet );
|
||||||
if ( face )
|
if ( face )
|
||||||
{
|
{
|
||||||
avoidSet.insert ( make_pair(face->GetID(),face) );
|
avoidSet.insert ( face );
|
||||||
myPolyElems.push_back( face );
|
myPolyElems.push_back( face );
|
||||||
|
|
||||||
// some links of <face> are split;
|
// some links of <face> are split;
|
||||||
@ -3414,7 +3414,7 @@ void SMESH_Pattern::
|
|||||||
while ( eIt->more() )
|
while ( eIt->more() )
|
||||||
{
|
{
|
||||||
const SMDS_MeshElement* elem = eIt->next();
|
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
|
continue; // skip faces or refined elements
|
||||||
// add polyhedron definition
|
// add polyhedron definition
|
||||||
myPolyhedronQuantities.push_back(vector<int> ());
|
myPolyhedronQuantities.push_back(vector<int> ());
|
||||||
|
@ -2749,7 +2749,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
|||||||
aDataset->CloseOnDisk();
|
aDataset->CloseOnDisk();
|
||||||
|
|
||||||
// get elements sorted by ID
|
// get elements sorted by ID
|
||||||
::SMESH_MeshEditor::TIDSortedElemSet elemSet;
|
TIDSortedElemSet elemSet;
|
||||||
if ( isNode )
|
if ( isNode )
|
||||||
while ( nIt->more() ) elemSet.insert( nIt->next() );
|
while ( nIt->more() ) elemSet.insert( nIt->next() );
|
||||||
else
|
else
|
||||||
@ -2757,7 +2757,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
|||||||
ASSERT( elemSet.size() == nbElems );
|
ASSERT( elemSet.size() == nbElems );
|
||||||
|
|
||||||
// add elements to submeshes
|
// add elements to submeshes
|
||||||
::SMESH_MeshEditor::TIDSortedElemSet::iterator iE = elemSet.begin();
|
TIDSortedElemSet::iterator iE = elemSet.begin();
|
||||||
for ( int i = 0; i < nbElems; ++i, ++iE )
|
for ( int i = 0; i < nbElems; ++i, ++iE )
|
||||||
{
|
{
|
||||||
int smID = smIDs[ i ];
|
int smID = smIDs[ i ];
|
||||||
|
@ -524,29 +524,32 @@ CORBA::Boolean SMESH_MeshEditor_i::ReorientObject(SMESH::SMESH_IDSource_ptr theO
|
|||||||
return isDone;
|
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
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
//=======================================================================
|
void ToMap(const SMESH::long_array & IDs,
|
||||||
//function : ToMap
|
const SMESHDS_Mesh* aMesh,
|
||||||
//purpose : auxilary function for conversion long_array to std::map<>
|
TIDSortedElemSet& aMap,
|
||||||
// which is used in some methods
|
const SMDSAbs_ElementType aType = SMDSAbs_All )
|
||||||
//=======================================================================
|
{
|
||||||
static void ToMap(const SMESH::long_array & IDs,
|
for (int i=0; i<IDs.length(); i++) {
|
||||||
const SMESHDS_Mesh* aMesh,
|
CORBA::Long ind = IDs[i];
|
||||||
std::map<int,const SMDS_MeshElement*>& 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);
|
const SMDS_MeshElement * elem = aMesh->FindElement(ind);
|
||||||
if ( elem && ( aType == SMDSAbs_All || elem->GetType() == aType ))
|
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();
|
myLastCreatedNodes = new SMESH::long_array();
|
||||||
|
|
||||||
SMESHDS_Mesh* aMesh = GetMeshDS();
|
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||||
map<int,const SMDS_MeshElement*> faces;
|
TIDSortedElemSet faces;
|
||||||
ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
|
ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
|
||||||
|
|
||||||
SMESH::NumericalFunctor_i* aNumericalFunctor =
|
SMESH::NumericalFunctor_i* aNumericalFunctor =
|
||||||
@ -636,7 +639,7 @@ CORBA::Boolean SMESH_MeshEditor_i::QuadToTri (const SMESH::long_array & IDsOfE
|
|||||||
myLastCreatedNodes = new SMESH::long_array();
|
myLastCreatedNodes = new SMESH::long_array();
|
||||||
|
|
||||||
SMESHDS_Mesh* aMesh = GetMeshDS();
|
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||||
map<int,const SMDS_MeshElement*> faces;
|
TIDSortedElemSet faces;
|
||||||
ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
|
ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
|
||||||
|
|
||||||
SMESH::NumericalFunctor_i* aNumericalFunctor =
|
SMESH::NumericalFunctor_i* aNumericalFunctor =
|
||||||
@ -709,7 +712,7 @@ CORBA::Boolean SMESH_MeshEditor_i::SplitQuad (const SMESH::long_array & IDsOfEle
|
|||||||
myLastCreatedNodes = new SMESH::long_array();
|
myLastCreatedNodes = new SMESH::long_array();
|
||||||
|
|
||||||
SMESHDS_Mesh* aMesh = GetMeshDS();
|
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||||
map<int,const SMDS_MeshElement*> faces;
|
TIDSortedElemSet faces;
|
||||||
ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
|
ToMap(IDsOfElements, aMesh, faces, SMDSAbs_Face);
|
||||||
|
|
||||||
// Update Python script
|
// Update Python script
|
||||||
@ -873,7 +876,7 @@ CORBA::Boolean
|
|||||||
|
|
||||||
SMESHDS_Mesh* aMesh = GetMeshDS();
|
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||||
|
|
||||||
map<int,const SMDS_MeshElement*> elements;
|
TIDSortedElemSet elements;
|
||||||
ToMap(IDsOfElements, aMesh, elements, SMDSAbs_Face);
|
ToMap(IDsOfElements, aMesh, elements, SMDSAbs_Face);
|
||||||
|
|
||||||
set<const SMDS_MeshNode*> fixedNodes;
|
set<const SMDS_MeshNode*> fixedNodes;
|
||||||
@ -999,7 +1002,7 @@ void SMESH_MeshEditor_i::RotationSweep(const SMESH::long_array & theIDsOfElement
|
|||||||
|
|
||||||
SMESHDS_Mesh* aMesh = GetMeshDS();
|
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||||
|
|
||||||
map<int,const SMDS_MeshElement*> elements;
|
TIDSortedElemSet elements;
|
||||||
ToMap(theIDsOfElements, aMesh, elements);
|
ToMap(theIDsOfElements, aMesh, elements);
|
||||||
|
|
||||||
gp_Ax1 Ax1 (gp_Pnt( theAxis.x, theAxis.y, theAxis.z ),
|
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
|
#endif
|
||||||
SMESHDS_Mesh* aMesh = GetMeshDS();
|
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||||
|
|
||||||
map<int,const SMDS_MeshElement*> elements;
|
TIDSortedElemSet elements;
|
||||||
ToMap(theIDsOfElements, aMesh, elements);
|
ToMap(theIDsOfElements, aMesh, elements);
|
||||||
|
|
||||||
const SMESH::PointStruct * P = &theStepVector.PS;
|
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();
|
SMESH::long_array_var allElementsId = theObject->GetIDs();
|
||||||
|
|
||||||
map<int,const SMDS_MeshElement*> elements;
|
TIDSortedElemSet elements;
|
||||||
ToMap(allElementsId, aMesh, elements);
|
ToMap(allElementsId, aMesh, elements);
|
||||||
|
|
||||||
const SMESH::PointStruct * P = &theStepVector.PS;
|
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();
|
SMESH::long_array_var allElementsId = theObject->GetIDs();
|
||||||
|
|
||||||
map<int,const SMDS_MeshElement*> elements;
|
TIDSortedElemSet elements;
|
||||||
ToMap(allElementsId, aMesh, elements);
|
ToMap(allElementsId, aMesh, elements);
|
||||||
|
|
||||||
const SMESH::PointStruct * P = &theStepVector.PS;
|
const SMESH::PointStruct * P = &theStepVector.PS;
|
||||||
@ -1210,7 +1213,7 @@ void SMESH_MeshEditor_i::AdvancedExtrusion(const SMESH::long_array & theIDsOfEle
|
|||||||
|
|
||||||
SMESHDS_Mesh* aMesh = GetMeshDS();
|
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||||
|
|
||||||
map<int,const SMDS_MeshElement*> elements;
|
TIDSortedElemSet elements;
|
||||||
ToMap(theIDsOfElements, aMesh, elements);
|
ToMap(theIDsOfElements, aMesh, elements);
|
||||||
|
|
||||||
const SMESH::PointStruct * P = &theStepVector.PS;
|
const SMESH::PointStruct * P = &theStepVector.PS;
|
||||||
@ -1284,7 +1287,7 @@ SMESH::SMESH_MeshEditor::Extrusion_Error
|
|||||||
if ( !nodeStart )
|
if ( !nodeStart )
|
||||||
return SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
|
return SMESH::SMESH_MeshEditor::EXTR_BAD_STARTING_NODE;
|
||||||
|
|
||||||
map<int,const SMDS_MeshElement*> elements;
|
TIDSortedElemSet elements;
|
||||||
ToMap(theIDsOfElements, aMesh, elements);
|
ToMap(theIDsOfElements, aMesh, elements);
|
||||||
|
|
||||||
list<double> angles;
|
list<double> angles;
|
||||||
@ -1374,7 +1377,7 @@ void SMESH_MeshEditor_i::Mirror(const SMESH::long_array & theIDsOfElem
|
|||||||
|
|
||||||
SMESHDS_Mesh* aMesh = GetMeshDS();
|
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||||
|
|
||||||
map<int,const SMDS_MeshElement*> elements;
|
TIDSortedElemSet elements;
|
||||||
ToMap(theIDsOfElements, aMesh, elements);
|
ToMap(theIDsOfElements, aMesh, elements);
|
||||||
|
|
||||||
gp_Pnt P ( theAxis.x, theAxis.y, theAxis.z );
|
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();
|
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||||
|
|
||||||
map<int,const SMDS_MeshElement*> elements;
|
TIDSortedElemSet elements;
|
||||||
ToMap(theIDsOfElements, aMesh, elements);
|
ToMap(theIDsOfElements, aMesh, elements);
|
||||||
|
|
||||||
gp_Trsf aTrsf;
|
gp_Trsf aTrsf;
|
||||||
@ -1529,7 +1532,7 @@ void SMESH_MeshEditor_i::Rotate(const SMESH::long_array & theIDsOfElements,
|
|||||||
|
|
||||||
SMESHDS_Mesh* aMesh = GetMeshDS();
|
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||||
|
|
||||||
map<int,const SMDS_MeshElement*> elements;
|
TIDSortedElemSet elements;
|
||||||
ToMap(theIDsOfElements, aMesh, elements);
|
ToMap(theIDsOfElements, aMesh, elements);
|
||||||
|
|
||||||
gp_Pnt P ( theAxis.x, theAxis.y, theAxis.z );
|
gp_Pnt P ( theAxis.x, theAxis.y, theAxis.z );
|
||||||
@ -1909,7 +1912,7 @@ SMESH_MeshEditor_i::SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
|
|||||||
!aSecondNode2ToMerge)
|
!aSecondNode2ToMerge)
|
||||||
return SMESH::SMESH_MeshEditor::SEW_BAD_SIDE2_NODES;
|
return SMESH::SMESH_MeshEditor::SEW_BAD_SIDE2_NODES;
|
||||||
|
|
||||||
map<int,const SMDS_MeshElement*> aSide1Elems, aSide2Elems;
|
TIDSortedElemSet aSide1Elems, aSide2Elems;
|
||||||
ToMap(IDsOfSide1Elements, aMesh, aSide1Elems);
|
ToMap(IDsOfSide1Elements, aMesh, aSide1Elems);
|
||||||
ToMap(IDsOfSide2Elements, aMesh, aSide2Elems);
|
ToMap(IDsOfSide2Elements, aMesh, aSide2Elems);
|
||||||
|
|
||||||
|
@ -1554,12 +1554,12 @@ bool StdMeshers_Penta_3D::LoadIJNodes(StdMeshers_IJNodeMap & theIJNodes,
|
|||||||
// try to load the rest nodes
|
// try to load the rest nodes
|
||||||
|
|
||||||
// get all faces from theFace
|
// get all faces from theFace
|
||||||
map<int,const SMDS_MeshElement*> allFaces, foundFaces;
|
TIDSortedElemSet allFaces, foundFaces;
|
||||||
SMDS_ElemIteratorPtr eIt = smFace->GetElements();
|
SMDS_ElemIteratorPtr eIt = smFace->GetElements();
|
||||||
while ( eIt->more() ) {
|
while ( eIt->more() ) {
|
||||||
const SMDS_MeshElement* e = eIt->next();
|
const SMDS_MeshElement* e = eIt->next();
|
||||||
if ( e->GetType() == SMDSAbs_Face )
|
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
|
// Starting from 2 neighbour nodes on theBaseEdge, look for a face
|
||||||
// the nodes belong to, and between the nodes of the found 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;
|
return false;
|
||||||
}
|
}
|
||||||
par_nVec_2->second[ row ] = node;
|
par_nVec_2->second[ row ] = node;
|
||||||
foundFaces.insert( make_pair(face->GetID(),face) );
|
foundFaces.insert( face );
|
||||||
n2 = node;
|
n2 = node;
|
||||||
if ( nbFaceNodes==4 || (myCreateQuadratic && nbFaceNodes==8) ) {
|
if ( nbFaceNodes==4 || (myCreateQuadratic && nbFaceNodes==8) ) {
|
||||||
n1 = par_nVec_1->second[ row ];
|
n1 = par_nVec_1->second[ row ];
|
||||||
|
@ -976,12 +976,12 @@ FindMatchingNodesOnFaces( const TopoDS_Face& face1,
|
|||||||
const SMDS_MeshElement* faceToKeep = 0;
|
const SMDS_MeshElement* faceToKeep = 0;
|
||||||
const SMDS_MeshNode* vNode = is2 ? vNode2 : vNode1;
|
const SMDS_MeshNode* vNode = is2 ? vNode2 : vNode1;
|
||||||
const SMDS_MeshNode* eNode = is2 ? eNode2[0] : eNode1[0];
|
const SMDS_MeshNode* eNode = is2 ? eNode2[0] : eNode1[0];
|
||||||
std::map<int,const SMDS_MeshElement*> inSet, notInSet;
|
TIDSortedElemSet inSet, notInSet;
|
||||||
|
|
||||||
const SMDS_MeshElement* f1 =
|
const SMDS_MeshElement* f1 =
|
||||||
SMESH_MeshEditor::FindFaceInSet( vNode, eNode, inSet, notInSet );
|
SMESH_MeshEditor::FindFaceInSet( vNode, eNode, inSet, notInSet );
|
||||||
if ( !f1 ) RETURN_BAD_RESULT("The first face on seam not found");
|
if ( !f1 ) RETURN_BAD_RESULT("The first face on seam not found");
|
||||||
SMESH_MeshEditor::Insert( f1, notInSet );
|
notInSet.insert( f1 );
|
||||||
|
|
||||||
const SMDS_MeshElement* f2 =
|
const SMDS_MeshElement* f2 =
|
||||||
SMESH_MeshEditor::FindFaceInSet( vNode, eNode, inSet, notInSet );
|
SMESH_MeshEditor::FindFaceInSet( vNode, eNode, inSet, notInSet );
|
||||||
|
Loading…
Reference in New Issue
Block a user