1 // Copyright (C) 2007-2013 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,
56 FT_EqualNodes, // IMPORTANT: when a new item is added, please
57 FT_EqualEdges, // 1) update getFunctNames() in SMESH_Filter_i.cxx: line 3910
58 FT_EqualFaces, // 2) update fixFunctorType() in SMESH_2smeshpy.cxx: line 234
67 FT_BelongToGenSurface,
73 FT_OverConstrainedVolume,
74 FT_OverConstrainedFace,
91 * Parameters of a reclangle of histogram
93 struct HistogramRectangle
99 typedef sequence<HistogramRectangle> Histogram;
103 * Base interface for all functors ( i.e. numerical functors and predicates )
105 interface Functor: SALOME::GenericObj
107 void SetMesh( in SMESH_Mesh theMesh );
108 FunctorType GetFunctorType();
109 ElementType GetElementType();
113 * Numerical functors are intended for calculating value by Id of mesh entity
115 interface NumericalFunctor: Functor
117 double GetValue( in long theElementId );
119 Histogram GetHistogram( in short nbIntervals, in boolean isLogarithmic );
122 * Set precision for calculation. It is a position after point which is
123 * used to functor value after calculation.
125 void SetPrecision( in long thePrecision );
128 interface MinimumAngle : NumericalFunctor{};
129 interface AspectRatio : NumericalFunctor{};
130 interface AspectRatio3D : NumericalFunctor{};
131 interface Warping : NumericalFunctor{};
132 interface Taper : NumericalFunctor{};
133 interface Skew : NumericalFunctor{};
134 interface Area : NumericalFunctor{};
135 interface Volume3D : NumericalFunctor{};
136 interface MaxElementLength2D : NumericalFunctor{};
137 interface MaxElementLength3D : NumericalFunctor{};
138 interface Length : NumericalFunctor{};
139 interface Length2D : NumericalFunctor
146 typedef sequence<Value> Values;
149 interface MultiConnection : NumericalFunctor{};
150 interface MultiConnection2D : NumericalFunctor
158 typedef sequence<Value> Values;
161 interface BallDiameter : NumericalFunctor{};
165 * Predicates are intended for verification of criteria,
166 * must return bool value by mesh id
168 interface Predicate: Functor
170 boolean IsSatisfy( in long thEntityId );
174 * Logical functor (predicate) "Bad Oriented Volume".
175 * Verify whether a mesh volume is incorrectly oriented from
176 * the point of view of MED convention
178 interface BadOrientedVolume: Predicate {};
181 * Logical functor (predicate) "Volumes with bare border".
182 * Verify whether a mesh volume has a free facet without a mesh face on it
184 interface BareBorderVolume: Predicate {};
186 * Logical functor (predicate) "Faces with bare border".
187 * Verify whether a mesh face has a side not shared with another face
188 * and without a mesh edge on it
190 interface BareBorderFace: Predicate {};
193 * Logical functor (predicate) "Over-constrained Volume"
194 * Verify whether a mesh volume has only one facet shared with other volumes
196 interface OverConstrainedVolume: Predicate {};
198 * Logical functor (predicate) "Over-constrained Face".
199 * Verify whether a mesh face has only one border shared with other faces
201 interface OverConstrainedFace: Predicate {};
204 * Logical functor (predicate) "Equal Nodes".
205 * Verify whether there is another mesh node with same coordinates
207 interface EqualNodes: Predicate
209 void SetTolerance( in double theToler );
210 double GetTolerance();
213 * Logical functor (predicate) "Equal Edges".
214 * Verify whether there is another mesh edge basing on the same nodes
216 interface EqualEdges: Predicate {};
218 * Logical functor (predicate) "Equal Faces".
219 * Verify whether there is another mesh face basing on the same nodes
221 interface EqualFaces: Predicate {};
223 * Logical functor (predicate) "Equal Volumes".
224 * Verify whether there is another mesh volumes basing on the same nodes
226 interface EqualVolumes: Predicate {};
229 * Logical functor (predicate) "Belong To Geometry".
230 * Verify whether mesh element or node belong to pointed Geom Object
232 interface BelongToGeom: Predicate
234 void SetGeom( in GEOM::GEOM_Object theGeom );
235 void SetElementType( in ElementType theType );
237 /*! The tolerance is used only if there is no submesh on the shape
239 void SetTolerance( in double theToler );
240 double GetTolerance();
242 void SetShapeName( in string theName );
243 void SetShape( in string theID, in string theName );
244 string GetShapeName();
249 * Logical functor (predicate) "Belong To Surface".
250 * Base interface for "belong to plane" and "belong to cylinder"
251 * and "Belong To Generic Surface" interfaces
253 interface BelongToSurface: Predicate
255 void SetTolerance( in double theToler );
256 double GetTolerance();
257 void SetShapeName( in string theName, in ElementType theType );
258 void SetShape( in string theID, in string theName, in ElementType theType );
259 string GetShapeName();
262 * Limit surface extent to bounding box of boundaries (edges)
263 * in surface parametric space. Boundaries are ignored by default
265 void SetUseBoundaries( in boolean theUseBndRestrictions );
266 boolean GetUseBoundaries();
270 * Logical functor (predicate) "Belong To Plane".
271 * Verify whether mesh element lie on pointed Geom planar object
273 interface BelongToPlane: BelongToSurface
275 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
279 * Logical functor (predicate) "Belong To Cylinder".
280 * Verify whether mesh element lie on pointed Geom cylindrical object
282 interface BelongToCylinder: BelongToSurface
284 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
288 * Logical functor (predicate) "Belong To Generic Surface".
289 * Verify whether mesh element lie in pointed Geom cylindrical object
291 interface BelongToGenSurface: BelongToSurface
293 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
297 * Logical functor (predicate) "Lying On Geometry".
298 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
300 interface LyingOnGeom: Predicate
302 void SetGeom( in GEOM::GEOM_Object theGeom );
303 void SetElementType( in ElementType theType );
305 /*! The tolerance is used only if there is no submesh on the shape
307 void SetTolerance( in double theToler );
308 double GetTolerance();
310 void SetShapeName( in string theName );
311 void SetShape( in string theID, in string theName );
312 string GetShapeName();
317 * Logical functor (predicate) "Free borders".
318 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
320 interface FreeBorders: Predicate{};
323 * Logical functor (predicate) "Free edges".
324 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
326 interface FreeEdges: Predicate
333 typedef sequence<Border> Borders;
334 Borders GetBorders();
338 * Logical functor (predicate) "Free nodes".
339 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
341 interface FreeNodes: Predicate{};
344 * Logical functor (predicate) "Free faces".
345 * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
347 interface FreeFaces: Predicate{};
350 * Abstract logical functor (predicate) "RangeOfIds".
351 * Verify whether an Entity Id belongs to defined sequence of id's
353 interface RangeOfIds: Predicate
355 void SetRange( in long_array theIds );
356 boolean SetRangeStr( in string theRange );
357 string GetRangeStr();
359 void SetElementType( in ElementType theType );
363 * Comparator. Predicate for compare value calculated
364 * by numerical functor with threshold value
366 interface Comparator: Predicate
368 void SetMargin( in double theValue );
369 void SetNumFunctor( in NumericalFunctor theFunct );
372 interface LessThan: Comparator{};
373 interface MoreThan: Comparator{};
374 interface EqualTo : Comparator
376 void SetTolerance( in double theToler );
377 double GetTolerance();
381 * Logical predicates are intended for compose predicates using boolean operations
383 interface Logical: Predicate{};
385 interface LogicalNOT: Logical
387 void SetPredicate(in Predicate thePredicate);
390 interface LogicalBinary: Logical
392 void SetPredicate1( in Predicate thePredicate );
393 void SetPredicate2( in Predicate thePredicate );
396 interface LogicalAND: LogicalBinary{};
397 interface LogicalOR : LogicalBinary{};
400 * Logical functor (predicate) "Is element Linear or Quadratic".
401 * Verify whether a mesh element is linear
403 interface LinearOrQuadratic: Predicate {
404 void SetElementType( in ElementType theType );
408 * Functor "Group Color"
409 * Returns color of group to which mesh element belongs to
411 interface GroupColor : Predicate{
412 void SetElementType( in ElementType theType );
413 void SetColorStr( in string theColor );
414 string GetColorStr();
418 * Functor "Element geometry type"
419 * Returns is element has indicated geometry type
421 interface ElemGeomType : Predicate{
422 void SetElementType ( in ElementType theType );
423 void SetGeometryType( in GeometryType theType );
427 * Functor "Element entity type"
428 * Returns is element has indicated entity type
430 interface ElemEntityType : Predicate{
431 void SetElementType ( in ElementType theType );
432 void SetEntityType( in EntityType theSetEntityType );
436 * Functor "Coplanar faces"
437 * Returns true if a mesh face is a coplanar neighbour to a given one. It checks
438 * if normal of a face has angle with the threshold face less than a tolerance.
440 interface CoplanarFaces : Predicate{
441 void SetFace ( in long theFaceID );
442 void SetTolerance( in double theToler );
448 interface Filter: SALOME::GenericObj, SMESH_IDSource
451 * Structure containing information about one criterion
452 * Type - FT_Taper, FT_Skew ...
453 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
454 * Threshold - threshold value
455 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
456 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
457 * (FT_Undefined must be for the last criterion)
458 * ThresholdStr - Threshold value defined as string. Used for:
459 * 1. Diapason of identifiers. Example: "1,2,3,5-10,12,27-29"
460 * 2. BelongToGeom predicate for storing name of shape
461 * 3. GroupColor predicate for storing group color "0.2;0;0.5"
462 * ThresholdID - One more threshold value defined as string. Used for:
463 * 1. BelongToGeom predicate for storing id of shape
464 * Tolerance - Tolerance is used for comparators (EqualTo comparision) and for
465 * "Belong to plane", "Belong to cylinder" etc predicates
466 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)
467 * Precision - Precision of numerical functors
479 ElementType TypeOfElement;
483 typedef sequence<Criterion> Criteria;
485 void SetPredicate( in Predicate thePredicate );
486 void SetMesh( in SMESH_Mesh theMesh );
488 long_array GetElementsId( in SMESH_Mesh theMesh );
489 ElementType GetElementType();
490 Predicate GetPredicate();
492 boolean GetCriteria( out Criteria theCriteria );
493 boolean SetCriteria( in Criteria theCriteria );
498 * Interface for working with library of filters
500 interface FilterLibrary : SALOME::GenericObj
503 * Copy filter from library by name (new filter is created)
505 Filter Copy( in string theFilterName );
508 * Methods for editing library
510 boolean Add ( in string theFilterName, in Filter theFilter );
511 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
512 boolean Delete ( in string theFilterName );
513 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
516 * Save library on disk
519 boolean SaveAs( in string aFileName );
524 boolean IsPresent( in string aFilterName );
525 long NbFilters( in ElementType aType );
526 string_array GetNames( in ElementType aType );
527 string_array GetAllNames();
528 void SetFileName( in string aFilterName );
529 string GetFileName();
534 * Interface of Filter manager
536 interface FilterManager: SALOME::GenericObj
539 * Create numerical functors
541 MinimumAngle CreateMinimumAngle();
542 AspectRatio CreateAspectRatio();
543 AspectRatio3D CreateAspectRatio3D();
544 Warping CreateWarping();
548 Volume3D CreateVolume3D();
549 MaxElementLength2D CreateMaxElementLength2D();
550 MaxElementLength3D CreateMaxElementLength3D();
551 Length CreateLength();
552 Length2D CreateLength2D();
553 MultiConnection CreateMultiConnection();
554 MultiConnection2D CreateMultiConnection2D();
555 BallDiameter CreateBallDiameter();
557 * Create logical functors ( predicates )
559 BelongToGeom CreateBelongToGeom();
560 BelongToPlane CreateBelongToPlane();
561 BelongToCylinder CreateBelongToCylinder();
562 BelongToGenSurface CreateBelongToGenSurface();
564 LyingOnGeom CreateLyingOnGeom();
566 FreeBorders CreateFreeBorders();
567 FreeEdges CreateFreeEdges();
568 FreeNodes CreateFreeNodes();
569 FreeFaces CreateFreeFaces();
571 EqualNodes CreateEqualNodes();
572 EqualEdges CreateEqualEdges();
573 EqualFaces CreateEqualFaces();
574 EqualVolumes CreateEqualVolumes();
576 RangeOfIds CreateRangeOfIds();
578 BadOrientedVolume CreateBadOrientedVolume();
579 BareBorderVolume CreateBareBorderVolume();
580 BareBorderFace CreateBareBorderFace();
581 OverConstrainedVolume CreateOverConstrainedVolume();
582 OverConstrainedFace CreateOverConstrainedFace();
583 LinearOrQuadratic CreateLinearOrQuadratic();
585 GroupColor CreateGroupColor();
586 ElemGeomType CreateElemGeomType();
587 ElemEntityType CreateElemEntityType();
588 CoplanarFaces CreateCoplanarFaces();
591 * Create comparators ( predicates )
593 LessThan CreateLessThan();
594 MoreThan CreateMoreThan();
595 EqualTo CreateEqualTo();
598 * Create boolean operations ( predicates )
600 LogicalNOT CreateLogicalNOT();
601 LogicalAND CreateLogicalAND();
602 LogicalOR CreateLogicalOR();
607 Filter CreateFilter();
610 * Load filter library. If libary does not exist it is created
612 FilterLibrary LoadLibrary( in string aFileName );
617 FilterLibrary CreateLibrary();
622 boolean DeleteLibrary( in string aFileName );