Salome HOME
Merge branch 'V7_dev'
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_Hypothesis_i.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    : BLSURFPlugin_Hypothesis.hxx
22 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
23 //           Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
24 // ---
25 //
26 #ifndef _BLSURFPlugin_Hypothesis_i_HXX_
27 #define _BLSURFPlugin_Hypothesis_i_HXX_
28
29 #include <SALOMEconfig.h>
30 #include CORBA_SERVER_HEADER(BLSURFPlugin_Algorithm)
31
32 #include "SMESH_Hypothesis_i.hxx"
33 #include "BLSURFPlugin_Hypothesis.hxx"
34
35 class SMESH_Gen;
36 class GEOM_Object;
37
38 // BLSURFPlugin parameters hypothesis
39
40 class BLSURFPlugin_Hypothesis_i: public virtual POA_BLSURFPlugin::BLSURFPlugin_Hypothesis,
41     public virtual SMESH_Hypothesis_i {
42 public:
43   // Constructor
44   BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA, int theStudyId, ::SMESH_Gen* theGenImpl);
45   // Destructor
46   virtual ~BLSURFPlugin_Hypothesis_i();
47
48   void SetPhysicalMesh(CORBA::Long theValue);
49   CORBA::Long GetPhysicalMesh();
50
51   void SetGeometricMesh(CORBA::Long theValue);
52   CORBA::Long GetGeometricMesh();
53
54   void SetPhySize(CORBA::Double theValue);
55   void SetPhySizeRel(CORBA::Double theValue);
56   CORBA::Double GetPhySize();
57   CORBA::Boolean IsPhySizeRel();
58
59   void SetMinSize(CORBA::Double theMinSize);
60   void SetMinSizeRel(CORBA::Double theMinSize);
61   CORBA::Double GetMinSize();
62   CORBA::Boolean IsMinSizeRel();
63
64   void SetMaxSize(CORBA::Double theMaxSize);
65   void SetMaxSizeRel(CORBA::Double theMaxSize);
66   CORBA::Double GetMaxSize();
67   CORBA::Boolean IsMaxSizeRel();
68
69   void SetGradation(CORBA::Double theValue);
70   CORBA::Double GetGradation();
71
72   void SetQuadAllowed(CORBA::Boolean theValue);
73   CORBA::Boolean GetQuadAllowed();
74
75   void SetAngleMesh(CORBA::Double theValue);
76   CORBA::Double GetAngleMesh();
77   
78   void SetChordalError(CORBA::Double distance);
79   CORBA::Double GetChordalError();
80   
81   void SetAnisotropic(CORBA::Boolean anisotropic);
82   CORBA::Boolean GetAnisotropic();
83   
84   void SetAnisotropicRatio(CORBA::Double ratio);
85   CORBA::Double GetAnisotropicRatio();
86   
87   void SetRemoveTinyEdges(CORBA::Boolean remove);
88   CORBA::Boolean GetRemoveTinyEdges();
89   
90   void SetTinyEdgeLength(CORBA::Double length);
91   CORBA::Double GetTinyEdgeLength();
92   
93   void SetBadElementRemoval(CORBA::Boolean remove);
94   CORBA::Boolean GetBadElementRemoval();
95   
96   void SetBadElementAspectRatio(CORBA::Double ratio);
97   CORBA::Double GetBadElementAspectRatio();
98   
99   void SetOptimizeMesh(CORBA::Boolean optimize);
100   CORBA::Boolean GetOptimizeMesh();
101   
102   void SetQuadraticMesh(CORBA::Boolean quadratic);
103   CORBA::Boolean GetQuadraticMesh();
104
105   void SetTopology(CORBA::Long theValue);
106   CORBA::Long GetTopology();
107
108   void SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception);
109   CORBA::Short GetVerbosity();
110
111   void SetPreCADMergeEdges(CORBA::Boolean theValue);
112   CORBA::Boolean GetPreCADMergeEdges();
113
114   void SetPreCADProcess3DTopology(CORBA::Boolean theValue);
115   CORBA::Boolean GetPreCADProcess3DTopology();
116
117   void SetPreCADDiscardInput(CORBA::Boolean theValue);
118   CORBA::Boolean GetPreCADDiscardInput();
119
120   void SetOptionValue(const char* optionName, const char* optionValue) throw (SALOME::SALOME_Exception);
121   void SetPreCADOptionValue(const char* optionName, const char* optionValue) throw (SALOME::SALOME_Exception);
122   char* GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception);
123   char* GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception);
124
125   void UnsetOption(const char* optionName);
126   void UnsetPreCADOption(const char* optionName);
127
128   BLSURFPlugin::string_array* GetOptionValues();
129   BLSURFPlugin::string_array* GetPreCADOptionValues();
130
131   void SetOptionValues(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception);
132   void SetPreCADOptionValues(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception);
133
134   void AddOption(const char* optionName, const char* optionValue);
135   void AddPreCADOption(const char* optionName, const char* optionValue);
136   char* GetOption(const char* optionName);
137   char* GetPreCADOption(const char* optionName);
138
139   void SetSizeMapEntry(const char* entry, const char* sizeMap) throw (SALOME::SALOME_Exception);
140
141   void SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap) throw (SALOME::SALOME_Exception);
142
143   char* GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception);
144
145   void UnsetEntry(const char* entry);
146
147   BLSURFPlugin::string_array* GetSizeMapEntries();
148
149   void SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps) throw (SALOME::SALOME_Exception);
150
151   void SetSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap) throw (SALOME::SALOME_Exception);
152
153   void SetConstantSizeMap(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap);
154
155   void UnsetSizeMap(GEOM::GEOM_Object_ptr GeomObj);
156
157   void ClearSizeMaps();
158
159   void SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor);
160
161   void UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj);
162
163   void SetAttractorEntry(const char* entry, const char* attractor) throw (SALOME::SALOME_Exception);
164
165   char* GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception);
166
167   BLSURFPlugin::string_array* GetAttractorEntries();
168   
169   
170   /*!
171     * Set/get/unset an attractor on a face 
172     */
173   
174   void SetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj, GEOM::GEOM_Object_ptr Attractor, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius );
175
176   void UnsetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj,
177                           GEOM::GEOM_Object_ptr theAttractor);
178
179   void UnsetAttractorEntry(const char* entry, const char* attractor);
180   void SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius)  throw (SALOME::SALOME_Exception);
181
182   BLSURFPlugin::TAttParamsMap* GetAttractorParams();
183   
184
185   /*
186    void SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap);
187
188    void UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj);
189
190    void SetCustomSizeMapEntry(const char* entry,const char* sizeMap )  throw (SALOME::SALOME_Exception);
191
192    char* GetCustomSizeMapEntry(const char* entry)  throw (SALOME::SALOME_Exception);
193
194    BLSURFPlugin::string_array* GetCustomSizeMapEntries();
195    */
196
197   ///////////////////////
198   // ENFORCED VERTEXES //
199   ///////////////////////
200
201   BLSURFPlugin::TFaceEntryEnfVertexListMap* GetAllEnforcedVerticesByFace();
202   BLSURFPlugin::TEnfVertexList* GetAllEnforcedVertices();
203
204   BLSURFPlugin::TFaceEntryCoordsListMap* GetAllCoordsByFace();
205   BLSURFPlugin::TCoordsEnfVertexMap* GetAllEnforcedVerticesByCoords();
206
207   BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* GetAllEnfVertexEntriesByFace();
208   BLSURFPlugin::TEnfVertexEntryEnfVertexMap* GetAllEnforcedVerticesByEnfVertexEntry();
209
210   void ClearAllEnforcedVertices();
211
212   /*!
213    * Set/get/unset an enforced vertex on geom object
214    */
215   bool SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z)
216       throw (SALOME::SALOME_Exception);
217   bool SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName)
218       throw (SALOME::SALOME_Exception);
219   bool SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
220       throw (SALOME::SALOME_Exception);
221   bool SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
222       throw (SALOME::SALOME_Exception);
223   bool SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName, const char* theGroupName)
224       throw (SALOME::SALOME_Exception);
225   bool SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
226       throw (SALOME::SALOME_Exception);
227
228   BLSURFPlugin::TEnfVertexList* GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
229
230   bool UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z)
231       throw (SALOME::SALOME_Exception);
232   bool UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
233       throw (SALOME::SALOME_Exception);
234   bool UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
235
236   /*!
237    * Set/get/unset an enforced vertex on geom object given by entry
238    */
239   bool SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x = 0, CORBA::Double y = 0, CORBA::Double z = 0,
240       const char* theVertexName = "", const char* theVertexEntry = "", const char* theGroupName = "")
241       throw (SALOME::SALOME_Exception);
242
243   BLSURFPlugin::TEnfVertexList* GetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
244
245   bool UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z,
246       const char* theVertexEntry = "") throw (SALOME::SALOME_Exception);
247   bool UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
248
249   /*!
250    * To add internal vertices as enforced vertices
251    */
252   void SetInternalEnforcedVertexAllFaces(CORBA::Boolean toEnforceInternalVertices);
253   CORBA::Boolean GetInternalEnforcedVertexAllFaces();
254   void SetInternalEnforcedVertexAllFacesGroup(const char*  groupName = "");
255   char* GetInternalEnforcedVertexAllFacesGroup();
256
257 // Enable internal enforced vertices on specific face if requested by user
258 //  void SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices) throw (SALOME::SALOME_Exception);
259 //  void SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "") throw (SALOME::SALOME_Exception);
260 //  void SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "") throw (SALOME::SALOME_Exception);
261 //  CORBA::Boolean GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
262 //  CORBA::Boolean GetInternalEnforcedVertexEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
263   
264   ///////////////////////
265   // PERIODICITY       //
266   ///////////////////////
267
268   void ClearPreCadPeriodicityVectors();
269
270   BLSURFPlugin::TPeriodicityList* GetPreCadFacesPeriodicityVector();
271   BLSURFPlugin::TPeriodicityList* GetPreCadEdgesPeriodicityVector();
272
273   BLSURFPlugin::TPeriodicityList* PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector);
274
275   void AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
276       throw (SALOME::SALOME_Exception);
277
278   void AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
279       const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
280       throw (SALOME::SALOME_Exception);
281
282   void AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
283       const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries)
284       throw (SALOME::SALOME_Exception);
285
286   void AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
287       throw (SALOME::SALOME_Exception);
288
289   void AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
290       const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
291       throw (SALOME::SALOME_Exception);
292
293   void AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
294       const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries)
295       throw (SALOME::SALOME_Exception);
296
297   void AddFacePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
298       throw (SALOME::SALOME_Exception);
299
300   void AddFacePeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry)
301     throw (SALOME::SALOME_Exception);
302
303   void AddEdgePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theEdge1,
304                           GEOM::GEOM_Object_ptr theFace2, GEOM::GEOM_Object_ptr theEdge2, CORBA::Long edge_orientation = 0)
305       throw (SALOME::SALOME_Exception);
306
307   void AddEdgePeriodicityWithoutFaces(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2, CORBA::Long edge_orientation = 0)
308       throw (SALOME::SALOME_Exception);
309
310   void AddEdgePeriodicityEntry(const char* theFace1Entry, const char* theEdge1Entry, const char* theFace2Entry, const char* theEdge2Entry, const long edge_orientation = 0)
311     throw (SALOME::SALOME_Exception);
312
313   void AddVertexPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theVertex1,
314       GEOM::GEOM_Object_ptr theEdge2, GEOM::GEOM_Object_ptr theVertex2)
315       throw (SALOME::SALOME_Exception);
316
317   void AddVertexPeriodicityEntry(const char* theEdge1Entry, const char* theVertex1Entry, const char* theEdge2Entry, const char* theVertex2Entry)
318     throw (SALOME::SALOME_Exception);
319
320   ///////////////////////
321   
322   /*!
323     * Sets the file for export resulting mesh in GMF format
324     */
325 //   void SetGMFFile(const char* theFileName, CORBA::Boolean isBinary);
326   void SetGMFFile(const char* theFileName);
327   char* GetGMFFile();
328 //   CORBA::Boolean GetGMFFileMode();
329
330   // Get implementation
331   ::BLSURFPlugin_Hypothesis* GetImpl();
332
333   // Verify whether hypothesis supports given entity type 
334   CORBA::Boolean IsDimSupported(SMESH::Dimension type);
335
336
337   //
338   // Obsolete methods - To be removed in V7
339   //
340   void SetPhyMin(CORBA::Double theMinSize);
341   CORBA::Double GetPhyMin();
342   void SetPhyMax(CORBA::Double theMaxSize);
343   CORBA::Double GetPhyMax();
344   void SetGeoMin(CORBA::Double theMinSize);
345   CORBA::Double GetGeoMin();
346   void SetGeoMax(CORBA::Double theMaxSize);
347   CORBA::Double GetGeoMax();
348   void SetAngleMeshS(CORBA::Double angle);
349   CORBA::Double GetAngleMeshS();
350   void SetAngleMeshC(CORBA::Double angle);
351   CORBA::Double GetAngleMeshC();
352   void SetDecimesh(CORBA::Boolean toIgnoreEdges);
353   CORBA::Boolean GetDecimesh();
354   void SetPreCADRemoveNanoEdges(CORBA::Boolean toRemoveNanoEdges);
355   CORBA::Boolean GetPreCADRemoveNanoEdges();
356   void SetPreCADEpsNano(CORBA::Double epsNano);
357   CORBA::Double GetPreCADEpsNano();
358
359 private:
360   ///////////////////////
361   // PERIODICITY       //
362   ///////////////////////
363   std::string ShapeTypeToString(GEOM::shape_type theShapeType);
364   void CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType);
365   void CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes);
366   std::string PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix);
367   std::string FormatVerticesEntries(std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);
368
369 };
370
371 #endif