From: eap Date: Thu, 15 Nov 2007 14:35:36 +0000 (+0000) Subject: PAL17694 (New Tool About Hexahedral Meshing) X-Git-Tag: V4_1_0rc2~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f5ec27b36b31c808cba629bd3703269df73ae6c9;p=modules%2Fsmesh.git PAL17694 (New Tool About Hexahedral Meshing) + SMESH::NodePosition* GetNodePosition(CORBA::Long NodeID); --- diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 2ebee967b..2aea23fda 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -44,6 +44,8 @@ #include "SMESH_Group.hxx" #include "SMESH_MeshEditor.hxx" #include "SMESH_MesherHelper.hxx" +#include "SMDS_EdgePosition.hxx" +#include "SMDS_FacePosition.hxx" #include "OpUtil.hxx" #include "SALOME_NamingService.hxx" @@ -54,14 +56,15 @@ // OCCT Includes #include -#include -#include #include +#include +#include #include -#include #include +#include #include #include +#include #include // STL Includes @@ -2060,6 +2063,56 @@ SMESH::long_array* SMESH_Mesh_i::GetNodeInverseElements(const CORBA::Long id) return aResult._retn(); } +//============================================================================= +/*! + * \brief Return position of a node on shape + */ +//============================================================================= + +SMESH::NodePosition* SMESH_Mesh_i::GetNodePosition(CORBA::Long NodeID) +{ + SMESH::NodePosition* aNodePosition = new SMESH::NodePosition(); + aNodePosition->shapeID = 0; + aNodePosition->shapeType = GEOM::SHAPE; + + SMESHDS_Mesh* mesh = _impl->GetMeshDS(); + if ( !mesh ) return aNodePosition; + + if ( const SMDS_MeshNode* aNode = mesh->FindNode(NodeID) ) + { + if ( SMDS_PositionPtr pos = aNode->GetPosition() ) + { + aNodePosition->shapeID = pos->GetShapeId(); + switch ( pos->GetTypeOfPosition() ) { + case SMDS_TOP_EDGE: + aNodePosition->shapeType = GEOM::EDGE; + aNodePosition->params.length(1); + aNodePosition->params[0] = + static_cast( pos.get() )->GetUParameter(); + break; + case SMDS_TOP_FACE: + aNodePosition->shapeType = GEOM::FACE; + aNodePosition->params.length(2); + aNodePosition->params[0] = + static_cast( pos.get() )->GetUParameter(); + aNodePosition->params[1] = + static_cast( pos.get() )->GetVParameter(); + break; + case SMDS_TOP_VERTEX: + aNodePosition->shapeType = GEOM::VERTEX; + break; + case SMDS_TOP_3DSPACE: + if ( TopExp_Explorer(_impl->GetShapeToMesh(), TopAbs_SOLID).More() ) + aNodePosition->shapeType = GEOM::SOLID; + else if ( TopExp_Explorer(_impl->GetShapeToMesh(), TopAbs_SHELL).More() ) + aNodePosition->shapeType = GEOM::SHELL; + break; + default:; + } + } + } + return aNodePosition; +} //============================================================================= /*! diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index e9f8447d7..d3e6bfc2d 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -358,6 +358,11 @@ public: */ SMESH::long_array* GetNodeInverseElements(CORBA::Long id); + /*! + * \brief Return position of a node on shape + */ + SMESH::NodePosition* GetNodePosition(CORBA::Long NodeID); + /*! * If given element is node returns IDs of shape from position * If there is not node for given ID - returns -1