1 // BLSURFPlugin : C++ implementation
3 // Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License.
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
22 // File : BLSURFPlugin_Hypothesis.cxx
23 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
26 //=============================================================================
29 #include <BLSURFPlugin_Hypothesis.hxx>
30 #include <utilities.h>
32 //=============================================================================
36 //=============================================================================
37 BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis (int hypId, int studyId,
39 : SMESH_Hypothesis(hypId, studyId, gen),
40 _physicalMesh(GetDefaultPhysicalMesh()),
41 _phySize(GetDefaultPhySize()),
42 _geometricMesh(GetDefaultGeometricMesh()),
43 _angleMeshS(GetDefaultAngleMeshS()),
44 _gradation(GetDefaultGradation()),
45 _quadAllowed(GetDefaultQuadAllowed()),
46 _decimesh(GetDefaultDecimesh())
48 _name = "BLSURF_Parameters";
52 //=============================================================================
56 //=============================================================================
57 void BLSURFPlugin_Hypothesis::SetPhysicalMesh(PhysicalMesh thePhysicalMesh)
59 if (thePhysicalMesh != _physicalMesh) {
60 _physicalMesh = thePhysicalMesh;
61 switch( _physicalMesh ) {
64 _phySize = GetDefaultPhySize();
67 NotifySubMeshesHypothesisModification();
71 //=============================================================================
75 //=============================================================================
76 void BLSURFPlugin_Hypothesis::SetPhySize(double theVal)
78 if (theVal != _phySize) {
80 NotifySubMeshesHypothesisModification();
84 //=============================================================================
88 //=============================================================================
89 void BLSURFPlugin_Hypothesis::SetGeometricMesh(GeometricMesh theGeometricMesh)
91 if (theGeometricMesh != _geometricMesh) {
92 _geometricMesh = theGeometricMesh;
93 switch( _geometricMesh ) {
96 _angleMeshS = GetDefaultAngleMeshS();
97 _gradation = GetDefaultGradation();
100 NotifySubMeshesHypothesisModification();
104 //=============================================================================
108 //=============================================================================
109 void BLSURFPlugin_Hypothesis::SetAngleMeshS(double theVal)
111 if (theVal != _angleMeshS) {
112 _angleMeshS = theVal;
113 NotifySubMeshesHypothesisModification();
117 //=============================================================================
121 //=============================================================================
122 void BLSURFPlugin_Hypothesis::SetGradation(double theVal)
124 if (theVal != _gradation) {
126 NotifySubMeshesHypothesisModification();
130 //=============================================================================
134 //=============================================================================
135 void BLSURFPlugin_Hypothesis::SetQuadAllowed(bool theVal)
137 if (theVal != _quadAllowed) {
138 _quadAllowed = theVal;
139 NotifySubMeshesHypothesisModification();
143 //=============================================================================
147 //=============================================================================
148 void BLSURFPlugin_Hypothesis::SetDecimesh(bool theVal)
150 if (theVal != _decimesh) {
152 NotifySubMeshesHypothesisModification();
156 //=============================================================================
160 //=============================================================================
161 ostream & BLSURFPlugin_Hypothesis::SaveTo(ostream & save)
163 // save << _maxSize << " " << _fineness;
165 // if (_fineness == UserDefined)
166 // save << " " << _growthRate << " " << _nbSegPerEdge << " " << _nbSegPerRadius;
168 // save << " " << (int)_secondOrder << " " << (int)_optimize;
173 //=============================================================================
177 //=============================================================================
178 istream & BLSURFPlugin_Hypothesis::LoadFrom(istream & load)
184 // isOK = (load >> val);
188 // load.clear(ios::badbit | load.rdstate());
190 // isOK = (load >> is);
192 // SetFineness((Fineness) is);
194 // load.clear(ios::badbit | load.rdstate());
196 // if (_fineness == UserDefined)
198 // isOK = (load >> val);
200 // _growthRate = val;
202 // load.clear(ios::badbit | load.rdstate());
204 // isOK = (load >> val);
206 // _nbSegPerEdge = val;
208 // load.clear(ios::badbit | load.rdstate());
210 // isOK = (load >> val);
212 // _nbSegPerRadius = val;
214 // load.clear(ios::badbit | load.rdstate());
217 // isOK = (load >> is);
219 // _secondOrder = (bool) is;
221 // load.clear(ios::badbit | load.rdstate());
223 // isOK = (load >> is);
225 // _optimize = (bool) is;
227 // load.clear(ios::badbit | load.rdstate());
231 //=============================================================================
235 //=============================================================================
236 ostream & operator <<(ostream & save, BLSURFPlugin_Hypothesis & hyp)
238 return hyp.SaveTo( save );
241 //=============================================================================
245 //=============================================================================
246 istream & operator >>(istream & load, BLSURFPlugin_Hypothesis & hyp)
248 return hyp.LoadFrom( load );
252 //================================================================================
254 * \brief Does nothing
255 * \param theMesh - the built mesh
256 * \param theShape - the geometry of interest
257 * \retval bool - always false
259 //================================================================================
260 bool BLSURFPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* theMesh,
261 const TopoDS_Shape& theShape)
266 //=============================================================================
267 BLSURFPlugin_Hypothesis::PhysicalMesh BLSURFPlugin_Hypothesis::GetDefaultPhysicalMesh()
269 return PhysicalUserDefined;
272 //=============================================================================
273 double BLSURFPlugin_Hypothesis::GetDefaultPhySize()
278 //=============================================================================
279 BLSURFPlugin_Hypothesis::GeometricMesh BLSURFPlugin_Hypothesis::GetDefaultGeometricMesh()
284 //=============================================================================
285 double BLSURFPlugin_Hypothesis::GetDefaultAngleMeshS()
290 //=============================================================================
291 double BLSURFPlugin_Hypothesis::GetDefaultGradation()
296 //=============================================================================
297 bool BLSURFPlugin_Hypothesis::GetDefaultQuadAllowed()
302 //=============================================================================
303 bool BLSURFPlugin_Hypothesis::GetDefaultDecimesh()