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