1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
20 #ifndef _SMESH_CONTROLS_HXX_
21 #define _SMESH_CONTROLS_HXX_
25 #include <boost/shared_ptr.hpp>
26 #include "SMDSAbs_ElementType.hxx"
31 class TColgp_SequenceOfXYZ;
38 virtual void SetMesh( SMDS_Mesh* theMesh ) = 0;
40 typedef boost::shared_ptr<Functor> FunctorPtr;
42 class NumericalFunctor: public virtual Functor{
45 virtual void SetMesh( SMDS_Mesh* theMesh );
46 virtual double GetValue( long theElementId ) = 0;
47 virtual SMDSAbs_ElementType GetType() const = 0;
50 bool getPoints( const int theId,
51 TColgp_SequenceOfXYZ& theRes ) const;
55 typedef boost::shared_ptr<NumericalFunctor> NumericalFunctorPtr;
59 Class : SMESH_MinimumAngle
60 Description : Functor for calculation of minimum angle
62 class MinimumAngle: public virtual NumericalFunctor{
64 virtual double GetValue( long theElementId );
65 virtual SMDSAbs_ElementType GetType() const;
71 Description : Functor for calculating aspect ratio
73 class AspectRatio: public virtual NumericalFunctor{
75 virtual double GetValue( long theElementId );
76 virtual SMDSAbs_ElementType GetType() const;
82 Description : Functor for calculating warping
84 class Warping: public virtual NumericalFunctor{
86 virtual double GetValue( long theElementId );
87 virtual SMDSAbs_ElementType GetType() const;
90 double ComputeA( const gp_XYZ&, const gp_XYZ&,
91 const gp_XYZ&, const gp_XYZ& ) const;
97 Description : Functor for calculating taper
99 class Taper: public virtual NumericalFunctor{
101 virtual double GetValue( long theElementId );
102 virtual SMDSAbs_ElementType GetType() const;
108 Description : Functor for calculating skew in degrees
110 class Skew: public virtual NumericalFunctor{
112 virtual double GetValue( long theElementId );
113 virtual SMDSAbs_ElementType GetType() const;
119 Description : Functor for calculating area
121 class Area: public virtual NumericalFunctor{
123 virtual double GetValue( long theElementId );
124 virtual SMDSAbs_ElementType GetType() const;
130 Description : Functor for calculating length of edge
132 class Length: public virtual NumericalFunctor{
134 virtual double GetValue( long theElementId );
135 virtual SMDSAbs_ElementType GetType() const;
140 Class : MultiConnection
141 Description : Functor for calculating number of faces conneted to the edge
143 class MultiConnection: public virtual NumericalFunctor{
145 virtual double GetValue( long theElementId );
146 virtual SMDSAbs_ElementType GetType() const;
155 Description : Base class for all predicates
157 class Predicate: public virtual Functor{
159 virtual bool IsSatisfy( long theElementId ) = 0;
160 virtual SMDSAbs_ElementType GetType() const = 0;
162 typedef boost::shared_ptr<Predicate> PredicatePtr;
168 Description : Predicate for free borders
170 class FreeBorders: public virtual Predicate{
173 virtual void SetMesh( SMDS_Mesh* theMesh );
174 virtual bool IsSatisfy( long theElementId );
175 virtual SMDSAbs_ElementType GetType() const;
184 Description : Predicate for free Edges
186 class FreeEdges: public virtual Predicate{
189 virtual void SetMesh( SMDS_Mesh* theMesh );
190 virtual bool IsSatisfy( long theElementId );
191 virtual SMDSAbs_ElementType GetType() const;
194 Border(long thePntId1, long thePntId2);
196 typedef long TElemId;
197 typedef std::map<TElemId,Border> Borders;
198 void GetBoreders(Borders& theBorders);
203 typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
208 Description : Base class for comparators
210 class Comparator: public virtual Predicate{
213 virtual ~Comparator();
214 virtual void SetMesh( SMDS_Mesh* theMesh );
215 virtual void SetMargin(double theValue);
216 virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
217 virtual bool IsSatisfy( long theElementId ) = 0;
218 virtual SMDSAbs_ElementType GetType() const;
222 NumericalFunctorPtr myFunctor;
224 typedef boost::shared_ptr<Comparator> ComparatorPtr;
229 Description : Comparator "<"
231 class LessThan: public virtual Comparator{
233 virtual bool IsSatisfy( long theElementId );
239 Description : Comparator ">"
241 class MoreThan: public virtual Comparator{
243 virtual bool IsSatisfy( long theElementId );
249 Description : Comparator "="
251 class EqualTo: public virtual Comparator{
254 virtual bool IsSatisfy( long theElementId );
255 virtual void SetTolerance( double theTol );
260 typedef boost::shared_ptr<EqualTo> EqualToPtr;
265 Description : Logical NOT predicate
267 class LogicalNOT: public virtual Predicate{
270 virtual ~LogicalNOT();
271 virtual bool IsSatisfy( long theElementId );
272 virtual void SetMesh( SMDS_Mesh* theMesh );
273 virtual void SetPredicate(PredicatePtr thePred);
274 virtual SMDSAbs_ElementType GetType() const;
277 PredicatePtr myPredicate;
279 typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
283 Class : LogicalBinary
284 Description : Base class for binary logical predicate
286 class LogicalBinary: public virtual Predicate{
289 virtual ~LogicalBinary();
290 virtual void SetMesh( SMDS_Mesh* theMesh );
291 virtual void SetPredicate1(PredicatePtr thePred);
292 virtual void SetPredicate2(PredicatePtr thePred);
293 virtual SMDSAbs_ElementType GetType() const;
296 PredicatePtr myPredicate1;
297 PredicatePtr myPredicate2;
299 typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
304 Description : Logical AND
306 class LogicalAND: public virtual LogicalBinary{
308 virtual bool IsSatisfy( long theElementId );
314 Description : Logical OR
316 class LogicalOR: public virtual LogicalBinary{
318 virtual bool IsSatisfy( long theElementId );
329 virtual void SetPredicate(PredicatePtr thePred);
330 typedef std::vector<long> TIdSequence;
331 virtual TIdSequence GetElementsId( SMDS_Mesh* theMesh );
334 PredicatePtr myPredicate;