0025039: Improvement of code structure of general and supporting tools implemented...
[occt.git] / src / BRepMesh / BRepMesh_FastDiscret.cdl
1 -- Created on: 1996-02-27
2 -- Created by: Laurent PAINNOT
3 -- Copyright (c) 1996-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
5 --
6 -- This file is part of Open CASCADE Technology software library.
7 --
8 -- This library is free software; you can redistribute it and/or modify it under
9 -- the terms of the GNU Lesser General Public License version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
13 --
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
16
17 class FastDiscret from BRepMesh inherits TShared from MMgt
18
19         ---Purpose: Algorithm  to mesh  a shape  with  respect of  the
20         --          frontier the deflection  and by option the  shared
21         --          components.
22
23
24 uses    Boolean                   from Standard,
25         Integer                   from Standard,
26         Box                       from Bnd,
27         Real                      from Standard,
28         Shape                     from TopoDS,
29         Face                      from TopoDS,
30         Edge                      from TopoDS,
31         FaceAttribute             from BRepMesh,
32         Vertex                    from TopoDS,
33         Triangle                  from BRepMesh,
34         Vertex                    from BRepMesh,
35         Edge                      from BRepMesh,
36         ListOfInteger             from TColStd,
37         MapOfInteger              from TColStd,
38         SequenceOfInteger         from TColStd,
39         ListOfReal                from TColStd,
40         IndexedMapOfInteger       from TColStd,
41         SequenceOfPnt2d           from TColgp,
42         Dir                       from gp,
43         Pnt                       from gp,
44         XY                        from gp,
45         Pnt2d                     from gp,
46         DataMapOfIntegerPnt       from BRepMesh,
47         DataMapOfIntegerListOfXY  from BRepMesh,
48         DataMapOfShapePairOfPolygon from  BRepMesh,
49         Delaun                    from BRepMesh,
50         DataMapOfVertexInteger    from BRepMesh,
51         DataStructureOfDelaun     from BRepMesh,
52         ListOfVertex              from BRepMesh,
53         MapOfShape                from TopTools,
54         HSurface                  from BRepAdaptor,
55         ClassifierPtr             from BRepMesh,
56         IndexedMapOfReal          from TColStd,
57         Status                    from BRepMesh,
58         DataMapOfShapeReal        from TopTools,
59         ListOfShape               from TopTools,
60         Curve                     from Geom2d,
61         MapOfInteger              from BRepMesh,
62         BaseAllocator             from BRepMesh,
63         DataMapOfFaceAttribute    from BRepMesh,
64         IndexedDataMapOfShapeListOfShape from TopTools,
65         MutexForShapeProvider     from TopTools,
66         ShapeEnum                 from TopAbs
67
68 is
69
70         Create (defle       : Real    from Standard;
71                 angle       : Real    from Standard;
72                 B           : Box     from Bnd;
73                 withShare   : Boolean from Standard=Standard_True;
74                 inshape     : Boolean from Standard=Standard_False;
75                 relative    : Boolean from Standard=Standard_False;
76                 shapetrigu  : Boolean from Standard=Standard_False;
77                 isInParallel: Boolean from Standard=Standard_False)
78           returns FastDiscret from BRepMesh;
79
80
81         Create (defle       : Real    from Standard;
82                 shape       : Shape   from TopoDS;
83                 B           : Box     from Bnd;
84                 angle       : Real    from Standard;
85                 withShare   : Boolean from Standard=Standard_True;
86                 inshape     : Boolean from Standard=Standard_False;
87                 relative    : Boolean from Standard=Standard_False;
88                 shapetrigu  : Boolean from Standard=Standard_False;
89                 isInParallel: Boolean from Standard=Standard_False)
90            ---Purpose: if the  boolean    <relative>   is  True,    the
91            --          deflection used   for the polygonalisation   of
92            --          each edge will be <defle> * Size of Edge.
93            --          the deflection used for the faces will be the maximum
94            --          deflection of their edges.
95            --          
96            --          if <shapetrigu> is True, the triangulation, if exists
97            --          with a correct deflection, can be used to re-triangulate 
98            --          the shape.
99            --          
100            --          if   <inshape>   is   True, the      calculated
101            --          triangulation will be stored in the shape.
102             returns FastDiscret from BRepMesh;
103
104
105         Perform (me: mutable; shape: Shape from TopoDS) is static;
106         ---Purpose: Build triangulation on the whole shape
107
108         Add (me: mutable; face: Face from TopoDS;
109                           ancestor : IndexedDataMapOfShapeListOfShape from TopTools) is static;
110         ---Purpose: Record a face for further processing.
111
112         Process (me; face: Face from TopoDS) is static;
113         ---Purpose: Triangulate a face previously recorded for
114             --          processing by call to Add(). Can be executed in
115             --          parallel threads.
116         ---C++: alias operator ()
117
118         CurrentFaceStatus(me)
119         returns Status from BRepMesh;
120
121         Add (me     : mutable;
122              edge   : Edge     from TopoDS;
123              face   : Face     from TopoDS;
124              S      : HSurface from BRepAdaptor;
125              C      : Curve    from Geom2d;
126              ancestor : IndexedDataMapOfShapeListOfShape from TopTools;
127              defedge: Real     from Standard;
128              first  : Real     from Standard;
129              last   : Real     from Standard)
130         is static private;
131
132         Add (me     : mutable;
133              theVert: Vertex   from TopoDS;
134              face   : Face     from TopoDS;
135              S      : HSurface from BRepAdaptor) is private;
136
137         Update (me: mutable; 
138                 Edge   : Edge     from TopoDS; 
139                 Face   : Face     from TopoDS; 
140                 C      : Curve    from Geom2d;
141                 defedge: Real     from Standard;
142                 first  : Real     from Standard;
143                 last   : Real     from Standard)     
144         returns Boolean is private;
145
146         RelativeEdgeDeflection(myclass;
147                                edge    : Edge    from TopoDS;
148                                defle   : Real    from Standard;
149                                dtotale : Real    from Standard;
150                                cdef    : out Real    from Standard)
151         ---Purpose: Returns computed relative deflection for edge
152           returns Real from Standard;
153
154         BoxMaxDimension(myclass;
155                         box    : in Box from Bnd;
156                         maxdim : out Real from Standard);
157         ---Purpose: Returns the maximal dimension of Bnd_Box
158
159         InternalVertices
160                (me         : mutable;
161                caro       : HSurface            from BRepAdaptor;
162                inter      : in out ListOfVertex from BRepMesh;
163                defedge    : Real                from Standard;
164                classifier : ClassifierPtr       from BRepMesh)
165         is static private;
166
167
168         Control (me      : mutable;
169                  caro    : HSurface                from BRepAdaptor;
170                  defface : Real                    from Standard;
171                  inter   : in out ListOfVertex     from BRepMesh;
172                  badTri  : in out ListOfInteger    from TColStd;
173                  nulTri  : in out ListOfInteger    from TColStd;
174                  trigu   : in out Delaun           from BRepMesh;
175                  isfirst : Boolean                 from Standard)
176           returns Real from Standard is static private;
177
178         AddInShape(me: mutable;
179                    face   : Face from TopoDS;
180                    defedge: Real from Standard)
181         is static private;
182
183         SetParallel (           me : mutable;
184                      theInParallel : Boolean from Standard);
185         ---Purpose:
186         -- Request algorithm to launch in multiple threads
187         -- to improve performance (should be supported by plugin).
188
189         IsParallel (me)
190             returns Boolean from Standard;
191         ---Purpose:
192         -- Returns the multi-threading usage flag.
193         
194         CreateMutexesForSubShapes(me               : mutable;
195                                   theShape : Shape      from TopoDS;
196                                   theType  : ShapeEnum  from TopAbs);
197          ---Purpose:
198          -- Creates mutexes for each sub-shape of type theType in theShape.
199          -- Used to avoid data races.
200                             
201         RemoveAllMutexes(me: mutable);
202         ---Purpose:
203         -- Removes all created mutexes
204
205 -- Output :
206
207
208         NbTriangles(me)
209             ---Purpose: Gives the number of built triangles.
210             returns Integer from Standard
211             is static;
212
213         Triangle   (me;
214                     Index : Integer from Standard)
215             ---Purpose: Gives the triangle of <Index>.
216             ---C++: return const &
217             returns Triangle from BRepMesh
218             is static;
219
220
221         NbEdges    (me)
222             ---Purpose: Gives the number of built Edges
223             returns Integer from Standard
224             is static;
225
226         Edge       (me;
227                     Index : Integer from Standard)
228             ---Purpose: Gives the edge of index <Index>.
229             ---C++: return const &
230               returns Edge from BRepMesh
231             is static;
232
233         NbVertices (me)
234             ---Purpose: Gives the number of built Vertices.
235             returns Integer from Standard
236             is static;
237
238         Vertex     (me;
239                     Index : Integer from Standard)
240             ---Purpose: Gives the vertex of <Index>.
241             ---C++: return const &
242             returns Vertex from BRepMesh
243             is static;
244
245         Pnt        (me;
246                     Index : Integer from Standard)
247             ---Purpose: Gives the location3d of the vertex of <Index>.
248             ---C++: return const &
249             returns Pnt from gp
250             is static;
251
252         VerticesOfDomain
253                  (me; Indices : in out MapOfInteger from BRepMesh)
254             ---Purpose: Gives the list of indices of the vertices
255             is static;
256
257
258         EdgesOfDomain
259                  (me; Indices : in out MapOfInteger from BRepMesh)
260             ---Purpose: Gives the list of indices of the edges
261             ---C++: inline
262             is static;
263
264
265         TrianglesOfDomain(me; Indices: in out MapOfInteger from BRepMesh)
266             ---Purpose: Gives the list of indices of the triangles
267             ---C++: inline
268             is static;
269
270
271         NbPoint3d (me)
272             ---Purpose: Gives the  number of different  location in 3d
273             --          space.  It  is  different    of the number  of
274             --          vertices if there is more than one surface.
275             --          Even for one surface, the number can be different
276             --          if an edge is shared.
277             ---C++: inline
278             returns Integer from Standard
279             is static;
280
281         Point3d    (me;
282                     Index : Integer from Standard)
283             ---Purpose: Gives the 3d space location of the vertex <Index>.
284             ---C++: return const &
285             ---C++: inline
286             returns Pnt from gp
287             is static;
288
289
290         GetDeflection(me)
291             ---Purpose: returns the deflection value.
292             ---C++: inline
293             returns Real from Standard;
294
295         GetAngle(me)  
296             ---Purpose: returns the deflection value.
297             ---C++: inline
298             returns Real from Standard;
299
300         WithShare(me)
301             ---C++: inline
302             returns Boolean from Standard;
303     
304         InShape(me)
305             ---C++: inline
306             returns Boolean from Standard;
307     
308         ShapeTrigu(me)
309             ---C++: inline
310             returns Boolean from Standard;
311     
312         GetFaceAttribute(me;
313                          face    : Face from TopoDS;
314                          fattrib : in out FaceAttribute from BRepMesh)
315             ---Purpose: returns the face deflection value.
316             returns Boolean from Standard;
317     
318         RemoveFaceAttribute(me   : mutable;
319                             face : Face     from TopoDS);
320             ---Purpose: remove face attribute as useless to free locate memory
321     
322         GetMapOfDefEdge(me)
323             ---C++: return const &
324             ---C++: inline
325             returns DataMapOfShapeReal from TopTools;
326     
327 fields  
328       myAngle        : Real                          from Standard;
329       myDeflection   : Real                          from Standard;
330       myDtotale      : Real                          from Standard;
331       myWithShare    : Boolean                       from Standard;
332       myInParallel   : Boolean                       from Standard;
333       myVertices     : DataMapOfVertexInteger        from BRepMesh;
334       myEdges        : DataMapOfShapePairOfPolygon   from BRepMesh;
335       myInternaledges: DataMapOfShapePairOfPolygon   from BRepMesh;
336       myNbLocat      : Integer                       from Standard;
337       myLocation3d   : DataMapOfIntegerPnt           from BRepMesh;
338       myStructure    : DataStructureOfDelaun         from BRepMesh;
339       myMapattrib    : DataMapOfFaceAttribute        from BRepMesh;
340       myVemap        : IndexedMapOfInteger           from TColStd;
341       myLocation2d   : DataMapOfIntegerListOfXY      from BRepMesh;
342       myRelative     : Boolean                       from Standard;
343       myShapetrigu   : Boolean                       from Standard;
344       myInshape      : Boolean                       from Standard; 
345       myFacestate    : Status                        from BRepMesh;
346       myMapdefle     : DataMapOfShapeReal            from TopTools;
347       myNottriangulated : ListOfShape                from TopTools;
348       myAllocator    : BaseAllocator                 from BRepMesh;
349       myMutexProvider: MutexForShapeProvider         from TopTools;
350
351 end FastDiscret;