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 : SetFacesWithImprinting
121 //=======================================================================
123 void HYBRIDPlugin_Hypothesis_i::SetFacesWithImprinting(const ::SMESH::long_array& theVal)
125 std::vector<int> ids( theVal.length() );
126 for ( size_t i = 0; i < ids.size(); ++i )
129 bool valueChanged = this->GetImpl()->SetFacesWithImprinting(ids);
131 SMESH::TPythonDump() << _this() << ".SetFacesWithImprinting( "<< theVal << " )";
134 //=======================================================================
135 //function : GetFacesWithImprinting
136 //=======================================================================
138 SMESH::long_array* HYBRIDPlugin_Hypothesis_i::GetFacesWithImprinting()
140 const std::vector<int>& idsVec = this->GetImpl()->GetFacesWithImprinting();
141 SMESH::long_array_var ids = new SMESH::long_array;
142 ids->length( idsVec.size() );
143 for ( size_t i = 0; i < idsVec.size(); ++i )
148 //=======================================================================
149 //function : SetToMeshHoles
150 //=======================================================================
152 void HYBRIDPlugin_Hypothesis_i::SetToMeshHoles(CORBA::Boolean toMesh)
155 this->GetImpl()->SetToMeshHoles(toMesh);
156 SMESH::TPythonDump() << _this() << ".SetToMeshHoles( " << toMesh << " )";
159 //=======================================================================
160 //function : GetToMeshHoles
161 //=======================================================================
163 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToMeshHoles()
166 return this->GetImpl()->GetToMeshHoles();
169 //=======================================================================
170 //function : SetToMakeGroupsOfDomains
171 //=======================================================================
173 void HYBRIDPlugin_Hypothesis_i::SetToMakeGroupsOfDomains(CORBA::Boolean toMakeGroups)
176 this->GetImpl()->SetToMakeGroupsOfDomains(toMakeGroups);
177 SMESH::TPythonDump() << _this() << ".SetToMakeGroupsOfDomains( " << toMakeGroups << " )";
180 //=======================================================================
181 //function : GetToMakeGroupsOfDomains
182 //=======================================================================
184 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToMakeGroupsOfDomains()
187 return this->GetImpl()->GetToMakeGroupsOfDomains();
190 //=======================================================================
191 //function : SetMaximumMemory
192 //=======================================================================
194 void HYBRIDPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Double MB)
195 throw ( SALOME::SALOME_Exception )
198 THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
200 this->GetImpl()->SetMaximumMemory(MB);
201 SMESH::TPythonDump() << _this() << ".SetMaximumMemory( " << MB << " )";
204 //=======================================================================
205 //function : GetMaximumMemory
206 //=======================================================================
208 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetMaximumMemory()
211 return this->GetImpl()->GetMaximumMemory();
214 //=======================================================================
215 //function : SetInitialMemory
216 //=======================================================================
218 void HYBRIDPlugin_Hypothesis_i::SetInitialMemory(CORBA::Double MB)
219 throw ( SALOME::SALOME_Exception )
222 THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
224 this->GetImpl()->SetInitialMemory(MB);
225 SMESH::TPythonDump() << _this() << ".SetInitialMemory( " << MB << " )";
228 //=======================================================================
229 //function : GetInitialMemory
230 //=======================================================================
232 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetInitialMemory()
235 return this->GetImpl()->GetInitialMemory();
238 //=======================================================================
239 //function : SetOptimizationLevel
240 //=======================================================================
242 void HYBRIDPlugin_Hypothesis_i::SetOptimizationLevel(CORBA::Short level)
243 throw ( SALOME::SALOME_Exception )
245 ::HYBRIDPlugin_Hypothesis::OptimizationLevel l =
246 (::HYBRIDPlugin_Hypothesis::OptimizationLevel) level;
247 if ( l < ::HYBRIDPlugin_Hypothesis::None ||
248 l > ::HYBRIDPlugin_Hypothesis::Strong )
249 THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
252 this->GetImpl()->SetOptimizationLevel(l);
253 SMESH::TPythonDump() << _this() << ".SetOptimizationLevel( " << level << " )";
256 //=======================================================================
257 //function : GetOptimizationLevel
258 //=======================================================================
260 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetOptimizationLevel()
263 return this->GetImpl()->GetOptimizationLevel();
267 //=======================================================================
268 //function : SetCollisionMode
269 //=======================================================================
270 void HYBRIDPlugin_Hypothesis_i::SetCollisionMode(CORBA::Short level)
271 throw ( SALOME::SALOME_Exception )
273 ::HYBRIDPlugin_Hypothesis::CollisionMode l =
274 (::HYBRIDPlugin_Hypothesis::CollisionMode) level;
275 if ( l < ::HYBRIDPlugin_Hypothesis::Decrease ||
276 l > ::HYBRIDPlugin_Hypothesis::Stop )
277 THROW_SALOME_CORBA_EXCEPTION( "Invalid collision mode",SALOME::BAD_PARAM );
280 this->GetImpl()->SetCollisionMode(l);
281 SMESH::TPythonDump() << _this() << ".SetCollisionMode( " << level << " )";
284 //=======================================================================
285 //function : GetCollisionMode
286 //=======================================================================
287 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetCollisionMode()
290 return this->GetImpl()->GetCollisionMode();
293 //=======================================================================
294 //function : SetWorkingDirectory
295 //=======================================================================
296 void HYBRIDPlugin_Hypothesis_i::SetWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception )
299 THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
301 std::string file(path);
302 const char lastChar = *file.rbegin();
304 if ( lastChar != '\\' ) file += '\\';
306 if ( lastChar != '/' ) file += '/';
308 file += "HYBRID.log";
309 SMESH_Mesh_i::PrepareForWriting (file.c_str());
312 this->GetImpl()->SetWorkingDirectory(path);
313 SMESH::TPythonDump() << _this() << ".SetWorkingDirectory( '" << path << "' )";
316 //=======================================================================
317 //function : GetWorkingDirectory
318 //=======================================================================
319 char* HYBRIDPlugin_Hypothesis_i::GetWorkingDirectory()
322 return CORBA::string_dup( this->GetImpl()->GetWorkingDirectory().c_str() );
325 //=======================================================================
326 //function : SetKeepFiles
327 //=======================================================================
328 void HYBRIDPlugin_Hypothesis_i::SetKeepFiles(CORBA::Boolean toKeep)
331 this->GetImpl()->SetKeepFiles(toKeep);
332 SMESH::TPythonDump() << _this() << ".SetKeepFiles( " << toKeep << " )";
335 //=======================================================================
336 //function : GetKeepFiles
337 //=======================================================================
338 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetKeepFiles()
341 return this->GetImpl()->GetKeepFiles();
344 //=======================================================================
345 //function : SetVerboseLevel
346 //=======================================================================
347 void HYBRIDPlugin_Hypothesis_i::SetVerboseLevel(CORBA::Short level)
348 throw ( SALOME::SALOME_Exception )
350 if (level < 0 || level > 10 )
351 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbose level, valid range is [0-10]",
354 this->GetImpl()->SetVerboseLevel(level);
355 SMESH::TPythonDump() << _this() << ".SetVerboseLevel( " << level << " )";
358 //=======================================================================
359 //function : GetVerboseLevel
360 //=======================================================================
361 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetVerboseLevel()
364 return this->GetImpl()->GetVerboseLevel();
367 //=======================================================================
368 //function : SetToCreateNewNodes
369 //=======================================================================
371 void HYBRIDPlugin_Hypothesis_i::SetToCreateNewNodes(CORBA::Boolean toCreate)
374 this->GetImpl()->SetToCreateNewNodes(toCreate);
375 SMESH::TPythonDump() << _this() << ".SetToCreateNewNodes( " << toCreate << " )";
378 //=======================================================================
379 //function : GetToCreateNewNodes
380 //=======================================================================
382 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToCreateNewNodes()
385 return this->GetImpl()->GetToCreateNewNodes();
388 //=======================================================================
389 //function : SetToUseBoundaryRecoveryVersion
390 //=======================================================================
392 void HYBRIDPlugin_Hypothesis_i::SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse)
395 this->GetImpl()->SetToUseBoundaryRecoveryVersion(toUse);
396 SMESH::TPythonDump() << _this() << ".SetToUseBoundaryRecoveryVersion( " << toUse << " )";
399 //=======================================================================
400 //function : GetToUseBoundaryRecoveryVersion
401 //=======================================================================
403 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToUseBoundaryRecoveryVersion()
406 return this->GetImpl()->GetToUseBoundaryRecoveryVersion();
409 //=======================================================================
410 //function : SetFEMCorrection
411 //=======================================================================
413 void HYBRIDPlugin_Hypothesis_i::SetFEMCorrection(CORBA::Boolean toUseFem)
416 this->GetImpl()->SetFEMCorrection(toUseFem);
417 SMESH::TPythonDump() << _this() << ".SetFEMCorrection( " << toUseFem << " )";
420 //=======================================================================
421 //function : GetFEMCorrection
422 //=======================================================================
424 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetFEMCorrection()
427 return this->GetImpl()->GetFEMCorrection();
430 //=======================================================================
431 //function : SetToRemoveCentralPoint
432 //=======================================================================
434 void HYBRIDPlugin_Hypothesis_i::SetToRemoveCentralPoint(CORBA::Boolean toRemove)
437 this->GetImpl()->SetToRemoveCentralPoint(toRemove);
438 SMESH::TPythonDump() << _this() << ".SetToRemoveCentralPoint( " << toRemove << " )";
441 //=======================================================================
442 //function : GetToRemoveCentralPoint
443 //=======================================================================
445 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToRemoveCentralPoint()
448 return this->GetImpl()->GetToRemoveCentralPoint();
451 //=======================================================================
452 //function : SetTextOption
453 //=======================================================================
454 void HYBRIDPlugin_Hypothesis_i::SetTextOption(const char* option)
457 this->GetImpl()->SetAdvancedOption(option);
458 SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << option << "' )";
461 //=======================================================================
462 //function : GetTextOption
463 //=======================================================================
464 char* HYBRIDPlugin_Hypothesis_i::GetTextOption()
467 return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
470 //=======================================================================
471 //function : SetAdvancedOption
472 //=======================================================================
473 void HYBRIDPlugin_Hypothesis_i::SetAdvancedOption(const char* theOptAndVals )
475 if ( theOptAndVals && GetImpl()->GetAdvancedOption() != theOptAndVals )
477 GetImpl()->SetAdvancedOption( theOptAndVals );
478 SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << theOptAndVals << "' )";
482 //=======================================================================
483 //function : GetAdvancedOption
484 //=======================================================================
485 char* HYBRIDPlugin_Hypothesis_i::GetAdvancedOption()
487 return CORBA::string_dup( GetImpl()->GetAdvancedOption().c_str() );
490 //=======================================================================
491 //function : SetToRemoveCentralPoint
492 //=======================================================================
494 void HYBRIDPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
497 THROW_SALOME_CORBA_EXCEPTION( "The volumic gradation must be > 1",SALOME::BAD_PARAM );
499 if (gradation != GetGradation()) {
500 this->GetImpl()->SetGradation(gradation);
501 SMESH::TPythonDump() << _this() << ".SetGradation( " << gradation << " )";
505 //=======================================================================
506 //function : GetToRemoveCentralPoint
507 //=======================================================================
509 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetGradation()
512 return this->GetImpl()->GetGradation();
515 //=======================================================================
516 //function : SetStandardOutputLog
517 //=======================================================================
518 void HYBRIDPlugin_Hypothesis_i::SetStandardOutputLog(CORBA::Boolean logInStandardOutput)
521 this->GetImpl()->SetStandardOutputLog(logInStandardOutput);
522 SMESH::TPythonDump() << _this() << ".SetPrintLogInFile( " << !logInStandardOutput << " )";
525 //=======================================================================
526 //function : GetStandardOutputLog
527 //=======================================================================
528 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetStandardOutputLog()
531 return this->GetImpl()->GetStandardOutputLog();
534 //=======================================================================
535 //function : SetRemoveLogOnSuccess
536 //=======================================================================
537 void HYBRIDPlugin_Hypothesis_i::SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess)
540 this->GetImpl()->SetRemoveLogOnSuccess(removeLogOnSuccess);
541 SMESH::TPythonDump() << _this() << ".SetRemoveLogOnSuccess( " << removeLogOnSuccess << " )";
544 //=======================================================================
545 //function : GetRemoveLogOnSuccess
546 //=======================================================================
547 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
550 return this->GetImpl()->GetRemoveLogOnSuccess();
553 //=======================================================================
554 //function : SetBoundaryLayersGrowth
555 //=======================================================================
556 void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersGrowth(CORBA::Short level)
557 throw ( SALOME::SALOME_Exception )
559 ::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth l =
560 (::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth) level;
561 if ( l < ::HYBRIDPlugin_Hypothesis::Layer_Growth_Inward ||
562 l > ::HYBRIDPlugin_Hypothesis::Layer_Growth_Outward )
563 THROW_SALOME_CORBA_EXCEPTION( "Invalid BoundaryLayersGrowth mode",SALOME::BAD_PARAM );
566 this->GetImpl()->SetBoundaryLayersGrowth(l);
567 SMESH::TPythonDump() << _this() << ".SetBoundaryLayersGrowth( " << level << " )";
570 //=======================================================================
571 //function : GetBoundaryLayersGrowth
572 //=======================================================================
573 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersGrowth()
576 return this->GetImpl()->GetBoundaryLayersGrowth();
579 //=======================================================================
580 //function : SetElementGeneration
581 //=======================================================================
582 void HYBRIDPlugin_Hypothesis_i::SetElementGeneration(CORBA::Short level)
583 throw ( SALOME::SALOME_Exception )
585 ::HYBRIDPlugin_Hypothesis::ElementGeneration l =
586 (::HYBRIDPlugin_Hypothesis::ElementGeneration) level;
587 if ( l < ::HYBRIDPlugin_Hypothesis::Generation_Tetra_Dominant ||
588 l > ::HYBRIDPlugin_Hypothesis::Generation_Cartesian_Core )
589 THROW_SALOME_CORBA_EXCEPTION( "Invalid ElementGeneration mode",SALOME::BAD_PARAM );
592 this->GetImpl()->SetElementGeneration(l);
593 SMESH::TPythonDump() << _this() << ".SetElementGeneration( " << level << " )";
596 //=======================================================================
597 //function : GetElementGeneration
598 //=======================================================================
599 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetElementGeneration()
602 return this->GetImpl()->GetElementGeneration();
605 //=======================================================================
606 //function : SetAddMultinormals
607 //=======================================================================
608 void HYBRIDPlugin_Hypothesis_i::SetAddMultinormals(CORBA::Boolean toAddMultinormals)
611 this->GetImpl()->SetAddMultinormals(toAddMultinormals);
612 SMESH::TPythonDump() << _this() << ".SetAddMultinormals( " << toAddMultinormals << " )";
615 //=======================================================================
616 //function : GetAddMultinormals
617 //=======================================================================
618 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetAddMultinormals()
621 return this->GetImpl()->GetAddMultinormals();
624 //=======================================================================
625 //function : SetSmoothNormals
626 //=======================================================================
627 void HYBRIDPlugin_Hypothesis_i::SetSmoothNormals(CORBA::Boolean toSmoothNormals)
630 this->GetImpl()->SetSmoothNormals(toSmoothNormals);
631 SMESH::TPythonDump() << _this() << ".SetSmoothNormals( " << toSmoothNormals << " )";
634 //=======================================================================
635 //function : GetSmoothNormals
636 //=======================================================================
637 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetSmoothNormals()
640 return this->GetImpl()->GetSmoothNormals();
643 //=======================================================================
644 //function : SetHeightFirstLayer
645 //=======================================================================
646 void HYBRIDPlugin_Hypothesis_i::SetHeightFirstLayer(CORBA::Double toHeightFirstLayer)
649 this->GetImpl()->SetHeightFirstLayer(toHeightFirstLayer);
650 SMESH::TPythonDump() << _this() << ".SetHeightFirstLayer( " << toHeightFirstLayer << " )";
653 //=======================================================================
654 //function : GetHeightFirstLayer
655 //=======================================================================
656 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetHeightFirstLayer()
659 return this->GetImpl()->GetHeightFirstLayer();
662 //=======================================================================
663 //function : SetBoundaryLayersProgression
664 //=======================================================================
665 void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersProgression(CORBA::Double toBoundaryLayersProgression)
668 this->GetImpl()->SetBoundaryLayersProgression(toBoundaryLayersProgression);
669 SMESH::TPythonDump() << _this() << ".SetBoundaryLayersProgression( " << toBoundaryLayersProgression << " )";
672 //=======================================================================
673 //function : GetBoundaryLayersProgression
674 //=======================================================================
675 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersProgression()
678 return this->GetImpl()->GetBoundaryLayersProgression();
681 //=======================================================================
682 //function : SetCoreSize
683 //=======================================================================
684 void HYBRIDPlugin_Hypothesis_i::SetCoreSize(CORBA::Double toCoreSize)
687 this->GetImpl()->SetCoreSize(toCoreSize);
688 SMESH::TPythonDump() << _this() << ".SetCoreSize( " << toCoreSize << " )";
691 //=======================================================================
692 //function : GetCoreSize
693 //=======================================================================
694 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetCoreSize()
697 return this->GetImpl()->GetCoreSize();
700 //=======================================================================
701 //function : SetMultinormalsAngle
702 //=======================================================================
703 void HYBRIDPlugin_Hypothesis_i::SetMultinormalsAngle(CORBA::Double toMultinormalsAngle)
706 this->GetImpl()->SetMultinormalsAngle(toMultinormalsAngle);
707 SMESH::TPythonDump() << _this() << ".SetMultinormalsAngle( " << toMultinormalsAngle << " )";
710 //=======================================================================
711 //function : GetMultinormalsAngle
712 //=======================================================================
713 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetMultinormalsAngle()
716 return this->GetImpl()->GetMultinormalsAngle();
719 //=======================================================================
720 //function : SetNbOfBoundaryLayers
721 //=======================================================================
722 void HYBRIDPlugin_Hypothesis_i::SetNbOfBoundaryLayers(CORBA::Short toNbOfBoundaryLayers)
725 this->GetImpl()->SetNbOfBoundaryLayers(toNbOfBoundaryLayers);
726 SMESH::TPythonDump() << _this() << ".SetNbOfBoundaryLayers( " << toNbOfBoundaryLayers << " )";
729 //=======================================================================
730 //function : GetNbOfBoundaryLayers
731 //=======================================================================
732 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetNbOfBoundaryLayers()
735 return this->GetImpl()->GetNbOfBoundaryLayers();
738 //=======================================================================
739 //function : SetEnforcedVertex
740 //=======================================================================
742 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
743 throw (SALOME::SALOME_Exception) {
745 return p_SetEnforcedVertex(size, x, y, z);
748 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
749 throw (SALOME::SALOME_Exception) {
751 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
754 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
755 throw (SALOME::SALOME_Exception) {
757 return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
760 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
761 throw (SALOME::SALOME_Exception) {
763 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
766 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size)
767 throw (SALOME::SALOME_Exception) {
770 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
771 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
774 std::string theVertexEntry = theVertex->GetStudyEntry();
775 CORBA::Double x = 0, y = 0, z = 0;
776 CORBA::Boolean isCompound = false;
777 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
778 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
779 if (theVertexEntry.empty()) {
781 if (theVertex->GetShapeType() == GEOM::VERTEX) {
784 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
788 aName += theVertex->GetEntry();
789 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
790 if (!theSVertex->_is_nil())
791 theVertexEntry = theSVertex->GetID();
793 if (theVertexEntry.empty())
794 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
796 if (theVertex->GetShapeType() == GEOM::VERTEX) {
797 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
798 if (CORBA::is_nil(measureOp))
801 measureOp->PointCoordinates (theVertex, x, y, z);
804 std::string theVertexName = theVertex->GetName();
806 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
809 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName)
810 throw (SALOME::SALOME_Exception) {
813 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
814 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
815 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
818 std::string theVertexEntry = theVertex->GetStudyEntry();
819 CORBA::Double x = 0, y = 0, z = 0;
820 CORBA::Boolean isCompound = false;
821 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
822 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
823 if (theVertexEntry.empty()) {
825 if (theVertex->GetShapeType() == GEOM::VERTEX) {
828 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
832 aName += theVertex->GetEntry();
833 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
834 if (!theSVertex->_is_nil())
835 theVertexEntry = theSVertex->GetID();
837 if (theVertexEntry.empty())
838 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
840 if (theVertex->GetShapeType() == GEOM::VERTEX) {
841 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
842 if (CORBA::is_nil(measureOp))
845 measureOp->PointCoordinates (theVertex, x, y, z);
848 std::string theVertexName = theVertex->GetName();
850 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
853 bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x, CORBA::Double y, CORBA::Double z,
854 const char* theVertexName, const char* theVertexEntry, const char* theGroupName,
855 CORBA::Boolean isCompound)
856 throw (SALOME::SALOME_Exception) {
858 bool newValue = false;
860 ::HYBRIDPlugin_Hypothesis::TCoordsHYBRIDEnforcedVertexMap coordsList;
861 ::HYBRIDPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap enfVertexEntryList;
862 if (std::string(theVertexEntry).empty()) {
863 coordsList = this->GetImpl()->_GetEnforcedVerticesByCoords();
864 std::vector<double> coords;
868 if (coordsList.find(coords) == coordsList.end()) {
872 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
873 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
874 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
882 if (std::string(theVertexName).empty()) {
883 if (std::string(theGroupName).empty())
884 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ")";
886 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theGroupName << "\")";
889 if (std::string(theGroupName).empty())
890 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\")";
892 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\", \"" << theGroupName << "\")";
897 // if (isCompound || (!isCompound && !std::string(theVertexEntry).empty())) {
898 enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
899 // ::BLSURFPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap::const_iterator it = enfVertexEntryList.find(theVertexEntry);
900 if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
904 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
905 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
906 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
914 if (std::string(theGroupName).empty())
915 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeom(" << theVertexEntry << ", " << size << ")";
917 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeomWithGroup(" << theVertexEntry << ", " << size << ", \"" << theGroupName << "\")";
922 this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
927 //=======================================================================
928 //function : GetEnforcedVertex
929 //=======================================================================
931 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
932 throw (SALOME::SALOME_Exception)
936 bool isDone = this->GetImpl()->GetEnforcedVertex(x,y,z)->size;
937 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertex(" << x << ", " << y << ", " << z << ")";
940 catch (const std::invalid_argument& ex) {
941 SALOME::ExceptionStruct ExDescription;
942 ExDescription.text = ex.what();
943 ExDescription.type = SALOME::BAD_PARAM;
944 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
945 ExDescription.lineNumber = 513;
946 throw SALOME::SALOME_Exception(ExDescription);
948 catch (SALOME_Exception& ex) {
949 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
953 //=======================================================================
954 //function : GetEnforcedVertex
955 //=======================================================================
957 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
958 throw (SALOME::SALOME_Exception)
962 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
963 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
964 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
967 std::string theVertexEntry = theVertex->GetStudyEntry();
968 if (theVertexEntry.empty()) {
969 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
970 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
972 if (theVertex->GetShapeType() == GEOM::VERTEX)
974 if (theVertex->GetShapeType() == GEOM::COMPOUND)
976 aName += theVertex->GetEntry();
977 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
978 if (!theSVertex->_is_nil())
979 theVertexEntry = theSVertex->GetID();
981 if (theVertexEntry.empty())
982 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
984 std::string theVertexName = theVertex->GetName();
987 bool isDone = this->GetImpl()->GetEnforcedVertex(theVertexName)->size;
988 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertexGeom(" << theVertex << ")";
991 catch (const std::invalid_argument& ex) {
992 SALOME::ExceptionStruct ExDescription;
993 ExDescription.text = ex.what();
994 ExDescription.type = SALOME::BAD_PARAM;
995 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
996 ExDescription.lineNumber = 538;
997 throw SALOME::SALOME_Exception(ExDescription);
999 catch (SALOME_Exception& ex) {
1000 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1004 //=======================================================================
1005 //function : GetEnforcedVertices
1006 //=======================================================================
1008 HYBRIDPlugin::HYBRIDEnforcedVertexList* HYBRIDPlugin_Hypothesis_i::GetEnforcedVertices()
1011 HYBRIDPlugin::HYBRIDEnforcedVertexList_var result = new HYBRIDPlugin::HYBRIDEnforcedVertexList();
1013 const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList enfVertexList = this->GetImpl()->_GetEnforcedVertices();
1014 result->length( enfVertexList.size() );
1016 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList::const_iterator it = enfVertexList.begin();
1018 for (int i = 0 ; it != enfVertexList.end(); ++it, ++i ) {
1019 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* currentVertex = (*it);
1020 HYBRIDPlugin::HYBRIDEnforcedVertex_var enfVertex = new HYBRIDPlugin::HYBRIDEnforcedVertex();
1022 enfVertex->name = CORBA::string_dup(currentVertex->name.c_str());
1023 // Geom Vertex Entry
1024 enfVertex->geomEntry = CORBA::string_dup(currentVertex->geomEntry.c_str());
1026 HYBRIDPlugin::TCoords_var coords = new HYBRIDPlugin::TCoords();
1027 coords->length(currentVertex->coords.size());
1028 for (size_t ind = 0; ind < currentVertex->coords.size(); ind++)
1029 coords[ind] = currentVertex->coords[ind];
1030 enfVertex->coords = coords;
1032 enfVertex->groupName = CORBA::string_dup(currentVertex->groupName.c_str());
1034 enfVertex->size = currentVertex->size;
1036 enfVertex->isCompound = currentVertex->isCompound;
1038 result[i]=enfVertex;
1041 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
1043 return result._retn();
1046 //=======================================================================
1047 //function : RemoveEnforcedVertex
1048 //=======================================================================
1050 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
1051 throw (SALOME::SALOME_Exception)
1055 bool res = this->GetImpl()->RemoveEnforcedVertex(x,y,z);
1056 SMESH::TPythonDump() << " isDone = " << _this() << ".RemoveEnforcedVertex( " << x << ", " << y << ", " << z << " )";
1059 catch (const std::invalid_argument& ex) {
1060 SALOME::ExceptionStruct ExDescription;
1061 ExDescription.text = ex.what();
1062 ExDescription.type = SALOME::BAD_PARAM;
1063 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1064 ExDescription.lineNumber = 625;
1065 throw SALOME::SALOME_Exception(ExDescription);
1067 catch (SALOME_Exception& ex) {
1068 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1072 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
1073 throw (SALOME::SALOME_Exception)
1077 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1078 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1079 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1082 std::string theVertexEntry = theVertex->GetStudyEntry();
1083 if (theVertexEntry.empty()) {
1084 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1085 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1087 if (theVertex->GetShapeType() == GEOM::VERTEX)
1089 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1090 aName = "Compound_";
1091 aName += theVertex->GetEntry();
1092 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1093 if (!theSVertex->_is_nil())
1094 theVertexEntry = theSVertex->GetID();
1096 if (theVertexEntry.empty())
1097 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1100 bool res = this->GetImpl()->RemoveEnforcedVertex(0,0,0, theVertexEntry.c_str());
1101 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom( " << theVertexEntry.c_str() << " )";
1104 catch (const std::invalid_argument& ex) {
1105 SALOME::ExceptionStruct ExDescription;
1106 ExDescription.text = ex.what();
1107 ExDescription.type = SALOME::BAD_PARAM;
1108 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1109 ExDescription.lineNumber = 648;
1110 throw SALOME::SALOME_Exception(ExDescription);
1112 catch (SALOME_Exception& ex) {
1113 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1117 //=======================================================================
1118 //function : ClearEnforcedVertices
1119 //=======================================================================
1121 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedVertices()
1124 this->GetImpl()->ClearEnforcedVertices();
1125 SMESH::TPythonDump () << _this() << ".ClearEnforcedVertices() ";
1128 //=======================================================================
1129 //function : ClearEnforcedMeshes
1130 //=======================================================================
1132 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedMeshes()
1135 this->GetImpl()->ClearEnforcedMeshes();
1136 SMESH::TPythonDump () << _this() << ".ClearEnforcedMeshes() ";
1139 //=======================================================================
1140 //function : GetEnforcedMeshes
1141 //=======================================================================
1143 HYBRIDPlugin::HYBRIDEnforcedMeshList* HYBRIDPlugin_Hypothesis_i::GetEnforcedMeshes()
1146 HYBRIDPlugin::HYBRIDEnforcedMeshList_var result = new HYBRIDPlugin::HYBRIDEnforcedMeshList();
1148 const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList enfMeshList = this->GetImpl()->_GetEnforcedMeshes();
1149 result->length( enfMeshList.size() );
1151 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList::const_iterator it = enfMeshList.begin();
1153 for (int i = 0 ; it != enfMeshList.end(); ++it, ++i ) {
1154 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMesh* currentMesh = (*it);
1155 HYBRIDPlugin::HYBRIDEnforcedMesh_var enfMesh = new HYBRIDPlugin::HYBRIDEnforcedMesh();
1157 enfMesh->name = CORBA::string_dup(currentMesh->name.c_str());
1159 enfMesh->entry = CORBA::string_dup(currentMesh->entry.c_str());
1161 enfMesh->elementType = currentMesh->elementType;
1163 enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
1168 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
1170 return result._retn();
1174 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource. The elements will be grouped in theGroupName.
1176 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
1177 throw (SALOME::SALOME_Exception)
1179 // #if HYBRID_VERSION >= 42
1180 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1182 // SALOME::ExceptionStruct ExDescription;
1183 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1184 // ExDescription.type = SALOME::BAD_PARAM;
1185 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1186 // ExDescription.lineNumber = 719;
1187 // throw SALOME::SALOME_Exception(ExDescription);
1192 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource.
1194 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
1195 throw (SALOME::SALOME_Exception)
1197 // #if HYBRID_VERSION >= 42
1198 return p_SetEnforcedMesh(theSource, theType);
1200 // SALOME::ExceptionStruct ExDescription;
1201 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1202 // ExDescription.type = SALOME::BAD_PARAM;
1203 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1204 // ExDescription.lineNumber = 750;
1205 // throw SALOME::SALOME_Exception(ExDescription);
1210 * \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.
1212 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
1213 throw (SALOME::SALOME_Exception)
1215 // #if HYBRID_VERSION >= 42
1216 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1218 // SALOME::ExceptionStruct ExDescription;
1219 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1220 // ExDescription.type = SALOME::BAD_PARAM;
1221 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1222 // ExDescription.lineNumber = 750;
1223 // throw SALOME::SALOME_Exception(ExDescription);
1228 * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
1230 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
1231 throw (SALOME::SALOME_Exception)
1233 // #if HYBRID_VERSION >= 42
1234 return p_SetEnforcedMesh(theSource, theType);
1236 // SALOME::ExceptionStruct ExDescription;
1237 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1238 // ExDescription.type = SALOME::BAD_PARAM;
1239 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1240 // ExDescription.lineNumber = 750;
1241 // throw SALOME::SALOME_Exception(ExDescription);
1245 bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
1246 throw (SALOME::SALOME_Exception)
1250 if (CORBA::is_nil( theSource ))
1252 SALOME::ExceptionStruct ExDescription;
1253 ExDescription.text = "The source mesh CORBA object is NULL";
1254 ExDescription.type = SALOME::BAD_PARAM;
1255 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1256 ExDescription.lineNumber = 840;
1257 throw SALOME::SALOME_Exception(ExDescription);
1270 SMESH::array_of_ElementType_var types = theSource->GetTypes();
1271 if ( types->length() >= 1 && types[types->length()-1] < theType)
1274 // SALOME::ExceptionStruct ExDescription;
1275 // ExDescription.text = "The source mesh has bad type";
1276 // ExDescription.type = SALOME::BAD_PARAM;
1277 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1278 // ExDescription.lineNumber = 840;
1279 // throw SALOME::SALOME_Exception(ExDescription);
1283 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1284 SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
1286 SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
1287 SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
1288 SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
1290 std::string enfMeshName = theName;
1291 if (enfMeshName.empty())
1292 enfMeshName = SObj->GetName();
1297 bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
1298 if (theGroupName && theGroupName[0]) {
1299 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1300 << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
1303 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1304 << theSource << ".GetMesh(), " << theType << " )";
1309 catch (const std::invalid_argument& ex) {
1310 SALOME::ExceptionStruct ExDescription;
1311 ExDescription.text = ex.what();
1312 ExDescription.type = SALOME::BAD_PARAM;
1313 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1314 ExDescription.lineNumber = 840;
1315 throw SALOME::SALOME_Exception(ExDescription);
1317 catch (SALOME_Exception& ex) {
1318 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1321 else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
1324 bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1325 if (theGroupName && theGroupName[0]) {
1326 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1327 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1330 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1331 << theSource << ", " << theType << " )";
1335 catch (const std::invalid_argument& ex) {
1336 SALOME::ExceptionStruct ExDescription;
1337 ExDescription.text = ex.what();
1338 ExDescription.type = SALOME::BAD_PARAM;
1339 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1340 ExDescription.lineNumber = 840;
1341 throw SALOME::SALOME_Exception(ExDescription);
1343 catch (SALOME_Exception& ex) {
1344 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1347 else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
1350 bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1351 if (theGroupName && theGroupName[0]) {
1352 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1353 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1356 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1357 << theSource << ", " << theType << " )";
1361 catch (const std::invalid_argument& ex) {
1362 SALOME::ExceptionStruct ExDescription;
1363 ExDescription.text = ex.what();
1364 ExDescription.type = SALOME::BAD_PARAM;
1365 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1366 ExDescription.lineNumber = 840;
1367 throw SALOME::SALOME_Exception(ExDescription);
1369 catch (SALOME_Exception& ex) {
1370 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1375 //=============================================================================
1377 * Get implementation
1379 //=============================================================================
1381 ::HYBRIDPlugin_Hypothesis* HYBRIDPlugin_Hypothesis_i::GetImpl()
1383 return (::HYBRIDPlugin_Hypothesis*)myBaseImpl;
1386 //================================================================================
1388 * \brief Verify whether hypothesis supports given entity type
1390 //================================================================================
1392 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
1394 return type == SMESH::DIM_3D;