1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // NETGENPlugin : C++ implementation
24 // File : NETGENPlugin_Hypothesis.hxx
25 // Author : Michael Sazonov (OCN)
29 #ifndef _NETGENPlugin_Hypothesis_HXX_
30 #define _NETGENPlugin_Hypothesis_HXX_
32 #include "NETGENPlugin_Defs.hxx"
34 #include "SMESH_Hypothesis.hxx"
35 #include "Utils_SALOME_Exception.hxx"
39 // Parameters for work of NETGEN
44 class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis: public SMESH_Hypothesis
48 NETGENPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen);
50 void SetMaxSize(double theSize);
51 double GetMaxSize() const { return _maxSize; }
53 void SetMinSize(double theSize);
54 double GetMinSize() const { return _minSize; }
56 void SetSecondOrder(bool theVal);
57 bool GetSecondOrder() const { return _secondOrder; }
59 void SetOptimize(bool theVal);
60 bool GetOptimize() const { return _optimize; }
72 void SetFineness(Fineness theFineness);
73 Fineness GetFineness() const { return _fineness; }
75 // the following parameters are controlled by Fineness
77 void SetGrowthRate(double theRate);
78 double GetGrowthRate() const { return _growthRate; }
80 void SetNbSegPerEdge(double theVal);
81 double GetNbSegPerEdge() const { return _nbSegPerEdge; }
83 void SetNbSegPerRadius(double theVal);
84 double GetNbSegPerRadius() const { return _nbSegPerRadius; }
86 typedef std::map<std::string, double> TLocalSize;
87 static TLocalSize GetDefaultLocalSize() { return TLocalSize(); }
88 void SetLocalSizeOnEntry(const std::string& entry, double localSize);
89 double GetLocalSizeOnEntry(const std::string& entry);
90 const TLocalSize& GetLocalSizesAndEntries() const { return _localSize; }
91 void UnsetLocalSizeOnEntry(const std::string& entry);
93 void SetQuadAllowed(bool theVal);
94 bool GetQuadAllowed() const { return _quadAllowed; }
96 // the default values (taken from NETGEN 4.5 sources)
98 static double GetDefaultMaxSize();
99 static Fineness GetDefaultFineness();
100 static double GetDefaultGrowthRate();
101 static double GetDefaultNbSegPerEdge();
102 static double GetDefaultNbSegPerRadius();
103 static bool GetDefaultSecondOrder();
104 static bool GetDefaultOptimize();
105 static bool GetDefaultQuadAllowed();
108 virtual ostream & SaveTo(ostream & save);
109 virtual istream & LoadFrom(istream & load);
110 friend NETGENPLUGIN_EXPORT ostream & operator <<(ostream & save, NETGENPlugin_Hypothesis & hyp);
111 friend NETGENPLUGIN_EXPORT istream & operator >>(istream & load, NETGENPlugin_Hypothesis & hyp);
114 * \brief Does nothing
115 * \param theMesh - the built mesh
116 * \param theShape - the geometry of interest
117 * \retval bool - always false
119 virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
122 * \brief Initialize my parameter values by default parameters.
123 * \retval bool - true if parameter values have been successfully defined
125 virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
128 double _maxSize, _minSize;
130 double _nbSegPerEdge;
131 double _nbSegPerRadius;
135 TLocalSize _localSize;