#include <SMESH_ControlsDef.hxx>

Public Member Functions | |
| ElementsOnShape () | |
| ~ElementsOnShape () | |
| virtual void | SetMesh (const SMDS_Mesh *theMesh) |
| virtual bool | IsSatisfy (long theElementId) |
| virtual SMDSAbs_ElementType | GetType () const |
| void | SetTolerance (const double theToler) |
| double | GetTolerance () const |
| void | SetAllNodes (bool theAllNodes) |
| bool | GetAllNodes () const |
| void | SetShape (const TopoDS_Shape &theShape, const SMDSAbs_ElementType theType) |
Private Member Functions | |
| void | addShape (const TopoDS_Shape &theShape) |
| void | process () |
| void | process (const SMDS_MeshElement *theElem) |
Private Attributes | |
| const SMDS_Mesh * | myMesh |
| TColStd_MapOfInteger | myIds |
| SMDSAbs_ElementType | myType |
| TopoDS_Shape | myShape |
| double | myToler |
| bool | myAllNodesFlag |
| TopTools_MapOfShape | myShapesMap |
| TopAbs_ShapeEnum | myCurShapeType |
| BRepClass3d_SolidClassifier | myCurSC |
| GeomAPI_ProjectPointOnSurf | myCurProjFace |
| TopoDS_Face | myCurFace |
| GeomAPI_ProjectPointOnCurve | myCurProjEdge |
| gp_Pnt | myCurPnt |
Definition at line 761 of file SMESH_ControlsDef.hxx.
| ElementsOnShape::ElementsOnShape | ( | ) |
Definition at line 3574 of file SMESH_Controls.cxx.
References SMESH.Controls.ElementsOnShape.myCurShapeType.
: myMesh(0), myType(SMDSAbs_All), myToler(Precision::Confusion()), myAllNodesFlag(false) { myCurShapeType = TopAbs_SHAPE; }
| ElementsOnShape::~ElementsOnShape | ( | ) |
Definition at line 3583 of file SMESH_Controls.cxx.
{
}
| void ElementsOnShape::addShape | ( | const TopoDS_Shape & | theShape | ) | [private] |
Definition at line 3660 of file SMESH_Controls.cxx.
References SMESH.Handle(), SMESH.Controls.ElementsOnShape.myCurFace, SMESH.Controls.ElementsOnShape.myCurPnt, SMESH.Controls.ElementsOnShape.myCurProjEdge, SMESH.Controls.ElementsOnShape.myCurProjFace, SMESH.Controls.ElementsOnShape.myCurSC, SMESH.Controls.ElementsOnShape.myCurShapeType, SMESH.Controls.ElementsOnShape.myMesh, SMESH.Controls.ElementsOnShape.myShapesMap, and SMESH.Controls.ElementsOnShape.process().
Referenced by SMESH.Controls.ElementsOnShape.SetShape().
{
if (theShape.IsNull() || myMesh == 0)
return;
if (!myShapesMap.Add(theShape)) return;
myCurShapeType = theShape.ShapeType();
switch (myCurShapeType)
{
case TopAbs_COMPOUND:
case TopAbs_COMPSOLID:
case TopAbs_SHELL:
case TopAbs_WIRE:
{
TopoDS_Iterator anIt (theShape, Standard_True, Standard_True);
for (; anIt.More(); anIt.Next()) addShape(anIt.Value());
}
break;
case TopAbs_SOLID:
{
myCurSC.Load(theShape);
process();
}
break;
case TopAbs_FACE:
{
TopoDS_Face aFace = TopoDS::Face(theShape);
BRepAdaptor_Surface SA (aFace, true);
Standard_Real
u1 = SA.FirstUParameter(),
u2 = SA.LastUParameter(),
v1 = SA.FirstVParameter(),
v2 = SA.LastVParameter();
Handle(Geom_Surface) surf = BRep_Tool::Surface(aFace);
myCurProjFace.Init(surf, u1,u2, v1,v2);
myCurFace = aFace;
process();
}
break;
case TopAbs_EDGE:
{
TopoDS_Edge anEdge = TopoDS::Edge(theShape);
Standard_Real u1, u2;
Handle(Geom_Curve) curve = BRep_Tool::Curve(anEdge, u1, u2);
myCurProjEdge.Init(curve, u1, u2);
process();
}
break;
case TopAbs_VERTEX:
{
TopoDS_Vertex aV = TopoDS::Vertex(theShape);
myCurPnt = BRep_Tool::Pnt(aV);
process();
}
break;
default:
break;
}
}
| bool SMESH.Controls.ElementsOnShape.GetAllNodes | ( | ) | const |
Definition at line 774 of file SMESH_ControlsDef.hxx.
{ return myAllNodesFlag; }
| double ElementsOnShape::GetTolerance | ( | ) | const |
Definition at line 3613 of file SMESH_Controls.cxx.
References SMESH.Controls.ElementsOnShape.myToler.
{
return myToler;
}
| SMDSAbs_ElementType ElementsOnShape::GetType | ( | ) | const [virtual] |
Implements SMESH.Controls.Predicate.
Definition at line 3600 of file SMESH_Controls.cxx.
References SMESH.Controls.ElementsOnShape.myType.
{
return myType;
}
| bool ElementsOnShape::IsSatisfy | ( | long | theElementId | ) | [virtual] |
Implements SMESH.Controls.Predicate.
Definition at line 3595 of file SMESH_Controls.cxx.
References SMESH.Controls.ElementsOnShape.myIds.
{
return myIds.Contains(theElementId);
}
| void ElementsOnShape::process | ( | const SMDS_MeshElement * | theElem | ) | [private] |
Definition at line 3758 of file SMESH_Controls.cxx.
References SMDS_MeshElement.GetID(), SMESH.Controls.ElementsOnShape.myAllNodesFlag, SMESH.Controls.ElementsOnShape.myCurFace, SMESH.Controls.ElementsOnShape.myCurPnt, SMESH.Controls.ElementsOnShape.myCurProjEdge, SMESH.Controls.ElementsOnShape.myCurProjFace, SMESH.Controls.ElementsOnShape.myCurSC, SMESH.Controls.ElementsOnShape.myCurShapeType, SMESH.Controls.ElementsOnShape.myIds, SMESH.Controls.ElementsOnShape.myShape, SMESH.Controls.ElementsOnShape.myToler, SMDS_MeshElement.NbNodes(), SMDS_MeshElement.nodesIterator(), SMDS_MeshNode.X(), SMDS_MeshNode.Y(), and SMDS_MeshNode.Z().
{
if (myShape.IsNull())
return;
SMDS_ElemIteratorPtr aNodeItr = theElemPtr->nodesIterator();
bool isSatisfy = myAllNodesFlag;
gp_XYZ centerXYZ (0, 0, 0);
while (aNodeItr->more() && (isSatisfy == myAllNodesFlag))
{
SMDS_MeshNode* aNode = (SMDS_MeshNode*)aNodeItr->next();
gp_Pnt aPnt (aNode->X(), aNode->Y(), aNode->Z());
centerXYZ += aPnt.XYZ();
switch (myCurShapeType)
{
case TopAbs_SOLID:
{
myCurSC.Perform(aPnt, myToler);
isSatisfy = (myCurSC.State() == TopAbs_IN || myCurSC.State() == TopAbs_ON);
}
break;
case TopAbs_FACE:
{
myCurProjFace.Perform(aPnt);
isSatisfy = (myCurProjFace.IsDone() && myCurProjFace.LowerDistance() <= myToler);
if (isSatisfy)
{
// check relatively the face
Quantity_Parameter u, v;
myCurProjFace.LowerDistanceParameters(u, v);
gp_Pnt2d aProjPnt (u, v);
BRepClass_FaceClassifier aClsf (myCurFace, aProjPnt, myToler);
isSatisfy = (aClsf.State() == TopAbs_IN || aClsf.State() == TopAbs_ON);
}
}
break;
case TopAbs_EDGE:
{
myCurProjEdge.Perform(aPnt);
isSatisfy = (myCurProjEdge.NbPoints() > 0 && myCurProjEdge.LowerDistance() <= myToler);
}
break;
case TopAbs_VERTEX:
{
isSatisfy = (aPnt.Distance(myCurPnt) <= myToler);
}
break;
default:
{
isSatisfy = false;
}
}
}
if (isSatisfy && myCurShapeType == TopAbs_SOLID) { // Check the center point for volumes MantisBug 0020168
centerXYZ /= theElemPtr->NbNodes();
gp_Pnt aCenterPnt (centerXYZ);
myCurSC.Perform(aCenterPnt, myToler);
if ( !(myCurSC.State() == TopAbs_IN || myCurSC.State() == TopAbs_ON))
isSatisfy = false;
}
if (isSatisfy)
myIds.Add(theElemPtr->GetID());
}
| void ElementsOnShape::process | ( | ) | [private] |
Definition at line 3721 of file SMESH_Controls.cxx.
References SMDS_Mesh.edgesIterator(), SMDS_Mesh.facesIterator(), SMESH.Controls.ElementsOnShape.myMesh, SMESH.Controls.ElementsOnShape.myShape, SMESH.Controls.ElementsOnShape.myType, SMDS_Mesh.nodesIterator(), SMDSAbs_All, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Node, SMDSAbs_Volume, and SMDS_Mesh.volumesIterator().
Referenced by SMESH.Controls.ElementsOnShape.addShape().
{
if (myShape.IsNull() || myMesh == 0)
return;
if (myType == SMDSAbs_Node)
{
SMDS_NodeIteratorPtr anIter = myMesh->nodesIterator();
while (anIter->more())
process(anIter->next());
}
else
{
if (myType == SMDSAbs_Edge || myType == SMDSAbs_All)
{
SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
while (anIter->more())
process(anIter->next());
}
if (myType == SMDSAbs_Face || myType == SMDSAbs_All)
{
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
while (anIter->more()) {
process(anIter->next());
}
}
if (myType == SMDSAbs_Volume || myType == SMDSAbs_All)
{
SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
while (anIter->more())
process(anIter->next());
}
}
}
| void ElementsOnShape::SetAllNodes | ( | bool | theAllNodes | ) |
Definition at line 3618 of file SMESH_Controls.cxx.
References SMESH.Controls.ElementsOnShape.myAllNodesFlag, SMESH.Controls.ElementsOnShape.myShape, SMESH.Controls.ElementsOnShape.myType, and SMESH.Controls.ElementsOnShape.SetShape().
{
if (myAllNodesFlag != theAllNodes) {
myAllNodesFlag = theAllNodes;
SetShape(myShape, myType);
}
}
| void ElementsOnShape::SetMesh | ( | const SMDS_Mesh * | theMesh | ) | [virtual] |
Implements SMESH.Controls.Functor.
Definition at line 3587 of file SMESH_Controls.cxx.
References SMESH.Controls.ElementsOnShape.myMesh, SMESH.Controls.ElementsOnShape.myShape, SMESH.Controls.ElementsOnShape.myType, and SMESH.Controls.ElementsOnShape.SetShape().
| void ElementsOnShape::SetShape | ( | const TopoDS_Shape & | theShape, |
| const SMDSAbs_ElementType | theType | ||
| ) |
Definition at line 3626 of file SMESH_Controls.cxx.
References SMESH.Controls.ElementsOnShape.addShape(), SMESH.Controls.ElementsOnShape.myIds, SMESH.Controls.ElementsOnShape.myMesh, SMESH.Controls.ElementsOnShape.myShape, SMESH.Controls.ElementsOnShape.myShapesMap, SMESH.Controls.ElementsOnShape.myType, SMDS_Mesh.NbEdges(), SMDS_Mesh.NbFaces(), SMDS_Mesh.NbNodes(), SMDS_Mesh.NbVolumes(), SMDSAbs_All, SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Node, and SMDSAbs_Volume.
Referenced by SMESH.Controls.ElementsOnShape.SetAllNodes(), SMESH.Controls.ElementsOnShape.SetMesh(), and SMESH.Controls.ElementsOnShape.SetTolerance().
{
myType = theType;
myShape = theShape;
myIds.Clear();
if (myMesh == 0) return;
switch (myType)
{
case SMDSAbs_All:
myIds.ReSize(myMesh->NbEdges() + myMesh->NbFaces() + myMesh->NbVolumes());
break;
case SMDSAbs_Node:
myIds.ReSize(myMesh->NbNodes());
break;
case SMDSAbs_Edge:
myIds.ReSize(myMesh->NbEdges());
break;
case SMDSAbs_Face:
myIds.ReSize(myMesh->NbFaces());
break;
case SMDSAbs_Volume:
myIds.ReSize(myMesh->NbVolumes());
break;
default:
break;
}
myShapesMap.Clear();
addShape(myShape);
}
| void ElementsOnShape::SetTolerance | ( | const double | theToler | ) |
Definition at line 3605 of file SMESH_Controls.cxx.
References SMESH.Controls.ElementsOnShape.myShape, SMESH.Controls.ElementsOnShape.myToler, SMESH.Controls.ElementsOnShape.myType, and SMESH.Controls.ElementsOnShape.SetShape().
Definition at line 789 of file SMESH_ControlsDef.hxx.
Referenced by SMESH.Controls.ElementsOnShape.process(), and SMESH.Controls.ElementsOnShape.SetAllNodes().
TopoDS_Face SMESH.Controls.ElementsOnShape.myCurFace [private] |
Definition at line 795 of file SMESH_ControlsDef.hxx.
Referenced by SMESH.Controls.ElementsOnShape.addShape(), and SMESH.Controls.ElementsOnShape.process().
gp_Pnt SMESH.Controls.ElementsOnShape.myCurPnt [private] |
Definition at line 797 of file SMESH_ControlsDef.hxx.
Referenced by SMESH.Controls.ElementsOnShape.addShape(), and SMESH.Controls.ElementsOnShape.process().
GeomAPI_ProjectPointOnCurve SMESH.Controls.ElementsOnShape.myCurProjEdge [private] |
Definition at line 796 of file SMESH_ControlsDef.hxx.
Referenced by SMESH.Controls.ElementsOnShape.addShape(), and SMESH.Controls.ElementsOnShape.process().
GeomAPI_ProjectPointOnSurf SMESH.Controls.ElementsOnShape.myCurProjFace [private] |
Definition at line 794 of file SMESH_ControlsDef.hxx.
Referenced by SMESH.Controls.ElementsOnShape.addShape(), and SMESH.Controls.ElementsOnShape.process().
BRepClass3d_SolidClassifier SMESH.Controls.ElementsOnShape.myCurSC [private] |
Definition at line 793 of file SMESH_ControlsDef.hxx.
Referenced by SMESH.Controls.ElementsOnShape.addShape(), and SMESH.Controls.ElementsOnShape.process().
TopAbs_ShapeEnum SMESH.Controls.ElementsOnShape.myCurShapeType [private] |
Definition at line 792 of file SMESH_ControlsDef.hxx.
Referenced by SMESH.Controls.ElementsOnShape.addShape(), SMESH.Controls.ElementsOnShape.ElementsOnShape(), and SMESH.Controls.ElementsOnShape.process().
TColStd_MapOfInteger SMESH.Controls.ElementsOnShape.myIds [private] |
Definition at line 785 of file SMESH_ControlsDef.hxx.
Referenced by SMESH.Controls.ElementsOnShape.IsSatisfy(), SMESH.Controls.ElementsOnShape.process(), and SMESH.Controls.ElementsOnShape.SetShape().
const SMDS_Mesh* SMESH.Controls.ElementsOnShape.myMesh [private] |
Definition at line 784 of file SMESH_ControlsDef.hxx.
Referenced by SMESH.Controls.ElementsOnShape.addShape(), SMESH.Controls.ElementsOnShape.process(), SMESH.Controls.ElementsOnShape.SetMesh(), and SMESH.Controls.ElementsOnShape.SetShape().
TopoDS_Shape SMESH.Controls.ElementsOnShape.myShape [private] |
TopTools_MapOfShape SMESH.Controls.ElementsOnShape.myShapesMap [private] |
Definition at line 791 of file SMESH_ControlsDef.hxx.
Referenced by SMESH.Controls.ElementsOnShape.addShape(), and SMESH.Controls.ElementsOnShape.SetShape().
double SMESH.Controls.ElementsOnShape.myToler [private] |
Definition at line 788 of file SMESH_ControlsDef.hxx.
Referenced by SMESH.Controls.ElementsOnShape.GetTolerance(), SMESH.Controls.ElementsOnShape.process(), and SMESH.Controls.ElementsOnShape.SetTolerance().
Definition at line 786 of file SMESH_ControlsDef.hxx.
Referenced by SMESH.Controls.ElementsOnShape.GetType(), SMESH.Controls.ElementsOnShape.process(), SMESH.Controls.ElementsOnShape.SetAllNodes(), SMESH.Controls.ElementsOnShape.SetMesh(), SMESH.Controls.ElementsOnShape.SetShape(), and SMESH.Controls.ElementsOnShape.SetTolerance().