1 // SMESH SMESH : implementaion of SMESH idl descriptions
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : StdMeshers_NumberOfSegments.cxx
25 // Moved here from SMESH_NumberOfSegments.cxx
26 // Author : Paul RASCLE, EDF
31 #include "StdMeshers_NumberOfSegments.hxx"
33 //=============================================================================
37 //=============================================================================
39 StdMeshers_NumberOfSegments::StdMeshers_NumberOfSegments(int hypId, int studyId,
40 SMESH_Gen * gen):SMESH_Hypothesis(hypId, studyId, gen)
42 _numberOfSegments = 1;
44 _name = "NumberOfSegments";
48 //=============================================================================
52 //=============================================================================
54 StdMeshers_NumberOfSegments::~StdMeshers_NumberOfSegments()
58 //=============================================================================
62 //=============================================================================
64 void StdMeshers_NumberOfSegments::SetNumberOfSegments(int segmentsNumber)
65 throw(SALOME_Exception)
67 int oldNumberOfSegments = _numberOfSegments;
68 if (segmentsNumber <= 0)
70 SALOME_Exception(LOCALIZED("number of segments must be positive"));
71 _numberOfSegments = segmentsNumber;
73 if (oldNumberOfSegments != _numberOfSegments)
74 NotifySubMeshesHypothesisModification();
77 //=============================================================================
81 //=============================================================================
83 int StdMeshers_NumberOfSegments::GetNumberOfSegments() const
85 return _numberOfSegments;
88 //=============================================================================
92 //=============================================================================
94 void StdMeshers_NumberOfSegments::SetScaleFactor(double scaleFactor)
95 throw(SALOME_Exception)
98 throw SALOME_Exception(LOCALIZED("scale factor must be positive"));
99 _scaleFactor = scaleFactor;
101 NotifySubMeshesHypothesisModification();
104 //=============================================================================
108 //=============================================================================
110 double StdMeshers_NumberOfSegments::GetScaleFactor() const
115 //=============================================================================
119 //=============================================================================
121 ostream & StdMeshers_NumberOfSegments::SaveTo(ostream & save)
123 save << this->_numberOfSegments << " " << this->_scaleFactor;
127 //=============================================================================
131 //=============================================================================
133 istream & StdMeshers_NumberOfSegments::LoadFrom(istream & load)
139 this->_numberOfSegments = a;
141 load.clear(ios::badbit | load.rdstate());
145 this->_scaleFactor = b;
147 load.clear(ios::badbit | load.rdstate());
151 //=============================================================================
155 //=============================================================================
157 ostream & operator <<(ostream & save, StdMeshers_NumberOfSegments & hyp)
159 return hyp.SaveTo( save );
162 //=============================================================================
166 //=============================================================================
168 istream & operator >>(istream & load, StdMeshers_NumberOfSegments & hyp)
170 return hyp.LoadFrom( load );