Salome HOME
b2bcc2478dc64926c7e77ad69746a55124a438dd
[modules/geom.git] / src / AdvancedEngine / AdvancedEngine_IOperations.hxx
1 // Copyright (C) 2007-2023  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 <TopTools_ListOfShape.hxx>
32 #include <Geom_Surface.hxx>
33
34 #include <list>
35 #include <gp_Ax2.hxx>
36
37 class GEOMImpl_IBasicOperations;
38 class GEOMImpl_IBooleanOperations;
39 class GEOMImpl_IShapesOperations;
40 class GEOMImpl_ITransformOperations;
41 class GEOMImpl_IBlocksOperations;
42 class GEOMImpl_I3DPrimOperations;
43 class GEOMImpl_ILocalOperations;
44 class GEOMImpl_IHealingOperations;
45 class GEOMImpl_IGroupOperations;
46
47 class ADVANCEDENGINE_EXPORT AdvancedEngine_IOperations: public GEOM_IOperations
48 {
49 private:
50   bool MakePipeTShapePartition(Handle(GEOM_Object) theShape,
51                                double theR1, double theW1, double theL1,
52                                double theR2, double theW2, double theL2,
53                                double theH = 0, double theW = 0,
54                                double theRF = 0, bool isNormal = true);
55
56   bool MakePipeTShapeMirrorAndGlue(Handle(GEOM_Object) theShape,
57                                    double theR1, double theW1, double theL1,
58                                    double theR2, double theW2, double theL2);
59
60   bool MakePipeTShapeThicknessReduction (Handle(GEOM_Object) theShape,
61                                          double theR1, double theW1, double theL1,
62                                          double theR2, double theW2, double theL2,
63                                          double theRL, double theWL, double theLtransL, double theLthinL,
64                                          double theRR, double theWR, double theLtransR, double theLthinR,
65                                          double theRI, double theWI, double theLtransI, double theLthinI);
66
67   bool MakeGroups(Handle(GEOM_Object) theShape, int shapType,
68                   double theR1, double theW1, double theL1,
69                   double theR2, double theW2, double theL2,
70                   double theH, double theW, double theRF,
71                   Handle(TColStd_HSequenceOfTransient) theSeq,
72                   gp_Trsf aTrsf);
73
74   bool GetFacesOnSurf(const TopoDS_Shape &theShape,
75                       const Handle(Geom_Surface)& theSurface,
76                       const Standard_Real theTolerance,
77                       TopTools_ListOfShape &theFaces);
78
79   TopoDS_Shape MakeConicalFace(const gp_Ax2 &theAxis,
80                                const double theRadius,
81                                const double theRadiusThin,
82                                const double theHeight,
83                                const gp_Trsf &theTrsf);
84
85   bool MakeInternalGroup(const Handle(GEOM_Object) &theShape,
86                          const double theR1, const double theLen1,
87                          const double theR2, const double theLen2,
88                          const double theRL, const double theTransLenL,
89                          const double theRR, const double theTransLenR,
90                          const double theRI, const double theTransLenI,
91                          const Handle(TColStd_HSequenceOfTransient) &theSeq,
92                          const gp_Trsf &theTrsf);
93
94   gp_Trsf GetPositionTrsf(double theL1, double theL2,
95                           Handle(GEOM_Object) P1 = 0,
96                           Handle(GEOM_Object) P2 = 0,
97                           Handle(GEOM_Object) P3 = 0);
98
99   bool CheckCompatiblePosition(double& theL1, double& theL2, 
100                                Handle(GEOM_Object) theP1, 
101                                Handle(GEOM_Object) theP2,
102                                Handle(GEOM_Object) theP3,
103                                double theTolerance);
104
105 private:
106   GEOMImpl_IBasicOperations*     myBasicOperations;
107   GEOMImpl_IBooleanOperations*   myBooleanOperations;
108   GEOMImpl_IShapesOperations*    myShapesOperations;
109   GEOMImpl_ITransformOperations* myTransformOperations;
110   GEOMImpl_IBlocksOperations*    myBlocksOperations;
111   GEOMImpl_I3DPrimOperations*    my3DPrimOperations;
112   GEOMImpl_ILocalOperations*     myLocalOperations;
113   GEOMImpl_IHealingOperations*   myHealingOperations;
114   GEOMImpl_IGroupOperations*     myGroupOperations;
115
116 public:
117
118   /*!
119    * \brief Add three thickness reductions at the open ends of the pipe T-Shape
120    *
121    * \param theShape - the pipe T-Shape
122    * \param r1 - the internal radius of main pipe
123    * \param w1 - the thickness of main pipe
124    * \param l1 - the half-length of main pipe
125    * \param r2 - the internal radius of incident pipe
126    * \param w2 - the thickness of incident pipe
127    * \param l2 - the half-length of main pipe
128    * \param r*, w*, ltrans* and lthin* - internal radius, thickness, length of transition part
129    *                                     and length of thin part of left(L), right(R) and
130    *                                     incident(I) thickness reduction correspondingly
131    * \param fuseReductions - boolean flag (use true to generate single solid,
132    *                         false to obtain parts, useful for hexameshing)
133    * \retval TopoDS_Shape - Resulting shape
134    */
135   static TopoDS_Shape MakePipeTShapeThicknessReduction
136                                      (TopoDS_Shape theShape,
137                                       double r1, double w1, double l1,
138                                       double r2, double w2, double l2,
139                                       double rL, double wL, double ltransL, double lthinL,
140                                       double rR, double wR, double ltransR, double lthinR,
141                                       double rI, double wI, double ltransI, double lthinI,
142                                       bool fuseReductions);
143
144   /*!
145    * \brief Create one thickness reduction element
146    *
147    * This method is called three times from MakePipeTShapeThicknessReduction
148    * to create three thickness reductions (one per each open end of a pipe T-Shape)
149    *
150    * \param theAxes - the position
151    * \param R - the internal radius of main pipe
152    * \param W - the thickness of main pipe
153    * \param Rthin - the internal radius of thin part
154    * \param Wthin - the thickness of thin part
155    * \param Ltrans - the length of transition part
156    * \param Lthin - the length of thin part
157    * \param fuse - boolean flag (use true to generate single solid,
158    *               false to obtain parts, useful for hexameshing)
159    * \retval TopoDS_Shape - Resulting shape
160    */
161   static TopoDS_Shape MakeThicknessReduction (gp_Ax2 theAxes,
162                                               const double R, const double W,
163                                               const double Rthin, const double Wthin,
164                                               const double Ltrans, const double Lthin,
165                                               bool fuse);
166   
167 public:
168   AdvancedEngine_IOperations(GEOM_Engine* theEngine);
169   ~AdvancedEngine_IOperations();
170
171   Handle(TColStd_HSequenceOfTransient) 
172                   MakePipeTShape(double theR1, double theW1, double theL1,
173                                  double theR2, double theW2, double theL2,
174                                  double theRL, double theWL, double theLtransL, double theLthinL,
175                                  double theRR, double theWR, double theLtransR, double theLthinR,
176                                  double theRI, double theWI, double theLtransI, double theLthinI,
177                                  bool theHexMesh = true);
178
179   Handle(TColStd_HSequenceOfTransient)
180                   MakePipeTShapeWithPosition(double theR1, double theW1, double theL1,
181                                              double theR2, double theW2, double theL2,
182                                              double theRL, double theWL, double theLtransL, double theLthinL,
183                                              double theRR, double theWR, double theLtransR, double theLthinR,
184                                              double theRI, double theWI, double theLtransI, double theLthinI,
185                                              bool theHexMesh = true,
186                                              Handle(GEOM_Object) P1 = 0,
187                                              Handle(GEOM_Object) P2 = 0,
188                                              Handle(GEOM_Object) P3 = 0);
189
190   Handle(TColStd_HSequenceOfTransient)
191                   MakePipeTShapeChamfer(double theR1, double theW1, double theL1,
192                                         double theR2, double theW2, double theL2,
193                                         double theRL, double theWL, double theLtransL, double theLthinL,
194                                         double theRR, double theWR, double theLtransR, double theLthinR,
195                                         double theRI, double theWI, double theLtransI, double theLthinI,
196                                         double theH,  double theW, 
197                                         bool theHexMesh = true);
198
199   Handle(TColStd_HSequenceOfTransient)
200                   MakePipeTShapeChamferWithPosition(double theR1, double theW1, double theL1,
201                                                     double theR2, double theW2, double theL2,
202                                                     double theH, double theW,
203                                                     double theRL, double theWL, double theLtransL, double theLthinL,
204                                                     double theRR, double theWR, double theLtransR, double theLthinR,
205                                                     double theRI, double theWI, double theLtransI, double theLthinI,
206                                                     bool theHexMesh = true,
207                                                     Handle(GEOM_Object) P1 = 0,
208                                                     Handle(GEOM_Object) P2 = 0,
209                                                     Handle(GEOM_Object) P3 = 0);
210
211   Handle(TColStd_HSequenceOfTransient)
212                   MakePipeTShapeFillet(double theR1, double theW1, double theL1,
213                                        double theR2, double theW2, double theL2,
214                                        double theRL, double theWL, double theLtransL, double theLthinL,
215                                        double theRR, double theWR, double theLtransR, double theLthinR,
216                                        double theRI, double theWI, double theLtransI, double theLthinI,
217                                        double theRF, bool theHexMesh = true);
218
219   Handle(TColStd_HSequenceOfTransient)
220                   MakePipeTShapeFilletWithPosition(double theR1, double theW1, double theL1,
221                                                    double theR2, double theW2, double theL2,
222                                                    double theRL, double theWL, double theLtransL, double theLthinL,
223                                                    double theRR, double theWR, double theLtransR, double theLthinR,
224                                                    double theRI, double theWI, double theLtransI, double theLthinI,
225                                                    double theRF, bool theHexMesh = true,
226                                                    Handle(GEOM_Object) P1 = 0,
227                                                    Handle(GEOM_Object) P2 = 0,
228                                                    Handle(GEOM_Object) P3 = 0);
229                   
230   Handle(GEOM_Object) MakeDividedDisk (double theR, double theRatio, 
231                                        int theOrientation, int thePattern);
232   Handle(GEOM_Object) MakeDividedDiskPntVecR (Handle(GEOM_Object) thePnt, 
233                                               Handle(GEOM_Object) theVec, 
234                                               double theR, 
235                                               double theRatio,
236                                               int    thePattern);
237   
238   Handle(GEOM_Object) MakeDividedCylinder (double theR, 
239                                            double theH,
240                                            int thePattern);
241   
242   Handle(GEOM_Object) MakeSmoothingSurface (std::list<Handle(GEOM_Object)> thelPoints, 
243                                             int                            theNbMax,
244                                             int                            theDegMax,
245                                             double                         theDMax);
246 };
247
248 #endif