1 // Copyright (C) 2007-2020 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, 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) throw ( SALOME::SALOME_Exception )
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)
266 throw (SALOME::SALOME_Exception)
270 std::string name( optionName );
271 if ( !optionValue || !optionValue[0] )
272 UnsetOption( optionName );
274 // options having corresponding methods
276 else if ( name == "max_memory" )
277 SetHexoticMaxMemory( GetImpl()->ToInt( optionValue ));
279 else if ( name == "min_level" )
280 SetHexesMinLevel( GetImpl()->ToInt( optionValue ));
282 else if ( name == "max_level" )
283 SetHexesMaxLevel( GetImpl()->ToInt( optionValue ));
285 else if ( name == "min_size" )
286 SetMinSize( GetImpl()->ToDbl( optionValue ));
288 else if ( name == "max_size" )
289 SetMaxSize( GetImpl()->ToDbl( optionValue ));
291 else if ( name == "ridge_angle" )
292 SetHexoticSharpAngleThreshold( GetImpl()->ToDbl( optionValue ));
294 else if ( name == "compute_ridges" )
295 SetHexoticIgnoreRidges( ! GetImpl()->ToBool( optionValue ));
297 else if ( name == "allow_invalid_elements" )
298 SetHexoticInvalidElements( GetImpl()->ToBool( optionValue ));
300 else if ( name == "max_number_of_threads" )
301 SetHexoticNbProc( GetImpl()->ToInt( optionValue ));
303 else if ( name == "verbose" )
304 SetHexoticVerbosity( GetImpl()->ToInt( optionValue ));
306 // advanced options (for backward compatibility)
307 // else if ( name == "create_tag_on_collision" ||
308 // name == "tiny_edge_respect_geometry" )
309 // AddOption( optionName, optionValue );
312 bool valueChanged = true, isDefault;
314 valueChanged = ( this->GetImpl()->GetOptionValue( name, &isDefault ) != optionValue );
316 catch ( std::invalid_argument ) {
320 this->GetImpl()->SetOptionValue(optionName, optionValue);
321 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
324 } catch (const std::invalid_argument& ex) {
325 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
326 } catch (SALOME_Exception& ex) {
327 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
331 //=============================================================================
333 char* HexoticPlugin_Hypothesis_i::GetOptionValue(const char* optionName)
334 throw (SALOME::SALOME_Exception)
339 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
340 } catch (const std::invalid_argument& ex) {
341 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
342 } catch (SALOME_Exception& ex) {
343 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
348 //=============================================================================
350 void HexoticPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
352 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
354 this->GetImpl()->ClearOption(optionName);
355 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
359 //=============================================================================
361 HexoticPlugin::string_array* HexoticPlugin_Hypothesis_i::GetOptionValues()
363 HexoticPlugin::string_array_var result = new HexoticPlugin::string_array();
365 const ::HexoticPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
366 result->length(opts.size());
370 ::HexoticPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
371 for (; opIt != opts.end(); ++opIt, ++i)
373 std::string name_value_type = opIt->first;
374 //if (!opIt->second.empty())
376 name_value_type += ":";
377 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
378 name_value_type += isDefault ? ":0" : ":1";
380 result[i] = CORBA::string_dup(name_value_type.c_str());
383 return result._retn();
386 //=============================================================================
388 HexoticPlugin::string_array* HexoticPlugin_Hypothesis_i::GetAdvancedOptionValues()
390 HexoticPlugin::string_array_var result = new HexoticPlugin::string_array();
392 const ::HexoticPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
393 result->length(custom_opts.size());
396 ::HexoticPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
397 for (; opIt != custom_opts.end(); ++opIt, ++i) {
398 std::string name_value_type = opIt->first;
399 if (!opIt->second.empty()) {
400 name_value_type += ":";
401 name_value_type += opIt->second;
402 name_value_type += ":1"; // user defined
404 result[i] = CORBA::string_dup(name_value_type.c_str());
406 return result._retn();
409 //=============================================================================
411 void HexoticPlugin_Hypothesis_i::SetOptionValues(const HexoticPlugin::string_array& options)
412 throw (SALOME::SALOME_Exception)
414 for (CORBA::ULong i = 0; i < options.length(); ++i)
416 std::string name_value_type = options[i].in();
417 if(name_value_type.empty())
419 size_t colonPos = name_value_type.find(':');
420 std::string name, value;
421 if (colonPos == std::string::npos) // ':' not found
422 name = name_value_type;
424 name = name_value_type.substr(0, colonPos);
425 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
426 std::string value_type = name_value_type.substr(colonPos + 1);
427 colonPos = value_type.find(':');
428 value = value_type.substr(0, colonPos);
429 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
430 if ( value_type.substr(colonPos + 1) == "0" ) // is default
434 SetOptionValue(name.c_str(), value.c_str());
438 //=============================================================================
440 void HexoticPlugin_Hypothesis_i::SetAdvancedOptionValues(const HexoticPlugin::string_array& options)
442 SMESH::TPythonDump dump;
444 std::string optionsAndValues;
445 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
446 std::string name_value_type = options[i].in();
447 if(name_value_type.empty())
449 size_t colonPos = name_value_type.find(':');
450 std::string name, value;
451 if (colonPos == std::string::npos) // ':' not found
452 name = name_value_type;
454 name = name_value_type.substr(0, colonPos);
455 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
456 std::string value_type = name_value_type.substr(colonPos + 1);
457 colonPos = value_type.find(':');
458 value = value_type.substr(0, colonPos);
461 AddOption(name.c_str(), value.c_str());
463 optionsAndValues += name + " " + value + " ";
466 if ( !optionsAndValues.empty() )
467 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
470 //=============================================================================
472 void HexoticPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
473 throw (SALOME::SALOME_Exception)
475 if ( !optionsAndValues ) return;
477 SMESH::TPythonDump dump;
479 std::istringstream strm( optionsAndValues );
480 std::istream_iterator<std::string> sIt( strm ), sEnd;
481 for ( int nbPairs = 0; sIt != sEnd; ++nbPairs )
483 std::string option = *sIt;
486 std::string value = *sIt;
488 AddOption( option.c_str(), value.c_str() );
493 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
494 AddOption( option.c_str(), "" );
497 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
500 //=============================================================================
502 void HexoticPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
505 bool valueChanged = ( !this->GetImpl()->HasOptionDefined(optionName) ||
506 this->GetImpl()->GetOptionValue(optionName) != optionValue );
508 this->GetImpl()->SetOptionValue(optionName, optionValue);
509 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
513 //=============================================================================
515 char* HexoticPlugin_Hypothesis_i::GetOption(const char* optionName)
518 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName).c_str());
521 void HexoticPlugin_Hypothesis_i::SetTextOptions(const char* theOptions)
524 std::string oldValue(GetAdvancedOption());
525 this->GetImpl()->SetAdvancedOption(theOptions);
526 if (theOptions != oldValue)
527 SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << theOptions << "' )";
530 HexoticPlugin::HexoticPluginSizeMapsList* HexoticPlugin_Hypothesis_i::GetSizeMaps ()
532 // Get the std::map < std::string entry, double size >
533 HexoticPlugin::HexoticPluginSizeMapsList_var result = new HexoticPlugin::HexoticPluginSizeMapsList();
534 const ::HexoticPlugin_Hypothesis::THexoticSizeMaps sizeMaps = this->GetImpl()->GetSizeMaps();
535 result->length( sizeMaps.size() );
537 // Write the content into a CORBA sequence of struct{ entry=anEntry; size=aSize; }
538 ::HexoticPlugin_Hypothesis::THexoticSizeMaps::const_iterator it = sizeMaps.begin();
539 for ( int i = 0; it != sizeMaps.end(); i++, it++ )
541 HexoticPlugin::HexoticPluginSizeMap_var aSizeMap = new HexoticPlugin::HexoticPluginSizeMap();
542 aSizeMap->entry = CORBA::string_dup( it->first.c_str() );
543 aSizeMap->size = it->second;
544 result[i] = aSizeMap;
546 return result._retn();
549 void HexoticPlugin_Hypothesis_i::SetSizeMapEntry ( const char* theEntry, CORBA::Double theSize )
551 bool valueChanged = this->GetImpl()->AddSizeMap(theEntry, theSize);
553 SMESH::TPythonDump() << _this() << ".SetSizeMap( "<< theEntry << ", " << theSize << " )";
556 void HexoticPlugin_Hypothesis_i::UnsetSizeMapEntry ( const char* theEntry )
558 bool entryRemoved = this->GetImpl()->UnsetSizeMap(theEntry);
560 SMESH::TPythonDump() << _this() << ".UnsetSizeMap( "<< theEntry << " )";
563 void HexoticPlugin_Hypothesis_i::SetSizeMap (const GEOM::GEOM_Object_ptr theGeomObj, const double theSize)
566 std::string entry = theGeomObj->GetStudyEntry();
567 SetSizeMapEntry( entry.c_str(), theSize);
570 void HexoticPlugin_Hypothesis_i::UnsetSizeMap (const GEOM::GEOM_Object_ptr theGeomObj)
573 std::string entry = theGeomObj->GetStudyEntry();
574 UnsetSizeMapEntry( entry.c_str());
577 void HexoticPlugin_Hypothesis_i::SetNbLayers(CORBA::Long theVal)
580 CORBA::Long oldValue = GetNbLayers();
581 this->GetImpl()->SetNbLayers(theVal);
582 if (theVal != oldValue)
583 SMESH::TPythonDump() << _this() << ".SetNbLayers( " << theVal << " )";
586 void HexoticPlugin_Hypothesis_i::SetFirstLayerSize(CORBA::Double theVal)
589 CORBA::Double oldValue = GetFirstLayerSize();
590 this->GetImpl()->SetFirstLayerSize(theVal);
591 if (theVal != oldValue)
592 SMESH::TPythonDump() << _this() << ".SetFirstLayerSize( " << theVal << " )";
595 void HexoticPlugin_Hypothesis_i::SetDirection(CORBA::Boolean theVal)
598 CORBA::Boolean oldValue = GetDirection();
599 this->GetImpl()->SetDirection(theVal);
600 if (theVal != oldValue)
601 SMESH::TPythonDump() << _this() << ".SetDirection( " << theVal << " )";
604 void HexoticPlugin_Hypothesis_i::SetGrowth(CORBA::Double theVal)
607 CORBA::Double oldValue = GetGrowth();
608 this->GetImpl()->SetGrowth(theVal);
609 if (theVal != oldValue)
610 SMESH::TPythonDump() << _this() << ".SetGrowth( " << theVal << " )";
613 void HexoticPlugin_Hypothesis_i::SetFacesWithLayers(const ::SMESH::long_array& theVal)
615 std::vector<int> ids( theVal.length() );
616 for ( unsigned i = 0; i < ids.size(); ++i )
619 bool valueChanged = this->GetImpl()->SetFacesWithLayers(ids);
621 SMESH::TPythonDump() << _this() << ".SetFacesWithLayers( "<< theVal << " )";
624 void HexoticPlugin_Hypothesis_i::SetImprintedFaces(const ::SMESH::long_array& theVal)
626 std::vector<int> ids( theVal.length() );
627 for ( unsigned i = 0; i < ids.size(); ++i )
630 bool valueChanged = this->GetImpl()->SetImprintedFaces(ids);
632 SMESH::TPythonDump() << _this() << ".SetImprintedFaces( "<< theVal << " )";
635 //=============================================================================
637 * HexoticPlugin_Hypothesis_i::GetHexesMinLevel
638 * HexoticPlugin_Hypothesis_i::GetHexesMaxLevel
639 * HexoticPlugin_Hypothesis_i::GetMinSize
640 * HexoticPlugin_Hypothesis_i::GetMaxSize
641 * HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges
642 * HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements
643 * HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold
644 * HexoticPlugin_Hypothesis_i::GetHexoticNbProc
645 * HexoticPlugin_Hypothesis_i::GetHexoticWorkingDirectory
646 * HexoticPlugin_Hypothesis_i::GetHexoticSdMode
647 * HexoticPlugin_Hypothesis_i::GetVerbosity
648 * HexoticPlugin_Hypothesis_i::GetHexoticMaxMemory
649 * HexoticPlugin_Hypothesis_i::GetTextOptions
650 * HexoticPlugin_Hypothesis_i::GetNbLayers
651 * HexoticPlugin_Hypothesis_i::GetFirstLayerSize
652 * HexoticPlugin_Hypothesis_i::GetDirection
653 * HexoticPlugin_Hypothesis_i::GetGrowth
654 * HexoticPlugin_Hypothesis_i::GetFacesWithLayers
655 * HexoticPlugin_Hypothesis_i::GetImprintedFaces
657 //=============================================================================
659 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexesMinLevel()
662 return this->GetImpl()->GetHexesMinLevel();
665 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexesMaxLevel()
668 return this->GetImpl()->GetHexesMaxLevel();
671 CORBA::Double HexoticPlugin_Hypothesis_i::GetMinSize()
674 return this->GetImpl()->GetMinSize();
677 CORBA::Double HexoticPlugin_Hypothesis_i::GetMaxSize()
680 return this->GetImpl()->GetMaxSize();
683 CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticIgnoreRidges()
686 return this->GetImpl()->GetHexoticIgnoreRidges();
689 CORBA::Boolean HexoticPlugin_Hypothesis_i::GetHexoticInvalidElements()
692 return this->GetImpl()->GetHexoticInvalidElements();
695 CORBA::Double HexoticPlugin_Hypothesis_i::GetHexoticSharpAngleThreshold()
698 return this->GetImpl()->GetHexoticSharpAngleThreshold();
701 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticNbProc()
704 return this->GetImpl()->GetHexoticNbProc();
707 char* HexoticPlugin_Hypothesis_i::GetHexoticWorkingDirectory()
710 return CORBA::string_dup( this->GetImpl()->GetHexoticWorkingDirectory().c_str() );
713 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticSdMode ()
716 return this->GetImpl()->GetHexoticSdMode();
719 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticVerbosity()
722 return this->GetImpl()->GetHexoticVerbosity();
725 CORBA::Long HexoticPlugin_Hypothesis_i::GetHexoticMaxMemory()
728 return this->GetImpl()->GetHexoticMaxMemory();
731 char* HexoticPlugin_Hypothesis_i::GetAdvancedOption()
734 return CORBA::string_dup( this->GetImpl()->GetAdvancedOption( /*customOnly=*/true ).c_str() );
736 char* HexoticPlugin_Hypothesis_i::GetTextOptions()
739 return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
742 CORBA::Long HexoticPlugin_Hypothesis_i::GetNbLayers()
745 return this->GetImpl()->GetNbLayers();
748 CORBA::Double HexoticPlugin_Hypothesis_i::GetFirstLayerSize()
751 return this->GetImpl()->GetFirstLayerSize();
754 CORBA::Boolean HexoticPlugin_Hypothesis_i::GetDirection()
757 return this->GetImpl()->GetDirection();
760 CORBA::Double HexoticPlugin_Hypothesis_i::GetGrowth()
763 return this->GetImpl()->GetGrowth();
766 SMESH::long_array* HexoticPlugin_Hypothesis_i::GetFacesWithLayers()
769 std::vector<int> idsVec = this->GetImpl()->GetFacesWithLayers();
770 SMESH::long_array_var ids = new SMESH::long_array;
771 ids->length( idsVec.size() );
772 for ( unsigned i = 0; i < idsVec.size(); ++i )
777 SMESH::long_array* HexoticPlugin_Hypothesis_i::GetImprintedFaces()
780 std::vector<int> idsVec = this->GetImpl()->GetImprintedFaces();
781 SMESH::long_array_var ids = new SMESH::long_array;
782 ids->length( idsVec.size() );
783 for ( unsigned i = 0; i < idsVec.size(); ++i )
787 //=============================================================================
789 * HexoticPlugin_Hypothesis_i::GetImpl
793 //=============================================================================
794 ::HexoticPlugin_Hypothesis* HexoticPlugin_Hypothesis_i::GetImpl()
796 return (::HexoticPlugin_Hypothesis*)myBaseImpl;
799 //================================================================================
801 * \brief Verify whether hypothesis supports given entity type
802 * \param type - dimension (see SMESH::Dimension enumeration)
803 * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
805 * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
807 //================================================================================
808 CORBA::Boolean HexoticPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
810 return type == SMESH::DIM_3D;
813 //================================================================================
815 * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
817 //================================================================================
820 HexoticPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
821 std::vector< int > & subIDArray ) const
823 typedef ::HexoticPlugin_Hypothesis THyp;
824 const THyp* h = static_cast< const THyp*> ( myBaseImpl );
826 const THyp::THexoticSizeMaps& sizeMaps = h->GetSizeMaps();
827 THyp::THexoticSizeMaps::const_iterator entry2size = sizeMaps.cbegin();
828 for ( ; entry2size != sizeMaps.cend(); ++entry2size )
829 entryArray.push_back( entry2size->first );
831 subIDArray = h->GetFacesWithLayers();
832 subIDArray.insert( subIDArray.end(),
833 h->GetImprintedFaces().begin(),
834 h->GetImprintedFaces().end());
839 //================================================================================
841 * \brief Set new geometry instead of that returned by getObjectsDependOn()
843 //================================================================================
846 HexoticPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
847 std::vector< int > & subIDArray )
849 typedef ::HexoticPlugin_Hypothesis THyp;
850 THyp* h = static_cast< THyp*> ( myBaseImpl );
854 THyp::THexoticSizeMaps& sizeMapsNew = const_cast< THyp::THexoticSizeMaps& > ( h->GetSizeMaps() );
855 THyp::THexoticSizeMaps sizeMaps;
856 sizeMaps.swap( sizeMapsNew );
857 THyp::THexoticSizeMaps::const_iterator entry2size = sizeMaps.cbegin();
858 for ( ; entry2size != sizeMaps.cend(); ++entry2size )
860 const std::string& entry = entryArray[ iEnt++ ];
861 if ( entry.empty() == entry2size->first.empty() )
862 sizeMapsNew[ entry ] = entry2size->second;
865 size_t nbFacesWL = h->GetFacesWithLayers().size();
866 std::vector<int> facesWithLayers;
868 for ( ; iID < nbFacesWL; ++iID )
869 if ( subIDArray[ iID ] > 0 )
870 facesWithLayers.push_back( subIDArray[ iID ]);
871 h->SetFacesWithLayers( facesWithLayers );
873 std::vector<int> imprintedFaces;
874 for ( ; iID < subIDArray.size(); ++iID )
875 if ( subIDArray[ iID ] > 0 )
876 imprintedFaces.push_back( subIDArray[ iID ]);
877 h->SetImprintedFaces( imprintedFaces );
879 return iID == subIDArray.size() && iEnt == entryArray.size();