1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : HexoticPlugin_Hypothesis_i.cxx
22 // Author : Lioka RAZAFINDRAZAKA (CEA)
25 #include "HexoticPlugin_Hypothesis_i.hxx"
26 #include "SMESH_Mesh_i.hxx"
27 #include "SMESH_Gen.hxx"
28 #include "SMESH_PythonDump.hxx"
30 #include "Utils_CorbaException.hxx"
31 #include "utilities.h"
33 //=============================================================================
35 * HexoticPlugin_Hypothesis_i::HexoticPlugin_Hypothesis_i
39 //=============================================================================
40 HexoticPlugin_Hypothesis_i::
41 HexoticPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
43 ::SMESH_Gen* theGenImpl)
44 : SALOME::GenericObj_i( thePOA ),
45 SMESH_Hypothesis_i( thePOA )
47 MESSAGE( "HexoticPlugin_Hypothesis_i::HexoticPlugin_Hypothesis_i" );
48 myBaseImpl = new ::HexoticPlugin_Hypothesis (theGenImpl->GetANewId(),
53 //=============================================================================
55 * HexoticPlugin_Hypothesis_i::~HexoticPlugin_Hypothesis_i
59 //=============================================================================
60 HexoticPlugin_Hypothesis_i::~HexoticPlugin_Hypothesis_i()
62 MESSAGE( "HexoticPlugin_Hypothesis_i::~HexoticPlugin_Hypothesis_i" );
65 //=============================================================================
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
79 //=============================================================================
81 void HexoticPlugin_Hypothesis_i::SetHexesMinLevel (CORBA::Long theValue)
83 // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexesMinLevel");
85 CORBA::Long oldValue = GetHexesMinLevel();
86 this->GetImpl()->SetHexesMinLevel(theValue);
87 if (theValue != oldValue)
88 SMESH::TPythonDump() << _this() << ".SetHexesMinLevel( " << theValue << " )";
91 void HexoticPlugin_Hypothesis_i::SetHexesMaxLevel (CORBA::Long theValue)
93 // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexesMaxLevel");
95 CORBA::Long oldValue = GetHexesMaxLevel();
96 this->GetImpl()->SetHexesMaxLevel(theValue);
97 if (theValue != oldValue)
98 SMESH::TPythonDump() << _this() << ".SetHexesMaxLevel( " << theValue << " )";
101 void HexoticPlugin_Hypothesis_i::SetMinSize (CORBA::Double theValue)
103 // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexesMaxLevel");
105 CORBA::Double oldValue = GetMinSize();
106 this->GetImpl()->SetMinSize(theValue);
107 if (theValue != oldValue)
108 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theValue << " )";
111 void HexoticPlugin_Hypothesis_i::SetMaxSize (CORBA::Double theValue)
113 // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexesMaxLevel");
115 CORBA::Double oldValue = GetMaxSize();
116 this->GetImpl()->SetMaxSize(theValue);
117 if (theValue != oldValue)
118 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theValue << " )";
121 void HexoticPlugin_Hypothesis_i::SetHexoticIgnoreRidges (CORBA::Boolean theValue)
123 // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticIgnoreRidges");
125 CORBA::Boolean oldValue = GetHexoticIgnoreRidges();
126 this->GetImpl()->SetHexoticIgnoreRidges(theValue);
127 if (theValue != oldValue)
128 SMESH::TPythonDump() << _this() << ".SetHexoticIgnoreRidges( " << theValue << " )";
131 void HexoticPlugin_Hypothesis_i::SetHexoticInvalidElements (CORBA::Boolean theValue)
133 // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticInvalidElements");
135 CORBA::Boolean oldValue = GetHexoticInvalidElements();
136 this->GetImpl()->SetHexoticInvalidElements(theValue);
137 if (theValue != oldValue)
138 SMESH::TPythonDump() << _this() << ".SetHexoticInvalidElements( " << theValue << " )";
141 void HexoticPlugin_Hypothesis_i::SetHexoticSharpAngleThreshold (CORBA::Double theValue)
143 // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticSharpAngleThreshold");
145 CORBA::Double oldValue = GetHexoticSharpAngleThreshold();
146 this->GetImpl()->SetHexoticSharpAngleThreshold(theValue);
147 if (theValue != oldValue)
148 SMESH::TPythonDump() << _this() << ".SetHexoticSharpAngleThreshold( " << theValue << " )";
151 void HexoticPlugin_Hypothesis_i::SetHexoticNbProc (CORBA::Long theValue)
153 // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticNbProc");
155 CORBA::Long oldValue = GetHexoticNbProc();
156 this->GetImpl()->SetHexoticNbProc(theValue);
157 if (theValue != oldValue)
158 SMESH::TPythonDump() << _this() << ".SetHexoticNbProc( " << theValue << " )";
161 void HexoticPlugin_Hypothesis_i::SetHexoticWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception )
164 THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
168 string oldValue(GetHexoticWorkingDirectory());
170 if (oldValue != file)
173 const char lastChar = *file.rbegin();
175 if ( lastChar != '\\' ) file += '\\';
177 if ( lastChar != '/' ) file += '/';
179 file += "Hexotic_In.mesh";
180 SMESH_Mesh_i::PrepareForWriting (file.c_str());
182 this->GetImpl()->SetHexoticWorkingDirectory(path);
184 SMESH::TPythonDump() << _this() << ".SetHexoticWorkingDirectory( '" << path << "' )";
187 void HexoticPlugin_Hypothesis_i::SetHexoticSdMode (CORBA::Long theValue)
189 // MESSAGE("HexoticPlugin_Hypothesis_i::SetHexoticSdMode");
191 CORBA::Long oldValue = GetHexoticSdMode();
192 this->GetImpl()->SetHexoticSdMode(theValue);
193 if (theValue != oldValue)
194 SMESH::TPythonDump() << _this() << ".SetHexoticSdMode( " << theValue << " )";
197 void HexoticPlugin_Hypothesis_i::SetHexoticVerbosity (CORBA::Long theValue)
199 // MESSAGE("HexoticPlugin_Hypothesis_i::SetVerbosity");
201 CORBA::Long oldValue = GetHexoticVerbosity();
202 this->GetImpl()->SetHexoticVerbosity(theValue);
203 if (theValue != oldValue)
204 SMESH::TPythonDump() << _this() << ".SetHexoticVerbosity( " << theValue << " )";
207 //=============================================================================
209 * HexoticPlugin_Hypothesis_i::GetHexesMinLevel
210 * HexoticPlugin_Hypothesis_i::GetHexesMaxLevel
211 * HexoticPlugin_Hypothesis_i::GetMinSize
212 * HexoticPlugin_Hypothesis_i::GetMaxSize
213 * HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges
214 * HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements
215 * HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold
216 * HexoticPlugin_Hypothesis_i::GetHexoticNbProc
217 * HexoticPlugin_Hypothesis_i::GetHexoticWorkingDirectory
218 * HexoticPlugin_Hypothesis_i::GetHexoticSdMode
219 * HexoticPlugin_Hypothesis_i::GetVerbosity
221 //=============================================================================
223 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexesMinLevel()
225 // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexesMinLevel");
227 return this->GetImpl()->GetHexesMinLevel();
230 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexesMaxLevel()
232 // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexesMaxLevel");
234 return this->GetImpl()->GetHexesMaxLevel();
237 CORBA::Double HexoticPlugin_Hypothesis_i::GetMinSize()
239 // MESSAGE("HexoticPlugin_Hypothesis_i::GetMinSize");
241 return this->GetImpl()->GetMinSize();
244 CORBA::Double HexoticPlugin_Hypothesis_i::GetMaxSize()
246 // MESSAGE("HexoticPlugin_Hypothesis_i::GetMaxSize");
248 return this->GetImpl()->GetMaxSize();
251 CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges()
253 // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges");
255 return this->GetImpl()->GetHexoticIgnoreRidges();
258 CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements()
260 // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements");
262 return this->GetImpl()->GetHexoticInvalidElements();
265 CORBA::Double HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold()
267 // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold");
269 return this->GetImpl()->GetHexoticSharpAngleThreshold();
272 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticNbProc()
274 // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticNbProc");
276 return this->GetImpl()->GetHexoticNbProc();
279 char* HexoticPlugin_Hypothesis_i::GetHexoticWorkingDirectory()
282 return CORBA::string_dup( this->GetImpl()->GetHexoticWorkingDirectory().c_str() );
285 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticSdMode ()
287 // MESSAGE("HexoticPlugin_Hypothesis_i::GetHexoticSdMode");
289 return this->GetImpl()->GetHexoticSdMode();
292 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticVerbosity()
294 // MESSAGE("HexoticPlugin_Hypothesis_i::GetVerbosity");
296 return this->GetImpl()->GetHexoticVerbosity();
299 //=============================================================================
301 * HexoticPlugin_Hypothesis_i::GetImpl
305 //=============================================================================
306 ::HexoticPlugin_Hypothesis* HexoticPlugin_Hypothesis_i::GetImpl()
308 // MESSAGE("HexoticPlugin_Hypothesis_i::GetImpl");
309 return (::HexoticPlugin_Hypothesis*)myBaseImpl;
312 //================================================================================
314 * \brief Verify whether hypothesis supports given entity type
315 * \param type - dimension (see SMESH::Dimension enumeration)
316 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
318 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
320 //================================================================================
321 CORBA::Boolean HexoticPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
323 return type == SMESH::DIM_3D;