Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[plugins/netgenplugin.git] / src / NETGENPlugin / NETGENPlugin_Hypothesis.hxx
1 //  NETGENPlugin : C++ implementation
2 //
3 //  Copyright (C) 2006  OPEN CASCADE, CEA/DEN, EDF R&D
4 // 
5 //  This library is free software; you can redistribute it and/or 
6 //  modify it under the terms of the GNU Lesser General Public 
7 //  License as published by the Free Software Foundation; either 
8 //  version 2.1 of the License. 
9 // 
10 //  This library is distributed in the hope that it will be useful, 
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
13 //  Lesser General Public License for more details. 
14 // 
15 //  You should have received a copy of the GNU Lesser General Public 
16 //  License along with this library; if not, write to the Free Software 
17 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
18 // 
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 //
21 //
22 // File      : NETGENPlugin_Hypothesis.hxx
23 // Author    : Michael Sazonov (OCN)
24 // Date      : 27/03/2006
25 // Project   : SALOME
26 // $Header$
27 //=============================================================================
28
29 #ifndef _NETGENPlugin_Hypothesis_HXX_
30 #define _NETGENPlugin_Hypothesis_HXX_
31
32 #include "SMESH_Hypothesis.hxx"
33 #include "Utils_SALOME_Exception.hxx"
34
35 //  Parameters for work of NETGEN
36 //
37
38 class NETGENPlugin_Hypothesis: public SMESH_Hypothesis
39 {
40 public:
41
42   NETGENPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen);
43
44   void SetMaxSize(double theSize);
45   double GetMaxSize() const { return _maxSize; }
46
47   void SetSecondOrder(bool theVal);
48   bool GetSecondOrder() const { return _secondOrder; }
49
50   void SetOptimize(bool theVal);
51   bool GetOptimize() const { return _optimize; }
52
53   enum Fineness
54   {
55     VeryCoarse,
56     Coarse,
57     Moderate,
58     Fine,
59     VeryFine,
60     UserDefined
61   };
62
63   void SetFineness(Fineness theFineness);
64   Fineness GetFineness() const { return _fineness; }
65
66   // the following parameters are controlled by Fineness
67
68   void SetGrowthRate(double theRate);
69   double GetGrowthRate() const { return _growthRate; }
70
71   void SetNbSegPerEdge(double theVal);
72   double GetNbSegPerEdge() const { return _nbSegPerEdge; }
73
74   void SetNbSegPerRadius(double theVal);
75   double GetNbSegPerRadius() const { return _nbSegPerRadius; }
76
77   // the default values (taken from NETGEN 4.5 sources)
78
79   static double GetDefaultMaxSize();
80   static Fineness GetDefaultFineness();
81   static double GetDefaultGrowthRate();
82   static double GetDefaultNbSegPerEdge();
83   static double GetDefaultNbSegPerRadius();
84   static bool GetDefaultSecondOrder();
85   static bool GetDefaultOptimize();
86
87   // Persistence
88   virtual ostream & SaveTo(ostream & save);
89   virtual istream & LoadFrom(istream & load);
90   friend ostream & operator <<(ostream & save, NETGENPlugin_Hypothesis & hyp);
91   friend istream & operator >>(istream & load, NETGENPlugin_Hypothesis & hyp);
92
93   /*!
94    * \brief Does nothing
95    * \param theMesh - the built mesh
96    * \param theShape - the geometry of interest
97    * \retval bool - always false
98    */
99   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
100
101 private:
102   double        _maxSize;
103   double        _growthRate;
104   double        _nbSegPerEdge;
105   double        _nbSegPerRadius;
106   Fineness      _fineness;
107   bool          _secondOrder;
108   bool          _optimize;
109 };
110
111 #endif