PAL7731. Make ceiling faces normals external in makeWalls()

This commit is contained in:
eap 2005-01-17 11:11:54 +00:00
parent b9a4ef3658
commit 98b7f7a44e

View File

@ -1691,23 +1691,28 @@ static void makeWalls (SMESHDS_Mesh* aMesh,
{
const SMDS_MeshElement* elem = itElem->first;
vector<TNodeOfNodeListMapItr>& vecNewNodes = itElemNodes->second;
if ( elem->GetType() == SMDSAbs_Edge )
{
// create a ceiling edge
aMesh->AddEdge(vecNewNodes[ 0 ]->second.back(),
vecNewNodes[ 1 ]->second.back() );
}
if ( elem->GetType() != SMDSAbs_Face )
continue;
bool hasFreeLinks = false;
set<const SMDS_MeshElement*> avoidSet;
avoidSet.insert( elem );
// loop on element nodes
// loop on a face nodes
set<const SMDS_MeshNode*> aFaceLastNodes;
int iNode, nbNodes = vecNewNodes.size();
vector<const SMDS_MeshNode*> lastNewNode( nbNodes ); // to make ceiling
for ( iNode = 0; iNode < nbNodes; iNode++ )
{
lastNewNode[ iNode ] = vecNewNodes[ iNode ]->second.back();
aFaceLastNodes.insert( vecNewNodes[ iNode ]->second.back() );
// look for free links of a face
if ( elem->GetType() == SMDSAbs_Face )
{
// get 2 nodes
int iNext = ( iNode + 1 == nbNodes ) ? 0 : iNode + 1;
const SMDS_MeshNode* n1 = vecNewNodes[ iNode ]->first;
const SMDS_MeshNode* n2 = vecNewNodes[ iNext ]->first;
@ -1724,7 +1729,6 @@ static void makeWalls (SMESHDS_Mesh* aMesh,
aMesh->AddEdge( n1, n2 );
}
}
}
// sweep free links into faces
if ( hasFreeLinks )
@ -1777,27 +1781,29 @@ static void makeWalls (SMESHDS_Mesh* aMesh,
}
} // sweep free links into faces
// create a ceiling element, faces will be reversed
// make a ceiling face with a normal external to a volume
switch ( nbNodes ) {
case 2:
aMesh->AddEdge(lastNewNode[ 0 ], lastNewNode[ 1 ]);
break;
SMDS_VolumeTool lastVol( itElem->second.back() );
int iF = lastVol.GetFaceIndex( aFaceLastNodes );
if ( iF >= 0 )
{
lastVol.SetExternalNormal();
const SMDS_MeshNode** nodes = lastVol.GetFaceNodes( iF );
switch ( lastVol.NbFaceNodes( iF ) ) {
case 3:
if (!hasFreeLinks ||
!aMesh->FindFace( lastNewNode[ 0 ], lastNewNode[ 2 ], lastNewNode[ 1 ]))
aMesh->AddFace (lastNewNode[ 0 ], lastNewNode[ 2 ], lastNewNode[ 1 ]);
!aMesh->FindFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ]))
aMesh->AddFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ] );
break;
case 4:
if (!hasFreeLinks ||
!aMesh->FindFace (lastNewNode[ 0 ], lastNewNode[ 3 ],
lastNewNode[ 2 ], lastNewNode[ 1 ]))
aMesh->AddFace (lastNewNode[ 0 ], lastNewNode[ 3 ],
lastNewNode[ 2 ], lastNewNode[ 1 ]);
!aMesh->FindFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ], nodes[ 3 ]))
aMesh->AddFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ], nodes[ 3 ] );
break;
}
}
} // loop on elements
} // loop on swept elements
}
//=======================================================================