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
31 #include "SMESH_NumberOfSegments.hxx"
33 //=============================================================================
37 //=============================================================================
39 SMESH_NumberOfSegments::SMESH_NumberOfSegments(int hypId, int studyId, SMESH_Gen* gen)
40 : SMESH_Hypothesis(hypId, studyId, gen)
42 _numberOfSegments = 1;
44 _name = "NumberOfSegments";
47 //=============================================================================
51 //=============================================================================
53 SMESH_NumberOfSegments::~SMESH_NumberOfSegments()
57 //=============================================================================
61 //=============================================================================
63 void SMESH_NumberOfSegments::SetNumberOfSegments(int segmentsNumber)
64 throw (SALOME_Exception)
66 int oldNumberOfSegments = _numberOfSegments;
67 if (segmentsNumber <= 0)
68 throw 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()
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()
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)
158 if (isOK) hyp._numberOfSegments = a;
159 else load.clear(ios::badbit | load.rdstate());