mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-30 02:20:34 +05:00
delete node positions at node removal
This commit is contained in:
parent
0c1947cfe5
commit
6e58f2fb40
@ -223,10 +223,6 @@ SMDS_MeshNode * SMDS_Mesh::AddNodeWithID(double x, double y, double z, int ID)
|
||||
SMDS_MeshNode * node = myNodePool->getNew();
|
||||
node->init(ID, myMeshId, 0, x, y, z);
|
||||
|
||||
//rnv: Set SMDS_SpacePosition for node if need
|
||||
if( node->GetPosition()->GetTypeOfPosition() != SMDS_TOP_3DSPACE)
|
||||
node->SetPosition(SMDS_SpacePosition::originSpacePosition());
|
||||
|
||||
if (ID >= myNodes.size())
|
||||
{
|
||||
myNodes.resize(ID+SMDS_Mesh::chunkSize, 0);
|
||||
@ -2395,6 +2391,7 @@ SMDS_Mesh::~SMDS_Mesh()
|
||||
while (itn->more())
|
||||
{
|
||||
const SMDS_MeshNode *node = itn->next();
|
||||
((SMDS_MeshNode*)node)->SetPosition(SMDS_SpacePosition::originSpacePosition());
|
||||
myNodeIDFactory->ReleaseID(node->GetID(), node->getVtkId());
|
||||
}
|
||||
}
|
||||
@ -2493,6 +2490,7 @@ void SMDS_Mesh::Clear()
|
||||
while (itn->more())
|
||||
{
|
||||
SMDS_MeshNode *node = (SMDS_MeshNode*)(itn->next());
|
||||
node->SetPosition(SMDS_SpacePosition::originSpacePosition());
|
||||
myNodePool->destroy(node);
|
||||
}
|
||||
myNodes.clear();
|
||||
@ -3129,7 +3127,10 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
|
||||
myNodeIDFactory->ReleaseID((*it)->GetID(), (*it)->getVtkId());
|
||||
removedNodes.push_back((*it));
|
||||
if (const SMDS_MeshNode* vtkElem = dynamic_cast<const SMDS_MeshNode*>(*it))
|
||||
{
|
||||
((SMDS_MeshNode*)vtkElem)->SetPosition(SMDS_SpacePosition::originSpacePosition());
|
||||
myNodePool->destroy((SMDS_MeshNode*) vtkElem);
|
||||
}
|
||||
else
|
||||
delete (*it);
|
||||
it++;
|
||||
@ -3159,6 +3160,7 @@ void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
|
||||
if (!itFe->more()) { // free node
|
||||
myNodes[elemId] = 0;
|
||||
myInfo.myNbNodes--;
|
||||
((SMDS_MeshNode*) n)->SetPosition(SMDS_SpacePosition::originSpacePosition());
|
||||
myNodePool->destroy(static_cast<SMDS_MeshNode*>(todest));
|
||||
myNodeIDFactory->ReleaseID(elemId, vtkId);
|
||||
}
|
||||
|
@ -78,6 +78,8 @@ void SMDS_MeshNode::init(int id, int meshId, int shapeId, double x, double y, do
|
||||
SMDS_MeshNode::~SMDS_MeshNode()
|
||||
{
|
||||
nbNodes--;
|
||||
if ( myPosition && myPosition != SMDS_SpacePosition::originSpacePosition() )
|
||||
delete myPosition, myPosition = 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -111,6 +113,8 @@ void SMDS_MeshNode::Print(ostream & OS) const
|
||||
|
||||
void SMDS_MeshNode::SetPosition(const SMDS_PositionPtr& aPos)
|
||||
{
|
||||
if ( myPosition && myPosition != aPos )
|
||||
delete myPosition;
|
||||
myPosition = aPos;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user