1 // Copyright (C) 2007-2016 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, or (at your option) any later version.
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_
26 #include "SMESH_Controls.hxx"
28 #include "SMESH_TypeDefs.hxx"
30 #include <BRepClass3d_SolidClassifier.hxx>
31 #include <Bnd_B3d.hxx>
32 #include <GeomAPI_ProjectPointOnCurve.hxx>
33 #include <GeomAPI_ProjectPointOnSurf.hxx>
34 #include <Quantity_Color.hxx>
35 #include <TColStd_MapOfInteger.hxx>
36 #include <TColStd_SequenceOfInteger.hxx>
37 #include <TCollection_AsciiString.hxx>
39 #include <TopoDS_Face.hxx>
46 #include <boost/shared_ptr.hpp>
48 class SMDS_MeshElement;
54 class SMESHDS_SubMesh;
55 class SMESHDS_GroupBase;
62 class SMESHCONTROLS_EXPORT TSequenceOfXYZ
64 typedef std::vector<gp_XYZ>::size_type size_type;
69 explicit TSequenceOfXYZ(size_type n);
71 TSequenceOfXYZ(size_type n, const gp_XYZ& t);
73 TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ);
75 template <class InputIterator>
76 TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd);
80 TSequenceOfXYZ& operator=(const TSequenceOfXYZ& theSequenceOfXYZ);
82 gp_XYZ& operator()(size_type n);
84 const gp_XYZ& operator()(size_type n) const;
88 void reserve(size_type n);
90 void push_back(const gp_XYZ& v);
92 size_type size() const;
95 void setElement(const SMDS_MeshElement* e) { myElem = e; }
97 const SMDS_MeshElement* getElement() const { return myElem; }
99 SMDSAbs_EntityType getElementEntity() const;
102 std::vector<gp_XYZ> myArray;
103 const SMDS_MeshElement* myElem;
107 * \brief Class used to detect mesh modification: IsMeshModified() returns
108 * true if a mesh has changed since last calling IsMeshModified()
110 class SMESHCONTROLS_EXPORT TMeshModifTracer
112 unsigned long myMeshModifTime;
113 const SMDS_Mesh* myMesh;
116 void SetMesh( const SMDS_Mesh* theMesh );
117 const SMDS_Mesh* GetMesh() const { return myMesh; }
118 bool IsMeshModified();
122 Class : NumericalFunctor
123 Description : Root of all Functors returning numeric value
125 class SMESHCONTROLS_EXPORT NumericalFunctor: public virtual Functor{
128 virtual void SetMesh( const SMDS_Mesh* theMesh );
129 virtual double GetValue( long theElementId );
130 virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
131 void GetHistogram(int nbIntervals,
132 std::vector<int>& nbEvents,
133 std::vector<double>& funValues,
134 const std::vector<int>& elements,
135 const double* minmax=0,
136 const bool isLogarithmic = false);
137 virtual SMDSAbs_ElementType GetType() const = 0;
138 virtual double GetBadRate( double Value, int nbNodes ) const = 0;
139 long GetPrecision() const;
140 void SetPrecision( const long thePrecision );
141 double Round( const double & value );
143 bool GetPoints(const int theId, TSequenceOfXYZ& theRes) const;
144 static bool GetPoints(const SMDS_MeshElement* theElem, 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 GetValue( const TSequenceOfXYZ& P );
174 virtual double GetBadRate( double Value, int nbNodes ) const;
175 virtual SMDSAbs_ElementType GetType() const;
180 Class : MaxElementLength3D
181 Description : Functor calculating maximum length of 3D element
183 class SMESHCONTROLS_EXPORT MaxElementLength3D: public virtual NumericalFunctor{
185 virtual double GetValue( long theElementId );
186 virtual double GetBadRate( double Value, int nbNodes ) const;
187 virtual SMDSAbs_ElementType GetType() const;
192 Class : SMESH_MinimumAngle
193 Description : Functor for calculation of minimum angle
195 class SMESHCONTROLS_EXPORT MinimumAngle: public virtual NumericalFunctor{
197 virtual double GetValue( const TSequenceOfXYZ& thePoints );
198 virtual double GetBadRate( double Value, int nbNodes ) const;
199 virtual SMDSAbs_ElementType GetType() const;
205 Description : Functor for calculating aspect ratio
207 class SMESHCONTROLS_EXPORT AspectRatio: public virtual NumericalFunctor{
209 virtual double GetValue( long theElementId );
210 virtual double GetValue( const TSequenceOfXYZ& thePoints );
211 virtual double GetBadRate( double Value, int nbNodes ) const;
212 virtual SMDSAbs_ElementType GetType() const;
217 Class : AspectRatio3D
218 Description : Functor for calculating aspect ratio of 3D elems.
220 class SMESHCONTROLS_EXPORT AspectRatio3D: public virtual NumericalFunctor{
222 virtual double GetValue( long theElementId );
223 virtual double GetValue( const TSequenceOfXYZ& thePoints );
224 virtual double GetBadRate( double Value, int nbNodes ) const;
225 virtual SMDSAbs_ElementType GetType() const;
231 Description : Functor for calculating warping
233 class SMESHCONTROLS_EXPORT Warping: public virtual NumericalFunctor{
235 virtual double GetValue( const TSequenceOfXYZ& thePoints );
236 virtual double GetBadRate( double Value, int nbNodes ) const;
237 virtual SMDSAbs_ElementType GetType() const;
240 double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
246 Description : Functor for calculating taper
248 class SMESHCONTROLS_EXPORT Taper: public virtual NumericalFunctor{
250 virtual double GetValue( const TSequenceOfXYZ& thePoints );
251 virtual double GetBadRate( double Value, int nbNodes ) const;
252 virtual SMDSAbs_ElementType GetType() const;
257 Description : Functor for calculating skew in degrees
259 class SMESHCONTROLS_EXPORT Skew: 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;
269 Description : Functor for calculating area
271 class SMESHCONTROLS_EXPORT Area: public virtual NumericalFunctor{
273 virtual double GetValue( const TSequenceOfXYZ& thePoints );
274 virtual double GetBadRate( double Value, int nbNodes ) const;
275 virtual SMDSAbs_ElementType GetType() const;
281 Description : Functor for calculating length of edge
283 class SMESHCONTROLS_EXPORT Length: public virtual NumericalFunctor{
285 virtual double GetValue( const TSequenceOfXYZ& thePoints );
286 virtual double GetBadRate( double Value, int nbNodes ) const;
287 virtual SMDSAbs_ElementType GetType() const;
292 Description : Functor for calculating length of edge
294 class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{
296 virtual double GetValue( long theElementId );
297 virtual double GetBadRate( double Value, int nbNodes ) const;
298 virtual SMDSAbs_ElementType GetType() const;
302 Value(double theLength, long thePntId1, long thePntId2);
303 bool operator<(const Value& x) const;
305 typedef std::set<Value> TValues;
306 void GetValues(TValues& theValues);
308 typedef boost::shared_ptr<Length2D> Length2DPtr;
311 Class : MultiConnection
312 Description : Functor for calculating number of faces connected to the edge
314 class SMESHCONTROLS_EXPORT MultiConnection: public virtual NumericalFunctor{
316 virtual double GetValue( long theElementId );
317 virtual double GetValue( const TSequenceOfXYZ& thePoints );
318 virtual double GetBadRate( double Value, int nbNodes ) const;
319 virtual SMDSAbs_ElementType GetType() const;
323 Class : MultiConnection2D
324 Description : Functor for calculating number of faces connected to the edge
326 class SMESHCONTROLS_EXPORT MultiConnection2D: public virtual NumericalFunctor{
328 virtual double GetValue( long theElementId );
329 virtual double GetValue( const TSequenceOfXYZ& thePoints );
330 virtual double GetBadRate( double Value, int nbNodes ) const;
331 virtual SMDSAbs_ElementType GetType() const;
334 Value(long thePntId1, long thePntId2);
335 bool operator<(const Value& x) const;
337 typedef std::map<Value,int> MValues;
339 void GetValues(MValues& theValues);
341 typedef boost::shared_ptr<MultiConnection2D> MultiConnection2DPtr;
345 Description : Functor returning diameter of a ball element
347 class SMESHCONTROLS_EXPORT BallDiameter: public virtual NumericalFunctor{
349 virtual double GetValue( long theElementId );
350 virtual double GetBadRate( double Value, int nbNodes ) const;
351 virtual SMDSAbs_ElementType GetType() const;
359 Class : CoincidentNodes
360 Description : Predicate of Coincident Nodes
361 Note : This class is suitable only for visualization of Coincident Nodes
363 class SMESHCONTROLS_EXPORT CoincidentNodes: public Predicate {
366 //virtual Predicate* clone() const { return new CoincidentNodes( *this ); }
367 virtual void SetMesh( const SMDS_Mesh* theMesh );
368 virtual bool IsSatisfy( long theElementId );
369 virtual SMDSAbs_ElementType GetType() const;
371 void SetTolerance (const double theToler) { myToler = theToler; }
372 double GetTolerance () const { return myToler; }
376 TColStd_MapOfInteger myCoincidentIDs;
377 TMeshModifTracer myMeshModifTracer;
379 typedef boost::shared_ptr<CoincidentNodes> CoincidentNodesPtr;
382 Class : CoincidentElements
383 Description : Predicate of Coincident Elements
384 Note : This class is suitable only for visualization of Coincident Elements
386 class SMESHCONTROLS_EXPORT CoincidentElements: public Predicate {
388 CoincidentElements();
389 virtual void SetMesh( const SMDS_Mesh* theMesh );
390 virtual bool IsSatisfy( long theElementId );
393 const SMDS_Mesh* myMesh;
395 class SMESHCONTROLS_EXPORT CoincidentElements1D: public CoincidentElements {
397 virtual SMDSAbs_ElementType GetType() const;
398 //virtual Predicate* clone() const { return new CoincidentElements1D( *this ); }
400 class SMESHCONTROLS_EXPORT CoincidentElements2D: public CoincidentElements {
402 virtual SMDSAbs_ElementType GetType() const;
403 //virtual Predicate* clone() const { return new CoincidentElements2D( *this ); }
405 class SMESHCONTROLS_EXPORT CoincidentElements3D: public CoincidentElements {
407 virtual SMDSAbs_ElementType GetType() const;
408 //virtual Predicate* clone() const { return new CoincidentElements3D( *this ); }
413 Description : Predicate for free borders
415 class SMESHCONTROLS_EXPORT FreeBorders: public virtual Predicate{
418 //virtual Predicate* clone() const { return new FreeBorders( *this ); }
419 virtual void SetMesh( const SMDS_Mesh* theMesh );
420 virtual bool IsSatisfy( long theElementId );
421 virtual SMDSAbs_ElementType GetType() const;
424 const SMDS_Mesh* myMesh;
429 Class : BadOrientedVolume
430 Description : Predicate bad oriented volumes
432 class SMESHCONTROLS_EXPORT BadOrientedVolume: public virtual Predicate{
435 //virtual Predicate* clone() const { return new BadOrientedVolume( *this ); }
436 virtual void SetMesh( const SMDS_Mesh* theMesh );
437 virtual bool IsSatisfy( long theElementId );
438 virtual SMDSAbs_ElementType GetType() const;
441 const SMDS_Mesh* myMesh;
445 Class : ElemEntityType
446 Description : Functor for calculating entity type
448 class SMESHCONTROLS_EXPORT ElemEntityType: public virtual Predicate{
451 //virtual Predicate* clone() const { return new ElemEntityType( *this ); }
452 virtual void SetMesh( const SMDS_Mesh* theMesh );
453 virtual bool IsSatisfy( long theElementId );
454 void SetType( SMDSAbs_ElementType theType );
455 virtual SMDSAbs_ElementType GetType() const;
456 void SetElemEntityType( SMDSAbs_EntityType theEntityType );
457 SMDSAbs_EntityType GetElemEntityType() const;
460 const SMDS_Mesh* myMesh;
461 SMDSAbs_ElementType myType;
462 SMDSAbs_EntityType myEntityType;
464 typedef boost::shared_ptr<ElemEntityType> ElemEntityTypePtr;
470 class SMESHCONTROLS_EXPORT BareBorderVolume: public Predicate
473 BareBorderVolume():myMesh(0) {}
474 virtual Predicate* clone() const { return new BareBorderVolume( *this ); }
475 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
476 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
477 virtual bool IsSatisfy( long theElementId );
479 const SMDS_Mesh* myMesh;
481 typedef boost::shared_ptr<BareBorderVolume> BareBorderVolumePtr;
486 class SMESHCONTROLS_EXPORT BareBorderFace: public Predicate
489 BareBorderFace():myMesh(0) {}
490 //virtual Predicate* clone() const { return new BareBorderFace( *this ); }
491 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
492 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
493 virtual bool IsSatisfy( long theElementId );
495 const SMDS_Mesh* myMesh;
496 std::vector< const SMDS_MeshNode* > myLinkNodes;
498 typedef boost::shared_ptr<BareBorderFace> BareBorderFacePtr;
501 OverConstrainedVolume
503 class SMESHCONTROLS_EXPORT OverConstrainedVolume: public Predicate
506 OverConstrainedVolume():myMesh(0) {}
507 virtual Predicate* clone() const { return new OverConstrainedVolume( *this ); }
508 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
509 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
510 virtual bool IsSatisfy( long theElementId );
512 const SMDS_Mesh* myMesh;
514 typedef boost::shared_ptr<OverConstrainedVolume> OverConstrainedVolumePtr;
519 class SMESHCONTROLS_EXPORT OverConstrainedFace: public Predicate
522 OverConstrainedFace():myMesh(0) {}
523 //virtual Predicate* clone() const { return new OverConstrainedFace( *this ); }
524 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
525 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
526 virtual bool IsSatisfy( long theElementId );
528 const SMDS_Mesh* myMesh;
530 typedef boost::shared_ptr<OverConstrainedFace> OverConstrainedFacePtr;
534 Description : Predicate for free Edges
536 class SMESHCONTROLS_EXPORT FreeEdges: public virtual Predicate{
539 //virtual Predicate* clone() const { return new FreeEdges( *this ); }
540 virtual void SetMesh( const SMDS_Mesh* theMesh );
541 virtual bool IsSatisfy( long theElementId );
542 virtual SMDSAbs_ElementType GetType() const;
543 static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
544 typedef long TElemId;
548 Border(long theElemId, long thePntId1, long thePntId2);
549 bool operator<(const Border& x) const;
551 typedef std::set<Border> TBorders;
552 void GetBoreders(TBorders& theBorders);
555 const SMDS_Mesh* myMesh;
557 typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
562 Description : Predicate for free nodes
564 class SMESHCONTROLS_EXPORT FreeNodes: public virtual Predicate{
567 //virtual Predicate* clone() const { return new FreeNodes( *this ); }
568 virtual void SetMesh( const SMDS_Mesh* theMesh );
569 virtual bool IsSatisfy( long theNodeId );
570 virtual SMDSAbs_ElementType GetType() const;
573 const SMDS_Mesh* myMesh;
579 Description : Predicate for Range of Ids.
580 Range may be specified with two ways.
581 1. Using AddToRange method
582 2. With SetRangeStr method. Parameter of this method is a string
583 like as "1,2,3,50-60,63,67,70-"
585 class SMESHCONTROLS_EXPORT RangeOfIds: public virtual Predicate
589 //virtual Predicate* clone() const { return new RangeOfIds( *this ); }
590 virtual void SetMesh( const SMDS_Mesh* theMesh );
591 virtual bool IsSatisfy( long theNodeId );
592 virtual SMDSAbs_ElementType GetType() const;
593 virtual void SetType( SMDSAbs_ElementType theType );
595 bool AddToRange( long theEntityId );
596 void GetRangeStr( TCollection_AsciiString& );
597 bool SetRangeStr( const TCollection_AsciiString& );
600 const SMDS_Mesh* myMesh;
602 TColStd_SequenceOfInteger myMin;
603 TColStd_SequenceOfInteger myMax;
604 TColStd_MapOfInteger myIds;
606 SMDSAbs_ElementType myType;
609 typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
614 Description : Base class for comparators
616 class SMESHCONTROLS_EXPORT Comparator: public virtual Predicate{
619 virtual ~Comparator();
620 virtual void SetMesh( const SMDS_Mesh* theMesh );
621 virtual void SetMargin(double theValue);
622 virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
623 virtual bool IsSatisfy( long theElementId ) = 0;
624 virtual SMDSAbs_ElementType GetType() const;
629 NumericalFunctorPtr myFunctor;
631 typedef boost::shared_ptr<Comparator> ComparatorPtr;
636 Description : Comparator "<"
638 class SMESHCONTROLS_EXPORT LessThan: public virtual Comparator{
640 virtual bool IsSatisfy( long theElementId );
641 //virtual Predicate* clone() const { return new LessThan( *this ); }
647 Description : Comparator ">"
649 class SMESHCONTROLS_EXPORT MoreThan: public virtual Comparator{
651 virtual bool IsSatisfy( long theElementId );
652 //virtual Predicate* clone() const { return new MoreThan( *this ); }
658 Description : Comparator "="
660 class SMESHCONTROLS_EXPORT EqualTo: public virtual Comparator{
663 //virtual Predicate* clone() const { return new EqualTo( *this ); }
664 virtual bool IsSatisfy( long theElementId );
665 virtual void SetTolerance( double theTol );
666 virtual double GetTolerance();
671 typedef boost::shared_ptr<EqualTo> EqualToPtr;
676 Description : Logical NOT predicate
678 class SMESHCONTROLS_EXPORT LogicalNOT: public virtual Predicate{
681 //virtual Predicate* clone() const { return new LogicalNOT( *this ); }
682 virtual ~LogicalNOT();
683 virtual bool IsSatisfy( long theElementId );
684 virtual void SetMesh( const SMDS_Mesh* theMesh );
685 virtual void SetPredicate(PredicatePtr thePred);
686 virtual SMDSAbs_ElementType GetType() const;
689 PredicatePtr myPredicate;
691 typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
695 Class : LogicalBinary
696 Description : Base class for binary logical predicate
698 class SMESHCONTROLS_EXPORT LogicalBinary: public virtual Predicate{
701 virtual ~LogicalBinary();
702 virtual void SetMesh( const SMDS_Mesh* theMesh );
703 virtual void SetPredicate1(PredicatePtr thePred);
704 virtual void SetPredicate2(PredicatePtr thePred);
705 virtual SMDSAbs_ElementType GetType() const;
708 PredicatePtr myPredicate1;
709 PredicatePtr myPredicate2;
711 typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
716 Description : Logical AND
718 class SMESHCONTROLS_EXPORT LogicalAND: public virtual LogicalBinary{
720 virtual bool IsSatisfy( long theElementId );
721 //virtual Predicate* clone() const { return new LogicalAND( *this ); }
727 Description : Logical OR
729 class SMESHCONTROLS_EXPORT LogicalOR: public virtual LogicalBinary{
731 virtual bool IsSatisfy( long theElementId );
732 //virtual Predicate* clone() const { return new LogicalOR( *this ); }
738 Description : Predicate for manifold part of mesh
740 class SMESHCONTROLS_EXPORT ManifoldPart: public virtual Predicate{
743 /* internal class for algorithm uses */
747 Link( SMDS_MeshNode* theNode1,
748 SMDS_MeshNode* theNode2 );
751 bool IsEqual( const ManifoldPart::Link& theLink ) const;
752 bool operator<(const ManifoldPart::Link& x) const;
754 SMDS_MeshNode* myNode1;
755 SMDS_MeshNode* myNode2;
758 bool IsEqual( const ManifoldPart::Link& theLink1,
759 const ManifoldPart::Link& theLink2 );
761 typedef std::set<ManifoldPart::Link> TMapOfLink;
762 typedef std::vector<SMDS_MeshFace*> TVectorOfFacePtr;
763 typedef std::vector<ManifoldPart::Link> TVectorOfLink;
764 typedef std::map<SMDS_MeshFace*,int> TDataMapFacePtrInt;
765 typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
769 //virtual Predicate* clone() const { return new ManifoldPart( *this ); }
770 virtual void SetMesh( const SMDS_Mesh* theMesh );
771 // inoke when all parameters already set
772 virtual bool IsSatisfy( long theElementId );
773 virtual SMDSAbs_ElementType GetType() const;
775 void SetAngleTolerance( const double theAngToler );
776 double GetAngleTolerance() const;
777 void SetIsOnlyManifold( const bool theIsOnly );
778 void SetStartElem( const long theStartElemId );
782 bool findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
783 SMDS_MeshFace* theStartFace,
784 TMapOfLink& theNonManifold,
785 TColStd_MapOfInteger& theResFaces );
786 bool isInPlane( const SMDS_MeshFace* theFace1,
787 const SMDS_MeshFace* theFace2 );
788 void expandBoundary( TMapOfLink& theMapOfBoundary,
789 TVectorOfLink& theSeqOfBoundary,
790 TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
791 TMapOfLink& theNonManifold,
792 SMDS_MeshFace* theNextFace ) const;
794 void getFacesByLink( const Link& theLink,
795 TVectorOfFacePtr& theFaces ) const;
798 const SMDS_Mesh* myMesh;
799 TColStd_MapOfInteger myMapIds;
800 TColStd_MapOfInteger myMapBadGeomIds;
801 TVectorOfFacePtr myAllFacePtr;
802 TDataMapFacePtrInt myAllFacePtrIntDMap;
804 bool myIsOnlyManifold;
808 typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
811 Class : BelongToMeshGroup
812 Description : Verify whether a mesh element is included into a mesh group
814 class SMESHCONTROLS_EXPORT BelongToMeshGroup : public virtual Predicate
818 //virtual Predicate* clone() const { return new BelongToMeshGroup( *this ); }
819 virtual void SetMesh( const SMDS_Mesh* theMesh );
820 virtual bool IsSatisfy( long theElementId );
821 virtual SMDSAbs_ElementType GetType() const;
823 void SetGroup( SMESHDS_GroupBase* g );
824 void SetStoreName( const std::string& sn );
825 const SMESHDS_GroupBase* GetGroup() const { return myGroup; }
828 SMESHDS_GroupBase* myGroup;
829 std::string myStoreName;
831 typedef boost::shared_ptr<BelongToMeshGroup> BelongToMeshGroupPtr;
834 Class : ElementsOnSurface
835 Description : Predicate elements that lying on indicated surface
838 class SMESHCONTROLS_EXPORT ElementsOnSurface : public virtual Predicate {
841 ~ElementsOnSurface();
842 //virtual Predicate* clone() const { return new ElementsOnSurface( *this ); }
843 virtual void SetMesh( const SMDS_Mesh* theMesh );
844 virtual bool IsSatisfy( long theElementId );
845 virtual SMDSAbs_ElementType GetType() const;
847 void SetTolerance( const double theToler );
848 double GetTolerance() const;
849 void SetSurface( const TopoDS_Shape& theShape,
850 const SMDSAbs_ElementType theType );
851 void SetUseBoundaries( bool theUse );
852 bool GetUseBoundaries() const { return myUseBoundaries; }
856 void process( const SMDS_MeshElement* theElem );
857 bool isOnSurface( const SMDS_MeshNode* theNode );
860 TMeshModifTracer myMeshModifTracer;
861 TColStd_MapOfInteger myIds;
862 SMDSAbs_ElementType myType;
865 bool myUseBoundaries;
866 GeomAPI_ProjectPointOnSurf myProjector;
869 typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
873 Class : ElementsOnShape
874 Description : Predicate elements that lying on indicated shape
877 class SMESHCONTROLS_EXPORT ElementsOnShape : public Predicate
883 virtual Predicate* clone() const;
884 virtual void SetMesh (const SMDS_Mesh* theMesh);
885 virtual bool IsSatisfy (long theElementId);
886 virtual SMDSAbs_ElementType GetType() const;
888 void SetTolerance (const double theToler);
889 double GetTolerance() const;
890 void SetAllNodes (bool theAllNodes);
891 bool GetAllNodes() const { return myAllNodesFlag; }
892 void SetShape (const TopoDS_Shape& theShape,
893 const SMDSAbs_ElementType theType);
898 struct OctreeClassifier;
900 void clearClassifiers();
901 bool getNodeIsOut( const SMDS_MeshNode* n, bool& isOut );
902 void setNodeIsOut( const SMDS_MeshNode* n, bool isOut );
904 std::vector< Classifier > myClassifiers;
905 std::vector< Classifier* > myWorkClassifiers;
906 OctreeClassifier* myOctree;
907 SMDSAbs_ElementType myType;
908 TopoDS_Shape myShape;
912 TMeshModifTracer myMeshModifTracer;
913 std::vector<bool> myNodeIsChecked;
914 std::vector<bool> myNodeIsOut;
917 typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
922 Description : Predicate for verifying whether entiy belong to
923 specified geometrical support
925 class SMESHCONTROLS_EXPORT BelongToGeom: public virtual Predicate
929 virtual Predicate* clone() const;
931 virtual void SetMesh( const SMDS_Mesh* theMesh );
932 virtual void SetGeom( const TopoDS_Shape& theShape );
934 virtual bool IsSatisfy( long theElementId );
936 virtual void SetType( SMDSAbs_ElementType theType );
937 virtual SMDSAbs_ElementType GetType() const;
939 TopoDS_Shape GetShape();
940 const SMESHDS_Mesh* GetMeshDS() const;
942 void SetTolerance( double );
943 double GetTolerance();
948 TopoDS_Shape myShape;
949 TColStd_MapOfInteger mySubShapesIDs;
950 const SMESHDS_Mesh* myMeshDS;
951 SMDSAbs_ElementType myType;
953 double myTolerance; // only if myIsSubshape == false
954 Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false
956 typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
960 Description : Predicate for verifying whether entiy lying or partially lying on
961 specified geometrical support
963 class SMESHCONTROLS_EXPORT LyingOnGeom: public virtual Predicate
967 virtual Predicate* clone() const;
969 virtual void SetMesh( const SMDS_Mesh* theMesh );
970 virtual void SetGeom( const TopoDS_Shape& theShape );
972 virtual bool IsSatisfy( long theElementId );
974 virtual void SetType( SMDSAbs_ElementType theType );
975 virtual SMDSAbs_ElementType GetType() const;
977 TopoDS_Shape GetShape();
978 const SMESHDS_Mesh* GetMeshDS() const;
980 void SetTolerance( double );
981 double GetTolerance();
986 TopoDS_Shape myShape;
987 TColStd_MapOfInteger mySubShapesIDs;
988 const SMESHDS_Mesh* myMeshDS;
989 SMDSAbs_ElementType myType;
991 double myTolerance; // only if myIsSubshape == false
992 Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false
994 typedef boost::shared_ptr<LyingOnGeom> LyingOnGeomPtr;
998 Description : Predicate for free faces
1000 class SMESHCONTROLS_EXPORT FreeFaces: public virtual Predicate{
1003 //virtual Predicate* clone() const { return new FreeFaces( *this ); }
1004 virtual void SetMesh( const SMDS_Mesh* theMesh );
1005 virtual bool IsSatisfy( long theElementId );
1006 virtual SMDSAbs_ElementType GetType() const;
1009 const SMDS_Mesh* myMesh;
1013 Class : LinearOrQuadratic
1014 Description : Predicate for free faces
1016 class SMESHCONTROLS_EXPORT LinearOrQuadratic: public virtual Predicate{
1018 LinearOrQuadratic();
1019 //virtual Predicate* clone() const { return new LinearOrQuadratic( *this ); }
1020 virtual void SetMesh( const SMDS_Mesh* theMesh );
1021 virtual bool IsSatisfy( long theElementId );
1022 void SetType( SMDSAbs_ElementType theType );
1023 virtual SMDSAbs_ElementType GetType() const;
1026 const SMDS_Mesh* myMesh;
1027 SMDSAbs_ElementType myType;
1029 typedef boost::shared_ptr<LinearOrQuadratic> LinearOrQuadraticPtr;
1033 Description : Functor for check color of group to whic mesh element belongs to
1035 class SMESHCONTROLS_EXPORT GroupColor: public virtual Predicate{
1038 //virtual Predicate* clone() const { return new GroupColor( *this ); }
1039 virtual void SetMesh( const SMDS_Mesh* theMesh );
1040 virtual bool IsSatisfy( long theElementId );
1041 void SetType( SMDSAbs_ElementType theType );
1042 virtual SMDSAbs_ElementType GetType() const;
1043 void SetColorStr( const TCollection_AsciiString& );
1044 void GetColorStr( TCollection_AsciiString& ) const;
1047 typedef std::set< long > TIDs;
1049 Quantity_Color myColor;
1050 SMDSAbs_ElementType myType;
1053 typedef boost::shared_ptr<GroupColor> GroupColorPtr;
1056 Class : ElemGeomType
1057 Description : Predicate to check element geometry type
1059 class SMESHCONTROLS_EXPORT ElemGeomType: public virtual Predicate{
1062 //virtual Predicate* clone() const { return new ElemGeomType( *this ); }
1063 virtual void SetMesh( const SMDS_Mesh* theMesh );
1064 virtual bool IsSatisfy( long theElementId );
1065 void SetType( SMDSAbs_ElementType theType );
1066 virtual SMDSAbs_ElementType GetType() const;
1067 void SetGeomType( SMDSAbs_GeometryType theType );
1068 SMDSAbs_GeometryType GetGeomType() const;
1071 const SMDS_Mesh* myMesh;
1072 SMDSAbs_ElementType myType;
1073 SMDSAbs_GeometryType myGeomType;
1075 typedef boost::shared_ptr<ElemGeomType> ElemGeomTypePtr;
1078 Class : CoplanarFaces
1079 Description : Predicate to check angle between faces
1081 class SMESHCONTROLS_EXPORT CoplanarFaces: public virtual Predicate
1085 //virtual Predicate* clone() const { return new CoplanarFaces( *this ); }
1086 void SetFace( long theID ) { myFaceID = theID; }
1087 long GetFace() const { return myFaceID; }
1088 void SetTolerance (const double theToler) { myToler = theToler; }
1089 double GetTolerance () const { return myToler; }
1090 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
1092 virtual void SetMesh( const SMDS_Mesh* theMesh );
1093 virtual bool IsSatisfy( long theElementId );
1096 TMeshModifTracer myMeshModifTracer;
1099 TColStd_MapOfInteger myCoplanarIDs;
1101 typedef boost::shared_ptr<CoplanarFaces> CoplanarFacesPtr;
1104 Class : ConnectedElements
1105 Description : Predicate to get elements of one domain
1107 class SMESHCONTROLS_EXPORT ConnectedElements: public virtual Predicate
1110 ConnectedElements();
1111 //virtual Predicate* clone() const { return new ConnectedElements( *this ); }
1112 void SetNode( int nodeID );
1113 void SetPoint( double x, double y, double z );
1114 int GetNode() const;
1115 std::vector<double> GetPoint() const;
1117 void SetType( SMDSAbs_ElementType theType );
1118 virtual SMDSAbs_ElementType GetType() const;
1120 virtual void SetMesh( const SMDS_Mesh* theMesh );
1121 virtual bool IsSatisfy( long theElementId );
1123 //const std::set<long>& GetDomainIDs() const { return myOkIDs; }
1127 std::vector<double> myXYZ;
1128 SMDSAbs_ElementType myType;
1129 TMeshModifTracer myMeshModifTracer;
1133 std::set< int > myOkIDs; // empty means that there is one domain
1135 typedef boost::shared_ptr<ConnectedElements> ConnectedElementsPtr;
1140 class SMESHCONTROLS_EXPORT Filter {
1144 virtual void SetPredicate(PredicatePtr thePred);
1146 typedef std::vector<long> TIdSequence;
1150 GetElementsId( const SMDS_Mesh* theMesh,
1151 TIdSequence& theSequence );
1155 GetElementsId( const SMDS_Mesh* theMesh,
1156 PredicatePtr thePredicate,
1157 TIdSequence& theSequence );
1160 PredicatePtr myPredicate;