]> SALOME platform Git repositories - plugins/hexoticplugin.git/blob - src/HexoticPlugin/HexoticPlugin_Hypothesis_i.cxx
Salome HOME
Merge from V6_main 13/12/2012
[plugins/hexoticplugin.git] / src / HexoticPlugin / HexoticPlugin_Hypothesis_i.cxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
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.
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 // ---
21 // File   : HexoticPlugin_Hypothesis_i.cxx
22 // Author : Lioka RAZAFINDRAZAKA (CEA)
23 // ---
24 //
25 #include "HexoticPlugin_Hypothesis_i.hxx"
26 #include "SMESH_Mesh_i.hxx"
27 #include "SMESH_Gen.hxx"
28 #include "SMESH_PythonDump.hxx"
29
30 #include "Utils_CorbaException.hxx"
31 #include "utilities.h"
32
33 //=============================================================================
34 /*!
35  *  HexoticPlugin_Hypothesis_i::HexoticPlugin_Hypothesis_i
36  *
37  *  Constructor
38  */
39 //=============================================================================
40 HexoticPlugin_Hypothesis_i::
41 HexoticPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
42                            int                     theStudyId,
43                            ::SMESH_Gen*            theGenImpl)
44   : SALOME::GenericObj_i( thePOA ), 
45     SMESH_Hypothesis_i( thePOA )
46 {
47   MESSAGE( "HexoticPlugin_Hypothesis_i::HexoticPlugin_Hypothesis_i" );
48   myBaseImpl = new ::HexoticPlugin_Hypothesis (theGenImpl->GetANewId(),
49                                               theStudyId,
50                                               theGenImpl);
51 }
52
53 //=============================================================================
54 /*!
55  *  HexoticPlugin_Hypothesis_i::~HexoticPlugin_Hypothesis_i
56  *
57  *  Destructor
58  */
59 //=============================================================================
60 HexoticPlugin_Hypothesis_i::~HexoticPlugin_Hypothesis_i()
61 {
62   MESSAGE( "HexoticPlugin_Hypothesis_i::~HexoticPlugin_Hypothesis_i" );
63 }
64
65 //=============================================================================
66 /*!
67  *  HexoticPlugin_Hypothesis_i::SetHexesMinLevel
68  *  HexoticPlugin_Hypothesis_i::SetHexesMaxLevel
69  *  HexoticPlugin_Hypothesis_i::SetMinSize
70  *  HexoticPlugin_Hypothesis_i::SetMaxSize
71  *  HexoticPlugin_Hypothesis_i::SetHexoticIgnoreRidges
72  *  HexoticPlugin_Hypothesis_i::SetHexoticInvalidElements
73  *  HexoticPlugin_Hypothesis_i::SetHexoticSharpAngleThreshold
74  *  HexoticPlugin_Hypothesis_i::SetHexoticNbProc 
75  *  HexoticPlugin_Hypothesis_i::SetHexoticWorkingDirectory 
76  *  HexoticPlugin_Hypothesis_i::SetHexoticSdMode
77  *  HexoticPlugin_Hypothesis_i::SetVerbosity
78  *  HexoticPlugin_Hypothesis_i::SetHexoticMaxMemory
79  */
80 //=============================================================================
81
82 void HexoticPlugin_Hypothesis_i::SetHexesMinLevel (CORBA::Long theValue)
83 {
84   // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexesMinLevel");
85   ASSERT(myBaseImpl);
86   CORBA::Long oldValue = GetHexesMinLevel();
87   this->GetImpl()->SetHexesMinLevel(theValue);
88   if (theValue != oldValue)
89     SMESH::TPythonDump() << _this() << ".SetHexesMinLevel( " << theValue << " )";
90 }
91
92 void HexoticPlugin_Hypothesis_i::SetHexesMaxLevel (CORBA::Long theValue)
93 {
94   // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexesMaxLevel");
95   ASSERT(myBaseImpl);
96   CORBA::Long oldValue = GetHexesMaxLevel();
97   this->GetImpl()->SetHexesMaxLevel(theValue);
98   if (theValue != oldValue)
99     SMESH::TPythonDump() << _this() << ".SetHexesMaxLevel( " << theValue << " )";
100 }
101
102 void HexoticPlugin_Hypothesis_i::SetMinSize (CORBA::Double theValue)
103 {
104   // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexesMaxLevel");
105   ASSERT(myBaseImpl);
106   CORBA::Double oldValue = GetMinSize();
107   this->GetImpl()->SetMinSize(theValue);
108   if (theValue != oldValue)
109     SMESH::TPythonDump() << _this() << ".SetMinSize( " << theValue << " )";
110 }
111
112 void HexoticPlugin_Hypothesis_i::SetMaxSize (CORBA::Double theValue)
113 {
114   // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexesMaxLevel");
115   ASSERT(myBaseImpl);
116   CORBA::Double oldValue = GetMaxSize();
117   this->GetImpl()->SetMaxSize(theValue);
118   if (theValue != oldValue)
119     SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theValue << " )";
120 }
121
122 void HexoticPlugin_Hypothesis_i::SetHexoticIgnoreRidges (CORBA::Boolean theValue)
123 {
124   // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticIgnoreRidges");
125   ASSERT(myBaseImpl);
126   CORBA::Boolean oldValue = GetHexoticIgnoreRidges();
127   this->GetImpl()->SetHexoticIgnoreRidges(theValue);
128   if (theValue != oldValue)
129     SMESH::TPythonDump() << _this() << ".SetHexoticIgnoreRidges( " << theValue << " )";
130 }
131
132 void HexoticPlugin_Hypothesis_i::SetHexoticInvalidElements (CORBA::Boolean theValue)
133 {
134   // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticInvalidElements");
135   ASSERT(myBaseImpl);
136   CORBA::Boolean oldValue = GetHexoticInvalidElements();
137   this->GetImpl()->SetHexoticInvalidElements(theValue);
138   if (theValue != oldValue)
139     SMESH::TPythonDump() << _this() << ".SetHexoticInvalidElements( " << theValue << " )";
140 }
141
142 void HexoticPlugin_Hypothesis_i::SetHexoticSharpAngleThreshold (CORBA::Double theValue)
143 {
144   // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticSharpAngleThreshold");
145   ASSERT(myBaseImpl);
146   CORBA::Double oldValue = GetHexoticSharpAngleThreshold();
147   this->GetImpl()->SetHexoticSharpAngleThreshold(theValue);
148   if (theValue != oldValue)
149     SMESH::TPythonDump() << _this() << ".SetHexoticSharpAngleThreshold( " << theValue << " )";
150 }
151
152 void HexoticPlugin_Hypothesis_i::SetHexoticNbProc (CORBA::Long theValue)
153 {
154   // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticNbProc");
155   ASSERT(myBaseImpl);
156   CORBA::Long oldValue = GetHexoticNbProc();
157   this->GetImpl()->SetHexoticNbProc(theValue);
158   if (theValue != oldValue)
159     SMESH::TPythonDump() << _this() << ".SetHexoticNbProc( " << theValue << " )";
160 }
161
162 void HexoticPlugin_Hypothesis_i::SetHexoticWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception )
163 {
164   if (!path )
165     THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
166
167   ASSERT(myBaseImpl);
168   string file(path);
169   string oldValue(GetHexoticWorkingDirectory());
170   bool doDump = false;
171   if (oldValue != file)
172     doDump = true;
173
174   const char lastChar = *file.rbegin();
175 #ifdef WIN32
176   if ( lastChar != '\\' ) file += '\\';
177 #else
178   if ( lastChar != '/' ) file += '/';
179 #endif
180   file += "Hexotic_In.mesh";
181   SMESH_Mesh_i::PrepareForWriting (file.c_str());
182
183   this->GetImpl()->SetHexoticWorkingDirectory(path);
184   if (doDump)
185     SMESH::TPythonDump() << _this() << ".SetHexoticWorkingDirectory( '" << path << "' )";
186 }
187
188 void HexoticPlugin_Hypothesis_i::SetHexoticSdMode (CORBA::Long theValue)
189 {
190   // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticSdMode");
191   ASSERT(myBaseImpl);
192   CORBA::Long oldValue = GetHexoticSdMode();
193   this->GetImpl()->SetHexoticSdMode(theValue);
194   if (theValue != oldValue)
195     SMESH::TPythonDump() << _this() << ".SetHexoticSdMode( " << theValue << " )";
196 }
197
198 void HexoticPlugin_Hypothesis_i::SetHexoticVerbosity (CORBA::Long theValue)
199 {
200   // MESSAGE("HexoticPlugin_Hypothesis_i::SetVerbosity");
201   ASSERT(myBaseImpl);
202   CORBA::Long oldValue = GetHexoticVerbosity();
203   this->GetImpl()->SetHexoticVerbosity(theValue);
204   if (theValue != oldValue)
205     SMESH::TPythonDump() << _this() << ".SetHexoticVerbosity( " << theValue << " )";
206 }
207
208 void HexoticPlugin_Hypothesis_i::SetHexoticMaxMemory (CORBA::Long theValue)
209 {
210   // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticMaxMemory");
211   ASSERT(myBaseImpl);
212   CORBA::Long oldValue = GetHexoticMaxMemory();
213   this->GetImpl()->SetHexoticMaxMemory(theValue);
214   if (theValue != oldValue)
215     SMESH::TPythonDump() << _this() << ".SetHexoticMaxMemory( " << theValue << " )";
216 }
217
218 //=============================================================================
219 /*!
220  *  HexoticPlugin_Hypothesis_i::GetHexesMinLevel
221  *  HexoticPlugin_Hypothesis_i::GetHexesMaxLevel
222  *  HexoticPlugin_Hypothesis_i::GetMinSize
223  *  HexoticPlugin_Hypothesis_i::GetMaxSize
224  *  HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges
225  *  HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements
226  *  HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold 
227  *  HexoticPlugin_Hypothesis_i::GetHexoticNbProc 
228  *  HexoticPlugin_Hypothesis_i::GetHexoticWorkingDirectory 
229  *  HexoticPlugin_Hypothesis_i::GetHexoticSdMode
230  *  HexoticPlugin_Hypothesis_i::GetVerbosity
231  *  HexoticPlugin_Hypothesis_i::GetHexoticMaxMemory
232  */
233 //=============================================================================
234
235 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexesMinLevel()
236 {
237   // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexesMinLevel");
238   ASSERT(myBaseImpl);
239   return this->GetImpl()->GetHexesMinLevel();
240 }
241
242 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexesMaxLevel()
243 {
244   // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexesMaxLevel");
245   ASSERT(myBaseImpl);
246   return this->GetImpl()->GetHexesMaxLevel();
247 }
248
249 CORBA::Double HexoticPlugin_Hypothesis_i::GetMinSize()
250 {
251   // MESSAGE("HexoticPlugin_Hypothesis_i::GetMinSize");
252   ASSERT(myBaseImpl);
253   return this->GetImpl()->GetMinSize();
254 }
255
256 CORBA::Double HexoticPlugin_Hypothesis_i::GetMaxSize()
257 {
258   // MESSAGE("HexoticPlugin_Hypothesis_i::GetMaxSize");
259   ASSERT(myBaseImpl);
260   return this->GetImpl()->GetMaxSize();
261 }
262
263 CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges()
264 {
265   // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges");
266   ASSERT(myBaseImpl);
267   return this->GetImpl()->GetHexoticIgnoreRidges();
268 }
269
270 CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements()
271 {
272   // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements");
273   ASSERT(myBaseImpl);
274   return this->GetImpl()->GetHexoticInvalidElements();
275 }
276
277 CORBA::Double HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold()
278 {
279   // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold");
280   ASSERT(myBaseImpl);
281   return this->GetImpl()->GetHexoticSharpAngleThreshold();
282 }
283
284 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticNbProc()
285 {
286   // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticNbProc");
287   ASSERT(myBaseImpl);
288   return this->GetImpl()->GetHexoticNbProc();
289 }
290
291 char* HexoticPlugin_Hypothesis_i::GetHexoticWorkingDirectory()
292 {
293   ASSERT(myBaseImpl);
294   return CORBA::string_dup( this->GetImpl()->GetHexoticWorkingDirectory().c_str() );
295 }
296
297 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticSdMode ()
298 {
299   // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticSdMode");
300   ASSERT(myBaseImpl);
301   return this->GetImpl()->GetHexoticSdMode();
302 }
303
304 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticVerbosity()
305 {
306   // MESSAGE("HexoticPlugin_Hypothesis_i::GetVerbosity");
307   ASSERT(myBaseImpl);
308   return this->GetImpl()->GetHexoticVerbosity();
309 }
310
311 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticMaxMemory()
312 {
313   // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticMaxMemory");
314   ASSERT(myBaseImpl);
315   return this->GetImpl()->GetHexoticMaxMemory();
316 }
317
318 //=============================================================================
319 /*!
320  *  HexoticPlugin_Hypothesis_i::GetImpl
321  *
322  *  Get implementation
323  */
324 //=============================================================================
325 ::HexoticPlugin_Hypothesis* HexoticPlugin_Hypothesis_i::GetImpl()
326 {
327   // MESSAGE("HexoticPlugin_Hypothesis_i::GetImpl");
328   return (::HexoticPlugin_Hypothesis*)myBaseImpl;
329 }
330
331 //================================================================================
332 /*!
333  * \brief Verify whether hypothesis supports given entity type 
334   * \param type - dimension (see SMESH::Dimension enumeration)
335   * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
336  * 
337  * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
338  */
339 //================================================================================  
340 CORBA::Boolean HexoticPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
341 {
342   return type == SMESH::DIM_3D;
343 }