1 // Copyright (C) 2007-2011 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,
69 FT_OverConstrainedVolume,
70 FT_OverConstrainedFace,
85 * Parameters of a reclangle of histogram
87 struct HistogramRectangle
93 typedef sequence<HistogramRectangle> Histogram;
97 * Base interface for all functors ( i.e. numerical functors and predicates )
99 interface Functor: SALOME::GenericObj
101 void SetMesh( in SMESH_Mesh theMesh );
102 FunctorType GetFunctorType();
103 ElementType GetElementType();
107 * Numerical functors are intended for calculating value by Id of mesh entity
109 interface NumericalFunctor: Functor
111 double GetValue( in long theElementId );
113 Histogram GetHistogram( in short nbIntervals );
116 * Set precision for calculation. It is a position after point which is
117 * used to functor value after calculation.
119 void SetPrecision( in long thePrecision );
122 interface MinimumAngle : NumericalFunctor{};
123 interface AspectRatio : NumericalFunctor{};
124 interface AspectRatio3D : NumericalFunctor{};
125 interface Warping : NumericalFunctor{};
126 interface Taper : NumericalFunctor{};
127 interface Skew : NumericalFunctor{};
128 interface Area : NumericalFunctor{};
129 interface Volume3D : NumericalFunctor{};
130 interface MaxElementLength2D : NumericalFunctor{};
131 interface MaxElementLength3D : NumericalFunctor{};
132 interface Length : NumericalFunctor{};
133 interface Length2D : NumericalFunctor
140 typedef sequence<Value> Values;
143 interface MultiConnection : NumericalFunctor{};
144 interface MultiConnection2D : NumericalFunctor
152 typedef sequence<Value> Values;
158 * Predicates are intended for verification of criteria,
159 * must return bool value by mesh id
161 interface Predicate: Functor
163 boolean IsSatisfy( in long thEntityId );
167 * Logical functor (predicate) "Bad Oriented Volume".
168 * Verify whether a mesh volume is incorrectly oriented from
169 * the point of view of MED convention
171 interface BadOrientedVolume: Predicate {};
174 * Logical functor (predicate) "Volumes with bare border".
175 * Verify whether a mesh volume has a free facet without a mesh face on it
177 interface BareBorderVolume: Predicate {};
179 * Logical functor (predicate) "Faces with bare border".
180 * Verify whether a mesh face has a side not shared with another face
181 * and without a mesh edge on it
183 interface BareBorderFace: Predicate {};
186 * Logical functor (predicate) "Over-constrained Volume"
187 * Verify whether a mesh volume has only one facet shared with other volumes
189 interface OverConstrainedVolume: Predicate {};
191 * Logical functor (predicate) "Over-constrained Face".
192 * Verify whether a mesh face has only one border shared with other faces
194 interface OverConstrainedFace: Predicate {};
197 * Logical functor (predicate) "Belong To Geometry".
198 * Verify whether mesh element or node belong to pointed Geom Object
200 interface BelongToGeom: Predicate
202 void SetGeom( in GEOM::GEOM_Object theGeom );
203 void SetElementType( in ElementType theType );
205 /*! The tolerance is used only if there is no submesh on the shape
207 void SetTolerance( in double theToler );
208 double GetTolerance();
210 void SetShapeName( in string theName );
211 void SetShape( in string theID, in string theName );
212 string GetShapeName();
217 * Logical functor (predicate) "Belong To Surface".
218 * Base interface for "belong to plane" and "belong to cylinder"
219 * and "Belong To Generic Surface" interfaces
221 interface BelongToSurface: Predicate
223 void SetTolerance( in double theToler );
224 double GetTolerance();
225 void SetShapeName( in string theName, in ElementType theType );
226 void SetShape( in string theID, in string theName, in ElementType theType );
227 string GetShapeName();
230 * Limit surface extent to bounding box of boundaries (edges)
231 * in surface parametric space. Boundaries are ignored by default
233 void SetUseBoundaries( in boolean theUseBndRestrictions );
234 boolean GetUseBoundaries();
238 * Logical functor (predicate) "Belong To Plane".
239 * Verify whether mesh element lie on pointed Geom planar object
241 interface BelongToPlane: BelongToSurface
243 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
247 * Logical functor (predicate) "Belong To Cylinder".
248 * Verify whether mesh element lie on pointed Geom cylindrical object
250 interface BelongToCylinder: BelongToSurface
252 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
256 * Logical functor (predicate) "Belong To Generic Surface".
257 * Verify whether mesh element lie in pointed Geom cylindrical object
259 interface BelongToGenSurface: BelongToSurface
261 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
265 * Logical functor (predicate) "Lying On Geometry".
266 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
268 interface LyingOnGeom: Predicate
270 void SetGeom( in GEOM::GEOM_Object theGeom );
271 void SetElementType( in ElementType theType );
273 /*! The tolerance is used only if there is no submesh on the shape
275 void SetTolerance( in double theToler );
276 double GetTolerance();
278 void SetShapeName( in string theName );
279 void SetShape( in string theID, in string theName );
280 string GetShapeName();
285 * Logical functor (predicate) "Free borders".
286 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
288 interface FreeBorders: Predicate{};
291 * Logical functor (predicate) "Free edges".
292 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
294 interface FreeEdges: Predicate
301 typedef sequence<Border> Borders;
302 Borders GetBorders();
306 * Logical functor (predicate) "Free nodes".
307 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
309 interface FreeNodes: Predicate{};
312 * Logical functor (predicate) "Free faces".
313 * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
315 interface FreeFaces: Predicate{};
318 * Abstract logical functor (predicate) "RangeOfIds".
319 * Verify whether an Entity Id belongs to defined sequence of id's
321 interface RangeOfIds: Predicate
323 void SetRange( in long_array theIds );
324 boolean SetRangeStr( in string theRange );
325 string GetRangeStr();
327 void SetElementType( in ElementType theType );
331 * Comparator. Predicate for compare value calculated
332 * by numerical functor with threshold value
334 interface Comparator: Predicate
336 void SetMargin( in double theValue );
337 void SetNumFunctor( in NumericalFunctor theFunct );
340 interface LessThan: Comparator{};
341 interface MoreThan: Comparator{};
342 interface EqualTo : Comparator
344 void SetTolerance( in double theToler );
345 double GetTolerance();
349 * Logical predicates are intended for compose predicates using boolean operations
351 interface Logical: Predicate{};
353 interface LogicalNOT: Logical
355 void SetPredicate(in Predicate thePredicate);
358 interface LogicalBinary: Logical
360 void SetPredicate1( in Predicate thePredicate );
361 void SetPredicate2( in Predicate thePredicate );
364 interface LogicalAND: LogicalBinary{};
365 interface LogicalOR : LogicalBinary{};
368 * Logical functor (predicate) "Is element Linear or Quadratic".
369 * Verify whether a mesh element is linear
371 interface LinearOrQuadratic: Predicate {
372 void SetElementType( in ElementType theType );
376 * Functor "Group Color"
377 * Returns color of group to which mesh element belongs to
379 interface GroupColor : Predicate{
380 void SetElementType( in ElementType theType );
381 void SetColorStr( in string theColor );
382 string GetColorStr();
386 * Functor "Element geometry type"
387 * Returns is element has indicated geometry type
389 interface ElemGeomType : Predicate{
390 void SetElementType ( in ElementType theType );
391 void SetGeometryType( in GeometryType theType );
395 * Functor "Coplanar faces"
396 * Returns true if a mesh face is a coplanar neighbour to a given one. It checks
397 * if normal of a face has angle with the threshold face less than a tolerance.
399 interface CoplanarFaces : Predicate{
400 void SetFace ( in long theFaceID );
401 void SetTolerance( in double theToler );
407 interface Filter: SALOME::GenericObj, SMESH_IDSource
410 * Structure containing information about one criterion
411 * Type - FT_Taper, FT_Skew ...
412 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
413 * Threshold - threshold value
414 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
415 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
416 * (FT_Undefined must be for the last criterion)
417 * ThresholdStr - Threshold value defined as string. Used for:
418 * 1. Diapason of identifiers. Example: "1,2,3,5-10,12,27-29"
419 * 2. BelongToGeom predicate for storing name of shape
420 * 3. GroupColor predicate for storing group color "0.2;0;0.5"
421 * ThresholdID - One more threshold value defined as string. Used for:
422 * 1. BelongToGeom predicate for storing id of shape
423 * Tolerance - Tolerance is used for comparators (EqualTo comparision) and for
424 * "Belong to plane", "Belong to cylinder" etc predicates
425 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)
426 * Precision - Precision of numerical functors
438 ElementType TypeOfElement;
442 typedef sequence<Criterion> Criteria;
444 void SetPredicate( in Predicate thePredicate );
445 void SetMesh( in SMESH_Mesh theMesh );
447 long_array GetElementsId( in SMESH_Mesh theMesh );
448 ElementType GetElementType();
449 Predicate GetPredicate();
451 boolean GetCriteria( out Criteria theCriteria );
452 boolean SetCriteria( in Criteria theCriteria );
457 * Interface for working with library of filters
459 interface FilterLibrary : SALOME::GenericObj
462 * Copy filter from library by name (new filter is created)
464 Filter Copy( in string theFilterName );
467 * Methods for editing library
469 boolean Add ( in string theFilterName, in Filter theFilter );
470 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
471 boolean Delete ( in string theFilterName );
472 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
475 * Save library on disk
478 boolean SaveAs( in string aFileName );
483 boolean IsPresent( in string aFilterName );
484 long NbFilters( in ElementType aType );
485 string_array GetNames( in ElementType aType );
486 string_array GetAllNames();
487 void SetFileName( in string aFilterName );
488 string GetFileName();
493 * Interface of Filter manager
495 interface FilterManager: SALOME::GenericObj
498 * Create numerical functors
500 MinimumAngle CreateMinimumAngle();
501 AspectRatio CreateAspectRatio();
502 AspectRatio3D CreateAspectRatio3D();
503 Warping CreateWarping();
507 Volume3D CreateVolume3D();
508 MaxElementLength2D CreateMaxElementLength2D();
509 MaxElementLength3D CreateMaxElementLength3D();
510 Length CreateLength();
511 Length2D CreateLength2D();
512 MultiConnection CreateMultiConnection();
513 MultiConnection2D CreateMultiConnection2D();
516 * Create logical functors ( predicates )
518 BelongToGeom CreateBelongToGeom();
519 BelongToPlane CreateBelongToPlane();
520 BelongToCylinder CreateBelongToCylinder();
521 BelongToGenSurface CreateBelongToGenSurface();
523 LyingOnGeom CreateLyingOnGeom();
525 FreeBorders CreateFreeBorders();
526 FreeEdges CreateFreeEdges();
527 FreeNodes CreateFreeNodes();
528 FreeFaces CreateFreeFaces();
530 RangeOfIds CreateRangeOfIds();
532 BadOrientedVolume CreateBadOrientedVolume();
533 BareBorderVolume CreateBareBorderVolume();
534 BareBorderFace CreateBareBorderFace();
535 OverConstrainedVolume CreateOverConstrainedVolume();
536 OverConstrainedFace CreateOverConstrainedFace();
537 LinearOrQuadratic CreateLinearOrQuadratic();
539 GroupColor CreateGroupColor();
540 ElemGeomType CreateElemGeomType();
541 CoplanarFaces CreateCoplanarFaces();
544 * Create comparators ( predicates )
546 LessThan CreateLessThan();
547 MoreThan CreateMoreThan();
548 EqualTo CreateEqualTo();
551 * Create boolean operations ( predicates )
553 LogicalNOT CreateLogicalNOT();
554 LogicalAND CreateLogicalAND();
555 LogicalOR CreateLogicalOR();
560 Filter CreateFilter();
563 * Load filter library. If libary does not exist it is created
565 FilterLibrary LoadLibrary( in string aFileName );
570 FilterLibrary CreateLibrary();
575 boolean DeleteLibrary( in string aFileName );