]> SALOME platform Git repositories - plugins/netgenplugin.git/blob - src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.cxx
Salome HOME
0019296: EDF 681 SMESH - Pre-evaluation of the number of elements before mesh
[plugins/netgenplugin.git] / src / NETGENPlugin / NETGENPlugin_SimpleHypothesis_2D_i.cxx
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_SimpleHypothesis_2D_i.cxx
24 // Author    : Edward AGAPOV
25 // Project   : SALOME
26 //=============================================================================
27 //
28 #include "NETGENPlugin_SimpleHypothesis_2D_i.hxx"
29 #include "NETGENPlugin_SimpleHypothesis_2D.hxx"
30
31 #include <SMESH_Gen.hxx>
32 #include <SMESH_PythonDump.hxx>
33
34 #include <Utils_CorbaException.hxx>
35 #include <utilities.h>
36
37 using namespace std;
38
39 //=============================================================================
40 /*!
41  *  NETGENPlugin_SimpleHypothesis_2D_i::NETGENPlugin_SimpleHypothesis_2D_i
42  *
43  *  Constructor
44  */
45 //=============================================================================
46 NETGENPlugin_SimpleHypothesis_2D_i::
47 NETGENPlugin_SimpleHypothesis_2D_i (PortableServer::POA_ptr thePOA,
48                                     int                     theStudyId,
49                                     ::SMESH_Gen*            theGenImpl)
50   : SALOME::GenericObj_i( thePOA ),
51     SMESH_Hypothesis_i( thePOA )
52 {
53   MESSAGE( "NETGENPlugin_SimpleHypothesis_2D_i::NETGENPlugin_SimpleHypothesis_2D_i" );
54   myBaseImpl = new ::NETGENPlugin_SimpleHypothesis_2D (theGenImpl->GetANewId(),
55                                                        theStudyId,
56                                                        theGenImpl);
57 }
58
59 //=============================================================================
60 /*!
61  *  NETGENPlugin_SimpleHypothesis_2D_i::~NETGENPlugin_SimpleHypothesis_2D_i
62  *
63  *  Destructor
64  */
65 //=============================================================================
66 NETGENPlugin_SimpleHypothesis_2D_i::~NETGENPlugin_SimpleHypothesis_2D_i()
67 {
68   MESSAGE( "NETGENPlugin_SimpleHypothesis_2D_i::~NETGENPlugin_SimpleHypothesis_2D_i" );
69 }
70
71 //=============================================================================
72 /*!
73  *  NETGENPlugin_SimpleHypothesis_2D_i::SetNumberOfSegments
74  */
75 //=============================================================================
76 void NETGENPlugin_SimpleHypothesis_2D_i::SetNumberOfSegments(CORBA::Short nb)
77   throw ( SALOME::SALOME_Exception )
78 {
79   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::SetNumberOfSegments");
80   ASSERT(myBaseImpl);
81   try {
82     this->GetImpl()->SetNumberOfSegments(nb);
83   }
84   catch (SALOME_Exception& S_ex) {
85     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
86   }
87   SMESH::TPythonDump() << _this() << ".SetNumberOfSegments( " << nb << " )";
88 }
89
90 //=============================================================================
91 /*!
92  *  NETGENPlugin_SimpleHypothesis_2D_i::GetNumberOfSegments()
93  */
94 //=============================================================================
95 CORBA::Short NETGENPlugin_SimpleHypothesis_2D_i::GetNumberOfSegments()
96 {
97   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::GetNumberOfSegments");
98   ASSERT(myBaseImpl);
99   return this->GetImpl()->GetNumberOfSegments();
100 }
101
102 //================================================================================
103 /*!
104  * LocalLength()
105  */
106 //================================================================================
107
108 void NETGENPlugin_SimpleHypothesis_2D_i::SetLocalLength(CORBA::Double segmentLength)
109 {
110   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::SetLocalLength");
111   ASSERT(myBaseImpl);
112   try {
113     this->GetImpl()->SetLocalLength(segmentLength);
114   }
115   catch (SALOME_Exception& S_ex) {
116     THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
117   }
118   SMESH::TPythonDump() << _this() << ".SetLocalLength( " << segmentLength << " )";
119 }
120
121 //================================================================================
122 /*!
123  * GetLocalLength()
124  */
125 //================================================================================
126
127 CORBA::Double NETGENPlugin_SimpleHypothesis_2D_i::GetLocalLength()
128 {
129   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::GetLocalLength");
130   ASSERT(myBaseImpl);
131   return this->GetImpl()->GetLocalLength();
132 }
133
134 //=============================================================================
135 /*!
136  *  NETGENPlugin_SimpleHypothesis_2D_i::LengthFromEdges()
137  */
138 //=============================================================================
139 void NETGENPlugin_SimpleHypothesis_2D_i::LengthFromEdges()
140 {
141   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::LengthFromEdges");
142   ASSERT(myBaseImpl);
143   this->GetImpl()->LengthFromEdges();
144   SMESH::TPythonDump() << _this() << ".LengthFromEdges()";
145 }
146
147 //=============================================================================
148 /*!
149  *  NETGENPlugin_SimpleHypothesis_2D_i::SetMaxElementArea()
150  */
151 //=============================================================================
152 void NETGENPlugin_SimpleHypothesis_2D_i::SetMaxElementArea(CORBA::Double area)
153 {
154   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::SetMaxElementArea");
155   ASSERT(myBaseImpl);
156   this->GetImpl()->SetMaxElementArea(area);
157   SMESH::TPythonDump() << _this() << ".SetMaxElementArea( " << area << " )";
158 }
159
160
161 //=============================================================================
162 /*!
163  *  NETGENPlugin_SimpleHypothesis_2D_i::GetMaxElementArea()
164  */
165 //=============================================================================
166 CORBA::Double NETGENPlugin_SimpleHypothesis_2D_i::GetMaxElementArea()
167 {
168   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::GetMaxElementArea");
169   ASSERT(myBaseImpl);
170   return this->GetImpl()->GetMaxElementArea();
171 }
172 //=============================================================================
173 /*!
174  *  NETGENPlugin_SimpleHypothesis_2D_i::GetImpl
175  */
176 //=============================================================================
177 ::NETGENPlugin_SimpleHypothesis_2D* NETGENPlugin_SimpleHypothesis_2D_i::GetImpl()
178 {
179   MESSAGE("NETGENPlugin_SimpleHypothesis_2D_i::GetImpl");
180   return (::NETGENPlugin_SimpleHypothesis_2D*)myBaseImpl;
181 }
182
183 //================================================================================
184 /*!
185  * \brief Verify whether hypothesis supports given entity type 
186   * \param type - dimension (see SMESH::Dimension enumeration)
187   * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
188  * 
189  * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
190  */
191 //================================================================================  
192 CORBA::Boolean NETGENPlugin_SimpleHypothesis_2D_i::IsDimSupported( SMESH::Dimension type )
193 {
194   return type == SMESH::DIM_2D;
195 }