mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-14 09:38:33 +05:00
Implement better check for over-constrained volumes and faces
wip
This commit is contained in:
parent
a9219e5f12
commit
067472c5cf
@ -24,4 +24,4 @@ assert( not mesh.GetIdsFromFilter( faceFilter ))
|
|||||||
|
|
||||||
# make faces
|
# make faces
|
||||||
mesh.ExtrusionSweep([edge], smesh.MakeDirStruct(0,7,0), 5)
|
mesh.ExtrusionSweep([edge], smesh.MakeDirStruct(0,7,0), 5)
|
||||||
assert( 2 == len( mesh.GetIdsFromFilter( faceFilter )))
|
assert( 5 == len( mesh.GetIdsFromFilter( faceFilter )))
|
||||||
|
@ -22,4 +22,4 @@ n2 = mesh.AddNode(10,0,0)
|
|||||||
edge = mesh.AddEdge([n1,n2])
|
edge = mesh.AddEdge([n1,n2])
|
||||||
mesh.ExtrusionSweep([edge], smesh.MakeDirStruct(0,7,0), 1)
|
mesh.ExtrusionSweep([edge], smesh.MakeDirStruct(0,7,0), 1)
|
||||||
mesh.ExtrusionSweep( mesh.GetElementsByType(SMESH.FACE), smesh.MakeDirStruct(0,0,5), 7)
|
mesh.ExtrusionSweep( mesh.GetElementsByType(SMESH.FACE), smesh.MakeDirStruct(0,0,5), 7)
|
||||||
assert( 2 == len( mesh.GetIdsFromFilter( volumeFilter )))
|
assert( 7 == len( mesh.GetIdsFromFilter( volumeFilter )))
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
Over-constrained faces
|
Over-constrained faces
|
||||||
**********************
|
**********************
|
||||||
|
|
||||||
This mesh quality control highlights faces sharing only one border with other faces.
|
This mesh quality control highlights faces having all their points on the border.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
The highlighted faces are actually over-constrained only if, at the computation time, the boundary conditions on the borders where the nodes are located are all Dirichlet boundary conditions.
|
The highlighted faces are actually over-constrained only if, at the computation time, the boundary conditions on the borders where the nodes are located are all Dirichlet boundary conditions.
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
Over-constrained volumes
|
Over-constrained volumes
|
||||||
************************
|
************************
|
||||||
|
|
||||||
This mesh quality control highlights volumes sharing only one border with other volumes.
|
This mesh quality control highlights volumes having all their points on the border.
|
||||||
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
@ -2469,16 +2469,22 @@ bool BareBorderFace::IsSatisfy(long theElementId )
|
|||||||
|
|
||||||
bool OverConstrainedVolume::IsSatisfy(long theElementId )
|
bool OverConstrainedVolume::IsSatisfy(long theElementId )
|
||||||
{
|
{
|
||||||
// An element is over-constrained if it has N-1 free borders where
|
// An element is over-constrained if all its nodes are on the boundary.
|
||||||
// N is the number of edges/faces for a 2D/3D element.
|
// A node is on the boundary if it is connected to one or more faces.
|
||||||
SMDS_VolumeTool myTool;
|
SMDS_VolumeTool myTool;
|
||||||
if (myTool.Set(myMesh->FindElement(theElementId)))
|
if (myTool.Set(myMesh->FindElement(theElementId)))
|
||||||
{
|
{
|
||||||
int nbSharedFaces = 0;
|
auto nodes = myTool.GetNodes();
|
||||||
for ( int iF = 0; iF < myTool.NbFaces(); ++iF )
|
|
||||||
if ( !myTool.IsFreeFace( iF ) && ++nbSharedFaces > 1 )
|
for (int i = 0; i < myTool.NbNodes(); ++i)
|
||||||
break;
|
{
|
||||||
return ( nbSharedFaces == 1 );
|
auto node = nodes[i];
|
||||||
|
if (node->NbInverseElements(SMDSAbs_Face) == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2491,29 +2497,19 @@ bool OverConstrainedVolume::IsSatisfy(long theElementId )
|
|||||||
|
|
||||||
bool OverConstrainedFace::IsSatisfy(long theElementId )
|
bool OverConstrainedFace::IsSatisfy(long theElementId )
|
||||||
{
|
{
|
||||||
// An element is over-constrained if it has N-1 free borders where
|
// An element is over-constrained if all its nodes are on the boundary.
|
||||||
// N is the number of edges/faces for a 2D/3D element.
|
// A node is on the boundary if it is connected to one or more faces.
|
||||||
if (const SMDS_MeshElement *face = myMesh->FindElement(theElementId))
|
if (const SMDS_MeshElement *face = myMesh->FindElement(theElementId))
|
||||||
if (face->GetType() == SMDSAbs_Face)
|
if (face->GetType() == SMDSAbs_Face)
|
||||||
{
|
{
|
||||||
int nbSharedBorders = 0;
|
|
||||||
int nbN = face->NbCornerNodes();
|
int nbN = face->NbCornerNodes();
|
||||||
for (int i = 0; i < nbN; ++i)
|
for (int i = 0; i < nbN; ++i)
|
||||||
{
|
{
|
||||||
// check if a link is shared by another face
|
|
||||||
const SMDS_MeshNode *n1 = face->GetNode(i);
|
const SMDS_MeshNode *n1 = face->GetNode(i);
|
||||||
const SMDS_MeshNode* n2 = face->GetNode( (i+1)%nbN );
|
if (n1->NbInverseElements(SMDSAbs_Edge) == 0)
|
||||||
SMDS_ElemIteratorPtr fIt = n1->GetInverseElementIterator( SMDSAbs_Face );
|
return false;
|
||||||
bool isShared = false;
|
|
||||||
while ( !isShared && fIt->more() )
|
|
||||||
{
|
|
||||||
const SMDS_MeshElement* f = fIt->next();
|
|
||||||
isShared = ( f != face && f->GetNodeIndex(n2) != -1 );
|
|
||||||
}
|
}
|
||||||
if ( isShared && ++nbSharedBorders > 1 )
|
return true;
|
||||||
break;
|
|
||||||
}
|
|
||||||
return ( nbSharedBorders == 1 );
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user