1 // File : GHS3DPlugin_Hypothesis_i.cxx
2 // Created : Wed Apr 2 13:53:01 2008
3 // Author : Edward AGAPOV (eap)
6 #include "GHS3DPlugin_Hypothesis_i.hxx"
8 #include <SMESH_Gen.hxx>
9 #include <SMESH_PythonDump.hxx>
11 #include <Utils_CorbaException.hxx>
12 #include <utilities.h>
13 #include <SMESH_Mesh_i.hxx>
15 //=======================================================================
16 //function : GHS3DPlugin_Hypothesis_i
17 //=======================================================================
19 GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
21 ::SMESH_Gen* theGenImpl)
22 : SALOME::GenericObj_i( thePOA ),
23 SMESH_Hypothesis_i( thePOA )
25 MESSAGE( "GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i" );
26 myBaseImpl = new ::GHS3DPlugin_Hypothesis (theGenImpl->GetANewId(),
31 //=======================================================================
32 //function : ~GHS3DPlugin_Hypothesis_i
33 //=======================================================================
35 GHS3DPlugin_Hypothesis_i::~GHS3DPlugin_Hypothesis_i()
37 MESSAGE( "GHS3DPlugin_Hypothesis_i::~GHS3DPlugin_Hypothesis_i" );
40 //=======================================================================
41 //function : SetToMeshHoles
42 //=======================================================================
44 void GHS3DPlugin_Hypothesis_i::SetToMeshHoles(CORBA::Boolean toMesh)
47 this->GetImpl()->SetToMeshHoles(toMesh);
48 SMESH::TPythonDump() << _this() << ".SetToMeshHoles( " << toMesh << " )";
51 //=======================================================================
52 //function : GetToMeshHoles
53 //=======================================================================
55 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMeshHoles()
58 return this->GetImpl()->GetToMeshHoles();
61 //=======================================================================
62 //function : SetMaximumMemory
63 //=======================================================================
65 void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Short MB)
66 throw ( SALOME::SALOME_Exception )
69 THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
71 this->GetImpl()->SetMaximumMemory(MB);
72 SMESH::TPythonDump() << _this() << ".SetMaximumMemory( " << MB << " )";
75 //=======================================================================
76 //function : GetMaximumMemory
77 //=======================================================================
79 CORBA::Short GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
82 return this->GetImpl()->GetMaximumMemory();
85 //=======================================================================
86 //function : SetInitialMemory
87 //=======================================================================
89 void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Short MB)
90 throw ( SALOME::SALOME_Exception )
93 THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
95 this->GetImpl()->SetInitialMemory(MB);
96 SMESH::TPythonDump() << _this() << ".SetInitialMemory( " << MB << " )";
99 //=======================================================================
100 //function : GetInitialMemory
101 //=======================================================================
103 CORBA::Short GHS3DPlugin_Hypothesis_i::GetInitialMemory()
106 return this->GetImpl()->GetInitialMemory();
109 //=======================================================================
110 //function : SetOptimizationLevel
111 //=======================================================================
113 void GHS3DPlugin_Hypothesis_i::SetOptimizationLevel(CORBA::Short level)
114 throw ( SALOME::SALOME_Exception )
116 ::GHS3DPlugin_Hypothesis::OptimizationLevel l =
117 (::GHS3DPlugin_Hypothesis::OptimizationLevel) level;
118 if ( l < ::GHS3DPlugin_Hypothesis::None ||
119 l > ::GHS3DPlugin_Hypothesis::Strong )
120 THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
123 this->GetImpl()->SetOptimizationLevel(l);
124 SMESH::TPythonDump() << _this() << ".SetOptimizationLevel( " << level << " )";
127 //=======================================================================
128 //function : GetOptimizationLevel
129 //=======================================================================
131 CORBA::Short GHS3DPlugin_Hypothesis_i::GetOptimizationLevel()
134 return this->GetImpl()->GetOptimizationLevel();
137 //=======================================================================
138 //function : SetWorkingDirectory
139 //=======================================================================
141 void GHS3DPlugin_Hypothesis_i::SetWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception )
144 THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
147 const char lastChar = *file.rbegin();
149 if ( lastChar != '\\' ) file += '\\';
151 if ( lastChar != '/' ) file += '/';
154 SMESH_Mesh_i::PrepareForWriting (file.c_str());
157 this->GetImpl()->SetWorkingDirectory(path);
158 SMESH::TPythonDump() << _this() << ".SetWorkingDirectory( '" << path << "' )";
161 //=======================================================================
162 //function : GetWorkingDirectory
163 //=======================================================================
165 char* GHS3DPlugin_Hypothesis_i::GetWorkingDirectory()
168 return CORBA::string_dup( this->GetImpl()->GetWorkingDirectory().c_str() );
171 //=======================================================================
172 //function : SetKeepFiles
173 //=======================================================================
175 void GHS3DPlugin_Hypothesis_i::SetKeepFiles(CORBA::Boolean toKeep)
178 this->GetImpl()->SetKeepFiles(toKeep);
179 SMESH::TPythonDump() << _this() << ".SetKeepFiles( " << toKeep << " )";
182 //=======================================================================
183 //function : GetKeepFiles
184 //=======================================================================
186 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetKeepFiles()
189 return this->GetImpl()->GetKeepFiles();
192 //=======================================================================
193 //function : SetVerboseLevel
194 //=======================================================================
196 void GHS3DPlugin_Hypothesis_i::SetVerboseLevel(CORBA::Short level)
197 throw ( SALOME::SALOME_Exception )
199 if (level < 0 || level > 10 )
200 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbose level, valid range is [0-10]",
203 this->GetImpl()->SetVerboseLevel(level);
204 SMESH::TPythonDump() << _this() << ".SetVerboseLevel( " << level << " )";
207 //=======================================================================
208 //function : GetVerboseLevel
209 //=======================================================================
211 CORBA::Short GHS3DPlugin_Hypothesis_i::GetVerboseLevel()
214 return this->GetImpl()->GetVerboseLevel();
217 //=======================================================================
218 //function : SetToCreateNewNodes
219 //=======================================================================
221 void GHS3DPlugin_Hypothesis_i::SetToCreateNewNodes(CORBA::Boolean toCreate)
224 this->GetImpl()->SetToCreateNewNodes(toCreate);
225 SMESH::TPythonDump() << _this() << ".SetToCreateNewNodes( " << toCreate << " )";
228 //=======================================================================
229 //function : GetToCreateNewNodes
230 //=======================================================================
232 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToCreateNewNodes()
235 return this->GetImpl()->GetToCreateNewNodes();
238 //=======================================================================
239 //function : SetToUseBoundaryRecoveryVersion
240 //=======================================================================
242 void GHS3DPlugin_Hypothesis_i::SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse)
245 this->GetImpl()->SetToUseBoundaryRecoveryVersion(toUse);
246 SMESH::TPythonDump() << _this() << ".SetToUseBoundaryRecoveryVersion( " << toUse << " )";
249 //=======================================================================
250 //function : GetToUseBoundaryRecoveryVersion
251 //=======================================================================
253 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToUseBoundaryRecoveryVersion()
256 return this->GetImpl()->GetToUseBoundaryRecoveryVersion();
259 //=======================================================================
260 //function : SetTextOption
261 //=======================================================================
263 void GHS3DPlugin_Hypothesis_i::SetTextOption(const char* option)
266 this->GetImpl()->SetTextOption(option);
267 SMESH::TPythonDump() << _this() << ".SetTextOption( '" << option << "' )";
270 //=======================================================================
271 //function : GetTextOption
272 //=======================================================================
274 char* GHS3DPlugin_Hypothesis_i::GetTextOption()
277 return CORBA::string_dup( this->GetImpl()->GetTextOption().c_str() );
280 //=============================================================================
284 //=============================================================================
286 ::GHS3DPlugin_Hypothesis* GHS3DPlugin_Hypothesis_i::GetImpl()
288 return (::GHS3DPlugin_Hypothesis*)myBaseImpl;
291 //================================================================================
293 * \brief Verify whether hypothesis supports given entity type
295 //================================================================================
297 CORBA::Boolean GHS3DPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
299 return type == SMESH::DIM_3D;