1 // HexoticPlugin : 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 : HexoticPlugin_Hypothesis.cxx
23 // Author : Lioka RAZAFINDRAZAKA (CEA)
26 //=============================================================================
29 #include <HexoticPlugin_Hypothesis.hxx>
30 #include <utilities.h>
32 //=============================================================================
36 //=============================================================================
37 HexoticPlugin_Hypothesis::HexoticPlugin_Hypothesis (int hypId, int studyId,
39 : SMESH_Hypothesis(hypId, studyId, gen),
40 _hexesMinLevel( GetDefaultHexesMinLevel() ),
41 _hexesMaxLevel( GetDefaultHexesMaxLevel() ),
42 _hexoticQuadrangles( GetDefaultHexoticQuadrangles() ),
43 _hexoticIgnoreRidges( GetDefaultHexoticIgnoreRidges() ),
44 _hexoticInvalidElements( GetDefaultHexoticInvalidElements() ),
45 _hexoticSharpAngleThreshold( GetDefaultHexoticSharpAngleThreshold() )
47 MESSAGE("HexoticPlugin_Hypothesis::HexoticPlugin_Hypothesis");
48 _name = "Hexotic_Parameters";
52 //=============================================================================
56 //=============================================================================
58 void HexoticPlugin_Hypothesis::SetHexesMinLevel(int theVal) {
59 if (theVal != _hexesMinLevel) {
60 _hexesMinLevel = theVal;
61 NotifySubMeshesHypothesisModification();
65 void HexoticPlugin_Hypothesis::SetHexesMaxLevel(int theVal) {
66 if (theVal != _hexesMaxLevel) {
67 _hexesMaxLevel = theVal;
68 NotifySubMeshesHypothesisModification();
72 void HexoticPlugin_Hypothesis::SetHexoticQuadrangles(bool theVal) {
73 if (theVal != _hexoticQuadrangles) {
74 _hexoticQuadrangles = theVal;
75 NotifySubMeshesHypothesisModification();
79 void HexoticPlugin_Hypothesis::SetHexoticIgnoreRidges(bool theVal) {
80 if (theVal != _hexoticIgnoreRidges) {
81 _hexoticIgnoreRidges = theVal;
82 NotifySubMeshesHypothesisModification();
86 void HexoticPlugin_Hypothesis::SetHexoticInvalidElements(bool theVal) {
87 if (theVal != _hexoticInvalidElements) {
88 _hexoticInvalidElements = theVal;
89 NotifySubMeshesHypothesisModification();
93 void HexoticPlugin_Hypothesis::SetHexoticSharpAngleThreshold(int theVal) {
94 if (theVal != _hexoticSharpAngleThreshold) {
95 _hexoticSharpAngleThreshold = theVal;
96 NotifySubMeshesHypothesisModification();
100 //=============================================================================
104 //=============================================================================
105 ostream & HexoticPlugin_Hypothesis::SaveTo(ostream & save)
107 save << _hexesMinLevel << " " << _hexesMaxLevel;
108 save << " " << (int)_hexoticQuadrangles;
109 save << " " << (int)_hexoticIgnoreRidges;
110 save << " " << (int)_hexoticInvalidElements;
111 save << " " << _hexoticSharpAngleThreshold;
113 cout << "save : " << save << endl;
119 //=============================================================================
123 //=============================================================================
124 istream & HexoticPlugin_Hypothesis::LoadFrom(istream & load)
130 // isOK = (load >> val);
134 // load.clear(ios::badbit | load.rdstate());
136 // isOK = (load >> is);
138 // SetFineness((Fineness) is);
140 // load.clear(ios::badbit | load.rdstate());
142 // if (_fineness == UserDefined)
144 // isOK = (load >> val);
146 // _growthRate = val;
148 // load.clear(ios::badbit | load.rdstate());
150 // isOK = (load >> val);
152 // _nbSegPerEdge = val;
154 // load.clear(ios::badbit | load.rdstate());
156 // isOK = (load >> val);
158 // _nbSegPerRadius = val;
160 // load.clear(ios::badbit | load.rdstate());
163 // isOK = (load >> is);
165 // _secondOrder = (bool) is;
167 // load.clear(ios::badbit | load.rdstate());
169 // isOK = (load >> is);
171 // _optimize = (bool) is;
173 // load.clear(ios::badbit | load.rdstate());
177 //=============================================================================
181 //=============================================================================
182 ostream & operator <<(ostream & save, HexoticPlugin_Hypothesis & hyp)
184 return hyp.SaveTo( save );
187 //=============================================================================
191 //=============================================================================
192 istream & operator >>(istream & load, HexoticPlugin_Hypothesis & hyp)
194 return hyp.LoadFrom( load );
198 //================================================================================
200 * \brief Does nothing
201 * \param theMesh - the built mesh
202 * \param theShape - the geometry of interest
203 * \retval bool - always false
205 //================================================================================
206 bool HexoticPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* theMesh,
207 const TopoDS_Shape& theShape)
212 //=============================================================================
213 int HexoticPlugin_Hypothesis::GetDefaultHexesMinLevel()
218 int HexoticPlugin_Hypothesis::GetDefaultHexesMaxLevel()
223 bool HexoticPlugin_Hypothesis::GetDefaultHexoticQuadrangles()
228 bool HexoticPlugin_Hypothesis::GetDefaultHexoticIgnoreRidges()
233 bool HexoticPlugin_Hypothesis::GetDefaultHexoticInvalidElements()
238 int HexoticPlugin_Hypothesis::GetDefaultHexoticSharpAngleThreshold()