1 // Copyright (C) 2007-2008 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.
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
20 // File : BLSURFPlugin_Hypothesis.hxx
21 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
22 // & Aurelien ALLEAUME (DISTENE)
23 // Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
26 #ifndef _BLSURFPlugin_Hypothesis_HXX_
27 #define _BLSURFPlugin_Hypothesis_HXX_
29 #include "SMESH_Hypothesis.hxx"
36 // Parameters for work of BLSURF
38 class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis
41 BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen);
59 void SetTopology(Topology theTopology);
60 Topology GetTopology() const { return _topology; }
62 void SetPhysicalMesh(PhysicalMesh thePhysicalMesh);
63 PhysicalMesh GetPhysicalMesh() const { return _physicalMesh; }
65 void SetPhySize(double thePhySize);
66 double GetPhySize() const { return _phySize; }
68 void SetPhyMin(double theMinSize);
69 double GetPhyMin() const { return _phyMin; }
71 void SetPhyMax(double theMaxSize);
72 double GetPhyMax() const { return _phyMax; }
74 void SetGeometricMesh(GeometricMesh theGeometricMesh);
75 GeometricMesh GetGeometricMesh() const { return _geometricMesh; }
77 void SetAngleMeshS(double theAngle);
78 double GetAngleMeshS() const { return _angleMeshS; }
80 void SetAngleMeshC(double theAngle);
81 double GetAngleMeshC() const { return _angleMeshC; }
83 void SetGeoMin(double theMinSize);
84 double GetGeoMin() const { return _hgeoMin; }
86 void SetGeoMax(double theMaxSize);
87 double GetGeoMax() const { return _hgeoMax; }
89 void SetGradation(double theGradation);
90 double GetGradation() const { return _gradation; }
92 void SetQuadAllowed(bool theVal);
93 bool GetQuadAllowed() const { return _quadAllowed; }
95 void SetDecimesh(bool theVal);
96 bool GetDecimesh() const { return _decimesh; }
98 void SetVerbosity(int theVal);
99 int GetVerbosity() const { return _verb; }
101 void ClearEntry(const std::string& entry);
102 void ClearSizeMaps();
104 typedef std::map<std::string,std::string> TSizeMap;
106 void SetSizeMapEntry(const std::string& entry,const std::string& sizeMap );
107 std::string GetSizeMapEntry(const std::string& entry);
108 const TSizeMap& _GetSizeMapEntries() const { return _sizeMap; }
110 * \brief Return the size maps
112 static TSizeMap GetSizeMapEntries(const BLSURFPlugin_Hypothesis* hyp);
115 void SetAttractorEntry(const std::string& entry,const std::string& attractor );
116 std::string GetAttractorEntry(const std::string& entry);
117 const TSizeMap& _GetAttractorEntries() const { return _attractors; };
119 * \brief Return the attractors
121 static TSizeMap GetAttractorEntries(const BLSURFPlugin_Hypothesis* hyp);
125 void SetCustomSizeMapEntry(const std::string& entry,const std::string& sizeMap );
126 std::string GetCustomSizeMapEntry(const std::string& entry);
127 void UnsetCustomSizeMap(const std::string& entry);
128 const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
132 * To set/get/unset an enforced vertex
134 typedef std::vector<double> TEnforcedVertex;
135 typedef std::set< TEnforcedVertex > TEnforcedVertexList;
136 typedef std::map< std::string, TEnforcedVertexList > TEnforcedVertexMap;
138 void SetEnforcedVertex(const std::string& entry, double x, double y, double z);
139 // void SetEnforcedVertexList(const std::string& entry, const TEnforcedVertexList vertexList);
140 TEnforcedVertexList GetEnforcedVertices(const std::string& entry) throw (std::invalid_argument);
141 void ClearEnforcedVertex(const std::string& entry, double x, double y, double z) throw (std::invalid_argument);
142 // void ClearEnforcedVertexList(const std::string& entry, TEnforcedVertexList vertexList) throw (std::invalid_argument);
143 void ClearEnforcedVertices(const std::string& entry) throw (std::invalid_argument);
145 void ClearAllEnforcedVertices();
146 const TEnforcedVertexMap _GetAllEnforcedVertices() const { return _enforcedVertices; }
149 * \brief Return the enforced vertices
151 static TEnforcedVertexMap GetAllEnforcedVertices(const BLSURFPlugin_Hypothesis* hyp);
154 static Topology GetDefaultTopology();
155 static PhysicalMesh GetDefaultPhysicalMesh();
156 static double GetDefaultPhySize();
157 static double GetDefaultMaxSize();
158 static double GetDefaultMinSize();
159 static GeometricMesh GetDefaultGeometricMesh();
160 static double GetDefaultAngleMeshS();
161 static double GetDefaultAngleMeshC() { return GetDefaultAngleMeshS(); }
162 static double GetDefaultGradation();
163 static bool GetDefaultQuadAllowed();
164 static bool GetDefaultDecimesh();
165 static int GetDefaultVerbosity() { return 10; }
166 static TSizeMap GetDefaultSizeMap() { return TSizeMap();}
167 static TEnforcedVertexMap GetDefaultEnforcedVertexMap() { return TEnforcedVertexMap(); }
169 static double undefinedDouble() { return -1.0; }
171 typedef std::map< std::string, std::string > TOptionValues;
172 typedef std::set< std::string > TOptionNames;
174 void SetOptionValue(const std::string& optionName,
175 const std::string& optionValue) throw (std::invalid_argument);
176 std::string GetOptionValue(const std::string& optionName) throw (std::invalid_argument);
177 void ClearOption(const std::string& optionName);
178 const TOptionValues& GetOptionValues() const { return _option2value; }
181 virtual std::ostream & SaveTo(std::ostream & save);
182 virtual std::istream & LoadFrom(std::istream & load);
183 friend std::ostream & operator <<(std::ostream & save, BLSURFPlugin_Hypothesis & hyp);
184 friend std::istream & operator >>(std::istream & load, BLSURFPlugin_Hypothesis & hyp);
187 * \brief Does nothing
188 * \param theMesh - the built mesh
189 * \param theShape - the geometry of interest
190 * \retval bool - always false
192 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
195 * \brief Initialize my parameter values by default parameters.
196 * \retval bool - true if parameter values have been successfully defined
198 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
202 PhysicalMesh _physicalMesh;
203 double _phySize, _phyMin, _phyMax;
204 GeometricMesh _geometricMesh;
205 double _angleMeshS, _angleMeshC, _hgeoMin, _hgeoMax;
210 TOptionValues _option2value;
211 TOptionNames _doubleOptions, _charOptions;
213 TSizeMap _attractors;
214 TEnforcedVertexMap _enforcedVertices;
216 TSizeMap _customSizeMap;