1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef _SMESH_CONTROLSDEF_HXX_
24 #define _SMESH_CONTROLSDEF_HXX_
30 #include <boost/shared_ptr.hpp>
33 #include <GeomAPI_ProjectPointOnSurf.hxx>
34 #include <GeomAPI_ProjectPointOnCurve.hxx>
35 #include <TColStd_SequenceOfInteger.hxx>
36 #include <TColStd_MapOfInteger.hxx>
37 #include <TCollection_AsciiString.hxx>
39 #include <TopoDS_Face.hxx>
40 #include <TopTools_MapOfShape.hxx>
41 #include <BRepClass3d_SolidClassifier.hxx>
42 #include <Quantity_Color.hxx>
44 #include "SMDSAbs_ElementType.hxx"
45 #include "SMDS_MeshNode.hxx"
46 #include "SMESH_TypeDefs.hxx"
48 #include "SMESH_Controls.hxx"
50 class SMDS_MeshElement;
56 class SMESHDS_SubMesh;
63 class SMESHCONTROLS_EXPORT TSequenceOfXYZ
65 typedef std::vector<gp_XYZ>::size_type size_type;
70 TSequenceOfXYZ(size_type n);
72 TSequenceOfXYZ(size_type n, const gp_XYZ& t);
74 TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ);
76 template <class InputIterator>
77 TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd);
81 TSequenceOfXYZ& operator=(const TSequenceOfXYZ& theSequenceOfXYZ);
83 gp_XYZ& operator()(size_type n);
85 const gp_XYZ& operator()(size_type n) const;
89 void reserve(size_type n);
91 void push_back(const gp_XYZ& v);
93 size_type size() const;
96 std::vector<gp_XYZ> myArray;
100 * \brief Class used to detect mesh modification: IsMeshModified() returns
101 * true if a mesh has changed since last calling IsMeshModified()
103 class SMESHCONTROLS_EXPORT TMeshModifTracer
105 unsigned long myMeshModifTime;
106 const SMDS_Mesh* myMesh;
109 void SetMesh( const SMDS_Mesh* theMesh );
110 const SMDS_Mesh* GetMesh() const { return myMesh; }
111 bool IsMeshModified();
115 Class : NumericalFunctor
116 Description : Root of all Functors returning numeric value
118 class SMESHCONTROLS_EXPORT NumericalFunctor: public virtual Functor{
121 virtual void SetMesh( const SMDS_Mesh* theMesh );
122 virtual double GetValue( long theElementId );
123 virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
124 void GetHistogram(int nbIntervals,
125 std::vector<int>& nbEvents,
126 std::vector<double>& funValues,
127 const std::vector<int>& elements,
128 const double* minmax=0,
129 const bool isLogarithmic = false);
130 virtual SMDSAbs_ElementType GetType() const = 0;
131 virtual double GetBadRate( double Value, int nbNodes ) const = 0;
132 long GetPrecision() const;
133 void SetPrecision( const long thePrecision );
134 double Round( const double & value );
136 bool GetPoints(const int theId, TSequenceOfXYZ& theRes) const;
137 static bool GetPoints(const SMDS_MeshElement* theElem, TSequenceOfXYZ& theRes);
139 const SMDS_Mesh* myMesh;
140 const SMDS_MeshElement* myCurrElement;
142 double myPrecisionValue;
148 Description : Functor calculating volume of 3D mesh element
150 class SMESHCONTROLS_EXPORT Volume: public virtual NumericalFunctor{
152 virtual double GetValue( long theElementId );
153 //virtual double GetValue( const TSequenceOfXYZ& thePoints );
154 virtual double GetBadRate( double Value, int nbNodes ) const;
155 virtual SMDSAbs_ElementType GetType() const;
160 Class : MaxElementLength2D
161 Description : Functor calculating maximum length of 2D element
163 class SMESHCONTROLS_EXPORT MaxElementLength2D: public virtual NumericalFunctor{
165 virtual double GetValue( long theElementId );
166 virtual double GetValue( const TSequenceOfXYZ& P );
167 virtual double GetBadRate( double Value, int nbNodes ) const;
168 virtual SMDSAbs_ElementType GetType() const;
173 Class : MaxElementLength3D
174 Description : Functor calculating maximum length of 3D element
176 class SMESHCONTROLS_EXPORT MaxElementLength3D: public virtual NumericalFunctor{
178 virtual double GetValue( long theElementId );
179 virtual double GetBadRate( double Value, int nbNodes ) const;
180 virtual SMDSAbs_ElementType GetType() const;
185 Class : SMESH_MinimumAngle
186 Description : Functor for calculation of minimum angle
188 class SMESHCONTROLS_EXPORT MinimumAngle: public virtual NumericalFunctor{
190 virtual double GetValue( const TSequenceOfXYZ& thePoints );
191 virtual double GetBadRate( double Value, int nbNodes ) const;
192 virtual SMDSAbs_ElementType GetType() const;
198 Description : Functor for calculating aspect ratio
200 class SMESHCONTROLS_EXPORT AspectRatio: public virtual NumericalFunctor{
202 virtual double GetValue( long theElementId );
203 virtual double GetValue( const TSequenceOfXYZ& thePoints );
204 virtual double GetBadRate( double Value, int nbNodes ) const;
205 virtual SMDSAbs_ElementType GetType() const;
210 Class : AspectRatio3D
211 Description : Functor for calculating aspect ratio of 3D elems.
213 class SMESHCONTROLS_EXPORT AspectRatio3D: public virtual NumericalFunctor{
215 virtual double GetValue( long theElementId );
216 virtual double GetValue( const TSequenceOfXYZ& thePoints );
217 virtual double GetBadRate( double Value, int nbNodes ) const;
218 virtual SMDSAbs_ElementType GetType() const;
224 Description : Functor for calculating warping
226 class SMESHCONTROLS_EXPORT Warping: public virtual NumericalFunctor{
228 virtual double GetValue( const TSequenceOfXYZ& thePoints );
229 virtual double GetBadRate( double Value, int nbNodes ) const;
230 virtual SMDSAbs_ElementType GetType() const;
233 double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
239 Description : Functor for calculating taper
241 class SMESHCONTROLS_EXPORT Taper: public virtual NumericalFunctor{
243 virtual double GetValue( const TSequenceOfXYZ& thePoints );
244 virtual double GetBadRate( double Value, int nbNodes ) const;
245 virtual SMDSAbs_ElementType GetType() const;
251 Description : Functor for calculating skew in degrees
253 class SMESHCONTROLS_EXPORT Skew: public virtual NumericalFunctor{
255 virtual double GetValue( const TSequenceOfXYZ& thePoints );
256 virtual double GetBadRate( double Value, int nbNodes ) const;
257 virtual SMDSAbs_ElementType GetType() const;
263 Description : Functor for calculating area
265 class SMESHCONTROLS_EXPORT Area: public virtual NumericalFunctor{
267 virtual double GetValue( const TSequenceOfXYZ& thePoints );
268 virtual double GetBadRate( double Value, int nbNodes ) const;
269 virtual SMDSAbs_ElementType GetType() const;
275 Description : Functor for calculating length of edge
277 class SMESHCONTROLS_EXPORT Length: public virtual NumericalFunctor{
279 virtual double GetValue( const TSequenceOfXYZ& thePoints );
280 virtual double GetBadRate( double Value, int nbNodes ) const;
281 virtual SMDSAbs_ElementType GetType() const;
286 Description : Functor for calculating length of edge
288 class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{
290 virtual double GetValue( long theElementId );
291 virtual double GetBadRate( double Value, int nbNodes ) const;
292 virtual SMDSAbs_ElementType GetType() const;
296 Value(double theLength, long thePntId1, long thePntId2);
297 bool operator<(const Value& x) const;
299 typedef std::set<Value> TValues;
300 void GetValues(TValues& theValues);
302 typedef boost::shared_ptr<Length2D> Length2DPtr;
305 Class : MultiConnection
306 Description : Functor for calculating number of faces conneted to the edge
308 class SMESHCONTROLS_EXPORT MultiConnection: public virtual NumericalFunctor{
310 virtual double GetValue( long theElementId );
311 virtual double GetValue( const TSequenceOfXYZ& thePoints );
312 virtual double GetBadRate( double Value, int nbNodes ) const;
313 virtual SMDSAbs_ElementType GetType() const;
317 Class : MultiConnection2D
318 Description : Functor for calculating number of faces conneted to the edge
320 class SMESHCONTROLS_EXPORT MultiConnection2D: public virtual NumericalFunctor{
322 virtual double GetValue( long theElementId );
323 virtual double GetValue( const TSequenceOfXYZ& thePoints );
324 virtual double GetBadRate( double Value, int nbNodes ) const;
325 virtual SMDSAbs_ElementType GetType() const;
328 Value(long thePntId1, long thePntId2);
329 bool operator<(const Value& x) const;
331 typedef std::map<Value,int> MValues;
333 void GetValues(MValues& theValues);
335 typedef boost::shared_ptr<MultiConnection2D> MultiConnection2DPtr;
339 Description : Functor returning diameter of a ball element
341 class SMESHCONTROLS_EXPORT BallDiameter: public virtual NumericalFunctor{
343 virtual double GetValue( long theElementId );
344 virtual double GetBadRate( double Value, int nbNodes ) const;
345 virtual SMDSAbs_ElementType GetType() const;
353 Class : CoincidentNodes
354 Description : Predicate of Coincident Nodes
355 Note : This class is suitable only for visualization of Coincident Nodes
357 class SMESHCONTROLS_EXPORT CoincidentNodes: public Predicate {
360 virtual void SetMesh( const SMDS_Mesh* theMesh );
361 virtual bool IsSatisfy( long theElementId );
362 virtual SMDSAbs_ElementType GetType() const;
364 void SetTolerance (const double theToler) { myToler = theToler; }
365 double GetTolerance () const { return myToler; }
369 TColStd_MapOfInteger myCoincidentIDs;
370 TMeshModifTracer myMeshModifTracer;
372 typedef boost::shared_ptr<CoincidentNodes> CoincidentNodesPtr;
375 Class : CoincidentElements
376 Description : Predicate of Coincident Elements
377 Note : This class is suitable only for visualization of Coincident Elements
379 class SMESHCONTROLS_EXPORT CoincidentElements: public Predicate {
381 CoincidentElements();
382 virtual void SetMesh( const SMDS_Mesh* theMesh );
383 virtual bool IsSatisfy( long theElementId );
386 const SMDS_Mesh* myMesh;
388 class SMESHCONTROLS_EXPORT CoincidentElements1D: public CoincidentElements {
390 virtual SMDSAbs_ElementType GetType() const;
392 class SMESHCONTROLS_EXPORT CoincidentElements2D: public CoincidentElements {
394 virtual SMDSAbs_ElementType GetType() const;
396 class SMESHCONTROLS_EXPORT CoincidentElements3D: public CoincidentElements {
398 virtual SMDSAbs_ElementType GetType() const;
403 Description : Predicate for free borders
405 class SMESHCONTROLS_EXPORT FreeBorders: public virtual Predicate{
408 virtual void SetMesh( const SMDS_Mesh* theMesh );
409 virtual bool IsSatisfy( long theElementId );
410 virtual SMDSAbs_ElementType GetType() const;
413 const SMDS_Mesh* myMesh;
418 Class : BadOrientedVolume
419 Description : Predicate bad oriented volumes
421 class SMESHCONTROLS_EXPORT BadOrientedVolume: public virtual Predicate{
424 virtual void SetMesh( const SMDS_Mesh* theMesh );
425 virtual bool IsSatisfy( long theElementId );
426 virtual SMDSAbs_ElementType GetType() const;
429 const SMDS_Mesh* myMesh;
435 class SMESHCONTROLS_EXPORT BareBorderVolume: public Predicate
438 BareBorderVolume():myMesh(0) {}
439 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
440 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
441 virtual bool IsSatisfy( long theElementId );
443 const SMDS_Mesh* myMesh;
445 typedef boost::shared_ptr<BareBorderVolume> BareBorderVolumePtr;
450 class SMESHCONTROLS_EXPORT BareBorderFace: public Predicate
453 BareBorderFace():myMesh(0) {}
454 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
455 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
456 virtual bool IsSatisfy( long theElementId );
458 const SMDS_Mesh* myMesh;
459 std::vector< const SMDS_MeshNode* > myLinkNodes;
461 typedef boost::shared_ptr<BareBorderFace> BareBorderFacePtr;
464 OverConstrainedVolume
466 class SMESHCONTROLS_EXPORT OverConstrainedVolume: public Predicate
469 OverConstrainedVolume():myMesh(0) {}
470 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
471 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
472 virtual bool IsSatisfy( long theElementId );
474 const SMDS_Mesh* myMesh;
476 typedef boost::shared_ptr<OverConstrainedVolume> OverConstrainedVolumePtr;
481 class SMESHCONTROLS_EXPORT OverConstrainedFace: public Predicate
484 OverConstrainedFace():myMesh(0) {}
485 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
486 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
487 virtual bool IsSatisfy( long theElementId );
489 const SMDS_Mesh* myMesh;
491 typedef boost::shared_ptr<OverConstrainedFace> OverConstrainedFacePtr;
495 Description : Predicate for free Edges
497 class SMESHCONTROLS_EXPORT FreeEdges: public virtual Predicate{
500 virtual void SetMesh( const SMDS_Mesh* theMesh );
501 virtual bool IsSatisfy( long theElementId );
502 virtual SMDSAbs_ElementType GetType() const;
503 static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
504 typedef long TElemId;
508 Border(long theElemId, long thePntId1, long thePntId2);
509 bool operator<(const Border& x) const;
511 typedef std::set<Border> TBorders;
512 void GetBoreders(TBorders& theBorders);
515 const SMDS_Mesh* myMesh;
517 typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
522 Description : Predicate for free nodes
524 class SMESHCONTROLS_EXPORT FreeNodes: public virtual Predicate{
527 virtual void SetMesh( const SMDS_Mesh* theMesh );
528 virtual bool IsSatisfy( long theNodeId );
529 virtual SMDSAbs_ElementType GetType() const;
532 const SMDS_Mesh* myMesh;
538 Description : Predicate for Range of Ids.
539 Range may be specified with two ways.
540 1. Using AddToRange method
541 2. With SetRangeStr method. Parameter of this method is a string
542 like as "1,2,3,50-60,63,67,70-"
544 class SMESHCONTROLS_EXPORT RangeOfIds: public virtual Predicate
548 virtual void SetMesh( const SMDS_Mesh* theMesh );
549 virtual bool IsSatisfy( long theNodeId );
550 virtual SMDSAbs_ElementType GetType() const;
551 virtual void SetType( SMDSAbs_ElementType theType );
553 bool AddToRange( long theEntityId );
554 void GetRangeStr( TCollection_AsciiString& );
555 bool SetRangeStr( const TCollection_AsciiString& );
558 const SMDS_Mesh* myMesh;
560 TColStd_SequenceOfInteger myMin;
561 TColStd_SequenceOfInteger myMax;
562 TColStd_MapOfInteger myIds;
564 SMDSAbs_ElementType myType;
567 typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
572 Description : Base class for comparators
574 class SMESHCONTROLS_EXPORT Comparator: public virtual Predicate{
577 virtual ~Comparator();
578 virtual void SetMesh( const SMDS_Mesh* theMesh );
579 virtual void SetMargin(double theValue);
580 virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
581 virtual bool IsSatisfy( long theElementId ) = 0;
582 virtual SMDSAbs_ElementType GetType() const;
587 NumericalFunctorPtr myFunctor;
589 typedef boost::shared_ptr<Comparator> ComparatorPtr;
594 Description : Comparator "<"
596 class SMESHCONTROLS_EXPORT LessThan: public virtual Comparator{
598 virtual bool IsSatisfy( long theElementId );
604 Description : Comparator ">"
606 class SMESHCONTROLS_EXPORT MoreThan: public virtual Comparator{
608 virtual bool IsSatisfy( long theElementId );
614 Description : Comparator "="
616 class SMESHCONTROLS_EXPORT EqualTo: public virtual Comparator{
619 virtual bool IsSatisfy( long theElementId );
620 virtual void SetTolerance( double theTol );
621 virtual double GetTolerance();
626 typedef boost::shared_ptr<EqualTo> EqualToPtr;
631 Description : Logical NOT predicate
633 class SMESHCONTROLS_EXPORT LogicalNOT: public virtual Predicate{
636 virtual ~LogicalNOT();
637 virtual bool IsSatisfy( long theElementId );
638 virtual void SetMesh( const SMDS_Mesh* theMesh );
639 virtual void SetPredicate(PredicatePtr thePred);
640 virtual SMDSAbs_ElementType GetType() const;
643 PredicatePtr myPredicate;
645 typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
649 Class : LogicalBinary
650 Description : Base class for binary logical predicate
652 class SMESHCONTROLS_EXPORT LogicalBinary: public virtual Predicate{
655 virtual ~LogicalBinary();
656 virtual void SetMesh( const SMDS_Mesh* theMesh );
657 virtual void SetPredicate1(PredicatePtr thePred);
658 virtual void SetPredicate2(PredicatePtr thePred);
659 virtual SMDSAbs_ElementType GetType() const;
662 PredicatePtr myPredicate1;
663 PredicatePtr myPredicate2;
665 typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
670 Description : Logical AND
672 class SMESHCONTROLS_EXPORT LogicalAND: public virtual LogicalBinary{
674 virtual bool IsSatisfy( long theElementId );
680 Description : Logical OR
682 class SMESHCONTROLS_EXPORT LogicalOR: public virtual LogicalBinary{
684 virtual bool IsSatisfy( long theElementId );
690 Description : Predicate for manifold part of mesh
692 class SMESHCONTROLS_EXPORT ManifoldPart: public virtual Predicate{
695 /* internal class for algorithm uses */
699 Link( SMDS_MeshNode* theNode1,
700 SMDS_MeshNode* theNode2 );
703 bool IsEqual( const ManifoldPart::Link& theLink ) const;
704 bool operator<(const ManifoldPart::Link& x) const;
706 SMDS_MeshNode* myNode1;
707 SMDS_MeshNode* myNode2;
710 bool IsEqual( const ManifoldPart::Link& theLink1,
711 const ManifoldPart::Link& theLink2 );
713 typedef std::set<ManifoldPart::Link> TMapOfLink;
714 typedef std::vector<SMDS_MeshFace*> TVectorOfFacePtr;
715 typedef std::vector<ManifoldPart::Link> TVectorOfLink;
716 typedef std::map<SMDS_MeshFace*,int> TDataMapFacePtrInt;
717 typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
721 virtual void SetMesh( const SMDS_Mesh* theMesh );
722 // inoke when all parameters already set
723 virtual bool IsSatisfy( long theElementId );
724 virtual SMDSAbs_ElementType GetType() const;
726 void SetAngleTolerance( const double theAngToler );
727 double GetAngleTolerance() const;
728 void SetIsOnlyManifold( const bool theIsOnly );
729 void SetStartElem( const long theStartElemId );
733 bool findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
734 SMDS_MeshFace* theStartFace,
735 TMapOfLink& theNonManifold,
736 TColStd_MapOfInteger& theResFaces );
737 bool isInPlane( const SMDS_MeshFace* theFace1,
738 const SMDS_MeshFace* theFace2 );
739 void expandBoundary( TMapOfLink& theMapOfBoundary,
740 TVectorOfLink& theSeqOfBoundary,
741 TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
742 TMapOfLink& theNonManifold,
743 SMDS_MeshFace* theNextFace ) const;
745 void getFacesByLink( const Link& theLink,
746 TVectorOfFacePtr& theFaces ) const;
749 const SMDS_Mesh* myMesh;
750 TColStd_MapOfInteger myMapIds;
751 TColStd_MapOfInteger myMapBadGeomIds;
752 TVectorOfFacePtr myAllFacePtr;
753 TDataMapFacePtrInt myAllFacePtrIntDMap;
755 bool myIsOnlyManifold;
759 typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
763 Class : ElementsOnSurface
764 Description : Predicate elements that lying on indicated surface
767 class SMESHCONTROLS_EXPORT ElementsOnSurface : public virtual Predicate {
770 ~ElementsOnSurface();
771 virtual void SetMesh( const SMDS_Mesh* theMesh );
772 virtual bool IsSatisfy( long theElementId );
773 virtual SMDSAbs_ElementType GetType() const;
775 void SetTolerance( const double theToler );
776 double GetTolerance() const;
777 void SetSurface( const TopoDS_Shape& theShape,
778 const SMDSAbs_ElementType theType );
779 void SetUseBoundaries( bool theUse );
780 bool GetUseBoundaries() const { return myUseBoundaries; }
784 void process( const SMDS_MeshElement* theElem );
785 bool isOnSurface( const SMDS_MeshNode* theNode );
788 TMeshModifTracer myMeshModifTracer;
789 TColStd_MapOfInteger myIds;
790 SMDSAbs_ElementType myType;
791 //Handle(Geom_Surface) mySurf;
794 bool myUseBoundaries;
795 GeomAPI_ProjectPointOnSurf myProjector;
798 typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
802 Class : ElementsOnShape
803 Description : Predicate elements that lying on indicated shape
806 class SMESHCONTROLS_EXPORT ElementsOnShape : public virtual Predicate
812 virtual void SetMesh (const SMDS_Mesh* theMesh);
813 virtual bool IsSatisfy (long theElementId);
814 virtual SMDSAbs_ElementType GetType() const;
816 void SetTolerance (const double theToler);
817 double GetTolerance() const;
818 void SetAllNodes (bool theAllNodes);
819 bool GetAllNodes() const { return myAllNodesFlag; }
820 void SetShape (const TopoDS_Shape& theShape,
821 const SMDSAbs_ElementType theType);
827 TClassifier(const TopoDS_Shape& s, double tol) { Init(s,tol); }
828 void Init(const TopoDS_Shape& s, double tol);
829 bool IsOut(const gp_Pnt& p);
830 TopAbs_ShapeEnum ShapeType() const;
832 bool isOutOfSolid (const gp_Pnt& p);
833 bool isOutOfFace (const gp_Pnt& p);
834 bool isOutOfEdge (const gp_Pnt& p);
835 bool isOutOfVertex(const gp_Pnt& p);
837 bool (TClassifier::* myIsOutFun)(const gp_Pnt& p);
838 BRepClass3d_SolidClassifier mySolidClfr;
839 GeomAPI_ProjectPointOnSurf myProjFace;
840 GeomAPI_ProjectPointOnCurve myProjEdge;
842 TopoDS_Shape myShape;
845 void clearClassifiers();
847 std::vector< TClassifier* > myClassifiers;
848 const SMDS_Mesh* myMesh;
849 SMDSAbs_ElementType myType;
850 TopoDS_Shape myShape;
856 typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
861 Description : Predicate for free faces
863 class SMESHCONTROLS_EXPORT FreeFaces: public virtual Predicate{
866 virtual void SetMesh( const SMDS_Mesh* theMesh );
867 virtual bool IsSatisfy( long theElementId );
868 virtual SMDSAbs_ElementType GetType() const;
871 const SMDS_Mesh* myMesh;
875 Class : LinearOrQuadratic
876 Description : Predicate for free faces
878 class SMESHCONTROLS_EXPORT LinearOrQuadratic: public virtual Predicate{
881 virtual void SetMesh( const SMDS_Mesh* theMesh );
882 virtual bool IsSatisfy( long theElementId );
883 void SetType( SMDSAbs_ElementType theType );
884 virtual SMDSAbs_ElementType GetType() const;
887 const SMDS_Mesh* myMesh;
888 SMDSAbs_ElementType myType;
890 typedef boost::shared_ptr<LinearOrQuadratic> LinearOrQuadraticPtr;
894 Description : Functor for check color of group to whic mesh element belongs to
896 class SMESHCONTROLS_EXPORT GroupColor: public virtual Predicate{
899 virtual void SetMesh( const SMDS_Mesh* theMesh );
900 virtual bool IsSatisfy( long theElementId );
901 void SetType( SMDSAbs_ElementType theType );
902 virtual SMDSAbs_ElementType GetType() const;
903 void SetColorStr( const TCollection_AsciiString& );
904 void GetColorStr( TCollection_AsciiString& ) const;
907 typedef std::set< long > TIDs;
909 Quantity_Color myColor;
910 SMDSAbs_ElementType myType;
913 typedef boost::shared_ptr<GroupColor> GroupColorPtr;
917 Description : Predicate to check element geometry type
919 class SMESHCONTROLS_EXPORT ElemGeomType: public virtual Predicate{
922 virtual void SetMesh( const SMDS_Mesh* theMesh );
923 virtual bool IsSatisfy( long theElementId );
924 void SetType( SMDSAbs_ElementType theType );
925 virtual SMDSAbs_ElementType GetType() const;
926 void SetGeomType( SMDSAbs_GeometryType theType );
927 virtual SMDSAbs_GeometryType GetGeomType() const;
930 const SMDS_Mesh* myMesh;
931 SMDSAbs_ElementType myType;
932 SMDSAbs_GeometryType myGeomType;
934 typedef boost::shared_ptr<ElemGeomType> ElemGeomTypePtr;
937 Class : CoplanarFaces
938 Description : Predicate to check angle between faces
940 class SMESHCONTROLS_EXPORT CoplanarFaces: public virtual Predicate
944 void SetFace( long theID ) { myFaceID = theID; }
945 long GetFace() const { return myFaceID; }
946 void SetTolerance (const double theToler) { myToler = theToler; }
947 double GetTolerance () const { return myToler; }
948 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
950 virtual void SetMesh( const SMDS_Mesh* theMesh );
951 virtual bool IsSatisfy( long theElementId );
954 TMeshModifTracer myMeshModifTracer;
957 std::set< long > myCoplanarIDs;
959 typedef boost::shared_ptr<CoplanarFaces> CoplanarFacesPtr;
964 class SMESHCONTROLS_EXPORT Filter{
968 virtual void SetPredicate(PredicatePtr thePred);
970 typedef std::vector<long> TIdSequence;
974 GetElementsId( const SMDS_Mesh* theMesh,
975 TIdSequence& theSequence );
979 GetElementsId( const SMDS_Mesh* theMesh,
980 PredicatePtr thePredicate,
981 TIdSequence& theSequence );
984 PredicatePtr myPredicate;