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