+ {
+ // do not remove nodes except elem
+ s2 = new set<const SMDS_MeshElement*> ();
+ s2->insert(elem);
+ removenodes = true;
+ }
+ else
+ s2 = getExclusiveNodes(*s1);
+
+ // form the set of finite and construction elements to remove
+ set<const SMDS_MeshElement*> s3;
+ set<const SMDS_MeshElement*>::iterator it = s1->begin();
+ while (it != s1->end())
+ {
+ addChildrenWithNodes(s3, *it, *s2);
+ s3.insert(*it);
+ it++;
+ }
+ if (elem->GetType() != SMDSAbs_Node)
+ s3.insert(elem);
+
+ // remove finite and construction elements
+ it = s3.begin();
+ while (it != s3.end())
+ {
+ // 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));
+ }
+ 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")
+ ;
+ break;
+ case SMDSAbs_0DElement:
+ if (IdToRemove >= 0)
+ {
+ myCells[IdToRemove] = 0; // -PR- ici ou dans myElementIDFactory->ReleaseID ?
+ myInfo.remove(*it);
+ }
+ removedElems.push_back((*it));
+ myElementIDFactory->ReleaseID(IdToRemove, vtkid);
+ delete (*it);
+ break;
+ case SMDSAbs_Edge:
+ if (IdToRemove >= 0)
+ {
+ myCells[IdToRemove] = 0;
+ myInfo.RemoveEdge(*it);
+ }
+ removedElems.push_back((*it));
+ myElementIDFactory->ReleaseID(IdToRemove, vtkid);
+ if (const SMDS_VtkEdge* vtkElem = dynamic_cast<const SMDS_VtkEdge*>(*it))
+ myEdgePool->destroy((SMDS_VtkEdge*) vtkElem);
+ else
+ delete (*it);
+ break;
+ case SMDSAbs_Face:
+ if (IdToRemove >= 0)
+ {
+ myCells[IdToRemove] = 0;
+ myInfo.RemoveFace(*it);
+ }
+ removedElems.push_back((*it));
+ myElementIDFactory->ReleaseID(IdToRemove, vtkid);
+ if (const SMDS_VtkFace* vtkElem = dynamic_cast<const SMDS_VtkFace*>(*it))
+ myFacePool->destroy((SMDS_VtkFace*) vtkElem);
+ else
+ delete (*it);
+ break;
+ case SMDSAbs_Volume:
+ if (IdToRemove >= 0)
+ {
+ myCells[IdToRemove] = 0;
+ myInfo.RemoveVolume(*it);
+ }
+ removedElems.push_back((*it));
+ myElementIDFactory->ReleaseID(IdToRemove, vtkid);
+ if (const SMDS_VtkVolume* vtkElem = dynamic_cast<const SMDS_VtkVolume*>(*it))
+ myVolumePool->destroy((SMDS_VtkVolume*) vtkElem);
+ else
+ delete (*it);
+ break;
+ case SMDSAbs_Ball:
+ if (IdToRemove >= 0)
+ {
+ myCells[IdToRemove] = 0;
+ myInfo.remove(*it);
+ }
+ removedElems.push_back((*it));
+ myElementIDFactory->ReleaseID(IdToRemove, vtkid);
+ if (const SMDS_BallElement* vtkElem = dynamic_cast<const SMDS_BallElement*>(*it))
+ myBallPool->destroy(const_cast<SMDS_BallElement*>( vtkElem ));
+ else
+ delete (*it);
+ break;
+ }
+ if (vtkid >= 0)
+ {
+ //MESSAGE("VTK_EMPTY_CELL in " << vtkid);
+ this->myGrid->GetCellTypesArray()->SetValue(vtkid, VTK_EMPTY_CELL);
+ }
+ it++;
+ }
+
+ // remove exclusive (free) nodes
+ if (removenodes)
+ {
+ 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++;
+ }
+ }
+
+ delete s2;
+ delete s1;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+///@param elem The element to delete
+///////////////////////////////////////////////////////////////////////////////
+void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
+{
+ int elemId = elem->GetID();
+ int vtkId = elem->getVtkId();
+ //MESSAGE("RemoveFreeElement " << elemId);
+ SMDSAbs_ElementType aType = elem->GetType();
+ SMDS_MeshElement* todest = (SMDS_MeshElement*)(elem);
+ if (aType == SMDSAbs_Node) {
+ //MESSAGE("Remove free node " << elemId);
+ // only free node can be removed by this method
+ const SMDS_MeshNode* n = static_cast<SMDS_MeshNode*>(todest);
+ SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
+ if (!itFe->more()) { // free node
+ myNodes[elemId] = 0;
+ myInfo.myNbNodes--;
+ ((SMDS_MeshNode*) n)->SetPosition(SMDS_SpacePosition::originSpacePosition());
+ ((SMDS_MeshNode*) n)->SMDS_MeshElement::init( -1, -1, -1 ); // avoid reuse
+ myNodePool->destroy(static_cast<SMDS_MeshNode*>(todest));
+ myNodeIDFactory->ReleaseID(elemId, vtkId);
+ }
+ } else {
+ if (hasConstructionEdges() || hasConstructionFaces())
+ // this methods is only for meshes without descendants
+ return;
+
+ //MESSAGE("Remove free element " << elemId);
+ // Remove element from <InverseElements> of its nodes
+ SMDS_ElemIteratorPtr itn = elem->nodesIterator();
+ while (itn->more()) {
+ SMDS_MeshNode * n = static_cast<SMDS_MeshNode *>
+ (const_cast<SMDS_MeshElement *>(itn->next()));
+ n->RemoveInverseElement(elem);
+ }
+
+ // in meshes without descendants elements are always free
+ switch (aType) {
+ case SMDSAbs_0DElement:
+ myCells[elemId] = 0;
+ myInfo.remove(elem);
+ delete elem;
+ break;
+ case SMDSAbs_Edge:
+ myCells[elemId] = 0;
+ myInfo.RemoveEdge(elem);
+ myEdgePool->destroy(static_cast<SMDS_VtkEdge*>(todest));
+ break;
+ case SMDSAbs_Face:
+ myCells[elemId] = 0;
+ myInfo.RemoveFace(elem);
+ myFacePool->destroy(static_cast<SMDS_VtkFace*>(todest));
+ break;
+ case SMDSAbs_Volume:
+ myCells[elemId] = 0;
+ myInfo.RemoveVolume(elem);
+ myVolumePool->destroy(static_cast<SMDS_VtkVolume*>(todest));
+ break;
+ case SMDSAbs_Ball:
+ myCells[elemId] = 0;
+ myInfo.remove(elem);
+ myBallPool->destroy(static_cast<SMDS_BallElement*>(todest));
+ break;
+ default:
+ break;
+ }
+ myElementIDFactory->ReleaseID(elemId, vtkId);
+
+ this->myGrid->GetCellTypesArray()->SetValue(vtkId, VTK_EMPTY_CELL);
+ // --- to do: keep vtkid in a list of reusable cells
+ }
+}
+
+/*!
+ * Checks if the element is present in mesh.
+ * Useful to determine dead pointers.
+ */
+bool SMDS_Mesh::Contains (const SMDS_MeshElement* elem) const
+{
+ // we should not imply on validity of *elem, so iterate on containers
+ // of all types in the hope of finding <elem> somewhere there
+ SMDS_NodeIteratorPtr itn = nodesIterator();
+ while (itn->more())
+ if (elem == itn->next())
+ return true;
+ SMDS_ElemIteratorPtr ite = elementsIterator();
+ while (ite->more())
+ if (elem == ite->next())
+ return true;
+ return false;
+}
+
+//=======================================================================
+//function : MaxNodeID
+//purpose :
+//=======================================================================
+
+int SMDS_Mesh::MaxNodeID() const
+{
+ return myNodeMax;
+}
+
+//=======================================================================
+//function : MinNodeID
+//purpose :
+//=======================================================================
+
+int SMDS_Mesh::MinNodeID() const
+{
+ return myNodeMin;
+}
+
+//=======================================================================
+//function : MaxElementID
+//purpose :
+//=======================================================================
+
+int SMDS_Mesh::MaxElementID() const
+{
+ return myElementIDFactory->GetMaxID();
+}
+
+//=======================================================================
+//function : MinElementID
+//purpose :
+//=======================================================================
+
+int SMDS_Mesh::MinElementID() const
+{
+ return myElementIDFactory->GetMinID();
+}
+
+//=======================================================================
+//function : Renumber
+//purpose : Renumber all nodes or elements.
+//=======================================================================
+
+void SMDS_Mesh::Renumber (const bool isNodes, const int startID, const int deltaID)
+{
+ MESSAGE("Renumber");
+ if ( deltaID == 0 )
+ return;
+
+ SMDS_MeshNodeIDFactory * idFactory =
+ isNodes ? myNodeIDFactory : myElementIDFactory;
+
+ // get existing elements in the order of ID increasing
+ map<int,SMDS_MeshElement*> elemMap;
+ SMDS_ElemIteratorPtr idElemIt = idFactory->elementsIterator();
+ while ( idElemIt->more() ) {
+ SMDS_MeshElement* elem = const_cast<SMDS_MeshElement*>(idElemIt->next());
+ int id = elem->GetID();
+ elemMap.insert(map<int,SMDS_MeshElement*>::value_type(id, elem));
+ }
+ // release their ids
+ map<int,SMDS_MeshElement*>::iterator elemIt = elemMap.begin();
+ idFactory->Clear();
+// for ( ; elemIt != elemMap.end(); elemIt++ )
+// {
+// int id = (*elemIt).first;
+// idFactory->ReleaseID( id );
+// }
+ // set new IDs
+ int ID = startID;
+ elemIt = elemMap.begin();
+ for ( ; elemIt != elemMap.end(); elemIt++ )
+ {
+ idFactory->BindID( ID, (*elemIt).second );
+ ID += deltaID;
+ }
+}
+
+//=======================================================================
+//function : GetElementType
+//purpose : Return type of element or node with id
+//=======================================================================
+
+SMDSAbs_ElementType SMDS_Mesh::GetElementType( const int id, const bool iselem ) const
+{
+ SMDS_MeshElement* elem = 0;
+ if( iselem )
+ elem = myElementIDFactory->MeshElement( id );
+ else
+ elem = myNodeIDFactory->MeshElement( id );
+
+ if( !elem )
+ {
+ //throw SALOME_Exception(LOCALIZED ("this element isn't exist"));
+ return SMDSAbs_All;
+ }
+ else
+ return elem->GetType();
+}
+
+
+
+//********************************************************************
+//********************************************************************
+//******** *********
+//***** Methods for addition of quadratic elements ******
+//******** *********
+//********************************************************************
+//********************************************************************
+
+//=======================================================================
+//function : AddEdgeWithID
+//purpose :
+//=======================================================================
+SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(int n1, int n2, int n12, int ID)
+{
+ return SMDS_Mesh::AddEdgeWithID
+ ((SMDS_MeshNode*) myNodeIDFactory->MeshElement(n1),
+ (SMDS_MeshNode*) myNodeIDFactory->MeshElement(n2),
+ (SMDS_MeshNode*) myNodeIDFactory->MeshElement(n12),
+ ID);
+}
+
+//=======================================================================
+//function : AddEdge
+//purpose :
+//=======================================================================
+SMDS_MeshEdge* SMDS_Mesh::AddEdge(const SMDS_MeshNode* n1,
+ const SMDS_MeshNode* n2,
+ const SMDS_MeshNode* n12)
+{
+ return SMDS_Mesh::AddEdgeWithID(n1, n2, n12, myElementIDFactory->GetFreeID());
+}
+
+//=======================================================================
+//function : AddEdgeWithID
+//purpose :
+//=======================================================================
+SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n12,
+ int ID)
+{
+ if ( !n1 || !n2 || !n12 ) return 0;
+
+ // --- retrieve nodes ID
+ myNodeIds.resize(3);
+ myNodeIds[0] = n1->getVtkId();
+ myNodeIds[1] = n2->getVtkId();
+ myNodeIds[2] = n12->getVtkId();
+
+ SMDS_MeshEdge * edge = 0;
+ SMDS_VtkEdge *edgevtk = myEdgePool->getNew();
+ edgevtk->init(myNodeIds, this);
+ if (!this->registerElement(ID,edgevtk))
+ {
+ this->myGrid->GetCellTypesArray()->SetValue(edgevtk->getVtkId(), VTK_EMPTY_CELL);
+ myEdgePool->destroy(edgevtk);
+ return 0;
+ }
+ edge = edgevtk;
+ adjustmyCellsCapacity(ID);
+ myCells[ID] = edge;
+ myInfo.myNbQuadEdges++;
+
+ // if (!registerElement(ID, edge)) {
+ // RemoveElement(edge, false);
+ // edge = NULL;
+ // }
+ return edge;
+
+}
+
+
+//=======================================================================
+//function : AddFace
+//purpose :
+//=======================================================================
+SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n31)
+{
+ return SMDS_Mesh::AddFaceWithID(n1,n2,n3,n12,n23,n31,
+ myElementIDFactory->GetFreeID());
+}
+
+//=======================================================================
+//function : AddFaceWithID
+//purpose :
+//=======================================================================
+SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int n1, int n2, int n3,
+ int n12,int n23,int n31, int ID)
+{
+ return SMDS_Mesh::AddFaceWithID
+ ((SMDS_MeshNode *)myNodeIDFactory->MeshElement(n1) ,
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n2) ,
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n3) ,
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n12),
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n23),
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n31),
+ ID);
+}
+
+//=======================================================================
+//function : AddFaceWithID
+//purpose :
+//=======================================================================
+SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n31,
+ int ID)
+{
+ if ( !n1 || !n2 || !n3 || !n12 || !n23 || !n31) return 0;
+ if(hasConstructionEdges()) {
+ // creation quadratic edges - not implemented
+ return 0;
+ }
+ else
+ {
+ // --- retrieve nodes ID
+ myNodeIds.resize(6);
+ myNodeIds[0] = n1->getVtkId();
+ myNodeIds[1] = n2->getVtkId();
+ myNodeIds[2] = n3->getVtkId();
+ myNodeIds[3] = n12->getVtkId();
+ myNodeIds[4] = n23->getVtkId();
+ myNodeIds[5] = n31->getVtkId();
+
+ SMDS_MeshFace * face = 0;
+ SMDS_VtkFace *facevtk = myFacePool->getNew();
+ facevtk->init(myNodeIds, this);
+ if (!this->registerElement(ID,facevtk))
+ {
+ this->myGrid->GetCellTypesArray()->SetValue(facevtk->getVtkId(), VTK_EMPTY_CELL);
+ myFacePool->destroy(facevtk);
+ return 0;
+ }
+ face = facevtk;
+ adjustmyCellsCapacity(ID);
+ myCells[ID] = face;
+ myInfo.myNbQuadTriangles++;
+
+ // if (!registerElement(ID, face)) {
+ // RemoveElement(face, false);
+ // face = NULL;
+ // }
+ return face;
+ }
+}
+
+
+//=======================================================================
+//function : AddFace
+//purpose :
+//=======================================================================
+SMDS_MeshFace* SMDS_Mesh::AddFace(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n31,
+ const SMDS_MeshNode * nCenter)
+{
+ return SMDS_Mesh::AddFaceWithID(n1,n2,n3,n12,n23,n31,nCenter,
+ myElementIDFactory->GetFreeID());
+}
+
+//=======================================================================
+//function : AddFaceWithID
+//purpose :
+//=======================================================================
+SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int n1, int n2, int n3,
+ int n12,int n23,int n31, int nCenter, int ID)
+{
+ return SMDS_Mesh::AddFaceWithID
+ ((SMDS_MeshNode *)myNodeIDFactory->MeshElement(n1) ,
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n2) ,
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n3) ,
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n12),
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n23),
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n31),
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(nCenter),
+ ID);
+}
+
+//=======================================================================
+//function : AddFaceWithID
+//purpose :
+//=======================================================================
+SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n31,
+ const SMDS_MeshNode * nCenter,
+ int ID)
+{
+ if ( !n1 || !n2 || !n3 || !n12 || !n23 || !n31 || !nCenter) return 0;
+ if(hasConstructionEdges()) {
+ // creation quadratic edges - not implemented
+ return 0;
+ }
+ else
+ {
+ // --- retrieve nodes ID
+ myNodeIds.resize(7);
+ myNodeIds[0] = n1->getVtkId();
+ myNodeIds[1] = n2->getVtkId();
+ myNodeIds[2] = n3->getVtkId();
+ myNodeIds[3] = n12->getVtkId();
+ myNodeIds[4] = n23->getVtkId();
+ myNodeIds[5] = n31->getVtkId();
+ myNodeIds[6] = nCenter->getVtkId();
+
+ SMDS_MeshFace * face = 0;
+ SMDS_VtkFace *facevtk = myFacePool->getNew();
+ facevtk->init(myNodeIds, this);
+ if (!this->registerElement(ID,facevtk))
+ {
+ this->myGrid->GetCellTypesArray()->SetValue(facevtk->getVtkId(), VTK_EMPTY_CELL);
+ myFacePool->destroy(facevtk);
+ return 0;
+ }
+ face = facevtk;
+ adjustmyCellsCapacity(ID);
+ myCells[ID] = face;
+ myInfo.myNbBiQuadTriangles++;
+
+ // if (!registerElement(ID, face)) {
+ // RemoveElement(face, false);
+ // face = NULL;
+ // }
+ return face;
+ }
+}
+
+
+//=======================================================================
+//function : AddFace
+//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 * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n34,
+ const SMDS_MeshNode * n41)
+{
+ return SMDS_Mesh::AddFaceWithID(n1,n2,n3,n4,n12,n23,n34,n41,
+ myElementIDFactory->GetFreeID());
+}
+
+//=======================================================================
+//function : AddFaceWithID
+//purpose :
+//=======================================================================
+SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int n4,
+ int n12,int n23,int n34,int n41, int ID)
+{
+ return SMDS_Mesh::AddFaceWithID
+ ((SMDS_MeshNode *)myNodeIDFactory->MeshElement(n1) ,
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n2) ,
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n3) ,
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n4) ,
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n12),
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n23),
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n34),
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n41),
+ ID);
+}
+
+//=======================================================================
+//function : AddFaceWithID
+//purpose :
+//=======================================================================
+SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n34,
+ const SMDS_MeshNode * n41,
+ int ID)
+{
+ if ( !n1 || !n2 || !n3 || !n4 || !n12 || !n23 || !n34 || !n41) return 0;
+ if(hasConstructionEdges()) {
+ // creation quadratic edges - not implemented
+ return 0;
+ }
+ else
+ {
+ // --- retrieve nodes ID
+ myNodeIds.resize(8);
+ myNodeIds[0] = n1->getVtkId();
+ myNodeIds[1] = n2->getVtkId();
+ myNodeIds[2] = n3->getVtkId();
+ myNodeIds[3] = n4->getVtkId();
+ myNodeIds[4] = n12->getVtkId();
+ myNodeIds[5] = n23->getVtkId();
+ myNodeIds[6] = n34->getVtkId();
+ myNodeIds[7] = n41->getVtkId();
+
+ SMDS_MeshFace * face = 0;
+ SMDS_VtkFace *facevtk = myFacePool->getNew();
+ facevtk->init(myNodeIds, this);
+ if (!this->registerElement(ID,facevtk))
+ {
+ this->myGrid->GetCellTypesArray()->SetValue(facevtk->getVtkId(), VTK_EMPTY_CELL);
+ myFacePool->destroy(facevtk);
+ return 0;
+ }
+ face = facevtk;
+ adjustmyCellsCapacity(ID);
+ myCells[ID] = face;
+ myInfo.myNbQuadQuadrangles++;
+
+ // if (!registerElement(ID, face)) {
+ // RemoveElement(face, false);
+ // face = NULL;
+ // }
+ return face;
+ }
+}
+
+//=======================================================================
+//function : AddFace
+//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 * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n34,
+ const SMDS_MeshNode * n41,
+ const SMDS_MeshNode * nCenter)
+{
+ return SMDS_Mesh::AddFaceWithID(n1,n2,n3,n4,n12,n23,n34,n41,nCenter,
+ myElementIDFactory->GetFreeID());
+}
+
+//=======================================================================
+//function : AddFaceWithID
+//purpose :
+//=======================================================================
+SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int n4,
+ int n12,int n23,int n34,int n41, int nCenter, int ID)
+{
+ return SMDS_Mesh::AddFaceWithID
+ ((SMDS_MeshNode *)myNodeIDFactory->MeshElement(n1) ,
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n2) ,
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n3) ,
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n4) ,
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n12),
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n23),
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n34),
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(n41),
+ (SMDS_MeshNode *)myNodeIDFactory->MeshElement(nCenter),
+ ID);
+}
+
+//=======================================================================
+//function : AddFaceWithID
+//purpose :
+//=======================================================================
+SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
+ const SMDS_MeshNode * n2,
+ const SMDS_MeshNode * n3,
+ const SMDS_MeshNode * n4,
+ const SMDS_MeshNode * n12,
+ const SMDS_MeshNode * n23,
+ const SMDS_MeshNode * n34,
+ const SMDS_MeshNode * n41,
+ const SMDS_MeshNode * nCenter,
+ int ID)
+{
+ if ( !n1 || !n2 || !n3 || !n4 || !n12 || !n23 || !n34 || !n41 || !nCenter) return 0;
+ if(hasConstructionEdges()) {
+ // creation quadratic edges - not implemented
+ return 0;