From: prascle Date: Thu, 3 Mar 2011 16:35:32 +0000 (+0000) Subject: PR: getOrderedNodesOfFace for hexahedron X-Git-Tag: StartingPortingMED3~35 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5cfaebe1bf2f9e92afe6df334248df06fcaedb31;p=modules%2Fsmesh.git PR: getOrderedNodesOfFace for hexahedron --- diff --git a/src/SMDS/SMDS_Downward.cxx b/src/SMDS/SMDS_Downward.cxx index a83430ee8..ed6fc3898 100644 --- a/src/SMDS/SMDS_Downward.cxx +++ b/src/SMDS/SMDS_Downward.cxx @@ -1766,7 +1766,34 @@ SMDS_DownHexa::~SMDS_DownHexa() void SMDS_DownHexa::getOrderedNodesOfFace(int cellId, std::vector& orderedNodes) { - // TODO + set setNodes; + setNodes.clear(); + for (int i = 0; i < orderedNodes.size(); i++) + setNodes.insert(orderedNodes[i]); + //MESSAGE("cellId = " << cellId); + + vtkIdType npts = 0; + vtkIdType *nodes; // will refer to the point id's of the volume + _grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes); + + set tofind; + int ids[24] = { 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 5, 4, 3, 2, 6, 7, 0, 3, 7, 4, 1, 2, 6, 5}; + for (int k = 0; k < 6; k++) // loop on the 6 faces + { + tofind.clear(); + for (int i = 0; i < 4; i++) + tofind.insert(nodes[ids[4 * k + i]]); // node ids of the face i + if (setNodes == tofind) + { + for (int i = 0; i < 4; i++) + orderedNodes[i] = nodes[ids[4 * k + i]]; + return; + } + } + MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId])); + MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2] << " " << orderedNodes[3]); + MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]); + MESSAGE(nodes[4] << " " << nodes[5] << " " << nodes[6] << " " << nodes[7]); } void SMDS_DownHexa::addDownCell(int cellId, int lowCellId, unsigned char aType)