/// 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)
{
}
/// (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)
{
}
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;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
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());
}
///////////////////////////////////////////////////////////////////////////////
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;
node1=const_cast<SMDS_MeshNode*>(n1);
node2=const_cast<SMDS_MeshNode*>(n2);
node1->AddInverseElement(edge);
- node2->AddInverseElement(edge);
+ node2->AddInverseElement(edge);
myEdges.Add(edge);
myInfo.myNbEdges++;
return edge;
///////////////////////////////////////////////////////////////////////////////
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());
}
SMDS_MeshNode * node2 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode2);
SMDS_MeshNode * node3 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode3);
if(!node1 || !node2 || !node3) return NULL;
- return SMDS_Mesh::AddFaceWithID(node1, node2, node3, ID);
+ return SMDS_Mesh::AddFaceWithID(node1, node2, node3, ID);
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
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());
}
///////////////////////////////////////////////////////////////////////////////
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);
node3 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode3);
node4 = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(idnode4);
if(!node1 || !node2 || !node3 || !node4) return NULL;
- return SMDS_Mesh::AddFaceWithID(node1, node2, node3, node4, ID);
+ return SMDS_Mesh::AddFaceWithID(node1, node2, node3, node4, ID);
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
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);
///////////////////////////////////////////////////////////////////////////////
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);
if(!node1 || !node2 || !node3 || !node4) return NULL;
return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, ID);
}
-
+
///////////////////////////////////////////////////////////////////////////////
///Create a new tetrahedron and add it to the mesh.
///@param ID The ID of the new volume
///////////////////////////////////////////////////////////////////////////////
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);
///////////////////////////////////////////////////////////////////////////////
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);
if(!node1 || !node2 || !node3 || !node4 || !node5) return NULL;
return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, ID);
}
-
+
///////////////////////////////////////////////////////////////////////////////
///Create a new pyramid and add it to the mesh.
///Nodes 1,2,3 and 4 define the base of the pyramid
///////////////////////////////////////////////////////////////////////////////
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);
///////////////////////////////////////////////////////////////////////////////
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);
if(!node1 || !node2 || !node3 || !node4 || !node5 || !node6) return NULL;
return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, node6, ID);
}
-
+
///////////////////////////////////////////////////////////////////////////////
///Create a new prism and add it to the mesh.
///Nodes 1,2,3 is a triangle and 1,2,5,4 a quadrangle.
///////////////////////////////////////////////////////////////////////////////
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);
///////////////////////////////////////////////////////////////////////////////
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);
return SMDS_Mesh::AddVolumeWithID(node1, node2, node3, node4, node5, node6,
node7, node8, ID);
}
-
+
///////////////////////////////////////////////////////////////////////////////
///Create a new hexahedron and add it to the mesh.
///Nodes 1,2,3,4 and 5,6,7,8 are quadrangle and 5,1 and 7,3 are an edges.
nodes[i] = (SMDS_MeshNode *)myNodeIDFactory->MeshElement(nodes_ids[i]);
if (!nodes[i]) return NULL;
}
- return SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID);
+ return SMDS_Mesh::AddPolygonalFaceWithID(nodes, ID);
}
///////////////////////////////////////////////////////////////////////////////
///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();
void SMDS_Mesh::RemoveNode(const SMDS_MeshNode * node)
{
- RemoveElement(node, true);
+ RemoveElement(node, true);
}
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::RemoveEdge(const SMDS_MeshEdge * edge)
{
- RemoveElement(edge,true);
+ RemoveElement(edge,true);
}
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::RemoveFace(const SMDS_MeshFace * face)
{
- RemoveElement(face, true);
+ RemoveElement(face, true);
}
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::RemoveVolume(const SMDS_MeshVolume * volume)
{
- RemoveElement(volume, true);
+ RemoveElement(volume, true);
}
//=======================================================================
bool SMDS_Mesh::RemoveFromParent()
{
- if (myParent==NULL) return false;
- else return (myParent->RemoveSubMesh(this));
+ if (myParent==NULL) return false;
+ else return (myParent->RemoveSubMesh(this));
}
//=======================================================================
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;
}
//=======================================================================
//=======================================================================
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);
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());
}
//=======================================================================
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());
}
//=======================================================================
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());
}
//=======================================================================
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());
}
//=======================================================================
void SMDS_Mesh::DebugStats() const
{
- MESSAGE("Debug stats of mesh : ");
+ MESSAGE("Debug stats of mesh : ");
- MESSAGE("===== NODES ====="<<NbNodes());
- MESSAGE("===== EDGES ====="<<NbEdges());
- MESSAGE("===== FACES ====="<<NbFaces());
- MESSAGE("===== VOLUMES ====="<<NbVolumes());
+ MESSAGE("===== NODES ====="<<NbNodes());
+ MESSAGE("===== EDGES ====="<<NbEdges());
+ MESSAGE("===== FACES ====="<<NbFaces());
+ MESSAGE("===== VOLUMES ====="<<NbVolumes());
- MESSAGE("End Debug stats of mesh ");
+ MESSAGE("End Debug stats of mesh ");
- //#ifdef DEB
-
- SMDS_NodeIteratorPtr itnode=nodesIterator();
- int sizeofnodes = 0;
- int sizeoffaces = 0;
+ //#ifdef DEB
+
+ 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);
-
- SMDS_ElemIteratorPtr it = node->GetInverseElementIterator();
- while(it->more())
- {
- const SMDS_MeshElement *me = it->next();
- sizeofnodes += sizeof(me);
- }
+ sizeofnodes += sizeof(*node);
+
+ 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
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
int SMDS_Mesh::NbNodes() const
{
- return myNodes.Size();
+ return myNodes.Size();
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
int SMDS_Mesh::NbEdges() const
{
- return myEdges.Size();
+ return myEdges.Size();
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
int SMDS_Mesh::NbFaces() const
{
- return myFaces.Size();
+ return myFaces.Size();
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
int SMDS_Mesh::NbVolumes() const
{
- return myVolumes.Size();
+ return myVolumes.Size();
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
int SMDS_Mesh::NbSubMesh() const
{
- return myChildren.size();
+ return myChildren.size();
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
bool SMDS_Mesh::hasConstructionEdges()
{
- return myHasConstructionEdges;
+ return myHasConstructionEdges;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
bool SMDS_Mesh::hasConstructionFaces()
{
- return myHasConstructionFaces;
+ return myHasConstructionFaces;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
bool SMDS_Mesh::hasInverseElements()
{
- return myHasInverseElements;
+ return myHasInverseElements;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::setConstructionEdges(bool b)
{
- myHasConstructionEdges=b;
+ myHasConstructionEdges=b;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::setConstructionFaces(bool b)
{
- myHasConstructionFaces=b;
+ myHasConstructionFaces=b;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::setInverseElements(bool b)
{
- if(!b) MESSAGE("Error : inverseElement=false not implemented");
- myHasInverseElements=b;
+ if(!b) MESSAGE("Error : inverseElement=false not implemented");
+ myHasInverseElements=b;
}
///////////////////////////////////////////////////////////////////////////////
/// 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;
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
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*> * 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(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())
+ set<const SMDS_MeshElement*>& elements)
+{
+ 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(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;
}
///////////////////////////////////////////////////////////////////////////////
///@param element The element were to search matching children
///@param nodes The nodes that the children must have to be selected
///////////////////////////////////////////////////////////////////////////////
-void SMDS_Mesh::addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren,
- const SMDS_MeshElement * element, set<const SMDS_MeshElement*>& nodes)
-{
-
- switch(element->GetType())
- {
- case SMDSAbs_Node:
- MESSAGE("Internal Error: This should not append");
- break;
- case SMDSAbs_Edge:
- {
- SMDS_ElemIteratorPtr itn=element->nodesIterator();
- while(itn->more())
- {
- const SMDS_MeshElement * e=itn->next();
- if(nodes.find(e)!=nodes.end())
+void SMDS_Mesh::addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren,
+ const SMDS_MeshElement * element, set<const SMDS_MeshElement*>& nodes)
+{
+
+ switch(element->GetType())
+ {
+ case SMDSAbs_Node:
+ MESSAGE("Internal Error: This should not append");
+ break;
+ case SMDSAbs_Edge:
+ {
+ 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;
- case SMDSAbs_Face:
- {
- SMDS_ElemIteratorPtr itn=element->nodesIterator();
- while(itn->more())
- {
- const SMDS_MeshElement * e=itn->next();
- if(nodes.find(e)!=nodes.end())
+ }
+ } break;
+ case SMDSAbs_Face:
+ {
+ 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;
- 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(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);
+ }
+ }
+ }
}
///////////////////////////////////////////////////////////////////////////////
///@param removenodes if true remaining nodes will be removed
///////////////////////////////////////////////////////////////////////////////
void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
- const bool removenodes)
+ const bool removenodes)
{
list<const SMDS_MeshElement *> removedElems;
list<const SMDS_MeshElement *> removedNodes;
//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());
//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);
//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)
//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,
//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,
//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,
//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,
//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,