Salome HOME
Update copyrights
[plugins/netgenplugin.git] / src / NETGENPlugin / NETGENPlugin_SimpleHypothesis_2D.hxx
1 // Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 //  NETGENPlugin : C++ implementation
21 // File      : NETGENPlugin_SimpleHypothesis_2D.hxx
22 // Author    : Edward AGAPOV
23 // Project   : SALOME
24 //=============================================================================
25 //
26 #ifndef _NETGENPlugin_SimpleHypothesis_2D_HXX_
27 #define _NETGENPlugin_SimpleHypothesis_2D_HXX_
28
29 #include "NETGENPlugin_Defs.hxx"
30
31 #include "SMESH_Hypothesis.hxx"
32 #include "Utils_SALOME_Exception.hxx"
33
34 //  Simplified parameters of NETGEN
35 //
36
37 using namespace std;
38
39 class NETGENPLUGIN_EXPORT NETGENPlugin_SimpleHypothesis_2D: public SMESH_Hypothesis
40 {
41 public:
42
43   NETGENPlugin_SimpleHypothesis_2D(int hypId, SMESH_Gen * gen);
44
45   /*!
46    * Sets <number of segments> value
47    */
48   void SetNumberOfSegments(int nb) throw (SALOME_Exception);
49   /*!
50    * Returns <number of segments> value.
51    * Can be zero in case if LocalLength() has been set
52    */
53   int GetNumberOfSegments() const { return _nbSegments; }
54
55   /*!
56    * Sets <segment length> value
57    */
58   void SetLocalLength(double segmentLength) throw (SALOME_Exception);
59   /*!
60    * Returns <segment length> value.
61    * Can be zero in case if NumberOfSegments() has been set
62    */
63   double GetLocalLength() const { return _segmentLength; }
64
65   /*!
66    * Sets <maximum element area> to be dependent on 1D discretization
67    */
68   void LengthFromEdges();
69
70   /*!
71    * Sets <maximum element area> value.
72    * Zero or negative value means same as LengthFromEdges().
73    */
74   void SetMaxElementArea(double area);
75   /*!
76    * Returns <maximum element area> value.
77    * Can be zero in case of LengthFromEdges()
78    */
79   double GetMaxElementArea() const { return _area; }
80
81   /*!
82    * Enables/disables generation of quadrangular faces
83    */
84   void SetAllowQuadrangles(bool toAllow);
85   /*!
86    * Returns true if generation of quadrangular faces is enabled
87    */
88   bool GetAllowQuadrangles() const;
89
90   // Persistence
91   virtual ostream & SaveTo(ostream & save);
92   virtual istream & LoadFrom(istream & load);
93
94   /*!
95    * \brief Set parameters by mesh
96    * \param theMesh - the built mesh
97    * \param theShape - the geometry of interest
98    * \retval bool - true if theShape is meshed
99    */
100   virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape);
101
102   /*!
103    * \brief Initialize my parameter values by default parameters.
104    *  \retval bool - true if parameter values have been successfully defined
105    */
106   virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
107
108 private:
109   int    _nbSegments;
110   double _segmentLength, _area;
111   bool   _allowQuad;
112 };
113
114 #endif