Salome HOME
Copyrights update 2015.
[modules/geom.git] / src / AdvancedEngine / AdvancedEngine_IOperations.hxx
1 // Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 //  File   : AdvancedEngine_IOperations.hxx
20 //  Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
21
22 #ifndef _AdvancedEngine_IOperations_HXX_
23 #define _AdvancedEngine_IOperations_HXX_
24
25 #include "AdvancedEngine.hxx"
26
27 #include "GEOM_IOperations.hxx"
28 #include "GEOM_Engine.hxx"
29 #include "GEOM_Object.hxx"
30
31 #include <list>
32 #include <gp_Ax2.hxx>
33
34 class GEOMImpl_IBasicOperations;
35 class GEOMImpl_IBooleanOperations;
36 class GEOMImpl_IShapesOperations;
37 class GEOMImpl_ITransformOperations;
38 class GEOMImpl_IBlocksOperations;
39 class GEOMImpl_I3DPrimOperations;
40 class GEOMImpl_ILocalOperations;
41 class GEOMImpl_IHealingOperations;
42 class GEOMImpl_IGroupOperations;
43 class Handle_Geom_Surface;
44 class TopTools_ListOfShape;
45
46 class ADVANCEDENGINE_EXPORT AdvancedEngine_IOperations: public GEOM_IOperations
47 {
48 private:
49   bool MakePipeTShapePartition(Handle(GEOM_Object) theShape,
50                                double theR1, double theW1, double theL1,
51                                double theR2, double theW2, double theL2,
52                                double theH = 0, double theW = 0,
53                                double theRF = 0, bool isNormal = true);
54
55   bool MakePipeTShapeMirrorAndGlue(Handle(GEOM_Object) theShape,
56                                    double theR1, double theW1, double theL1,
57                                    double theR2, double theW2, double theL2);
58
59   bool MakePipeTShapeThicknessReduction (Handle(GEOM_Object) theShape,
60                                          double theR1, double theW1, double theL1,
61                                          double theR2, double theW2, double theL2,
62                                          double theRL, double theWL, double theLtransL, double theLthinL,
63                                          double theRR, double theWR, double theLtransR, double theLthinR,
64                                          double theRI, double theWI, double theLtransI, double theLthinI);
65
66   bool MakeGroups(Handle(GEOM_Object) theShape, int shapType,
67                   double theR1, double theW1, double theL1,
68                   double theR2, double theW2, double theL2,
69                   double theH, double theW, double theRF,
70                   Handle(TColStd_HSequenceOfTransient) theSeq,
71                   gp_Trsf aTrsf);
72
73   bool GetFacesOnSurf(const TopoDS_Shape &theShape,
74                       const Handle_Geom_Surface& theSurface,
75                       const Standard_Real theTolerance,
76                       TopTools_ListOfShape &theFaces);
77
78   TopoDS_Shape MakeConicalFace(const gp_Ax2 &theAxis,
79                                const double theRadius,
80                                const double theRadiusThin,
81                                const double theHeight,
82                                const gp_Trsf &theTrsf);
83
84   bool MakeInternalGroup(const Handle(GEOM_Object) &theShape,
85                          const double theR1, const double theLen1,
86                          const double theR2, const double theLen2,
87                          const double theRL, const double theTransLenL,
88                          const double theRR, const double theTransLenR,
89                          const double theRI, const double theTransLenI,
90                          const Handle(TColStd_HSequenceOfTransient) &theSeq,
91                          const gp_Trsf &theTrsf);
92
93   gp_Trsf GetPositionTrsf(double theL1, double theL2,
94                           Handle(GEOM_Object) P1 = 0,
95                           Handle(GEOM_Object) P2 = 0,
96                           Handle(GEOM_Object) P3 = 0);
97
98   bool CheckCompatiblePosition(double& theL1, double& theL2, 
99                                Handle(GEOM_Object) theP1, 
100                                Handle(GEOM_Object) theP2,
101                                Handle(GEOM_Object) theP3,
102                                double theTolerance);
103
104 private:
105   GEOMImpl_IBasicOperations*     myBasicOperations;
106   GEOMImpl_IBooleanOperations*   myBooleanOperations;
107   GEOMImpl_IShapesOperations*    myShapesOperations;
108   GEOMImpl_ITransformOperations* myTransformOperations;
109   GEOMImpl_IBlocksOperations*    myBlocksOperations;
110   GEOMImpl_I3DPrimOperations*    my3DPrimOperations;
111   GEOMImpl_ILocalOperations*     myLocalOperations;
112   GEOMImpl_IHealingOperations*   myHealingOperations;
113   GEOMImpl_IGroupOperations*     myGroupOperations;
114
115 public:
116
117   /*!
118    * \brief Add three thickness reductions at the open ends of the pipe T-Shape
119    *
120    * \param theShape - the pipe T-Shape
121    * \param r1 - the internal radius of main pipe
122    * \param w1 - the thickness of main pipe
123    * \param l1 - the half-length of main pipe
124    * \param r2 - the internal radius of incident pipe
125    * \param w2 - the thickness of incident pipe
126    * \param l2 - the half-length of main pipe
127    * \param r*, w*, ltrans* and lthin* - internal radius, thickness, length of transition part
128    *                                     and length of thin part of left(L), right(R) and
129    *                                     incident(I) thickness reduction correspondingly
130    * \param fuseReductions - boolean flag (use true to generate single solid,
131    *                         false to obtain parts, useful for hexameshing)
132    * \retval TopoDS_Shape - Resulting shape
133    */
134   static TopoDS_Shape MakePipeTShapeThicknessReduction
135                                      (TopoDS_Shape theShape,
136                                       double r1, double w1, double l1,
137                                       double r2, double w2, double l2,
138                                       double rL, double wL, double ltransL, double lthinL,
139                                       double rR, double wR, double ltransR, double lthinR,
140                                       double rI, double wI, double ltransI, double lthinI,
141                                       bool fuseReductions);
142
143   /*!
144    * \brief Create one thickness reduction element
145    *
146    * This method is called three times from MakePipeTShapeThicknessReduction
147    * to create three thickness reductions (one per each open end of a pipe T-Shape)
148    *
149    * \param theAxes - the position
150    * \param R - the internal radius of main pipe
151    * \param W - the thickness of main pipe
152    * \param Rthin - the internal radius of thin part
153    * \param Wthin - the thickness of thin part
154    * \param Ltrans - the length of transition part
155    * \param Lthin - the length of thin part
156    * \param fuse - boolean flag (use true to generate single solid,
157    *               false to obtain parts, useful for hexameshing)
158    * \retval TopoDS_Shape - Resulting shape
159    */
160   static TopoDS_Shape MakeThicknessReduction (gp_Ax2 theAxes,
161                                               const double R, const double W,
162                                               const double Rthin, const double Wthin,
163                                               const double Ltrans, const double Lthin,
164                                               bool fuse);
165   
166 public:
167   AdvancedEngine_IOperations(GEOM_Engine* theEngine, int theDocID);
168   ~AdvancedEngine_IOperations();
169
170   Handle(TColStd_HSequenceOfTransient) 
171                   MakePipeTShape(double theR1, double theW1, double theL1,
172                                  double theR2, double theW2, double theL2,
173                                  double theRL, double theWL, double theLtransL, double theLthinL,
174                                  double theRR, double theWR, double theLtransR, double theLthinR,
175                                  double theRI, double theWI, double theLtransI, double theLthinI,
176                                  bool theHexMesh = true);
177
178   Handle(TColStd_HSequenceOfTransient)
179                   MakePipeTShapeWithPosition(double theR1, double theW1, double theL1,
180                                              double theR2, double theW2, double theL2,
181                                              double theRL, double theWL, double theLtransL, double theLthinL,
182                                              double theRR, double theWR, double theLtransR, double theLthinR,
183                                              double theRI, double theWI, double theLtransI, double theLthinI,
184                                              bool theHexMesh = true,
185                                              Handle(GEOM_Object) P1 = 0,
186                                              Handle(GEOM_Object) P2 = 0,
187                                              Handle(GEOM_Object) P3 = 0);
188
189   Handle(TColStd_HSequenceOfTransient)
190                   MakePipeTShapeChamfer(double theR1, double theW1, double theL1,
191                                         double theR2, double theW2, double theL2,
192                                         double theRL, double theWL, double theLtransL, double theLthinL,
193                                         double theRR, double theWR, double theLtransR, double theLthinR,
194                                         double theRI, double theWI, double theLtransI, double theLthinI,
195                                         double theH,  double theW, 
196                                         bool theHexMesh = true);
197
198   Handle(TColStd_HSequenceOfTransient)
199                   MakePipeTShapeChamferWithPosition(double theR1, double theW1, double theL1,
200                                                     double theR2, double theW2, double theL2,
201                                                     double theH, double theW,
202                                                     double theRL, double theWL, double theLtransL, double theLthinL,
203                                                     double theRR, double theWR, double theLtransR, double theLthinR,
204                                                     double theRI, double theWI, double theLtransI, double theLthinI,
205                                                     bool theHexMesh = true,
206                                                     Handle(GEOM_Object) P1 = 0,
207                                                     Handle(GEOM_Object) P2 = 0,
208                                                     Handle(GEOM_Object) P3 = 0);
209
210   Handle(TColStd_HSequenceOfTransient)
211                   MakePipeTShapeFillet(double theR1, double theW1, double theL1,
212                                        double theR2, double theW2, double theL2,
213                                        double theRL, double theWL, double theLtransL, double theLthinL,
214                                        double theRR, double theWR, double theLtransR, double theLthinR,
215                                        double theRI, double theWI, double theLtransI, double theLthinI,
216                                        double theRF, bool theHexMesh = true);
217
218   Handle(TColStd_HSequenceOfTransient)
219                   MakePipeTShapeFilletWithPosition(double theR1, double theW1, double theL1,
220                                                    double theR2, double theW2, double theL2,
221                                                    double theRL, double theWL, double theLtransL, double theLthinL,
222                                                    double theRR, double theWR, double theLtransR, double theLthinR,
223                                                    double theRI, double theWI, double theLtransI, double theLthinI,
224                                                    double theRF, bool theHexMesh = true,
225                                                    Handle(GEOM_Object) P1 = 0,
226                                                    Handle(GEOM_Object) P2 = 0,
227                                                    Handle(GEOM_Object) P3 = 0);
228                   
229   Handle(GEOM_Object) MakeDividedDisk (double theR, double theRatio, 
230                                        int theOrientation, int thePattern);
231   Handle(GEOM_Object) MakeDividedDiskPntVecR (Handle(GEOM_Object) thePnt, 
232                                               Handle(GEOM_Object) theVec, 
233                                               double theR, 
234                                               double theRatio,
235                                               int    thePattern);
236   
237   Handle(GEOM_Object) MakeDividedCylinder (double theR, 
238                                            double theH,
239                                            int thePattern);
240   
241   Handle(GEOM_Object) MakeSmoothingSurface (std::list<Handle(GEOM_Object)> thelPoints, 
242                                             int                            theNbMax,
243                                             int                            theDegMax,
244                                             double                         theDMax);
245 };
246
247 #endif