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