1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SMESH_Filter.idl
23 // Author : Alexey Petrov, OCC
25 #ifndef _SMESH_FILTER_IDL_
26 #define _SMESH_FILTER_IDL_
28 #include "SALOME_Exception.idl"
29 #include "SALOME_GenericObj.idl"
30 #include "GEOM_Gen.idl"
31 #include "SMESH_Mesh.idl"
37 * Enumeration of functor types
59 FT_BelongToGenSurface,
73 * Base interface for all functors ( i.e. numerical functors and predicates )
75 interface Functor: SALOME::GenericObj
77 void SetMesh( in SMESH_Mesh theMesh );
78 FunctorType GetFunctorType();
79 ElementType GetElementType();
85 * Numerical functors are intended for calculating value by Id of mesh entity
87 interface NumericalFunctor: Functor
89 double GetValue( in long theElementId );
92 * Set precision for calculation. It is a position after point which is
93 * used to functor value after calculation.
95 void SetPrecision( in long thePrecision );
98 interface MinimumAngle : NumericalFunctor{};
99 interface AspectRatio : NumericalFunctor{};
100 interface AspectRatio3D : NumericalFunctor{};
101 interface Warping : NumericalFunctor{};
102 interface Taper : NumericalFunctor{};
103 interface Skew : NumericalFunctor{};
104 interface Area : NumericalFunctor{};
105 interface Volume3D : NumericalFunctor{};
106 interface Length : NumericalFunctor{};
107 interface Length2D : NumericalFunctor
114 typedef sequence<Value> Values;
117 interface MultiConnection : NumericalFunctor{};
118 interface MultiConnection2D : NumericalFunctor
126 typedef sequence<Value> Values;
131 * Predicates are intended for verification of criteria,
132 * must return bool value by mesh id
134 interface Predicate: Functor
136 boolean IsSatisfy( in long thEntityId );
140 * Logical functor (predicate) "Bad Oriented Volume".
141 * Verify whether a mesh volume is incorrectly oriented from
142 * the point of view of MED convention
144 interface BadOrientedVolume: Predicate {};
147 * Logical functor (predicate) "Belong To Geometry".
148 * Verify whether mesh element or node belong to pointed Geom Object
150 interface BelongToGeom: Predicate
152 void SetGeom( in GEOM::GEOM_Object theGeom );
153 void SetElementType( in ElementType theType );
155 /*! The tolerance is used only if there is no submesh on the shape
157 void SetTolerance( in double theToler );
158 double GetTolerance();
160 void SetShapeName( in string theName );
161 void SetShape( in string theID, in string theName );
162 string GetShapeName();
167 * Logical functor (predicate) "Belong To Surface".
168 * Base interface for "belong to plane" and "belong to cylinder"
169 * and "Belong To Generic Surface" interfaces
171 interface BelongToSurface: Predicate
173 void SetTolerance( in double theToler );
174 double GetTolerance();
175 void SetShapeName( in string theName, in ElementType theType );
176 void SetShape( in string theID, in string theName, in ElementType theType );
177 string GetShapeName();
180 * Limit surface extent to bounding box of boundaries (edges)
181 * in surface parametric space. Boundaries are ignored by default
183 void SetUseBoundaries( in boolean theUseBndRestrictions );
184 boolean GetUseBoundaries();
188 * Logical functor (predicate) "Belong To Plane".
189 * Verify whether mesh element lie on pointed Geom planar object
191 interface BelongToPlane: BelongToSurface
193 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
197 * Logical functor (predicate) "Belong To Cylinder".
198 * Verify whether mesh element lie on pointed Geom cylindrical object
200 interface BelongToCylinder: BelongToSurface
202 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
206 * Logical functor (predicate) "Belong To Generic Surface".
207 * Verify whether mesh element lie in pointed Geom cylindrical object
209 interface BelongToGenSurface: BelongToSurface
211 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
215 * Logical functor (predicate) "Lying On Geometry".
216 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
218 interface LyingOnGeom: Predicate
220 void SetGeom( in GEOM::GEOM_Object theGeom );
221 void SetElementType( in ElementType theType );
223 /*! The tolerance is used only if there is no submesh on the shape
225 void SetTolerance( in double theToler );
226 double GetTolerance();
228 void SetShapeName( in string theName );
229 void SetShape( in string theID, in string theName );
230 string GetShapeName();
235 * Logical functor (predicate) "Free borders".
236 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
238 interface FreeBorders: Predicate{};
241 * Logical functor (predicate) "Free edges".
242 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
244 interface FreeEdges: Predicate
251 typedef sequence<Border> Borders;
252 Borders GetBorders();
256 * Logical functor (predicate) "Free nodes".
257 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
259 interface FreeNodes: Predicate{};
262 * Abstract logical functor (predicate) "RangeOfIds".
263 * Verify whether an Entity Id belongs to defined sequence of id's
265 interface RangeOfIds: Predicate
267 void SetRange( in long_array theIds );
268 boolean SetRangeStr( in string theRange );
269 string GetRangeStr();
271 void SetElementType( in ElementType theType );
275 * Comparator. Predicate for compare value calculated
276 * by numerical functor with threshold value
278 interface Comparator: Predicate
280 void SetMargin( in double theValue );
281 void SetNumFunctor( in NumericalFunctor theFunct );
284 interface LessThan: Comparator{};
285 interface MoreThan: Comparator{};
286 interface EqualTo : Comparator
288 void SetTolerance( in double theToler );
289 double GetTolerance();
293 * Logical predicates are intended for compose predicates using boolean operations
295 interface Logical: Predicate{};
297 interface LogicalNOT: Logical
299 void SetPredicate(in Predicate thePredicate);
302 interface LogicalBinary: Logical
304 void SetPredicate1( in Predicate thePredicate );
305 void SetPredicate2( in Predicate thePredicate );
308 interface LogicalAND: LogicalBinary{};
309 interface LogicalOR : LogicalBinary{};
314 interface Filter: SALOME::GenericObj, SMESH_IDSource
317 * Structure containing information about one criterion
318 * Type - FT_Taper, FT_Skew ...
319 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
320 * Threshold - threshold value
321 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
322 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
323 * (FT_Undefined must be for the last criterion)
324 * ThresholdStr - Threshold value defined as string. Used for:
325 * 1. Diaposon of identifiers. Example: "1,2,3,5-10,12,27-29"
326 * 2. BelongToGeom predicate for storing name of shape
327 * ThresholdID - One more threshold value defined as string. Used for:
328 * 1. BelongToGeom predicate for storing id of shape
329 * Tolerance - Tolerance is used for comparators (EqualTo comparision) and for
330 * "Belong to plane" and "Belong to cylinder" predicates
331 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)
332 * Precision - Precision of numerical functors
344 ElementType TypeOfElement;
348 typedef sequence<Criterion> Criteria;
350 void SetPredicate( in Predicate thePredicate );
351 void SetMesh( in SMESH_Mesh theMesh );
353 long_array GetElementsId( in SMESH_Mesh theMesh );
354 ElementType GetElementType();
355 Predicate GetPredicate();
357 boolean GetCriteria( out Criteria theCriteria );
358 boolean SetCriteria( in Criteria theCriteria );
363 * Interface for working with library of filters
365 interface FilterLibrary : SALOME::GenericObj
368 * Copy filter from library by name (new filter is created)
370 Filter Copy( in string theFilterName );
373 * Methods for editing library
375 boolean Add ( in string theFilterName, in Filter theFilter );
376 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
377 boolean Delete ( in string theFilterName );
378 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
381 * Save library on disk
384 boolean SaveAs( in string aFileName );
389 boolean IsPresent( in string aFilterName );
390 long NbFilters( in ElementType aType );
391 string_array GetNames( in ElementType aType );
392 string_array GetAllNames();
393 void SetFileName( in string aFilterName );
394 string GetFileName();
399 * Interface of Filter manager
401 interface FilterManager: SALOME::GenericObj
404 * Create numerical functors
406 MinimumAngle CreateMinimumAngle();
407 AspectRatio CreateAspectRatio();
408 AspectRatio3D CreateAspectRatio3D();
409 Warping CreateWarping();
413 Volume3D CreateVolume3D();
414 Length CreateLength();
415 Length2D CreateLength2D();
416 MultiConnection CreateMultiConnection();
417 MultiConnection2D CreateMultiConnection2D();
420 * Create logical functors ( predicates )
422 BelongToGeom CreateBelongToGeom();
423 BelongToPlane CreateBelongToPlane();
424 BelongToCylinder CreateBelongToCylinder();
425 BelongToGenSurface CreateBelongToGenSurface();
427 LyingOnGeom CreateLyingOnGeom();
429 FreeBorders CreateFreeBorders();
430 FreeEdges CreateFreeEdges();
431 FreeNodes CreateFreeNodes();
433 RangeOfIds CreateRangeOfIds();
435 BadOrientedVolume CreateBadOrientedVolume();
438 * Create comparators ( predicates )
440 LessThan CreateLessThan();
441 MoreThan CreateMoreThan();
442 EqualTo CreateEqualTo();
445 * Create boolean operations ( predicates )
447 LogicalNOT CreateLogicalNOT();
448 LogicalAND CreateLogicalAND();
449 LogicalOR CreateLogicalOR();
454 Filter CreateFilter();
457 * Load filter library. If libary does not exist it is created
459 FilterLibrary LoadLibrary( in string aFileName );
464 FilterLibrary CreateLibrary();
469 boolean DeleteLibrary( in string aFileName );