#include <SMESH_ControlsDef.hxx>

Public Member Functions | |
| FreeFaces () | |
| virtual void | SetMesh (const SMDS_Mesh *theMesh) |
| virtual bool | IsSatisfy (long theElementId) |
| virtual SMDSAbs_ElementType | GetType () const |
Private Attributes | |
| const SMDS_Mesh * | myMesh |
Definition at line 807 of file SMESH_ControlsDef.hxx.
| FreeFaces::FreeFaces | ( | ) |
Definition at line 2274 of file SMESH_Controls.cxx.
References SMESH.Controls.FreeEdges.myMesh.
{
myMesh = 0;
}
| SMDSAbs_ElementType FreeFaces::GetType | ( | ) | const [virtual] |
Implements SMESH.Controls.Predicate.
Definition at line 2320 of file SMESH_Controls.cxx.
References SMDSAbs_Face.
{
return SMDSAbs_Face;
}
| bool FreeFaces::IsSatisfy | ( | long | theElementId | ) | [virtual] |
Implements SMESH.Controls.Predicate.
Definition at line 2284 of file SMESH_Controls.cxx.
References SMDS_Mesh.FindElement(), SMDS_MeshNode.GetInverseElementIterator(), SMDS_MeshElement.GetType(), SMESH.Controls.FreeEdges.myMesh, SMDS_MeshElement.NbNodes(), SMDS_MeshElement.nodesIterator(), SMDSAbs_Face, and SMDSAbs_Volume.
{
if (!myMesh) return false;
// check that faces nodes refers to less than two common volumes
const SMDS_MeshElement* aFace = myMesh->FindElement( theId );
if ( !aFace || aFace->GetType() != SMDSAbs_Face )
return false;
int nbNode = aFace->NbNodes();
// collect volumes check that number of volumss with count equal nbNode not less than 2
typedef map< SMDS_MeshElement*, int > TMapOfVolume; // map of volume counters
typedef map< SMDS_MeshElement*, int >::iterator TItrMapOfVolume; // iterator
TMapOfVolume mapOfVol;
SMDS_ElemIteratorPtr nodeItr = aFace->nodesIterator();
while ( nodeItr->more() ) {
const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(nodeItr->next());
if ( !aNode ) continue;
SMDS_ElemIteratorPtr volItr = aNode->GetInverseElementIterator(SMDSAbs_Volume);
while ( volItr->more() ) {
SMDS_MeshElement* aVol = (SMDS_MeshElement*)volItr->next();
TItrMapOfVolume itr = mapOfVol.insert(make_pair(aVol, 0)).first;
(*itr).second++;
}
}
int nbVol = 0;
TItrMapOfVolume volItr = mapOfVol.begin();
TItrMapOfVolume volEnd = mapOfVol.end();
for ( ; volItr != volEnd; ++volItr )
if ( (*volItr).second >= nbNode )
nbVol++;
// face is not free if number of volumes constructed on thier nodes more than one
return (nbVol < 2);
}
| void FreeFaces::SetMesh | ( | const SMDS_Mesh * | theMesh | ) | [virtual] |
Implements SMESH.Controls.Functor.
Definition at line 2279 of file SMESH_Controls.cxx.
References SMESH.Controls.FreeEdges.myMesh.
{
myMesh = theMesh;
}
const SMDS_Mesh* SMESH.Controls.FreeFaces.myMesh [private] |
Definition at line 815 of file SMESH_ControlsDef.hxx.