mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-18 17:50:37 +05:00
0020978: EDF 1475 SMESH: Convert linear to quadratic on a submesh
fix the problem with adding elements (elements are not added) after {elems removal + addition of elements with specified IDs}: 1) add elems with IDs 1,2,3 2) remove elem 1 (1 stored in the pool ) 3) add elem with id 1 (1 remains in the pool) 4) add elem with no id specified -> not added as GetFreeID() returns 1 which is already occupied + virtual int GetFreeID();
This commit is contained in:
parent
fcae5eda64
commit
098d6b0723
@ -126,6 +126,20 @@ SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID)
|
|||||||
return (SMDS_MeshElement*)(elem);
|
return (SMDS_MeshElement*)(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : GetFreeID
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
int SMDS_MeshElementIDFactory::GetFreeID()
|
||||||
|
{
|
||||||
|
int ID;
|
||||||
|
do {
|
||||||
|
ID = SMDS_MeshIDFactory::GetFreeID();
|
||||||
|
} while ( MeshElement( ID ));
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ReleaseID
|
//function : ReleaseID
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -45,6 +45,7 @@ public:
|
|||||||
bool BindID(int ID, SMDS_MeshElement * elem);
|
bool BindID(int ID, SMDS_MeshElement * elem);
|
||||||
int SetInVtkGrid(SMDS_MeshElement * elem);
|
int SetInVtkGrid(SMDS_MeshElement * elem);
|
||||||
SMDS_MeshElement * MeshElement(int ID);
|
SMDS_MeshElement * MeshElement(int ID);
|
||||||
|
virtual int GetFreeID();
|
||||||
virtual void ReleaseID(int ID, int vtkId = -1);
|
virtual void ReleaseID(int ID, int vtkId = -1);
|
||||||
SMDS_ElemIteratorPtr elementsIterator() const;
|
SMDS_ElemIteratorPtr elementsIterator() const;
|
||||||
virtual void Clear();
|
virtual void Clear();
|
||||||
|
@ -62,12 +62,26 @@ bool SMDS_MeshNodeIDFactory::BindID(int ID, SMDS_MeshElement * elem)
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
SMDS_MeshElement* SMDS_MeshNodeIDFactory::MeshElement(int ID)
|
SMDS_MeshElement* SMDS_MeshNodeIDFactory::MeshElement(int ID)
|
||||||
{
|
{
|
||||||
if ((ID < 1) || (ID > myMax))
|
// commented since myMax can be 0 after ReleaseID()
|
||||||
return NULL;
|
// if ((ID < 1) || (ID > myMax))
|
||||||
|
// return NULL;
|
||||||
const SMDS_MeshElement* elem = GetMesh()->FindNode(ID);
|
const SMDS_MeshElement* elem = GetMesh()->FindNode(ID);
|
||||||
return (SMDS_MeshElement*) (elem);
|
return (SMDS_MeshElement*) (elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : GetFreeID
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
int SMDS_MeshNodeIDFactory::GetFreeID()
|
||||||
|
{
|
||||||
|
int ID;
|
||||||
|
do {
|
||||||
|
ID = SMDS_MeshIDFactory::GetFreeID();
|
||||||
|
} while ( MeshElement( ID ));
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ReleaseID
|
//function : ReleaseID
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -41,6 +41,7 @@ public:
|
|||||||
SMDS_MeshNodeIDFactory();
|
SMDS_MeshNodeIDFactory();
|
||||||
bool BindID(int ID, SMDS_MeshElement * elem);
|
bool BindID(int ID, SMDS_MeshElement * elem);
|
||||||
SMDS_MeshElement * MeshElement(int ID);
|
SMDS_MeshElement * MeshElement(int ID);
|
||||||
|
virtual int GetFreeID();
|
||||||
virtual void ReleaseID(int ID, int vtkId = -1);
|
virtual void ReleaseID(int ID, int vtkId = -1);
|
||||||
int GetMaxID() const;
|
int GetMaxID() const;
|
||||||
int GetMinID() const;
|
int GetMinID() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user