mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-25 08:50:35 +05:00
small optimization
This commit is contained in:
parent
24a8566eb1
commit
896ab9bad6
@ -521,9 +521,7 @@ int SMDS_MeshCell::NbNodes() const
|
||||
{
|
||||
if ( GetVtkType() == VTK_POLYHEDRON )
|
||||
return static_cast< const SMDS_MeshVolume* >( this )->SMDS_MeshVolume::NbNodes();
|
||||
vtkIdType npts;
|
||||
vtkIdType const *pts;
|
||||
getGrid()->GetCellPoints( GetVtkID(), npts, pts );
|
||||
vtkIdType npts = getGrid()->GetCells()->GetCellSize( GetVtkID() );
|
||||
return npts;
|
||||
}
|
||||
|
||||
|
@ -9349,7 +9349,7 @@ void SMESH_MeshEditor::ConvertFromQuadratic(TIDSortedElemSet& theElements)
|
||||
const SMDS_MeshElement* eComplex = invIt2->next();
|
||||
if ( eComplex->IsQuadratic() && !allMediumNodesIn( eComplex, mediumNodes))
|
||||
{
|
||||
int nbCommonNodes = SMESH_MeshAlgos::GetCommonNodes( e, eComplex ).size();
|
||||
int nbCommonNodes = SMESH_MeshAlgos::NbCommonNodes( e, eComplex );
|
||||
if ( nbCommonNodes == e->NbNodes())
|
||||
{
|
||||
complexFound = true;
|
||||
|
@ -1098,7 +1098,7 @@ TopAbs_State SMESH_ElementSearcherImpl::GetPointState(const gp_Pnt& point)
|
||||
const SMDS_MeshElement* prevFace = u_int1->second._face;
|
||||
while ( ok && u_int2->second._coincides )
|
||||
{
|
||||
if ( SMESH_MeshAlgos::GetCommonNodes(prevFace , u_int2->second._face).empty() )
|
||||
if ( SMESH_MeshAlgos::NbCommonNodes(prevFace , u_int2->second._face) == 0 )
|
||||
ok = false;
|
||||
else
|
||||
{
|
||||
@ -2210,10 +2210,26 @@ bool SMESH_MeshAlgos::FaceNormal(const SMDS_MeshElement* F, gp_XYZ& normal, bool
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetCommonNodes
|
||||
//purpose : Return nodes common to two elements
|
||||
//=======================================================================
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return nodes common to two elements
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
int SMESH_MeshAlgos::NbCommonNodes(const SMDS_MeshElement* e1,
|
||||
const SMDS_MeshElement* e2)
|
||||
{
|
||||
int nb = 0;
|
||||
for ( int i = 0 ; i < e1->NbNodes(); ++i )
|
||||
nb += ( e2->GetNodeIndex( e1->GetNode( i )) >= 0 );
|
||||
return nb;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return nodes common to two elements
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
std::vector< const SMDS_MeshNode*> SMESH_MeshAlgos::GetCommonNodes(const SMDS_MeshElement* e1,
|
||||
const SMDS_MeshElement* e2)
|
||||
@ -2224,6 +2240,7 @@ std::vector< const SMDS_MeshNode*> SMESH_MeshAlgos::GetCommonNodes(const SMDS_Me
|
||||
common.push_back( e1->GetNode( i ));
|
||||
return common;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return true if node1 encounters first in the face and node2, after
|
||||
|
@ -187,6 +187,12 @@ namespace SMESH_MeshAlgos
|
||||
SMESHUtils_EXPORT
|
||||
bool FaceNormal(const SMDS_MeshElement* F, gp_XYZ& normal, bool normalized=true);
|
||||
|
||||
/*!
|
||||
* \brief Return number of nodes common to two elements
|
||||
*/
|
||||
SMESHUtils_EXPORT
|
||||
int NbCommonNodes(const SMDS_MeshElement* e1,
|
||||
const SMDS_MeshElement* e2);
|
||||
/*!
|
||||
* \brief Return nodes common to two elements
|
||||
*/
|
||||
|
@ -2981,8 +2981,8 @@ namespace
|
||||
bool isAdded = checkedCoplanar.insert( myLinks[iE].myFace ).second;
|
||||
if ( !isAdded )
|
||||
continue;
|
||||
toErase = SMESH_MeshAlgos::GetCommonNodes( myLinks[i ].myFace,
|
||||
myLinks[iE].myFace ).size() < 1;
|
||||
toErase = ( SMESH_MeshAlgos::NbCommonNodes( myLinks[i ].myFace,
|
||||
myLinks[iE].myFace ) < 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3075,7 +3075,7 @@ namespace
|
||||
//check if the faces are connected
|
||||
int nbCommonNodes = 0;
|
||||
if ( e.myFace && myFace )
|
||||
nbCommonNodes = SMESH_MeshAlgos::GetCommonNodes( e.myFace, myFace ).size();
|
||||
nbCommonNodes = SMESH_MeshAlgos::NbCommonNodes( e.myFace, myFace );
|
||||
bool toReplace = (( myIndex == _INTERNAL && nbCommonNodes > 1 ) ||
|
||||
( myIndex == _COPLANAR && nbCommonNodes < 2 ));
|
||||
if ( toReplace )
|
||||
|
@ -1369,7 +1369,7 @@ bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh&
|
||||
while ( vIt->more() )
|
||||
{
|
||||
const SMDS_MeshElement* PrmJ = vIt->next();
|
||||
if ( SMESH_MeshAlgos::GetCommonNodes( PrmI, PrmJ ).size() > 1 )
|
||||
if ( SMESH_MeshAlgos::NbCommonNodes( PrmI, PrmJ ) > 1 )
|
||||
checkedPyrams.insert( PrmJ );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user