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 virtual SMDSAbs_ElementType GetType() const = 0;
130 virtual double GetBadRate( double Value, int nbNodes ) const = 0;
131 long GetPrecision() const;
132 void SetPrecision( const long thePrecision );
133 double Round( const double & value );
135 bool GetPoints(const int theId, TSequenceOfXYZ& theRes) const;
136 static bool GetPoints(const SMDS_MeshElement* theElem, TSequenceOfXYZ& theRes);
138 const SMDS_Mesh* myMesh;
139 const SMDS_MeshElement* myCurrElement;
141 double myPrecisionValue;
147 Description : Functor calculating volume of 3D mesh element
149 class SMESHCONTROLS_EXPORT Volume: public virtual NumericalFunctor{
151 virtual double GetValue( long theElementId );
152 //virtual double GetValue( const TSequenceOfXYZ& thePoints );
153 virtual double GetBadRate( double Value, int nbNodes ) const;
154 virtual SMDSAbs_ElementType GetType() const;
159 Class : MaxElementLength2D
160 Description : Functor calculating maximum length of 2D element
162 class SMESHCONTROLS_EXPORT MaxElementLength2D: public virtual NumericalFunctor{
164 virtual double GetValue( long theElementId );
165 virtual double GetValue( const TSequenceOfXYZ& P );
166 virtual double GetBadRate( double Value, int nbNodes ) const;
167 virtual SMDSAbs_ElementType GetType() const;
172 Class : MaxElementLength3D
173 Description : Functor calculating maximum length of 3D element
175 class SMESHCONTROLS_EXPORT MaxElementLength3D: public virtual NumericalFunctor{
177 virtual double GetValue( long theElementId );
178 virtual double GetBadRate( double Value, int nbNodes ) const;
179 virtual SMDSAbs_ElementType GetType() const;
184 Class : SMESH_MinimumAngle
185 Description : Functor for calculation of minimum angle
187 class SMESHCONTROLS_EXPORT MinimumAngle: public virtual NumericalFunctor{
189 virtual double GetValue( const TSequenceOfXYZ& thePoints );
190 virtual double GetBadRate( double Value, int nbNodes ) const;
191 virtual SMDSAbs_ElementType GetType() const;
197 Description : Functor for calculating aspect ratio
199 class SMESHCONTROLS_EXPORT AspectRatio: public virtual NumericalFunctor{
201 virtual double GetValue( long theElementId );
202 virtual double GetValue( const TSequenceOfXYZ& thePoints );
203 virtual double GetBadRate( double Value, int nbNodes ) const;
204 virtual SMDSAbs_ElementType GetType() const;
209 Class : AspectRatio3D
210 Description : Functor for calculating aspect ratio of 3D elems.
212 class SMESHCONTROLS_EXPORT AspectRatio3D: public virtual NumericalFunctor{
214 virtual double GetValue( long theElementId );
215 virtual double GetValue( const TSequenceOfXYZ& thePoints );
216 virtual double GetBadRate( double Value, int nbNodes ) const;
217 virtual SMDSAbs_ElementType GetType() const;
223 Description : Functor for calculating warping
225 class SMESHCONTROLS_EXPORT Warping: public virtual NumericalFunctor{
227 virtual double GetValue( const TSequenceOfXYZ& thePoints );
228 virtual double GetBadRate( double Value, int nbNodes ) const;
229 virtual SMDSAbs_ElementType GetType() const;
232 double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
238 Description : Functor for calculating taper
240 class SMESHCONTROLS_EXPORT Taper: public virtual NumericalFunctor{
242 virtual double GetValue( const TSequenceOfXYZ& thePoints );
243 virtual double GetBadRate( double Value, int nbNodes ) const;
244 virtual SMDSAbs_ElementType GetType() const;
250 Description : Functor for calculating skew in degrees
252 class SMESHCONTROLS_EXPORT Skew: public virtual NumericalFunctor{
254 virtual double GetValue( const TSequenceOfXYZ& thePoints );
255 virtual double GetBadRate( double Value, int nbNodes ) const;
256 virtual SMDSAbs_ElementType GetType() const;
262 Description : Functor for calculating area
264 class SMESHCONTROLS_EXPORT Area: public virtual NumericalFunctor{
266 virtual double GetValue( const TSequenceOfXYZ& thePoints );
267 virtual double GetBadRate( double Value, int nbNodes ) const;
268 virtual SMDSAbs_ElementType GetType() const;
274 Description : Functor for calculating length of edge
276 class SMESHCONTROLS_EXPORT Length: public virtual NumericalFunctor{
278 virtual double GetValue( const TSequenceOfXYZ& thePoints );
279 virtual double GetBadRate( double Value, int nbNodes ) const;
280 virtual SMDSAbs_ElementType GetType() const;
285 Description : Functor for calculating length of edge
287 class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{
289 virtual double GetValue( long theElementId );
290 virtual double GetBadRate( double Value, int nbNodes ) const;
291 virtual SMDSAbs_ElementType GetType() const;
295 Value(double theLength, long thePntId1, long thePntId2);
296 bool operator<(const Value& x) const;
298 typedef std::set<Value> TValues;
299 void GetValues(TValues& theValues);
301 typedef boost::shared_ptr<Length2D> Length2DPtr;
304 Class : MultiConnection
305 Description : Functor for calculating number of faces conneted to the edge
307 class SMESHCONTROLS_EXPORT MultiConnection: public virtual NumericalFunctor{
309 virtual double GetValue( long theElementId );
310 virtual double GetValue( const TSequenceOfXYZ& thePoints );
311 virtual double GetBadRate( double Value, int nbNodes ) const;
312 virtual SMDSAbs_ElementType GetType() const;
316 Class : MultiConnection2D
317 Description : Functor for calculating number of faces conneted to the edge
319 class SMESHCONTROLS_EXPORT MultiConnection2D: public virtual NumericalFunctor{
321 virtual double GetValue( long theElementId );
322 virtual double GetValue( const TSequenceOfXYZ& thePoints );
323 virtual double GetBadRate( double Value, int nbNodes ) const;
324 virtual SMDSAbs_ElementType GetType() const;
327 Value(long thePntId1, long thePntId2);
328 bool operator<(const Value& x) const;
330 typedef std::map<Value,int> MValues;
332 void GetValues(MValues& theValues);
334 typedef boost::shared_ptr<MultiConnection2D> MultiConnection2DPtr;
338 Description : Functor returning diameter of a ball element
340 class SMESHCONTROLS_EXPORT BallDiameter: public virtual NumericalFunctor{
342 virtual double GetValue( long theElementId );
343 virtual double GetBadRate( double Value, int nbNodes ) const;
344 virtual SMDSAbs_ElementType GetType() const;
352 Class : CoincidentNodes
353 Description : Predicate of Coincident Nodes
354 Note : This class is suitable only for visualization of Coincident Nodes
356 class SMESHCONTROLS_EXPORT CoincidentNodes: public Predicate {
359 virtual void SetMesh( const SMDS_Mesh* theMesh );
360 virtual bool IsSatisfy( long theElementId );
361 virtual SMDSAbs_ElementType GetType() const;
363 void SetTolerance (const double theToler) { myToler = theToler; }
364 double GetTolerance () const { return myToler; }
368 TColStd_MapOfInteger myCoincidentIDs;
369 TMeshModifTracer myMeshModifTracer;
371 typedef boost::shared_ptr<CoincidentNodes> CoincidentNodesPtr;
374 Class : CoincidentElements
375 Description : Predicate of Coincident Elements
376 Note : This class is suitable only for visualization of Coincident Elements
378 class SMESHCONTROLS_EXPORT CoincidentElements: public Predicate {
380 CoincidentElements();
381 virtual void SetMesh( const SMDS_Mesh* theMesh );
382 virtual bool IsSatisfy( long theElementId );
385 const SMDS_Mesh* myMesh;
387 class SMESHCONTROLS_EXPORT CoincidentElements1D: public CoincidentElements {
389 virtual SMDSAbs_ElementType GetType() const;
391 class SMESHCONTROLS_EXPORT CoincidentElements2D: public CoincidentElements {
393 virtual SMDSAbs_ElementType GetType() const;
395 class SMESHCONTROLS_EXPORT CoincidentElements3D: public CoincidentElements {
397 virtual SMDSAbs_ElementType GetType() const;
402 Description : Predicate for free borders
404 class SMESHCONTROLS_EXPORT FreeBorders: public virtual Predicate{
407 virtual void SetMesh( const SMDS_Mesh* theMesh );
408 virtual bool IsSatisfy( long theElementId );
409 virtual SMDSAbs_ElementType GetType() const;
412 const SMDS_Mesh* myMesh;
417 Class : BadOrientedVolume
418 Description : Predicate bad oriented volumes
420 class SMESHCONTROLS_EXPORT BadOrientedVolume: public virtual Predicate{
423 virtual void SetMesh( const SMDS_Mesh* theMesh );
424 virtual bool IsSatisfy( long theElementId );
425 virtual SMDSAbs_ElementType GetType() const;
428 const SMDS_Mesh* myMesh;
434 class SMESHCONTROLS_EXPORT BareBorderVolume: public Predicate
437 BareBorderVolume():myMesh(0) {}
438 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
439 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
440 virtual bool IsSatisfy( long theElementId );
442 const SMDS_Mesh* myMesh;
444 typedef boost::shared_ptr<BareBorderVolume> BareBorderVolumePtr;
449 class SMESHCONTROLS_EXPORT BareBorderFace: public Predicate
452 BareBorderFace():myMesh(0) {}
453 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
454 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
455 virtual bool IsSatisfy( long theElementId );
457 const SMDS_Mesh* myMesh;
458 std::vector< const SMDS_MeshNode* > myLinkNodes;
460 typedef boost::shared_ptr<BareBorderFace> BareBorderFacePtr;
463 OverConstrainedVolume
465 class SMESHCONTROLS_EXPORT OverConstrainedVolume: public Predicate
468 OverConstrainedVolume():myMesh(0) {}
469 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
470 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
471 virtual bool IsSatisfy( long theElementId );
473 const SMDS_Mesh* myMesh;
475 typedef boost::shared_ptr<OverConstrainedVolume> OverConstrainedVolumePtr;
480 class SMESHCONTROLS_EXPORT OverConstrainedFace: public Predicate
483 OverConstrainedFace():myMesh(0) {}
484 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
485 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
486 virtual bool IsSatisfy( long theElementId );
488 const SMDS_Mesh* myMesh;
490 typedef boost::shared_ptr<OverConstrainedFace> OverConstrainedFacePtr;
494 Description : Predicate for free Edges
496 class SMESHCONTROLS_EXPORT FreeEdges: public virtual Predicate{
499 virtual void SetMesh( const SMDS_Mesh* theMesh );
500 virtual bool IsSatisfy( long theElementId );
501 virtual SMDSAbs_ElementType GetType() const;
502 static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
503 typedef long TElemId;
507 Border(long theElemId, long thePntId1, long thePntId2);
508 bool operator<(const Border& x) const;
510 typedef std::set<Border> TBorders;
511 void GetBoreders(TBorders& theBorders);
514 const SMDS_Mesh* myMesh;
516 typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
521 Description : Predicate for free nodes
523 class SMESHCONTROLS_EXPORT FreeNodes: public virtual Predicate{
526 virtual void SetMesh( const SMDS_Mesh* theMesh );
527 virtual bool IsSatisfy( long theNodeId );
528 virtual SMDSAbs_ElementType GetType() const;
531 const SMDS_Mesh* myMesh;
537 Description : Predicate for Range of Ids.
538 Range may be specified with two ways.
539 1. Using AddToRange method
540 2. With SetRangeStr method. Parameter of this method is a string
541 like as "1,2,3,50-60,63,67,70-"
543 class SMESHCONTROLS_EXPORT RangeOfIds: public virtual Predicate
547 virtual void SetMesh( const SMDS_Mesh* theMesh );
548 virtual bool IsSatisfy( long theNodeId );
549 virtual SMDSAbs_ElementType GetType() const;
550 virtual void SetType( SMDSAbs_ElementType theType );
552 bool AddToRange( long theEntityId );
553 void GetRangeStr( TCollection_AsciiString& );
554 bool SetRangeStr( const TCollection_AsciiString& );
557 const SMDS_Mesh* myMesh;
559 TColStd_SequenceOfInteger myMin;
560 TColStd_SequenceOfInteger myMax;
561 TColStd_MapOfInteger myIds;
563 SMDSAbs_ElementType myType;
566 typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
571 Description : Base class for comparators
573 class SMESHCONTROLS_EXPORT Comparator: public virtual Predicate{
576 virtual ~Comparator();
577 virtual void SetMesh( const SMDS_Mesh* theMesh );
578 virtual void SetMargin(double theValue);
579 virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
580 virtual bool IsSatisfy( long theElementId ) = 0;
581 virtual SMDSAbs_ElementType GetType() const;
586 NumericalFunctorPtr myFunctor;
588 typedef boost::shared_ptr<Comparator> ComparatorPtr;
593 Description : Comparator "<"
595 class SMESHCONTROLS_EXPORT LessThan: public virtual Comparator{
597 virtual bool IsSatisfy( long theElementId );
603 Description : Comparator ">"
605 class SMESHCONTROLS_EXPORT MoreThan: public virtual Comparator{
607 virtual bool IsSatisfy( long theElementId );
613 Description : Comparator "="
615 class SMESHCONTROLS_EXPORT EqualTo: public virtual Comparator{
618 virtual bool IsSatisfy( long theElementId );
619 virtual void SetTolerance( double theTol );
620 virtual double GetTolerance();
625 typedef boost::shared_ptr<EqualTo> EqualToPtr;
630 Description : Logical NOT predicate
632 class SMESHCONTROLS_EXPORT LogicalNOT: public virtual Predicate{
635 virtual ~LogicalNOT();
636 virtual bool IsSatisfy( long theElementId );
637 virtual void SetMesh( const SMDS_Mesh* theMesh );
638 virtual void SetPredicate(PredicatePtr thePred);
639 virtual SMDSAbs_ElementType GetType() const;
642 PredicatePtr myPredicate;
644 typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
648 Class : LogicalBinary
649 Description : Base class for binary logical predicate
651 class SMESHCONTROLS_EXPORT LogicalBinary: public virtual Predicate{
654 virtual ~LogicalBinary();
655 virtual void SetMesh( const SMDS_Mesh* theMesh );
656 virtual void SetPredicate1(PredicatePtr thePred);
657 virtual void SetPredicate2(PredicatePtr thePred);
658 virtual SMDSAbs_ElementType GetType() const;
661 PredicatePtr myPredicate1;
662 PredicatePtr myPredicate2;
664 typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
669 Description : Logical AND
671 class SMESHCONTROLS_EXPORT LogicalAND: public virtual LogicalBinary{
673 virtual bool IsSatisfy( long theElementId );
679 Description : Logical OR
681 class SMESHCONTROLS_EXPORT LogicalOR: public virtual LogicalBinary{
683 virtual bool IsSatisfy( long theElementId );
689 Description : Predicate for manifold part of mesh
691 class SMESHCONTROLS_EXPORT ManifoldPart: public virtual Predicate{
694 /* internal class for algorithm uses */
698 Link( SMDS_MeshNode* theNode1,
699 SMDS_MeshNode* theNode2 );
702 bool IsEqual( const ManifoldPart::Link& theLink ) const;
703 bool operator<(const ManifoldPart::Link& x) const;
705 SMDS_MeshNode* myNode1;
706 SMDS_MeshNode* myNode2;
709 bool IsEqual( const ManifoldPart::Link& theLink1,
710 const ManifoldPart::Link& theLink2 );
712 typedef std::set<ManifoldPart::Link> TMapOfLink;
713 typedef std::vector<SMDS_MeshFace*> TVectorOfFacePtr;
714 typedef std::vector<ManifoldPart::Link> TVectorOfLink;
715 typedef std::map<SMDS_MeshFace*,int> TDataMapFacePtrInt;
716 typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
720 virtual void SetMesh( const SMDS_Mesh* theMesh );
721 // inoke when all parameters already set
722 virtual bool IsSatisfy( long theElementId );
723 virtual SMDSAbs_ElementType GetType() const;
725 void SetAngleTolerance( const double theAngToler );
726 double GetAngleTolerance() const;
727 void SetIsOnlyManifold( const bool theIsOnly );
728 void SetStartElem( const long theStartElemId );
732 bool findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
733 SMDS_MeshFace* theStartFace,
734 TMapOfLink& theNonManifold,
735 TColStd_MapOfInteger& theResFaces );
736 bool isInPlane( const SMDS_MeshFace* theFace1,
737 const SMDS_MeshFace* theFace2 );
738 void expandBoundary( TMapOfLink& theMapOfBoundary,
739 TVectorOfLink& theSeqOfBoundary,
740 TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
741 TMapOfLink& theNonManifold,
742 SMDS_MeshFace* theNextFace ) const;
744 void getFacesByLink( const Link& theLink,
745 TVectorOfFacePtr& theFaces ) const;
748 const SMDS_Mesh* myMesh;
749 TColStd_MapOfInteger myMapIds;
750 TColStd_MapOfInteger myMapBadGeomIds;
751 TVectorOfFacePtr myAllFacePtr;
752 TDataMapFacePtrInt myAllFacePtrIntDMap;
754 bool myIsOnlyManifold;
758 typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
762 Class : ElementsOnSurface
763 Description : Predicate elements that lying on indicated surface
766 class SMESHCONTROLS_EXPORT ElementsOnSurface : public virtual Predicate {
769 ~ElementsOnSurface();
770 virtual void SetMesh( const SMDS_Mesh* theMesh );
771 virtual bool IsSatisfy( long theElementId );
772 virtual SMDSAbs_ElementType GetType() const;
774 void SetTolerance( const double theToler );
775 double GetTolerance() const;
776 void SetSurface( const TopoDS_Shape& theShape,
777 const SMDSAbs_ElementType theType );
778 void SetUseBoundaries( bool theUse );
779 bool GetUseBoundaries() const { return myUseBoundaries; }
783 void process( const SMDS_MeshElement* theElem );
784 bool isOnSurface( const SMDS_MeshNode* theNode );
787 TMeshModifTracer myMeshModifTracer;
788 TColStd_MapOfInteger myIds;
789 SMDSAbs_ElementType myType;
790 //Handle(Geom_Surface) mySurf;
793 bool myUseBoundaries;
794 GeomAPI_ProjectPointOnSurf myProjector;
797 typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
801 Class : ElementsOnShape
802 Description : Predicate elements that lying on indicated shape
805 class SMESHCONTROLS_EXPORT ElementsOnShape : public virtual Predicate
811 virtual void SetMesh (const SMDS_Mesh* theMesh);
812 virtual bool IsSatisfy (long theElementId);
813 virtual SMDSAbs_ElementType GetType() const;
815 void SetTolerance (const double theToler);
816 double GetTolerance() const;
817 void SetAllNodes (bool theAllNodes);
818 bool GetAllNodes() const { return myAllNodesFlag; }
819 void SetShape (const TopoDS_Shape& theShape,
820 const SMDSAbs_ElementType theType);
826 TClassifier(const TopoDS_Shape& s, double tol) { Init(s,tol); }
827 void Init(const TopoDS_Shape& s, double tol);
828 bool IsOut(const gp_Pnt& p);
829 TopAbs_ShapeEnum ShapeType() const;
831 bool isOutOfSolid (const gp_Pnt& p);
832 bool isOutOfFace (const gp_Pnt& p);
833 bool isOutOfEdge (const gp_Pnt& p);
834 bool isOutOfVertex(const gp_Pnt& p);
836 bool (TClassifier::* myIsOutFun)(const gp_Pnt& p);
837 BRepClass3d_SolidClassifier mySolidClfr;
838 GeomAPI_ProjectPointOnSurf myProjFace;
839 GeomAPI_ProjectPointOnCurve myProjEdge;
841 TopoDS_Shape myShape;
844 void clearClassifiers();
846 std::vector< TClassifier* > myClassifiers;
847 const SMDS_Mesh* myMesh;
848 SMDSAbs_ElementType myType;
849 TopoDS_Shape myShape;
855 typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
860 Description : Predicate for free faces
862 class SMESHCONTROLS_EXPORT FreeFaces: public virtual Predicate{
865 virtual void SetMesh( const SMDS_Mesh* theMesh );
866 virtual bool IsSatisfy( long theElementId );
867 virtual SMDSAbs_ElementType GetType() const;
870 const SMDS_Mesh* myMesh;
874 Class : LinearOrQuadratic
875 Description : Predicate for free faces
877 class SMESHCONTROLS_EXPORT LinearOrQuadratic: public virtual Predicate{
880 virtual void SetMesh( const SMDS_Mesh* theMesh );
881 virtual bool IsSatisfy( long theElementId );
882 void SetType( SMDSAbs_ElementType theType );
883 virtual SMDSAbs_ElementType GetType() const;
886 const SMDS_Mesh* myMesh;
887 SMDSAbs_ElementType myType;
889 typedef boost::shared_ptr<LinearOrQuadratic> LinearOrQuadraticPtr;
893 Description : Functor for check color of group to whic mesh element belongs to
895 class SMESHCONTROLS_EXPORT GroupColor: public virtual Predicate{
898 virtual void SetMesh( const SMDS_Mesh* theMesh );
899 virtual bool IsSatisfy( long theElementId );
900 void SetType( SMDSAbs_ElementType theType );
901 virtual SMDSAbs_ElementType GetType() const;
902 void SetColorStr( const TCollection_AsciiString& );
903 void GetColorStr( TCollection_AsciiString& ) const;
906 typedef std::set< long > TIDs;
908 Quantity_Color myColor;
909 SMDSAbs_ElementType myType;
912 typedef boost::shared_ptr<GroupColor> GroupColorPtr;
916 Description : Predicate to check element geometry type
918 class SMESHCONTROLS_EXPORT ElemGeomType: public virtual Predicate{
921 virtual void SetMesh( const SMDS_Mesh* theMesh );
922 virtual bool IsSatisfy( long theElementId );
923 void SetType( SMDSAbs_ElementType theType );
924 virtual SMDSAbs_ElementType GetType() const;
925 void SetGeomType( SMDSAbs_GeometryType theType );
926 virtual SMDSAbs_GeometryType GetGeomType() const;
929 const SMDS_Mesh* myMesh;
930 SMDSAbs_ElementType myType;
931 SMDSAbs_GeometryType myGeomType;
933 typedef boost::shared_ptr<ElemGeomType> ElemGeomTypePtr;
936 Class : CoplanarFaces
937 Description : Predicate to check angle between faces
939 class SMESHCONTROLS_EXPORT CoplanarFaces: public virtual Predicate
943 void SetFace( long theID ) { myFaceID = theID; }
944 long GetFace() const { return myFaceID; }
945 void SetTolerance (const double theToler) { myToler = theToler; }
946 double GetTolerance () const { return myToler; }
947 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
949 virtual void SetMesh( const SMDS_Mesh* theMesh );
950 virtual bool IsSatisfy( long theElementId );
953 TMeshModifTracer myMeshModifTracer;
956 std::set< long > myCoplanarIDs;
958 typedef boost::shared_ptr<CoplanarFaces> CoplanarFacesPtr;
963 class SMESHCONTROLS_EXPORT Filter{
967 virtual void SetPredicate(PredicatePtr thePred);
969 typedef std::vector<long> TIdSequence;
973 GetElementsId( const SMDS_Mesh* theMesh,
974 TIdSequence& theSequence );
978 GetElementsId( const SMDS_Mesh* theMesh,
979 PredicatePtr thePredicate,
980 TIdSequence& theSequence );
983 PredicatePtr myPredicate;