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 : SMESH_NumberOfSegments.cxx
25 // Author : Paul RASCLE, EDF
30 #include "SMESH_NumberOfSegments.hxx"
32 //=============================================================================
36 //=============================================================================
38 SMESH_NumberOfSegments::SMESH_NumberOfSegments(int hypId, int studyId,
39 SMESH_Gen * gen):SMESH_Hypothesis(hypId, studyId, gen)
41 _numberOfSegments = 1;
43 _name = "NumberOfSegments";
46 //=============================================================================
50 //=============================================================================
52 SMESH_NumberOfSegments::~SMESH_NumberOfSegments()
56 //=============================================================================
60 //=============================================================================
62 void SMESH_NumberOfSegments::SetNumberOfSegments(int segmentsNumber)
63 throw(SALOME_Exception)
65 int oldNumberOfSegments = _numberOfSegments;
66 if (segmentsNumber <= 0)
68 SALOME_Exception(LOCALIZED("number of segments must be positive"));
69 _numberOfSegments = segmentsNumber;
71 if (oldNumberOfSegments != _numberOfSegments)
72 NotifySubMeshesHypothesisModification();
75 //=============================================================================
79 //=============================================================================
81 int SMESH_NumberOfSegments::GetNumberOfSegments() const
83 return _numberOfSegments;
86 //=============================================================================
90 //=============================================================================
92 void SMESH_NumberOfSegments::SetScaleFactor(double scaleFactor)
93 throw(SALOME_Exception)
96 throw SALOME_Exception(LOCALIZED("scale factor must be positive"));
97 _scaleFactor = scaleFactor;
99 NotifySubMeshesHypothesisModification();
102 //=============================================================================
106 //=============================================================================
108 double SMESH_NumberOfSegments::GetScaleFactor() const
113 //=============================================================================
117 //=============================================================================
119 ostream & SMESH_NumberOfSegments::SaveTo(ostream & save)
124 //=============================================================================
128 //=============================================================================
130 istream & SMESH_NumberOfSegments::LoadFrom(istream & load)
132 return load >> (*this);
135 //=============================================================================
139 //=============================================================================
141 ostream & operator <<(ostream & save, SMESH_NumberOfSegments & hyp)
143 save << hyp._numberOfSegments;
147 //=============================================================================
151 //=============================================================================
153 istream & operator >>(istream & load, SMESH_NumberOfSegments & hyp)
159 hyp._numberOfSegments = a;
161 load.clear(ios::badbit | load.rdstate());