1 // Copyright (C) 2007-2024 CEA, EDF
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, or (at your option) any later version.
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,
42 ::SMESH_Gen* theGenImpl)
43 : SALOME::GenericObj_i( thePOA ),
44 SMESH_Hypothesis_i( thePOA )
46 myBaseImpl = new ::HexoticPlugin_Hypothesis (theGenImpl->GetANewId(),
50 //=============================================================================
52 * HexoticPlugin_Hypothesis_i::~HexoticPlugin_Hypothesis_i
56 //=============================================================================
57 HexoticPlugin_Hypothesis_i::~HexoticPlugin_Hypothesis_i()
61 //=============================================================================
63 * HexoticPlugin_Hypothesis_i::SetHexesMinLevel
64 * HexoticPlugin_Hypothesis_i::SetHexesMaxLevel
65 * HexoticPlugin_Hypothesis_i::SetMinSize
66 * HexoticPlugin_Hypothesis_i::SetMaxSize
67 * HexoticPlugin_Hypothesis_i::SetHexoticIgnoreRidges
68 * HexoticPlugin_Hypothesis_i::SetHexoticInvalidElements
69 * HexoticPlugin_Hypothesis_i::SetHexoticSharpAngleThreshold
70 * HexoticPlugin_Hypothesis_i::SetHexoticNbProc
71 * HexoticPlugin_Hypothesis_i::SetHexoticWorkingDirectory
72 * HexoticPlugin_Hypothesis_i::SetHexoticSdMode
73 * HexoticPlugin_Hypothesis_i::SetVerbosity
74 * HexoticPlugin_Hypothesis_i::SetHexoticMaxMemory
75 * HexoticPlugin_Hypothesis_i::SetTextOptions
76 * HexoticPlugin_Hypothesis_i::SetNbLayers
77 * HexoticPlugin_Hypothesis_i::SetFirstLayerSize
78 * HexoticPlugin_Hypothesis_i::SetDirection
79 * HexoticPlugin_Hypothesis_i::SetGrowth
80 * HexoticPlugin_Hypothesis_i::SetFacesWithLayers
81 * HexoticPlugin_Hypothesis_i::SetImprintedFaces
83 //=============================================================================
85 void HexoticPlugin_Hypothesis_i::SetHexesMinLevel (CORBA::Long theValue)
88 CORBA::Long oldValue = GetHexesMinLevel();
89 this->GetImpl()->SetHexesMinLevel(theValue);
90 if (theValue != oldValue)
91 SMESH::TPythonDump() << _this() << ".SetHexesMinLevel( " << theValue << " )";
94 void HexoticPlugin_Hypothesis_i::SetHexesMaxLevel (CORBA::Long theValue)
97 CORBA::Long oldValue = GetHexesMaxLevel();
98 this->GetImpl()->SetHexesMaxLevel(theValue);
99 if (theValue != oldValue)
100 SMESH::TPythonDump() << _this() << ".SetHexesMaxLevel( " << theValue << " )";
103 void HexoticPlugin_Hypothesis_i::SetMinSize (CORBA::Double theValue)
106 CORBA::Double oldValue = GetMinSize();
107 this->GetImpl()->SetMinSize(theValue);
108 if (theValue != oldValue)
109 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theValue << " )";
112 void HexoticPlugin_Hypothesis_i::SetMaxSize (CORBA::Double theValue)
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::SetGeomApproxAngle(CORBA::Double angle)
123 CORBA::Double oldValue = GetGeomApproxAngle();
124 this->GetImpl()->SetGeomApproxAngle( angle );
125 if (angle != oldValue)
126 SMESH::TPythonDump() << _this() << ".SetGeomApproxAngle( " << angle << " )";
129 CORBA::Double HexoticPlugin_Hypothesis_i::GetGeomApproxAngle()
131 return this->GetImpl()->GetGeomApproxAngle();
134 void HexoticPlugin_Hypothesis_i::SetHexoticIgnoreRidges (CORBA::Boolean theValue)
137 CORBA::Boolean oldValue = GetHexoticIgnoreRidges();
138 this->GetImpl()->SetHexoticIgnoreRidges(theValue);
139 if (theValue != oldValue)
140 SMESH::TPythonDump() << _this() << ".SetHexoticIgnoreRidges( " << theValue << " )";
143 void HexoticPlugin_Hypothesis_i::SetHexoticInvalidElements (CORBA::Boolean theValue)
146 CORBA::Boolean oldValue = GetHexoticInvalidElements();
147 this->GetImpl()->SetHexoticInvalidElements(theValue);
148 if (theValue != oldValue)
149 SMESH::TPythonDump() << _this() << ".SetHexoticInvalidElements( " << theValue << " )";
152 void HexoticPlugin_Hypothesis_i::SetHexoticSharpAngleThreshold (CORBA::Double theValue)
155 CORBA::Double oldValue = GetHexoticSharpAngleThreshold();
156 this->GetImpl()->SetHexoticSharpAngleThreshold(theValue);
157 if (theValue != oldValue)
158 SMESH::TPythonDump() << _this() << ".SetHexoticSharpAngleThreshold( " << theValue << " )";
161 void HexoticPlugin_Hypothesis_i::SetHexoticNbProc (CORBA::Long theValue)
164 CORBA::Long oldValue = GetHexoticNbProc();
165 this->GetImpl()->SetHexoticNbProc(theValue);
166 if (theValue != oldValue)
167 SMESH::TPythonDump() << _this() << ".SetHexoticNbProc( " << theValue << " )";
170 void HexoticPlugin_Hypothesis_i::SetHexoticWorkingDirectory(const char* path)
173 THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
176 std::string file(path);
177 std::string oldValue(GetHexoticWorkingDirectory());
179 if (oldValue != file)
182 const char lastChar = *file.rbegin();
184 if ( lastChar != '\\' ) file += '\\';
186 if ( lastChar != '/' ) file += '/';
188 file += "Hexotic_In.mesh";
189 SMESH_Mesh_i::PrepareForWriting (file.c_str());
191 this->GetImpl()->SetHexoticWorkingDirectory(path);
193 SMESH::TPythonDump() << _this() << ".SetHexoticWorkingDirectory( '" << path << "' )";
196 void HexoticPlugin_Hypothesis_i::SetKeepFiles(::CORBA::Boolean toKeep)
198 if ( GetKeepFiles() != toKeep )
200 this->GetImpl()->SetKeepFiles(toKeep);
201 SMESH::TPythonDump() << _this() << ".SetKeepFiles( " << toKeep << " )";
205 ::CORBA::Boolean HexoticPlugin_Hypothesis_i::GetKeepFiles()
207 return this->GetImpl()->GetKeepFiles();
210 void HexoticPlugin_Hypothesis_i::SetStandardOutputLog(::CORBA::Boolean logInStandardOutput)
212 if ( GetStandardOutputLog() != logInStandardOutput )
214 this->GetImpl()->SetStandardOutputLog(logInStandardOutput);
215 SMESH::TPythonDump() << _this() << ".SetStandardOutputLog( " << logInStandardOutput << " )";
219 ::CORBA::Boolean HexoticPlugin_Hypothesis_i::GetStandardOutputLog()
221 return this->GetImpl()->GetStandardOutputLog();
224 void HexoticPlugin_Hypothesis_i::SetRemoveLogOnSuccess(::CORBA::Boolean removeLogOnSuccess)
226 if ( GetRemoveLogOnSuccess() != removeLogOnSuccess )
228 this->GetImpl()->SetRemoveLogOnSuccess(removeLogOnSuccess);
229 SMESH::TPythonDump() << _this() << ".SetRemoveLogOnSuccess( " << removeLogOnSuccess << " )";
233 ::CORBA::Boolean HexoticPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
235 return this->GetImpl()->GetRemoveLogOnSuccess();
238 void HexoticPlugin_Hypothesis_i::SetHexoticSdMode (CORBA::Long theValue)
241 CORBA::Long oldValue = GetHexoticSdMode();
242 this->GetImpl()->SetHexoticSdMode(theValue);
243 if (theValue != oldValue)
244 SMESH::TPythonDump() << _this() << ".SetHexoticSdMode( " << theValue << " )";
247 void HexoticPlugin_Hypothesis_i::SetHexoticVerbosity (CORBA::Long theValue)
250 CORBA::Long oldValue = GetHexoticVerbosity();
251 this->GetImpl()->SetHexoticVerbosity(theValue);
252 if (theValue != oldValue)
253 SMESH::TPythonDump() << _this() << ".SetHexoticVerbosity( " << theValue << " )";
256 void HexoticPlugin_Hypothesis_i::SetHexoticMaxMemory (CORBA::Long theValue)
259 CORBA::Long oldValue = GetHexoticMaxMemory();
260 this->GetImpl()->SetHexoticMaxMemory(theValue);
261 if (theValue != oldValue)
262 SMESH::TPythonDump() << _this() << ".SetHexoticMaxMemory( " << theValue << " )";
265 void HexoticPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
269 std::string name( optionName );
270 if ( !optionValue || !optionValue[0] )
271 UnsetOption( optionName );
273 // options having corresponding methods
275 else if ( name == "max_memory" )
276 SetHexoticMaxMemory( GetImpl()->ToInt( optionValue ));
278 else if ( name == "min_level" )
279 SetHexesMinLevel( GetImpl()->ToInt( optionValue ));
281 else if ( name == "max_level" )
282 SetHexesMaxLevel( GetImpl()->ToInt( optionValue ));
284 else if ( name == "min_size" )
285 SetMinSize( GetImpl()->ToDbl( optionValue ));
287 else if ( name == "max_size" )
288 SetMaxSize( GetImpl()->ToDbl( optionValue ));
290 else if ( name == "ridge_angle" )
291 SetHexoticSharpAngleThreshold( GetImpl()->ToDbl( optionValue ));
293 else if ( name == "compute_ridges" )
294 SetHexoticIgnoreRidges( ! GetImpl()->ToBool( optionValue ));
296 else if ( name == "allow_invalid_elements" )
297 SetHexoticInvalidElements( GetImpl()->ToBool( optionValue ));
299 else if ( name == "max_number_of_threads" )
300 SetHexoticNbProc( GetImpl()->ToInt( optionValue ));
302 else if ( name == "verbose" )
303 SetHexoticVerbosity( GetImpl()->ToInt( optionValue ));
305 // advanced options (for backward compatibility)
306 // else if ( name == "create_tag_on_collision" ||
307 // name == "tiny_edge_respect_geometry" )
308 // AddOption( optionName, optionValue );
311 bool valueChanged = true, isDefault;
313 valueChanged = ( this->GetImpl()->GetOptionValue( name, &isDefault ) != optionValue );
315 catch ( std::invalid_argument& ) {
319 this->GetImpl()->SetOptionValue(optionName, optionValue);
320 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
323 } catch (const std::invalid_argument& ex) {
324 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
325 } catch (SALOME_Exception& ex) {
326 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
330 //=============================================================================
332 char* HexoticPlugin_Hypothesis_i::GetOptionValue(const char* optionName)
337 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
338 } catch (const std::invalid_argument& ex) {
339 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
340 } catch (SALOME_Exception& ex) {
341 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
346 //=============================================================================
348 void HexoticPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
350 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
352 this->GetImpl()->ClearOption(optionName);
353 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
357 //=============================================================================
359 HexoticPlugin::string_array* HexoticPlugin_Hypothesis_i::GetOptionValues()
361 HexoticPlugin::string_array_var result = new HexoticPlugin::string_array();
363 const ::HexoticPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
364 result->length(opts.size());
368 ::HexoticPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
369 for (; opIt != opts.end(); ++opIt, ++i)
371 std::string name_value_type = opIt->first;
372 //if (!opIt->second.empty())
374 name_value_type += ":";
375 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
376 name_value_type += isDefault ? ":0" : ":1";
378 result[i] = CORBA::string_dup(name_value_type.c_str());
381 return result._retn();
384 //=============================================================================
386 HexoticPlugin::string_array* HexoticPlugin_Hypothesis_i::GetAdvancedOptionValues()
388 HexoticPlugin::string_array_var result = new HexoticPlugin::string_array();
390 const ::HexoticPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
391 result->length(custom_opts.size());
394 ::HexoticPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
395 for (; opIt != custom_opts.end(); ++opIt, ++i) {
396 std::string name_value_type = opIt->first;
397 if (!opIt->second.empty()) {
398 name_value_type += ":";
399 name_value_type += opIt->second;
400 name_value_type += ":1"; // user defined
402 result[i] = CORBA::string_dup(name_value_type.c_str());
404 return result._retn();
407 //=============================================================================
409 void HexoticPlugin_Hypothesis_i::SetOptionValues(const HexoticPlugin::string_array& options)
411 for (CORBA::ULong i = 0; i < options.length(); ++i)
413 std::string name_value_type = options[i].in();
414 if(name_value_type.empty())
416 size_t colonPos = name_value_type.find(':');
417 std::string name, value;
418 if (colonPos == std::string::npos) // ':' not found
419 name = name_value_type;
421 name = name_value_type.substr(0, colonPos);
422 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
423 std::string value_type = name_value_type.substr(colonPos + 1);
424 colonPos = value_type.find(':');
425 value = value_type.substr(0, colonPos);
426 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
427 if ( value_type.substr(colonPos + 1) == "0" ) // is default
431 SetOptionValue(name.c_str(), value.c_str());
435 //=============================================================================
437 void HexoticPlugin_Hypothesis_i::SetAdvancedOptionValues(const HexoticPlugin::string_array& options)
439 SMESH::TPythonDump dump;
441 std::string optionsAndValues;
442 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
443 std::string name_value_type = options[i].in();
444 if(name_value_type.empty())
446 size_t colonPos = name_value_type.find(':');
447 std::string name, value;
448 if (colonPos == std::string::npos) // ':' not found
449 name = name_value_type;
451 name = name_value_type.substr(0, colonPos);
452 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
453 std::string value_type = name_value_type.substr(colonPos + 1);
454 colonPos = value_type.find(':');
455 value = value_type.substr(0, colonPos);
458 AddOption(name.c_str(), value.c_str());
460 optionsAndValues += name + " " + value + " ";
463 if ( !optionsAndValues.empty() )
464 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
467 //=============================================================================
469 void HexoticPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
471 if ( !optionsAndValues ) return;
473 SMESH::TPythonDump dump;
475 std::istringstream strm( optionsAndValues );
476 std::istream_iterator<std::string> sIt( strm ), sEnd;
477 for ( int nbPairs = 0; sIt != sEnd; ++nbPairs )
479 std::string option = *sIt;
482 std::string value = *sIt;
484 AddOption( option.c_str(), value.c_str() );
489 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
490 AddOption( option.c_str(), "" );
493 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
496 //=============================================================================
498 void HexoticPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
501 bool valueChanged = ( !this->GetImpl()->HasOptionDefined(optionName) ||
502 this->GetImpl()->GetOptionValue(optionName) != optionValue );
504 this->GetImpl()->SetOptionValue(optionName, optionValue);
505 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
509 //=============================================================================
511 char* HexoticPlugin_Hypothesis_i::GetOption(const char* optionName)
514 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName).c_str());
517 void HexoticPlugin_Hypothesis_i::SetTextOptions(const char* theOptions)
520 std::string oldValue(GetAdvancedOption());
521 this->GetImpl()->SetAdvancedOption(theOptions);
522 if (theOptions != oldValue)
523 SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << theOptions << "' )";
526 HexoticPlugin::HexoticPluginSizeMapsList* HexoticPlugin_Hypothesis_i::GetSizeMaps ()
528 // Get the std::map < std::string entry, double size >
529 HexoticPlugin::HexoticPluginSizeMapsList_var result = new HexoticPlugin::HexoticPluginSizeMapsList();
530 const ::HexoticPlugin_Hypothesis::THexoticSizeMaps sizeMaps = this->GetImpl()->GetSizeMaps();
531 result->length( sizeMaps.size() );
533 // Write the content into a CORBA sequence of struct{ entry=anEntry; size=aSize; }
534 ::HexoticPlugin_Hypothesis::THexoticSizeMaps::const_iterator it = sizeMaps.begin();
535 for ( int i = 0; it != sizeMaps.end(); i++, it++ )
537 HexoticPlugin::HexoticPluginSizeMap_var aSizeMap = new HexoticPlugin::HexoticPluginSizeMap();
538 aSizeMap->entry = CORBA::string_dup( it->first.c_str() );
539 aSizeMap->size = it->second;
540 result[i] = aSizeMap;
542 return result._retn();
545 void HexoticPlugin_Hypothesis_i::SetSizeMapEntry ( const char* theEntry, CORBA::Double theSize )
547 bool valueChanged = this->GetImpl()->AddSizeMap(theEntry, theSize);
549 SMESH::TPythonDump() << _this() << ".SetSizeMap( "<< theEntry << ", " << theSize << " )";
552 void HexoticPlugin_Hypothesis_i::UnsetSizeMapEntry ( const char* theEntry )
554 bool entryRemoved = this->GetImpl()->UnsetSizeMap(theEntry);
556 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( "<< theEntry << " )";
559 void HexoticPlugin_Hypothesis_i::SetSizeMap (const GEOM::GEOM_Object_ptr theGeomObj, const double theSize)
562 std::string entry = theGeomObj->GetStudyEntry();
563 SetSizeMapEntry( entry.c_str(), theSize);
566 void HexoticPlugin_Hypothesis_i::UnsetSizeMap (const GEOM::GEOM_Object_ptr theGeomObj)
569 std::string entry = theGeomObj->GetStudyEntry();
570 UnsetSizeMapEntry( entry.c_str());
573 void HexoticPlugin_Hypothesis_i::SetNbLayers(CORBA::Long theVal)
576 CORBA::Long oldValue = GetNbLayers();
577 this->GetImpl()->SetNbLayers(theVal);
578 if (theVal != oldValue)
579 SMESH::TPythonDump() << _this() << ".SetNbLayers( " << theVal << " )";
582 void HexoticPlugin_Hypothesis_i::SetFirstLayerSize(CORBA::Double theVal)
585 CORBA::Double oldValue = GetFirstLayerSize();
586 this->GetImpl()->SetFirstLayerSize(theVal);
587 if (theVal != oldValue)
588 SMESH::TPythonDump() << _this() << ".SetFirstLayerSize( " << theVal << " )";
591 void HexoticPlugin_Hypothesis_i::SetDirection(CORBA::Boolean theVal)
594 CORBA::Boolean oldValue = GetDirection();
595 this->GetImpl()->SetDirection(theVal);
596 if (theVal != oldValue)
597 SMESH::TPythonDump() << _this() << ".SetDirection( " << theVal << " )";
600 void HexoticPlugin_Hypothesis_i::SetGrowth(CORBA::Double theVal)
603 CORBA::Double oldValue = GetGrowth();
604 this->GetImpl()->SetGrowth(theVal);
605 if (theVal != oldValue)
606 SMESH::TPythonDump() << _this() << ".SetGrowth( " << theVal << " )";
609 void HexoticPlugin_Hypothesis_i::SetFacesWithLayers(const ::SMESH::long_array& theVal)
611 std::vector<int> ids( theVal.length() );
612 for ( unsigned i = 0; i < ids.size(); ++i )
615 bool valueChanged = this->GetImpl()->SetFacesWithLayers(ids);
617 SMESH::TPythonDump() << _this() << ".SetFacesWithLayers( "<< theVal << " )";
620 void HexoticPlugin_Hypothesis_i::SetImprintedFaces(const ::SMESH::long_array& theVal)
622 std::vector<int> ids( theVal.length() );
623 for ( unsigned i = 0; i < ids.size(); ++i )
626 bool valueChanged = this->GetImpl()->SetImprintedFaces(ids);
628 SMESH::TPythonDump() << _this() << ".SetImprintedFaces( "<< theVal << " )";
631 //=============================================================================
633 * HexoticPlugin_Hypothesis_i::GetHexesMinLevel
634 * HexoticPlugin_Hypothesis_i::GetHexesMaxLevel
635 * HexoticPlugin_Hypothesis_i::GetMinSize
636 * HexoticPlugin_Hypothesis_i::GetMaxSize
637 * HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges
638 * HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements
639 * HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold
640 * HexoticPlugin_Hypothesis_i::GetHexoticNbProc
641 * HexoticPlugin_Hypothesis_i::GetHexoticWorkingDirectory
642 * HexoticPlugin_Hypothesis_i::GetHexoticSdMode
643 * HexoticPlugin_Hypothesis_i::GetVerbosity
644 * HexoticPlugin_Hypothesis_i::GetHexoticMaxMemory
645 * HexoticPlugin_Hypothesis_i::GetTextOptions
646 * HexoticPlugin_Hypothesis_i::GetNbLayers
647 * HexoticPlugin_Hypothesis_i::GetFirstLayerSize
648 * HexoticPlugin_Hypothesis_i::GetDirection
649 * HexoticPlugin_Hypothesis_i::GetGrowth
650 * HexoticPlugin_Hypothesis_i::GetFacesWithLayers
651 * HexoticPlugin_Hypothesis_i::GetImprintedFaces
653 //=============================================================================
655 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexesMinLevel()
658 return this->GetImpl()->GetHexesMinLevel();
661 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexesMaxLevel()
664 return this->GetImpl()->GetHexesMaxLevel();
667 CORBA::Double HexoticPlugin_Hypothesis_i::GetMinSize()
670 return this->GetImpl()->GetMinSize();
673 CORBA::Double HexoticPlugin_Hypothesis_i::GetMaxSize()
676 return this->GetImpl()->GetMaxSize();
679 CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges()
682 return this->GetImpl()->GetHexoticIgnoreRidges();
685 CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements()
688 return this->GetImpl()->GetHexoticInvalidElements();
691 CORBA::Double HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold()
694 return this->GetImpl()->GetHexoticSharpAngleThreshold();
697 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticNbProc()
700 return this->GetImpl()->GetHexoticNbProc();
703 char* HexoticPlugin_Hypothesis_i::GetHexoticWorkingDirectory()
706 return CORBA::string_dup( this->GetImpl()->GetHexoticWorkingDirectory().c_str() );
709 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticSdMode ()
712 return this->GetImpl()->GetHexoticSdMode();
715 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticVerbosity()
718 return this->GetImpl()->GetHexoticVerbosity();
721 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticMaxMemory()
724 return this->GetImpl()->GetHexoticMaxMemory();
727 char* HexoticPlugin_Hypothesis_i::GetAdvancedOption()
730 return CORBA::string_dup( this->GetImpl()->GetAdvancedOption( /*customOnly=*/true ).c_str() );
732 char* HexoticPlugin_Hypothesis_i::GetTextOptions()
735 return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
738 CORBA::Long HexoticPlugin_Hypothesis_i::GetNbLayers()
741 return this->GetImpl()->GetNbLayers();
744 CORBA::Double HexoticPlugin_Hypothesis_i::GetFirstLayerSize()
747 return this->GetImpl()->GetFirstLayerSize();
750 CORBA::Boolean HexoticPlugin_Hypothesis_i::GetDirection()
753 return this->GetImpl()->GetDirection();
756 CORBA::Double HexoticPlugin_Hypothesis_i::GetGrowth()
759 return this->GetImpl()->GetGrowth();
762 SMESH::long_array* HexoticPlugin_Hypothesis_i::GetFacesWithLayers()
765 std::vector<int> idsVec = this->GetImpl()->GetFacesWithLayers();
766 SMESH::long_array_var ids = new SMESH::long_array;
767 ids->length( idsVec.size() );
768 for ( unsigned i = 0; i < idsVec.size(); ++i )
773 SMESH::long_array* HexoticPlugin_Hypothesis_i::GetImprintedFaces()
776 std::vector<int> idsVec = this->GetImpl()->GetImprintedFaces();
777 SMESH::long_array_var ids = new SMESH::long_array;
778 ids->length( idsVec.size() );
779 for ( unsigned i = 0; i < idsVec.size(); ++i )
783 //=============================================================================
785 * HexoticPlugin_Hypothesis_i::GetImpl
789 //=============================================================================
790 ::HexoticPlugin_Hypothesis* HexoticPlugin_Hypothesis_i::GetImpl()
792 return (::HexoticPlugin_Hypothesis*)myBaseImpl;
795 //================================================================================
797 * \brief Verify whether hypothesis supports given entity type
798 * \param type - dimension (see SMESH::Dimension enumeration)
799 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
801 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
803 //================================================================================
804 CORBA::Boolean HexoticPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
806 return type == SMESH::DIM_3D;
809 //================================================================================
811 * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
813 //================================================================================
816 HexoticPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
817 std::vector< int > & subIDArray ) const
819 typedef ::HexoticPlugin_Hypothesis THyp;
820 const THyp* h = static_cast< const THyp*> ( myBaseImpl );
822 const THyp::THexoticSizeMaps& sizeMaps = h->GetSizeMaps();
823 THyp::THexoticSizeMaps::const_iterator entry2size = sizeMaps.cbegin();
824 for ( ; entry2size != sizeMaps.cend(); ++entry2size )
825 entryArray.push_back( entry2size->first );
827 subIDArray = h->GetFacesWithLayers();
828 subIDArray.insert( subIDArray.end(),
829 h->GetImprintedFaces().begin(),
830 h->GetImprintedFaces().end());
835 //================================================================================
837 * \brief Set new geometry instead of that returned by getObjectsDependOn()
839 //================================================================================
842 HexoticPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
843 std::vector< int > & subIDArray )
845 typedef ::HexoticPlugin_Hypothesis THyp;
846 THyp* h = static_cast< THyp*> ( myBaseImpl );
850 THyp::THexoticSizeMaps& sizeMapsNew = const_cast< THyp::THexoticSizeMaps& > ( h->GetSizeMaps() );
851 THyp::THexoticSizeMaps sizeMaps;
852 sizeMaps.swap( sizeMapsNew );
853 THyp::THexoticSizeMaps::const_iterator entry2size = sizeMaps.cbegin();
854 for ( ; entry2size != sizeMaps.cend(); ++entry2size )
856 const std::string& entry = entryArray[ iEnt++ ];
857 if ( entry.empty() == entry2size->first.empty() )
858 sizeMapsNew[ entry ] = entry2size->second;
861 size_t nbFacesWL = h->GetFacesWithLayers().size();
862 std::vector<int> facesWithLayers;
864 for ( ; iID < nbFacesWL; ++iID )
865 if ( subIDArray[ iID ] > 0 )
866 facesWithLayers.push_back( subIDArray[ iID ]);
867 h->SetFacesWithLayers( facesWithLayers );
869 std::vector<int> imprintedFaces;
870 for ( ; iID < subIDArray.size(); ++iID )
871 if ( subIDArray[ iID ] > 0 )
872 imprintedFaces.push_back( subIDArray[ iID ]);
873 h->SetImprintedFaces( imprintedFaces );
875 return iID == subIDArray.size() && iEnt == entryArray.size();