mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 17:00:34 +05:00
PAL7358. Now Reorient() can work with edge, faces and volumes
This commit is contained in:
parent
4f7811fdb1
commit
08e0a4de43
@ -470,34 +470,40 @@ bool SMESH_MeshEditor::DeleteDiag (const SMDS_MeshNode * theNode1,
|
|||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : Reorient
|
//function : Reorient
|
||||||
//purpose : Reverse the normal of theFace
|
//purpose : Reverse theElement orientation
|
||||||
// Return false if theFace is null
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
bool SMESH_MeshEditor::Reorient (const SMDS_MeshElement * theFace)
|
bool SMESH_MeshEditor::Reorient (const SMDS_MeshElement * theElem)
|
||||||
{
|
{
|
||||||
if (!theFace) return false;
|
if (!theElem)
|
||||||
const SMDS_FaceOfNodes* F = dynamic_cast<const SMDS_FaceOfNodes*>( theFace );
|
return false;
|
||||||
if (!F) return false;
|
SMDS_ElemIteratorPtr it = theElem->nodesIterator();
|
||||||
|
if ( !it || !it->more() )
|
||||||
|
return false;
|
||||||
|
|
||||||
const SMDS_MeshNode* aNodes [4], *tmpNode;
|
switch ( theElem->GetType() ) {
|
||||||
int i = 0;
|
|
||||||
SMDS_ElemIteratorPtr it = theFace->nodesIterator();
|
case SMDSAbs_Edge:
|
||||||
|
case SMDSAbs_Face:
|
||||||
|
{
|
||||||
|
int i = theElem->NbNodes();
|
||||||
|
vector<const SMDS_MeshNode*> aNodes( i );
|
||||||
while ( it->more() )
|
while ( it->more() )
|
||||||
aNodes[ i++ ] = static_cast<const SMDS_MeshNode*>( it->next() );
|
aNodes[ --i ]= static_cast<const SMDS_MeshNode*>( it->next() );
|
||||||
|
return GetMeshDS()->ChangeElementNodes( theElem, &aNodes[0], theElem->NbNodes() );
|
||||||
|
}
|
||||||
|
case SMDSAbs_Volume:
|
||||||
|
{
|
||||||
|
SMDS_VolumeTool vTool;
|
||||||
|
if ( !vTool.Set( theElem ))
|
||||||
|
return false;
|
||||||
|
vTool.Inverse();
|
||||||
|
return GetMeshDS()->ChangeElementNodes( theElem, vTool.GetNodes(), vTool.NbNodes() );
|
||||||
|
}
|
||||||
|
default:;
|
||||||
|
}
|
||||||
|
|
||||||
// exchange nodes with indeces 0 and 2
|
return false;
|
||||||
tmpNode = aNodes[ 0 ];
|
|
||||||
aNodes[ 0 ] = aNodes[ 2 ];
|
|
||||||
aNodes[ 2 ] = tmpNode;
|
|
||||||
|
|
||||||
//MESSAGE( theFace );
|
|
||||||
|
|
||||||
GetMeshDS()->ChangeElementNodes( theFace, aNodes, theFace->NbNodes() );
|
|
||||||
|
|
||||||
//MESSAGE( theFace );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -70,9 +70,8 @@ class SMESH_MeshEditor {
|
|||||||
// with a quadrangle built on the same 4 nodes.
|
// with a quadrangle built on the same 4 nodes.
|
||||||
// Return false if proper faces not found
|
// Return false if proper faces not found
|
||||||
|
|
||||||
bool Reorient (const SMDS_MeshElement * theFace);
|
bool Reorient (const SMDS_MeshElement * theElement);
|
||||||
// Reverse the normal of theFace
|
// Reverse theElement orientation
|
||||||
// Return false if theFace is null
|
|
||||||
|
|
||||||
|
|
||||||
bool TriToQuad (std::set<const SMDS_MeshElement*> & theElems,
|
bool TriToQuad (std::set<const SMDS_MeshElement*> & theElems,
|
||||||
|
Loading…
Reference in New Issue
Block a user