1 // Copyright (C) 2007-2016 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 : HYBRIDPlugin_Hypothesis_i.cxx
22 // Author : Christian VAN WAMBEKE (CEA)
25 #include "HYBRIDPlugin_Hypothesis_i.hxx"
27 #include "SMESH_Gen.hxx"
28 #include "SMESH_PythonDump.hxx"
29 //#include "SMESH_Mesh.hxx"
30 //#include "SMESH_ProxyMesh.hxx"
31 //#include <StdMeshers_QuadToTriaAdaptor.hxx>
33 #include "Utils_CorbaException.hxx"
34 #include "utilities.h"
35 #include "SMESH_Mesh_i.hxx"
36 #include "SMESH_Group_i.hxx"
37 #include "SMESH_Gen_i.hxx"
38 #include "SMESH_TypeDefs.hxx"
39 #include "SMESHDS_GroupBase.hxx"
41 // SALOME KERNEL includes
42 #include "SALOMEDSClient.hxx"
43 #include <SALOMEDSClient_definitions.hxx>
45 // #include <SALOMEconfig.h>
46 // #include CORBA_SERVER_HEADER(SALOMEDS)
48 //=======================================================================
49 //function : HYBRIDPlugin_Hypothesis_i
50 //=======================================================================
51 HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
53 ::SMESH_Gen* theGenImpl)
54 : SALOME::GenericObj_i( thePOA ),
55 SMESH_Hypothesis_i( thePOA )
57 myBaseImpl = new ::HYBRIDPlugin_Hypothesis (theGenImpl->GetANewId(),
62 //=======================================================================
63 //function : ~HYBRIDPlugin_Hypothesis_i
64 //=======================================================================
65 HYBRIDPlugin_Hypothesis_i::~HYBRIDPlugin_Hypothesis_i()
69 //=======================================================================
70 //function : SetLayersOnAllWrap
71 //=======================================================================
73 void HYBRIDPlugin_Hypothesis_i::SetLayersOnAllWrap(CORBA::Boolean toMesh)
76 this->GetImpl()->SetLayersOnAllWrap(toMesh);
77 SMESH::TPythonDump() << _this() << ".SetLayersOnAllWrap( " << toMesh << " )";
80 //=======================================================================
81 //function : GetLayersOnAllWrap
82 //=======================================================================
84 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetLayersOnAllWrap()
87 return this->GetImpl()->GetLayersOnAllWrap();
90 //=======================================================================
91 //function : SetFacesWithLayers
92 //=======================================================================
94 void HYBRIDPlugin_Hypothesis_i::SetFacesWithLayers(const ::SMESH::long_array& theVal)
96 std::vector<int> ids( theVal.length() );
97 for ( size_t i = 0; i < ids.size(); ++i )
100 bool valueChanged = this->GetImpl()->SetFacesWithLayers(ids);
102 SMESH::TPythonDump() << _this() << ".SetFacesWithLayers( "<< theVal << " )";
105 //=======================================================================
106 //function : GetFacesWithLayers
107 //=======================================================================
109 SMESH::long_array* HYBRIDPlugin_Hypothesis_i::GetFacesWithLayers()
111 const std::vector<int>& idsVec = this->GetImpl()->GetFacesWithLayers();
112 SMESH::long_array_var ids = new SMESH::long_array;
113 ids->length( idsVec.size() );
114 for ( size_t i = 0; i < idsVec.size(); ++i )
119 //=======================================================================
120 //function : SetToMeshHoles
121 //=======================================================================
123 void HYBRIDPlugin_Hypothesis_i::SetToMeshHoles(CORBA::Boolean toMesh)
126 this->GetImpl()->SetToMeshHoles(toMesh);
127 SMESH::TPythonDump() << _this() << ".SetToMeshHoles( " << toMesh << " )";
130 //=======================================================================
131 //function : GetToMeshHoles
132 //=======================================================================
134 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToMeshHoles()
137 return this->GetImpl()->GetToMeshHoles();
140 //=======================================================================
141 //function : SetToMakeGroupsOfDomains
142 //=======================================================================
144 void HYBRIDPlugin_Hypothesis_i::SetToMakeGroupsOfDomains(CORBA::Boolean toMakeGroups)
147 this->GetImpl()->SetToMakeGroupsOfDomains(toMakeGroups);
148 SMESH::TPythonDump() << _this() << ".SetToMakeGroupsOfDomains( " << toMakeGroups << " )";
151 //=======================================================================
152 //function : GetToMakeGroupsOfDomains
153 //=======================================================================
155 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToMakeGroupsOfDomains()
158 return this->GetImpl()->GetToMakeGroupsOfDomains();
161 //=======================================================================
162 //function : SetMaximumMemory
163 //=======================================================================
165 void HYBRIDPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Double MB)
166 throw ( SALOME::SALOME_Exception )
169 THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
171 this->GetImpl()->SetMaximumMemory(MB);
172 SMESH::TPythonDump() << _this() << ".SetMaximumMemory( " << MB << " )";
175 //=======================================================================
176 //function : GetMaximumMemory
177 //=======================================================================
179 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetMaximumMemory()
182 return this->GetImpl()->GetMaximumMemory();
185 //=======================================================================
186 //function : SetInitialMemory
187 //=======================================================================
189 void HYBRIDPlugin_Hypothesis_i::SetInitialMemory(CORBA::Double MB)
190 throw ( SALOME::SALOME_Exception )
193 THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
195 this->GetImpl()->SetInitialMemory(MB);
196 SMESH::TPythonDump() << _this() << ".SetInitialMemory( " << MB << " )";
199 //=======================================================================
200 //function : GetInitialMemory
201 //=======================================================================
203 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetInitialMemory()
206 return this->GetImpl()->GetInitialMemory();
209 //=======================================================================
210 //function : SetOptimizationLevel
211 //=======================================================================
213 void HYBRIDPlugin_Hypothesis_i::SetOptimizationLevel(CORBA::Short level)
214 throw ( SALOME::SALOME_Exception )
216 ::HYBRIDPlugin_Hypothesis::OptimizationLevel l =
217 (::HYBRIDPlugin_Hypothesis::OptimizationLevel) level;
218 if ( l < ::HYBRIDPlugin_Hypothesis::None ||
219 l > ::HYBRIDPlugin_Hypothesis::Strong )
220 THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
223 this->GetImpl()->SetOptimizationLevel(l);
224 SMESH::TPythonDump() << _this() << ".SetOptimizationLevel( " << level << " )";
227 //=======================================================================
228 //function : GetOptimizationLevel
229 //=======================================================================
231 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetOptimizationLevel()
234 return this->GetImpl()->GetOptimizationLevel();
238 //=======================================================================
239 //function : SetCollisionMode
240 //=======================================================================
241 void HYBRIDPlugin_Hypothesis_i::SetCollisionMode(CORBA::Short level)
242 throw ( SALOME::SALOME_Exception )
244 ::HYBRIDPlugin_Hypothesis::CollisionMode l =
245 (::HYBRIDPlugin_Hypothesis::CollisionMode) level;
246 if ( l < ::HYBRIDPlugin_Hypothesis::Decrease ||
247 l > ::HYBRIDPlugin_Hypothesis::Stop )
248 THROW_SALOME_CORBA_EXCEPTION( "Invalid collision mode",SALOME::BAD_PARAM );
251 this->GetImpl()->SetCollisionMode(l);
252 SMESH::TPythonDump() << _this() << ".SetCollisionMode( " << level << " )";
255 //=======================================================================
256 //function : GetCollisionMode
257 //=======================================================================
258 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetCollisionMode()
261 return this->GetImpl()->GetCollisionMode();
264 //=======================================================================
265 //function : SetWorkingDirectory
266 //=======================================================================
267 void HYBRIDPlugin_Hypothesis_i::SetWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception )
270 THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
272 std::string file(path);
273 const char lastChar = *file.rbegin();
275 if ( lastChar != '\\' ) file += '\\';
277 if ( lastChar != '/' ) file += '/';
279 file += "HYBRID.log";
280 SMESH_Mesh_i::PrepareForWriting (file.c_str());
283 this->GetImpl()->SetWorkingDirectory(path);
284 SMESH::TPythonDump() << _this() << ".SetWorkingDirectory( '" << path << "' )";
287 //=======================================================================
288 //function : GetWorkingDirectory
289 //=======================================================================
290 char* HYBRIDPlugin_Hypothesis_i::GetWorkingDirectory()
293 return CORBA::string_dup( this->GetImpl()->GetWorkingDirectory().c_str() );
296 //=======================================================================
297 //function : SetKeepFiles
298 //=======================================================================
299 void HYBRIDPlugin_Hypothesis_i::SetKeepFiles(CORBA::Boolean toKeep)
302 this->GetImpl()->SetKeepFiles(toKeep);
303 SMESH::TPythonDump() << _this() << ".SetKeepFiles( " << toKeep << " )";
306 //=======================================================================
307 //function : GetKeepFiles
308 //=======================================================================
309 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetKeepFiles()
312 return this->GetImpl()->GetKeepFiles();
315 //=======================================================================
316 //function : SetVerboseLevel
317 //=======================================================================
318 void HYBRIDPlugin_Hypothesis_i::SetVerboseLevel(CORBA::Short level)
319 throw ( SALOME::SALOME_Exception )
321 if (level < 0 || level > 10 )
322 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbose level, valid range is [0-10]",
325 this->GetImpl()->SetVerboseLevel(level);
326 SMESH::TPythonDump() << _this() << ".SetVerboseLevel( " << level << " )";
329 //=======================================================================
330 //function : GetVerboseLevel
331 //=======================================================================
332 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetVerboseLevel()
335 return this->GetImpl()->GetVerboseLevel();
338 //=======================================================================
339 //function : SetToCreateNewNodes
340 //=======================================================================
342 void HYBRIDPlugin_Hypothesis_i::SetToCreateNewNodes(CORBA::Boolean toCreate)
345 this->GetImpl()->SetToCreateNewNodes(toCreate);
346 SMESH::TPythonDump() << _this() << ".SetToCreateNewNodes( " << toCreate << " )";
349 //=======================================================================
350 //function : GetToCreateNewNodes
351 //=======================================================================
353 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToCreateNewNodes()
356 return this->GetImpl()->GetToCreateNewNodes();
359 //=======================================================================
360 //function : SetToUseBoundaryRecoveryVersion
361 //=======================================================================
363 void HYBRIDPlugin_Hypothesis_i::SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse)
366 this->GetImpl()->SetToUseBoundaryRecoveryVersion(toUse);
367 SMESH::TPythonDump() << _this() << ".SetToUseBoundaryRecoveryVersion( " << toUse << " )";
370 //=======================================================================
371 //function : GetToUseBoundaryRecoveryVersion
372 //=======================================================================
374 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToUseBoundaryRecoveryVersion()
377 return this->GetImpl()->GetToUseBoundaryRecoveryVersion();
380 //=======================================================================
381 //function : SetFEMCorrection
382 //=======================================================================
384 void HYBRIDPlugin_Hypothesis_i::SetFEMCorrection(CORBA::Boolean toUseFem)
387 this->GetImpl()->SetFEMCorrection(toUseFem);
388 SMESH::TPythonDump() << _this() << ".SetFEMCorrection( " << toUseFem << " )";
391 //=======================================================================
392 //function : GetFEMCorrection
393 //=======================================================================
395 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetFEMCorrection()
398 return this->GetImpl()->GetFEMCorrection();
401 //=======================================================================
402 //function : SetToRemoveCentralPoint
403 //=======================================================================
405 void HYBRIDPlugin_Hypothesis_i::SetToRemoveCentralPoint(CORBA::Boolean toRemove)
408 this->GetImpl()->SetToRemoveCentralPoint(toRemove);
409 SMESH::TPythonDump() << _this() << ".SetToRemoveCentralPoint( " << toRemove << " )";
412 //=======================================================================
413 //function : GetToRemoveCentralPoint
414 //=======================================================================
416 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToRemoveCentralPoint()
419 return this->GetImpl()->GetToRemoveCentralPoint();
422 //=======================================================================
423 //function : SetTextOption
424 //=======================================================================
425 void HYBRIDPlugin_Hypothesis_i::SetTextOption(const char* option)
428 this->GetImpl()->SetAdvancedOption(option);
429 SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << option << "' )";
432 //=======================================================================
433 //function : GetTextOption
434 //=======================================================================
435 char* HYBRIDPlugin_Hypothesis_i::GetTextOption()
438 return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
441 //=======================================================================
442 //function : SetAdvancedOption
443 //=======================================================================
444 void HYBRIDPlugin_Hypothesis_i::SetAdvancedOption(const char* theOptAndVals )
446 if ( theOptAndVals && GetImpl()->GetAdvancedOption() != theOptAndVals )
448 GetImpl()->SetAdvancedOption( theOptAndVals );
449 SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << theOptAndVals << "' )";
453 //=======================================================================
454 //function : GetAdvancedOption
455 //=======================================================================
456 char* HYBRIDPlugin_Hypothesis_i::GetAdvancedOption()
458 return CORBA::string_dup( GetImpl()->GetAdvancedOption().c_str() );
461 //=======================================================================
462 //function : SetToRemoveCentralPoint
463 //=======================================================================
465 void HYBRIDPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
468 THROW_SALOME_CORBA_EXCEPTION( "The volumic gradation must be > 1",SALOME::BAD_PARAM );
470 if (gradation != GetGradation()) {
471 this->GetImpl()->SetGradation(gradation);
472 SMESH::TPythonDump() << _this() << ".SetGradation( " << gradation << " )";
476 //=======================================================================
477 //function : GetToRemoveCentralPoint
478 //=======================================================================
480 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetGradation()
483 return this->GetImpl()->GetGradation();
486 //=======================================================================
487 //function : SetStandardOutputLog
488 //=======================================================================
489 void HYBRIDPlugin_Hypothesis_i::SetStandardOutputLog(CORBA::Boolean logInStandardOutput)
492 this->GetImpl()->SetStandardOutputLog(logInStandardOutput);
493 SMESH::TPythonDump() << _this() << ".SetPrintLogInFile( " << !logInStandardOutput << " )";
496 //=======================================================================
497 //function : GetStandardOutputLog
498 //=======================================================================
499 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetStandardOutputLog()
502 return this->GetImpl()->GetStandardOutputLog();
505 //=======================================================================
506 //function : SetRemoveLogOnSuccess
507 //=======================================================================
508 void HYBRIDPlugin_Hypothesis_i::SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess)
511 this->GetImpl()->SetRemoveLogOnSuccess(removeLogOnSuccess);
512 SMESH::TPythonDump() << _this() << ".SetRemoveLogOnSuccess( " << removeLogOnSuccess << " )";
515 //=======================================================================
516 //function : GetRemoveLogOnSuccess
517 //=======================================================================
518 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
521 return this->GetImpl()->GetRemoveLogOnSuccess();
524 //=======================================================================
525 //function : SetBoundaryLayersGrowth
526 //=======================================================================
527 void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersGrowth(CORBA::Short level)
528 throw ( SALOME::SALOME_Exception )
530 ::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth l =
531 (::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth) level;
532 if ( l < ::HYBRIDPlugin_Hypothesis::Layer_Growth_Inward ||
533 l > ::HYBRIDPlugin_Hypothesis::Layer_Growth_Outward )
534 THROW_SALOME_CORBA_EXCEPTION( "Invalid BoundaryLayersGrowth mode",SALOME::BAD_PARAM );
537 this->GetImpl()->SetBoundaryLayersGrowth(l);
538 SMESH::TPythonDump() << _this() << ".SetBoundaryLayersGrowth( " << level << " )";
541 //=======================================================================
542 //function : GetBoundaryLayersGrowth
543 //=======================================================================
544 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersGrowth()
547 return this->GetImpl()->GetBoundaryLayersGrowth();
550 //=======================================================================
551 //function : SetElementGeneration
552 //=======================================================================
553 void HYBRIDPlugin_Hypothesis_i::SetElementGeneration(CORBA::Short level)
554 throw ( SALOME::SALOME_Exception )
556 ::HYBRIDPlugin_Hypothesis::ElementGeneration l =
557 (::HYBRIDPlugin_Hypothesis::ElementGeneration) level;
558 if ( l < ::HYBRIDPlugin_Hypothesis::Generation_Tetra_Dominant ||
559 l > ::HYBRIDPlugin_Hypothesis::Generation_Hexa_Dominant )
560 THROW_SALOME_CORBA_EXCEPTION( "Invalid ElementGeneration mode",SALOME::BAD_PARAM );
563 this->GetImpl()->SetElementGeneration(l);
564 SMESH::TPythonDump() << _this() << ".SetElementGeneration( " << level << " )";
567 //=======================================================================
568 //function : GetElementGeneration
569 //=======================================================================
570 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetElementGeneration()
573 return this->GetImpl()->GetElementGeneration();
576 //=======================================================================
577 //function : SetAddMultinormals
578 //=======================================================================
579 void HYBRIDPlugin_Hypothesis_i::SetAddMultinormals(CORBA::Boolean toAddMultinormals)
582 this->GetImpl()->SetAddMultinormals(toAddMultinormals);
583 SMESH::TPythonDump() << _this() << ".SetAddMultinormals( " << toAddMultinormals << " )";
586 //=======================================================================
587 //function : GetAddMultinormals
588 //=======================================================================
589 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetAddMultinormals()
592 return this->GetImpl()->GetAddMultinormals();
595 //=======================================================================
596 //function : SetSmoothNormals
597 //=======================================================================
598 void HYBRIDPlugin_Hypothesis_i::SetSmoothNormals(CORBA::Boolean toSmoothNormals)
601 this->GetImpl()->SetSmoothNormals(toSmoothNormals);
602 SMESH::TPythonDump() << _this() << ".SetSmoothNormals( " << toSmoothNormals << " )";
605 //=======================================================================
606 //function : GetSmoothNormals
607 //=======================================================================
608 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetSmoothNormals()
611 return this->GetImpl()->GetSmoothNormals();
614 //=======================================================================
615 //function : SetHeightFirstLayer
616 //=======================================================================
617 void HYBRIDPlugin_Hypothesis_i::SetHeightFirstLayer(CORBA::Double toHeightFirstLayer)
620 this->GetImpl()->SetHeightFirstLayer(toHeightFirstLayer);
621 SMESH::TPythonDump() << _this() << ".SetHeightFirstLayer( " << toHeightFirstLayer << " )";
624 //=======================================================================
625 //function : GetHeightFirstLayer
626 //=======================================================================
627 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetHeightFirstLayer()
630 return this->GetImpl()->GetHeightFirstLayer();
633 //=======================================================================
634 //function : SetBoundaryLayersProgression
635 //=======================================================================
636 void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersProgression(CORBA::Double toBoundaryLayersProgression)
639 this->GetImpl()->SetBoundaryLayersProgression(toBoundaryLayersProgression);
640 SMESH::TPythonDump() << _this() << ".SetBoundaryLayersProgression( " << toBoundaryLayersProgression << " )";
643 //=======================================================================
644 //function : GetBoundaryLayersProgression
645 //=======================================================================
646 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersProgression()
649 return this->GetImpl()->GetBoundaryLayersProgression();
652 //=======================================================================
653 //function : SetMultinormalsAngle
654 //=======================================================================
655 void HYBRIDPlugin_Hypothesis_i::SetMultinormalsAngle(CORBA::Double toMultinormalsAngle)
658 this->GetImpl()->SetMultinormalsAngle(toMultinormalsAngle);
659 SMESH::TPythonDump() << _this() << ".SetMultinormalsAngle( " << toMultinormalsAngle << " )";
662 //=======================================================================
663 //function : GetMultinormalsAngle
664 //=======================================================================
665 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetMultinormalsAngle()
668 return this->GetImpl()->GetMultinormalsAngle();
671 //=======================================================================
672 //function : SetNbOfBoundaryLayers
673 //=======================================================================
674 void HYBRIDPlugin_Hypothesis_i::SetNbOfBoundaryLayers(CORBA::Short toNbOfBoundaryLayers)
677 this->GetImpl()->SetNbOfBoundaryLayers(toNbOfBoundaryLayers);
678 SMESH::TPythonDump() << _this() << ".SetNbOfBoundaryLayers( " << toNbOfBoundaryLayers << " )";
681 //=======================================================================
682 //function : GetNbOfBoundaryLayers
683 //=======================================================================
684 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetNbOfBoundaryLayers()
687 return this->GetImpl()->GetNbOfBoundaryLayers();
690 //=======================================================================
691 //function : SetEnforcedVertex
692 //=======================================================================
694 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
695 throw (SALOME::SALOME_Exception) {
697 return p_SetEnforcedVertex(size, x, y, z);
700 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
701 throw (SALOME::SALOME_Exception) {
703 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
706 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
707 throw (SALOME::SALOME_Exception) {
709 return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
712 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
713 throw (SALOME::SALOME_Exception) {
715 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
718 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size)
719 throw (SALOME::SALOME_Exception) {
722 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
723 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
726 std::string theVertexEntry = theVertex->GetStudyEntry();
727 CORBA::Double x = 0, y = 0, z = 0;
728 CORBA::Boolean isCompound = false;
729 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
730 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
731 if (theVertexEntry.empty()) {
733 if (theVertex->GetShapeType() == GEOM::VERTEX) {
736 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
740 aName += theVertex->GetEntry();
741 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
742 if (!theSVertex->_is_nil())
743 theVertexEntry = theSVertex->GetID();
745 if (theVertexEntry.empty())
746 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
748 if (theVertex->GetShapeType() == GEOM::VERTEX) {
749 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
750 if (CORBA::is_nil(measureOp))
753 measureOp->PointCoordinates (theVertex, x, y, z);
756 std::string theVertexName = theVertex->GetName();
758 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
761 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName)
762 throw (SALOME::SALOME_Exception) {
765 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
766 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
767 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
770 std::string theVertexEntry = theVertex->GetStudyEntry();
771 CORBA::Double x = 0, y = 0, z = 0;
772 CORBA::Boolean isCompound = false;
773 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
774 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
775 if (theVertexEntry.empty()) {
777 if (theVertex->GetShapeType() == GEOM::VERTEX) {
780 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
784 aName += theVertex->GetEntry();
785 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
786 if (!theSVertex->_is_nil())
787 theVertexEntry = theSVertex->GetID();
789 if (theVertexEntry.empty())
790 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
792 if (theVertex->GetShapeType() == GEOM::VERTEX) {
793 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
794 if (CORBA::is_nil(measureOp))
797 measureOp->PointCoordinates (theVertex, x, y, z);
800 std::string theVertexName = theVertex->GetName();
802 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
805 bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x, CORBA::Double y, CORBA::Double z,
806 const char* theVertexName, const char* theVertexEntry, const char* theGroupName,
807 CORBA::Boolean isCompound)
808 throw (SALOME::SALOME_Exception) {
810 bool newValue = false;
812 ::HYBRIDPlugin_Hypothesis::TCoordsHYBRIDEnforcedVertexMap coordsList;
813 ::HYBRIDPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap enfVertexEntryList;
814 if (std::string(theVertexEntry).empty()) {
815 coordsList = this->GetImpl()->_GetEnforcedVerticesByCoords();
816 std::vector<double> coords;
820 if (coordsList.find(coords) == coordsList.end()) {
824 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
825 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
826 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
834 if (std::string(theVertexName).empty()) {
835 if (std::string(theGroupName).empty())
836 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ")";
838 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theGroupName << "\")";
841 if (std::string(theGroupName).empty())
842 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\")";
844 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\", \"" << theGroupName << "\")";
849 // if (isCompound || (!isCompound && !std::string(theVertexEntry).empty())) {
850 enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
851 // ::BLSURFPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap::const_iterator it = enfVertexEntryList.find(theVertexEntry);
852 if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
856 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
857 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
858 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
866 if (std::string(theGroupName).empty())
867 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeom(" << theVertexEntry << ", " << size << ")";
869 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeomWithGroup(" << theVertexEntry << ", " << size << ", \"" << theGroupName << "\")";
874 this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
879 //=======================================================================
880 //function : GetEnforcedVertex
881 //=======================================================================
883 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
884 throw (SALOME::SALOME_Exception)
888 bool isDone = this->GetImpl()->GetEnforcedVertex(x,y,z)->size;
889 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertex(" << x << ", " << y << ", " << z << ")";
892 catch (const std::invalid_argument& ex) {
893 SALOME::ExceptionStruct ExDescription;
894 ExDescription.text = ex.what();
895 ExDescription.type = SALOME::BAD_PARAM;
896 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
897 ExDescription.lineNumber = 513;
898 throw SALOME::SALOME_Exception(ExDescription);
900 catch (SALOME_Exception& ex) {
901 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
905 //=======================================================================
906 //function : GetEnforcedVertex
907 //=======================================================================
909 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
910 throw (SALOME::SALOME_Exception)
914 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
915 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
916 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
919 std::string theVertexEntry = theVertex->GetStudyEntry();
920 if (theVertexEntry.empty()) {
921 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
922 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
924 if (theVertex->GetShapeType() == GEOM::VERTEX)
926 if (theVertex->GetShapeType() == GEOM::COMPOUND)
928 aName += theVertex->GetEntry();
929 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
930 if (!theSVertex->_is_nil())
931 theVertexEntry = theSVertex->GetID();
933 if (theVertexEntry.empty())
934 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
936 std::string theVertexName = theVertex->GetName();
939 bool isDone = this->GetImpl()->GetEnforcedVertex(theVertexName)->size;
940 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertexGeom(" << theVertex << ")";
943 catch (const std::invalid_argument& ex) {
944 SALOME::ExceptionStruct ExDescription;
945 ExDescription.text = ex.what();
946 ExDescription.type = SALOME::BAD_PARAM;
947 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
948 ExDescription.lineNumber = 538;
949 throw SALOME::SALOME_Exception(ExDescription);
951 catch (SALOME_Exception& ex) {
952 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
956 //=======================================================================
957 //function : GetEnforcedVertices
958 //=======================================================================
960 HYBRIDPlugin::HYBRIDEnforcedVertexList* HYBRIDPlugin_Hypothesis_i::GetEnforcedVertices()
963 HYBRIDPlugin::HYBRIDEnforcedVertexList_var result = new HYBRIDPlugin::HYBRIDEnforcedVertexList();
965 const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList enfVertexList = this->GetImpl()->_GetEnforcedVertices();
966 result->length( enfVertexList.size() );
968 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList::const_iterator it = enfVertexList.begin();
970 for (int i = 0 ; it != enfVertexList.end(); ++it, ++i ) {
971 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* currentVertex = (*it);
972 HYBRIDPlugin::HYBRIDEnforcedVertex_var enfVertex = new HYBRIDPlugin::HYBRIDEnforcedVertex();
974 enfVertex->name = CORBA::string_dup(currentVertex->name.c_str());
976 enfVertex->geomEntry = CORBA::string_dup(currentVertex->geomEntry.c_str());
978 HYBRIDPlugin::TCoords_var coords = new HYBRIDPlugin::TCoords();
979 coords->length(currentVertex->coords.size());
980 for (size_t ind = 0; ind < currentVertex->coords.size(); ind++)
981 coords[ind] = currentVertex->coords[ind];
982 enfVertex->coords = coords;
984 enfVertex->groupName = CORBA::string_dup(currentVertex->groupName.c_str());
986 enfVertex->size = currentVertex->size;
988 enfVertex->isCompound = currentVertex->isCompound;
993 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
995 return result._retn();
998 //=======================================================================
999 //function : RemoveEnforcedVertex
1000 //=======================================================================
1002 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
1003 throw (SALOME::SALOME_Exception)
1007 bool res = this->GetImpl()->RemoveEnforcedVertex(x,y,z);
1008 SMESH::TPythonDump() << " isDone = " << _this() << ".RemoveEnforcedVertex( " << x << ", " << y << ", " << z << " )";
1011 catch (const std::invalid_argument& ex) {
1012 SALOME::ExceptionStruct ExDescription;
1013 ExDescription.text = ex.what();
1014 ExDescription.type = SALOME::BAD_PARAM;
1015 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1016 ExDescription.lineNumber = 625;
1017 throw SALOME::SALOME_Exception(ExDescription);
1019 catch (SALOME_Exception& ex) {
1020 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1024 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
1025 throw (SALOME::SALOME_Exception)
1029 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1030 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1031 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1034 std::string theVertexEntry = theVertex->GetStudyEntry();
1035 if (theVertexEntry.empty()) {
1036 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1037 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1039 if (theVertex->GetShapeType() == GEOM::VERTEX)
1041 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1042 aName = "Compound_";
1043 aName += theVertex->GetEntry();
1044 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1045 if (!theSVertex->_is_nil())
1046 theVertexEntry = theSVertex->GetID();
1048 if (theVertexEntry.empty())
1049 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1052 bool res = this->GetImpl()->RemoveEnforcedVertex(0,0,0, theVertexEntry.c_str());
1053 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom( " << theVertexEntry.c_str() << " )";
1056 catch (const std::invalid_argument& ex) {
1057 SALOME::ExceptionStruct ExDescription;
1058 ExDescription.text = ex.what();
1059 ExDescription.type = SALOME::BAD_PARAM;
1060 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1061 ExDescription.lineNumber = 648;
1062 throw SALOME::SALOME_Exception(ExDescription);
1064 catch (SALOME_Exception& ex) {
1065 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1069 //=======================================================================
1070 //function : ClearEnforcedVertices
1071 //=======================================================================
1073 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedVertices()
1076 this->GetImpl()->ClearEnforcedVertices();
1077 SMESH::TPythonDump () << _this() << ".ClearEnforcedVertices() ";
1080 //=======================================================================
1081 //function : ClearEnforcedMeshes
1082 //=======================================================================
1084 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedMeshes()
1087 this->GetImpl()->ClearEnforcedMeshes();
1088 SMESH::TPythonDump () << _this() << ".ClearEnforcedMeshes() ";
1091 //=======================================================================
1092 //function : GetEnforcedMeshes
1093 //=======================================================================
1095 HYBRIDPlugin::HYBRIDEnforcedMeshList* HYBRIDPlugin_Hypothesis_i::GetEnforcedMeshes()
1098 HYBRIDPlugin::HYBRIDEnforcedMeshList_var result = new HYBRIDPlugin::HYBRIDEnforcedMeshList();
1100 const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList enfMeshList = this->GetImpl()->_GetEnforcedMeshes();
1101 result->length( enfMeshList.size() );
1103 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList::const_iterator it = enfMeshList.begin();
1105 for (int i = 0 ; it != enfMeshList.end(); ++it, ++i ) {
1106 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMesh* currentMesh = (*it);
1107 HYBRIDPlugin::HYBRIDEnforcedMesh_var enfMesh = new HYBRIDPlugin::HYBRIDEnforcedMesh();
1109 enfMesh->name = CORBA::string_dup(currentMesh->name.c_str());
1111 enfMesh->entry = CORBA::string_dup(currentMesh->entry.c_str());
1113 enfMesh->elementType = currentMesh->elementType;
1115 enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
1120 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
1122 return result._retn();
1126 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource. The elements will be grouped in theGroupName.
1128 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
1129 throw (SALOME::SALOME_Exception)
1131 // #if HYBRID_VERSION >= 42
1132 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1134 // SALOME::ExceptionStruct ExDescription;
1135 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1136 // ExDescription.type = SALOME::BAD_PARAM;
1137 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1138 // ExDescription.lineNumber = 719;
1139 // throw SALOME::SALOME_Exception(ExDescription);
1144 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource.
1146 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
1147 throw (SALOME::SALOME_Exception)
1149 // #if HYBRID_VERSION >= 42
1150 return p_SetEnforcedMesh(theSource, theType);
1152 // SALOME::ExceptionStruct ExDescription;
1153 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1154 // ExDescription.type = SALOME::BAD_PARAM;
1155 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1156 // ExDescription.lineNumber = 750;
1157 // throw SALOME::SALOME_Exception(ExDescription);
1162 * \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.
1164 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
1165 throw (SALOME::SALOME_Exception)
1167 // #if HYBRID_VERSION >= 42
1168 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1170 // SALOME::ExceptionStruct ExDescription;
1171 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1172 // ExDescription.type = SALOME::BAD_PARAM;
1173 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1174 // ExDescription.lineNumber = 750;
1175 // throw SALOME::SALOME_Exception(ExDescription);
1180 * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
1182 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
1183 throw (SALOME::SALOME_Exception)
1185 // #if HYBRID_VERSION >= 42
1186 return p_SetEnforcedMesh(theSource, theType);
1188 // SALOME::ExceptionStruct ExDescription;
1189 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1190 // ExDescription.type = SALOME::BAD_PARAM;
1191 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1192 // ExDescription.lineNumber = 750;
1193 // throw SALOME::SALOME_Exception(ExDescription);
1197 bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
1198 throw (SALOME::SALOME_Exception)
1202 if (CORBA::is_nil( theSource ))
1204 SALOME::ExceptionStruct ExDescription;
1205 ExDescription.text = "The source mesh CORBA object is NULL";
1206 ExDescription.type = SALOME::BAD_PARAM;
1207 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1208 ExDescription.lineNumber = 840;
1209 throw SALOME::SALOME_Exception(ExDescription);
1222 SMESH::array_of_ElementType_var types = theSource->GetTypes();
1223 if ( types->length() >= 1 && types[types->length()-1] < theType)
1226 // SALOME::ExceptionStruct ExDescription;
1227 // ExDescription.text = "The source mesh has bad type";
1228 // ExDescription.type = SALOME::BAD_PARAM;
1229 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1230 // ExDescription.lineNumber = 840;
1231 // throw SALOME::SALOME_Exception(ExDescription);
1235 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1236 SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
1238 SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
1239 SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
1240 SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
1242 std::string enfMeshName = theName;
1243 if (enfMeshName.empty())
1244 enfMeshName = SObj->GetName();
1249 bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
1250 if (theGroupName && theGroupName[0]) {
1251 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1252 << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
1255 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1256 << theSource << ".GetMesh(), " << theType << " )";
1261 catch (const std::invalid_argument& ex) {
1262 SALOME::ExceptionStruct ExDescription;
1263 ExDescription.text = ex.what();
1264 ExDescription.type = SALOME::BAD_PARAM;
1265 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1266 ExDescription.lineNumber = 840;
1267 throw SALOME::SALOME_Exception(ExDescription);
1269 catch (SALOME_Exception& ex) {
1270 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1273 else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
1276 bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1277 if (theGroupName && theGroupName[0]) {
1278 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1279 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1282 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1283 << theSource << ", " << theType << " )";
1287 catch (const std::invalid_argument& ex) {
1288 SALOME::ExceptionStruct ExDescription;
1289 ExDescription.text = ex.what();
1290 ExDescription.type = SALOME::BAD_PARAM;
1291 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1292 ExDescription.lineNumber = 840;
1293 throw SALOME::SALOME_Exception(ExDescription);
1295 catch (SALOME_Exception& ex) {
1296 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1299 else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
1302 bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1303 if (theGroupName && theGroupName[0]) {
1304 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1305 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1308 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1309 << theSource << ", " << theType << " )";
1313 catch (const std::invalid_argument& ex) {
1314 SALOME::ExceptionStruct ExDescription;
1315 ExDescription.text = ex.what();
1316 ExDescription.type = SALOME::BAD_PARAM;
1317 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1318 ExDescription.lineNumber = 840;
1319 throw SALOME::SALOME_Exception(ExDescription);
1321 catch (SALOME_Exception& ex) {
1322 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1327 //=============================================================================
1329 * Get implementation
1331 //=============================================================================
1333 ::HYBRIDPlugin_Hypothesis* HYBRIDPlugin_Hypothesis_i::GetImpl()
1335 return (::HYBRIDPlugin_Hypothesis*)myBaseImpl;
1338 //================================================================================
1340 * \brief Verify whether hypothesis supports given entity type
1342 //================================================================================
1344 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
1346 return type == SMESH::DIM_3D;