From 1f50f137e374dc2649589127412662103a4ff670 Mon Sep 17 00:00:00 2001 From: eap Date: Tue, 30 Mar 2010 12:32:41 +0000 Subject: [PATCH] 0020672: EDF 1243 SMESH : Be able to transform mixed mesh * Implement GetFaceNodesIndices() for polyhedrons --- src/SMDS/SMDS_VolumeTool.cxx | 27 ++++++++++++++------------- src/SMDS/SMDS_VolumeTool.hxx | 3 ++- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/SMDS/SMDS_VolumeTool.cxx b/src/SMDS/SMDS_VolumeTool.cxx index 24509b255..2bacb2c29 100644 --- a/src/SMDS/SMDS_VolumeTool.cxx +++ b/src/SMDS/SMDS_VolumeTool.cxx @@ -447,14 +447,11 @@ SMDS_VolumeTool::SMDS_VolumeTool (const SMDS_MeshElement* theVolume) SMDS_VolumeTool::~SMDS_VolumeTool() { - if (myVolumeNodes != NULL) { - delete [] myVolumeNodes; - myVolumeNodes = NULL; - } - if (myFaceNodes != NULL) { - delete [] myFaceNodes; - myFaceNodes = NULL; - } + if ( myVolumeNodes != NULL ) delete [] myVolumeNodes; + if ( myFaceNodes != NULL ) delete [] myFaceNodes; + + myFaceNodeIndices = NULL; + myVolumeNodes = myFaceNodes = NULL; } //======================================================================= @@ -914,12 +911,16 @@ const SMDS_MeshNode** SMDS_VolumeTool::GetFaceNodes( int faceIndex ) const int* SMDS_VolumeTool::GetFaceNodesIndices( int faceIndex ) { - if (myVolume->IsPoly()) { - MESSAGE("Warning: attempt to obtain FaceNodesIndices of polyhedral volume"); - return NULL; - } if ( !setFace( faceIndex )) return 0; + + if (myVolume->IsPoly()) + { + myPolyIndices.resize( myFaceNbNodes + 1 ); + myFaceNodeIndices = & myPolyIndices[0]; + for ( int i = 0; i <= myFaceNbNodes; ++i ) + myFaceNodeIndices[i] = myVolume->GetNodeIndex( myFaceNodes[i] ); + } return myFaceNodeIndices; } @@ -1686,7 +1687,7 @@ int SMDS_VolumeTool::NbFaceNodes(VolumeType type, //purpose : return element //======================================================================= -const SMDS_MeshVolume* SMDS_VolumeTool::Get() const +const SMDS_MeshVolume* SMDS_VolumeTool::Element() const { return static_cast( myVolume ); } diff --git a/src/SMDS/SMDS_VolumeTool.hxx b/src/SMDS/SMDS_VolumeTool.hxx index 3b637c839..ce54e9f9a 100644 --- a/src/SMDS/SMDS_VolumeTool.hxx +++ b/src/SMDS/SMDS_VolumeTool.hxx @@ -61,7 +61,7 @@ class SMDS_EXPORT SMDS_VolumeTool // Set volume. // Return false if theVolume is not of type SMDSAbs_Volume - const SMDS_MeshVolume* Get() const; + const SMDS_MeshVolume* Element() const; // return element int ID() const; @@ -210,6 +210,7 @@ private: int myNbFaces; int myVolumeNbNodes; const SMDS_MeshNode** myVolumeNodes; + std::vector< int > myPolyIndices; bool myExternalFaces; -- 2.39.2