22368: EDF SMESH: Pattern mapping to assign new nodes to sub-shapes

+    /*!
+     * Returns three components of normal of given mesh face.
+     */
+    double_array GetFaceNormal(in long faceId);
This commit is contained in:
eap 2013-12-26 15:07:24 +00:00
parent 60e380a37a
commit 1d6cfba4c1
4 changed files with 51 additions and 4 deletions

View File

@ -925,6 +925,11 @@ module SMESH
*/
long_array GetElemFaceNodes(in long elemId, in short faceIndex);
/*!
* Returns three components of normal of given mesh face (or an empty array in KO case)
*/
double_array GetFaceNormal(in long faceId);
/*!
* Returns an element based on all given nodes.
*/

View File

@ -44,6 +44,7 @@
#include "SMESH_Gen_i.hxx"
#include "SMESH_Group.hxx"
#include "SMESH_Group_i.hxx"
#include "SMESH_MeshAlgos.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_MeshEditor_i.hxx"
#include "SMESH_MeshPartDS.hxx"
@ -4023,6 +4024,32 @@ SMESH::long_array* SMESH_Mesh_i::GetElemFaceNodes(CORBA::Long elemId,
return aResult._retn();
}
//=======================================================================
//function : GetElemFaceNodes
//purpose : Returns three components of normal of given mesh face.
//=======================================================================
SMESH::double_array* SMESH_Mesh_i::GetFaceNormal(CORBA::Long elemId)
{
if ( _preMeshInfo )
_preMeshInfo->FullLoadFromFile();
SMESH::double_array_var aResult = new SMESH::double_array();
if ( SMESHDS_Mesh* mesh = _impl->GetMeshDS() )
{
gp_XYZ normal;
if ( SMESH_MeshAlgos::FaceNormal( mesh->FindElement(elemId), normal, /*normalized=*/true ))
{
aResult->length( 3 );
aResult[ 0 ] = normal.X();
aResult[ 1 ] = normal.Y();
aResult[ 2 ] = normal.Z();
}
}
return aResult._retn();
}
//=======================================================================
//function : FindElementByNodes
//purpose : Returns an element based on all given nodes.

View File

@ -532,6 +532,11 @@ public:
*/
SMESH::long_array* GetElemFaceNodes(CORBA::Long elemId, CORBA::Short faceIndex);
/*!
* Returns three components of normal of given mesh face (or an empty array in KO case)
*/
SMESH::double_array* GetFaceNormal(CORBA::Long faceId);
/*!
* Returns an element based on all given nodes.
*/

View File

@ -2418,6 +2418,12 @@ class Mesh:
def GetElemFaceNodes(self,elemId, faceIndex):
return self.mesh.GetElemFaceNodes(elemId, faceIndex)
## Returns three components of normal of given mesh face
# (or an empty array in KO case)
# @ingroup l1_meshinfo
def GetFaceNormal(self, faceId):
return self.mesh.GetFaceNormal(faceId)
## Returns an element based on all given nodes.
# @ingroup l1_meshinfo
def FindElementByNodes(self,nodes):
@ -3181,7 +3187,8 @@ class Mesh:
# Note that nodes built on edges and boundary nodes are always fixed.
# @param MaxNbOfIterations the maximum number of iterations
# @param MaxAspectRatio varies in range [1.0, inf]
# @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
# @param Method is either Laplacian (SMESH.SMESH_MeshEditor.LAPLACIAN_SMOOTH)
# or Centroidal (SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH)
# @return TRUE in case of success, FALSE otherwise.
# @ingroup l2_modif_smooth
def Smooth(self, IDsOfElements, IDsOfFixedNodes,
@ -3199,7 +3206,8 @@ class Mesh:
# Note that nodes built on edges and boundary nodes are always fixed.
# @param MaxNbOfIterations the maximum number of iterations
# @param MaxAspectRatio varies in range [1.0, inf]
# @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
# @param Method is either Laplacian (SMESH.SMESH_MeshEditor.LAPLACIAN_SMOOTH)
# or Centroidal (SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH)
# @return TRUE in case of success, FALSE otherwise.
# @ingroup l2_modif_smooth
def SmoothObject(self, theObject, IDsOfFixedNodes,
@ -3215,7 +3223,8 @@ class Mesh:
# Note that nodes built on edges and boundary nodes are always fixed.
# @param MaxNbOfIterations the maximum number of iterations
# @param MaxAspectRatio varies in range [1.0, inf]
# @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
# @param Method is either Laplacian (SMESH.SMESH_MeshEditor.LAPLACIAN_SMOOTH)
# or Centroidal (SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH)
# @return TRUE in case of success, FALSE otherwise.
# @ingroup l2_modif_smooth
def SmoothParametric(self, IDsOfElements, IDsOfFixedNodes,
@ -3233,7 +3242,8 @@ class Mesh:
# Note that nodes built on edges and boundary nodes are always fixed.
# @param MaxNbOfIterations the maximum number of iterations
# @param MaxAspectRatio varies in range [1.0, inf]
# @param Method Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
# @param Method is either Laplacian (SMESH.SMESH_MeshEditor.LAPLACIAN_SMOOTH)
# or Centroidal (SMESH.SMESH_MeshEditor.CENTROIDAL_SMOOTH)
# @return TRUE in case of success, FALSE otherwise.
# @ingroup l2_modif_smooth
def SmoothParametricObject(self, theObject, IDsOfFixedNodes,