Bug 0020403: Clear mesh data doen't 'free' the memory.

This commit is contained in:
jfa 2009-08-27 06:22:59 +00:00
parent df30a6d6f6
commit 874fdebf62

View File

@ -1891,7 +1891,6 @@ void SMDS_Mesh::DebugStats() const
const SMDS_MeshElement *me = it->next(); const SMDS_MeshElement *me = it->next();
sizeofnodes += sizeof(me); sizeofnodes += sizeof(me);
} }
} }
SMDS_FaceIteratorPtr itface=facesIterator(); SMDS_FaceIteratorPtr itface=facesIterator();
@ -1899,8 +1898,8 @@ void SMDS_Mesh::DebugStats() const
{ {
const SMDS_MeshElement *face = itface->next(); const SMDS_MeshElement *face = itface->next();
sizeoffaces += sizeof(*face); sizeoffaces += sizeof(*face);
} }
MESSAGE("total size of node elements = " << sizeofnodes);; MESSAGE("total size of node elements = " << sizeofnodes);;
MESSAGE("total size of face elements = " << sizeoffaces);; MESSAGE("total size of face elements = " << sizeoffaces);;
@ -2038,6 +2037,7 @@ void SMDS_Mesh::Clear()
myNodeIDFactory->Clear(); myNodeIDFactory->Clear();
myElementIDFactory->Clear(); myElementIDFactory->Clear();
} }
SMDS_VolumeIteratorPtr itv = volumesIterator(); SMDS_VolumeIteratorPtr itv = volumesIterator();
while (itv->more()) while (itv->more())
delete itv->next(); delete itv->next();
@ -2129,33 +2129,6 @@ void SMDS_Mesh::setInverseElements(bool b)
myHasInverseElements=b; myHasInverseElements=b;
} }
///////////////////////////////////////////////////////////////////////////////
/// Return an iterator on nodes of the current mesh factory
///////////////////////////////////////////////////////////////////////////////
class SMDS_Mesh_MyNodeIterator:public SMDS_NodeIterator
{
SMDS_ElemIteratorPtr myIterator;
public:
SMDS_Mesh_MyNodeIterator(const SMDS_ElemIteratorPtr& it):myIterator(it)
{}
bool more()
{
return myIterator->more();
}
const SMDS_MeshNode* next()
{
return static_cast<const SMDS_MeshNode*>(myIterator->next());
}
};
SMDS_NodeIteratorPtr SMDS_Mesh::nodesIterator() const
{
return SMDS_NodeIteratorPtr
(new SMDS_Mesh_MyNodeIterator(myNodeIDFactory->elementsIterator()));
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
///Iterator on NCollection_Map ///Iterator on NCollection_Map
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -2185,6 +2158,19 @@ struct MYNCollection_Map_Iterator: public FATHER
} }
}; };
///////////////////////////////////////////////////////////////////////////////
/// Return an iterator on nodes of the current mesh factory
///////////////////////////////////////////////////////////////////////////////
SMDS_NodeIteratorPtr SMDS_Mesh::nodesIterator() const
{
//return SMDS_NodeIteratorPtr
// (new SMDS_Mesh_MyNodeIterator(myNodeIDFactory->elementsIterator()));
typedef MYNCollection_Map_Iterator
< SetOfNodes, const SMDS_MeshNode*, SMDS_NodeIterator > TIterator;
return SMDS_NodeIteratorPtr(new TIterator(myNodes));
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
///Return an iterator on 0D elements of the current mesh. ///Return an iterator on 0D elements of the current mesh.
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////