mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-27 20:30:32 +05:00
Make IsFreeFace() fast, the old implementation of IsFreeFace() is renamed -> IsFreeFaceAdv()
bool IsFreeFace( int faceIndex, const SMDS_MeshElement** otherVol=0 ) const; - // Check that all volumes built on the face nodes lays on one side + // Fast check that only one volume is built on nodes of a given face + // otherVol returns another volume sharing the given facet + + bool IsFreeFaceAdv( int faceIndex, const SMDS_MeshElement** otherVol=0 ) const; + // Thorough check that all volumes built on the face nodes lays on one side + bool IsPoly() const { return myPolyedre; }
This commit is contained in:
parent
580dfddb72
commit
5030955be8
@ -1493,9 +1493,7 @@ double SMDS_VolumeTool::MaxLinearSize2() const
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief check that only one volume is build on the face nodes
|
||||
*
|
||||
* If a face is shared by one of <ignoreVolumes>, it is considered free
|
||||
* \brief fast check that only one volume is build on the face nodes
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
@ -1503,6 +1501,45 @@ bool SMDS_VolumeTool::IsFreeFace( int faceIndex, const SMDS_MeshElement** otherV
|
||||
{
|
||||
const bool isFree = true;
|
||||
|
||||
if (!setFace( faceIndex ))
|
||||
return !isFree;
|
||||
|
||||
const SMDS_MeshNode** nodes = GetFaceNodes( faceIndex );
|
||||
|
||||
// a set of facet nodes w/o medium ones and w/o nodes[0]
|
||||
set< const SMDS_MeshNode* > nodeSet;
|
||||
const int di = myVolume->IsQuadratic() ? 2 : 1;
|
||||
for ( int i = di; i < myFaceNbNodes; i += di )
|
||||
nodeSet.insert( nodes[i] );
|
||||
|
||||
SMDS_ElemIteratorPtr eIt = nodes[0]->GetInverseElementIterator( SMDSAbs_Volume );
|
||||
while ( eIt->more() ) {
|
||||
const SMDS_MeshElement* vol = eIt->next();
|
||||
if ( vol != myVolume ) {
|
||||
size_t nbShared = 0;
|
||||
SMDS_NodeIteratorPtr nIt = vol->nodeIterator();
|
||||
while ( nIt->more() )
|
||||
if (( nbShared += nodeSet.count( nIt->next() )) == nodeSet.size() )
|
||||
{
|
||||
if ( otherVol ) *otherVol = vol;
|
||||
return !isFree;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( otherVol ) *otherVol = 0;
|
||||
return isFree;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Thorough check that only one volume is build on the face nodes
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
bool SMDS_VolumeTool::IsFreeFaceAdv( int faceIndex, const SMDS_MeshElement** otherVol/*=0*/ ) const
|
||||
{
|
||||
const bool isFree = true;
|
||||
|
||||
if (!setFace( faceIndex ))
|
||||
return !isFree;
|
||||
|
||||
@ -1621,14 +1658,16 @@ bool SMDS_VolumeTool::IsFreeFace( int faceIndex, const SMDS_MeshElement** otherV
|
||||
|
||||
int SMDS_VolumeTool::GetFaceIndex( const set<const SMDS_MeshNode*>& theFaceNodes ) const
|
||||
{
|
||||
for ( int iFace = 0; iFace < myNbFaces; iFace++ ) {
|
||||
const SMDS_MeshNode** nodes = GetFaceNodes( iFace );
|
||||
int nbFaceNodes = NbFaceNodes( iFace );
|
||||
set<const SMDS_MeshNode*> nodeSet;
|
||||
for ( int iNode = 0; iNode < nbFaceNodes; iNode++ )
|
||||
nodeSet.insert( nodes[ iNode ] );
|
||||
if ( theFaceNodes == nodeSet )
|
||||
return iFace;
|
||||
for ( int iFace = 0; iFace < myNbFaces; iFace++ )
|
||||
{
|
||||
const int nbNodes = NbFaceNodes( iFace );
|
||||
if ( nbNodes == (int) theFaceNodes.size() )
|
||||
{
|
||||
const SMDS_MeshNode** nodes = GetFaceNodes( iFace );
|
||||
set<const SMDS_MeshNode*> nodeSet( nodes, nodes + nbNodes);
|
||||
if ( theFaceNodes == nodeSet )
|
||||
return iFace;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
@ -73,6 +73,8 @@ class SMDS_EXPORT SMDS_VolumeTool
|
||||
int ID() const;
|
||||
// return element ID
|
||||
|
||||
bool IsPoly() const { return myPolyedre; }
|
||||
|
||||
// -----------------------
|
||||
// general info
|
||||
// -----------------------
|
||||
@ -177,7 +179,11 @@ class SMDS_EXPORT SMDS_VolumeTool
|
||||
// SetExternalNormal() is taken into account.
|
||||
|
||||
bool IsFreeFace( int faceIndex, const SMDS_MeshElement** otherVol=0 ) const;
|
||||
// Check that all volumes built on the face nodes lays on one side
|
||||
// Fast check that only one volume is built on nodes of a given face
|
||||
// otherVol returns another volume sharing the given facet
|
||||
|
||||
bool IsFreeFaceAdv( int faceIndex, const SMDS_MeshElement** otherVol=0 ) const;
|
||||
// Thorough check that all volumes built on the face nodes lays on one side
|
||||
// otherVol returns another volume sharing the given facet
|
||||
|
||||
bool GetFaceNormal (int faceIndex, double & X, double & Y, double & Z) const;
|
||||
|
Loading…
Reference in New Issue
Block a user