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;
355 Class : NodeConnectivityNumber
356 Description : Functor returning number of elements connected to a node
358 class SMESHCONTROLS_EXPORT NodeConnectivityNumber: public virtual NumericalFunctor{
360 virtual double GetValue( long theNodeId );
361 virtual double GetBadRate( double Value, int nbNodes ) const;
362 virtual SMDSAbs_ElementType GetType() const;
370 Class : CoincidentNodes
371 Description : Predicate of Coincident Nodes
372 Note : This class is suitable only for visualization of Coincident Nodes
374 class SMESHCONTROLS_EXPORT CoincidentNodes: public Predicate {
377 //virtual Predicate* clone() const { return new CoincidentNodes( *this ); }
378 virtual void SetMesh( const SMDS_Mesh* theMesh );
379 virtual bool IsSatisfy( long theElementId );
380 virtual SMDSAbs_ElementType GetType() const;
382 void SetTolerance (const double theToler) { myToler = theToler; }
383 double GetTolerance () const { return myToler; }
387 TColStd_MapOfInteger myCoincidentIDs;
388 TMeshModifTracer myMeshModifTracer;
390 typedef boost::shared_ptr<CoincidentNodes> CoincidentNodesPtr;
393 Class : CoincidentElements
394 Description : Predicate of Coincident Elements
395 Note : This class is suitable only for visualization of Coincident Elements
397 class SMESHCONTROLS_EXPORT CoincidentElements: public Predicate {
399 CoincidentElements();
400 virtual void SetMesh( const SMDS_Mesh* theMesh );
401 virtual bool IsSatisfy( long theElementId );
404 const SMDS_Mesh* myMesh;
406 class SMESHCONTROLS_EXPORT CoincidentElements1D: public CoincidentElements {
408 virtual SMDSAbs_ElementType GetType() const;
409 //virtual Predicate* clone() const { return new CoincidentElements1D( *this ); }
411 class SMESHCONTROLS_EXPORT CoincidentElements2D: public CoincidentElements {
413 virtual SMDSAbs_ElementType GetType() const;
414 //virtual Predicate* clone() const { return new CoincidentElements2D( *this ); }
416 class SMESHCONTROLS_EXPORT CoincidentElements3D: public CoincidentElements {
418 virtual SMDSAbs_ElementType GetType() const;
419 //virtual Predicate* clone() const { return new CoincidentElements3D( *this ); }
424 Description : Predicate for free borders
426 class SMESHCONTROLS_EXPORT FreeBorders: public virtual Predicate{
429 //virtual Predicate* clone() const { return new FreeBorders( *this ); }
430 virtual void SetMesh( const SMDS_Mesh* theMesh );
431 virtual bool IsSatisfy( long theElementId );
432 virtual SMDSAbs_ElementType GetType() const;
435 const SMDS_Mesh* myMesh;
440 Class : BadOrientedVolume
441 Description : Predicate bad oriented volumes
443 class SMESHCONTROLS_EXPORT BadOrientedVolume: public virtual Predicate{
446 //virtual Predicate* clone() const { return new BadOrientedVolume( *this ); }
447 virtual void SetMesh( const SMDS_Mesh* theMesh );
448 virtual bool IsSatisfy( long theElementId );
449 virtual SMDSAbs_ElementType GetType() const;
452 const SMDS_Mesh* myMesh;
456 Class : ElemEntityType
457 Description : Functor for calculating entity type
459 class SMESHCONTROLS_EXPORT ElemEntityType: public virtual Predicate{
462 //virtual Predicate* clone() const { return new ElemEntityType( *this ); }
463 virtual void SetMesh( const SMDS_Mesh* theMesh );
464 virtual bool IsSatisfy( long theElementId );
465 void SetType( SMDSAbs_ElementType theType );
466 virtual SMDSAbs_ElementType GetType() const;
467 void SetElemEntityType( SMDSAbs_EntityType theEntityType );
468 SMDSAbs_EntityType GetElemEntityType() const;
471 const SMDS_Mesh* myMesh;
472 SMDSAbs_ElementType myType;
473 SMDSAbs_EntityType myEntityType;
475 typedef boost::shared_ptr<ElemEntityType> ElemEntityTypePtr;
481 class SMESHCONTROLS_EXPORT BareBorderVolume: public Predicate
484 BareBorderVolume():myMesh(0) {}
485 virtual Predicate* clone() const { return new BareBorderVolume( *this ); }
486 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
487 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
488 virtual bool IsSatisfy( long theElementId );
490 const SMDS_Mesh* myMesh;
492 typedef boost::shared_ptr<BareBorderVolume> BareBorderVolumePtr;
497 class SMESHCONTROLS_EXPORT BareBorderFace: public Predicate
500 BareBorderFace():myMesh(0) {}
501 //virtual Predicate* clone() const { return new BareBorderFace( *this ); }
502 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
503 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
504 virtual bool IsSatisfy( long theElementId );
506 const SMDS_Mesh* myMesh;
507 std::vector< const SMDS_MeshNode* > myLinkNodes;
509 typedef boost::shared_ptr<BareBorderFace> BareBorderFacePtr;
512 OverConstrainedVolume
514 class SMESHCONTROLS_EXPORT OverConstrainedVolume: public Predicate
517 OverConstrainedVolume():myMesh(0) {}
518 virtual Predicate* clone() const { return new OverConstrainedVolume( *this ); }
519 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
520 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Volume; }
521 virtual bool IsSatisfy( long theElementId );
523 const SMDS_Mesh* myMesh;
525 typedef boost::shared_ptr<OverConstrainedVolume> OverConstrainedVolumePtr;
530 class SMESHCONTROLS_EXPORT OverConstrainedFace: public Predicate
533 OverConstrainedFace():myMesh(0) {}
534 //virtual Predicate* clone() const { return new OverConstrainedFace( *this ); }
535 virtual void SetMesh( const SMDS_Mesh* theMesh ) { myMesh = theMesh; }
536 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
537 virtual bool IsSatisfy( long theElementId );
539 const SMDS_Mesh* myMesh;
541 typedef boost::shared_ptr<OverConstrainedFace> OverConstrainedFacePtr;
545 Description : Predicate for free Edges
547 class SMESHCONTROLS_EXPORT FreeEdges: public virtual Predicate{
550 //virtual Predicate* clone() const { return new FreeEdges( *this ); }
551 virtual void SetMesh( const SMDS_Mesh* theMesh );
552 virtual bool IsSatisfy( long theElementId );
553 virtual SMDSAbs_ElementType GetType() const;
554 static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
555 typedef long TElemId;
559 Border(long theElemId, long thePntId1, long thePntId2);
560 bool operator<(const Border& x) const;
562 typedef std::set<Border> TBorders;
563 void GetBoreders(TBorders& theBorders);
566 const SMDS_Mesh* myMesh;
568 typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
573 Description : Predicate for free nodes
575 class SMESHCONTROLS_EXPORT FreeNodes: public virtual Predicate{
578 //virtual Predicate* clone() const { return new FreeNodes( *this ); }
579 virtual void SetMesh( const SMDS_Mesh* theMesh );
580 virtual bool IsSatisfy( long theNodeId );
581 virtual SMDSAbs_ElementType GetType() const;
584 const SMDS_Mesh* myMesh;
590 Description : Predicate for Range of Ids.
591 Range may be specified with two ways.
592 1. Using AddToRange method
593 2. With SetRangeStr method. Parameter of this method is a string
594 like as "1,2,3,50-60,63,67,70-"
596 class SMESHCONTROLS_EXPORT RangeOfIds: public virtual Predicate
600 //virtual Predicate* clone() const { return new RangeOfIds( *this ); }
601 virtual void SetMesh( const SMDS_Mesh* theMesh );
602 virtual bool IsSatisfy( long theNodeId );
603 virtual SMDSAbs_ElementType GetType() const;
604 virtual void SetType( SMDSAbs_ElementType theType );
606 bool AddToRange( long theEntityId );
607 void GetRangeStr( TCollection_AsciiString& );
608 bool SetRangeStr( const TCollection_AsciiString& );
611 const SMDS_Mesh* myMesh;
613 TColStd_SequenceOfInteger myMin;
614 TColStd_SequenceOfInteger myMax;
615 TColStd_MapOfInteger myIds;
617 SMDSAbs_ElementType myType;
620 typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
625 Description : Base class for comparators
627 class SMESHCONTROLS_EXPORT Comparator: public virtual Predicate{
630 virtual ~Comparator();
631 virtual void SetMesh( const SMDS_Mesh* theMesh );
632 virtual void SetMargin(double theValue);
633 virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
634 virtual bool IsSatisfy( long theElementId ) = 0;
635 virtual SMDSAbs_ElementType GetType() const;
640 NumericalFunctorPtr myFunctor;
642 typedef boost::shared_ptr<Comparator> ComparatorPtr;
647 Description : Comparator "<"
649 class SMESHCONTROLS_EXPORT LessThan: public virtual Comparator{
651 virtual bool IsSatisfy( long theElementId );
652 //virtual Predicate* clone() const { return new LessThan( *this ); }
658 Description : Comparator ">"
660 class SMESHCONTROLS_EXPORT MoreThan: public virtual Comparator{
662 virtual bool IsSatisfy( long theElementId );
663 //virtual Predicate* clone() const { return new MoreThan( *this ); }
669 Description : Comparator "="
671 class SMESHCONTROLS_EXPORT EqualTo: public virtual Comparator{
674 //virtual Predicate* clone() const { return new EqualTo( *this ); }
675 virtual bool IsSatisfy( long theElementId );
676 virtual void SetTolerance( double theTol );
677 virtual double GetTolerance();
682 typedef boost::shared_ptr<EqualTo> EqualToPtr;
687 Description : Logical NOT predicate
689 class SMESHCONTROLS_EXPORT LogicalNOT: public virtual Predicate{
692 //virtual Predicate* clone() const { return new LogicalNOT( *this ); }
693 virtual ~LogicalNOT();
694 virtual bool IsSatisfy( long theElementId );
695 virtual void SetMesh( const SMDS_Mesh* theMesh );
696 virtual void SetPredicate(PredicatePtr thePred);
697 virtual SMDSAbs_ElementType GetType() const;
700 PredicatePtr myPredicate;
702 typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
706 Class : LogicalBinary
707 Description : Base class for binary logical predicate
709 class SMESHCONTROLS_EXPORT LogicalBinary: public virtual Predicate{
712 virtual ~LogicalBinary();
713 virtual void SetMesh( const SMDS_Mesh* theMesh );
714 virtual void SetPredicate1(PredicatePtr thePred);
715 virtual void SetPredicate2(PredicatePtr thePred);
716 virtual SMDSAbs_ElementType GetType() const;
719 PredicatePtr myPredicate1;
720 PredicatePtr myPredicate2;
722 typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
727 Description : Logical AND
729 class SMESHCONTROLS_EXPORT LogicalAND: public virtual LogicalBinary{
731 virtual bool IsSatisfy( long theElementId );
732 //virtual Predicate* clone() const { return new LogicalAND( *this ); }
738 Description : Logical OR
740 class SMESHCONTROLS_EXPORT LogicalOR: public virtual LogicalBinary{
742 virtual bool IsSatisfy( long theElementId );
743 //virtual Predicate* clone() const { return new LogicalOR( *this ); }
749 Description : Predicate for manifold part of mesh
751 class SMESHCONTROLS_EXPORT ManifoldPart: public virtual Predicate{
754 /* internal class for algorithm uses */
758 Link( SMDS_MeshNode* theNode1,
759 SMDS_MeshNode* theNode2 );
762 bool IsEqual( const ManifoldPart::Link& theLink ) const;
763 bool operator<(const ManifoldPart::Link& x) const;
765 SMDS_MeshNode* myNode1;
766 SMDS_MeshNode* myNode2;
769 bool IsEqual( const ManifoldPart::Link& theLink1,
770 const ManifoldPart::Link& theLink2 );
772 typedef std::set<ManifoldPart::Link> TMapOfLink;
773 typedef std::vector<SMDS_MeshFace*> TVectorOfFacePtr;
774 typedef std::vector<ManifoldPart::Link> TVectorOfLink;
775 typedef std::map<SMDS_MeshFace*,int> TDataMapFacePtrInt;
776 typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
780 //virtual Predicate* clone() const { return new ManifoldPart( *this ); }
781 virtual void SetMesh( const SMDS_Mesh* theMesh );
782 // inoke when all parameters already set
783 virtual bool IsSatisfy( long theElementId );
784 virtual SMDSAbs_ElementType GetType() const;
786 void SetAngleTolerance( const double theAngToler );
787 double GetAngleTolerance() const;
788 void SetIsOnlyManifold( const bool theIsOnly );
789 void SetStartElem( const long theStartElemId );
793 bool findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
794 SMDS_MeshFace* theStartFace,
795 TMapOfLink& theNonManifold,
796 TColStd_MapOfInteger& theResFaces );
797 bool isInPlane( const SMDS_MeshFace* theFace1,
798 const SMDS_MeshFace* theFace2 );
799 void expandBoundary( TMapOfLink& theMapOfBoundary,
800 TVectorOfLink& theSeqOfBoundary,
801 TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
802 TMapOfLink& theNonManifold,
803 SMDS_MeshFace* theNextFace ) const;
805 void getFacesByLink( const Link& theLink,
806 TVectorOfFacePtr& theFaces ) const;
809 const SMDS_Mesh* myMesh;
810 TColStd_MapOfInteger myMapIds;
811 TColStd_MapOfInteger myMapBadGeomIds;
812 TVectorOfFacePtr myAllFacePtr;
813 TDataMapFacePtrInt myAllFacePtrIntDMap;
815 bool myIsOnlyManifold;
819 typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
822 Class : BelongToMeshGroup
823 Description : Verify whether a mesh element is included into a mesh group
825 class SMESHCONTROLS_EXPORT BelongToMeshGroup : public virtual Predicate
829 //virtual Predicate* clone() const { return new BelongToMeshGroup( *this ); }
830 virtual void SetMesh( const SMDS_Mesh* theMesh );
831 virtual bool IsSatisfy( long theElementId );
832 virtual SMDSAbs_ElementType GetType() const;
834 void SetGroup( SMESHDS_GroupBase* g );
835 void SetStoreName( const std::string& sn );
836 const SMESHDS_GroupBase* GetGroup() const { return myGroup; }
839 SMESHDS_GroupBase* myGroup;
840 std::string myStoreName;
842 typedef boost::shared_ptr<BelongToMeshGroup> BelongToMeshGroupPtr;
845 Class : ElementsOnSurface
846 Description : Predicate elements that lying on indicated surface
849 class SMESHCONTROLS_EXPORT ElementsOnSurface : public virtual Predicate {
852 ~ElementsOnSurface();
853 //virtual Predicate* clone() const { return new ElementsOnSurface( *this ); }
854 virtual void SetMesh( const SMDS_Mesh* theMesh );
855 virtual bool IsSatisfy( long theElementId );
856 virtual SMDSAbs_ElementType GetType() const;
858 void SetTolerance( const double theToler );
859 double GetTolerance() const;
860 void SetSurface( const TopoDS_Shape& theShape,
861 const SMDSAbs_ElementType theType );
862 void SetUseBoundaries( bool theUse );
863 bool GetUseBoundaries() const { return myUseBoundaries; }
867 void process( const SMDS_MeshElement* theElem );
868 bool isOnSurface( const SMDS_MeshNode* theNode );
871 TMeshModifTracer myMeshModifTracer;
872 TColStd_MapOfInteger myIds;
873 SMDSAbs_ElementType myType;
876 bool myUseBoundaries;
877 GeomAPI_ProjectPointOnSurf myProjector;
880 typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
884 Class : ElementsOnShape
885 Description : Predicate elements that lying on indicated shape
888 class SMESHCONTROLS_EXPORT ElementsOnShape : public Predicate
894 virtual Predicate* clone() const;
895 virtual void SetMesh (const SMDS_Mesh* theMesh);
896 virtual bool IsSatisfy (long theElementId);
897 virtual SMDSAbs_ElementType GetType() const;
899 void SetTolerance (const double theToler);
900 double GetTolerance() const;
901 void SetAllNodes (bool theAllNodes);
902 bool GetAllNodes() const { return myAllNodesFlag; }
903 void SetShape (const TopoDS_Shape& theShape,
904 const SMDSAbs_ElementType theType);
909 struct OctreeClassifier;
911 void clearClassifiers();
912 bool getNodeIsOut( const SMDS_MeshNode* n, bool& isOut );
913 void setNodeIsOut( const SMDS_MeshNode* n, bool isOut );
915 std::vector< Classifier > myClassifiers;
916 std::vector< Classifier* > myWorkClassifiers;
917 OctreeClassifier* myOctree;
918 SMDSAbs_ElementType myType;
919 TopoDS_Shape myShape;
923 TMeshModifTracer myMeshModifTracer;
924 std::vector<bool> myNodeIsChecked;
925 std::vector<bool> myNodeIsOut;
928 typedef boost::shared_ptr<ElementsOnShape> ElementsOnShapePtr;
933 Description : Predicate for verifying whether entiy belong to
934 specified geometrical support
936 class SMESHCONTROLS_EXPORT BelongToGeom: public virtual Predicate
940 virtual Predicate* clone() const;
942 virtual void SetMesh( const SMDS_Mesh* theMesh );
943 virtual void SetGeom( const TopoDS_Shape& theShape );
945 virtual bool IsSatisfy( long theElementId );
947 virtual void SetType( SMDSAbs_ElementType theType );
948 virtual SMDSAbs_ElementType GetType() const;
950 TopoDS_Shape GetShape();
951 const SMESHDS_Mesh* GetMeshDS() const;
953 void SetTolerance( double );
954 double GetTolerance();
959 TopoDS_Shape myShape;
960 TColStd_MapOfInteger mySubShapesIDs;
961 const SMESHDS_Mesh* myMeshDS;
962 SMDSAbs_ElementType myType;
964 double myTolerance; // only if myIsSubshape == false
965 Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false
967 typedef boost::shared_ptr<BelongToGeom> BelongToGeomPtr;
971 Description : Predicate for verifying whether entiy lying or partially lying on
972 specified geometrical support
974 class SMESHCONTROLS_EXPORT LyingOnGeom: public virtual Predicate
978 virtual Predicate* clone() const;
980 virtual void SetMesh( const SMDS_Mesh* theMesh );
981 virtual void SetGeom( const TopoDS_Shape& theShape );
983 virtual bool IsSatisfy( long theElementId );
985 virtual void SetType( SMDSAbs_ElementType theType );
986 virtual SMDSAbs_ElementType GetType() const;
988 TopoDS_Shape GetShape();
989 const SMESHDS_Mesh* GetMeshDS() const;
991 void SetTolerance( double );
992 double GetTolerance();
997 TopoDS_Shape myShape;
998 TColStd_MapOfInteger mySubShapesIDs;
999 const SMESHDS_Mesh* myMeshDS;
1000 SMDSAbs_ElementType myType;
1002 double myTolerance; // only if myIsSubshape == false
1003 Controls::ElementsOnShapePtr myElementsOnShapePtr; // only if myIsSubshape == false
1005 typedef boost::shared_ptr<LyingOnGeom> LyingOnGeomPtr;
1009 Description : Predicate for free faces
1011 class SMESHCONTROLS_EXPORT FreeFaces: public virtual Predicate{
1014 //virtual Predicate* clone() const { return new FreeFaces( *this ); }
1015 virtual void SetMesh( const SMDS_Mesh* theMesh );
1016 virtual bool IsSatisfy( long theElementId );
1017 virtual SMDSAbs_ElementType GetType() const;
1020 const SMDS_Mesh* myMesh;
1024 Class : LinearOrQuadratic
1025 Description : Predicate for free faces
1027 class SMESHCONTROLS_EXPORT LinearOrQuadratic: public virtual Predicate{
1029 LinearOrQuadratic();
1030 //virtual Predicate* clone() const { return new LinearOrQuadratic( *this ); }
1031 virtual void SetMesh( const SMDS_Mesh* theMesh );
1032 virtual bool IsSatisfy( long theElementId );
1033 void SetType( SMDSAbs_ElementType theType );
1034 virtual SMDSAbs_ElementType GetType() const;
1037 const SMDS_Mesh* myMesh;
1038 SMDSAbs_ElementType myType;
1040 typedef boost::shared_ptr<LinearOrQuadratic> LinearOrQuadraticPtr;
1044 Description : Functor for check color of group to whic mesh element belongs to
1046 class SMESHCONTROLS_EXPORT GroupColor: public virtual Predicate{
1049 //virtual Predicate* clone() const { return new GroupColor( *this ); }
1050 virtual void SetMesh( const SMDS_Mesh* theMesh );
1051 virtual bool IsSatisfy( long theElementId );
1052 void SetType( SMDSAbs_ElementType theType );
1053 virtual SMDSAbs_ElementType GetType() const;
1054 void SetColorStr( const TCollection_AsciiString& );
1055 void GetColorStr( TCollection_AsciiString& ) const;
1058 typedef std::set< long > TIDs;
1060 Quantity_Color myColor;
1061 SMDSAbs_ElementType myType;
1064 typedef boost::shared_ptr<GroupColor> GroupColorPtr;
1067 Class : ElemGeomType
1068 Description : Predicate to check element geometry type
1070 class SMESHCONTROLS_EXPORT ElemGeomType: public virtual Predicate{
1073 //virtual Predicate* clone() const { return new ElemGeomType( *this ); }
1074 virtual void SetMesh( const SMDS_Mesh* theMesh );
1075 virtual bool IsSatisfy( long theElementId );
1076 void SetType( SMDSAbs_ElementType theType );
1077 virtual SMDSAbs_ElementType GetType() const;
1078 void SetGeomType( SMDSAbs_GeometryType theType );
1079 SMDSAbs_GeometryType GetGeomType() const;
1082 const SMDS_Mesh* myMesh;
1083 SMDSAbs_ElementType myType;
1084 SMDSAbs_GeometryType myGeomType;
1086 typedef boost::shared_ptr<ElemGeomType> ElemGeomTypePtr;
1089 Class : CoplanarFaces
1090 Description : Predicate to check angle between faces
1092 class SMESHCONTROLS_EXPORT CoplanarFaces: public virtual Predicate
1096 //virtual Predicate* clone() const { return new CoplanarFaces( *this ); }
1097 void SetFace( long theID ) { myFaceID = theID; }
1098 long GetFace() const { return myFaceID; }
1099 void SetTolerance (const double theToler) { myToler = theToler; }
1100 double GetTolerance () const { return myToler; }
1101 virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_Face; }
1103 virtual void SetMesh( const SMDS_Mesh* theMesh );
1104 virtual bool IsSatisfy( long theElementId );
1107 TMeshModifTracer myMeshModifTracer;
1110 TColStd_MapOfInteger myCoplanarIDs;
1112 typedef boost::shared_ptr<CoplanarFaces> CoplanarFacesPtr;
1115 Class : ConnectedElements
1116 Description : Predicate to get elements of one domain
1118 class SMESHCONTROLS_EXPORT ConnectedElements: public virtual Predicate
1121 ConnectedElements();
1122 //virtual Predicate* clone() const { return new ConnectedElements( *this ); }
1123 void SetNode( int nodeID );
1124 void SetPoint( double x, double y, double z );
1125 int GetNode() const;
1126 std::vector<double> GetPoint() const;
1128 void SetType( SMDSAbs_ElementType theType );
1129 virtual SMDSAbs_ElementType GetType() const;
1131 virtual void SetMesh( const SMDS_Mesh* theMesh );
1132 virtual bool IsSatisfy( long theElementId );
1134 //const std::set<long>& GetDomainIDs() const { return myOkIDs; }
1138 std::vector<double> myXYZ;
1139 SMDSAbs_ElementType myType;
1140 TMeshModifTracer myMeshModifTracer;
1144 std::set< int > myOkIDs; // empty means that there is one domain
1146 typedef boost::shared_ptr<ConnectedElements> ConnectedElementsPtr;
1151 class SMESHCONTROLS_EXPORT Filter {
1155 virtual void SetPredicate(PredicatePtr thePred);
1157 typedef std::vector<long> TIdSequence;
1161 GetElementsId( const SMDS_Mesh* theMesh,
1162 TIdSequence& theSequence );
1166 GetElementsId( const SMDS_Mesh* theMesh,
1167 PredicatePtr thePredicate,
1168 TIdSequence& theSequence );
1171 PredicatePtr myPredicate;