Salome HOME
Merge from V6_main 01/04/2013
[modules/smesh.git] / src / StdMeshers / StdMeshers_MaxLength.hxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 //  SMESH SMESH : implementaion of SMESH idl descriptions
21 //  File   : StdMeshers_MaxLength.hxx
22 //  Module : SMESH
23 //
24 #ifndef _SMESH_MaxLength_HXX_
25 #define _SMESH_MaxLength_HXX_
26
27 #include "SMESH_StdMeshers.hxx"
28
29 #include "SMESH_Hypothesis.hxx"
30 #include "Utils_SALOME_Exception.hxx"
31
32 class STDMESHERS_EXPORT StdMeshers_MaxLength: public SMESH_Hypothesis
33 {
34  public:
35   StdMeshers_MaxLength(int hypId, int studyId, SMESH_Gen * gen);
36   virtual ~ StdMeshers_MaxLength();
37
38   void SetLength(double length) throw(SALOME_Exception);
39   double GetLength() const;
40
41   bool HavePreestimatedLength() const  { return _preestimated > 0.; }
42   double GetPreestimatedLength() const { return _preestimated; }
43   void SetPreestimatedLength(double length);
44
45   void SetUsePreestimatedLength(bool toUse);
46   bool GetUsePreestimatedLength() const;
47
48   virtual std::ostream & SaveTo(std::ostream & save);
49   virtual std::istream & LoadFrom(std::istream & load);
50
51   /*!
52    * \brief Initialize segment length by the mesh built on the geometry
53    * \param theMesh - the built mesh
54    * \param theShape - the geometry of interest
55    * \retval bool - true if parameter values have been successfully defined
56    */
57   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
58
59   /*!
60    * \brief Initialize my parameter values by default parameters.
61    *  \retval bool - true if parameter values have been successfully defined
62    */
63   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
64
65  protected:
66   double _length, _preestimated;
67   bool   _preestimation;
68 };
69
70 #endif