-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
MESSAGE("Internal Error: This should not happen");
break;
case SMDSAbs_0DElement:
+ case SMDSAbs_Ball:
{
}
break;
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
}
}
+ case SMDSAbs_NbElementTypes:
case SMDSAbs_All: break;
}
}
list<const SMDS_MeshElement *>& removedNodes,
bool removenodes)
{
- //MESSAGE("SMDS_Mesh::RemoveElement " << elem->getVtkId() << " " << removenodes);
// get finite elements built on elem
set<const SMDS_MeshElement*> * s1;
if ( (elem->GetType() == SMDSAbs_0DElement)
// Remove element from <InverseElements> of its nodes
SMDS_ElemIteratorPtr itn = (*it)->nodesIterator();
while (itn->more())
- {
- SMDS_MeshNode * n = static_cast<SMDS_MeshNode *> (const_cast<SMDS_MeshElement *> (itn->next()));
- n->RemoveInverseElement((*it));
- }
+ {
+ SMDS_MeshNode * n = static_cast<SMDS_MeshNode *> (const_cast<SMDS_MeshElement *> (itn->next()));
+ n->RemoveInverseElement((*it));
+ }
int IdToRemove = (*it)->GetID();
int vtkid = (*it)->getVtkId();
- //MESSAGE("elem Id to remove " << IdToRemove << " vtkid " << vtkid <<
- // " vtktype " << (*it)->GetVtkType() << " type " << (*it)->GetType());
switch ((*it)->GetType())
{
case SMDSAbs_Node:
- MYASSERT("Internal Error: This should not happen")
- ;
+ MYASSERT("Internal Error: This should not happen");
break;
case SMDSAbs_0DElement:
if (IdToRemove >= 0)
myElementIDFactory->ReleaseID(IdToRemove, vtkid);
if (const SMDS_VtkEdge* vtkElem = dynamic_cast<const SMDS_VtkEdge*>(*it))
myEdgePool->destroy((SMDS_VtkEdge*) vtkElem);
- else
+ else {
+ ((SMDS_MeshElement*) *it)->init( -1, -1, -1 ); // avoid reuse
delete (*it);
+ }
break;
case SMDSAbs_Face:
if (IdToRemove >= 0)
myElementIDFactory->ReleaseID(IdToRemove, vtkid);
if (const SMDS_VtkFace* vtkElem = dynamic_cast<const SMDS_VtkFace*>(*it))
myFacePool->destroy((SMDS_VtkFace*) vtkElem);
- else
+ else {
+ ((SMDS_MeshElement*) *it)->init( -1, -1, -1 ); // avoid reuse
delete (*it);
+ }
break;
case SMDSAbs_Volume:
if (IdToRemove >= 0)
myElementIDFactory->ReleaseID(IdToRemove, vtkid);
if (const SMDS_VtkVolume* vtkElem = dynamic_cast<const SMDS_VtkVolume*>(*it))
myVolumePool->destroy((SMDS_VtkVolume*) vtkElem);
- else
+ else {
+ ((SMDS_MeshElement*) *it)->init( -1, -1, -1 ); // avoid reuse
delete (*it);
+ }
break;
case SMDSAbs_Ball:
if (IdToRemove >= 0)
myElementIDFactory->ReleaseID(IdToRemove, vtkid);
if (const SMDS_BallElement* vtkElem = dynamic_cast<const SMDS_BallElement*>(*it))
myBallPool->destroy(const_cast<SMDS_BallElement*>( vtkElem ));
- else
+ else {
+ ((SMDS_MeshElement*) *it)->init( -1, -1, -1 ); // avoid reuse
delete (*it);
+ }
break;
- case SMDSAbs_All:
+ case SMDSAbs_All: // avoid compilation warning
case SMDSAbs_NbElementTypes: break;
}
if (vtkid >= 0)
- {
- //MESSAGE("VTK_EMPTY_CELL in " << vtkid);
- this->myGrid->GetCellTypesArray()->SetValue(vtkid, VTK_EMPTY_CELL);
- }
+ {
+ this->myGrid->GetCellTypesArray()->SetValue(vtkid, VTK_EMPTY_CELL);
+ }
it++;
}
// remove exclusive (free) nodes
if (removenodes)
+ {
+ it = s2->begin();
+ while (it != s2->end())
{
- it = s2->begin();
- while (it != s2->end())
- {
- int IdToRemove = (*it)->GetID();
- //MESSAGE( "SMDS: RM node " << IdToRemove);
- if (IdToRemove >= 0)
- {
- myNodes[IdToRemove] = 0;
- myInfo.myNbNodes--;
- }
- 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++;
- }
+ int IdToRemove = (*it)->GetID();
+ if (IdToRemove >= 0)
+ {
+ myNodes[IdToRemove] = 0;
+ myInfo.myNbNodes--;
+ }
+ 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++;
}
+ }
delete s2;
delete s1;
}
// in meshes without descendants elements are always free
- switch (aType) {
+ switch (aType) {
case SMDSAbs_0DElement:
myCells[elemId] = 0;
myInfo.remove(elem);
delete elem;
+ elem = 0;
break;
case SMDSAbs_Edge:
myCells[elemId] = 0;
this->myGrid->GetCellTypesArray()->SetValue(vtkId, VTK_EMPTY_CELL);
// --- to do: keep vtkid in a list of reusable cells
+
+ if ( elem )
+ ((SMDS_MeshElement*) elem)->init( -1, -1, -1 ); // avoid reuse
}
}