From: eap Date: Thu, 16 May 2013 16:06:21 +0000 (+0000) Subject: 0022100: EDF 2413 SMESH: Take into account TRIA7 X-Git-Tag: V7_3_0a1~482 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=90925ba7c07194003441f8a90e0a5fb954f3bd05;p=modules%2Fsmesh.git 0022100: EDF 2413 SMESH: Take into account TRIA7 + virtual SMDS_MeshFace* 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); + virtual void MoveNode(const SMDS_MeshNode *n, double x, double y, double z); --- diff --git a/src/SMDS/SMDS_Mesh.cxx b/src/SMDS/SMDS_Mesh.cxx index 9f45f3a04..b27c89703 100644 --- a/src/SMDS/SMDS_Mesh.cxx +++ b/src/SMDS/SMDS_Mesh.cxx @@ -1597,6 +1597,9 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceFromVtkIdsWithID(const std::vector& case VTK_BIQUADRATIC_QUAD: myInfo.myNbBiQuadQuadrangles++; break; + case VTK_BIQUADRATIC_TRIANGLE: + myInfo.myNbBiQuadTriangles++; + break; case VTK_POLYGON: myInfo.myNbPolygons++; break; @@ -1638,6 +1641,17 @@ bool SMDS_Mesh::registerElement(int ID, SMDS_MeshElement* element) return true; } +//======================================================================= +//function : MoveNode +//purpose : +//======================================================================= + +void SMDS_Mesh::MoveNode(const SMDS_MeshNode *n, double x, double y, double z) +{ + SMDS_MeshNode * node=const_cast(n); + node->setXYZ(x,y,z); +} + /////////////////////////////////////////////////////////////////////////////// /// Return the node whose SMDS ID is 'ID'. /////////////////////////////////////////////////////////////////////////////// @@ -2446,7 +2460,7 @@ const SMDS_MeshElement* SMDS_Mesh::FindElement (const vector (e); + return e; } } } @@ -3690,6 +3704,94 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1, } +//======================================================================= +//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 + vector nodeIds; + nodeIds.clear(); + nodeIds.push_back(n1->getVtkId()); + nodeIds.push_back(n2->getVtkId()); + nodeIds.push_back(n3->getVtkId()); + nodeIds.push_back(n12->getVtkId()); + nodeIds.push_back(n23->getVtkId()); + nodeIds.push_back(n31->getVtkId()); + nodeIds.push_back(nCenter->getVtkId()); + + SMDS_MeshFace * face = 0; + SMDS_VtkFace *facevtk = myFacePool->getNew(); + facevtk->init(nodeIds, 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 : diff --git a/src/SMDS/SMDS_Mesh.hxx b/src/SMDS/SMDS_Mesh.hxx index 948830dd9..3c0d0ca0d 100644 --- a/src/SMDS/SMDS_Mesh.hxx +++ b/src/SMDS/SMDS_Mesh.hxx @@ -170,6 +170,25 @@ public: const SMDS_MeshNode * n23, const SMDS_MeshNode * n31); + // 2d order triangle of 7 nodes + virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, + int n12,int n23,int n31, int nCenter, int ID); + virtual SMDS_MeshFace* 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); + virtual SMDS_MeshFace* 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); + // 2d order quadrangle virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int n12,int n23,int n34,int n41, int ID); @@ -580,6 +599,7 @@ public: virtual SMDS_MeshFace* AddFaceFromVtkIdsWithID(const std::vector& vtkNodeIds, const int ID); + virtual void MoveNode(const SMDS_MeshNode *n, double x, double y, double z); virtual void RemoveElement(const SMDS_MeshElement * elem, std::list& removedElems,