1 // Copyright (C) 2007-2012 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,
67 FT_BelongToGenSurface,
73 FT_OverConstrainedVolume,
74 FT_OverConstrainedFace,
89 * Parameters of a reclangle of histogram
91 struct HistogramRectangle
97 typedef sequence<HistogramRectangle> Histogram;
101 * Base interface for all functors ( i.e. numerical functors and predicates )
103 interface Functor: SALOME::GenericObj
105 void SetMesh( in SMESH_Mesh theMesh );
106 FunctorType GetFunctorType();
107 ElementType GetElementType();
111 * Numerical functors are intended for calculating value by Id of mesh entity
113 interface NumericalFunctor: Functor
115 double GetValue( in long theElementId );
117 Histogram GetHistogram( in short nbIntervals );
120 * Set precision for calculation. It is a position after point which is
121 * used to functor value after calculation.
123 void SetPrecision( in long thePrecision );
126 interface MinimumAngle : NumericalFunctor{};
127 interface AspectRatio : NumericalFunctor{};
128 interface AspectRatio3D : NumericalFunctor{};
129 interface Warping : NumericalFunctor{};
130 interface Taper : NumericalFunctor{};
131 interface Skew : NumericalFunctor{};
132 interface Area : NumericalFunctor{};
133 interface Volume3D : NumericalFunctor{};
134 interface MaxElementLength2D : NumericalFunctor{};
135 interface MaxElementLength3D : NumericalFunctor{};
136 interface Length : NumericalFunctor{};
137 interface Length2D : NumericalFunctor
144 typedef sequence<Value> Values;
147 interface MultiConnection : NumericalFunctor{};
148 interface MultiConnection2D : NumericalFunctor
156 typedef sequence<Value> Values;
162 * Predicates are intended for verification of criteria,
163 * must return bool value by mesh id
165 interface Predicate: Functor
167 boolean IsSatisfy( in long thEntityId );
171 * Logical functor (predicate) "Bad Oriented Volume".
172 * Verify whether a mesh volume is incorrectly oriented from
173 * the point of view of MED convention
175 interface BadOrientedVolume: Predicate {};
178 * Logical functor (predicate) "Volumes with bare border".
179 * Verify whether a mesh volume has a free facet without a mesh face on it
181 interface BareBorderVolume: Predicate {};
183 * Logical functor (predicate) "Faces with bare border".
184 * Verify whether a mesh face has a side not shared with another face
185 * and without a mesh edge on it
187 interface BareBorderFace: Predicate {};
190 * Logical functor (predicate) "Over-constrained Volume"
191 * Verify whether a mesh volume has only one facet shared with other volumes
193 interface OverConstrainedVolume: Predicate {};
195 * Logical functor (predicate) "Over-constrained Face".
196 * Verify whether a mesh face has only one border shared with other faces
198 interface OverConstrainedFace: Predicate {};
201 * Logical functor (predicate) "Equal Nodes".
202 * Verify whether there is another mesh node with same coordinates
204 interface EqualNodes: Predicate
206 void SetTolerance( in double theToler );
207 double GetTolerance();
210 * Logical functor (predicate) "Equal Edges".
211 * Verify whether there is another mesh edge basing on the same nodes
213 interface EqualEdges: Predicate {};
215 * Logical functor (predicate) "Equal Faces".
216 * Verify whether there is another mesh face basing on the same nodes
218 interface EqualFaces: Predicate {};
220 * Logical functor (predicate) "Equal Volumes".
221 * Verify whether there is another mesh volumes basing on the same nodes
223 interface EqualVolumes: Predicate {};
226 * Logical functor (predicate) "Belong To Geometry".
227 * Verify whether mesh element or node belong to pointed Geom Object
229 interface BelongToGeom: Predicate
231 void SetGeom( in GEOM::GEOM_Object theGeom );
232 void SetElementType( in ElementType theType );
234 /*! The tolerance is used only if there is no submesh on the shape
236 void SetTolerance( in double theToler );
237 double GetTolerance();
239 void SetShapeName( in string theName );
240 void SetShape( in string theID, in string theName );
241 string GetShapeName();
246 * Logical functor (predicate) "Belong To Surface".
247 * Base interface for "belong to plane" and "belong to cylinder"
248 * and "Belong To Generic Surface" interfaces
250 interface BelongToSurface: Predicate
252 void SetTolerance( in double theToler );
253 double GetTolerance();
254 void SetShapeName( in string theName, in ElementType theType );
255 void SetShape( in string theID, in string theName, in ElementType theType );
256 string GetShapeName();
259 * Limit surface extent to bounding box of boundaries (edges)
260 * in surface parametric space. Boundaries are ignored by default
262 void SetUseBoundaries( in boolean theUseBndRestrictions );
263 boolean GetUseBoundaries();
267 * Logical functor (predicate) "Belong To Plane".
268 * Verify whether mesh element lie on pointed Geom planar object
270 interface BelongToPlane: BelongToSurface
272 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
276 * Logical functor (predicate) "Belong To Cylinder".
277 * Verify whether mesh element lie on pointed Geom cylindrical object
279 interface BelongToCylinder: BelongToSurface
281 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
285 * Logical functor (predicate) "Belong To Generic Surface".
286 * Verify whether mesh element lie in pointed Geom cylindrical object
288 interface BelongToGenSurface: BelongToSurface
290 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
294 * Logical functor (predicate) "Lying On Geometry".
295 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
297 interface LyingOnGeom: Predicate
299 void SetGeom( in GEOM::GEOM_Object theGeom );
300 void SetElementType( in ElementType theType );
302 /*! The tolerance is used only if there is no submesh on the shape
304 void SetTolerance( in double theToler );
305 double GetTolerance();
307 void SetShapeName( in string theName );
308 void SetShape( in string theID, in string theName );
309 string GetShapeName();
314 * Logical functor (predicate) "Free borders".
315 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
317 interface FreeBorders: Predicate{};
320 * Logical functor (predicate) "Free edges".
321 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
323 interface FreeEdges: Predicate
330 typedef sequence<Border> Borders;
331 Borders GetBorders();
335 * Logical functor (predicate) "Free nodes".
336 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
338 interface FreeNodes: Predicate{};
341 * Logical functor (predicate) "Free faces".
342 * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
344 interface FreeFaces: Predicate{};
347 * Abstract logical functor (predicate) "RangeOfIds".
348 * Verify whether an Entity Id belongs to defined sequence of id's
350 interface RangeOfIds: Predicate
352 void SetRange( in long_array theIds );
353 boolean SetRangeStr( in string theRange );
354 string GetRangeStr();
356 void SetElementType( in ElementType theType );
360 * Comparator. Predicate for compare value calculated
361 * by numerical functor with threshold value
363 interface Comparator: Predicate
365 void SetMargin( in double theValue );
366 void SetNumFunctor( in NumericalFunctor theFunct );
369 interface LessThan: Comparator{};
370 interface MoreThan: Comparator{};
371 interface EqualTo : Comparator
373 void SetTolerance( in double theToler );
374 double GetTolerance();
378 * Logical predicates are intended for compose predicates using boolean operations
380 interface Logical: Predicate{};
382 interface LogicalNOT: Logical
384 void SetPredicate(in Predicate thePredicate);
387 interface LogicalBinary: Logical
389 void SetPredicate1( in Predicate thePredicate );
390 void SetPredicate2( in Predicate thePredicate );
393 interface LogicalAND: LogicalBinary{};
394 interface LogicalOR : LogicalBinary{};
397 * Logical functor (predicate) "Is element Linear or Quadratic".
398 * Verify whether a mesh element is linear
400 interface LinearOrQuadratic: Predicate {
401 void SetElementType( in ElementType theType );
405 * Functor "Group Color"
406 * Returns color of group to which mesh element belongs to
408 interface GroupColor : Predicate{
409 void SetElementType( in ElementType theType );
410 void SetColorStr( in string theColor );
411 string GetColorStr();
415 * Functor "Element geometry type"
416 * Returns is element has indicated geometry type
418 interface ElemGeomType : Predicate{
419 void SetElementType ( in ElementType theType );
420 void SetGeometryType( in GeometryType theType );
424 * Functor "Coplanar faces"
425 * Returns true if a mesh face is a coplanar neighbour to a given one. It checks
426 * if normal of a face has angle with the threshold face less than a tolerance.
428 interface CoplanarFaces : Predicate{
429 void SetFace ( in long theFaceID );
430 void SetTolerance( in double theToler );
436 interface Filter: SALOME::GenericObj, SMESH_IDSource
439 * Structure containing information about one criterion
440 * Type - FT_Taper, FT_Skew ...
441 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
442 * Threshold - threshold value
443 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
444 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
445 * (FT_Undefined must be for the last criterion)
446 * ThresholdStr - Threshold value defined as string. Used for:
447 * 1. Diapason of identifiers. Example: "1,2,3,5-10,12,27-29"
448 * 2. BelongToGeom predicate for storing name of shape
449 * 3. GroupColor predicate for storing group color "0.2;0;0.5"
450 * ThresholdID - One more threshold value defined as string. Used for:
451 * 1. BelongToGeom predicate for storing id of shape
452 * Tolerance - Tolerance is used for comparators (EqualTo comparision) and for
453 * "Belong to plane", "Belong to cylinder" etc predicates
454 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)
455 * Precision - Precision of numerical functors
467 ElementType TypeOfElement;
471 typedef sequence<Criterion> Criteria;
473 void SetPredicate( in Predicate thePredicate );
474 void SetMesh( in SMESH_Mesh theMesh );
476 long_array GetElementsId( in SMESH_Mesh theMesh );
477 ElementType GetElementType();
478 Predicate GetPredicate();
480 boolean GetCriteria( out Criteria theCriteria );
481 boolean SetCriteria( in Criteria theCriteria );
486 * Interface for working with library of filters
488 interface FilterLibrary : SALOME::GenericObj
491 * Copy filter from library by name (new filter is created)
493 Filter Copy( in string theFilterName );
496 * Methods for editing library
498 boolean Add ( in string theFilterName, in Filter theFilter );
499 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
500 boolean Delete ( in string theFilterName );
501 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
504 * Save library on disk
507 boolean SaveAs( in string aFileName );
512 boolean IsPresent( in string aFilterName );
513 long NbFilters( in ElementType aType );
514 string_array GetNames( in ElementType aType );
515 string_array GetAllNames();
516 void SetFileName( in string aFilterName );
517 string GetFileName();
522 * Interface of Filter manager
524 interface FilterManager: SALOME::GenericObj
527 * Create numerical functors
529 MinimumAngle CreateMinimumAngle();
530 AspectRatio CreateAspectRatio();
531 AspectRatio3D CreateAspectRatio3D();
532 Warping CreateWarping();
536 Volume3D CreateVolume3D();
537 MaxElementLength2D CreateMaxElementLength2D();
538 MaxElementLength3D CreateMaxElementLength3D();
539 Length CreateLength();
540 Length2D CreateLength2D();
541 MultiConnection CreateMultiConnection();
542 MultiConnection2D CreateMultiConnection2D();
545 * Create logical functors ( predicates )
547 BelongToGeom CreateBelongToGeom();
548 BelongToPlane CreateBelongToPlane();
549 BelongToCylinder CreateBelongToCylinder();
550 BelongToGenSurface CreateBelongToGenSurface();
552 LyingOnGeom CreateLyingOnGeom();
554 FreeBorders CreateFreeBorders();
555 FreeEdges CreateFreeEdges();
556 FreeNodes CreateFreeNodes();
557 FreeFaces CreateFreeFaces();
559 EqualNodes CreateEqualNodes();
560 EqualEdges CreateEqualEdges();
561 EqualFaces CreateEqualFaces();
562 EqualVolumes CreateEqualVolumes();
564 RangeOfIds CreateRangeOfIds();
566 BadOrientedVolume CreateBadOrientedVolume();
567 BareBorderVolume CreateBareBorderVolume();
568 BareBorderFace CreateBareBorderFace();
569 OverConstrainedVolume CreateOverConstrainedVolume();
570 OverConstrainedFace CreateOverConstrainedFace();
571 LinearOrQuadratic CreateLinearOrQuadratic();
573 GroupColor CreateGroupColor();
574 ElemGeomType CreateElemGeomType();
575 CoplanarFaces CreateCoplanarFaces();
578 * Create comparators ( predicates )
580 LessThan CreateLessThan();
581 MoreThan CreateMoreThan();
582 EqualTo CreateEqualTo();
585 * Create boolean operations ( predicates )
587 LogicalNOT CreateLogicalNOT();
588 LogicalAND CreateLogicalAND();
589 LogicalOR CreateLogicalOR();
594 Filter CreateFilter();
597 * Load filter library. If libary does not exist it is created
599 FilterLibrary LoadLibrary( in string aFileName );
604 FilterLibrary CreateLibrary();
609 boolean DeleteLibrary( in string aFileName );