mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-27 09:50: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
f94864f0a5
commit
44b3e0b765
@ -87,11 +87,7 @@ int SMESHDS_SubMesh::NbElements() const
|
||||
return myElements.size();
|
||||
|
||||
int nbElems = 0;
|
||||
#ifndef WNT
|
||||
set<const SMESHDS_SubMesh*>::iterator it = mySubMeshes.begin();
|
||||
#else
|
||||
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
|
||||
#endif
|
||||
for ( ; it != mySubMeshes.end(); it++ )
|
||||
nbElems += (*it)->NbElements();
|
||||
|
||||
@ -109,11 +105,7 @@ int SMESHDS_SubMesh::NbNodes() const
|
||||
return myNodes.size();
|
||||
|
||||
int nbElems = 0;
|
||||
#ifndef WNT
|
||||
set<const SMESHDS_SubMesh*>::iterator it = mySubMeshes.begin();
|
||||
#else
|
||||
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
|
||||
#endif
|
||||
for ( ; it != mySubMeshes.end(); it++ )
|
||||
nbElems += (*it)->NbNodes();
|
||||
|
||||
@ -124,27 +116,14 @@ int SMESHDS_SubMesh::NbNodes() const
|
||||
// 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;
|
||||
typename TSet::const_iterator myIt;
|
||||
TSet& mySet;
|
||||
|
||||
typedef SMDS_SetIterator<typename TSet::key_type, typename TSet::const_iterator > TFather;
|
||||
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() )
|
||||
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() )
|
||||
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();
|
||||
|
||||
private:
|
||||
//const SMDS_Mesh * myMesh;
|
||||
std::set<const SMDS_MeshElement*> myElements;
|
||||
std::set<const SMDS_MeshNode*> myNodes;
|
||||
struct TIDCompare { // to have nodes and elements sorted by ID
|
||||
bool operator () (const SMDS_MeshElement* e1, const SMDS_MeshElement* e2) const
|
||||
{ return e1->GetID() < e2->GetID(); }
|
||||
};
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user