1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
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)
26 #ifndef _BLSURFPlugin_Hypothesis_i_HXX_
27 #define _BLSURFPlugin_Hypothesis_i_HXX_
29 #include <SALOMEconfig.h>
30 #include CORBA_SERVER_HEADER(BLSURFPlugin_Algorithm)
32 #include "SMESH_Hypothesis_i.hxx"
33 #include "BLSURFPlugin_Hypothesis.hxx"
38 // BLSURFPlugin parameters hypothesis
40 class BLSURFPlugin_Hypothesis_i:
41 public virtual POA_BLSURFPlugin::BLSURFPlugin_Hypothesis,
42 public virtual SMESH_Hypothesis_i
46 BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA,
48 ::SMESH_Gen* theGenImpl,
51 virtual ~BLSURFPlugin_Hypothesis_i();
53 void SetPhysicalMesh(CORBA::Long theValue);
54 CORBA::Long GetPhysicalMesh();
56 void SetGeometricMesh(CORBA::Long theValue);
57 CORBA::Long GetGeometricMesh();
59 void SetPhySize(CORBA::Double theValue);
60 void SetPhySizeRel(CORBA::Double theValue);
61 CORBA::Double GetPhySize();
62 CORBA::Boolean IsPhySizeRel();
64 void SetMinSize(CORBA::Double theMinSize);
65 void SetMinSizeRel(CORBA::Double theMinSize);
66 CORBA::Double GetMinSize();
67 CORBA::Boolean IsMinSizeRel();
69 void SetMaxSize(CORBA::Double theMaxSize);
70 void SetMaxSizeRel(CORBA::Double theMaxSize);
71 CORBA::Double GetMaxSize();
72 CORBA::Boolean IsMaxSizeRel();
74 void SetUseGradation(CORBA::Boolean theValue);
75 CORBA::Boolean GetUseGradation();
76 void SetGradation(CORBA::Double theValue);
77 CORBA::Double GetGradation();
79 void SetUseVolumeGradation(CORBA::Boolean theValue);
80 CORBA::Boolean GetUseVolumeGradation();
81 void SetVolumeGradation(CORBA::Double theValue);
82 CORBA::Double GetVolumeGradation();
84 void SetQuadAllowed(CORBA::Boolean theValue);
85 CORBA::Boolean GetQuadAllowed();
87 void SetAngleMesh(CORBA::Double theValue);
88 CORBA::Double GetAngleMesh();
90 void SetChordalError(CORBA::Double distance);
91 CORBA::Double GetChordalError();
93 void SetAnisotropic(CORBA::Boolean anisotropic);
94 CORBA::Boolean GetAnisotropic();
96 void SetAnisotropicRatio(CORBA::Double ratio);
97 CORBA::Double GetAnisotropicRatio();
99 void SetRemoveTinyEdges(CORBA::Boolean remove);
100 CORBA::Boolean GetRemoveTinyEdges();
102 void SetTinyEdgeLength(CORBA::Double length);
103 CORBA::Double GetTinyEdgeLength();
105 void SetOptimiseTinyEdges(CORBA::Boolean toOptimise);
106 CORBA::Boolean GetOptimiseTinyEdges();
108 void SetTinyEdgeOptimisationLength(CORBA::Double length);
109 CORBA::Double GetTinyEdgeOptimisationLength();
111 void SetCorrectSurfaceIntersection(CORBA::Boolean toOptimise);
112 CORBA::Boolean GetCorrectSurfaceIntersection();
114 void SetCorrectSurfaceIntersectionMaxCost(CORBA::Double maxCost);
115 CORBA::Double GetCorrectSurfaceIntersectionMaxCost();
117 void SetBadElementRemoval(CORBA::Boolean remove);
118 CORBA::Boolean GetBadElementRemoval();
120 void SetBadElementAspectRatio(CORBA::Double ratio);
121 CORBA::Double GetBadElementAspectRatio();
123 void SetOptimizeMesh(CORBA::Boolean optimize);
124 CORBA::Boolean GetOptimizeMesh();
126 void SetQuadraticMesh(CORBA::Boolean quadratic);
127 CORBA::Boolean GetQuadraticMesh();
129 void SetTopology(CORBA::Long theValue);
130 CORBA::Long GetTopology();
132 void SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception);
133 CORBA::Short GetVerbosity();
135 void SetEnforceCadEdgesSize( CORBA::Boolean toEnforce );
136 CORBA::Boolean GetEnforceCadEdgesSize();
138 void SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification );
139 CORBA::Boolean GetJacobianRectificationRespectGeometry();
141 void SetJacobianRectification( CORBA::Boolean allowRectification );
142 CORBA::Boolean GetJacobianRectification();
144 void SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception);
145 CORBA::Long GetMaxNumberOfPointsPerPatch();
147 void SetMaxNumberOfThreads( CORBA::Long nb ) throw (SALOME::SALOME_Exception);
148 CORBA::Long GetMaxNumberOfThreads();
150 void SetRespectGeometry( CORBA::Boolean toRespect );
151 CORBA::Boolean GetRespectGeometry();
153 void SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection );
154 CORBA::Boolean GetTinyEdgesAvoidSurfaceIntersections();
156 void SetClosedGeometry( CORBA::Boolean isClosed );
157 CORBA::Boolean GetClosedGeometry();
159 void SetDebug( CORBA::Boolean isDebug );
162 void SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception);
163 double GetPeriodicTolerance() throw (SALOME::SALOME_Exception);
165 void SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception);
166 char* GetRequiredEntities();
168 void SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception);
169 CORBA::Double GetSewingTolerance() throw (SALOME::SALOME_Exception);
171 void SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception);
174 void SetHyperPatches(const BLSURFPlugin::THyperPatchList& hpl);
175 BLSURFPlugin::THyperPatchList* GetHyperPatches();
177 void SetPreCADMergeEdges(CORBA::Boolean theValue);
178 CORBA::Boolean GetPreCADMergeEdges();
180 void SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue);
181 CORBA::Boolean GetPreCADRemoveDuplicateCADFaces();
183 void SetPreCADProcess3DTopology(CORBA::Boolean theValue);
184 CORBA::Boolean GetPreCADProcess3DTopology();
186 void SetPreCADDiscardInput(CORBA::Boolean theValue);
187 CORBA::Boolean GetPreCADDiscardInput();
189 void SetOptionValue(const char* optionName, const char* optionValue) throw (SALOME::SALOME_Exception);
190 void SetPreCADOptionValue(const char* optionName, const char* optionValue) throw (SALOME::SALOME_Exception);
191 char* GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception);
192 char* GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception);
194 void UnsetOption(const char* optionName);
195 void UnsetPreCADOption(const char* optionName);
197 BLSURFPlugin::string_array* GetOptionValues();
198 BLSURFPlugin::string_array* GetPreCADOptionValues();
199 BLSURFPlugin::string_array* GetAdvancedOptionValues();
201 void SetOptionValues(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception);
202 void SetPreCADOptionValues(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception);
203 void SetAdvancedOptionValues(const BLSURFPlugin::string_array& options);
204 void SetAdvancedOption(const char* optionsAndValues) throw (SALOME::SALOME_Exception);
206 void AddOption(const char* optionName, const char* optionValue);
207 void AddPreCADOption(const char* optionName, const char* optionValue);
208 char* GetOption(const char* optionName);
209 char* GetPreCADOption(const char* optionName);
211 void SetSizeMapEntry(const char* entry, const char* sizeMap) throw (SALOME::SALOME_Exception);
213 void SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap) throw (SALOME::SALOME_Exception);
215 char* GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception);
217 void UnsetEntry(const char* entry);
219 BLSURFPlugin::string_array* GetSizeMapEntries();
221 void SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps) throw (SALOME::SALOME_Exception);
223 void SetSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap) throw (SALOME::SALOME_Exception);
225 void SetConstantSizeMap(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap);
227 void UnsetSizeMap(GEOM::GEOM_Object_ptr GeomObj);
229 void ClearSizeMaps();
231 void SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor);
233 void UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj);
235 void SetAttractorEntry(const char* entry, const char* attractor) throw (SALOME::SALOME_Exception);
237 char* GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception);
239 BLSURFPlugin::string_array* GetAttractorEntries();
243 * Set/get/unset an attractor on a face
246 void SetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj, GEOM::GEOM_Object_ptr Attractor, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius );
248 void UnsetAttractorGeom(GEOM::GEOM_Object_ptr GeomObj,
249 GEOM::GEOM_Object_ptr theAttractor);
251 void UnsetAttractorEntry(const char* entry, const char* attractor);
252 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);
254 BLSURFPlugin::TAttParamsMap* GetAttractorParams();
258 void SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap);
260 void UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj);
262 void SetCustomSizeMapEntry(const char* entry,const char* sizeMap ) throw (SALOME::SALOME_Exception);
264 char* GetCustomSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception);
266 BLSURFPlugin::string_array* GetCustomSizeMapEntries();
269 ///////////////////////
270 // ENFORCED VERTEXES //
271 ///////////////////////
273 BLSURFPlugin::TFaceEntryEnfVertexListMap* GetAllEnforcedVerticesByFace();
274 BLSURFPlugin::TEnfVertexList* GetAllEnforcedVertices();
276 BLSURFPlugin::TFaceEntryCoordsListMap* GetAllCoordsByFace();
277 BLSURFPlugin::TCoordsEnfVertexMap* GetAllEnforcedVerticesByCoords();
279 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* GetAllEnfVertexEntriesByFace();
280 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* GetAllEnforcedVerticesByEnfVertexEntry();
282 void ClearAllEnforcedVertices();
285 * Set/get/unset an enforced vertex on geom object
288 bool SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z)
289 throw (SALOME::SALOME_Exception);
290 bool SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName)
291 throw (SALOME::SALOME_Exception);
292 bool SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
293 throw (SALOME::SALOME_Exception);
294 bool SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
295 throw (SALOME::SALOME_Exception);
296 bool SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName, const char* theGroupName)
297 throw (SALOME::SALOME_Exception);
298 bool SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
299 throw (SALOME::SALOME_Exception);
301 BLSURFPlugin::TEnfVertexList* GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
303 bool UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z)
304 throw (SALOME::SALOME_Exception);
305 bool UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
306 throw (SALOME::SALOME_Exception);
307 bool UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
310 bool AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
311 throw (SALOME::SALOME_Exception);
312 bool AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName)
313 throw (SALOME::SALOME_Exception);
314 bool AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
315 throw (SALOME::SALOME_Exception);
316 bool AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
317 throw (SALOME::SALOME_Exception);
318 bool AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName, const char* theGroupName)
319 throw (SALOME::SALOME_Exception);
320 bool AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
321 throw (SALOME::SALOME_Exception);
323 bool RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
324 throw (SALOME::SALOME_Exception);
325 bool RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
326 throw (SALOME::SALOME_Exception);
327 bool RemoveEnforcedVertices() throw (SALOME::SALOME_Exception);
330 * Set/get/unset an enforced vertex on geom object given by entry
332 bool SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x = 0, CORBA::Double y = 0, CORBA::Double z = 0,
333 const char* theVertexName = "", const char* theVertexEntry = "", const char* theGroupName = "")
334 throw (SALOME::SALOME_Exception);
336 BLSURFPlugin::TEnfVertexList* GetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
338 bool UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z,
339 const char* theVertexEntry = "") throw (SALOME::SALOME_Exception);
340 bool UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
343 * To add internal vertices as enforced vertices
345 void SetInternalEnforcedVertexAllFaces(CORBA::Boolean toEnforceInternalVertices);
346 CORBA::Boolean GetInternalEnforcedVertexAllFaces();
347 void SetInternalEnforcedVertexAllFacesGroup(const char* groupName = "");
348 char* GetInternalEnforcedVertexAllFacesGroup();
350 // Enable internal enforced vertices on specific face if requested by user
351 // void SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices) throw (SALOME::SALOME_Exception);
352 // void SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "") throw (SALOME::SALOME_Exception);
353 // void SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "") throw (SALOME::SALOME_Exception);
354 // CORBA::Boolean GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
355 // CORBA::Boolean GetInternalEnforcedVertexEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
357 ///////////////////////
359 ///////////////////////
361 void ClearPreCadPeriodicityVectors();
363 BLSURFPlugin::TPeriodicityList* GetPreCadFacesPeriodicityVector();
364 BLSURFPlugin::TPeriodicityList* GetPreCadEdgesPeriodicityVector();
366 BLSURFPlugin::TPeriodicityList* PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector);
368 void AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
369 throw (SALOME::SALOME_Exception);
371 void AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
372 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
373 throw (SALOME::SALOME_Exception);
375 void AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
376 const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries)
377 throw (SALOME::SALOME_Exception);
379 void AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
380 throw (SALOME::SALOME_Exception);
382 void AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
383 const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
384 throw (SALOME::SALOME_Exception);
386 void AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
387 const BLSURFPlugin::TEntryList& theSourceVerticesEntries, const BLSURFPlugin::TEntryList& theTargetVerticesEntries)
388 throw (SALOME::SALOME_Exception);
390 ///////////////////////
393 * Sets the file for export resulting mesh in GMF format
395 // void SetGMFFile(const char* theFileName, CORBA::Boolean isBinary);
396 void SetGMFFile(const char* theFileName);
398 // CORBA::Boolean GetGMFFileMode();
400 // Get implementation
401 ::BLSURFPlugin_Hypothesis* GetImpl();
403 // Verify whether hypothesis supports given entity type
404 CORBA::Boolean IsDimSupported(SMESH::Dimension type);
408 // Obsolete methods - To be removed in V7
410 void SetPhyMin(CORBA::Double theMinSize);
411 CORBA::Double GetPhyMin();
412 void SetPhyMax(CORBA::Double theMaxSize);
413 CORBA::Double GetPhyMax();
414 void SetGeoMin(CORBA::Double theMinSize);
415 CORBA::Double GetGeoMin();
416 void SetGeoMax(CORBA::Double theMaxSize);
417 CORBA::Double GetGeoMax();
418 void SetAngleMeshS(CORBA::Double angle);
419 CORBA::Double GetAngleMeshS();
420 void SetAngleMeshC(CORBA::Double angle);
421 CORBA::Double GetAngleMeshC();
422 void SetDecimesh(CORBA::Boolean toIgnoreEdges);
423 CORBA::Boolean GetDecimesh();
424 void SetPreCADRemoveNanoEdges(CORBA::Boolean toRemoveNanoEdges);
425 CORBA::Boolean GetPreCADRemoveNanoEdges();
426 void SetPreCADEpsNano(CORBA::Double epsNano);
427 CORBA::Double GetPreCADEpsNano();
430 ///////////////////////
432 ///////////////////////
433 std::string ShapeTypeToString(GEOM::shape_type theShapeType);
434 void CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType);
435 void CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes);
436 std::string PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix);
437 std::string FormatVerticesEntries(std::vector<std::string> &theSourceVerticesEntries, std::vector<std::string> &theTargetVerticesEntries);