1 // Copyright (C) 2007-2010 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"
47 #include "SMESH_Controls.hxx"
50 #if defined SMESHCONTROLS_EXPORTS || defined SMESHControls_EXPORTS
51 #define SMESHCONTROLS_EXPORT __declspec( dllexport )
53 #define SMESHCONTROLS_EXPORT __declspec( dllimport )
56 #define SMESHCONTROLS_EXPORT
59 class SMDS_MeshElement;
65 class SMESHDS_SubMesh;
72 class SMESHCONTROLS_EXPORT TSequenceOfXYZ
74 typedef std::vector<gp_XYZ>::size_type size_type;
79 TSequenceOfXYZ(size_type n);
81 TSequenceOfXYZ(size_type n, const gp_XYZ& t);
83 TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ);
85 template <class InputIterator>
86 TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd);
90 TSequenceOfXYZ& operator=(const TSequenceOfXYZ& theSequenceOfXYZ);
92 gp_XYZ& operator()(size_type n);
94 const gp_XYZ& operator()(size_type n) const;
98 void reserve(size_type n);
100 void push_back(const gp_XYZ& v);
102 size_type size() const;
105 std::vector<gp_XYZ> myArray;
110 Description : Root of all Functors
112 class SMESHCONTROLS_EXPORT Functor
116 virtual void SetMesh( const SMDS_Mesh* theMesh ) = 0;
117 virtual SMDSAbs_ElementType GetType() const = 0;
121 Class : NumericalFunctor
122 Description : Root of all Functors returning numeric value
124 class SMESHCONTROLS_EXPORT NumericalFunctor: public virtual Functor{
127 virtual void SetMesh( const SMDS_Mesh* theMesh );
128 virtual double GetValue( long theElementId );
129 virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
130 void GetHistogram(int nbIntervals,
131 std::vector<int>& nbEvents,
132 std::vector<double>& funValues,
133 const std::vector<int>& elements,
134 const double* minmax=0);
135 virtual SMDSAbs_ElementType GetType() const = 0;
136 virtual double GetBadRate( double Value, int nbNodes ) const = 0;
137 long GetPrecision() const;
138 void SetPrecision( const long thePrecision );
139 double Round( const double & value );
141 bool GetPoints(const int theId,
142 TSequenceOfXYZ& theRes) const;
143 static bool GetPoints(const SMDS_MeshElement* theElem,
144 TSequenceOfXYZ& theRes);
146 const SMDS_Mesh* myMesh;
147 const SMDS_MeshElement* myCurrElement;
149 double myPrecisionValue;
155 Description : Functor calculating volume of 3D mesh element
157 class SMESHCONTROLS_EXPORT Volume: public virtual NumericalFunctor{
159 virtual double GetValue( long theElementId );
160 //virtual double GetValue( const TSequenceOfXYZ& thePoints );
161 virtual double GetBadRate( double Value, int nbNodes ) const;
162 virtual SMDSAbs_ElementType GetType() const;
167 Class : MaxElementLength2D
168 Description : Functor calculating maximum length of 2D element
170 class SMESHCONTROLS_EXPORT MaxElementLength2D: public virtual NumericalFunctor{
172 virtual double GetValue( long theElementId );
173 virtual double GetBadRate( double Value, int nbNodes ) const;
174 virtual SMDSAbs_ElementType GetType() const;
179 Class : MaxElementLength3D
180 Description : Functor calculating maximum length of 3D element
182 class SMESHCONTROLS_EXPORT MaxElementLength3D: public virtual NumericalFunctor{
184 virtual double GetValue( long theElementId );
185 virtual double GetBadRate( double Value, int nbNodes ) const;
186 virtual SMDSAbs_ElementType GetType() const;
191 Class : SMESH_MinimumAngle
192 Description : Functor for calculation of minimum angle
194 class SMESHCONTROLS_EXPORT MinimumAngle: public virtual NumericalFunctor{
196 virtual double GetValue( const TSequenceOfXYZ& thePoints );
197 virtual double GetBadRate( double Value, int nbNodes ) const;
198 virtual SMDSAbs_ElementType GetType() const;
204 Description : Functor for calculating aspect ratio
206 class SMESHCONTROLS_EXPORT AspectRatio: public virtual NumericalFunctor{
208 virtual double GetValue( const TSequenceOfXYZ& thePoints );
209 virtual double GetBadRate( double Value, int nbNodes ) const;
210 virtual SMDSAbs_ElementType GetType() const;
215 Class : AspectRatio3D
216 Description : Functor for calculating aspect ratio of 3D elems.
218 class SMESHCONTROLS_EXPORT AspectRatio3D: public virtual NumericalFunctor{
220 virtual double GetValue( long theElementId );
221 virtual double GetValue( const TSequenceOfXYZ& thePoints );
222 virtual double GetBadRate( double Value, int nbNodes ) const;
223 virtual SMDSAbs_ElementType GetType() const;
229 Description : Functor for calculating warping
231 class SMESHCONTROLS_EXPORT Warping: public virtual NumericalFunctor{
233 virtual double GetValue( const TSequenceOfXYZ& thePoints );
234 virtual double GetBadRate( double Value, int nbNodes ) const;
235 virtual SMDSAbs_ElementType GetType() const;
238 double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
244 Description : Functor for calculating taper
246 class SMESHCONTROLS_EXPORT Taper: public virtual NumericalFunctor{
248 virtual double GetValue( const TSequenceOfXYZ& thePoints );
249 virtual double GetBadRate( double Value, int nbNodes ) const;
250 virtual SMDSAbs_ElementType GetType() const;
256 Description : Functor for calculating skew in degrees
258 class SMESHCONTROLS_EXPORT Skew: public virtual NumericalFunctor{
260 virtual double GetValue( const TSequenceOfXYZ& thePoints );
261 virtual double GetBadRate( double Value, int nbNodes ) const;
262 virtual SMDSAbs_ElementType GetType() const;
268 Description : Functor for calculating area
270 class SMESHCONTROLS_EXPORT Area: public virtual NumericalFunctor{
272 virtual double GetValue( const TSequenceOfXYZ& thePoints );
273 virtual double GetBadRate( double Value, int nbNodes ) const;
274 virtual SMDSAbs_ElementType GetType() const;
280 Description : Functor for calculating length of edge
282 class SMESHCONTROLS_EXPORT Length: public virtual NumericalFunctor{
284 virtual double GetValue( const TSequenceOfXYZ& thePoints );
285 virtual double GetBadRate( double Value, int nbNodes ) const;
286 virtual SMDSAbs_ElementType GetType() const;
291 Description : Functor for calculating length of edge
293 class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{
295 virtual double GetValue( long theElementId );
296 virtual double GetBadRate( double Value, int nbNodes ) const;
297 virtual SMDSAbs_ElementType GetType() const;
301 Value(double theLength, long thePntId1, long thePntId2);
302 bool operator<(const Value& x) const;
304 typedef std::set<Value> TValues;
305 void GetValues(TValues& theValues);
307 typedef boost::shared_ptr<Length2D> Length2DPtr;
310 Class : MultiConnection
311 Description : Functor for calculating number of faces conneted to the edge
313 class SMESHCONTROLS_EXPORT MultiConnection: public virtual NumericalFunctor{
315 virtual double GetValue( long theElementId );
316 virtual double GetValue( const TSequenceOfXYZ& thePoints );
317 virtual double GetBadRate( double Value, int nbNodes ) const;
318 virtual SMDSAbs_ElementType GetType() const;
322 Class : MultiConnection2D
323 Description : Functor for calculating number of faces conneted to the edge
325 class SMESHCONTROLS_EXPORT MultiConnection2D: public virtual NumericalFunctor{
327 virtual double GetValue( long theElementId );
328 virtual double GetValue( const TSequenceOfXYZ& thePoints );
329 virtual double GetBadRate( double Value, int nbNodes ) const;
330 virtual SMDSAbs_ElementType GetType() const;
333 Value(long thePntId1, long thePntId2);
334 bool operator<(const Value& x) const;
336 typedef std::map<Value,int> MValues;
338 void GetValues(MValues& theValues);
340 typedef boost::shared_ptr<MultiConnection2D> MultiConnection2DPtr;
346 Description : Base class for all predicates
348 class SMESHCONTROLS_EXPORT Predicate: public virtual Functor{
350 virtual bool IsSatisfy( long theElementId ) = 0;
351 virtual SMDSAbs_ElementType GetType() const = 0;
357 Description : Predicate for free borders
359 class SMESHCONTROLS_EXPORT FreeBorders: public virtual Predicate{
362 virtual void SetMesh( const SMDS_Mesh* theMesh );
363 virtual bool IsSatisfy( long theElementId );
364 virtual SMDSAbs_ElementType GetType() const;
367 const SMDS_Mesh* myMesh;
372 Class : BadOrientedVolume
373 Description : Predicate bad oriented volumes
375 class SMESHCONTROLS_EXPORT BadOrientedVolume: public virtual Predicate{
378 virtual void SetMesh( const SMDS_Mesh* theMesh );
379 virtual bool IsSatisfy( long theElementId );
380 virtual SMDSAbs_ElementType GetType() const;
383 const SMDS_Mesh* myMesh;
389 class SMESHCONTROLS_EXPORT BareBorderVolume: public Predicate
392 BareBorderVolume():myMesh(0) {}
393 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
394 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
395 virtual bool IsSatisfy( long theElementId );
397 const SMDS_Mesh* myMesh;
399 typedef boost::shared_ptr<BareBorderVolume> BareBorderVolumePtr;
404 class SMESHCONTROLS_EXPORT BareBorderFace: public Predicate
407 BareBorderFace():myMesh(0) {}
408 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
409 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
410 virtual bool IsSatisfy( long theElementId );
412 const SMDS_Mesh* myMesh;
413 std::vector< const SMDS_MeshNode* > myLinkNodes;
415 typedef boost::shared_ptr<BareBorderFace> BareBorderFacePtr;
418 OverConstrainedVolume
420 class SMESHCONTROLS_EXPORT OverConstrainedVolume: public Predicate
423 OverConstrainedVolume():myMesh(0) {}
424 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
425 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
426 virtual bool IsSatisfy( long theElementId );
428 const SMDS_Mesh* myMesh;
430 typedef boost::shared_ptr<OverConstrainedVolume> OverConstrainedVolumePtr;
435 class SMESHCONTROLS_EXPORT OverConstrainedFace: public Predicate
438 OverConstrainedFace():myMesh(0) {}
439 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
440 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
441 virtual bool IsSatisfy( long theElementId );
443 const SMDS_Mesh* myMesh;
444 std::vector< const SMDS_MeshNode* > myLinkNodes;
446 typedef boost::shared_ptr<OverConstrainedFace> OverConstrainedFacePtr;
450 Description : Predicate for free Edges
452 class SMESHCONTROLS_EXPORT FreeEdges: public virtual Predicate{
455 virtual void SetMesh( const SMDS_Mesh* theMesh );
456 virtual bool IsSatisfy( long theElementId );
457 virtual SMDSAbs_ElementType GetType() const;
458 static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
459 typedef long TElemId;
463 Border(long theElemId, long thePntId1, long thePntId2);
464 bool operator<(const Border& x) const;
466 typedef std::set<Border> TBorders;
467 void GetBoreders(TBorders& theBorders);
470 const SMDS_Mesh* myMesh;
472 typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
477 Description : Predicate for free nodes
479 class SMESHCONTROLS_EXPORT FreeNodes: public virtual Predicate{
482 virtual void SetMesh( const SMDS_Mesh* theMesh );
483 virtual bool IsSatisfy( long theNodeId );
484 virtual SMDSAbs_ElementType GetType() const;
487 const SMDS_Mesh* myMesh;
493 Description : Predicate for Range of Ids.
494 Range may be specified with two ways.
495 1. Using AddToRange method
496 2. With SetRangeStr method. Parameter of this method is a string
497 like as "1,2,3,50-60,63,67,70-"
499 class SMESHCONTROLS_EXPORT RangeOfIds: public virtual Predicate
503 virtual void SetMesh( const SMDS_Mesh* theMesh );
504 virtual bool IsSatisfy( long theNodeId );
505 virtual SMDSAbs_ElementType GetType() const;
506 virtual void SetType( SMDSAbs_ElementType theType );
508 bool AddToRange( long theEntityId );
509 void GetRangeStr( TCollection_AsciiString& );
510 bool SetRangeStr( const TCollection_AsciiString& );
513 const SMDS_Mesh* myMesh;
515 TColStd_SequenceOfInteger myMin;
516 TColStd_SequenceOfInteger myMax;
517 TColStd_MapOfInteger myIds;
519 SMDSAbs_ElementType myType;
522 typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
527 Description : Base class for comparators
529 class SMESHCONTROLS_EXPORT Comparator: public virtual Predicate{
532 virtual ~Comparator();
533 virtual void SetMesh( const SMDS_Mesh* theMesh );
534 virtual void SetMargin(double theValue);
535 virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
536 virtual bool IsSatisfy( long theElementId ) = 0;
537 virtual SMDSAbs_ElementType GetType() const;
542 NumericalFunctorPtr myFunctor;
544 typedef boost::shared_ptr<Comparator> ComparatorPtr;
549 Description : Comparator "<"
551 class SMESHCONTROLS_EXPORT LessThan: public virtual Comparator{
553 virtual bool IsSatisfy( long theElementId );
559 Description : Comparator ">"
561 class SMESHCONTROLS_EXPORT MoreThan: public virtual Comparator{
563 virtual bool IsSatisfy( long theElementId );
569 Description : Comparator "="
571 class SMESHCONTROLS_EXPORT EqualTo: public virtual Comparator{
574 virtual bool IsSatisfy( long theElementId );
575 virtual void SetTolerance( double theTol );
576 virtual double GetTolerance();
581 typedef boost::shared_ptr<EqualTo> EqualToPtr;
586 Description : Logical NOT predicate
588 class SMESHCONTROLS_EXPORT LogicalNOT: public virtual Predicate{
591 virtual ~LogicalNOT();
592 virtual bool IsSatisfy( long theElementId );
593 virtual void SetMesh( const SMDS_Mesh* theMesh );
594 virtual void SetPredicate(PredicatePtr thePred);
595 virtual SMDSAbs_ElementType GetType() const;
598 PredicatePtr myPredicate;
600 typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
604 Class : LogicalBinary
605 Description : Base class for binary logical predicate
607 class SMESHCONTROLS_EXPORT LogicalBinary: public virtual Predicate{
610 virtual ~LogicalBinary();
611 virtual void SetMesh( const SMDS_Mesh* theMesh );
612 virtual void SetPredicate1(PredicatePtr thePred);
613 virtual void SetPredicate2(PredicatePtr thePred);
614 virtual SMDSAbs_ElementType GetType() const;
617 PredicatePtr myPredicate1;
618 PredicatePtr myPredicate2;
620 typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
625 Description : Logical AND
627 class SMESHCONTROLS_EXPORT LogicalAND: public virtual LogicalBinary{
629 virtual bool IsSatisfy( long theElementId );
635 Description : Logical OR
637 class SMESHCONTROLS_EXPORT LogicalOR: public virtual LogicalBinary{
639 virtual bool IsSatisfy( long theElementId );
645 Description : Predicate for manifold part of mesh
647 class SMESHCONTROLS_EXPORT ManifoldPart: public virtual Predicate{
650 /* internal class for algorithm uses */
654 Link( SMDS_MeshNode* theNode1,
655 SMDS_MeshNode* theNode2 );
658 bool IsEqual( const ManifoldPart::Link& theLink ) const;
659 bool operator<(const ManifoldPart::Link& x) const;
661 SMDS_MeshNode* myNode1;
662 SMDS_MeshNode* myNode2;
665 bool IsEqual( const ManifoldPart::Link& theLink1,
666 const ManifoldPart::Link& theLink2 );
668 typedef std::set<ManifoldPart::Link> TMapOfLink;
669 typedef std::vector<SMDS_MeshFace*> TVectorOfFacePtr;
670 typedef std::vector<ManifoldPart::Link> TVectorOfLink;
671 typedef std::map<SMDS_MeshFace*,int> TDataMapFacePtrInt;
672 typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
676 virtual void SetMesh( const SMDS_Mesh* theMesh );
677 // inoke when all parameters already set
678 virtual bool IsSatisfy( long theElementId );
679 virtual SMDSAbs_ElementType GetType() const;
681 void SetAngleTolerance( const double theAngToler );
682 double GetAngleTolerance() const;
683 void SetIsOnlyManifold( const bool theIsOnly );
684 void SetStartElem( const long theStartElemId );
688 bool findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
689 SMDS_MeshFace* theStartFace,
690 TMapOfLink& theNonManifold,
691 TColStd_MapOfInteger& theResFaces );
692 bool isInPlane( const SMDS_MeshFace* theFace1,
693 const SMDS_MeshFace* theFace2 );
694 void expandBoundary( TMapOfLink& theMapOfBoundary,
695 TVectorOfLink& theSeqOfBoundary,
696 TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
697 TMapOfLink& theNonManifold,
698 SMDS_MeshFace* theNextFace ) const;
700 void getFacesByLink( const Link& theLink,
701 TVectorOfFacePtr& theFaces ) const;
704 const SMDS_Mesh* myMesh;
705 TColStd_MapOfInteger myMapIds;
706 TColStd_MapOfInteger myMapBadGeomIds;
707 TVectorOfFacePtr myAllFacePtr;
708 TDataMapFacePtrInt myAllFacePtrIntDMap;
710 bool myIsOnlyManifold;
714 typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
718 Class : ElementsOnSurface
719 Description : Predicate elements that lying on indicated surface
722 class SMESHCONTROLS_EXPORT ElementsOnSurface : public virtual Predicate {
725 ~ElementsOnSurface();
726 virtual void SetMesh( const SMDS_Mesh* theMesh );
727 virtual bool IsSatisfy( long theElementId );
728 virtual SMDSAbs_ElementType GetType() const;
730 void SetTolerance( const double theToler );
731 double GetTolerance() const;
732 void SetSurface( const TopoDS_Shape& theShape,
733 const SMDSAbs_ElementType theType );
734 void SetUseBoundaries( bool theUse );
735 bool GetUseBoundaries() const { return myUseBoundaries; }
739 void process( const SMDS_MeshElement* theElem );
740 bool isOnSurface( const SMDS_MeshNode* theNode );
743 const SMDS_Mesh* myMesh;
744 TColStd_MapOfInteger myIds;
745 SMDSAbs_ElementType myType;
746 //Handle(Geom_Surface) mySurf;
749 bool myUseBoundaries;
750 GeomAPI_ProjectPointOnSurf myProjector;
753 typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
757 Class : ElementsOnShape
758 Description : Predicate elements that lying on indicated shape
761 class SMESHCONTROLS_EXPORT ElementsOnShape : public virtual Predicate
767 virtual void SetMesh (const SMDS_Mesh* theMesh);
768 virtual bool IsSatisfy (long theElementId);
769 virtual SMDSAbs_ElementType GetType() const;
771 void SetTolerance (const double theToler);
772 double GetTolerance() const;
773 void SetAllNodes (bool theAllNodes);
774 bool GetAllNodes() const { return myAllNodesFlag; }
775 void SetShape (const TopoDS_Shape& theShape,
776 const SMDSAbs_ElementType theType);
779 void addShape (const TopoDS_Shape& theShape);
781 void process (const SMDS_MeshElement* theElem);
784 const SMDS_Mesh* myMesh;
785 TColStd_MapOfInteger myIds;
786 SMDSAbs_ElementType myType;
787 TopoDS_Shape myShape;
791 TopTools_MapOfShape myShapesMap;
792 TopAbs_ShapeEnum myCurShapeType; // type of current sub-shape
793 BRepClass3d_SolidClassifier myCurSC; // current SOLID
794 GeomAPI_ProjectPointOnSurf myCurProjFace; // current FACE
795 TopoDS_Face myCurFace; // current FACE
796 GeomAPI_ProjectPointOnCurve myCurProjEdge; // current EDGE
797 gp_Pnt myCurPnt; // current VERTEX
800 typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
805 Description : Predicate for free faces
807 class SMESHCONTROLS_EXPORT FreeFaces: public virtual Predicate{
810 virtual void SetMesh( const SMDS_Mesh* theMesh );
811 virtual bool IsSatisfy( long theElementId );
812 virtual SMDSAbs_ElementType GetType() const;
815 const SMDS_Mesh* myMesh;
819 Class : LinearOrQuadratic
820 Description : Predicate for free faces
822 class SMESHCONTROLS_EXPORT LinearOrQuadratic: public virtual Predicate{
825 virtual void SetMesh( const SMDS_Mesh* theMesh );
826 virtual bool IsSatisfy( long theElementId );
827 void SetType( SMDSAbs_ElementType theType );
828 virtual SMDSAbs_ElementType GetType() const;
831 const SMDS_Mesh* myMesh;
832 SMDSAbs_ElementType myType;
834 typedef boost::shared_ptr<LinearOrQuadratic> LinearOrQuadraticPtr;
838 Description : Functor for check color of group to whic mesh element belongs to
840 class SMESHCONTROLS_EXPORT GroupColor: public virtual Predicate{
843 virtual void SetMesh( const SMDS_Mesh* theMesh );
844 virtual bool IsSatisfy( long theElementId );
845 void SetType( SMDSAbs_ElementType theType );
846 virtual SMDSAbs_ElementType GetType() const;
847 void SetColorStr( const TCollection_AsciiString& );
848 void GetColorStr( TCollection_AsciiString& ) const;
851 typedef std::set< long > TIDs;
853 Quantity_Color myColor;
854 SMDSAbs_ElementType myType;
857 typedef boost::shared_ptr<GroupColor> GroupColorPtr;
861 Description : Predicate to check element geometry type
863 class SMESHCONTROLS_EXPORT ElemGeomType: public virtual Predicate{
866 virtual void SetMesh( const SMDS_Mesh* theMesh );
867 virtual bool IsSatisfy( long theElementId );
868 void SetType( SMDSAbs_ElementType theType );
869 virtual SMDSAbs_ElementType GetType() const;
870 void SetGeomType( SMDSAbs_GeometryType theType );
871 virtual SMDSAbs_GeometryType GetGeomType() const;
874 const SMDS_Mesh* myMesh;
875 SMDSAbs_ElementType myType;
876 SMDSAbs_GeometryType myGeomType;
878 typedef boost::shared_ptr<ElemGeomType> ElemGeomTypePtr;
881 Class : CoplanarFaces
882 Description : Predicate to check angle between faces
884 class SMESHCONTROLS_EXPORT CoplanarFaces: public virtual Predicate
888 void SetFace( long theID ) { myFaceID = theID; }
889 long GetFace() const { return myFaceID; }
890 void SetTolerance (const double theToler) { myToler = theToler; }
891 double GetTolerance () const { return myToler; }
892 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
893 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
895 virtual bool IsSatisfy( long theElementId );
898 const SMDS_Mesh* myMesh;
901 std::set< long > myCoplanarIDs;
903 typedef boost::shared_ptr<CoplanarFaces> CoplanarFacesPtr;
908 class SMESHCONTROLS_EXPORT Filter{
912 virtual void SetPredicate(PredicatePtr thePred);
914 typedef std::vector<long> TIdSequence;
918 GetElementsId( const SMDS_Mesh* theMesh,
919 TIdSequence& theSequence );
923 GetElementsId( const SMDS_Mesh* theMesh,
924 PredicatePtr thePredicate,
925 TIdSequence& theSequence );
928 PredicatePtr myPredicate;