Salome HOME
Copyright update 2022
[plugins/hybridplugin.git] / src / HYBRIDPlugin / HYBRIDPlugin_HYBRID.hxx
1 // Copyright (C) 2007-2022  CEA/DEN, EDF R&D
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 // ---
21 // File   : HYBRIDPlugin_HYBRID.hxx
22 // Author : Christian VAN WAMBEKE (CEA) (from GHS3D plugin V730)
23 // ---
24 //
25 #ifndef _HYBRIDPlugin_HYBRID_HXX_
26 #define _HYBRIDPlugin_HYBRID_HXX_
27
28 #include "SMESH_Algo.hxx"
29 #include "SMESH_Gen.hxx"
30 #include "SMESH_Gen_i.hxx"
31
32 #include <map>
33 #include <vector>
34
35 class HYBRIDPlugin_Hypothesis;
36 class SMDS_MeshNode;
37 class SMESH_Mesh;
38 class StdMeshers_ViscousLayers;
39 class TCollection_AsciiString;
40 class _Ghs2smdsConvertor;
41 class TopoDS_Shape;
42
43 class HYBRIDPlugin_HYBRID: public SMESH_3D_Algo
44 {
45 public:
46   HYBRIDPlugin_HYBRID(int hypId, SMESH_Gen* gen);
47   virtual ~HYBRIDPlugin_HYBRID();
48
49   virtual bool CheckHypothesis(SMESH_Mesh&         aMesh,
50                                const TopoDS_Shape& aShape,
51                                Hypothesis_Status&  aStatus);
52
53   virtual bool Compute(SMESH_Mesh&         aMesh,
54                        const TopoDS_Shape& aShape);
55
56   virtual void CancelCompute();
57   bool         computeCanceled() { return _computeCanceled; }
58
59   virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
60                         MapShapeNbElems& aResMap);
61
62   virtual bool Compute(SMESH_Mesh&         theMesh,
63                        SMESH_MesherHelper* aHelper);
64
65   virtual void SubmeshRestored(SMESH_subMesh* subMesh);
66
67   virtual void SetEventListener(SMESH_subMesh* subMesh);
68
69   bool         importGMFMesh(const char* aGMFFileName, SMESH_Mesh& aMesh);
70
71   static const char* Name() { return "HYBRID_3D"; }
72
73   const HYBRIDPlugin_Hypothesis* getHyp() {return _hyp ;}
74
75 protected:
76   const HYBRIDPlugin_Hypothesis*   _hyp;
77   //const StdMeshers_ViscousLayers* _viscousLayersHyp;
78   std::string                     _genericName;
79    
80 private:
81
82   bool         storeErrorDescription(const char*                logFile,
83                                      const std::string&         log,
84                                      const _Ghs2smdsConvertor & toSmdsConvertor );
85   TopoDS_Shape entryToShape(std::string entry);
86   
87   int  _iShape;
88   int  _nbShape;
89   bool _keepFiles;
90   bool _removeLogOnSuccess;
91   bool _logInStandardOutput;
92 };
93
94 /*!
95  * \brief Convertor of HYBRID elements to SMDS ones
96  */
97 class _Ghs2smdsConvertor
98 {
99   const std::map <int,const SMDS_MeshNode*> * _ghs2NodeMap;
100   const std::vector <const SMDS_MeshNode*> *  _nodeByGhsId;
101
102 public:
103   _Ghs2smdsConvertor( const std::map <int,const SMDS_MeshNode*> & ghs2NodeMap);
104
105   _Ghs2smdsConvertor( const std::vector <const SMDS_MeshNode*> &  nodeByGhsId);
106
107   const SMDS_MeshElement* getElement(const std::vector<int>& ghsNodes) const;
108 };
109
110 #endif