mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-24 16:30:34 +05:00
0020200: EDF SMESH 983: changing algo of a mesh and switching back to original algo leads to different result than original
sort nodes and elements by ID
This commit is contained in:
parent
2534543b1e
commit
59b7f3d704
@ -87,11 +87,7 @@ int SMESHDS_SubMesh::NbElements() const
|
|||||||
return myElements.size();
|
return myElements.size();
|
||||||
|
|
||||||
int nbElems = 0;
|
int nbElems = 0;
|
||||||
#ifndef WNT
|
|
||||||
set<const SMESHDS_SubMesh*>::iterator it = mySubMeshes.begin();
|
|
||||||
#else
|
|
||||||
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
|
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
|
||||||
#endif
|
|
||||||
for ( ; it != mySubMeshes.end(); it++ )
|
for ( ; it != mySubMeshes.end(); it++ )
|
||||||
nbElems += (*it)->NbElements();
|
nbElems += (*it)->NbElements();
|
||||||
|
|
||||||
@ -109,11 +105,7 @@ int SMESHDS_SubMesh::NbNodes() const
|
|||||||
return myNodes.size();
|
return myNodes.size();
|
||||||
|
|
||||||
int nbElems = 0;
|
int nbElems = 0;
|
||||||
#ifndef WNT
|
|
||||||
set<const SMESHDS_SubMesh*>::iterator it = mySubMeshes.begin();
|
|
||||||
#else
|
|
||||||
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
|
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
|
||||||
#endif
|
|
||||||
for ( ; it != mySubMeshes.end(); it++ )
|
for ( ; it != mySubMeshes.end(); it++ )
|
||||||
nbElems += (*it)->NbNodes();
|
nbElems += (*it)->NbNodes();
|
||||||
|
|
||||||
@ -124,27 +116,14 @@ int SMESHDS_SubMesh::NbNodes() const
|
|||||||
// class MySetIterator
|
// class MySetIterator
|
||||||
// =====================
|
// =====================
|
||||||
|
|
||||||
template<typename T> class MySetIterator:public SMDS_Iterator<const T*>
|
template<typename TSet> class MySetIterator: public SMDS_SetIterator<typename TSet::key_type,
|
||||||
|
typename TSet::const_iterator >
|
||||||
{
|
{
|
||||||
typedef const set<const T*> TSet;
|
typedef SMDS_SetIterator<typename TSet::key_type, typename TSet::const_iterator > TFather;
|
||||||
typename TSet::const_iterator myIt;
|
|
||||||
TSet& mySet;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MySetIterator(const set<const T*>& s):mySet(s), myIt(s.begin())
|
MySetIterator(const TSet& s):TFather(s.begin(),s.end())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool more()
|
|
||||||
{
|
|
||||||
return myIt!=mySet.end();
|
|
||||||
}
|
|
||||||
const T* next()
|
|
||||||
{
|
|
||||||
const T* t=*myIt;
|
|
||||||
myIt++;
|
|
||||||
return t;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// =====================
|
// =====================
|
||||||
@ -222,7 +201,7 @@ SMDS_ElemIteratorPtr SMESHDS_SubMesh::GetElements() const
|
|||||||
if ( IsComplexSubmesh() )
|
if ( IsComplexSubmesh() )
|
||||||
return SMDS_ElemIteratorPtr( new MyElemIterator( mySubMeshes ));
|
return SMDS_ElemIteratorPtr( new MyElemIterator( mySubMeshes ));
|
||||||
|
|
||||||
return SMDS_ElemIteratorPtr(new MySetIterator<SMDS_MeshElement>(myElements));
|
return SMDS_ElemIteratorPtr(new MySetIterator<TElemSet>(myElements));
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -235,7 +214,7 @@ SMDS_NodeIteratorPtr SMESHDS_SubMesh::GetNodes() const
|
|||||||
if ( IsComplexSubmesh() )
|
if ( IsComplexSubmesh() )
|
||||||
return SMDS_NodeIteratorPtr( new MyNodeIterator( mySubMeshes ));
|
return SMDS_NodeIteratorPtr( new MyNodeIterator( mySubMeshes ));
|
||||||
|
|
||||||
return SMDS_NodeIteratorPtr(new MySetIterator<SMDS_MeshNode>(myNodes));
|
return SMDS_NodeIteratorPtr(new MySetIterator<TNodeSet>(myNodes));
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -65,9 +65,14 @@ class SMESHDS_EXPORT SMESHDS_SubMesh
|
|||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//const SMDS_Mesh * myMesh;
|
struct TIDCompare { // to have nodes and elements sorted by ID
|
||||||
std::set<const SMDS_MeshElement*> myElements;
|
bool operator () (const SMDS_MeshElement* e1, const SMDS_MeshElement* e2) const
|
||||||
std::set<const SMDS_MeshNode*> myNodes;
|
{ return e1->GetID() < e2->GetID(); }
|
||||||
std::set<const SMESHDS_SubMesh*> mySubMeshes;
|
};
|
||||||
|
typedef std::set<const SMDS_MeshElement*, TIDCompare > TElemSet;
|
||||||
|
typedef std::set<const SMDS_MeshNode* , TIDCompare> TNodeSet;
|
||||||
|
TElemSet myElements;
|
||||||
|
TNodeSet myNodes;
|
||||||
|
std::set<const SMESHDS_SubMesh*> mySubMeshes;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user