1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : SMESH_Filter.idl
24 // Author : Alexey Petrov, OCC
26 #ifndef _SMESH_FILTER_IDL_
27 #define _SMESH_FILTER_IDL_
29 #include "SALOME_Exception.idl"
30 #include "SALOME_GenericObj.idl"
31 #include "GEOM_Gen.idl"
32 #include "SMESH_Mesh.idl"
38 * Enumeration of functor types
61 FT_BelongToGenSurface,
79 * Base interface for all functors ( i.e. numerical functors and predicates )
81 interface Functor: SALOME::GenericObj
83 void SetMesh( in SMESH_Mesh theMesh );
84 FunctorType GetFunctorType();
85 ElementType GetElementType();
91 * Numerical functors are intended for calculating value by Id of mesh entity
93 interface NumericalFunctor: Functor
95 double GetValue( in long theElementId );
98 * Set precision for calculation. It is a position after point which is
99 * used to functor value after calculation.
101 void SetPrecision( in long thePrecision );
104 interface MinimumAngle : NumericalFunctor{};
105 interface AspectRatio : NumericalFunctor{};
106 interface AspectRatio3D : NumericalFunctor{};
107 interface Warping : NumericalFunctor{};
108 interface Taper : NumericalFunctor{};
109 interface Skew : NumericalFunctor{};
110 interface Area : NumericalFunctor{};
111 interface Volume3D : NumericalFunctor{};
112 interface Length : NumericalFunctor{};
113 interface Length2D : NumericalFunctor
120 typedef sequence<Value> Values;
123 interface MultiConnection : NumericalFunctor{};
124 interface MultiConnection2D : NumericalFunctor
132 typedef sequence<Value> Values;
137 * Predicates are intended for verification of criteria,
138 * must return bool value by mesh id
140 interface Predicate: Functor
142 boolean IsSatisfy( in long thEntityId );
146 * Logical functor (predicate) "Bad Oriented Volume".
147 * Verify whether a mesh volume is incorrectly oriented from
148 * the point of view of MED convention
150 interface BadOrientedVolume: Predicate {};
153 * Logical functor (predicate) "Belong To Geometry".
154 * Verify whether mesh element or node belong to pointed Geom Object
156 interface BelongToGeom: Predicate
158 void SetGeom( in GEOM::GEOM_Object theGeom );
159 void SetElementType( in ElementType theType );
161 /*! The tolerance is used only if there is no submesh on the shape
163 void SetTolerance( in double theToler );
164 double GetTolerance();
166 void SetShapeName( in string theName );
167 void SetShape( in string theID, in string theName );
168 string GetShapeName();
173 * Logical functor (predicate) "Belong To Surface".
174 * Base interface for "belong to plane" and "belong to cylinder"
175 * and "Belong To Generic Surface" interfaces
177 interface BelongToSurface: Predicate
179 void SetTolerance( in double theToler );
180 double GetTolerance();
181 void SetShapeName( in string theName, in ElementType theType );
182 void SetShape( in string theID, in string theName, in ElementType theType );
183 string GetShapeName();
186 * Limit surface extent to bounding box of boundaries (edges)
187 * in surface parametric space. Boundaries are ignored by default
189 void SetUseBoundaries( in boolean theUseBndRestrictions );
190 boolean GetUseBoundaries();
194 * Logical functor (predicate) "Belong To Plane".
195 * Verify whether mesh element lie on pointed Geom planar object
197 interface BelongToPlane: BelongToSurface
199 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
203 * Logical functor (predicate) "Belong To Cylinder".
204 * Verify whether mesh element lie on pointed Geom cylindrical object
206 interface BelongToCylinder: BelongToSurface
208 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
212 * Logical functor (predicate) "Belong To Generic Surface".
213 * Verify whether mesh element lie in pointed Geom cylindrical object
215 interface BelongToGenSurface: BelongToSurface
217 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
221 * Logical functor (predicate) "Lying On Geometry".
222 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
224 interface LyingOnGeom: Predicate
226 void SetGeom( in GEOM::GEOM_Object theGeom );
227 void SetElementType( in ElementType theType );
229 /*! The tolerance is used only if there is no submesh on the shape
231 void SetTolerance( in double theToler );
232 double GetTolerance();
234 void SetShapeName( in string theName );
235 void SetShape( in string theID, in string theName );
236 string GetShapeName();
241 * Logical functor (predicate) "Free borders".
242 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
244 interface FreeBorders: Predicate{};
247 * Logical functor (predicate) "Free edges".
248 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
250 interface FreeEdges: Predicate
257 typedef sequence<Border> Borders;
258 Borders GetBorders();
262 * Logical functor (predicate) "Free nodes".
263 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
265 interface FreeNodes: Predicate{};
268 * Logical functor (predicate) "Free faces".
269 * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
271 interface FreeFaces: Predicate{};
274 * Abstract logical functor (predicate) "RangeOfIds".
275 * Verify whether an Entity Id belongs to defined sequence of id's
277 interface RangeOfIds: Predicate
279 void SetRange( in long_array theIds );
280 boolean SetRangeStr( in string theRange );
281 string GetRangeStr();
283 void SetElementType( in ElementType theType );
287 * Comparator. Predicate for compare value calculated
288 * by numerical functor with threshold value
290 interface Comparator: Predicate
292 void SetMargin( in double theValue );
293 void SetNumFunctor( in NumericalFunctor theFunct );
296 interface LessThan: Comparator{};
297 interface MoreThan: Comparator{};
298 interface EqualTo : Comparator
300 void SetTolerance( in double theToler );
301 double GetTolerance();
305 * Logical predicates are intended for compose predicates using boolean operations
307 interface Logical: Predicate{};
309 interface LogicalNOT: Logical
311 void SetPredicate(in Predicate thePredicate);
314 interface LogicalBinary: Logical
316 void SetPredicate1( in Predicate thePredicate );
317 void SetPredicate2( in Predicate thePredicate );
320 interface LogicalAND: LogicalBinary{};
321 interface LogicalOR : LogicalBinary{};
324 * Logical functor (predicate) "Is element Linear or Quadratic".
325 * Verify whether a mesh element is linear
327 interface LinearOrQuadratic: Predicate {
328 void SetElementType( in ElementType theType );
332 * Functor "Group Color"
333 * Returns color of group to which mesh element belongs to
335 interface GroupColor : Predicate{
336 void SetElementType( in ElementType theType );
337 void SetColorStr( in string theColor );
338 string GetColorStr();
342 * Functor "Element geometry type"
343 * Returns is element has indicated geometry type
345 interface ElemGeomType : Predicate{
346 void SetElementType ( in ElementType theType );
347 void SetGeometryType( in GeometryType theType );
351 * Functor "Coplanar faces"
352 * Returns true if a mesh face is a coplanar neighbour to a given one. It checks
353 * if normal of a face has angle with the threshold face less than a tolerance.
355 interface CoplanarFaces : Predicate{
356 void SetFace ( in long theFaceID );
357 void SetTolerance( in double theToler );
363 interface Filter: SALOME::GenericObj, SMESH_IDSource
366 * Structure containing information about one criterion
367 * Type - FT_Taper, FT_Skew ...
368 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
369 * Threshold - threshold value
370 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
371 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
372 * (FT_Undefined must be for the last criterion)
373 * ThresholdStr - Threshold value defined as string. Used for:
374 * 1. Diapason of identifiers. Example: "1,2,3,5-10,12,27-29"
375 * 2. BelongToGeom predicate for storing name of shape
376 * 3. GroupColor predicate for storing group color "0.2;0;0.5"
377 * ThresholdID - One more threshold value defined as string. Used for:
378 * 1. BelongToGeom predicate for storing id of shape
379 * Tolerance - Tolerance is used for comparators (EqualTo comparision) and for
380 * "Belong to plane", "Belong to cylinder" etc predicates
381 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)
382 * Precision - Precision of numerical functors
394 ElementType TypeOfElement;
398 typedef sequence<Criterion> Criteria;
400 void SetPredicate( in Predicate thePredicate );
401 void SetMesh( in SMESH_Mesh theMesh );
403 long_array GetElementsId( in SMESH_Mesh theMesh );
404 ElementType GetElementType();
405 Predicate GetPredicate();
407 boolean GetCriteria( out Criteria theCriteria );
408 boolean SetCriteria( in Criteria theCriteria );
413 * Interface for working with library of filters
415 interface FilterLibrary : SALOME::GenericObj
418 * Copy filter from library by name (new filter is created)
420 Filter Copy( in string theFilterName );
423 * Methods for editing library
425 boolean Add ( in string theFilterName, in Filter theFilter );
426 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
427 boolean Delete ( in string theFilterName );
428 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
431 * Save library on disk
434 boolean SaveAs( in string aFileName );
439 boolean IsPresent( in string aFilterName );
440 long NbFilters( in ElementType aType );
441 string_array GetNames( in ElementType aType );
442 string_array GetAllNames();
443 void SetFileName( in string aFilterName );
444 string GetFileName();
449 * Interface of Filter manager
451 interface FilterManager: SALOME::GenericObj
454 * Create numerical functors
456 MinimumAngle CreateMinimumAngle();
457 AspectRatio CreateAspectRatio();
458 AspectRatio3D CreateAspectRatio3D();
459 Warping CreateWarping();
463 Volume3D CreateVolume3D();
464 Length CreateLength();
465 Length2D CreateLength2D();
466 MultiConnection CreateMultiConnection();
467 MultiConnection2D CreateMultiConnection2D();
470 * Create logical functors ( predicates )
472 BelongToGeom CreateBelongToGeom();
473 BelongToPlane CreateBelongToPlane();
474 BelongToCylinder CreateBelongToCylinder();
475 BelongToGenSurface CreateBelongToGenSurface();
477 LyingOnGeom CreateLyingOnGeom();
479 FreeBorders CreateFreeBorders();
480 FreeEdges CreateFreeEdges();
481 FreeNodes CreateFreeNodes();
482 FreeFaces CreateFreeFaces();
484 RangeOfIds CreateRangeOfIds();
486 BadOrientedVolume CreateBadOrientedVolume();
487 LinearOrQuadratic CreateLinearOrQuadratic();
489 GroupColor CreateGroupColor();
490 ElemGeomType CreateElemGeomType();
491 CoplanarFaces CreateCoplanarFaces();
494 * Create comparators ( predicates )
496 LessThan CreateLessThan();
497 MoreThan CreateMoreThan();
498 EqualTo CreateEqualTo();
501 * Create boolean operations ( predicates )
503 LogicalNOT CreateLogicalNOT();
504 LogicalAND CreateLogicalAND();
505 LogicalOR CreateLogicalOR();
510 Filter CreateFilter();
513 * Load filter library. If libary does not exist it is created
515 FilterLibrary LoadLibrary( in string aFileName );
520 FilterLibrary CreateLibrary();
525 boolean DeleteLibrary( in string aFileName );