1 // Copyright (C) 2007-2011 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 Class : NumericalFunctor
101 Description : Root of all Functors returning numeric value
103 class SMESHCONTROLS_EXPORT NumericalFunctor: public virtual Functor{
106 virtual void SetMesh( const SMDS_Mesh* theMesh );
107 virtual double GetValue( long theElementId );
108 virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
109 void GetHistogram(int nbIntervals,
110 std::vector<int>& nbEvents,
111 std::vector<double>& funValues,
112 const std::vector<int>& elements,
113 const double* minmax=0);
114 virtual SMDSAbs_ElementType GetType() const = 0;
115 virtual double GetBadRate( double Value, int nbNodes ) const = 0;
116 long GetPrecision() const;
117 void SetPrecision( const long thePrecision );
118 double Round( const double & value );
120 bool GetPoints(const int theId, TSequenceOfXYZ& theRes) const;
121 static bool GetPoints(const SMDS_MeshElement* theElem, TSequenceOfXYZ& theRes);
123 const SMDS_Mesh* myMesh;
124 const SMDS_MeshElement* myCurrElement;
126 double myPrecisionValue;
132 Description : Functor calculating volume of 3D mesh element
134 class SMESHCONTROLS_EXPORT Volume: public virtual NumericalFunctor{
136 virtual double GetValue( long theElementId );
137 //virtual double GetValue( const TSequenceOfXYZ& thePoints );
138 virtual double GetBadRate( double Value, int nbNodes ) const;
139 virtual SMDSAbs_ElementType GetType() const;
144 Class : MaxElementLength2D
145 Description : Functor calculating maximum length of 2D element
147 class SMESHCONTROLS_EXPORT MaxElementLength2D: public virtual NumericalFunctor{
149 virtual double GetValue( long theElementId );
150 virtual double GetBadRate( double Value, int nbNodes ) const;
151 virtual SMDSAbs_ElementType GetType() const;
156 Class : MaxElementLength3D
157 Description : Functor calculating maximum length of 3D element
159 class SMESHCONTROLS_EXPORT MaxElementLength3D: public virtual NumericalFunctor{
161 virtual double GetValue( long theElementId );
162 virtual double GetBadRate( double Value, int nbNodes ) const;
163 virtual SMDSAbs_ElementType GetType() const;
168 Class : SMESH_MinimumAngle
169 Description : Functor for calculation of minimum angle
171 class SMESHCONTROLS_EXPORT MinimumAngle: public virtual NumericalFunctor{
173 virtual double GetValue( const TSequenceOfXYZ& thePoints );
174 virtual double GetBadRate( double Value, int nbNodes ) const;
175 virtual SMDSAbs_ElementType GetType() const;
181 Description : Functor for calculating aspect ratio
183 class SMESHCONTROLS_EXPORT AspectRatio: public virtual NumericalFunctor{
185 virtual double GetValue( const TSequenceOfXYZ& thePoints );
186 virtual double GetBadRate( double Value, int nbNodes ) const;
187 virtual SMDSAbs_ElementType GetType() const;
192 Class : AspectRatio3D
193 Description : Functor for calculating aspect ratio of 3D elems.
195 class SMESHCONTROLS_EXPORT AspectRatio3D: public virtual NumericalFunctor{
197 virtual double GetValue( long theElementId );
198 virtual double GetValue( const TSequenceOfXYZ& thePoints );
199 virtual double GetBadRate( double Value, int nbNodes ) const;
200 virtual SMDSAbs_ElementType GetType() const;
206 Description : Functor for calculating warping
208 class SMESHCONTROLS_EXPORT Warping: public virtual NumericalFunctor{
210 virtual double GetValue( const TSequenceOfXYZ& thePoints );
211 virtual double GetBadRate( double Value, int nbNodes ) const;
212 virtual SMDSAbs_ElementType GetType() const;
215 double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
221 Description : Functor for calculating taper
223 class SMESHCONTROLS_EXPORT Taper: public virtual NumericalFunctor{
225 virtual double GetValue( const TSequenceOfXYZ& thePoints );
226 virtual double GetBadRate( double Value, int nbNodes ) const;
227 virtual SMDSAbs_ElementType GetType() const;
233 Description : Functor for calculating skew in degrees
235 class SMESHCONTROLS_EXPORT Skew: public virtual NumericalFunctor{
237 virtual double GetValue( const TSequenceOfXYZ& thePoints );
238 virtual double GetBadRate( double Value, int nbNodes ) const;
239 virtual SMDSAbs_ElementType GetType() const;
245 Description : Functor for calculating area
247 class SMESHCONTROLS_EXPORT Area: public virtual NumericalFunctor{
249 virtual double GetValue( const TSequenceOfXYZ& thePoints );
250 virtual double GetBadRate( double Value, int nbNodes ) const;
251 virtual SMDSAbs_ElementType GetType() const;
257 Description : Functor for calculating length of edge
259 class SMESHCONTROLS_EXPORT Length: public virtual NumericalFunctor{
261 virtual double GetValue( const TSequenceOfXYZ& thePoints );
262 virtual double GetBadRate( double Value, int nbNodes ) const;
263 virtual SMDSAbs_ElementType GetType() const;
268 Description : Functor for calculating length of edge
270 class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{
272 virtual double GetValue( long theElementId );
273 virtual double GetBadRate( double Value, int nbNodes ) const;
274 virtual SMDSAbs_ElementType GetType() const;
278 Value(double theLength, long thePntId1, long thePntId2);
279 bool operator<(const Value& x) const;
281 typedef std::set<Value> TValues;
282 void GetValues(TValues& theValues);
284 typedef boost::shared_ptr<Length2D> Length2DPtr;
287 Class : MultiConnection
288 Description : Functor for calculating number of faces conneted to the edge
290 class SMESHCONTROLS_EXPORT MultiConnection: public virtual NumericalFunctor{
292 virtual double GetValue( long theElementId );
293 virtual double GetValue( const TSequenceOfXYZ& thePoints );
294 virtual double GetBadRate( double Value, int nbNodes ) const;
295 virtual SMDSAbs_ElementType GetType() const;
299 Class : MultiConnection2D
300 Description : Functor for calculating number of faces conneted to the edge
302 class SMESHCONTROLS_EXPORT MultiConnection2D: public virtual NumericalFunctor{
304 virtual double GetValue( long theElementId );
305 virtual double GetValue( const TSequenceOfXYZ& thePoints );
306 virtual double GetBadRate( double Value, int nbNodes ) const;
307 virtual SMDSAbs_ElementType GetType() const;
310 Value(long thePntId1, long thePntId2);
311 bool operator<(const Value& x) const;
313 typedef std::map<Value,int> MValues;
315 void GetValues(MValues& theValues);
317 typedef boost::shared_ptr<MultiConnection2D> MultiConnection2DPtr;
322 Class : CoincidentNodes
323 Description : Predicate of Coincident Nodes
324 Note : This class is suitable only for visualization of Coincident Nodes
326 class SMESHCONTROLS_EXPORT CoincidentNodes: public Predicate {
329 void SetTolerance (const double theToler) { myToler = theToler; }
330 void SetMesh( const SMDS_Mesh* theMesh, TIDSortedNodeSet* nodesToCheck );
331 virtual void SetMesh( const SMDS_Mesh* theMesh ) { SetMesh( theMesh, 0 ); }
332 virtual bool IsSatisfy( long theElementId );
333 virtual SMDSAbs_ElementType GetType() const;
336 TColStd_MapOfInteger myCoincidentIDs;
341 Class : CoincidentElements
342 Description : Predicate of Coincident Elements
343 Note : This class is suitable only for visualization of Coincident Elements
345 class SMESHCONTROLS_EXPORT CoincidentElements: public Predicate {
347 CoincidentElements();
348 void SetMesh( const SMDS_Mesh* theMesh, TIDSortedElemSet* elemsToCheck );
349 virtual void SetMesh( const SMDS_Mesh* theMesh ) { SetMesh( theMesh, 0 ); }
350 virtual bool IsSatisfy( long theElementId );
353 const SMDS_Mesh* myMesh;
354 TIDSortedElemSet* myElemsToCheck;
355 TColStd_MapOfInteger myCoincidentIDs;
357 class SMESHCONTROLS_EXPORT CoincidentElements1D: public CoincidentElements {
359 virtual SMDSAbs_ElementType GetType() const;
361 class SMESHCONTROLS_EXPORT CoincidentElements2D: public CoincidentElements {
363 virtual SMDSAbs_ElementType GetType() const;
365 class SMESHCONTROLS_EXPORT CoincidentElements3D: public CoincidentElements {
367 virtual SMDSAbs_ElementType GetType() const;
372 Description : Predicate for free borders
374 class SMESHCONTROLS_EXPORT FreeBorders: public virtual Predicate{
377 virtual void SetMesh( const SMDS_Mesh* theMesh );
378 virtual bool IsSatisfy( long theElementId );
379 virtual SMDSAbs_ElementType GetType() const;
382 const SMDS_Mesh* myMesh;
387 Class : BadOrientedVolume
388 Description : Predicate bad oriented volumes
390 class SMESHCONTROLS_EXPORT BadOrientedVolume: public virtual Predicate{
393 virtual void SetMesh( const SMDS_Mesh* theMesh );
394 virtual bool IsSatisfy( long theElementId );
395 virtual SMDSAbs_ElementType GetType() const;
398 const SMDS_Mesh* myMesh;
404 class SMESHCONTROLS_EXPORT BareBorderVolume: public Predicate
407 BareBorderVolume():myMesh(0) {}
408 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
409 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
410 virtual bool IsSatisfy( long theElementId );
412 const SMDS_Mesh* myMesh;
414 typedef boost::shared_ptr<BareBorderVolume> BareBorderVolumePtr;
419 class SMESHCONTROLS_EXPORT BareBorderFace: public Predicate
422 BareBorderFace():myMesh(0) {}
423 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
424 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
425 virtual bool IsSatisfy( long theElementId );
427 const SMDS_Mesh* myMesh;
428 std::vector< const SMDS_MeshNode* > myLinkNodes;
430 typedef boost::shared_ptr<BareBorderFace> BareBorderFacePtr;
433 OverConstrainedVolume
435 class SMESHCONTROLS_EXPORT OverConstrainedVolume: public Predicate
438 OverConstrainedVolume():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<OverConstrainedVolume> OverConstrainedVolumePtr;
450 class SMESHCONTROLS_EXPORT OverConstrainedFace: public Predicate
453 OverConstrainedFace():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<OverConstrainedFace> OverConstrainedFacePtr;
465 Description : Predicate for free Edges
467 class SMESHCONTROLS_EXPORT FreeEdges: public virtual Predicate{
470 virtual void SetMesh( const SMDS_Mesh* theMesh );
471 virtual bool IsSatisfy( long theElementId );
472 virtual SMDSAbs_ElementType GetType() const;
473 static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
474 typedef long TElemId;
478 Border(long theElemId, long thePntId1, long thePntId2);
479 bool operator<(const Border& x) const;
481 typedef std::set<Border> TBorders;
482 void GetBoreders(TBorders& theBorders);
485 const SMDS_Mesh* myMesh;
487 typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
492 Description : Predicate for free nodes
494 class SMESHCONTROLS_EXPORT FreeNodes: public virtual Predicate{
497 virtual void SetMesh( const SMDS_Mesh* theMesh );
498 virtual bool IsSatisfy( long theNodeId );
499 virtual SMDSAbs_ElementType GetType() const;
502 const SMDS_Mesh* myMesh;
508 Description : Predicate for Range of Ids.
509 Range may be specified with two ways.
510 1. Using AddToRange method
511 2. With SetRangeStr method. Parameter of this method is a string
512 like as "1,2,3,50-60,63,67,70-"
514 class SMESHCONTROLS_EXPORT RangeOfIds: public virtual Predicate
518 virtual void SetMesh( const SMDS_Mesh* theMesh );
519 virtual bool IsSatisfy( long theNodeId );
520 virtual SMDSAbs_ElementType GetType() const;
521 virtual void SetType( SMDSAbs_ElementType theType );
523 bool AddToRange( long theEntityId );
524 void GetRangeStr( TCollection_AsciiString& );
525 bool SetRangeStr( const TCollection_AsciiString& );
528 const SMDS_Mesh* myMesh;
530 TColStd_SequenceOfInteger myMin;
531 TColStd_SequenceOfInteger myMax;
532 TColStd_MapOfInteger myIds;
534 SMDSAbs_ElementType myType;
537 typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
542 Description : Base class for comparators
544 class SMESHCONTROLS_EXPORT Comparator: public virtual Predicate{
547 virtual ~Comparator();
548 virtual void SetMesh( const SMDS_Mesh* theMesh );
549 virtual void SetMargin(double theValue);
550 virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
551 virtual bool IsSatisfy( long theElementId ) = 0;
552 virtual SMDSAbs_ElementType GetType() const;
557 NumericalFunctorPtr myFunctor;
559 typedef boost::shared_ptr<Comparator> ComparatorPtr;
564 Description : Comparator "<"
566 class SMESHCONTROLS_EXPORT LessThan: public virtual Comparator{
568 virtual bool IsSatisfy( long theElementId );
574 Description : Comparator ">"
576 class SMESHCONTROLS_EXPORT MoreThan: public virtual Comparator{
578 virtual bool IsSatisfy( long theElementId );
584 Description : Comparator "="
586 class SMESHCONTROLS_EXPORT EqualTo: public virtual Comparator{
589 virtual bool IsSatisfy( long theElementId );
590 virtual void SetTolerance( double theTol );
591 virtual double GetTolerance();
596 typedef boost::shared_ptr<EqualTo> EqualToPtr;
601 Description : Logical NOT predicate
603 class SMESHCONTROLS_EXPORT LogicalNOT: public virtual Predicate{
606 virtual ~LogicalNOT();
607 virtual bool IsSatisfy( long theElementId );
608 virtual void SetMesh( const SMDS_Mesh* theMesh );
609 virtual void SetPredicate(PredicatePtr thePred);
610 virtual SMDSAbs_ElementType GetType() const;
613 PredicatePtr myPredicate;
615 typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
619 Class : LogicalBinary
620 Description : Base class for binary logical predicate
622 class SMESHCONTROLS_EXPORT LogicalBinary: public virtual Predicate{
625 virtual ~LogicalBinary();
626 virtual void SetMesh( const SMDS_Mesh* theMesh );
627 virtual void SetPredicate1(PredicatePtr thePred);
628 virtual void SetPredicate2(PredicatePtr thePred);
629 virtual SMDSAbs_ElementType GetType() const;
632 PredicatePtr myPredicate1;
633 PredicatePtr myPredicate2;
635 typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
640 Description : Logical AND
642 class SMESHCONTROLS_EXPORT LogicalAND: public virtual LogicalBinary{
644 virtual bool IsSatisfy( long theElementId );
650 Description : Logical OR
652 class SMESHCONTROLS_EXPORT LogicalOR: public virtual LogicalBinary{
654 virtual bool IsSatisfy( long theElementId );
660 Description : Predicate for manifold part of mesh
662 class SMESHCONTROLS_EXPORT ManifoldPart: public virtual Predicate{
665 /* internal class for algorithm uses */
669 Link( SMDS_MeshNode* theNode1,
670 SMDS_MeshNode* theNode2 );
673 bool IsEqual( const ManifoldPart::Link& theLink ) const;
674 bool operator<(const ManifoldPart::Link& x) const;
676 SMDS_MeshNode* myNode1;
677 SMDS_MeshNode* myNode2;
680 bool IsEqual( const ManifoldPart::Link& theLink1,
681 const ManifoldPart::Link& theLink2 );
683 typedef std::set<ManifoldPart::Link> TMapOfLink;
684 typedef std::vector<SMDS_MeshFace*> TVectorOfFacePtr;
685 typedef std::vector<ManifoldPart::Link> TVectorOfLink;
686 typedef std::map<SMDS_MeshFace*,int> TDataMapFacePtrInt;
687 typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
691 virtual void SetMesh( const SMDS_Mesh* theMesh );
692 // inoke when all parameters already set
693 virtual bool IsSatisfy( long theElementId );
694 virtual SMDSAbs_ElementType GetType() const;
696 void SetAngleTolerance( const double theAngToler );
697 double GetAngleTolerance() const;
698 void SetIsOnlyManifold( const bool theIsOnly );
699 void SetStartElem( const long theStartElemId );
703 bool findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
704 SMDS_MeshFace* theStartFace,
705 TMapOfLink& theNonManifold,
706 TColStd_MapOfInteger& theResFaces );
707 bool isInPlane( const SMDS_MeshFace* theFace1,
708 const SMDS_MeshFace* theFace2 );
709 void expandBoundary( TMapOfLink& theMapOfBoundary,
710 TVectorOfLink& theSeqOfBoundary,
711 TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
712 TMapOfLink& theNonManifold,
713 SMDS_MeshFace* theNextFace ) const;
715 void getFacesByLink( const Link& theLink,
716 TVectorOfFacePtr& theFaces ) const;
719 const SMDS_Mesh* myMesh;
720 TColStd_MapOfInteger myMapIds;
721 TColStd_MapOfInteger myMapBadGeomIds;
722 TVectorOfFacePtr myAllFacePtr;
723 TDataMapFacePtrInt myAllFacePtrIntDMap;
725 bool myIsOnlyManifold;
729 typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
733 Class : ElementsOnSurface
734 Description : Predicate elements that lying on indicated surface
737 class SMESHCONTROLS_EXPORT ElementsOnSurface : public virtual Predicate {
740 ~ElementsOnSurface();
741 virtual void SetMesh( const SMDS_Mesh* theMesh );
742 virtual bool IsSatisfy( long theElementId );
743 virtual SMDSAbs_ElementType GetType() const;
745 void SetTolerance( const double theToler );
746 double GetTolerance() const;
747 void SetSurface( const TopoDS_Shape& theShape,
748 const SMDSAbs_ElementType theType );
749 void SetUseBoundaries( bool theUse );
750 bool GetUseBoundaries() const { return myUseBoundaries; }
754 void process( const SMDS_MeshElement* theElem );
755 bool isOnSurface( const SMDS_MeshNode* theNode );
758 const SMDS_Mesh* myMesh;
759 TColStd_MapOfInteger myIds;
760 SMDSAbs_ElementType myType;
761 //Handle(Geom_Surface) mySurf;
764 bool myUseBoundaries;
765 GeomAPI_ProjectPointOnSurf myProjector;
768 typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
772 Class : ElementsOnShape
773 Description : Predicate elements that lying on indicated shape
776 class SMESHCONTROLS_EXPORT ElementsOnShape : public virtual Predicate
782 virtual void SetMesh (const SMDS_Mesh* theMesh);
783 virtual bool IsSatisfy (long theElementId);
784 virtual SMDSAbs_ElementType GetType() const;
786 void SetTolerance (const double theToler);
787 double GetTolerance() const;
788 void SetAllNodes (bool theAllNodes);
789 bool GetAllNodes() const { return myAllNodesFlag; }
790 void SetShape (const TopoDS_Shape& theShape,
791 const SMDSAbs_ElementType theType);
794 void addShape (const TopoDS_Shape& theShape);
796 void process (const SMDS_MeshElement* theElem);
799 const SMDS_Mesh* myMesh;
800 TColStd_MapOfInteger myIds;
801 SMDSAbs_ElementType myType;
802 TopoDS_Shape myShape;
806 TopTools_MapOfShape myShapesMap;
807 TopAbs_ShapeEnum myCurShapeType; // type of current sub-shape
808 BRepClass3d_SolidClassifier myCurSC; // current SOLID
809 GeomAPI_ProjectPointOnSurf myCurProjFace; // current FACE
810 TopoDS_Face myCurFace; // current FACE
811 GeomAPI_ProjectPointOnCurve myCurProjEdge; // current EDGE
812 gp_Pnt myCurPnt; // current VERTEX
815 typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
820 Description : Predicate for free faces
822 class SMESHCONTROLS_EXPORT FreeFaces: public virtual Predicate{
825 virtual void SetMesh( const SMDS_Mesh* theMesh );
826 virtual bool IsSatisfy( long theElementId );
827 virtual SMDSAbs_ElementType GetType() const;
830 const SMDS_Mesh* myMesh;
834 Class : LinearOrQuadratic
835 Description : Predicate for free faces
837 class SMESHCONTROLS_EXPORT LinearOrQuadratic: public virtual Predicate{
840 virtual void SetMesh( const SMDS_Mesh* theMesh );
841 virtual bool IsSatisfy( long theElementId );
842 void SetType( SMDSAbs_ElementType theType );
843 virtual SMDSAbs_ElementType GetType() const;
846 const SMDS_Mesh* myMesh;
847 SMDSAbs_ElementType myType;
849 typedef boost::shared_ptr<LinearOrQuadratic> LinearOrQuadraticPtr;
853 Description : Functor for check color of group to whic mesh element belongs to
855 class SMESHCONTROLS_EXPORT GroupColor: public virtual Predicate{
858 virtual void SetMesh( const SMDS_Mesh* theMesh );
859 virtual bool IsSatisfy( long theElementId );
860 void SetType( SMDSAbs_ElementType theType );
861 virtual SMDSAbs_ElementType GetType() const;
862 void SetColorStr( const TCollection_AsciiString& );
863 void GetColorStr( TCollection_AsciiString& ) const;
866 typedef std::set< long > TIDs;
868 Quantity_Color myColor;
869 SMDSAbs_ElementType myType;
872 typedef boost::shared_ptr<GroupColor> GroupColorPtr;
876 Description : Predicate to check element geometry type
878 class SMESHCONTROLS_EXPORT ElemGeomType: 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;
885 void SetGeomType( SMDSAbs_GeometryType theType );
886 virtual SMDSAbs_GeometryType GetGeomType() const;
889 const SMDS_Mesh* myMesh;
890 SMDSAbs_ElementType myType;
891 SMDSAbs_GeometryType myGeomType;
893 typedef boost::shared_ptr<ElemGeomType> ElemGeomTypePtr;
896 Class : CoplanarFaces
897 Description : Predicate to check angle between faces
899 class SMESHCONTROLS_EXPORT CoplanarFaces: public virtual Predicate
903 void SetFace( long theID ) { myFaceID = theID; }
904 long GetFace() const { return myFaceID; }
905 void SetTolerance (const double theToler) { myToler = theToler; }
906 double GetTolerance () const { return myToler; }
907 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
908 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
910 virtual bool IsSatisfy( long theElementId );
913 const SMDS_Mesh* myMesh;
916 std::set< long > myCoplanarIDs;
918 typedef boost::shared_ptr<CoplanarFaces> CoplanarFacesPtr;
923 class SMESHCONTROLS_EXPORT Filter{
927 virtual void SetPredicate(PredicatePtr thePred);
929 typedef std::vector<long> TIdSequence;
933 GetElementsId( const SMDS_Mesh* theMesh,
934 TIdSequence& theSequence );
938 GetElementsId( const SMDS_Mesh* theMesh,
939 PredicatePtr thePredicate,
940 TIdSequence& theSequence );
943 PredicatePtr myPredicate;