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