0020672: EDF 1243 SMESH : Be able to transform mixed mesh

* Implement GetFaceNodesIndices() for polyhedrons
This commit is contained in:
eap 2010-03-30 12:32:41 +00:00
parent 2705c10eb5
commit 1f50f137e3
2 changed files with 16 additions and 14 deletions

View File

@ -447,14 +447,11 @@ SMDS_VolumeTool::SMDS_VolumeTool (const SMDS_MeshElement* theVolume)
SMDS_VolumeTool::~SMDS_VolumeTool() SMDS_VolumeTool::~SMDS_VolumeTool()
{ {
if (myVolumeNodes != NULL) { if ( myVolumeNodes != NULL ) delete [] myVolumeNodes;
delete [] myVolumeNodes; if ( myFaceNodes != NULL ) delete [] myFaceNodes;
myVolumeNodes = NULL;
} myFaceNodeIndices = NULL;
if (myFaceNodes != NULL) { myVolumeNodes = myFaceNodes = NULL;
delete [] myFaceNodes;
myFaceNodes = NULL;
}
} }
//======================================================================= //=======================================================================
@ -914,12 +911,16 @@ const SMDS_MeshNode** SMDS_VolumeTool::GetFaceNodes( int faceIndex )
const int* SMDS_VolumeTool::GetFaceNodesIndices( 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 )) if ( !setFace( faceIndex ))
return 0; 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; return myFaceNodeIndices;
} }
@ -1686,7 +1687,7 @@ int SMDS_VolumeTool::NbFaceNodes(VolumeType type,
//purpose : return element //purpose : return element
//======================================================================= //=======================================================================
const SMDS_MeshVolume* SMDS_VolumeTool::Get() const const SMDS_MeshVolume* SMDS_VolumeTool::Element() const
{ {
return static_cast<const SMDS_MeshVolume*>( myVolume ); return static_cast<const SMDS_MeshVolume*>( myVolume );
} }

View File

@ -61,7 +61,7 @@ class SMDS_EXPORT SMDS_VolumeTool
// Set volume. // Set volume.
// Return false if theVolume is not of type SMDSAbs_Volume // Return false if theVolume is not of type SMDSAbs_Volume
const SMDS_MeshVolume* Get() const; const SMDS_MeshVolume* Element() const;
// return element // return element
int ID() const; int ID() const;
@ -210,6 +210,7 @@ private:
int myNbFaces; int myNbFaces;
int myVolumeNbNodes; int myVolumeNbNodes;
const SMDS_MeshNode** myVolumeNodes; const SMDS_MeshNode** myVolumeNodes;
std::vector< int > myPolyIndices;
bool myExternalFaces; bool myExternalFaces;