Salome HOME
fix the bug 8924: correct edges orientation definition, remove unused variables
[modules/smesh.git] / src / StdMeshers / StdMeshers_MaxElementVolume.cxx
1 //  SMESH SMESH : implementaion of SMESH idl descriptions
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : StdMeshers_MaxElementVolume.cxx
25 //           Moved here from SMESH_MaxElementVolume.cxx
26 //  Author : Paul RASCLE, EDF
27 //  Module : SMESH
28 //  $Header$
29
30 using namespace std;
31
32 #include "StdMeshers_MaxElementVolume.hxx"
33 #include "utilities.h"
34
35 //=============================================================================
36 /*!
37  *  
38  */
39 //=============================================================================
40
41 StdMeshers_MaxElementVolume::StdMeshers_MaxElementVolume(int hypId, int studyId, SMESH_Gen* gen)
42   : SMESH_Hypothesis(hypId, studyId, gen)
43 {
44   _maxVolume =1.;
45   _name = "MaxElementVolume";
46 //   SCRUTE(_name);
47   SCRUTE(&_name);
48   _param_algo_dim = 3;
49 }
50
51 //=============================================================================
52 /*!
53  *  
54  */
55 //=============================================================================
56
57 StdMeshers_MaxElementVolume::~StdMeshers_MaxElementVolume()
58 {
59   MESSAGE("StdMeshers_MaxElementVolume::~StdMeshers_MaxElementVolume");
60 }
61
62 //=============================================================================
63 /*!
64  *  
65  */
66 //=============================================================================
67
68 void StdMeshers_MaxElementVolume::SetMaxVolume(double maxVolume)
69   throw (SALOME_Exception)
70 {
71   double oldVolume = _maxVolume;
72   if (maxVolume <= 0) 
73     throw SALOME_Exception(LOCALIZED("maxVolume must be positive"));
74   _maxVolume = maxVolume;
75   if (_maxVolume != oldVolume)
76     NotifySubMeshesHypothesisModification();
77 }
78
79 //=============================================================================
80 /*!
81  *  
82  */
83 //=============================================================================
84
85 double StdMeshers_MaxElementVolume::GetMaxVolume() const
86 {
87   return _maxVolume;
88 }
89
90 //=============================================================================
91 /*!
92  *  
93  */
94 //=============================================================================
95
96 ostream & StdMeshers_MaxElementVolume::SaveTo(ostream & save)
97 {
98   save << this->_maxVolume;
99   return save;
100 }
101
102 //=============================================================================
103 /*!
104  *  
105  */
106 //=============================================================================
107
108 istream & StdMeshers_MaxElementVolume::LoadFrom(istream & load)
109 {
110   bool isOK = true;
111   double a;
112   isOK = (load >> a);
113   if (isOK)
114     this->_maxVolume = a;
115   else 
116     load.clear(ios::badbit | load.rdstate());
117   return load;
118 }
119
120 //=============================================================================
121 /*!
122  *  
123  */
124 //=============================================================================
125
126 ostream & operator << (ostream & save, StdMeshers_MaxElementVolume & hyp)
127 {
128   return hyp.SaveTo( save );
129 }
130
131 //=============================================================================
132 /*!
133  *  
134  */
135 //=============================================================================
136
137 istream & operator >> (istream & load, StdMeshers_MaxElementVolume & hyp)
138 {
139   return hyp.LoadFrom( load );
140 }
141