#include <SMESH_Filter_i.hxx>

Public Member Functions | |
| LyingOnGeom () | |
| virtual void | SetMesh (const SMDS_Mesh *theMesh) |
| virtual void | SetGeom (const TopoDS_Shape &theShape) |
| virtual bool | IsSatisfy (long theElementId) |
| virtual void | SetType (SMDSAbs_ElementType theType) |
| virtual SMDSAbs_ElementType | GetType () const |
| TopoDS_Shape | GetShape () |
| const SMESHDS_Mesh * | GetMeshDS () const |
| void | SetTolerance (double) |
| double | GetTolerance () |
| virtual bool | Contains (const SMESHDS_Mesh *theMeshDS, const TopoDS_Shape &theShape, const SMDS_MeshElement *theElem, TopAbs_ShapeEnum theFindShapeEnum, TopAbs_ShapeEnum theAvoidShapeEnum=TopAbs_SHAPE) |
Private Member Functions | |
| virtual void | init () |
Private Attributes | |
| TopoDS_Shape | myShape |
| const SMESHDS_Mesh * | myMeshDS |
| SMDSAbs_ElementType | myType |
| bool | myIsSubshape |
| double | myTolerance |
| Controls::ElementsOnShapePtr | myElementsOnShapePtr |
Definition at line 92 of file SMESH_Filter_i.hxx.
| Controls::LyingOnGeom::LyingOnGeom | ( | ) |
Definition at line 261 of file SMESH_Filter_i.cxx.
: myMeshDS(NULL), myType(SMDSAbs_All), myIsSubshape(false), myTolerance(Precision::Confusion()) {}
| bool Controls::LyingOnGeom::Contains | ( | const SMESHDS_Mesh * | theMeshDS, |
| const TopoDS_Shape & | theShape, | ||
| const SMDS_MeshElement * | theElem, | ||
| TopAbs_ShapeEnum | theFindShapeEnum, | ||
| TopAbs_ShapeEnum | theAvoidShapeEnum = TopAbs_SHAPE |
||
| ) | [virtual] |
Definition at line 391 of file SMESH_Filter_i.cxx.
References SMESH_fixation.aShape, SMDS_MeshNode.GetInverseElementIterator(), IsContains(), and SMESHDS_Mesh.MeshElements().
{
if (IsContains(theMeshDS, theShape, theElem, theFindShapeEnum, theAvoidShapeEnum))
return true;
TopTools_IndexedMapOfShape aSubShapes;
TopExp::MapShapes( theShape, aSubShapes );
for (int i = 1; i <= aSubShapes.Extent(); i++)
{
const TopoDS_Shape& aShape = aSubShapes.FindKey(i);
if( SMESHDS_SubMesh* aSubMesh = theMeshDS->MeshElements( aShape ) ){
if( aSubMesh->Contains( theElem ) )
return true;
SMDS_NodeIteratorPtr aNodeIt = aSubMesh->GetNodes();
while ( aNodeIt->more() )
{
const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(aNodeIt->next());
SMDS_ElemIteratorPtr anElemIt = aNode->GetInverseElementIterator();
while ( anElemIt->more() )
{
const SMDS_MeshElement* anElement = static_cast<const SMDS_MeshElement*>(anElemIt->next());
if (anElement == theElem)
return true;
}
}
}
}
return false;
}
| const SMESHDS_Mesh * Controls::LyingOnGeom::GetMeshDS | ( | ) | const |
Definition at line 374 of file SMESH_Filter_i.cxx.
{
return myMeshDS;
}
| TopoDS_Shape Controls::LyingOnGeom::GetShape | ( | ) |
Definition at line 369 of file SMESH_Filter_i.cxx.
{
return myShape;
}
| double Controls::LyingOnGeom::GetTolerance | ( | ) |
Definition at line 386 of file SMESH_Filter_i.cxx.
{
return myTolerance;
}
| SMDSAbs_ElementType Controls::LyingOnGeom::GetType | ( | ) | const [virtual] |
Implements SMESH.Controls.Predicate.
Definition at line 364 of file SMESH_Filter_i.cxx.
{
return myType;
}
| void Controls::LyingOnGeom::init | ( | ) | [private, virtual] |
Definition at line 280 of file SMESH_Filter_i.cxx.
References IsSubShape().
{
if (!myMeshDS || myShape.IsNull()) return;
// is subshape of main shape?
TopoDS_Shape aMainShape = myMeshDS->ShapeToMesh();
if (aMainShape.IsNull()) {
myIsSubshape = false;
}
else {
TopTools_IndexedMapOfShape aMap;
TopExp::MapShapes(aMainShape, aMap);
myIsSubshape = IsSubShape(aMap, myShape);
}
if (!myIsSubshape)
{
myElementsOnShapePtr.reset(new Controls::ElementsOnShape());
myElementsOnShapePtr->SetTolerance(myTolerance);
myElementsOnShapePtr->SetAllNodes(false); // lays on, while true means "belong"
myElementsOnShapePtr->SetMesh(myMeshDS);
myElementsOnShapePtr->SetShape(myShape, myType);
}
}
| bool Controls::LyingOnGeom::IsSatisfy | ( | long | theElementId | ) | [virtual] |
Implements SMESH.Controls.Predicate.
Definition at line 305 of file SMESH_Filter_i.cxx.
References SMDS_Position.GetTypeOfPosition(), IsContains(), SMDS_TOP_3DSPACE, SMDS_TOP_EDGE, SMDS_TOP_FACE, SMDS_TOP_VERTEX, SMDSAbs_All, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Node, and SMDSAbs_Volume.
{
if ( myMeshDS == 0 || myShape.IsNull() )
return false;
if (!myIsSubshape)
{
return myElementsOnShapePtr->IsSatisfy(theId);
}
// Case of submesh
if( myType == SMDSAbs_Node )
{
if( const SMDS_MeshNode* aNode = myMeshDS->FindNode( theId ) )
{
const SMDS_PositionPtr& aPosition = aNode->GetPosition();
SMDS_TypeOfPosition aTypeOfPosition = aPosition->GetTypeOfPosition();
switch( aTypeOfPosition )
{
case SMDS_TOP_VERTEX : return IsContains( myMeshDS,myShape,aNode,TopAbs_VERTEX );
case SMDS_TOP_EDGE : return IsContains( myMeshDS,myShape,aNode,TopAbs_EDGE );
case SMDS_TOP_FACE : return IsContains( myMeshDS,myShape,aNode,TopAbs_FACE );
case SMDS_TOP_3DSPACE: return IsContains( myMeshDS,myShape,aNode,TopAbs_SHELL );
}
}
}
else
{
if( const SMDS_MeshElement* anElem = myMeshDS->FindElement( theId ) )
{
if( myType == SMDSAbs_All )
{
return Contains( myMeshDS,myShape,anElem,TopAbs_EDGE ) ||
Contains( myMeshDS,myShape,anElem,TopAbs_FACE ) ||
Contains( myMeshDS,myShape,anElem,TopAbs_SHELL )||
Contains( myMeshDS,myShape,anElem,TopAbs_SOLID );
}
else if( myType == anElem->GetType() )
{
switch( myType )
{
case SMDSAbs_Edge : return Contains( myMeshDS,myShape,anElem,TopAbs_EDGE );
case SMDSAbs_Face : return Contains( myMeshDS,myShape,anElem,TopAbs_FACE );
case SMDSAbs_Volume: return Contains( myMeshDS,myShape,anElem,TopAbs_SHELL )||
Contains( myMeshDS,myShape,anElem,TopAbs_SOLID );
}
}
}
}
return false;
}
| void Controls::LyingOnGeom::SetGeom | ( | const TopoDS_Shape & | theShape | ) | [virtual] |
Definition at line 274 of file SMESH_Filter_i.cxx.
| void Controls::LyingOnGeom::SetMesh | ( | const SMDS_Mesh * | theMesh | ) | [virtual] |
Implements SMESH.Controls.Functor.
Definition at line 268 of file SMESH_Filter_i.cxx.
{
myMeshDS = dynamic_cast<const SMESHDS_Mesh*>(theMesh);
init();
}
| void Controls::LyingOnGeom::SetTolerance | ( | double | theTolerance | ) |
Definition at line 379 of file SMESH_Filter_i.cxx.
{
myTolerance = theTolerance;
if (!myIsSubshape)
init();
}
| void Controls::LyingOnGeom::SetType | ( | SMDSAbs_ElementType | theType | ) | [virtual] |
Definition at line 358 of file SMESH_Filter_i.cxx.
Definition at line 124 of file SMESH_Filter_i.hxx.
bool SMESH.Controls.LyingOnGeom.myIsSubshape [private] |
Definition at line 122 of file SMESH_Filter_i.hxx.
const SMESHDS_Mesh* SMESH.Controls.LyingOnGeom.myMeshDS [private] |
Definition at line 120 of file SMESH_Filter_i.hxx.
TopoDS_Shape SMESH.Controls.LyingOnGeom.myShape [private] |
Definition at line 119 of file SMESH_Filter_i.hxx.
double SMESH.Controls.LyingOnGeom.myTolerance [private] |
Definition at line 123 of file SMESH_Filter_i.hxx.
Definition at line 121 of file SMESH_Filter_i.hxx.