Salome HOME
Merge from V5_1_4_BR 07/05/2010
[plugins/netgenplugin.git] / src / NETGENPlugin / NETGENPlugin_Hypothesis.hxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  NETGENPlugin : C++ implementation
24 // File      : NETGENPlugin_Hypothesis.hxx
25 // Author    : Michael Sazonov (OCN)
26 // Date      : 27/03/2006
27 // Project   : SALOME
28 //
29 #ifndef _NETGENPlugin_Hypothesis_HXX_
30 #define _NETGENPlugin_Hypothesis_HXX_
31
32 #include "NETGENPlugin_Defs.hxx"
33
34 #include "SMESH_Hypothesis.hxx"
35 #include "Utils_SALOME_Exception.hxx"
36
37 //  Parameters for work of NETGEN
38 //
39
40 using namespace std;
41
42 class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis: public SMESH_Hypothesis
43 {
44 public:
45
46   NETGENPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen);
47
48   void SetMaxSize(double theSize);
49   double GetMaxSize() const { return _maxSize; }
50
51   void SetSecondOrder(bool theVal);
52   bool GetSecondOrder() const { return _secondOrder; }
53
54   void SetOptimize(bool theVal);
55   bool GetOptimize() const { return _optimize; }
56
57   enum Fineness
58   {
59     VeryCoarse,
60     Coarse,
61     Moderate,
62     Fine,
63     VeryFine,
64     UserDefined
65   };
66
67   void SetFineness(Fineness theFineness);
68   Fineness GetFineness() const { return _fineness; }
69
70   // the following parameters are controlled by Fineness
71
72   void SetGrowthRate(double theRate);
73   double GetGrowthRate() const { return _growthRate; }
74
75   void SetNbSegPerEdge(double theVal);
76   double GetNbSegPerEdge() const { return _nbSegPerEdge; }
77
78   void SetNbSegPerRadius(double theVal);
79   double GetNbSegPerRadius() const { return _nbSegPerRadius; }
80
81   // the default values (taken from NETGEN 4.5 sources)
82
83   static double GetDefaultMaxSize();
84   static Fineness GetDefaultFineness();
85   static double GetDefaultGrowthRate();
86   static double GetDefaultNbSegPerEdge();
87   static double GetDefaultNbSegPerRadius();
88   static bool GetDefaultSecondOrder();
89   static bool GetDefaultOptimize();
90
91   // Persistence
92   virtual ostream & SaveTo(ostream & save);
93   virtual istream & LoadFrom(istream & load);
94   friend NETGENPLUGIN_EXPORT ostream & operator <<(ostream & save, NETGENPlugin_Hypothesis & hyp);
95   friend NETGENPLUGIN_EXPORT istream & operator >>(istream & load, NETGENPlugin_Hypothesis & hyp);
96
97   /*!
98    * \brief Does nothing
99    * \param theMesh - the built mesh
100    * \param theShape - the geometry of interest
101    * \retval bool - always false
102    */
103   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
104
105   /*!
106    * \brief Initialize my parameter values by default parameters.
107    *  \retval bool - true if parameter values have been successfully defined
108    */
109   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
110
111 private:
112   double        _maxSize;
113   double        _growthRate;
114   double        _nbSegPerEdge;
115   double        _nbSegPerRadius;
116   Fineness      _fineness;
117   bool          _secondOrder;
118   bool          _optimize;
119 };
120
121 #endif