Salome HOME
This commit was generated by cvs2git to create branch 'IMPORT'.
[modules/smesh.git] / src / SMESH / SMESH_LocalLength.cxx
1 using namespace std;
2 //=============================================================================
3 // File      : SMESH_LocalLength.cxx
4 // Created   : sam mai 18 08:10:23 CEST 2002
5 // Author    : Paul RASCLE, EDF
6 // Project   : SALOME
7 // Copyright : EDF 2002
8 // $Header$
9 //=============================================================================
10 using namespace std;
11
12 #include "SMESH_LocalLength.hxx"
13 #include "utilities.h"
14
15 //=============================================================================
16 /*!
17  *  
18  */
19 //=============================================================================
20
21 SMESH_LocalLength::SMESH_LocalLength(int hypId, int studyId, SMESH_Gen* gen)
22   : SMESH_Hypothesis(hypId, studyId, gen)
23 {
24   _length =1.;
25   _name = "LocalLength";
26 //   SCRUTE(_name);
27 //   SCRUTE(&_name);
28 }
29
30 //=============================================================================
31 /*!
32  *  
33  */
34 //=============================================================================
35
36 SMESH_LocalLength::~SMESH_LocalLength()
37 {
38 }
39
40 //=============================================================================
41 /*!
42  *  
43  */
44 //=============================================================================
45
46 void SMESH_LocalLength::SetLength(double length)
47   throw (SALOME_Exception)
48 {
49   double oldLength = _length;
50   if (length <= 0) 
51     throw SALOME_Exception(LOCALIZED("length must be positive"));
52   _length = length;
53   if (oldLength != _length)
54     NotifySubMeshesHypothesisModification();
55 }
56
57 //=============================================================================
58 /*!
59  *  
60  */
61 //=============================================================================
62
63 double SMESH_LocalLength::GetLength()
64 {
65   return _length;
66 }
67
68 //=============================================================================
69 /*!
70  *  
71  */
72 //=============================================================================
73
74 ostream & SMESH_LocalLength::SaveTo(ostream & save)
75 {
76   return save << this;
77 }
78
79 //=============================================================================
80 /*!
81  *  
82  */
83 //=============================================================================
84
85 istream & SMESH_LocalLength::LoadFrom(istream & load)
86 {
87   return load >> (*this);
88 }
89
90 //=============================================================================
91 /*!
92  *  
93  */
94 //=============================================================================
95
96 ostream & operator << (ostream & save, SMESH_LocalLength & hyp)
97 {
98   save << hyp._length;
99   return save;
100 }
101
102 //=============================================================================
103 /*!
104  *  
105  */
106 //=============================================================================
107
108 istream & operator >> (istream & load, SMESH_LocalLength & hyp)
109 {
110   bool isOK = true;
111   double a;
112   isOK = (load >> a);
113   if (isOK) hyp._length = a;
114   else load.clear(ios::badbit | load.rdstate());
115   return load;
116 }
117