0020511: EDF 1101 SMESH : Add CGNS to Mesh Format Supported

Fix setFace(): correctly take into account IsFaceExternal() for the polyhedron
This commit is contained in:
eap 2011-08-10 09:56:47 +00:00
parent 406dc55fef
commit db1a1fcbb7

View File

@ -952,7 +952,7 @@ bool SMDS_VolumeTool::GetFaceNodes (int faceIndex,
//======================================================================= //=======================================================================
//function : IsFaceExternal //function : IsFaceExternal
//purpose : Check normal orientation of a returned face //purpose : Check normal orientation of a given face
//======================================================================= //=======================================================================
bool SMDS_VolumeTool::IsFaceExternal( int faceIndex ) bool SMDS_VolumeTool::IsFaceExternal( int faceIndex )
@ -1545,24 +1545,24 @@ bool SMDS_VolumeTool::setFace( int faceIndex )
return false; return false;
} }
// check orientation
bool isGoodOri = true;
if (myExternalFaces)
isGoodOri = IsFaceExternal( faceIndex );
// set face nodes // set face nodes
int iNode; int iNode;
myFaceNbNodes = myPolyedre->NbFaceNodes(faceIndex + 1); myFaceNbNodes = myPolyedre->NbFaceNodes(faceIndex + 1);
myFaceNodes = new const SMDS_MeshNode* [myFaceNbNodes + 1]; myFaceNodes = new const SMDS_MeshNode* [myFaceNbNodes + 1];
if (isGoodOri) {
for ( iNode = 0; iNode < myFaceNbNodes; iNode++ ) for ( iNode = 0; iNode < myFaceNbNodes; iNode++ )
myFaceNodes[ iNode ] = myPolyedre->GetFaceNode(faceIndex + 1, iNode + 1); myFaceNodes[ iNode ] = myPolyedre->GetFaceNode(faceIndex + 1, iNode + 1);
} else {
for ( iNode = 0; iNode < myFaceNbNodes; iNode++ )
myFaceNodes[ iNode ] = myPolyedre->GetFaceNode(faceIndex + 1, myFaceNbNodes - iNode);
}
myFaceNodes[ myFaceNbNodes ] = myFaceNodes[ 0 ]; // last = first myFaceNodes[ myFaceNbNodes ] = myFaceNodes[ 0 ]; // last = first
// check orientation
if (myExternalFaces)
{
myCurFace = faceIndex; // avoid infinite recursion in IsFaceExternal()
myExternalFaces = false; // force normal computation by IsFaceExternal()
if ( !IsFaceExternal( faceIndex ))
for ( int i = 0, j = myFaceNbNodes; i < j; ++i, --j )
std::swap( myFaceNodes[i], myFaceNodes[j] );
myExternalFaces = true;
}
} }
else { else {
// choose face node indices // choose face node indices