Salome HOME
Updated copyright comment
[plugins/netgenplugin.git] / src / NETGENPlugin / NETGENPlugin_NETGEN_2D_ONLY.hxx
1 // Copyright (C) 2007-2024  CEA, EDF, 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      : NETGENPlugin_NETGEN_2D_ONLY.hxx
21 // Project   : SALOME
22 // Author    : Edward AGAPOV (OCC)
23 //
24 #ifndef _NETGENPlugin_NETGEN_2D_ONLY_HXX_
25 #define _NETGENPlugin_NETGEN_2D_ONLY_HXX_
26
27 #include <SMESH_Algo.hxx>
28 #include <SMESH_Mesh.hxx>
29 #include <SMESH_Group.hxx>
30 #include <SMESHDS_GroupBase.hxx>
31
32 #include "NETGENPlugin_Mesher.hxx"
33
34 class StdMeshers_MaxElementArea;
35 class StdMeshers_LengthFromEdges;
36 class NETGENPlugin_Hypothesis_2D;
37
38 /*!
39  * \brief Mesher generating 2D elements on a geometrical face taking
40  * into account pre-existing nodes on face boundaries
41  *
42  * Historically, NETGENPlugin_NETGEN_2D is actually 1D-2D, that is why
43  * the class is named NETGENPlugin_NETGEN_2D_ONLY. Renaming is useless as
44  * algorithm field "_name" can't be changed
45  */
46 class NETGENPlugin_NETGEN_2D_ONLY: public SMESH_2D_Algo
47 {
48 public:
49   NETGENPlugin_NETGEN_2D_ONLY(int hypId, SMESH_Gen* gen);
50   virtual ~NETGENPlugin_NETGEN_2D_ONLY();
51
52   virtual bool CheckHypothesis(SMESH_Mesh&         aMesh,
53                                const TopoDS_Shape& aShape,
54                                Hypothesis_Status&  aStatus);
55
56   virtual bool Compute(SMESH_Mesh&         aMesh,
57                        const TopoDS_Shape& aShape);  
58
59   virtual void CancelCompute();
60
61   virtual double GetProgress() const;
62
63   virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
64                         MapShapeNbElems& aResMap);
65
66   bool MapSegmentsToEdges(SMESH_Mesh&         aMesh,
67                           const TopoDS_Shape& aShape, 
68                           NETGENPlugin_NetgenLibWrapper &ngLib, 
69                           vector< const SMDS_MeshNode* >& nodeVec, 
70                           std::map<int,const SMDS_MeshNode*>& premeshedNodes, 
71                           std::map<int,std::vector<double>>& newNetgenCoordinates,
72                           std::map<int,std::vector<smIdType>>& newNetgenElements );  
73
74   std::tuple<bool,bool> SetParameteres( SMESH_Mesh& aMesh, const TopoDS_Shape& aShape, 
75                                         NETGENPlugin_Mesher& aMesher,  netgen::Mesh * ngMeshes,
76                                         netgen::OCCGeometry& occgeoComm, bool isSubMeshSupported = true );     
77
78   bool ComputeMaxhOfFace( TopoDS_Face& Face, NETGENPlugin_Mesher& aMesher, TSideVector& wires, 
79                           netgen::OCCGeometry& occgeoComm, bool isDefaultHyp, bool isCommonLocalSize );
80   
81   void FillNodesAndElements( SMESH_Mesh& aMesh, SMESH_MesherHelper& helper, netgen::Mesh * ngMesh, vector< const SMDS_MeshNode* >& nodeVec, int faceId );
82
83  /*!
84  * \brief FillNodesAndElements, fill created triangular elements by netgen to the smesh data structure
85  */
86   void FillNodesAndElements( SMESH_Mesh& aMesh, SMESH_MesherHelper& helper, netgen::Mesh * ngMesh, vector< const SMDS_MeshNode* >& nodeVec, map<int, const SMDS_MeshNode* >& ng2smesh,
87                               std::map<int,std::vector<double>>& newNetgenCoordinates, std::map<int,std::vector<smIdType>>& newNetgenElements, const int numberOfPremeshedNodes );
88
89 protected:
90   const StdMeshers_MaxElementArea*       _hypMaxElementArea;
91   const StdMeshers_LengthFromEdges*      _hypLengthFromEdges;
92   const SMESHDS_Hypothesis*              _hypQuadranglePreference;
93   const NETGENPlugin_Hypothesis_2D*      _hypParameters;
94
95   double                                 _progressByTic;
96 };
97
98 #endif