Salome HOME
PAL8196. Fix GetAlgo() for the case with the same algo on several ancestors
[modules/smesh.git] / idl / SMESH_Filter.idl
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
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. 
8 // 
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. 
13 // 
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 
17 // 
18 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
19 //
20 //
21 //
22 //  File   : SMESH_Filter.idl
23 //  Author : Alexey Petrov, OCC
24
25 #ifndef _SMESH_FILTER_IDL_
26 #define _SMESH_FILTER_IDL_
27
28 #include "SALOME_Exception.idl"
29 #include "SALOME_GenericObj.idl"
30 #include "SMESH_Mesh.idl"
31
32
33 module GEOM
34 {
35   interface GEOM_Object;
36 };
37
38
39 module SMESH
40 {
41
42   /*!
43   * Enumeration of functor types
44   */
45   enum FunctorType
46   {
47     FT_AspectRatio,
48     FT_AspectRatio3D,
49     FT_Warping,   
50     FT_MinimumAngle,
51     FT_Taper,       
52     FT_Skew,         
53     FT_Area,          
54     FT_FreeBorders,
55     FT_FreeEdges,
56     FT_MultiConnection,
57     FT_MultiConnection2D,
58     FT_Length,
59     FT_Length2D,
60     FT_BelongToGeom,
61     FT_BelongToPlane,
62     FT_BelongToCylinder,
63     FT_LyingOnGeom,
64     FT_RangeOfIds,
65     FT_BadOrientedVolume,
66     FT_LessThan,
67     FT_MoreThan,
68     FT_EqualTo,
69     FT_LogicalNOT,
70     FT_LogicalAND,
71     FT_LogicalOR,
72     FT_Undefined
73   };
74
75   /*!
76   * Base interface for all functors ( i.e. numerical functors and predicates )
77   */
78   interface Functor: SALOME::GenericObj
79   {
80     void            SetMesh( in SMESH_Mesh theMesh );
81     FunctorType     GetFunctorType();
82     ElementType     GetElementType();
83   };
84
85
86
87   /*!
88   * Numerical functors are intended for calculating value by Id of mesh entity
89   */
90   interface NumericalFunctor: Functor
91   {
92     double GetValue( in long theElementId );
93
94     /*!
95     * Set precision for calculation. It is a position after point which is
96     * used to functor value after calculation.
97     */
98     void   SetPrecision( in long thePrecision );
99     long   GetPrecision();
100   };
101   interface MinimumAngle    : NumericalFunctor{};
102   interface AspectRatio     : NumericalFunctor{};
103   interface AspectRatio3D   : NumericalFunctor{};
104   interface Warping         : NumericalFunctor{};
105   interface Taper           : NumericalFunctor{};
106   interface Skew            : NumericalFunctor{};
107   interface Area            : NumericalFunctor{};
108   interface Length          : NumericalFunctor{};
109   interface Length2D        : NumericalFunctor
110   {
111     struct Value
112     {
113       double myLength;
114       long myPnt1, myPnt2;
115     };
116     typedef sequence<Value> Values;
117     Values GetValues();
118   };
119   interface MultiConnection   : NumericalFunctor{};
120   interface MultiConnection2D : NumericalFunctor
121   {
122     struct Value
123     {
124       long myNbConnects;
125       long myPnt1, myPnt2;
126     };
127     
128     typedef sequence<Value> Values;
129     Values GetValues();
130   };
131
132   /*!
133   * Predicates are intended for verification of criteria,
134   *            must return bool value by mesh id
135   */
136   interface Predicate: Functor
137   {
138     boolean IsSatisfy( in long thEntityId );
139   };
140
141   /*!
142   * Logical functor (predicate) "Bad Oriented Volume".
143   * Verify whether a mesh volume is incorrectly oriented from
144   * the point of view of MED convention
145   */
146   interface BadOrientedVolume: Predicate {};
147
148   /*!
149   * Logical functor (predicate) "Belong To Geometry".
150   * Verify whether mesh element or node belong to pointed Geom Object
151   */
152   interface BelongToGeom: Predicate
153   {
154     void SetGeom( in GEOM::GEOM_Object theGeom );
155     void SetElementType( in ElementType theType );
156
157     void   SetShapeName( in string theName );
158     string GetShapeName();    
159   };
160
161   /*!
162   * Logical functor (predicate) "Belong To Surface".
163   * Base interface for "belong to plane" and "belong to cylinder interfaces"
164   */
165   interface BelongToSurface: Predicate
166   {
167     void   SetTolerance( in double theToler );
168     double GetTolerance();
169     void   SetShapeName( in string theName, in ElementType theType );
170     string GetShapeName();
171   };
172
173
174   /*!
175   * Logical functor (predicate) "Belong To Plane".
176   * Verify whether mesh element lie in pointed Geom planar object
177   */
178   interface BelongToPlane: BelongToSurface
179   {
180     void   SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
181   };
182
183   /*!
184   * Logical functor (predicate) "Belong To Culinder".
185   * Verify whether mesh element lie in pointed Geom cylindrical object
186   */
187   interface BelongToCylinder: BelongToSurface
188   {
189     void   SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
190   };
191
192   /*!
193   * Logical functor (predicate) "Lying On Geometry".
194   * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
195   */
196   interface LyingOnGeom: Predicate
197   {
198     void SetGeom( in GEOM::GEOM_Object theGeom );
199     void SetElementType( in ElementType theType );
200
201     void   SetShapeName( in string theName );
202     string GetShapeName();    
203   };
204  
205   /*!
206   * Logical functor (predicate) "Free borders".
207   * Verify whether 1D mesh element is free ( i.e. connected to one face only )
208   */
209   interface FreeBorders: Predicate{};
210
211   /*!
212   * Logical functor (predicate) "Free edges".
213   * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
214   */
215   interface FreeEdges: Predicate
216
217   {
218     struct Border
219     {
220       long myElemId;
221       long myPnt1, myPnt2;
222     };
223     typedef sequence<Border> Borders;
224     Borders GetBorders();
225   };
226
227
228   /*!
229   * Abstract logical functor (predicate) "RangeOfIds".
230   * Verify whether an Entity Id belongs to defined sequence of id's
231   */
232   interface RangeOfIds: Predicate
233   {
234     void            SetRange( in long_array theIds );
235     boolean         SetRangeStr( in string theRange );
236     string          GetRangeStr();
237
238     void            SetElementType( in ElementType theType );
239   };
240
241   /*!
242   * Comparator. Predicate for compare value calculated
243   *             by numerical functor with threshold value
244   */
245   interface Comparator: Predicate
246   {
247     void    SetMargin( in double theValue );
248     void    SetNumFunctor( in NumericalFunctor theFunct );
249     double  GetMargin();
250   };
251   interface LessThan: Comparator{};
252   interface MoreThan: Comparator{};
253   interface EqualTo : Comparator
254   {
255     void    SetTolerance( in double theToler );
256     double  GetTolerance();
257   };
258
259   /*!
260   * Logical predicates are intended for compose predicates using boolean operations
261   */
262   interface Logical: Predicate{};
263
264   interface LogicalNOT: Logical
265   {
266     void SetPredicate(in Predicate thePredicate);
267   };
268
269   interface LogicalBinary: Logical
270 {
271     void SetPredicate1( in Predicate thePredicate );
272     void SetPredicate2( in Predicate thePredicate );
273   };
274
275   interface LogicalAND: LogicalBinary{};
276   interface LogicalOR : LogicalBinary{};
277
278   /*!
279   *  Filter
280   */
281   interface Filter: SALOME::GenericObj, SMESH_IDSource
282   {
283     /*!
284     * Structure containing information about one criterion
285     *   Type          - FT_Taper, FT_Skew ...
286     *   Compare       - FT_LessThan, FT_MoreThan, FT_EqualTo
287     *   Threshold     - threshold value
288     *   UnaryOp       - unary logical operation: FT_LogicalNOT or FT_Undefined
289     *   BinaryOp      - binary logical operation FT_LogicalAND, FT_LogicalOR or
290     *                   (FT_Undefined must be for the last criterion)
291     *   ThresholdStr  - Threshold value defined as string. Used for:
292     *                   1. Diaposon of identifiers. Example: "1,2,3,5-10,12,27-29"
293     *                   2. BelongToGeom predicate for storing name of shape
294     *   Tolerance     - Tolerance is used for comparators (EqualTo comparision) and for
295     *                   "Belong to plane" and "Belong to cylinder" predicates
296     *   TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)
297     *   Precision     - Precision of numerical functors
298     */
299     struct Criterion
300     {
301       long        Type;
302       long        Compare;
303       double      Threshold;
304       string      ThresholdStr;
305       long        UnaryOp;
306       long        BinaryOp;
307       double      Tolerance;
308       ElementType TypeOfElement;
309       long        Precision;
310     };
311
312     typedef sequence<Criterion> Criteria;
313
314     void          SetPredicate( in Predicate thePredicate );
315     void          SetMesh( in SMESH_Mesh theMesh );
316
317     long_array    GetElementsId( in SMESH_Mesh theMesh );
318     ElementType   GetElementType();
319     Predicate     GetPredicate();
320
321     boolean       GetCriteria( out Criteria theCriteria );
322     boolean       SetCriteria( in Criteria theCriteria );
323   };
324
325
326   /*!
327   *  Interface for working with library of filters
328   */
329   interface FilterLibrary : SALOME::GenericObj
330   {
331     /*!
332     *  Copy filter from library by name (new filter is created)
333     */
334     Filter        Copy( in string theFilterName );
335
336     /*!
337     * Methods for editing library
338     */
339     boolean       Add     ( in string theFilterName, in Filter theFilter );
340     boolean       AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
341     boolean       Delete  ( in string theFilterName );
342     boolean       Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
343
344     /*!
345     *  Save library on disk
346     */
347     boolean       Save();
348     boolean       SaveAs( in string aFileName );
349
350     /*!
351     * Query methods
352     */
353     boolean       IsPresent( in string aFilterName );
354     long          NbFilters( in ElementType aType );
355     string_array  GetNames( in ElementType aType );
356     string_array  GetAllNames();
357     void          SetFileName( in string aFilterName );
358     string        GetFileName();
359   };
360
361
362   /*!
363   * Interface of Filter manager
364   */
365   interface FilterManager: SALOME::GenericObj
366   {
367     /*!
368     *  Create numerical functors
369     */
370     MinimumAngle      CreateMinimumAngle();
371     AspectRatio       CreateAspectRatio();
372     AspectRatio3D     CreateAspectRatio3D();
373     Warping           CreateWarping();
374     Taper             CreateTaper();
375     Skew              CreateSkew();
376     Area              CreateArea();
377     Length            CreateLength();
378     Length2D          CreateLength2D();
379     MultiConnection   CreateMultiConnection();
380     MultiConnection2D CreateMultiConnection2D();
381
382     /*!
383     *  Create logical functors ( predicates )
384     */
385     BelongToGeom      CreateBelongToGeom();
386     BelongToPlane     CreateBelongToPlane();
387     BelongToCylinder  CreateBelongToCylinder();
388
389     LyingOnGeom       CreateLyingOnGeom();
390
391     FreeBorders       CreateFreeBorders();
392     FreeEdges         CreateFreeEdges();
393
394     RangeOfIds        CreateRangeOfIds();
395
396     BadOrientedVolume CreateBadOrientedVolume();
397
398     /*!
399     *  Create comparators ( predicates )
400     */
401     LessThan          CreateLessThan();
402     MoreThan          CreateMoreThan();
403     EqualTo           CreateEqualTo();
404
405     /*!
406     *  Create boolean operations ( predicates )
407     */
408     LogicalNOT        CreateLogicalNOT();
409     LogicalAND        CreateLogicalAND();
410     LogicalOR         CreateLogicalOR();
411
412     /*!
413     *  Create filter
414     */
415     Filter            CreateFilter();
416
417     /*!
418     *  Load filter library. If libary does not exist it is created
419     */
420     FilterLibrary     LoadLibrary( in string aFileName );
421
422     /*!
423     *  Create new library
424     */
425     FilterLibrary     CreateLibrary();
426
427     /*!
428     *  Delete library
429     */
430     boolean           DeleteLibrary( in string aFileName );
431   };
432 };
433
434
435 #endif