Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "StdMeshers_NumberOfSegments_i.hxx"
00031 #include "SMESH_Gen_i.hxx"
00032 #include "SMESH_Gen.hxx"
00033 #include "SMESH_PythonDump.hxx"
00034
00035 #include "Utils_CorbaException.hxx"
00036 #include "utilities.h"
00037
00038 #include <TCollection_AsciiString.hxx>
00039
00040 using namespace std;
00041
00047
00048
00049 StdMeshers_NumberOfSegments_i::StdMeshers_NumberOfSegments_i( PortableServer::POA_ptr thePOA,
00050 int theStudyId,
00051 ::SMESH_Gen* theGenImpl )
00052 : SALOME::GenericObj_i( thePOA ),
00053 SMESH_Hypothesis_i( thePOA )
00054 {
00055 MESSAGE( "StdMeshers_NumberOfSegments_i::StdMeshers_NumberOfSegments_i" );
00056 myBaseImpl = new ::StdMeshers_NumberOfSegments( theGenImpl->GetANewId(),
00057 theStudyId,
00058 theGenImpl );
00059 }
00060
00061
00067
00068
00069 StdMeshers_NumberOfSegments_i::~StdMeshers_NumberOfSegments_i()
00070 {
00071 MESSAGE( "StdMeshers_NumberOfSegments_i::~StdMeshers_NumberOfSegments_i" );
00072 }
00073
00074
00080
00081 SMESH::double_array* StdMeshers_NumberOfSegments_i::BuildDistributionExpr( const char* func,
00082 CORBA::Long nbSeg,
00083 CORBA::Long conv )
00084 throw ( SALOME::SALOME_Exception )
00085 {
00086 ASSERT( myBaseImpl );
00087 try
00088 {
00089 SMESH::double_array_var aRes = new SMESH::double_array();
00090 const std::vector<double>& res = this->GetImpl()->BuildDistributionExpr( func, nbSeg, conv );
00091 aRes->length( res.size() );
00092 for (int i = 0; i < res.size(); i++)
00093 aRes[i] = res[i];
00094 return aRes._retn();
00095 }
00096 catch( SALOME_Exception& S_ex )
00097 {
00098 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
00099 }
00100 }
00101
00102 SMESH::double_array* StdMeshers_NumberOfSegments_i::BuildDistributionTab( const SMESH::double_array& func,
00103 CORBA::Long nbSeg,
00104 CORBA::Long conv )
00105 throw ( SALOME::SALOME_Exception )
00106 {
00107 ASSERT( myBaseImpl );
00108
00109 std::vector<double> tbl( func.length() );
00110 for (int i = 0; i < func.length(); i++)
00111 tbl[i] = func[i];
00112
00113 try
00114 {
00115 SMESH::double_array_var aRes = new SMESH::double_array();
00116 const std::vector<double>& res = this->GetImpl()->BuildDistributionTab( tbl, nbSeg, conv );
00117 aRes->length( res.size() );
00118 for (int i = 0; i < res.size(); i++)
00119 aRes[i] = res[i];
00120 return aRes._retn();
00121 }
00122 catch( SALOME_Exception& S_ex )
00123 {
00124 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
00125 }
00126 }
00127
00128
00134
00135
00136 void StdMeshers_NumberOfSegments_i::SetNumberOfSegments( CORBA::Long theSegmentsNumber )
00137 throw ( SALOME::SALOME_Exception )
00138 {
00139 ASSERT( myBaseImpl );
00140 try {
00141 this->GetImpl()->SetNumberOfSegments( theSegmentsNumber );
00142 }
00143 catch (SALOME_Exception& S_ex) {
00144 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00145 SALOME::BAD_PARAM );
00146 }
00147
00148
00149 SMESH::TPythonDump() << _this() << ".SetNumberOfSegments( " << theSegmentsNumber << " )";
00150 }
00151
00152
00158
00159
00160 CORBA::Long StdMeshers_NumberOfSegments_i::GetNumberOfSegments()
00161 {
00162 ASSERT( myBaseImpl );
00163 return this->GetImpl()->GetNumberOfSegments();
00164 }
00165
00166
00172
00173
00174 void StdMeshers_NumberOfSegments_i::SetReversedEdges( const SMESH::long_array& theIds )
00175 {
00176 ASSERT( myBaseImpl );
00177 try {
00178 std::vector<int> ids( theIds.length() );
00179 CORBA::Long iEnd = theIds.length();
00180 for ( CORBA::Long i = 0; i < iEnd; i++ )
00181 ids[ i ] = theIds[ i ];
00182
00183 this->GetImpl()->SetReversedEdges( ids );
00184 }
00185 catch ( SALOME_Exception& S_ex ) {
00186 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00187 SALOME::BAD_PARAM );
00188 }
00189
00190
00191 SMESH::TPythonDump() << _this() << ".SetReversedEdges( " << theIds << " )";
00192 }
00193
00194
00200
00201
00202 void StdMeshers_NumberOfSegments_i::SetObjectEntry( const char* theEntry )
00203 {
00204 ASSERT( myBaseImpl );
00205 string entry(theEntry);
00206 try {
00207 this->GetImpl()->SetObjectEntry( entry.c_str() );
00208 }
00209 catch ( SALOME_Exception& S_ex ) {
00210 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00211 SALOME::BAD_PARAM );
00212 }
00213
00214 SMESH::TPythonDump() << _this() << ".SetObjectEntry( \"" << entry.c_str() << "\" )";
00215 }
00216
00217
00223
00224
00225 char* StdMeshers_NumberOfSegments_i::GetObjectEntry()
00226 {
00227 ASSERT( myBaseImpl );
00228
00229 const char* entry;
00230 try {
00231 entry = this->GetImpl()->GetObjectEntry();
00232 }
00233 catch ( SALOME_Exception& S_ex ) {
00234 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00235 SALOME::BAD_PARAM );
00236 }
00237 return CORBA::string_dup( entry );
00238 }
00239
00240
00246
00247
00248 SMESH::long_array* StdMeshers_NumberOfSegments_i::GetReversedEdges()
00249 {
00250 MESSAGE( "StdMeshers_NumberOfSegments_i::GetReversedEdges" );
00251 ASSERT( myBaseImpl );
00252 SMESH::long_array_var anArray = new SMESH::long_array;
00253 std::vector<int> ids = this->GetImpl()->GetReversedEdges();
00254 anArray->length( ids.size() );
00255 for ( CORBA::Long i = 0; i < ids.size(); i++)
00256 anArray [ i ] = ids [ i ];
00257
00258 return anArray._retn();
00259 }
00260
00261
00264
00265
00266 void StdMeshers_NumberOfSegments_i::SetDistrType(CORBA::Long typ)
00267 throw ( SALOME::SALOME_Exception )
00268 {
00269 ASSERT( myBaseImpl );
00270 try {
00271 this->GetImpl()->SetDistrType( (::StdMeshers_NumberOfSegments::DistrType) typ );
00272
00273
00274 SMESH::TPythonDump() << _this() << ".SetDistrType( " << typ << " )";
00275 }
00276 catch ( SALOME_Exception& S_ex ) {
00277 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00278 SALOME::BAD_PARAM );
00279 }
00280 }
00281
00282
00285
00286
00287 CORBA::Long StdMeshers_NumberOfSegments_i::GetDistrType()
00288 {
00289 ASSERT( myBaseImpl );
00290 return this->GetImpl()->GetDistrType();
00291 }
00292
00293
00299
00300
00301 void StdMeshers_NumberOfSegments_i::SetScaleFactor( CORBA::Double theScaleFactor )
00302 throw ( SALOME::SALOME_Exception )
00303 {
00304 ASSERT( myBaseImpl );
00305 try {
00306 this->GetImpl()->SetScaleFactor( theScaleFactor );
00307
00308 SMESH::TPythonDump() << _this() << ".SetScaleFactor( " << theScaleFactor << " )";
00309 }
00310 catch ( SALOME_Exception& S_ex ) {
00311 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00312 SALOME::BAD_PARAM );
00313 }
00314 }
00315
00316
00322
00323
00324 CORBA::Double StdMeshers_NumberOfSegments_i::GetScaleFactor()
00325 throw ( SALOME::SALOME_Exception )
00326 {
00327 ASSERT( myBaseImpl );
00328 double scale;
00329 try {
00330 scale = this->GetImpl()->GetScaleFactor();
00331 }
00332 catch ( SALOME_Exception& S_ex ) {
00333 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00334 SALOME::BAD_PARAM );
00335 }
00336 return scale;
00337 }
00338
00339
00342
00343
00344 void StdMeshers_NumberOfSegments_i::SetTableFunction(const SMESH::double_array& table)
00345 throw ( SALOME::SALOME_Exception )
00346 {
00347 ASSERT( myBaseImpl );
00348 std::vector<double> tbl( table.length() );
00349 for (int i = 0; i < table.length(); i++)
00350 tbl[i] = table[i];
00351 try {
00352 this->GetImpl()->SetTableFunction( tbl );
00353
00354 SMESH::TPythonDump() << _this() << ".SetTableFunction( " << table << " )";
00355 }
00356 catch ( SALOME_Exception& S_ex ) {
00357 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00358 SALOME::BAD_PARAM );
00359 }
00360 }
00361
00362
00365
00366
00367 SMESH::double_array* StdMeshers_NumberOfSegments_i::GetTableFunction()
00368 throw ( SALOME::SALOME_Exception )
00369 {
00370 ASSERT( myBaseImpl );
00371 const std::vector<double>* tbl;
00372 try {
00373 tbl = &this->GetImpl()->GetTableFunction();
00374 }
00375 catch ( SALOME_Exception& S_ex ) {
00376 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00377 SALOME::BAD_PARAM );
00378 }
00379 SMESH::double_array_var aRes = new SMESH::double_array();
00380 aRes->length(tbl->size());
00381 for (int i = 0; i < tbl->size(); i++)
00382 aRes[i] = (*tbl)[i];
00383 return aRes._retn();
00384 }
00385
00386
00389
00390
00391 void StdMeshers_NumberOfSegments_i::SetExpressionFunction(const char* expr)
00392 throw ( SALOME::SALOME_Exception )
00393 {
00394 ASSERT( myBaseImpl );
00395 try {
00396 this->GetImpl()->SetExpressionFunction( expr );
00397
00398 SMESH::TPythonDump() << _this() << ".SetExpressionFunction( '" << expr << "' )";
00399 }
00400 catch ( SALOME_Exception& S_ex ) {
00401 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00402 SALOME::BAD_PARAM );
00403 }
00404 }
00405
00406
00409
00410
00411 char* StdMeshers_NumberOfSegments_i::GetExpressionFunction()
00412 throw ( SALOME::SALOME_Exception )
00413 {
00414 ASSERT( myBaseImpl );
00415 const char* expr;
00416 try {
00417 expr = this->GetImpl()->GetExpressionFunction();
00418 }
00419 catch ( SALOME_Exception& S_ex ) {
00420 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00421 SALOME::BAD_PARAM );
00422 }
00423 return CORBA::string_dup(expr);
00424 }
00425
00426
00429
00430
00431 void StdMeshers_NumberOfSegments_i::SetConversionMode(CORBA::Long conv )
00432 throw ( SALOME::SALOME_Exception )
00433 {
00434 ASSERT( myBaseImpl );
00435 try {
00436 this->GetImpl()->SetConversionMode( conv );
00437
00438 SMESH::TPythonDump() << _this() << ".SetConversionMode( " << conv << " )";
00439 }
00440 catch ( SALOME_Exception& S_ex ) {
00441 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00442 SALOME::BAD_PARAM );
00443 }
00444 }
00445
00446
00449
00450
00451 CORBA::Long StdMeshers_NumberOfSegments_i::ConversionMode()
00452 throw ( SALOME::SALOME_Exception )
00453 {
00454 ASSERT( myBaseImpl );
00455 int conv;
00456 try {
00457 conv = this->GetImpl()->ConversionMode();
00458 }
00459 catch ( SALOME_Exception& S_ex ) {
00460 THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
00461 SALOME::BAD_PARAM );
00462 }
00463 return conv;
00464 }
00465
00466
00472
00473
00474 ::StdMeshers_NumberOfSegments* StdMeshers_NumberOfSegments_i::GetImpl()
00475 {
00476 return ( ::StdMeshers_NumberOfSegments* )myBaseImpl;
00477 }
00478
00479
00487
00488 CORBA::Boolean StdMeshers_NumberOfSegments_i::IsDimSupported( SMESH::Dimension type )
00489 {
00490 return type == SMESH::DIM_1D;
00491 }
00492