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