mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-26 17:30:35 +05:00
PAL7731. Make ceiling faces normals external in makeWalls()
This commit is contained in:
parent
b9a4ef3658
commit
98b7f7a44e
@ -1656,9 +1656,9 @@ static void sweepElement(SMESHDS_Mesh* aMesh,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
static void makeWalls (SMESHDS_Mesh* aMesh,
|
static void makeWalls (SMESHDS_Mesh* aMesh,
|
||||||
TNodeOfNodeListMap& mapNewNodes,
|
TNodeOfNodeListMap & mapNewNodes,
|
||||||
TElemOfElemListMap& newElemsMap,
|
TElemOfElemListMap & newElemsMap,
|
||||||
TElemOfVecOfNnlmiMap& elemNewNodesMap,
|
TElemOfVecOfNnlmiMap & elemNewNodesMap,
|
||||||
set<const SMDS_MeshElement*>& elemSet)
|
set<const SMDS_MeshElement*>& elemSet)
|
||||||
{
|
{
|
||||||
ASSERT( newElemsMap.size() == elemNewNodesMap.size() );
|
ASSERT( newElemsMap.size() == elemNewNodesMap.size() );
|
||||||
@ -1691,38 +1691,42 @@ static void makeWalls (SMESHDS_Mesh* aMesh,
|
|||||||
{
|
{
|
||||||
const SMDS_MeshElement* elem = itElem->first;
|
const SMDS_MeshElement* elem = itElem->first;
|
||||||
vector<TNodeOfNodeListMapItr>& vecNewNodes = itElemNodes->second;
|
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;
|
bool hasFreeLinks = false;
|
||||||
|
|
||||||
set<const SMDS_MeshElement*> avoidSet;
|
set<const SMDS_MeshElement*> avoidSet;
|
||||||
avoidSet.insert( elem );
|
avoidSet.insert( elem );
|
||||||
|
|
||||||
// loop on element nodes
|
// loop on a face nodes
|
||||||
|
set<const SMDS_MeshNode*> aFaceLastNodes;
|
||||||
int iNode, nbNodes = vecNewNodes.size();
|
int iNode, nbNodes = vecNewNodes.size();
|
||||||
vector<const SMDS_MeshNode*> lastNewNode( nbNodes ); // to make ceiling
|
|
||||||
for ( iNode = 0; iNode < nbNodes; iNode++ )
|
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
|
// look for free links of a face
|
||||||
|
int iNext = ( iNode + 1 == nbNodes ) ? 0 : iNode + 1;
|
||||||
if ( elem->GetType() == SMDSAbs_Face )
|
const SMDS_MeshNode* n1 = vecNewNodes[ iNode ]->first;
|
||||||
|
const SMDS_MeshNode* n2 = vecNewNodes[ iNext ]->first;
|
||||||
|
// check if a link is free
|
||||||
|
if ( ! SMESH_MeshEditor::FindFaceInSet ( n1, n2, elemSet, avoidSet ))
|
||||||
{
|
{
|
||||||
// get 2 nodes
|
hasFreeLinks = true;
|
||||||
int iNext = ( iNode + 1 == nbNodes ) ? 0 : iNode + 1;
|
// make an edge and a ceiling for a new edge
|
||||||
const SMDS_MeshNode* n1 = vecNewNodes[ iNode ]->first;
|
if ( !aMesh->FindEdge( n1, n2 ))
|
||||||
const SMDS_MeshNode* n2 = vecNewNodes[ iNext ]->first;
|
aMesh->AddEdge( n1, n2 );
|
||||||
// check if a link is free
|
n1 = vecNewNodes[ iNode ]->second.back();
|
||||||
if ( ! SMESH_MeshEditor::FindFaceInSet ( n1, n2, elemSet, avoidSet ))
|
n2 = vecNewNodes[ iNext ]->second.back();
|
||||||
{
|
if ( !aMesh->FindEdge( n1, n2 ))
|
||||||
hasFreeLinks = true;
|
aMesh->AddEdge( n1, n2 );
|
||||||
// make an edge and a ceiling for a new edge
|
|
||||||
if ( !aMesh->FindEdge( n1, n2 ))
|
|
||||||
aMesh->AddEdge( n1, n2 );
|
|
||||||
n1 = vecNewNodes[ iNode ]->second.back();
|
|
||||||
n2 = vecNewNodes[ iNext ]->second.back();
|
|
||||||
if ( !aMesh->FindEdge( n1, n2 ))
|
|
||||||
aMesh->AddEdge( n1, n2 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// sweep free links into faces
|
// sweep free links into faces
|
||||||
@ -1777,27 +1781,29 @@ static void makeWalls (SMESHDS_Mesh* aMesh,
|
|||||||
}
|
}
|
||||||
} // sweep free links into faces
|
} // 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 ) {
|
SMDS_VolumeTool lastVol( itElem->second.back() );
|
||||||
case 2:
|
int iF = lastVol.GetFaceIndex( aFaceLastNodes );
|
||||||
aMesh->AddEdge(lastNewNode[ 0 ], lastNewNode[ 1 ]);
|
if ( iF >= 0 )
|
||||||
break;
|
{
|
||||||
case 3:
|
lastVol.SetExternalNormal();
|
||||||
if (!hasFreeLinks ||
|
const SMDS_MeshNode** nodes = lastVol.GetFaceNodes( iF );
|
||||||
!aMesh->FindFace( lastNewNode[ 0 ], lastNewNode[ 2 ], lastNewNode[ 1 ]))
|
switch ( lastVol.NbFaceNodes( iF ) ) {
|
||||||
aMesh->AddFace (lastNewNode[ 0 ], lastNewNode[ 2 ], lastNewNode[ 1 ]);
|
case 3:
|
||||||
break;
|
if (!hasFreeLinks ||
|
||||||
case 4:
|
!aMesh->FindFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ]))
|
||||||
if (!hasFreeLinks ||
|
aMesh->AddFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ] );
|
||||||
!aMesh->FindFace (lastNewNode[ 0 ], lastNewNode[ 3 ],
|
break;
|
||||||
lastNewNode[ 2 ], lastNewNode[ 1 ]))
|
case 4:
|
||||||
aMesh->AddFace (lastNewNode[ 0 ], lastNewNode[ 3 ],
|
if (!hasFreeLinks ||
|
||||||
lastNewNode[ 2 ], lastNewNode[ 1 ]);
|
!aMesh->FindFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ], nodes[ 3 ]))
|
||||||
break;
|
aMesh->AddFace( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ], nodes[ 3 ] );
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // loop on elements
|
} // loop on swept elements
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user