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"
35 // Parameters for work of BLSURF
37 class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis
40 BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen);
58 void SetTopology(Topology theTopology);
59 Topology GetTopology() const { return _topology; }
61 void SetPhysicalMesh(PhysicalMesh thePhysicalMesh);
62 PhysicalMesh GetPhysicalMesh() const { return _physicalMesh; }
64 void SetPhySize(double thePhySize);
65 double GetPhySize() const { return _phySize; }
67 void SetPhyMin(double theMinSize);
68 double GetPhyMin() const { return _phyMin; }
70 void SetPhyMax(double theMaxSize);
71 double GetPhyMax() const { return _phyMax; }
73 void SetGeometricMesh(GeometricMesh theGeometricMesh);
74 GeometricMesh GetGeometricMesh() const { return _geometricMesh; }
76 void SetAngleMeshS(double theAngle);
77 double GetAngleMeshS() const { return _angleMeshS; }
79 void SetAngleMeshC(double theAngle);
80 double GetAngleMeshC() const { return _angleMeshC; }
82 void SetGeoMin(double theMinSize);
83 double GetGeoMin() const { return _hgeoMin; }
85 void SetGeoMax(double theMaxSize);
86 double GetGeoMax() const { return _hgeoMax; }
88 void SetGradation(double theGradation);
89 double GetGradation() const { return _gradation; }
91 void SetQuadAllowed(bool theVal);
92 bool GetQuadAllowed() const { return _quadAllowed; }
94 void SetDecimesh(bool theVal);
95 bool GetDecimesh() const { return _decimesh; }
97 void SetVerbosity(int theVal);
98 int GetVerbosity() const { return _verb; }
100 void ClearEntry(const std::string& entry);
101 void ClearSizeMaps();
103 typedef std::map<std::string,std::string> TSizeMap;
105 void SetSizeMapEntry(const std::string& entry,const std::string& sizeMap );
106 std::string GetSizeMapEntry(const std::string& entry);
107 const TSizeMap& GetSizeMapEntries() const { return _sizeMap; }
110 void SetAttractorEntry(const std::string& entry,const std::string& attractor );
111 std::string GetAttractorEntry(const std::string& entry);
112 const TSizeMap& GetAttractorEntries() const { return _attractors; };
116 void SetCustomSizeMapEntry(const std::string& entry,const std::string& sizeMap );
117 std::string GetCustomSizeMapEntry(const std::string& entry);
118 void UnsetCustomSizeMap(const std::string& entry);
119 const TSizeMap& GetCustomSizeMapEntries() const { return _customSizeMap; }
122 static Topology GetDefaultTopology();
123 static PhysicalMesh GetDefaultPhysicalMesh();
124 static double GetDefaultPhySize();
125 static double GetDefaultMaxSize();
126 static double GetDefaultMinSize();
127 static GeometricMesh GetDefaultGeometricMesh();
128 static double GetDefaultAngleMeshS();
129 static double GetDefaultAngleMeshC() { return GetDefaultAngleMeshS(); }
130 static double GetDefaultGradation();
131 static bool GetDefaultQuadAllowed();
132 static bool GetDefaultDecimesh();
133 static int GetDefaultVerbosity() { return 10; }
135 static double undefinedDouble() { return -1.0; }
137 typedef std::map< std::string, std::string > TOptionValues;
138 typedef std::set< std::string > TOptionNames;
140 void SetOptionValue(const std::string& optionName,
141 const std::string& optionValue) throw (std::invalid_argument);
142 std::string GetOptionValue(const std::string& optionName) throw (std::invalid_argument);
143 void ClearOption(const std::string& optionName);
144 const TOptionValues& GetOptionValues() const { return _option2value; }
147 virtual std::ostream & SaveTo(std::ostream & save);
148 virtual std::istream & LoadFrom(std::istream & load);
149 friend std::ostream & operator <<(std::ostream & save, BLSURFPlugin_Hypothesis & hyp);
150 friend std::istream & operator >>(std::istream & load, BLSURFPlugin_Hypothesis & hyp);
153 * \brief Does nothing
154 * \param theMesh - the built mesh
155 * \param theShape - the geometry of interest
156 * \retval bool - always false
158 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
161 * \brief Initialize my parameter values by default parameters.
162 * \retval bool - true if parameter values have been successfully defined
164 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
168 PhysicalMesh _physicalMesh;
169 double _phySize, _phyMin, _phyMax;
170 GeometricMesh _geometricMesh;
171 double _angleMeshS, _angleMeshC, _hgeoMin, _hgeoMax;
176 TOptionValues _option2value;
177 TOptionNames _doubleOptions, _charOptions;
179 TSizeMap _attractors;
181 TSizeMap _customSizeMap;