Salome HOME
0eef149c082a1f99f9fec9b8c7a547e6f848bb8b
[plugins/hexoticplugin.git] / src / HexoticPlugin / HexoticPlugin_Hexotic.hxx
1 // Copyright (C) 2007-2016  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   : HexoticPlugin_Hexotic.hxx
22 // Author : Lioka RAZAFINDRAZAKA (CEA)
23 // ---
24 //
25 #ifndef _HexoticPlugin_Hexotic_HXX_
26 #define _HexoticPlugin_Hexotic_HXX_
27
28 #include "HexoticPlugin_Defs.hxx"
29 #include "HexoticPlugin_Hypothesis.hxx"
30
31 #include "SMESH_Algo.hxx"
32 #include "SMESH_Mesh.hxx"
33 #include "Utils_SALOME_Exception.hxx"
34
35 #ifdef WITH_BLSURFPLUGIN
36 #include "BLSURFPlugin_Hypothesis.hxx"
37 #endif
38
39 #include <string>
40
41 #include "DriverGMF_Read.hxx"
42 #include "DriverGMF_Write.hxx"
43
44 #include <SALOMEconfig.h>
45 #include CORBA_CLIENT_HEADER(GEOM_Gen)
46 #include <SMESH_Gen_i.hxx>
47
48 class HexoticPlugin_Hypothesis;
49 class TCollection_AsciiString;
50 class gp_Pnt;
51 class MG_Hexotic_API;
52
53 class HEXOTICPLUGIN_EXPORT HexoticPlugin_Hexotic: public SMESH_3D_Algo
54 {
55 public:
56   HexoticPlugin_Hexotic(int hypId, SMESH_Gen* gen);
57   virtual ~HexoticPlugin_Hexotic();
58
59 #ifdef WITH_BLSURFPLUGIN
60   bool CheckBLSURFHypothesis(SMESH_Mesh&         aMesh,
61                              const TopoDS_Shape& aShape);
62 #endif
63
64   virtual bool CheckHypothesis(SMESH_Mesh&                          aMesh,
65                                const TopoDS_Shape&                  aShape,
66                                SMESH_Hypothesis::Hypothesis_Status& aStatus);
67
68   void SetParameters(const HexoticPlugin_Hypothesis* hyp);
69
70   virtual bool Compute(SMESH_Mesh& aMesh,  const TopoDS_Shape& aShape);
71
72   virtual bool Compute(SMESH_Mesh & aMesh, SMESH_MesherHelper* aHelper);
73
74   virtual void CancelCompute();
75   bool computeCanceled() { return _computeCanceled; }
76
77   virtual bool Evaluate(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape,
78                         MapShapeNbElems& aResMap);
79
80 protected:
81   const HexoticPlugin_Hypothesis* _hypothesis;
82
83 private:
84
85   std::string getHexoticCommand(const TCollection_AsciiString& Hexotic_In,
86                                 const TCollection_AsciiString& Hexotic_Out,
87                                 const TCollection_AsciiString& Hexotic_Sol,
88                                 const bool                     forExecutable) const;
89   
90   GEOM::GEOM_Object_var entryToGeomObj(std::string entry);
91   TopoDS_Shape     entryToShape(std::string entry);
92
93   std::vector<std::string> writeSizeMapFile(MG_Hexotic_API* mgOutput,
94                                             std::string     fileName);
95   
96   int              _iShape;
97   int              _nbShape;
98   int              _hexesMinLevel;
99   int              _hexesMaxLevel;
100   double           _hexesMinSize;
101   double           _hexesMaxSize;
102   bool             _hexoticIgnoreRidges;
103   bool             _hexoticInvalidElements;
104   bool             _hexoticFilesKept;
105   int              _hexoticSharpAngleThreshold;
106   int              _hexoticNbProc;
107   std::string      _hexoticWorkingDirectory;
108   int              _hexoticVerbosity;
109   int              _hexoticMaxMemory;
110   int              _hexoticSdMode;
111   std::string      _textOptions;
112   HexoticPlugin_Hypothesis::THexoticSizeMaps _sizeMaps;
113   int              _nbLayers;
114   double           _firstLayerSize;
115   bool             _direction;
116   double           _growth;
117   std::vector<int> _facesWithLayers;
118   std::vector<int> _imprintedFaces;
119   SMDS_MeshNode**  _tabNode;
120   
121 #ifdef WITH_BLSURFPLUGIN
122   const BLSURFPlugin_Hypothesis* _blsurfHypo;
123 #endif
124
125
126   SALOMEDS::Study_var myStudy;
127   SMESH_Gen_i*        smeshGen_i;
128
129 };
130
131 #endif