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_Cartesian_Core )
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 : SetCoreSize
654 //=======================================================================
655 void HYBRIDPlugin_Hypothesis_i::SetCoreSize(CORBA::Double toCoreSize)
658 this->GetImpl()->SetCoreSize(toCoreSize);
659 SMESH::TPythonDump() << _this() << ".SetCoreSize( " << toCoreSize << " )";
662 //=======================================================================
663 //function : GetCoreSize
664 //=======================================================================
665 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetCoreSize()
668 return this->GetImpl()->GetCoreSize();
671 //=======================================================================
672 //function : SetMultinormalsAngle
673 //=======================================================================
674 void HYBRIDPlugin_Hypothesis_i::SetMultinormalsAngle(CORBA::Double toMultinormalsAngle)
677 this->GetImpl()->SetMultinormalsAngle(toMultinormalsAngle);
678 SMESH::TPythonDump() << _this() << ".SetMultinormalsAngle( " << toMultinormalsAngle << " )";
681 //=======================================================================
682 //function : GetMultinormalsAngle
683 //=======================================================================
684 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetMultinormalsAngle()
687 return this->GetImpl()->GetMultinormalsAngle();
690 //=======================================================================
691 //function : SetNbOfBoundaryLayers
692 //=======================================================================
693 void HYBRIDPlugin_Hypothesis_i::SetNbOfBoundaryLayers(CORBA::Short toNbOfBoundaryLayers)
696 this->GetImpl()->SetNbOfBoundaryLayers(toNbOfBoundaryLayers);
697 SMESH::TPythonDump() << _this() << ".SetNbOfBoundaryLayers( " << toNbOfBoundaryLayers << " )";
700 //=======================================================================
701 //function : GetNbOfBoundaryLayers
702 //=======================================================================
703 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetNbOfBoundaryLayers()
706 return this->GetImpl()->GetNbOfBoundaryLayers();
709 //=======================================================================
710 //function : SetEnforcedVertex
711 //=======================================================================
713 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
714 throw (SALOME::SALOME_Exception) {
716 return p_SetEnforcedVertex(size, x, y, z);
719 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
720 throw (SALOME::SALOME_Exception) {
722 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
725 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
726 throw (SALOME::SALOME_Exception) {
728 return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
731 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
732 throw (SALOME::SALOME_Exception) {
734 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
737 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size)
738 throw (SALOME::SALOME_Exception) {
741 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
742 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
745 std::string theVertexEntry = theVertex->GetStudyEntry();
746 CORBA::Double x = 0, y = 0, z = 0;
747 CORBA::Boolean isCompound = false;
748 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
749 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
750 if (theVertexEntry.empty()) {
752 if (theVertex->GetShapeType() == GEOM::VERTEX) {
755 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
759 aName += theVertex->GetEntry();
760 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
761 if (!theSVertex->_is_nil())
762 theVertexEntry = theSVertex->GetID();
764 if (theVertexEntry.empty())
765 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
767 if (theVertex->GetShapeType() == GEOM::VERTEX) {
768 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
769 if (CORBA::is_nil(measureOp))
772 measureOp->PointCoordinates (theVertex, x, y, z);
775 std::string theVertexName = theVertex->GetName();
777 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
780 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName)
781 throw (SALOME::SALOME_Exception) {
784 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
785 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
786 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
789 std::string theVertexEntry = theVertex->GetStudyEntry();
790 CORBA::Double x = 0, y = 0, z = 0;
791 CORBA::Boolean isCompound = false;
792 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
793 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
794 if (theVertexEntry.empty()) {
796 if (theVertex->GetShapeType() == GEOM::VERTEX) {
799 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
803 aName += theVertex->GetEntry();
804 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
805 if (!theSVertex->_is_nil())
806 theVertexEntry = theSVertex->GetID();
808 if (theVertexEntry.empty())
809 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
811 if (theVertex->GetShapeType() == GEOM::VERTEX) {
812 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
813 if (CORBA::is_nil(measureOp))
816 measureOp->PointCoordinates (theVertex, x, y, z);
819 std::string theVertexName = theVertex->GetName();
821 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
824 bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x, CORBA::Double y, CORBA::Double z,
825 const char* theVertexName, const char* theVertexEntry, const char* theGroupName,
826 CORBA::Boolean isCompound)
827 throw (SALOME::SALOME_Exception) {
829 bool newValue = false;
831 ::HYBRIDPlugin_Hypothesis::TCoordsHYBRIDEnforcedVertexMap coordsList;
832 ::HYBRIDPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap enfVertexEntryList;
833 if (std::string(theVertexEntry).empty()) {
834 coordsList = this->GetImpl()->_GetEnforcedVerticesByCoords();
835 std::vector<double> coords;
839 if (coordsList.find(coords) == coordsList.end()) {
843 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
844 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
845 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
853 if (std::string(theVertexName).empty()) {
854 if (std::string(theGroupName).empty())
855 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ")";
857 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theGroupName << "\")";
860 if (std::string(theGroupName).empty())
861 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\")";
863 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\", \"" << theGroupName << "\")";
868 // if (isCompound || (!isCompound && !std::string(theVertexEntry).empty())) {
869 enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
870 // ::BLSURFPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap::const_iterator it = enfVertexEntryList.find(theVertexEntry);
871 if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
875 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
876 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
877 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
885 if (std::string(theGroupName).empty())
886 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeom(" << theVertexEntry << ", " << size << ")";
888 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeomWithGroup(" << theVertexEntry << ", " << size << ", \"" << theGroupName << "\")";
893 this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
898 //=======================================================================
899 //function : GetEnforcedVertex
900 //=======================================================================
902 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
903 throw (SALOME::SALOME_Exception)
907 bool isDone = this->GetImpl()->GetEnforcedVertex(x,y,z)->size;
908 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertex(" << x << ", " << y << ", " << z << ")";
911 catch (const std::invalid_argument& ex) {
912 SALOME::ExceptionStruct ExDescription;
913 ExDescription.text = ex.what();
914 ExDescription.type = SALOME::BAD_PARAM;
915 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
916 ExDescription.lineNumber = 513;
917 throw SALOME::SALOME_Exception(ExDescription);
919 catch (SALOME_Exception& ex) {
920 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
924 //=======================================================================
925 //function : GetEnforcedVertex
926 //=======================================================================
928 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
929 throw (SALOME::SALOME_Exception)
933 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
934 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
935 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
938 std::string theVertexEntry = theVertex->GetStudyEntry();
939 if (theVertexEntry.empty()) {
940 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
941 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
943 if (theVertex->GetShapeType() == GEOM::VERTEX)
945 if (theVertex->GetShapeType() == GEOM::COMPOUND)
947 aName += theVertex->GetEntry();
948 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
949 if (!theSVertex->_is_nil())
950 theVertexEntry = theSVertex->GetID();
952 if (theVertexEntry.empty())
953 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
955 std::string theVertexName = theVertex->GetName();
958 bool isDone = this->GetImpl()->GetEnforcedVertex(theVertexName)->size;
959 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertexGeom(" << theVertex << ")";
962 catch (const std::invalid_argument& ex) {
963 SALOME::ExceptionStruct ExDescription;
964 ExDescription.text = ex.what();
965 ExDescription.type = SALOME::BAD_PARAM;
966 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
967 ExDescription.lineNumber = 538;
968 throw SALOME::SALOME_Exception(ExDescription);
970 catch (SALOME_Exception& ex) {
971 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
975 //=======================================================================
976 //function : GetEnforcedVertices
977 //=======================================================================
979 HYBRIDPlugin::HYBRIDEnforcedVertexList* HYBRIDPlugin_Hypothesis_i::GetEnforcedVertices()
982 HYBRIDPlugin::HYBRIDEnforcedVertexList_var result = new HYBRIDPlugin::HYBRIDEnforcedVertexList();
984 const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList enfVertexList = this->GetImpl()->_GetEnforcedVertices();
985 result->length( enfVertexList.size() );
987 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList::const_iterator it = enfVertexList.begin();
989 for (int i = 0 ; it != enfVertexList.end(); ++it, ++i ) {
990 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* currentVertex = (*it);
991 HYBRIDPlugin::HYBRIDEnforcedVertex_var enfVertex = new HYBRIDPlugin::HYBRIDEnforcedVertex();
993 enfVertex->name = CORBA::string_dup(currentVertex->name.c_str());
995 enfVertex->geomEntry = CORBA::string_dup(currentVertex->geomEntry.c_str());
997 HYBRIDPlugin::TCoords_var coords = new HYBRIDPlugin::TCoords();
998 coords->length(currentVertex->coords.size());
999 for (size_t ind = 0; ind < currentVertex->coords.size(); ind++)
1000 coords[ind] = currentVertex->coords[ind];
1001 enfVertex->coords = coords;
1003 enfVertex->groupName = CORBA::string_dup(currentVertex->groupName.c_str());
1005 enfVertex->size = currentVertex->size;
1007 enfVertex->isCompound = currentVertex->isCompound;
1009 result[i]=enfVertex;
1012 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
1014 return result._retn();
1017 //=======================================================================
1018 //function : RemoveEnforcedVertex
1019 //=======================================================================
1021 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
1022 throw (SALOME::SALOME_Exception)
1026 bool res = this->GetImpl()->RemoveEnforcedVertex(x,y,z);
1027 SMESH::TPythonDump() << " isDone = " << _this() << ".RemoveEnforcedVertex( " << x << ", " << y << ", " << z << " )";
1030 catch (const std::invalid_argument& ex) {
1031 SALOME::ExceptionStruct ExDescription;
1032 ExDescription.text = ex.what();
1033 ExDescription.type = SALOME::BAD_PARAM;
1034 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1035 ExDescription.lineNumber = 625;
1036 throw SALOME::SALOME_Exception(ExDescription);
1038 catch (SALOME_Exception& ex) {
1039 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1043 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
1044 throw (SALOME::SALOME_Exception)
1048 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1049 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1050 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1053 std::string theVertexEntry = theVertex->GetStudyEntry();
1054 if (theVertexEntry.empty()) {
1055 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1056 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1058 if (theVertex->GetShapeType() == GEOM::VERTEX)
1060 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1061 aName = "Compound_";
1062 aName += theVertex->GetEntry();
1063 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1064 if (!theSVertex->_is_nil())
1065 theVertexEntry = theSVertex->GetID();
1067 if (theVertexEntry.empty())
1068 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1071 bool res = this->GetImpl()->RemoveEnforcedVertex(0,0,0, theVertexEntry.c_str());
1072 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom( " << theVertexEntry.c_str() << " )";
1075 catch (const std::invalid_argument& ex) {
1076 SALOME::ExceptionStruct ExDescription;
1077 ExDescription.text = ex.what();
1078 ExDescription.type = SALOME::BAD_PARAM;
1079 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1080 ExDescription.lineNumber = 648;
1081 throw SALOME::SALOME_Exception(ExDescription);
1083 catch (SALOME_Exception& ex) {
1084 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1088 //=======================================================================
1089 //function : ClearEnforcedVertices
1090 //=======================================================================
1092 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedVertices()
1095 this->GetImpl()->ClearEnforcedVertices();
1096 SMESH::TPythonDump () << _this() << ".ClearEnforcedVertices() ";
1099 //=======================================================================
1100 //function : ClearEnforcedMeshes
1101 //=======================================================================
1103 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedMeshes()
1106 this->GetImpl()->ClearEnforcedMeshes();
1107 SMESH::TPythonDump () << _this() << ".ClearEnforcedMeshes() ";
1110 //=======================================================================
1111 //function : GetEnforcedMeshes
1112 //=======================================================================
1114 HYBRIDPlugin::HYBRIDEnforcedMeshList* HYBRIDPlugin_Hypothesis_i::GetEnforcedMeshes()
1117 HYBRIDPlugin::HYBRIDEnforcedMeshList_var result = new HYBRIDPlugin::HYBRIDEnforcedMeshList();
1119 const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList enfMeshList = this->GetImpl()->_GetEnforcedMeshes();
1120 result->length( enfMeshList.size() );
1122 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList::const_iterator it = enfMeshList.begin();
1124 for (int i = 0 ; it != enfMeshList.end(); ++it, ++i ) {
1125 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMesh* currentMesh = (*it);
1126 HYBRIDPlugin::HYBRIDEnforcedMesh_var enfMesh = new HYBRIDPlugin::HYBRIDEnforcedMesh();
1128 enfMesh->name = CORBA::string_dup(currentMesh->name.c_str());
1130 enfMesh->entry = CORBA::string_dup(currentMesh->entry.c_str());
1132 enfMesh->elementType = currentMesh->elementType;
1134 enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
1139 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
1141 return result._retn();
1145 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource. The elements will be grouped in theGroupName.
1147 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
1148 throw (SALOME::SALOME_Exception)
1150 // #if HYBRID_VERSION >= 42
1151 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1153 // SALOME::ExceptionStruct ExDescription;
1154 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1155 // ExDescription.type = SALOME::BAD_PARAM;
1156 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1157 // ExDescription.lineNumber = 719;
1158 // throw SALOME::SALOME_Exception(ExDescription);
1163 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource.
1165 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
1166 throw (SALOME::SALOME_Exception)
1168 // #if HYBRID_VERSION >= 42
1169 return p_SetEnforcedMesh(theSource, theType);
1171 // SALOME::ExceptionStruct ExDescription;
1172 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1173 // ExDescription.type = SALOME::BAD_PARAM;
1174 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1175 // ExDescription.lineNumber = 750;
1176 // throw SALOME::SALOME_Exception(ExDescription);
1181 * \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.
1183 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
1184 throw (SALOME::SALOME_Exception)
1186 // #if HYBRID_VERSION >= 42
1187 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1189 // SALOME::ExceptionStruct ExDescription;
1190 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1191 // ExDescription.type = SALOME::BAD_PARAM;
1192 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1193 // ExDescription.lineNumber = 750;
1194 // throw SALOME::SALOME_Exception(ExDescription);
1199 * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
1201 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
1202 throw (SALOME::SALOME_Exception)
1204 // #if HYBRID_VERSION >= 42
1205 return p_SetEnforcedMesh(theSource, theType);
1207 // SALOME::ExceptionStruct ExDescription;
1208 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1209 // ExDescription.type = SALOME::BAD_PARAM;
1210 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1211 // ExDescription.lineNumber = 750;
1212 // throw SALOME::SALOME_Exception(ExDescription);
1216 bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
1217 throw (SALOME::SALOME_Exception)
1221 if (CORBA::is_nil( theSource ))
1223 SALOME::ExceptionStruct ExDescription;
1224 ExDescription.text = "The source mesh CORBA object is NULL";
1225 ExDescription.type = SALOME::BAD_PARAM;
1226 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1227 ExDescription.lineNumber = 840;
1228 throw SALOME::SALOME_Exception(ExDescription);
1241 SMESH::array_of_ElementType_var types = theSource->GetTypes();
1242 if ( types->length() >= 1 && types[types->length()-1] < theType)
1245 // SALOME::ExceptionStruct ExDescription;
1246 // ExDescription.text = "The source mesh has bad type";
1247 // ExDescription.type = SALOME::BAD_PARAM;
1248 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1249 // ExDescription.lineNumber = 840;
1250 // throw SALOME::SALOME_Exception(ExDescription);
1254 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1255 SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
1257 SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
1258 SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
1259 SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
1261 std::string enfMeshName = theName;
1262 if (enfMeshName.empty())
1263 enfMeshName = SObj->GetName();
1268 bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
1269 if (theGroupName && theGroupName[0]) {
1270 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1271 << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
1274 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1275 << theSource << ".GetMesh(), " << theType << " )";
1280 catch (const std::invalid_argument& ex) {
1281 SALOME::ExceptionStruct ExDescription;
1282 ExDescription.text = ex.what();
1283 ExDescription.type = SALOME::BAD_PARAM;
1284 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1285 ExDescription.lineNumber = 840;
1286 throw SALOME::SALOME_Exception(ExDescription);
1288 catch (SALOME_Exception& ex) {
1289 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1292 else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
1295 bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1296 if (theGroupName && theGroupName[0]) {
1297 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1298 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1301 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1302 << theSource << ", " << theType << " )";
1306 catch (const std::invalid_argument& ex) {
1307 SALOME::ExceptionStruct ExDescription;
1308 ExDescription.text = ex.what();
1309 ExDescription.type = SALOME::BAD_PARAM;
1310 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1311 ExDescription.lineNumber = 840;
1312 throw SALOME::SALOME_Exception(ExDescription);
1314 catch (SALOME_Exception& ex) {
1315 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1318 else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
1321 bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1322 if (theGroupName && theGroupName[0]) {
1323 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1324 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1327 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1328 << theSource << ", " << theType << " )";
1332 catch (const std::invalid_argument& ex) {
1333 SALOME::ExceptionStruct ExDescription;
1334 ExDescription.text = ex.what();
1335 ExDescription.type = SALOME::BAD_PARAM;
1336 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1337 ExDescription.lineNumber = 840;
1338 throw SALOME::SALOME_Exception(ExDescription);
1340 catch (SALOME_Exception& ex) {
1341 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1346 //=============================================================================
1348 * Get implementation
1350 //=============================================================================
1352 ::HYBRIDPlugin_Hypothesis* HYBRIDPlugin_Hypothesis_i::GetImpl()
1354 return (::HYBRIDPlugin_Hypothesis*)myBaseImpl;
1357 //================================================================================
1359 * \brief Verify whether hypothesis supports given entity type
1361 //================================================================================
1363 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
1365 return type == SMESH::DIM_3D;