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,
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,
90 * Parameters of a reclangle of histogram
92 struct HistogramRectangle
98 typedef sequence<HistogramRectangle> Histogram;
102 * Base interface for all functors ( i.e. numerical functors and predicates )
104 interface Functor: SALOME::GenericObj
106 void SetMesh( in SMESH_Mesh theMesh );
107 FunctorType GetFunctorType();
108 ElementType GetElementType();
112 * Numerical functors are intended for calculating value by Id of mesh entity
114 interface NumericalFunctor: Functor
116 double GetValue( in long theElementId );
118 Histogram GetHistogram( in short nbIntervals );
121 * Set precision for calculation. It is a position after point which is
122 * used to functor value after calculation.
124 void SetPrecision( in long thePrecision );
127 interface MinimumAngle : NumericalFunctor{};
128 interface AspectRatio : NumericalFunctor{};
129 interface AspectRatio3D : NumericalFunctor{};
130 interface Warping : NumericalFunctor{};
131 interface Taper : NumericalFunctor{};
132 interface Skew : NumericalFunctor{};
133 interface Area : NumericalFunctor{};
134 interface Volume3D : NumericalFunctor{};
135 interface MaxElementLength2D : NumericalFunctor{};
136 interface MaxElementLength3D : NumericalFunctor{};
137 interface Length : NumericalFunctor{};
138 interface Length2D : NumericalFunctor
145 typedef sequence<Value> Values;
148 interface MultiConnection : NumericalFunctor{};
149 interface MultiConnection2D : NumericalFunctor
157 typedef sequence<Value> Values;
160 interface BallDiameter : NumericalFunctor{};
164 * Predicates are intended for verification of criteria,
165 * must return bool value by mesh id
167 interface Predicate: Functor
169 boolean IsSatisfy( in long thEntityId );
173 * Logical functor (predicate) "Bad Oriented Volume".
174 * Verify whether a mesh volume is incorrectly oriented from
175 * the point of view of MED convention
177 interface BadOrientedVolume: Predicate {};
180 * Logical functor (predicate) "Volumes with bare border".
181 * Verify whether a mesh volume has a free facet without a mesh face on it
183 interface BareBorderVolume: Predicate {};
185 * Logical functor (predicate) "Faces with bare border".
186 * Verify whether a mesh face has a side not shared with another face
187 * and without a mesh edge on it
189 interface BareBorderFace: Predicate {};
192 * Logical functor (predicate) "Over-constrained Volume"
193 * Verify whether a mesh volume has only one facet shared with other volumes
195 interface OverConstrainedVolume: Predicate {};
197 * Logical functor (predicate) "Over-constrained Face".
198 * Verify whether a mesh face has only one border shared with other faces
200 interface OverConstrainedFace: Predicate {};
203 * Logical functor (predicate) "Equal Nodes".
204 * Verify whether there is another mesh node with same coordinates
206 interface EqualNodes: Predicate
208 void SetTolerance( in double theToler );
209 double GetTolerance();
212 * Logical functor (predicate) "Equal Edges".
213 * Verify whether there is another mesh edge basing on the same nodes
215 interface EqualEdges: Predicate {};
217 * Logical functor (predicate) "Equal Faces".
218 * Verify whether there is another mesh face basing on the same nodes
220 interface EqualFaces: Predicate {};
222 * Logical functor (predicate) "Equal Volumes".
223 * Verify whether there is another mesh volumes basing on the same nodes
225 interface EqualVolumes: Predicate {};
228 * Logical functor (predicate) "Belong To Geometry".
229 * Verify whether mesh element or node belong to pointed Geom Object
231 interface BelongToGeom: Predicate
233 void SetGeom( in GEOM::GEOM_Object theGeom );
234 void SetElementType( in ElementType theType );
236 /*! The tolerance is used only if there is no submesh on the shape
238 void SetTolerance( in double theToler );
239 double GetTolerance();
241 void SetShapeName( in string theName );
242 void SetShape( in string theID, in string theName );
243 string GetShapeName();
248 * Logical functor (predicate) "Belong To Surface".
249 * Base interface for "belong to plane" and "belong to cylinder"
250 * and "Belong To Generic Surface" interfaces
252 interface BelongToSurface: Predicate
254 void SetTolerance( in double theToler );
255 double GetTolerance();
256 void SetShapeName( in string theName, in ElementType theType );
257 void SetShape( in string theID, in string theName, in ElementType theType );
258 string GetShapeName();
261 * Limit surface extent to bounding box of boundaries (edges)
262 * in surface parametric space. Boundaries are ignored by default
264 void SetUseBoundaries( in boolean theUseBndRestrictions );
265 boolean GetUseBoundaries();
269 * Logical functor (predicate) "Belong To Plane".
270 * Verify whether mesh element lie on pointed Geom planar object
272 interface BelongToPlane: BelongToSurface
274 void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
278 * Logical functor (predicate) "Belong To Cylinder".
279 * Verify whether mesh element lie on pointed Geom cylindrical object
281 interface BelongToCylinder: BelongToSurface
283 void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
287 * Logical functor (predicate) "Belong To Generic Surface".
288 * Verify whether mesh element lie in pointed Geom cylindrical object
290 interface BelongToGenSurface: BelongToSurface
292 void SetSurface( in GEOM::GEOM_Object theGeom, in ElementType theType );
296 * Logical functor (predicate) "Lying On Geometry".
297 * Verify whether mesh element or node lying or partially lying on the pointed Geom Object
299 interface LyingOnGeom: Predicate
301 void SetGeom( in GEOM::GEOM_Object theGeom );
302 void SetElementType( in ElementType theType );
304 /*! The tolerance is used only if there is no submesh on the shape
306 void SetTolerance( in double theToler );
307 double GetTolerance();
309 void SetShapeName( in string theName );
310 void SetShape( in string theID, in string theName );
311 string GetShapeName();
316 * Logical functor (predicate) "Free borders".
317 * Verify whether 1D mesh element is free ( i.e. connected to one face only )
319 interface FreeBorders: Predicate{};
322 * Logical functor (predicate) "Free edges".
323 * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
325 interface FreeEdges: Predicate
332 typedef sequence<Border> Borders;
333 Borders GetBorders();
337 * Logical functor (predicate) "Free nodes".
338 * Verify whether mesh has free nodes( i.e. nodes are not connected to any element )
340 interface FreeNodes: Predicate{};
343 * Logical functor (predicate) "Free faces".
344 * Verify whether 2D mesh element is free ( i.e. connected to one volume only )
346 interface FreeFaces: Predicate{};
349 * Abstract logical functor (predicate) "RangeOfIds".
350 * Verify whether an Entity Id belongs to defined sequence of id's
352 interface RangeOfIds: Predicate
354 void SetRange( in long_array theIds );
355 boolean SetRangeStr( in string theRange );
356 string GetRangeStr();
358 void SetElementType( in ElementType theType );
362 * Comparator. Predicate for compare value calculated
363 * by numerical functor with threshold value
365 interface Comparator: Predicate
367 void SetMargin( in double theValue );
368 void SetNumFunctor( in NumericalFunctor theFunct );
371 interface LessThan: Comparator{};
372 interface MoreThan: Comparator{};
373 interface EqualTo : Comparator
375 void SetTolerance( in double theToler );
376 double GetTolerance();
380 * Logical predicates are intended for compose predicates using boolean operations
382 interface Logical: Predicate{};
384 interface LogicalNOT: Logical
386 void SetPredicate(in Predicate thePredicate);
389 interface LogicalBinary: Logical
391 void SetPredicate1( in Predicate thePredicate );
392 void SetPredicate2( in Predicate thePredicate );
395 interface LogicalAND: LogicalBinary{};
396 interface LogicalOR : LogicalBinary{};
399 * Logical functor (predicate) "Is element Linear or Quadratic".
400 * Verify whether a mesh element is linear
402 interface LinearOrQuadratic: Predicate {
403 void SetElementType( in ElementType theType );
407 * Functor "Group Color"
408 * Returns color of group to which mesh element belongs to
410 interface GroupColor : Predicate{
411 void SetElementType( in ElementType theType );
412 void SetColorStr( in string theColor );
413 string GetColorStr();
417 * Functor "Element geometry type"
418 * Returns is element has indicated geometry type
420 interface ElemGeomType : Predicate{
421 void SetElementType ( in ElementType theType );
422 void SetGeometryType( in GeometryType theType );
426 * Functor "Coplanar faces"
427 * Returns true if a mesh face is a coplanar neighbour to a given one. It checks
428 * if normal of a face has angle with the threshold face less than a tolerance.
430 interface CoplanarFaces : Predicate{
431 void SetFace ( in long theFaceID );
432 void SetTolerance( in double theToler );
438 interface Filter: SALOME::GenericObj, SMESH_IDSource
441 * Structure containing information about one criterion
442 * Type - FT_Taper, FT_Skew ...
443 * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
444 * Threshold - threshold value
445 * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
446 * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
447 * (FT_Undefined must be for the last criterion)
448 * ThresholdStr - Threshold value defined as string. Used for:
449 * 1. Diapason of identifiers. Example: "1,2,3,5-10,12,27-29"
450 * 2. BelongToGeom predicate for storing name of shape
451 * 3. GroupColor predicate for storing group color "0.2;0;0.5"
452 * ThresholdID - One more threshold value defined as string. Used for:
453 * 1. BelongToGeom predicate for storing id of shape
454 * Tolerance - Tolerance is used for comparators (EqualTo comparision) and for
455 * "Belong to plane", "Belong to cylinder" etc predicates
456 * TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)
457 * Precision - Precision of numerical functors
469 ElementType TypeOfElement;
473 typedef sequence<Criterion> Criteria;
475 void SetPredicate( in Predicate thePredicate );
476 void SetMesh( in SMESH_Mesh theMesh );
478 long_array GetElementsId( in SMESH_Mesh theMesh );
479 ElementType GetElementType();
480 Predicate GetPredicate();
482 boolean GetCriteria( out Criteria theCriteria );
483 boolean SetCriteria( in Criteria theCriteria );
488 * Interface for working with library of filters
490 interface FilterLibrary : SALOME::GenericObj
493 * Copy filter from library by name (new filter is created)
495 Filter Copy( in string theFilterName );
498 * Methods for editing library
500 boolean Add ( in string theFilterName, in Filter theFilter );
501 boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
502 boolean Delete ( in string theFilterName );
503 boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
506 * Save library on disk
509 boolean SaveAs( in string aFileName );
514 boolean IsPresent( in string aFilterName );
515 long NbFilters( in ElementType aType );
516 string_array GetNames( in ElementType aType );
517 string_array GetAllNames();
518 void SetFileName( in string aFilterName );
519 string GetFileName();
524 * Interface of Filter manager
526 interface FilterManager: SALOME::GenericObj
529 * Create numerical functors
531 MinimumAngle CreateMinimumAngle();
532 AspectRatio CreateAspectRatio();
533 AspectRatio3D CreateAspectRatio3D();
534 Warping CreateWarping();
538 Volume3D CreateVolume3D();
539 MaxElementLength2D CreateMaxElementLength2D();
540 MaxElementLength3D CreateMaxElementLength3D();
541 Length CreateLength();
542 Length2D CreateLength2D();
543 MultiConnection CreateMultiConnection();
544 MultiConnection2D CreateMultiConnection2D();
545 BallDiameter CreateBallDiameter();
548 * Create logical functors ( predicates )
550 BelongToGeom CreateBelongToGeom();
551 BelongToPlane CreateBelongToPlane();
552 BelongToCylinder CreateBelongToCylinder();
553 BelongToGenSurface CreateBelongToGenSurface();
555 LyingOnGeom CreateLyingOnGeom();
557 FreeBorders CreateFreeBorders();
558 FreeEdges CreateFreeEdges();
559 FreeNodes CreateFreeNodes();
560 FreeFaces CreateFreeFaces();
562 EqualNodes CreateEqualNodes();
563 EqualEdges CreateEqualEdges();
564 EqualFaces CreateEqualFaces();
565 EqualVolumes CreateEqualVolumes();
567 RangeOfIds CreateRangeOfIds();
569 BadOrientedVolume CreateBadOrientedVolume();
570 BareBorderVolume CreateBareBorderVolume();
571 BareBorderFace CreateBareBorderFace();
572 OverConstrainedVolume CreateOverConstrainedVolume();
573 OverConstrainedFace CreateOverConstrainedFace();
574 LinearOrQuadratic CreateLinearOrQuadratic();
576 GroupColor CreateGroupColor();
577 ElemGeomType CreateElemGeomType();
578 CoplanarFaces CreateCoplanarFaces();
581 * Create comparators ( predicates )
583 LessThan CreateLessThan();
584 MoreThan CreateMoreThan();
585 EqualTo CreateEqualTo();
588 * Create boolean operations ( predicates )
590 LogicalNOT CreateLogicalNOT();
591 LogicalAND CreateLogicalAND();
592 LogicalOR CreateLogicalOR();
597 Filter CreateFilter();
600 * Load filter library. If libary does not exist it is created
602 FilterLibrary LoadLibrary( in string aFileName );
607 FilterLibrary CreateLibrary();
612 boolean DeleteLibrary( in string aFileName );