mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-12 01:30:34 +05:00
Bug 0020403: Clear mesh data doen't 'free' the memory.
This commit is contained in:
parent
df30a6d6f6
commit
874fdebf62
@ -103,11 +103,11 @@ int SMDS_Mesh::CheckMemory(const bool doNotRaise) throw (std::bad_alloc)
|
||||
/// Create a new mesh object
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
SMDS_Mesh::SMDS_Mesh()
|
||||
:myParent(NULL),
|
||||
:myParent(NULL),
|
||||
myNodeIDFactory(new SMDS_MeshElementIDFactory()),
|
||||
myElementIDFactory(new SMDS_MeshElementIDFactory()),
|
||||
myHasConstructionEdges(false), myHasConstructionFaces(false),
|
||||
myHasInverseElements(true)
|
||||
myElementIDFactory(new SMDS_MeshElementIDFactory()),
|
||||
myHasConstructionEdges(false), myHasConstructionFaces(false),
|
||||
myHasInverseElements(true)
|
||||
{
|
||||
}
|
||||
|
||||
@ -117,10 +117,10 @@ SMDS_Mesh::SMDS_Mesh()
|
||||
/// (2003-09-08) of SMESH
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
SMDS_Mesh::SMDS_Mesh(SMDS_Mesh * parent)
|
||||
:myParent(parent), myNodeIDFactory(parent->myNodeIDFactory),
|
||||
myElementIDFactory(parent->myElementIDFactory),
|
||||
myHasConstructionEdges(false), myHasConstructionFaces(false),
|
||||
myHasInverseElements(true)
|
||||
:myParent(parent), myNodeIDFactory(parent->myNodeIDFactory),
|
||||
myElementIDFactory(parent->myElementIDFactory),
|
||||
myHasConstructionEdges(false), myHasConstructionFaces(false),
|
||||
myHasInverseElements(true)
|
||||
{
|
||||
}
|
||||
|
||||
@ -130,9 +130,9 @@ SMDS_Mesh::SMDS_Mesh(SMDS_Mesh * parent)
|
||||
|
||||
SMDS_Mesh *SMDS_Mesh::AddSubMesh()
|
||||
{
|
||||
SMDS_Mesh *submesh = new SMDS_Mesh(this);
|
||||
myChildren.insert(myChildren.end(), submesh);
|
||||
return submesh;
|
||||
SMDS_Mesh *submesh = new SMDS_Mesh(this);
|
||||
myChildren.insert(myChildren.end(), submesh);
|
||||
return submesh;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -231,7 +231,7 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int idnode1, int idnode2, int ID)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshEdge* SMDS_Mesh::AddEdge(const SMDS_MeshNode * node1,
|
||||
const SMDS_MeshNode * node2)
|
||||
const SMDS_MeshNode * node2)
|
||||
{
|
||||
return SMDS_Mesh::AddEdgeWithID(node1, node2, myElementIDFactory->GetFreeID());
|
||||
}
|
||||
@ -246,8 +246,8 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdge(const SMDS_MeshNode * node1,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
int ID)
|
||||
const SMDS_MeshNode * n2,
|
||||
int ID)
|
||||
{
|
||||
if ( !n1 || !n2 ) return 0;
|
||||
|
||||
@ -276,8 +276,8 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3)
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3)
|
||||
{
|
||||
return SMDS_Mesh::AddFaceWithID(n1,n2,n3, myElementIDFactory->GetFreeID());
|
||||
}
|
||||
@ -319,9 +319,9 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4)
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4)
|
||||
{
|
||||
return SMDS_Mesh::AddFaceWithID(n1,n2,n3, n4, myElementIDFactory->GetFreeID());
|
||||
}
|
||||
@ -331,10 +331,10 @@ SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int idnode1,
|
||||
int idnode2,
|
||||
int idnode3,
|
||||
int idnode4,
|
||||
int ID)
|
||||
int idnode2,
|
||||
int idnode3,
|
||||
int idnode4,
|
||||
int ID)
|
||||
{
|
||||
SMDS_MeshNode *node1, *node2, *node3, *node4;
|
||||
node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
|
||||
@ -451,9 +451,9 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshEdge * e1,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4)
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4)
|
||||
{
|
||||
int ID = myElementIDFactory->GetFreeID();
|
||||
SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, ID);
|
||||
@ -469,10 +469,10 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
|
||||
int idnode2,
|
||||
int idnode3,
|
||||
int idnode4,
|
||||
int ID)
|
||||
int idnode2,
|
||||
int idnode3,
|
||||
int idnode4,
|
||||
int ID)
|
||||
{
|
||||
SMDS_MeshNode *node1, *node2, *node3, *node4;
|
||||
node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
|
||||
@ -531,10 +531,10 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n5)
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n5)
|
||||
{
|
||||
int ID = myElementIDFactory->GetFreeID();
|
||||
SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, ID);
|
||||
@ -551,11 +551,11 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
|
||||
int idnode2,
|
||||
int idnode3,
|
||||
int idnode4,
|
||||
int idnode5,
|
||||
int ID)
|
||||
int idnode2,
|
||||
int idnode3,
|
||||
int idnode4,
|
||||
int idnode5,
|
||||
int ID)
|
||||
{
|
||||
SMDS_MeshNode *node1, *node2, *node3, *node4, *node5;
|
||||
node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
|
||||
@ -617,11 +617,11 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n5,
|
||||
const SMDS_MeshNode * n6)
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n5,
|
||||
const SMDS_MeshNode * n6)
|
||||
{
|
||||
int ID = myElementIDFactory->GetFreeID();
|
||||
SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, ID);
|
||||
@ -638,12 +638,12 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
|
||||
int idnode2,
|
||||
int idnode3,
|
||||
int idnode4,
|
||||
int idnode5,
|
||||
int idnode6,
|
||||
int ID)
|
||||
int idnode2,
|
||||
int idnode3,
|
||||
int idnode4,
|
||||
int idnode5,
|
||||
int idnode6,
|
||||
int ID)
|
||||
{
|
||||
SMDS_MeshNode *node1, *node2, *node3, *node4, *node5, *node6;
|
||||
node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
|
||||
@ -708,13 +708,13 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n5,
|
||||
const SMDS_MeshNode * n6,
|
||||
const SMDS_MeshNode * n7,
|
||||
const SMDS_MeshNode * n8)
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n5,
|
||||
const SMDS_MeshNode * n6,
|
||||
const SMDS_MeshNode * n7,
|
||||
const SMDS_MeshNode * n8)
|
||||
{
|
||||
int ID = myElementIDFactory->GetFreeID();
|
||||
SMDS_MeshVolume * v = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, n7, n8, ID);
|
||||
@ -731,14 +731,14 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SMDS_MeshVolume * SMDS_Mesh::AddVolumeWithID(int idnode1,
|
||||
int idnode2,
|
||||
int idnode3,
|
||||
int idnode4,
|
||||
int idnode5,
|
||||
int idnode6,
|
||||
int idnode7,
|
||||
int idnode8,
|
||||
int ID)
|
||||
int idnode2,
|
||||
int idnode3,
|
||||
int idnode4,
|
||||
int idnode5,
|
||||
int idnode6,
|
||||
int idnode7,
|
||||
int idnode8,
|
||||
int ID)
|
||||
{
|
||||
SMDS_MeshNode *node1, *node2, *node3, *node4, *node5, *node6, *node7, *node8;
|
||||
node1 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode1);
|
||||
@ -1126,9 +1126,9 @@ SMDS_MeshFace * SMDS_Mesh::createTriangle(const SMDS_MeshNode * node1,
|
||||
///a ID to the create triangle.
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
SMDS_MeshFace * SMDS_Mesh::createQuadrangle(const SMDS_MeshNode * node1,
|
||||
const SMDS_MeshNode * node2,
|
||||
const SMDS_MeshNode * node3,
|
||||
const SMDS_MeshNode * node4)
|
||||
const SMDS_MeshNode * node2,
|
||||
const SMDS_MeshNode * node3,
|
||||
const SMDS_MeshNode * node4)
|
||||
{
|
||||
if ( !node1 || !node2 || !node3 || !node4 ) return 0;
|
||||
if ( myFaces.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
|
||||
@ -1160,7 +1160,7 @@ SMDS_MeshFace * SMDS_Mesh::createQuadrangle(const SMDS_MeshNode * node1,
|
||||
|
||||
void SMDS_Mesh::RemoveNode(const SMDS_MeshNode * node)
|
||||
{
|
||||
RemoveElement(node, true);
|
||||
RemoveElement(node, true);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -1178,7 +1178,7 @@ void SMDS_Mesh::Remove0DElement(const SMDS_Mesh0DElement * elem0d)
|
||||
|
||||
void SMDS_Mesh::RemoveEdge(const SMDS_MeshEdge * edge)
|
||||
{
|
||||
RemoveElement(edge,true);
|
||||
RemoveElement(edge,true);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -1187,7 +1187,7 @@ void SMDS_Mesh::RemoveEdge(const SMDS_MeshEdge * edge)
|
||||
|
||||
void SMDS_Mesh::RemoveFace(const SMDS_MeshFace * face)
|
||||
{
|
||||
RemoveElement(face, true);
|
||||
RemoveElement(face, true);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -1196,7 +1196,7 @@ void SMDS_Mesh::RemoveFace(const SMDS_MeshFace * face)
|
||||
|
||||
void SMDS_Mesh::RemoveVolume(const SMDS_MeshVolume * volume)
|
||||
{
|
||||
RemoveElement(volume, true);
|
||||
RemoveElement(volume, true);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -1206,8 +1206,8 @@ void SMDS_Mesh::RemoveVolume(const SMDS_MeshVolume * volume)
|
||||
|
||||
bool SMDS_Mesh::RemoveFromParent()
|
||||
{
|
||||
if (myParent==NULL) return false;
|
||||
else return (myParent->RemoveSubMesh(this));
|
||||
if (myParent==NULL) return false;
|
||||
else return (myParent->RemoveSubMesh(this));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -1217,20 +1217,20 @@ bool SMDS_Mesh::RemoveFromParent()
|
||||
|
||||
bool SMDS_Mesh::RemoveSubMesh(const SMDS_Mesh * aMesh)
|
||||
{
|
||||
bool found = false;
|
||||
bool found = false;
|
||||
|
||||
list<SMDS_Mesh *>::iterator itmsh=myChildren.begin();
|
||||
for (; itmsh!=myChildren.end() && !found; itmsh++)
|
||||
{
|
||||
SMDS_Mesh * submesh = *itmsh;
|
||||
if (submesh == aMesh)
|
||||
{
|
||||
found = true;
|
||||
myChildren.erase(itmsh);
|
||||
}
|
||||
}
|
||||
list<SMDS_Mesh *>::iterator itmsh=myChildren.begin();
|
||||
for (; itmsh!=myChildren.end() && !found; itmsh++)
|
||||
{
|
||||
SMDS_Mesh * submesh = *itmsh;
|
||||
if (submesh == aMesh)
|
||||
{
|
||||
found = true;
|
||||
myChildren.erase(itmsh);
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
return found;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -1531,7 +1531,7 @@ const SMDS_MeshEdge* SMDS_Mesh::FindEdge(const SMDS_MeshNode * node1,
|
||||
//=======================================================================
|
||||
|
||||
const SMDS_MeshFace* SMDS_Mesh::FindFace(int idnode1, int idnode2,
|
||||
int idnode3) const
|
||||
int idnode3) const
|
||||
{
|
||||
const SMDS_MeshNode * node1=FindNode(idnode1);
|
||||
const SMDS_MeshNode * node2=FindNode(idnode2);
|
||||
@ -1804,9 +1804,9 @@ const SMDS_MeshFace* SMDS_Mesh::FindFace (std::vector<const SMDS_MeshNode *> nod
|
||||
|
||||
void SMDS_Mesh::DumpNodes() const
|
||||
{
|
||||
MESSAGE("dump nodes of mesh : ");
|
||||
SMDS_NodeIteratorPtr itnode=nodesIterator();
|
||||
while(itnode->more()) MESSAGE(itnode->next());
|
||||
MESSAGE("dump nodes of mesh : ");
|
||||
SMDS_NodeIteratorPtr itnode=nodesIterator();
|
||||
while(itnode->more()) MESSAGE(itnode->next());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -1827,9 +1827,9 @@ void SMDS_Mesh::Dump0DElements() const
|
||||
|
||||
void SMDS_Mesh::DumpEdges() const
|
||||
{
|
||||
MESSAGE("dump edges of mesh : ");
|
||||
SMDS_EdgeIteratorPtr itedge=edgesIterator();
|
||||
while(itedge->more()) MESSAGE(itedge->next());
|
||||
MESSAGE("dump edges of mesh : ");
|
||||
SMDS_EdgeIteratorPtr itedge=edgesIterator();
|
||||
while(itedge->more()) MESSAGE(itedge->next());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -1839,9 +1839,9 @@ void SMDS_Mesh::DumpEdges() const
|
||||
|
||||
void SMDS_Mesh::DumpFaces() const
|
||||
{
|
||||
MESSAGE("dump faces of mesh : ");
|
||||
SMDS_FaceIteratorPtr itface=facesIterator();
|
||||
while(itface->more()) MESSAGE(itface->next());
|
||||
MESSAGE("dump faces of mesh : ");
|
||||
SMDS_FaceIteratorPtr itface=facesIterator();
|
||||
while(itface->more()) MESSAGE(itface->next());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -1851,9 +1851,9 @@ void SMDS_Mesh::DumpFaces() const
|
||||
|
||||
void SMDS_Mesh::DumpVolumes() const
|
||||
{
|
||||
MESSAGE("dump volumes of mesh : ");
|
||||
SMDS_VolumeIteratorPtr itvol=volumesIterator();
|
||||
while(itvol->more()) MESSAGE(itvol->next());
|
||||
MESSAGE("dump volumes of mesh : ");
|
||||
SMDS_VolumeIteratorPtr itvol=volumesIterator();
|
||||
while(itvol->more()) MESSAGE(itvol->next());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@ -1863,48 +1863,47 @@ void SMDS_Mesh::DumpVolumes() const
|
||||
|
||||
void SMDS_Mesh::DebugStats() const
|
||||
{
|
||||
MESSAGE("Debug stats of mesh : ");
|
||||
MESSAGE("Debug stats of mesh : ");
|
||||
|
||||
MESSAGE("===== NODES ====="<<NbNodes());
|
||||
MESSAGE("===== 0DELEMS ====="<<Nb0DElements());
|
||||
MESSAGE("===== EDGES ====="<<NbEdges());
|
||||
MESSAGE("===== FACES ====="<<NbFaces());
|
||||
MESSAGE("===== VOLUMES ====="<<NbVolumes());
|
||||
MESSAGE("===== NODES ====="<<NbNodes());
|
||||
MESSAGE("===== 0DELEMS ====="<<Nb0DElements());
|
||||
MESSAGE("===== EDGES ====="<<NbEdges());
|
||||
MESSAGE("===== FACES ====="<<NbFaces());
|
||||
MESSAGE("===== VOLUMES ====="<<NbVolumes());
|
||||
|
||||
MESSAGE("End Debug stats of mesh ");
|
||||
MESSAGE("End Debug stats of mesh ");
|
||||
|
||||
//#ifdef DEB
|
||||
//#ifdef DEB
|
||||
|
||||
SMDS_NodeIteratorPtr itnode=nodesIterator();
|
||||
int sizeofnodes = 0;
|
||||
int sizeoffaces = 0;
|
||||
SMDS_NodeIteratorPtr itnode=nodesIterator();
|
||||
int sizeofnodes = 0;
|
||||
int sizeoffaces = 0;
|
||||
|
||||
while(itnode->more())
|
||||
{
|
||||
const SMDS_MeshNode *node = itnode->next();
|
||||
while(itnode->more())
|
||||
{
|
||||
const SMDS_MeshNode *node = itnode->next();
|
||||
|
||||
sizeofnodes += sizeof(*node);
|
||||
sizeofnodes += sizeof(*node);
|
||||
|
||||
SMDS_ElemIteratorPtr it = node->GetInverseElementIterator();
|
||||
while(it->more())
|
||||
{
|
||||
const SMDS_MeshElement *me = it->next();
|
||||
sizeofnodes += sizeof(me);
|
||||
}
|
||||
SMDS_ElemIteratorPtr it = node->GetInverseElementIterator();
|
||||
while(it->more())
|
||||
{
|
||||
const SMDS_MeshElement *me = it->next();
|
||||
sizeofnodes += sizeof(me);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
SMDS_FaceIteratorPtr itface=facesIterator();
|
||||
while(itface->more())
|
||||
{
|
||||
const SMDS_MeshElement *face = itface->next();
|
||||
sizeoffaces += sizeof(*face);
|
||||
}
|
||||
|
||||
SMDS_FaceIteratorPtr itface=facesIterator();
|
||||
while(itface->more())
|
||||
{
|
||||
const SMDS_MeshElement *face = itface->next();
|
||||
sizeoffaces += sizeof(*face);
|
||||
MESSAGE("total size of node elements = " << sizeofnodes);;
|
||||
MESSAGE("total size of face elements = " << sizeoffaces);;
|
||||
|
||||
}
|
||||
MESSAGE("total size of node elements = " << sizeofnodes);;
|
||||
MESSAGE("total size of face elements = " << sizeoffaces);;
|
||||
|
||||
//#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -1912,7 +1911,7 @@ void SMDS_Mesh::DebugStats() const
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int SMDS_Mesh::NbNodes() const
|
||||
{
|
||||
return myNodes.Size();
|
||||
return myNodes.Size();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -1928,7 +1927,7 @@ int SMDS_Mesh::Nb0DElements() const
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int SMDS_Mesh::NbEdges() const
|
||||
{
|
||||
return myEdges.Size();
|
||||
return myEdges.Size();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -1936,7 +1935,7 @@ int SMDS_Mesh::NbEdges() const
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int SMDS_Mesh::NbFaces() const
|
||||
{
|
||||
return myFaces.Size();
|
||||
return myFaces.Size();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -1944,7 +1943,7 @@ int SMDS_Mesh::NbFaces() const
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int SMDS_Mesh::NbVolumes() const
|
||||
{
|
||||
return myVolumes.Size();
|
||||
return myVolumes.Size();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -1954,7 +1953,7 @@ int SMDS_Mesh::NbVolumes() const
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
int SMDS_Mesh::NbSubMesh() const
|
||||
{
|
||||
return myChildren.size();
|
||||
return myChildren.size();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -2038,6 +2037,7 @@ void SMDS_Mesh::Clear()
|
||||
myNodeIDFactory->Clear();
|
||||
myElementIDFactory->Clear();
|
||||
}
|
||||
|
||||
SMDS_VolumeIteratorPtr itv = volumesIterator();
|
||||
while (itv->more())
|
||||
delete itv->next();
|
||||
@ -2077,7 +2077,7 @@ void SMDS_Mesh::Clear()
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
bool SMDS_Mesh::hasConstructionEdges()
|
||||
{
|
||||
return myHasConstructionEdges;
|
||||
return myHasConstructionEdges;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -2089,7 +2089,7 @@ bool SMDS_Mesh::hasConstructionEdges()
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
bool SMDS_Mesh::hasConstructionFaces()
|
||||
{
|
||||
return myHasConstructionFaces;
|
||||
return myHasConstructionFaces;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -2098,7 +2098,7 @@ bool SMDS_Mesh::hasConstructionFaces()
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
bool SMDS_Mesh::hasInverseElements()
|
||||
{
|
||||
return myHasInverseElements;
|
||||
return myHasInverseElements;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -2107,7 +2107,7 @@ bool SMDS_Mesh::hasInverseElements()
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void SMDS_Mesh::setConstructionEdges(bool b)
|
||||
{
|
||||
myHasConstructionEdges=b;
|
||||
myHasConstructionEdges=b;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -2116,7 +2116,7 @@ void SMDS_Mesh::setConstructionEdges(bool b)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void SMDS_Mesh::setConstructionFaces(bool b)
|
||||
{
|
||||
myHasConstructionFaces=b;
|
||||
myHasConstructionFaces=b;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -2125,35 +2125,8 @@ void SMDS_Mesh::setConstructionFaces(bool b)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void SMDS_Mesh::setInverseElements(bool b)
|
||||
{
|
||||
if(!b) MESSAGE("Error : inverseElement=false not implemented");
|
||||
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()));
|
||||
if(!b) MESSAGE("Error : inverseElement=false not implemented");
|
||||
myHasInverseElements=b;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -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.
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -2256,22 +2242,22 @@ SMDS_ElemIteratorPtr SMDS_Mesh::elementsIterator(SMDSAbs_ElementType type) const
|
||||
/// Do intersection of sets (more than 2)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static set<const SMDS_MeshElement*> * intersectionOfSets(
|
||||
set<const SMDS_MeshElement*> vs[], int numberOfSets)
|
||||
set<const SMDS_MeshElement*> vs[], int numberOfSets)
|
||||
{
|
||||
set<const SMDS_MeshElement*>* rsetA=new set<const SMDS_MeshElement*>(vs[0]);
|
||||
set<const SMDS_MeshElement*>* rsetB;
|
||||
set<const SMDS_MeshElement*>* rsetA=new set<const SMDS_MeshElement*>(vs[0]);
|
||||
set<const SMDS_MeshElement*>* rsetB;
|
||||
|
||||
for(int i=0; i<numberOfSets-1; i++)
|
||||
{
|
||||
rsetB=new set<const SMDS_MeshElement*>();
|
||||
set_intersection(
|
||||
rsetA->begin(), rsetA->end(),
|
||||
vs[i+1].begin(), vs[i+1].end(),
|
||||
inserter(*rsetB, rsetB->begin()));
|
||||
delete rsetA;
|
||||
rsetA=rsetB;
|
||||
}
|
||||
return rsetA;
|
||||
for(int i=0; i<numberOfSets-1; i++)
|
||||
{
|
||||
rsetB=new set<const SMDS_MeshElement*>();
|
||||
set_intersection(
|
||||
rsetA->begin(), rsetA->end(),
|
||||
vs[i+1].begin(), vs[i+1].end(),
|
||||
inserter(*rsetB, rsetB->begin()));
|
||||
delete rsetA;
|
||||
rsetA=rsetB;
|
||||
}
|
||||
return rsetA;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -2279,53 +2265,53 @@ static set<const SMDS_MeshElement*> * intersectionOfSets(
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static set<const SMDS_MeshElement*> * getFinitElements(const SMDS_MeshElement * element)
|
||||
{
|
||||
int numberOfSets=element->NbNodes();
|
||||
set<const SMDS_MeshElement*> *initSet = new set<const SMDS_MeshElement*>[numberOfSets];
|
||||
int numberOfSets=element->NbNodes();
|
||||
set<const SMDS_MeshElement*> *initSet = new set<const SMDS_MeshElement*>[numberOfSets];
|
||||
|
||||
SMDS_ElemIteratorPtr itNodes=element->nodesIterator();
|
||||
SMDS_ElemIteratorPtr itNodes=element->nodesIterator();
|
||||
|
||||
int i=0;
|
||||
while(itNodes->more())
|
||||
{
|
||||
const SMDS_MeshNode * n=static_cast<const SMDS_MeshNode*>(itNodes->next());
|
||||
SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
|
||||
int i=0;
|
||||
while(itNodes->more())
|
||||
{
|
||||
const SMDS_MeshNode * n=static_cast<const SMDS_MeshNode*>(itNodes->next());
|
||||
SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
|
||||
|
||||
//initSet[i]=set<const SMDS_MeshElement*>();
|
||||
while(itFe->more())
|
||||
//initSet[i]=set<const SMDS_MeshElement*>();
|
||||
while(itFe->more())
|
||||
initSet[i].insert(itFe->next());
|
||||
|
||||
i++;
|
||||
}
|
||||
set<const SMDS_MeshElement*> *retSet=intersectionOfSets(initSet, numberOfSets);
|
||||
i++;
|
||||
}
|
||||
set<const SMDS_MeshElement*> *retSet=intersectionOfSets(initSet, numberOfSets);
|
||||
delete [] initSet;
|
||||
return retSet;
|
||||
return retSet;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Return the list of nodes used only by the given elements
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static set<const SMDS_MeshElement*> * getExclusiveNodes(
|
||||
set<const SMDS_MeshElement*>& elements)
|
||||
set<const SMDS_MeshElement*>& elements)
|
||||
{
|
||||
set<const SMDS_MeshElement*> * toReturn=new set<const SMDS_MeshElement*>();
|
||||
set<const SMDS_MeshElement*>::iterator itElements=elements.begin();
|
||||
set<const SMDS_MeshElement*> * toReturn=new set<const SMDS_MeshElement*>();
|
||||
set<const SMDS_MeshElement*>::iterator itElements=elements.begin();
|
||||
|
||||
while(itElements!=elements.end())
|
||||
{
|
||||
SMDS_ElemIteratorPtr itNodes = (*itElements)->nodesIterator();
|
||||
itElements++;
|
||||
while(itElements!=elements.end())
|
||||
{
|
||||
SMDS_ElemIteratorPtr itNodes = (*itElements)->nodesIterator();
|
||||
itElements++;
|
||||
|
||||
while(itNodes->more())
|
||||
{
|
||||
const SMDS_MeshNode * n=static_cast<const SMDS_MeshNode*>(itNodes->next());
|
||||
SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
|
||||
set<const SMDS_MeshElement*> s;
|
||||
while(itFe->more())
|
||||
while(itNodes->more())
|
||||
{
|
||||
const SMDS_MeshNode * n=static_cast<const SMDS_MeshNode*>(itNodes->next());
|
||||
SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
|
||||
set<const SMDS_MeshElement*> s;
|
||||
while(itFe->more())
|
||||
s.insert(itFe->next());
|
||||
if(s==elements) toReturn->insert(n);
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
if(s==elements) toReturn->insert(n);
|
||||
}
|
||||
}
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -2348,52 +2334,52 @@ void SMDS_Mesh::addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren
|
||||
}
|
||||
break;
|
||||
case SMDSAbs_Edge:
|
||||
{
|
||||
SMDS_ElemIteratorPtr itn=element->nodesIterator();
|
||||
while(itn->more())
|
||||
{
|
||||
const SMDS_MeshElement * e=itn->next();
|
||||
if(nodes.find(e)!=nodes.end())
|
||||
{
|
||||
SMDS_ElemIteratorPtr itn=element->nodesIterator();
|
||||
while(itn->more())
|
||||
{
|
||||
const SMDS_MeshElement * e=itn->next();
|
||||
if(nodes.find(e)!=nodes.end())
|
||||
{
|
||||
setOfChildren.insert(element);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
case SMDSAbs_Face:
|
||||
{
|
||||
SMDS_ElemIteratorPtr itn=element->nodesIterator();
|
||||
while(itn->more())
|
||||
{
|
||||
const SMDS_MeshElement * e=itn->next();
|
||||
if(nodes.find(e)!=nodes.end())
|
||||
{
|
||||
SMDS_ElemIteratorPtr itn=element->nodesIterator();
|
||||
while(itn->more())
|
||||
{
|
||||
const SMDS_MeshElement * e=itn->next();
|
||||
if(nodes.find(e)!=nodes.end())
|
||||
{
|
||||
setOfChildren.insert(element);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(hasConstructionEdges())
|
||||
{
|
||||
SMDS_ElemIteratorPtr ite=element->edgesIterator();
|
||||
while(ite->more())
|
||||
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
|
||||
}
|
||||
} break;
|
||||
}
|
||||
if(hasConstructionEdges())
|
||||
{
|
||||
SMDS_ElemIteratorPtr ite=element->edgesIterator();
|
||||
while(ite->more())
|
||||
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
|
||||
}
|
||||
} break;
|
||||
case SMDSAbs_Volume:
|
||||
{
|
||||
if(hasConstructionFaces())
|
||||
{
|
||||
SMDS_ElemIteratorPtr ite=element->facesIterator();
|
||||
while(ite->more())
|
||||
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
|
||||
}
|
||||
else if(hasConstructionEdges())
|
||||
{
|
||||
SMDS_ElemIteratorPtr ite=element->edgesIterator();
|
||||
while(ite->more())
|
||||
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
|
||||
}
|
||||
}
|
||||
{
|
||||
if(hasConstructionFaces())
|
||||
{
|
||||
SMDS_ElemIteratorPtr ite=element->facesIterator();
|
||||
while(ite->more())
|
||||
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
|
||||
}
|
||||
else if(hasConstructionEdges())
|
||||
{
|
||||
SMDS_ElemIteratorPtr ite=element->edgesIterator();
|
||||
while(ite->more())
|
||||
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2745,7 +2731,7 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int n1, int n2, int n12, int ID)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMDS_MeshEdge* SMDS_Mesh::AddEdge(const SMDS_MeshNode* n1,
|
||||
const SMDS_MeshNode* n2,
|
||||
const SMDS_MeshNode* n2,
|
||||
const SMDS_MeshNode* n12)
|
||||
{
|
||||
return SMDS_Mesh::AddEdgeWithID(n1, n2, n12, myElementIDFactory->GetFreeID());
|
||||
@ -2756,9 +2742,9 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdge(const SMDS_MeshNode* n1,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n12,
|
||||
int ID)
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n12,
|
||||
int ID)
|
||||
{
|
||||
if ( !n1 || !n2 || !n12 ) return 0;
|
||||
SMDS_QuadraticEdge* edge = new SMDS_QuadraticEdge(n1,n2,n12);
|
||||
@ -2786,8 +2772,8 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n12,
|
||||
const SMDS_MeshNode * n23,
|
||||
const SMDS_MeshNode * n31)
|
||||
@ -2848,9 +2834,9 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n12,
|
||||
const SMDS_MeshNode * n23,
|
||||
const SMDS_MeshNode * n34,
|
||||
@ -2915,9 +2901,9 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n12,
|
||||
const SMDS_MeshNode * n23,
|
||||
const SMDS_MeshNode * n31,
|
||||
@ -2994,9 +2980,9 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n5,
|
||||
const SMDS_MeshNode * n12,
|
||||
const SMDS_MeshNode * n23,
|
||||
@ -3085,9 +3071,9 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n5,
|
||||
const SMDS_MeshNode * n6,
|
||||
const SMDS_MeshNode * n12,
|
||||
@ -3184,9 +3170,9 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMDS_MeshVolume* SMDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n5,
|
||||
const SMDS_MeshNode * n6,
|
||||
const SMDS_MeshNode * n7,
|
||||
|
Loading…
Reference in New Issue
Block a user