1 // Copyright (C) 2004-2021 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
20 // File : GHS3DPlugin_Hypothesis_i.cxx
21 // Created : Wed Apr 2 13:53:01 2008
22 // Author : Edward AGAPOV (eap)
24 #include "GHS3DPlugin_Hypothesis_i.hxx"
26 #include <SMESH_Gen.hxx>
27 #include <SMESH_PythonDump.hxx>
29 #include <Utils_CorbaException.hxx>
30 #include <utilities.h>
31 #include <SMESH_Mesh_i.hxx>
32 #include <SMESH_Group_i.hxx>
33 #include <SMESH_Gen_i.hxx>
34 #include <SMESHDS_GroupBase.hxx>
39 //=======================================================================
40 //function : GHS3DPlugin_Hypothesis_i
41 //=======================================================================
43 GHS3DPlugin_Hypothesis_i::GHS3DPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
44 ::SMESH_Gen* theGenImpl)
45 : SALOME::GenericObj_i( thePOA ),
46 SMESH_Hypothesis_i( thePOA )
48 myBaseImpl = new ::GHS3DPlugin_Hypothesis (theGenImpl->GetANewId(),
52 //=======================================================================
53 //function : ~GHS3DPlugin_Hypothesis_i
54 //=======================================================================
56 GHS3DPlugin_Hypothesis_i::~GHS3DPlugin_Hypothesis_i()
60 //=======================================================================
61 //function : SetToMeshHoles
62 //=======================================================================
64 void GHS3DPlugin_Hypothesis_i::SetToMeshHoles(CORBA::Boolean toMesh)
67 this->GetImpl()->SetToMeshHoles(toMesh);
68 SMESH::TPythonDump() << _this() << ".SetToMeshHoles( " << toMesh << " )";
71 //=======================================================================
72 //function : GetToMeshHoles
73 //=======================================================================
75 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMeshHoles()
78 return this->GetImpl()->GetToMeshHoles();
81 //=============================================================================
82 void GHS3DPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize)
84 if ( GetMinSize() != theMinSize ) {
85 this->GetImpl()->SetMinSize( theMinSize );
86 SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
90 //=============================================================================
91 CORBA::Double GHS3DPlugin_Hypothesis_i::GetMinSize()
93 return this->GetImpl()->GetMinSize();
96 //=============================================================================
97 CORBA::Double GHS3DPlugin_Hypothesis_i::GetMinSizeDefault()
99 return this->GetImpl()->GetMinSizeDefault();
102 //=============================================================================
103 void GHS3DPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize)
105 if ( GetMaxSize() != theMaxSize ) {
106 this->GetImpl()->SetMaxSize( theMaxSize );
107 SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
111 //=============================================================================
112 CORBA::Double GHS3DPlugin_Hypothesis_i::GetMaxSize()
114 return this->GetImpl()->GetMaxSize();
117 //=============================================================================
118 CORBA::Double GHS3DPlugin_Hypothesis_i::GetMaxSizeDefault()
120 return this->GetImpl()->GetMaxSizeDefault();
123 //=============================================================================
124 void GHS3DPlugin_Hypothesis_i::SetMinMaxSizeDefault( CORBA::Double theMinSize,
125 CORBA::Double theMaxSize )
127 this->GetImpl()->SetMinMaxSizeDefault( theMinSize, theMaxSize );
130 //=============================================================================
132 * Activate/deactivate volume proximity computation
134 void GHS3DPlugin_Hypothesis_i::SetVolumeProximity( CORBA::Boolean toUse )
136 if ( GetVolumeProximity() != toUse )
138 this->GetImpl()->SetUseVolumeProximity( toUse );
139 SMESH::TPythonDump() << _this() << ".SetVolumeProximity( " << toUse << " )";
143 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetVolumeProximity()
145 return this->GetImpl()->GetUseVolumeProximity();
149 //=============================================================================
151 * Set number of surface element layers to be generated due to volume proximity
153 void GHS3DPlugin_Hypothesis_i::SetNbVolumeProximityLayers( CORBA::Short nbLayers )
155 if ( GetNbVolumeProximityLayers() != nbLayers )
157 this->GetImpl()->SetNbVolumeProximityLayers( nbLayers );
158 SMESH::TPythonDump() << _this() << ".SetNbVolumeProximityLayers( " << nbLayers << " )";
162 CORBA::Short GHS3DPlugin_Hypothesis_i::GetNbVolumeProximityLayers()
164 return this->GetImpl()->GetNbVolumeProximityLayers();
167 //=======================================================================
168 //function : SetToMakeGroupsOfDomains
169 //=======================================================================
171 void GHS3DPlugin_Hypothesis_i::SetToMakeGroupsOfDomains(CORBA::Boolean toMakeGroups)
174 this->GetImpl()->SetToMakeGroupsOfDomains(toMakeGroups);
175 SMESH::TPythonDump() << _this() << ".SetToMakeGroupsOfDomains( " << toMakeGroups << " )";
178 //=======================================================================
179 //function : GetToMakeGroupsOfDomains
180 //=======================================================================
182 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToMakeGroupsOfDomains()
185 return this->GetImpl()->GetToMakeGroupsOfDomains();
188 //=======================================================================
189 //function : SetMaximumMemory
190 //=======================================================================
192 void GHS3DPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Float MB)
195 THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
197 this->GetImpl()->SetMaximumMemory(MB);
198 SMESH::TPythonDump() << _this() << ".SetMaximumMemory( " << MB << " )";
201 //=======================================================================
202 //function : GetMaximumMemory
203 //=======================================================================
205 CORBA::Float GHS3DPlugin_Hypothesis_i::GetMaximumMemory()
208 return this->GetImpl()->GetMaximumMemory();
211 //=======================================================================
212 //function : SetInitialMemory
213 //=======================================================================
215 void GHS3DPlugin_Hypothesis_i::SetInitialMemory(CORBA::Float MB)
218 THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
220 this->GetImpl()->SetInitialMemory(MB);
221 SMESH::TPythonDump() << _this() << ".SetInitialMemory( " << MB << " )";
224 //=======================================================================
225 //function : GetInitialMemory
226 //=======================================================================
228 CORBA::Float GHS3DPlugin_Hypothesis_i::GetInitialMemory()
231 return this->GetImpl()->GetInitialMemory();
234 //=======================================================================
235 //function : SetOptimizationLevel
236 //=======================================================================
238 void GHS3DPlugin_Hypothesis_i::SetOptimizationLevel(CORBA::Short level)
240 ::GHS3DPlugin_Hypothesis::OptimizationLevel l =
241 (::GHS3DPlugin_Hypothesis::OptimizationLevel) level;
242 if ( l < ::GHS3DPlugin_Hypothesis::None ||
243 l > ::GHS3DPlugin_Hypothesis::Strong )
244 THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
247 this->GetImpl()->SetOptimizationLevel(l);
248 SMESH::TPythonDump() << _this() << ".SetOptimizationLevel( " << level << " )";
251 //=======================================================================
252 //function : GetOptimizationLevel
253 //=======================================================================
255 CORBA::Short GHS3DPlugin_Hypothesis_i::GetOptimizationLevel()
258 return this->GetImpl()->GetOptimizationLevel();
261 //=======================================================================
262 //function : SetWorkingDirectory
263 //=======================================================================
265 void GHS3DPlugin_Hypothesis_i::SetWorkingDirectory(const char* path)
268 THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
271 const char lastChar = *file.rbegin();
273 if ( lastChar != '\\' ) file += '\\';
275 if ( lastChar != '/' ) file += '/';
278 SMESH_Mesh_i::PrepareForWriting (file.c_str());
281 this->GetImpl()->SetWorkingDirectory(path);
282 SMESH::TPythonDump() << _this() << ".SetWorkingDirectory( '" << path << "' )";
285 //=======================================================================
286 //function : GetWorkingDirectory
287 //=======================================================================
289 char* GHS3DPlugin_Hypothesis_i::GetWorkingDirectory()
292 return CORBA::string_dup( this->GetImpl()->GetWorkingDirectory().c_str() );
295 //=======================================================================
296 //function : SetKeepFiles
297 //=======================================================================
299 void GHS3DPlugin_Hypothesis_i::SetKeepFiles(CORBA::Boolean toKeep)
302 this->GetImpl()->SetKeepFiles(toKeep);
303 SMESH::TPythonDump() << _this() << ".SetKeepFiles( " << toKeep << " )";
306 //=======================================================================
307 //function : GetKeepFiles
308 //=======================================================================
310 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetKeepFiles()
313 return this->GetImpl()->GetKeepFiles();
316 //=======================================================================
317 //function : SetVerboseLevel
318 //=======================================================================
320 void GHS3DPlugin_Hypothesis_i::SetVerboseLevel(CORBA::Short level)
322 if (level < 0 || level > 10 )
323 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbose level, valid range is [0-10]",
326 this->GetImpl()->SetVerboseLevel(level);
327 SMESH::TPythonDump() << _this() << ".SetVerboseLevel( " << level << " )";
330 //=======================================================================
331 //function : GetVerboseLevel
332 //=======================================================================
334 CORBA::Short GHS3DPlugin_Hypothesis_i::GetVerboseLevel()
337 return this->GetImpl()->GetVerboseLevel();
340 //=======================================================================
341 //function : SetToCreateNewNodes
342 //=======================================================================
344 void GHS3DPlugin_Hypothesis_i::SetToCreateNewNodes(CORBA::Boolean toCreate)
347 this->GetImpl()->SetToCreateNewNodes(toCreate);
348 SMESH::TPythonDump() << _this() << ".SetToCreateNewNodes( " << toCreate << " )";
351 //=======================================================================
352 //function : GetToCreateNewNodes
353 //=======================================================================
355 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToCreateNewNodes()
358 return this->GetImpl()->GetToCreateNewNodes();
361 //=======================================================================
362 //function : SetToUseBoundaryRecoveryVersion
363 //=======================================================================
365 void GHS3DPlugin_Hypothesis_i::SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse)
368 this->GetImpl()->SetToUseBoundaryRecoveryVersion(toUse);
369 SMESH::TPythonDump() << _this() << ".SetToUseBoundaryRecoveryVersion( " << toUse << " )";
372 //=======================================================================
373 //function : GetToUseBoundaryRecoveryVersion
374 //=======================================================================
376 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToUseBoundaryRecoveryVersion()
379 return this->GetImpl()->GetToUseBoundaryRecoveryVersion();
382 //=======================================================================
383 //function : SetFEMCorrection
384 //=======================================================================
386 void GHS3DPlugin_Hypothesis_i::SetFEMCorrection(CORBA::Boolean toUseFem)
389 this->GetImpl()->SetFEMCorrection(toUseFem);
390 SMESH::TPythonDump() << _this() << ".SetFEMCorrection( " << toUseFem << " )";
393 //=======================================================================
394 //function : GetFEMCorrection
395 //=======================================================================
397 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetFEMCorrection()
400 return this->GetImpl()->GetFEMCorrection();
403 //=======================================================================
404 //function : SetToRemoveCentralPoint
405 //=======================================================================
407 void GHS3DPlugin_Hypothesis_i::SetToRemoveCentralPoint(CORBA::Boolean toRemove)
410 this->GetImpl()->SetToRemoveCentralPoint(toRemove);
411 SMESH::TPythonDump() << _this() << ".SetToRemoveCentralPoint( " << toRemove << " )";
414 //=======================================================================
415 //function : GetToRemoveCentralPoint
416 //=======================================================================
418 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToRemoveCentralPoint()
421 return this->GetImpl()->GetToRemoveCentralPoint();
424 //=======================================================================
425 //function : SetTextOption
426 //=======================================================================
428 void GHS3DPlugin_Hypothesis_i::SetTextOption(const char* option)
430 SetAdvancedOption(option);
433 //=======================================================================
434 //function : GetTextOption
435 //=======================================================================
437 char* GHS3DPlugin_Hypothesis_i::GetTextOption()
439 return GetAdvancedOption();
442 //=======================================================================
443 //function : SetAdvancedOption
444 //=======================================================================
446 // void GHS3DPlugin_Hypothesis_i::SetAdvancedOption(const char* option)
448 // ASSERT(myBaseImpl);
449 // this->GetImpl()->SetAdvancedOption(option);
450 // SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << option << "' )";
453 //=======================================================================
454 //function : GetAdvancedOption
455 //=======================================================================
457 char* GHS3DPlugin_Hypothesis_i::GetAdvancedOption()
460 return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
463 //=============================================================================
465 void GHS3DPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
469 std::string name( optionName );
470 if ( !optionValue || !optionValue[0] )
471 UnsetOption( optionName );
473 // basic options (visible in Advanced table)
475 else if ( name == "verbose" )
476 SetVerboseLevel( GetImpl()->ToInt( optionValue ));
478 else if ( name == "max_memory" )
479 SetMaximumMemory( GetImpl()->ToInt( optionValue ));
481 else if ( name == "automatic_memory" )
482 SetInitialMemory( GetImpl()->ToInt( optionValue ));
484 else if ( name == "no_initial_central_point" && // optimizer
485 strcmp( GetImpl()->GetName(), ::GHS3DPlugin_Hypothesis::GetHypType() ) != 0 )
487 //if ( strcmp( optionValue, ::GHS3DPlugin_Hypothesis::NoValue() ) == 0 )
488 if ( !optionValue[0] )
489 SetToRemoveCentralPoint( true );
491 SetToRemoveCentralPoint( GetImpl()->ToBool( optionValue ));
493 else if ( name == "no_internal_points" && // optimizer
494 strcmp( GetImpl()->GetName(), ::GHS3DPlugin_Hypothesis::GetHypType() ) != 0)
496 //if ( strcmp( optionValue, ::GHS3DPlugin_Hypothesis::NoValue() ) == 0 )
497 if ( !optionValue[0] )
498 SetToRemoveCentralPoint( true );
500 SetToCreateNewNodes( GetImpl()->ToBool( optionValue ));
502 else if ( name == "min_size" )
503 SetMinSize( GetImpl()->ToDbl( optionValue ));
505 else if ( name == "max_size" )
506 SetMaxSize( GetImpl()->ToDbl( optionValue ));
508 else if ( name == "gradation" )
509 SetGradation( GetImpl()->ToDbl( optionValue ));
511 else if ( name == "volume_proximity_layers" )
512 SetNbVolumeProximityLayers( GetImpl()->ToInt( optionValue ));
514 else if ( name == "components" )
515 SetToMeshHoles( strncmp( "all", optionValue, 3 ) == 0 );
517 // advanced options (for backward compatibility)
518 // else if ( name == "create_tag_on_collision" ||
519 // name == "tiny_edge_respect_geometry" )
520 // AddOption( optionName, optionValue );
523 bool valueChanged = true;
525 valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue );
527 catch ( std::invalid_argument& ) {
531 this->GetImpl()->SetOptionValue(optionName, optionValue);
532 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
535 } catch (const std::invalid_argument& ex) {
536 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
537 } catch (SALOME_Exception& ex) {
538 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
542 //=============================================================================
544 char* GHS3DPlugin_Hypothesis_i::GetOptionValue(const char* optionName)
549 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
550 } catch (const std::invalid_argument& ex) {
551 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
552 } catch (SALOME_Exception& ex) {
553 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
558 //=============================================================================
560 void GHS3DPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
562 if ( !GetImpl()->GetOptionValue( optionName ).empty() )
564 this->GetImpl()->ClearOption(optionName);
565 SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
569 //=============================================================================
571 GHS3DPlugin::string_array* GHS3DPlugin_Hypothesis_i::GetOptionValues()
573 GHS3DPlugin::string_array_var result = new GHS3DPlugin::string_array();
575 const ::GHS3DPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
576 result->length(opts.size());
580 ::GHS3DPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
581 for (; opIt != opts.end(); ++opIt, ++i)
583 string name_value_type = opIt->first;
584 //if (!opIt->second.empty())
586 name_value_type += ":";
587 name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
588 name_value_type += isDefault ? ":0" : ":1";
590 result[i] = CORBA::string_dup(name_value_type.c_str());
593 return result._retn();
596 //=============================================================================
598 GHS3DPlugin::string_array* GHS3DPlugin_Hypothesis_i::GetAdvancedOptionValues()
600 GHS3DPlugin::string_array_var result = new GHS3DPlugin::string_array();
602 const ::GHS3DPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
603 result->length(custom_opts.size());
606 ::GHS3DPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
607 for (; opIt != custom_opts.end(); ++opIt, ++i) {
608 string name_value_type = opIt->first;
609 if (!opIt->second.empty()) {
610 name_value_type += ":";
611 name_value_type += opIt->second;
612 name_value_type += ":1"; // user defined
614 result[i] = CORBA::string_dup(name_value_type.c_str());
616 return result._retn();
619 //=============================================================================
621 void GHS3DPlugin_Hypothesis_i::SetOptionValues(const GHS3DPlugin::string_array& options)
623 for (CORBA::ULong i = 0; i < options.length(); ++i)
625 string name_value_type = options[i].in();
626 if(name_value_type.empty())
628 size_t colonPos = name_value_type.find(':');
630 if (colonPos == string::npos) // ':' not found
631 name = name_value_type;
633 name = name_value_type.substr(0, colonPos);
634 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
635 string value_type = name_value_type.substr(colonPos + 1);
636 colonPos = value_type.find(':');
637 value = value_type.substr(0, colonPos);
638 if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
639 if ( value_type.substr(colonPos + 1) == "0" ) // is default
643 SetOptionValue(name.c_str(), value.c_str());
647 //=============================================================================
649 void GHS3DPlugin_Hypothesis_i::SetAdvancedOptionValues(const GHS3DPlugin::string_array& options)
651 SMESH::TPythonDump dump;
653 string optionsAndValues;
654 for ( CORBA::ULong i = 0; i < options.length(); ++i) {
655 string name_value_type = options[i].in();
656 if(name_value_type.empty())
658 size_t colonPos = name_value_type.find(':');
660 if (colonPos == string::npos) // ':' not found
661 name = name_value_type;
663 name = name_value_type.substr(0, colonPos);
664 if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
665 string value_type = name_value_type.substr(colonPos + 1);
666 colonPos = value_type.find(':');
667 value = value_type.substr(0, colonPos);
670 AddOption(name.c_str(), value.c_str());
672 optionsAndValues += name + " " + value + " ";
675 if ( !optionsAndValues.empty() )
676 dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
679 //=============================================================================
681 void GHS3DPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
683 if ( !optionsAndValues ) return;
685 SMESH::TPythonDump dump;
687 std::istringstream strm( optionsAndValues );
688 std::istream_iterator<std::string> sIt( strm ), sEnd;
689 for ( int nbPairs = 0; sIt != sEnd; ++nbPairs )
691 std::string option = *sIt;
694 std::string value = *sIt;
696 AddOption( option.c_str(), value.c_str() );
701 THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
702 AddOption( option.c_str(), "" );
705 dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
708 //=============================================================================
710 void GHS3DPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
713 bool valueChanged = ( !this->GetImpl()->HasOptionDefined(optionName) ||
714 this->GetImpl()->GetOptionValue(optionName) != optionValue );
716 this->GetImpl()->SetOptionValue(optionName, optionValue);
717 SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
721 //=============================================================================
723 char* GHS3DPlugin_Hypothesis_i::GetOption(const char* optionName)
726 return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName).c_str());
729 //=======================================================================
730 //function : SetGradation
731 //=======================================================================
733 void GHS3DPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
736 if (gradation != GetGradation()) {
737 this->GetImpl()->SetGradation(gradation);
738 SMESH::TPythonDump() << _this() << ".SetGradation( " << gradation << " )";
742 //=======================================================================
743 //function : GetGradation
744 //=======================================================================
746 CORBA::Double GHS3DPlugin_Hypothesis_i::GetGradation()
749 return this->GetImpl()->GetGradation();
752 //=======================================================================
753 //function : SetStandardOutputLog
754 //=======================================================================
756 void GHS3DPlugin_Hypothesis_i::SetStandardOutputLog(CORBA::Boolean logInStandardOutput)
759 this->GetImpl()->SetStandardOutputLog(logInStandardOutput);
760 SMESH::TPythonDump() << _this() << ".SetStandardOutputLog( " << logInStandardOutput << " )";
763 //=======================================================================
764 //function : GetStandardOutputLog
765 //=======================================================================
767 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetStandardOutputLog()
770 return this->GetImpl()->GetStandardOutputLog();
773 //=======================================================================
774 //function : SetRemoveLogOnSuccess
775 //=======================================================================
777 void GHS3DPlugin_Hypothesis_i::SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess)
780 this->GetImpl()->SetRemoveLogOnSuccess(removeLogOnSuccess);
781 SMESH::TPythonDump() << _this() << ".SetRemoveLogOnSuccess( " << removeLogOnSuccess << " )";
784 //=======================================================================
785 //function : GetRemoveLogOnSuccess
786 //=======================================================================
788 CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
791 return this->GetImpl()->GetRemoveLogOnSuccess();
794 //=======================================================================
795 //function : SetEnforcedVertex
796 //=======================================================================
798 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
801 return p_SetEnforcedVertex(size, x, y, z);
804 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
807 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
810 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
813 return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
816 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
819 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
822 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size)
826 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
827 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
830 string theVertexEntry = theVertex->GetStudyEntry();
831 CORBA::Double x = 0, y = 0, z = 0;
832 CORBA::Boolean isCompound = false;
833 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
834 if (theVertexEntry.empty()) {
836 if (theVertex->GetShapeType() == GEOM::VERTEX) {
839 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
843 aName += theVertex->GetEntry();
844 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
845 if (!theSVertex->_is_nil())
846 theVertexEntry = theSVertex->GetID();
848 if (theVertexEntry.empty())
849 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
851 if (theVertex->GetShapeType() == GEOM::VERTEX) {
852 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
853 if (CORBA::is_nil(measureOp))
856 measureOp->PointCoordinates (theVertex, x, y, z);
859 string theVertexName = theVertex->GetName();
861 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
864 bool GHS3DPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName)
868 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
869 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
872 string theVertexEntry = theVertex->GetStudyEntry();
873 CORBA::Double x = 0, y = 0, z = 0;
874 CORBA::Boolean isCompound = false;
875 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
876 if (theVertexEntry.empty()) {
878 if (theVertex->GetShapeType() == GEOM::VERTEX) {
881 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
885 aName += theVertex->GetEntry();
886 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
887 if (!theSVertex->_is_nil())
888 theVertexEntry = theSVertex->GetID();
890 if (theVertexEntry.empty())
891 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
893 if (theVertex->GetShapeType() == GEOM::VERTEX) {
894 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
895 if (CORBA::is_nil(measureOp))
898 measureOp->PointCoordinates (theVertex, x, y, z);
901 string theVertexName = theVertex->GetName();
903 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
906 bool GHS3DPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x, CORBA::Double y, CORBA::Double z,
907 const char* theVertexName, const char* theVertexEntry, const char* theGroupName,
908 CORBA::Boolean isCompound)
911 bool newValue = false;
913 ::GHS3DPlugin_Hypothesis::TCoordsGHS3DEnforcedVertexMap coordsList;
914 ::GHS3DPlugin_Hypothesis::TGeomEntryGHS3DEnforcedVertexMap enfVertexEntryList;
915 if (string(theVertexEntry).empty()) {
916 coordsList = this->GetImpl()->_GetEnforcedVerticesByCoords();
917 std::vector<double> coords;
921 if (coordsList.find(coords) == coordsList.end()) {
925 ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
926 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
932 if (string(theVertexName).empty()) {
933 if (string(theGroupName).empty())
934 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ")";
936 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theGroupName << "\")";
939 if (string(theGroupName).empty())
940 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\")";
942 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\", \"" << theGroupName << "\")";
947 enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
948 if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
952 ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
953 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
959 if (string(theGroupName).empty())
960 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeom(" << theVertexEntry << ", " << size << ")";
962 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeomWithGroup(" << theVertexEntry << ", " << size << ", \"" << theGroupName << "\")";
967 this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
972 //=======================================================================
973 //function : GetEnforcedVertex
974 //=======================================================================
976 CORBA::Double GHS3DPlugin_Hypothesis_i::GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
980 bool isDone = this->GetImpl()->GetEnforcedVertex(x,y,z)->size;
981 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertex(" << x << ", " << y << ", " << z << ")";
984 catch (const std::invalid_argument& ex) {
985 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
987 catch (SALOME_Exception& ex) {
988 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
992 //=======================================================================
993 //function : GetEnforcedVertex
994 //=======================================================================
996 CORBA::Double GHS3DPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
1000 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1001 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1004 string theVertexEntry = theVertex->GetStudyEntry();
1005 if (theVertexEntry.empty()) {
1006 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
1008 if (theVertex->GetShapeType() == GEOM::VERTEX)
1010 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1011 aName = "Compound_";
1012 aName += theVertex->GetEntry();
1013 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
1014 if (!theSVertex->_is_nil())
1015 theVertexEntry = theSVertex->GetID();
1017 if (theVertexEntry.empty())
1018 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1020 string theVertexName = theVertex->GetName();
1023 bool isDone = this->GetImpl()->GetEnforcedVertex(theVertexName)->size;
1024 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertexGeom(" << theVertex << ")";
1027 catch (const std::invalid_argument& ex) {
1028 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1030 catch (SALOME_Exception& ex) {
1031 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1035 //=======================================================================
1036 //function : GetEnforcedVertices
1037 //=======================================================================
1039 GHS3DPlugin::GHS3DEnforcedVertexList* GHS3DPlugin_Hypothesis_i::GetEnforcedVertices()
1042 GHS3DPlugin::GHS3DEnforcedVertexList_var result = new GHS3DPlugin::GHS3DEnforcedVertexList();
1044 const ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList enfVertexList = this->GetImpl()->_GetEnforcedVertices();
1045 result->length( enfVertexList.size() );
1047 ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertexList::const_iterator it = enfVertexList.begin();
1049 for (int i = 0 ; it != enfVertexList.end(); ++it, ++i ) {
1050 ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedVertex* currentVertex = (*it);
1051 GHS3DPlugin::GHS3DEnforcedVertex_var enfVertex = new GHS3DPlugin::GHS3DEnforcedVertex();
1053 enfVertex->name = CORBA::string_dup(currentVertex->name.c_str());
1054 // Geom Vertex Entry
1055 enfVertex->geomEntry = CORBA::string_dup(currentVertex->geomEntry.c_str());
1057 GHS3DPlugin::TCoords_var coords = new GHS3DPlugin::TCoords();
1058 coords->length(currentVertex->coords.size());
1059 for ( size_t ind = 0; ind < currentVertex->coords.size(); ind++)
1060 coords[ind] = currentVertex->coords[ind];
1061 enfVertex->coords = coords;
1063 enfVertex->groupName = CORBA::string_dup(currentVertex->groupName.c_str());
1065 enfVertex->size = currentVertex->size;
1067 enfVertex->isCompound = currentVertex->isCompound;
1069 result[i]=enfVertex;
1072 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
1074 return result._retn();
1077 //=======================================================================
1078 //function : RemoveEnforcedVertex
1079 //=======================================================================
1081 bool GHS3DPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
1085 bool res = this->GetImpl()->RemoveEnforcedVertex(x,y,z);
1086 SMESH::TPythonDump() << " isDone = " << _this() << ".RemoveEnforcedVertex( " << x << ", " << y << ", " << z << " )";
1089 catch (const std::invalid_argument& ex) {
1090 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1092 catch (SALOME_Exception& ex) {
1093 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1097 bool GHS3DPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
1101 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1102 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1105 string theVertexEntry = theVertex->GetStudyEntry();
1106 if (theVertexEntry.empty()) {
1107 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
1109 if (theVertex->GetShapeType() == GEOM::VERTEX)
1111 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1112 aName = "Compound_";
1113 aName += theVertex->GetEntry();
1114 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
1115 if (!theSVertex->_is_nil())
1116 theVertexEntry = theSVertex->GetID();
1118 if (theVertexEntry.empty())
1119 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1122 bool res = this->GetImpl()->RemoveEnforcedVertex(0,0,0, theVertexEntry.c_str());
1123 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom( " << theVertexEntry.c_str() << " )";
1126 catch (const std::invalid_argument& ex) {
1127 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1129 catch (SALOME_Exception& ex) {
1130 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1134 //=======================================================================
1135 //function : ClearEnforcedVertices
1136 //=======================================================================
1138 void GHS3DPlugin_Hypothesis_i::ClearEnforcedVertices()
1141 this->GetImpl()->ClearEnforcedVertices();
1142 SMESH::TPythonDump () << _this() << ".ClearEnforcedVertices() ";
1145 //=======================================================================
1146 //function : ClearEnforcedMeshes
1147 //=======================================================================
1149 void GHS3DPlugin_Hypothesis_i::ClearEnforcedMeshes()
1152 this->GetImpl()->ClearEnforcedMeshes();
1153 SMESH::TPythonDump () << _this() << ".ClearEnforcedMeshes() ";
1156 //=======================================================================
1157 //function : GetEnforcedMeshes
1158 //=======================================================================
1160 GHS3DPlugin::GHS3DEnforcedMeshList* GHS3DPlugin_Hypothesis_i::GetEnforcedMeshes()
1163 GHS3DPlugin::GHS3DEnforcedMeshList_var result = new GHS3DPlugin::GHS3DEnforcedMeshList();
1165 const ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList enfMeshList = this->GetImpl()->_GetEnforcedMeshes();
1166 result->length( enfMeshList.size() );
1168 ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList::const_iterator it = enfMeshList.begin();
1170 for (int i = 0 ; it != enfMeshList.end(); ++it, ++i ) {
1171 ::GHS3DPlugin_Hypothesis::TGHS3DEnforcedMesh* currentMesh = (*it);
1172 GHS3DPlugin::GHS3DEnforcedMesh_var enfMesh = new GHS3DPlugin::GHS3DEnforcedMesh();
1174 enfMesh->name = CORBA::string_dup(currentMesh->name.c_str());
1176 enfMesh->entry = CORBA::string_dup(currentMesh->entry.c_str());
1178 enfMesh->elementType = currentMesh->elementType;
1180 enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
1185 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
1187 return result._retn();
1191 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource. The elements will be grouped in theGroupName.
1193 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
1195 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1199 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource.
1201 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
1203 return p_SetEnforcedMesh(theSource, theType);
1207 * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size. The elements will be grouped in theGroupName.
1209 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double /*theSize*/, const char* theGroupName)
1211 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1215 * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
1217 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double /*theSize*/)
1219 return p_SetEnforcedMesh(theSource, theType);
1222 bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource,
1223 SMESH::ElementType theType,
1224 const char* theName,
1225 const char* theGroupName)
1229 if (CORBA::is_nil( theSource ))
1230 THROW_SALOME_CORBA_EXCEPTION( "The source mesh CORBA object is NULL" ,SALOME::BAD_PARAM );
1235 case SMESH::FACE: break;
1239 SMESH::array_of_ElementType_var types = theSource->GetTypes();
1240 if ( types->length() >= 1 && types[types->length()-1] < theType)
1245 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1246 SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(theSource);
1248 SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
1249 SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
1250 SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
1252 string enfMeshName = theName;
1253 if (enfMeshName.empty())
1254 enfMeshName = SObj->GetName();
1259 bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
1260 if (theGroupName && theGroupName[0] ) {
1261 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1262 << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
1265 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1266 << theSource << ".GetMesh(), " << theType << " )";
1271 catch (const std::invalid_argument& ex) {
1272 SALOME::ExceptionStruct ExDescription;
1273 ExDescription.text = ex.what();
1274 ExDescription.type = SALOME::BAD_PARAM;
1275 ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
1276 ExDescription.lineNumber = 840;
1277 throw SALOME::SALOME_Exception(ExDescription);
1279 catch (SALOME_Exception& ex) {
1280 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1283 else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
1286 bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1287 if ( theGroupName && theGroupName[0] ) {
1288 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1289 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1292 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1293 << theSource << ", " << theType << " )";
1297 catch (const std::invalid_argument& ex) {
1298 SALOME::ExceptionStruct ExDescription;
1299 ExDescription.text = ex.what();
1300 ExDescription.type = SALOME::BAD_PARAM;
1301 ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
1302 ExDescription.lineNumber = 840;
1303 throw SALOME::SALOME_Exception(ExDescription);
1305 catch (SALOME_Exception& ex) {
1306 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1309 else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
1312 bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1313 if ( theGroupName && theGroupName[0] ) {
1314 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1315 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1318 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1319 << theSource << ", " << theType << " )";
1323 catch (const std::invalid_argument& ex) {
1324 SALOME::ExceptionStruct ExDescription;
1325 ExDescription.text = ex.what();
1326 ExDescription.type = SALOME::BAD_PARAM;
1327 ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
1328 ExDescription.lineNumber = 840;
1329 throw SALOME::SALOME_Exception(ExDescription);
1331 catch (SALOME_Exception& ex) {
1332 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1337 //=============================================================================
1339 * Get implementation
1341 //=============================================================================
1343 ::GHS3DPlugin_Hypothesis* GHS3DPlugin_Hypothesis_i::GetImpl()
1345 return (::GHS3DPlugin_Hypothesis*)myBaseImpl;
1348 //================================================================================
1350 * \brief Verify whether hypothesis supports given entity type
1352 //================================================================================
1354 CORBA::Boolean GHS3DPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
1356 return type == SMESH::DIM_3D;
1360 //================================================================================
1362 * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
1364 //================================================================================
1367 GHS3DPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
1368 std::vector< int > & /*subIDArray*/ ) const
1370 typedef ::GHS3DPlugin_Hypothesis THyp;
1371 const THyp* h = static_cast< const THyp*>( myBaseImpl );
1374 const THyp::TGHS3DEnforcedVertexList& enfVertexList = h->_GetEnforcedVertices();
1375 THyp::TGHS3DEnforcedVertexList::const_iterator evIt = enfVertexList.begin();
1376 for ( ; evIt != enfVertexList.end(); ++evIt )
1378 const THyp::TGHS3DEnforcedVertex* ev = *evIt;
1379 entryArray.push_back( ev->geomEntry );
1383 const THyp::TGHS3DEnforcedVertexEntryValues&
1384 enfVertexEntrySizeList = h->_GetEnforcedVerticesEntrySize();
1385 THyp::TGHS3DEnforcedVertexEntryValues::const_iterator entry2size;
1386 for ( entry2size = enfVertexEntrySizeList.cbegin();
1387 entry2size != enfVertexEntrySizeList.cend();
1390 entryArray.push_back( entry2size->first );
1394 const THyp::TCoordsGHS3DEnforcedVertexMap&
1395 coordsEnfVertexMap = h->_GetEnforcedVerticesByCoords();
1396 THyp::TCoordsGHS3DEnforcedVertexMap::const_iterator size2ev = coordsEnfVertexMap.cbegin();
1397 for ( ; size2ev != coordsEnfVertexMap.cend(); ++size2ev )
1399 const THyp::TGHS3DEnforcedVertex* ev = size2ev->second;
1400 entryArray.push_back( ev->geomEntry );
1404 const THyp::TGeomEntryGHS3DEnforcedVertexMap&
1405 geomEntryEnfVertexMap = h->_GetEnforcedVerticesByEntry();
1406 THyp::TGeomEntryGHS3DEnforcedVertexMap::const_iterator entry2ev;
1407 for ( entry2ev = geomEntryEnfVertexMap.cbegin();
1408 entry2ev != geomEntryEnfVertexMap.cend();
1411 entryArray.push_back( entry2ev->first );
1413 const THyp::TGHS3DEnforcedVertex* ev = entry2ev->second;
1414 entryArray.push_back( ev->geomEntry );
1418 return entryArray.size() > 0;
1421 //================================================================================
1423 * \brief Set new geometry instead of that returned by getObjectsDependOn()
1425 //================================================================================
1428 GHS3DPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
1429 std::vector< int > & /*subIDArray*/ )
1431 typedef ::GHS3DPlugin_Hypothesis THyp;
1432 THyp* h = static_cast< THyp*>( myBaseImpl );
1436 THyp::TGHS3DEnforcedVertexList& enfVertexList =
1437 const_cast<THyp::TGHS3DEnforcedVertexList& >( h->_GetEnforcedVertices() );
1438 THyp::TGHS3DEnforcedVertexList::iterator evIt = enfVertexList.begin();
1439 for ( ; evIt != enfVertexList.end(); ++evIt )
1441 THyp::TGHS3DEnforcedVertex* ev = *evIt;
1442 ev->geomEntry = entryArray[ iEnt++ ];
1446 THyp::TGHS3DEnforcedVertexEntryValues& enfVertexEntrySizeListNew =
1447 const_cast< THyp::TGHS3DEnforcedVertexEntryValues& > ( h->_GetEnforcedVerticesEntrySize() );
1448 THyp::TGHS3DEnforcedVertexEntryValues enfVertexEntrySizeList;
1449 enfVertexEntrySizeList.swap( enfVertexEntrySizeListNew );
1450 THyp::TGHS3DEnforcedVertexEntryValues::const_iterator entry2size;
1451 for ( entry2size = enfVertexEntrySizeList.cbegin();
1452 entry2size != enfVertexEntrySizeList.cend();
1453 entry2size++, ++iEnt )
1455 if ( entry2size->first.empty() == entryArray[ iEnt ].empty() )
1456 enfVertexEntrySizeListNew[ entryArray[ iEnt ]] = entry2size->second;
1460 THyp::TCoordsGHS3DEnforcedVertexMap& coordsEnfVertexMap =
1461 const_cast< THyp::TCoordsGHS3DEnforcedVertexMap& > ( h->_GetEnforcedVerticesByCoords() );
1462 THyp::TCoordsGHS3DEnforcedVertexMap::iterator size2ev = coordsEnfVertexMap.begin();
1463 for ( ; size2ev != coordsEnfVertexMap.end(); ++size2ev )
1465 THyp::TGHS3DEnforcedVertex* ev = size2ev->second;
1466 ev->geomEntry = entryArray[ iEnt++ ];
1470 THyp::TGeomEntryGHS3DEnforcedVertexMap& geomEntryEnfVertexMapNew =
1471 const_cast< THyp::TGeomEntryGHS3DEnforcedVertexMap& > ( h->_GetEnforcedVerticesByEntry() );
1472 THyp::TGeomEntryGHS3DEnforcedVertexMap geomEntryEnfVertexMap;
1473 geomEntryEnfVertexMap.swap( geomEntryEnfVertexMapNew );
1474 THyp::TGeomEntryGHS3DEnforcedVertexMap::iterator entry2ev;
1475 for ( entry2ev = geomEntryEnfVertexMap.begin();
1476 entry2ev != geomEntryEnfVertexMap.end();
1479 const std::string& entry = entryArray[ iEnt++ ];
1480 THyp::TGHS3DEnforcedVertex* ev = entry2ev->second;
1481 ev->geomEntry = entryArray[ iEnt++ ];
1483 geomEntryEnfVertexMapNew[ entry ] = ev;
1487 return iEnt == entryArray.size();