Salome HOME
0023212: EDF 12054 - Problem with a pyramidal layer
[modules/smesh.git] / src / StdMeshers / StdMeshers_QuadToTriaAdaptor.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
20 //  File   : StdMeshers_QuadToTriaAdaptor.hxx
21 //  Module : SMESH
22 //
23 #ifndef _SMESH_QuadToTriaAdaptor_HXX_
24 #define _SMESH_QuadToTriaAdaptor_HXX_
25
26 #include "SMESH_StdMeshers.hxx"
27
28 #include "SMESH_ProxyMesh.hxx"
29
30 class SMESH_Mesh;
31 class SMESH_ElementSearcher;
32 class SMDS_MeshElement;
33 class SMDS_MeshNode;
34 class SMDS_MeshFace;
35 class TColgp_Array1OfPnt;
36 class TColgp_Array1OfVec;
37 class gp_Pnt;
38 class gp_Vec;
39
40
41 #include <set>
42 #include <list>
43 #include <vector>
44
45 #include <TopoDS_Shape.hxx>
46
47 /*!
48  * \brief "Transforms" quadrilateral faces into triangular ones by creation of pyramids
49  */
50 class STDMESHERS_EXPORT StdMeshers_QuadToTriaAdaptor : public SMESH_ProxyMesh
51 {
52 public:
53   StdMeshers_QuadToTriaAdaptor();
54
55   ~StdMeshers_QuadToTriaAdaptor();
56
57   bool Compute(SMESH_Mesh&         aMesh,
58                const TopoDS_Shape& aShape,
59                SMESH_ProxyMesh*    aProxyMesh=0);
60
61   bool Compute(SMESH_Mesh& aMesh);
62
63   const TopoDS_Shape& GetShape() const { return myShape; }
64
65 protected:
66
67   int Preparation(const SMDS_MeshElement* face,
68                   TColgp_Array1OfPnt& PN,
69                   TColgp_Array1OfVec& VN,
70                   std::vector<const SMDS_MeshNode*>& FNodes,
71                   gp_Pnt& PC, gp_Vec& VNorm,
72                   const SMDS_MeshElement** volumes=0);
73
74   void LimitHeight (gp_Pnt&                                  Papex,
75                     const gp_Pnt&                            PC,
76                     const TColgp_Array1OfPnt&                PN,
77                     const std::vector<const SMDS_MeshNode*>& FNodes,
78                     SMESH_Mesh&                              aMesh,
79                     const SMDS_MeshElement*                  NotCheckedFace,
80                     const bool                               UseApexRay);
81
82   bool Compute2ndPart(SMESH_Mesh&                                 aMesh,
83                       const std::vector<const SMDS_MeshElement*>& pyramids);
84
85
86   void MergePiramids( const SMDS_MeshElement*          PrmI,
87                       const SMDS_MeshElement*          PrmJ,
88                       std::set<const SMDS_MeshNode*> & nodesToMove);
89
90   void MergeAdjacent(const SMDS_MeshElement*         PrmI,
91                      std::set<const SMDS_MeshNode*>& nodesToMove,
92                      const bool                      isRecursion = false);
93
94
95   TopoDS_Shape                      myShape;
96   std::set<const SMDS_MeshElement*> myRemovedTrias;
97   std::list< const SMDS_MeshNode* > myDegNodes;
98   const SMESH_ElementSearcher*      myElemSearcher;
99 };
100
101 #endif