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
50 FT_MaxElementLength2D,
51 FT_MaxElementLength3D,
63 FT_BelongToGenSurface,
81 * Parameters of a reclangle of histogram
83 struct HistogramRectangle
89 typedef sequence<HistogramRectangle> Histogram;
92 * Base interface for all functors ( i.e. numerical functors and predicates )
94 interface Functor: SALOME::GenericObj
96 void SetMesh( in SMESH_Mesh theMesh );
97 FunctorType GetFunctorType();
98 ElementType GetElementType();
104 * Numerical functors are intended for calculating value by Id of mesh entity
106 interface NumericalFunctor: Functor
108 double GetValue( in long theElementId );
110 Histogram GetHistogram( in short nbIntervals );
113 * Set precision for calculation. It is a position after point which is
114 * used to functor value after calculation.
116 void SetPrecision( in long thePrecision );
119 interface MinimumAngle : NumericalFunctor{};
120 interface AspectRatio : NumericalFunctor{};
121 interface AspectRatio3D : NumericalFunctor{};
122 interface Warping : NumericalFunctor{};
123 interface Taper : NumericalFunctor{};
124 interface Skew : NumericalFunctor{};
125 interface Area : NumericalFunctor{};
126 interface Volume3D : NumericalFunctor{};
127 interface MaxElementLength2D : NumericalFunctor{};
128 interface MaxElementLength3D : NumericalFunctor{};
129 interface Length : NumericalFunctor{};
130 interface Length2D : NumericalFunctor
137 typedef sequence<Value> Values;
140 interface MultiConnection : NumericalFunctor{};
141 interface MultiConnection2D : NumericalFunctor
149 typedef sequence<Value> Values;
154 * Predicates are intended for verification of criteria,
155 * must return bool value by mesh id
157 interface Predicate: Functor
159 boolean IsSatisfy( in long thEntityId );
163 * Logical functor (predicate) "Bad Oriented Volume".
164 * Verify whether a mesh volume is incorrectly oriented from
165 * the point of view of MED convention
167 interface BadOrientedVolume: Predicate {};
170 * Logical functor (predicate) "Belong To Geometry".
171 * Verify whether mesh element or node belong to pointed Geom Object
173 interface BelongToGeom: Predicate
175 void SetGeom( in GEOM::GEOM_Object theGeom );
176 void SetElementType( in ElementType theType );
178 /*! The tolerance is used only if there is no submesh on the shape
180 void SetTolerance( in double theToler );
181 double GetTolerance();
183 void SetShapeName( in string theName );
184 void SetShape( in string theID, in string theName );
185 string GetShapeName();
190 * Logical functor (predicate) "Belong To Surface".
191 * Base interface for "belong to plane" and "belong to cylinder"
192 * and "Belong To Generic Surface" interfaces
194 interface BelongToSurface: Predicate
196 void SetTolerance( in double theToler );
197 double GetTolerance();
198 void SetShapeName( in string theName, in ElementType theType );
199 void SetShape( in string theID, in string theName, in ElementType theType );
200 string GetShapeName();
203 * Limit surface extent to bounding box of boundaries (edges)
204 * in surface parametric space. Boundaries are ignored by default
206 void SetUseBoundaries( in boolean theUseBndRestrictions );
207 boolean GetUseBoundaries();
211 * Logical functor (predicate) "Belong To Plane".
212 * Verify whether mesh element lie on pointed Geom planar object
214 interface BelongToPlane: BelongToSurface
216 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
220 * Logical functor (predicate) "Belong To Cylinder".
221 * Verify whether mesh element lie on pointed Geom cylindrical object
223 interface BelongToCylinder: BelongToSurface
225 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
229 * Logical functor (predicate) "Belong To Generic Surface".
230 * Verify whether mesh element lie in pointed Geom cylindrical object
232 interface BelongToGenSurface: BelongToSurface
234 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
238 * Logical functor (predicate) "Lying On Geometry".
239 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
241 interface LyingOnGeom: Predicate
243 void SetGeom( in GEOM::GEOM_Object theGeom );
244 void SetElementType( in ElementType theType );
246 /*! The tolerance is used only if there is no submesh on the shape
248 void SetTolerance( in double theToler );
249 double GetTolerance();
251 void SetShapeName( in string theName );
252 void SetShape( in string theID, in string theName );
253 string GetShapeName();
258 * Logical functor (predicate) "Free borders".
259 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
261 interface FreeBorders: Predicate{};
264 * Logical functor (predicate) "Free edges".
265 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
267 interface FreeEdges: Predicate
274 typedef sequence<Border> Borders;
275 Borders GetBorders();
279 * Logical functor (predicate) "Free nodes".
280 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
282 interface FreeNodes: Predicate{};
285 * Logical functor (predicate) "Free faces".
286 * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
288 interface FreeFaces: Predicate{};
291 * Abstract logical functor (predicate) "RangeOfIds".
292 * Verify whether an Entity Id belongs to defined sequence of id's
294 interface RangeOfIds: Predicate
296 void SetRange( in long_array theIds );
297 boolean SetRangeStr( in string theRange );
298 string GetRangeStr();
300 void SetElementType( in ElementType theType );
304 * Comparator. Predicate for compare value calculated
305 * by numerical functor with threshold value
307 interface Comparator: Predicate
309 void SetMargin( in double theValue );
310 void SetNumFunctor( in NumericalFunctor theFunct );
313 interface LessThan: Comparator{};
314 interface MoreThan: Comparator{};
315 interface EqualTo : Comparator
317 void SetTolerance( in double theToler );
318 double GetTolerance();
322 * Logical predicates are intended for compose predicates using boolean operations
324 interface Logical: Predicate{};
326 interface LogicalNOT: Logical
328 void SetPredicate(in Predicate thePredicate);
331 interface LogicalBinary: Logical
333 void SetPredicate1( in Predicate thePredicate );
334 void SetPredicate2( in Predicate thePredicate );
337 interface LogicalAND: LogicalBinary{};
338 interface LogicalOR : LogicalBinary{};
341 * Logical functor (predicate) "Is element Linear or Quadratic".
342 * Verify whether a mesh element is linear
344 interface LinearOrQuadratic: Predicate {
345 void SetElementType( in ElementType theType );
349 * Functor "Group Color"
350 * Returns color of group to which mesh element belongs to
352 interface GroupColor : Predicate{
353 void SetElementType( in ElementType theType );
354 void SetColorStr( in string theColor );
355 string GetColorStr();
359 * Functor "Element geometry type"
360 * Returns is element has indicated geometry type
362 interface ElemGeomType : Predicate{
363 void SetElementType ( in ElementType theType );
364 void SetGeometryType( in GeometryType theType );
368 * Functor "Coplanar faces"
369 * Returns true if a mesh face is a coplanar neighbour to a given one. It checks
370 * if normal of a face has angle with the threshold face less than a tolerance.
372 interface CoplanarFaces : Predicate{
373 void SetFace ( in long theFaceID );
374 void SetTolerance( in double theToler );
380 interface Filter: SALOME::GenericObj, SMESH_IDSource
383 * Structure containing information about one criterion
384 * Type - FT_Taper, FT_Skew ...
385 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
386 * Threshold - threshold value
387 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
388 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
389 * (FT_Undefined must be for the last criterion)
390 * ThresholdStr - Threshold value defined as string. Used for:
391 * 1. Diapason of identifiers. Example: "1,2,3,5-10,12,27-29"
392 * 2. BelongToGeom predicate for storing name of shape
393 * 3. GroupColor predicate for storing group color "0.2;0;0.5"
394 * ThresholdID - One more threshold value defined as string. Used for:
395 * 1. BelongToGeom predicate for storing id of shape
396 * Tolerance - Tolerance is used for comparators (EqualTo comparision) and for
397 * "Belong to plane", "Belong to cylinder" etc predicates
398 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)
399 * Precision - Precision of numerical functors
411 ElementType TypeOfElement;
415 typedef sequence<Criterion> Criteria;
417 void SetPredicate( in Predicate thePredicate );
418 void SetMesh( in SMESH_Mesh theMesh );
420 long_array GetElementsId( in SMESH_Mesh theMesh );
421 ElementType GetElementType();
422 Predicate GetPredicate();
424 boolean GetCriteria( out Criteria theCriteria );
425 boolean SetCriteria( in Criteria theCriteria );
430 * Interface for working with library of filters
432 interface FilterLibrary : SALOME::GenericObj
435 * Copy filter from library by name (new filter is created)
437 Filter Copy( in string theFilterName );
440 * Methods for editing library
442 boolean Add ( in string theFilterName, in Filter theFilter );
443 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
444 boolean Delete ( in string theFilterName );
445 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
448 * Save library on disk
451 boolean SaveAs( in string aFileName );
456 boolean IsPresent( in string aFilterName );
457 long NbFilters( in ElementType aType );
458 string_array GetNames( in ElementType aType );
459 string_array GetAllNames();
460 void SetFileName( in string aFilterName );
461 string GetFileName();
466 * Interface of Filter manager
468 interface FilterManager: SALOME::GenericObj
471 * Create numerical functors
473 MinimumAngle CreateMinimumAngle();
474 AspectRatio CreateAspectRatio();
475 AspectRatio3D CreateAspectRatio3D();
476 Warping CreateWarping();
480 Volume3D CreateVolume3D();
481 MaxElementLength2D CreateMaxElementLength2D();
482 MaxElementLength3D CreateMaxElementLength3D();
483 Length CreateLength();
484 Length2D CreateLength2D();
485 MultiConnection CreateMultiConnection();
486 MultiConnection2D CreateMultiConnection2D();
489 * Create logical functors ( predicates )
491 BelongToGeom CreateBelongToGeom();
492 BelongToPlane CreateBelongToPlane();
493 BelongToCylinder CreateBelongToCylinder();
494 BelongToGenSurface CreateBelongToGenSurface();
496 LyingOnGeom CreateLyingOnGeom();
498 FreeBorders CreateFreeBorders();
499 FreeEdges CreateFreeEdges();
500 FreeNodes CreateFreeNodes();
501 FreeFaces CreateFreeFaces();
503 RangeOfIds CreateRangeOfIds();
505 BadOrientedVolume CreateBadOrientedVolume();
506 LinearOrQuadratic CreateLinearOrQuadratic();
508 GroupColor CreateGroupColor();
509 ElemGeomType CreateElemGeomType();
510 CoplanarFaces CreateCoplanarFaces();
513 * Create comparators ( predicates )
515 LessThan CreateLessThan();
516 MoreThan CreateMoreThan();
517 EqualTo CreateEqualTo();
520 * Create boolean operations ( predicates )
522 LogicalNOT CreateLogicalNOT();
523 LogicalAND CreateLogicalAND();
524 LogicalOR CreateLogicalOR();
529 Filter CreateFilter();
532 * Load filter library. If libary does not exist it is created
534 FilterLibrary LoadLibrary( in string aFileName );
539 FilterLibrary CreateLibrary();
544 boolean DeleteLibrary( in string aFileName );