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)
24 // & Aurelien ALLEAUME (DISTENE)
27 //=============================================================================
30 #include <BLSURFPlugin_Hypothesis.hxx>
31 #include <utilities.h>
33 //=============================================================================
37 //=============================================================================
38 BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis (int hypId, int studyId,
40 : SMESH_Hypothesis(hypId, studyId, gen),
41 _topology(GetDefaultTopology()),
42 _physicalMesh(GetDefaultPhysicalMesh()),
43 _phySize(GetDefaultPhySize()),
44 _geometricMesh(GetDefaultGeometricMesh()),
45 _angleMeshS(GetDefaultAngleMeshS()),
46 _gradation(GetDefaultGradation()),
47 _quadAllowed(GetDefaultQuadAllowed()),
48 _decimesh(GetDefaultDecimesh())
50 _name = "BLSURF_Parameters";
54 //=============================================================================
58 //=============================================================================
59 void BLSURFPlugin_Hypothesis::SetTopology(Topology theTopology)
61 if (theTopology != _topology) {
62 _topology = theTopology;
63 NotifySubMeshesHypothesisModification();
67 //=============================================================================
71 //=============================================================================
72 void BLSURFPlugin_Hypothesis::SetPhysicalMesh(PhysicalMesh thePhysicalMesh)
74 if (thePhysicalMesh != _physicalMesh) {
75 _physicalMesh = thePhysicalMesh;
76 switch( _physicalMesh ) {
79 _phySize = GetDefaultPhySize();
82 NotifySubMeshesHypothesisModification();
86 //=============================================================================
90 //=============================================================================
91 void BLSURFPlugin_Hypothesis::SetPhySize(double theVal)
93 if (theVal != _phySize) {
95 NotifySubMeshesHypothesisModification();
99 //=============================================================================
103 //=============================================================================
104 void BLSURFPlugin_Hypothesis::SetGeometricMesh(GeometricMesh theGeometricMesh)
106 if (theGeometricMesh != _geometricMesh) {
107 _geometricMesh = theGeometricMesh;
108 switch( _geometricMesh ) {
111 _angleMeshS = GetDefaultAngleMeshS();
112 _gradation = GetDefaultGradation();
115 NotifySubMeshesHypothesisModification();
119 //=============================================================================
123 //=============================================================================
124 void BLSURFPlugin_Hypothesis::SetAngleMeshS(double theVal)
126 if (theVal != _angleMeshS) {
127 _angleMeshS = theVal;
128 NotifySubMeshesHypothesisModification();
132 //=============================================================================
136 //=============================================================================
137 void BLSURFPlugin_Hypothesis::SetGradation(double theVal)
139 if (theVal != _gradation) {
141 NotifySubMeshesHypothesisModification();
145 //=============================================================================
149 //=============================================================================
150 void BLSURFPlugin_Hypothesis::SetQuadAllowed(bool theVal)
152 if (theVal != _quadAllowed) {
153 _quadAllowed = theVal;
154 NotifySubMeshesHypothesisModification();
158 //=============================================================================
162 //=============================================================================
163 void BLSURFPlugin_Hypothesis::SetDecimesh(bool theVal)
165 if (theVal != _decimesh) {
167 NotifySubMeshesHypothesisModification();
171 //=============================================================================
175 //=============================================================================
176 ostream & BLSURFPlugin_Hypothesis::SaveTo(ostream & save)
178 // save << _maxSize << " " << _fineness;
180 // if (_fineness == UserDefined)
181 // save << " " << _growthRate << " " << _nbSegPerEdge << " " << _nbSegPerRadius;
183 // save << " " << (int)_secondOrder << " " << (int)_optimize;
188 //=============================================================================
192 //=============================================================================
193 istream & BLSURFPlugin_Hypothesis::LoadFrom(istream & load)
199 // isOK = (load >> val);
203 // load.clear(ios::badbit | load.rdstate());
205 // isOK = (load >> is);
207 // SetFineness((Fineness) is);
209 // load.clear(ios::badbit | load.rdstate());
211 // if (_fineness == UserDefined)
213 // isOK = (load >> val);
215 // _growthRate = val;
217 // load.clear(ios::badbit | load.rdstate());
219 // isOK = (load >> val);
221 // _nbSegPerEdge = val;
223 // load.clear(ios::badbit | load.rdstate());
225 // isOK = (load >> val);
227 // _nbSegPerRadius = val;
229 // load.clear(ios::badbit | load.rdstate());
232 // isOK = (load >> is);
234 // _secondOrder = (bool) is;
236 // load.clear(ios::badbit | load.rdstate());
238 // isOK = (load >> is);
240 // _optimize = (bool) is;
242 // load.clear(ios::badbit | load.rdstate());
246 //=============================================================================
250 //=============================================================================
251 ostream & operator <<(ostream & save, BLSURFPlugin_Hypothesis & hyp)
253 return hyp.SaveTo( save );
256 //=============================================================================
260 //=============================================================================
261 istream & operator >>(istream & load, BLSURFPlugin_Hypothesis & hyp)
263 return hyp.LoadFrom( load );
267 //================================================================================
269 * \brief Does nothing
270 * \param theMesh - the built mesh
271 * \param theShape - the geometry of interest
272 * \retval bool - always false
274 //================================================================================
275 bool BLSURFPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* theMesh,
276 const TopoDS_Shape& theShape)
281 //=============================================================================
282 BLSURFPlugin_Hypothesis::Topology BLSURFPlugin_Hypothesis::GetDefaultTopology()
287 //=============================================================================
288 BLSURFPlugin_Hypothesis::PhysicalMesh BLSURFPlugin_Hypothesis::GetDefaultPhysicalMesh()
290 return PhysicalUserDefined;
293 //=============================================================================
294 double BLSURFPlugin_Hypothesis::GetDefaultPhySize()
299 //=============================================================================
300 BLSURFPlugin_Hypothesis::GeometricMesh BLSURFPlugin_Hypothesis::GetDefaultGeometricMesh()
305 //=============================================================================
306 double BLSURFPlugin_Hypothesis::GetDefaultAngleMeshS()
311 //=============================================================================
312 double BLSURFPlugin_Hypothesis::GetDefaultGradation()
317 //=============================================================================
318 bool BLSURFPlugin_Hypothesis::GetDefaultQuadAllowed()
323 //=============================================================================
324 bool BLSURFPlugin_Hypothesis::GetDefaultDecimesh()