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,
52 ::SMESH_Gen* theGenImpl)
53 : SALOME::GenericObj_i( thePOA ),
54 SMESH_Hypothesis_i( thePOA )
56 MESSAGE( "HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i" );
57 myBaseImpl = new ::HYBRIDPlugin_Hypothesis (theGenImpl->GetANewId(),
61 //=======================================================================
62 //function : ~HYBRIDPlugin_Hypothesis_i
63 //=======================================================================
64 HYBRIDPlugin_Hypothesis_i::~HYBRIDPlugin_Hypothesis_i()
66 MESSAGE( "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 : SetToMeshHoles
92 //=======================================================================
94 void HYBRIDPlugin_Hypothesis_i::SetToMeshHoles(CORBA::Boolean toMesh)
97 this->GetImpl()->SetToMeshHoles(toMesh);
98 SMESH::TPythonDump() << _this() << ".SetToMeshHoles( " << toMesh << " )";
101 //=======================================================================
102 //function : GetToMeshHoles
103 //=======================================================================
105 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToMeshHoles()
108 return this->GetImpl()->GetToMeshHoles();
111 //=======================================================================
112 //function : SetToMakeGroupsOfDomains
113 //=======================================================================
115 void HYBRIDPlugin_Hypothesis_i::SetToMakeGroupsOfDomains(CORBA::Boolean toMakeGroups)
118 this->GetImpl()->SetToMakeGroupsOfDomains(toMakeGroups);
119 SMESH::TPythonDump() << _this() << ".SetToMakeGroupsOfDomains( " << toMakeGroups << " )";
122 //=======================================================================
123 //function : GetToMakeGroupsOfDomains
124 //=======================================================================
126 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToMakeGroupsOfDomains()
129 return this->GetImpl()->GetToMakeGroupsOfDomains();
132 //=======================================================================
133 //function : SetMaximumMemory
134 //=======================================================================
136 void HYBRIDPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Double MB)
137 throw ( SALOME::SALOME_Exception )
140 THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
142 this->GetImpl()->SetMaximumMemory(MB);
143 SMESH::TPythonDump() << _this() << ".SetMaximumMemory( " << MB << " )";
146 //=======================================================================
147 //function : GetMaximumMemory
148 //=======================================================================
150 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetMaximumMemory()
153 return this->GetImpl()->GetMaximumMemory();
156 //=======================================================================
157 //function : SetInitialMemory
158 //=======================================================================
160 void HYBRIDPlugin_Hypothesis_i::SetInitialMemory(CORBA::Double MB)
161 throw ( SALOME::SALOME_Exception )
164 THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
166 this->GetImpl()->SetInitialMemory(MB);
167 SMESH::TPythonDump() << _this() << ".SetInitialMemory( " << MB << " )";
170 //=======================================================================
171 //function : GetInitialMemory
172 //=======================================================================
174 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetInitialMemory()
177 return this->GetImpl()->GetInitialMemory();
180 //=======================================================================
181 //function : SetOptimizationLevel
182 //=======================================================================
184 void HYBRIDPlugin_Hypothesis_i::SetOptimizationLevel(CORBA::Short level)
185 throw ( SALOME::SALOME_Exception )
187 ::HYBRIDPlugin_Hypothesis::OptimizationLevel l =
188 (::HYBRIDPlugin_Hypothesis::OptimizationLevel) level;
189 if ( l < ::HYBRIDPlugin_Hypothesis::None ||
190 l > ::HYBRIDPlugin_Hypothesis::Strong )
191 THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
194 this->GetImpl()->SetOptimizationLevel(l);
195 SMESH::TPythonDump() << _this() << ".SetOptimizationLevel( " << level << " )";
198 //=======================================================================
199 //function : GetOptimizationLevel
200 //=======================================================================
202 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetOptimizationLevel()
205 return this->GetImpl()->GetOptimizationLevel();
209 //=======================================================================
210 //function : SetCollisionMode
211 //=======================================================================
212 void HYBRIDPlugin_Hypothesis_i::SetCollisionMode(CORBA::Short level)
213 throw ( SALOME::SALOME_Exception )
215 ::HYBRIDPlugin_Hypothesis::CollisionMode l =
216 (::HYBRIDPlugin_Hypothesis::CollisionMode) level;
217 if ( l < ::HYBRIDPlugin_Hypothesis::Decrease ||
218 l > ::HYBRIDPlugin_Hypothesis::Stop )
219 THROW_SALOME_CORBA_EXCEPTION( "Invalid collision mode",SALOME::BAD_PARAM );
222 this->GetImpl()->SetCollisionMode(l);
223 SMESH::TPythonDump() << _this() << ".SetCollisionMode( " << level << " )";
226 //=======================================================================
227 //function : GetCollisionMode
228 //=======================================================================
229 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetCollisionMode()
232 return this->GetImpl()->GetCollisionMode();
235 //=======================================================================
236 //function : SetWorkingDirectory
237 //=======================================================================
238 void HYBRIDPlugin_Hypothesis_i::SetWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception )
241 THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
243 std::string file(path);
244 const char lastChar = *file.rbegin();
246 if ( lastChar != '\\' ) file += '\\';
248 if ( lastChar != '/' ) file += '/';
250 file += "HYBRID.log";
251 SMESH_Mesh_i::PrepareForWriting (file.c_str());
254 this->GetImpl()->SetWorkingDirectory(path);
255 SMESH::TPythonDump() << _this() << ".SetWorkingDirectory( '" << path << "' )";
258 //=======================================================================
259 //function : GetWorkingDirectory
260 //=======================================================================
261 char* HYBRIDPlugin_Hypothesis_i::GetWorkingDirectory()
264 return CORBA::string_dup( this->GetImpl()->GetWorkingDirectory().c_str() );
267 //=======================================================================
268 //function : SetKeepFiles
269 //=======================================================================
270 void HYBRIDPlugin_Hypothesis_i::SetKeepFiles(CORBA::Boolean toKeep)
273 this->GetImpl()->SetKeepFiles(toKeep);
274 SMESH::TPythonDump() << _this() << ".SetKeepFiles( " << toKeep << " )";
277 //=======================================================================
278 //function : GetKeepFiles
279 //=======================================================================
280 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetKeepFiles()
283 return this->GetImpl()->GetKeepFiles();
286 //=======================================================================
287 //function : SetVerboseLevel
288 //=======================================================================
289 void HYBRIDPlugin_Hypothesis_i::SetVerboseLevel(CORBA::Short level)
290 throw ( SALOME::SALOME_Exception )
292 if (level < 0 || level > 10 )
293 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbose level, valid range is [0-10]",
296 this->GetImpl()->SetVerboseLevel(level);
297 SMESH::TPythonDump() << _this() << ".SetVerboseLevel( " << level << " )";
300 //=======================================================================
301 //function : GetVerboseLevel
302 //=======================================================================
303 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetVerboseLevel()
306 return this->GetImpl()->GetVerboseLevel();
309 //=======================================================================
310 //function : SetToCreateNewNodes
311 //=======================================================================
313 void HYBRIDPlugin_Hypothesis_i::SetToCreateNewNodes(CORBA::Boolean toCreate)
316 this->GetImpl()->SetToCreateNewNodes(toCreate);
317 SMESH::TPythonDump() << _this() << ".SetToCreateNewNodes( " << toCreate << " )";
320 //=======================================================================
321 //function : GetToCreateNewNodes
322 //=======================================================================
324 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToCreateNewNodes()
327 return this->GetImpl()->GetToCreateNewNodes();
330 //=======================================================================
331 //function : SetToUseBoundaryRecoveryVersion
332 //=======================================================================
334 void HYBRIDPlugin_Hypothesis_i::SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse)
337 this->GetImpl()->SetToUseBoundaryRecoveryVersion(toUse);
338 SMESH::TPythonDump() << _this() << ".SetToUseBoundaryRecoveryVersion( " << toUse << " )";
341 //=======================================================================
342 //function : GetToUseBoundaryRecoveryVersion
343 //=======================================================================
345 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToUseBoundaryRecoveryVersion()
348 return this->GetImpl()->GetToUseBoundaryRecoveryVersion();
351 //=======================================================================
352 //function : SetFEMCorrection
353 //=======================================================================
355 void HYBRIDPlugin_Hypothesis_i::SetFEMCorrection(CORBA::Boolean toUseFem)
358 this->GetImpl()->SetFEMCorrection(toUseFem);
359 SMESH::TPythonDump() << _this() << ".SetFEMCorrection( " << toUseFem << " )";
362 //=======================================================================
363 //function : GetFEMCorrection
364 //=======================================================================
366 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetFEMCorrection()
369 return this->GetImpl()->GetFEMCorrection();
372 //=======================================================================
373 //function : SetToRemoveCentralPoint
374 //=======================================================================
376 void HYBRIDPlugin_Hypothesis_i::SetToRemoveCentralPoint(CORBA::Boolean toRemove)
379 this->GetImpl()->SetToRemoveCentralPoint(toRemove);
380 SMESH::TPythonDump() << _this() << ".SetToRemoveCentralPoint( " << toRemove << " )";
383 //=======================================================================
384 //function : GetToRemoveCentralPoint
385 //=======================================================================
387 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToRemoveCentralPoint()
390 return this->GetImpl()->GetToRemoveCentralPoint();
393 //=======================================================================
394 //function : SetTextOption
395 //=======================================================================
396 void HYBRIDPlugin_Hypothesis_i::SetTextOption(const char* option)
399 this->GetImpl()->SetAdvancedOption(option);
400 SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << option << "' )";
403 //=======================================================================
404 //function : GetTextOption
405 //=======================================================================
406 char* HYBRIDPlugin_Hypothesis_i::GetTextOption()
409 return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
412 //=======================================================================
413 //function : SetAdvancedOption
414 //=======================================================================
415 void HYBRIDPlugin_Hypothesis_i::SetAdvancedOption(const char* theOptAndVals )
417 if ( theOptAndVals && GetImpl()->GetAdvancedOption() != theOptAndVals )
419 GetImpl()->SetAdvancedOption( theOptAndVals );
420 SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << theOptAndVals << "' )";
424 //=======================================================================
425 //function : GetAdvancedOption
426 //=======================================================================
427 char* HYBRIDPlugin_Hypothesis_i::GetAdvancedOption()
429 return CORBA::string_dup( GetImpl()->GetAdvancedOption().c_str() );
432 //=======================================================================
433 //function : SetToRemoveCentralPoint
434 //=======================================================================
436 void HYBRIDPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
439 THROW_SALOME_CORBA_EXCEPTION( "The volumic gradation must be > 1",SALOME::BAD_PARAM );
441 if (gradation != GetGradation()) {
442 this->GetImpl()->SetGradation(gradation);
443 SMESH::TPythonDump() << _this() << ".SetGradation( " << gradation << " )";
447 //=======================================================================
448 //function : GetToRemoveCentralPoint
449 //=======================================================================
451 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetGradation()
454 return this->GetImpl()->GetGradation();
457 //=======================================================================
458 //function : SetStandardOutputLog
459 //=======================================================================
460 void HYBRIDPlugin_Hypothesis_i::SetStandardOutputLog(CORBA::Boolean logInStandardOutput)
463 this->GetImpl()->SetStandardOutputLog(logInStandardOutput);
464 SMESH::TPythonDump() << _this() << ".SetPrintLogInFile( " << !logInStandardOutput << " )";
467 //=======================================================================
468 //function : GetStandardOutputLog
469 //=======================================================================
470 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetStandardOutputLog()
473 return this->GetImpl()->GetStandardOutputLog();
476 //=======================================================================
477 //function : SetRemoveLogOnSuccess
478 //=======================================================================
479 void HYBRIDPlugin_Hypothesis_i::SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess)
482 this->GetImpl()->SetRemoveLogOnSuccess(removeLogOnSuccess);
483 SMESH::TPythonDump() << _this() << ".SetRemoveLogOnSuccess( " << removeLogOnSuccess << " )";
486 //=======================================================================
487 //function : GetRemoveLogOnSuccess
488 //=======================================================================
489 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
492 return this->GetImpl()->GetRemoveLogOnSuccess();
495 //=======================================================================
496 //function : SetBoundaryLayersGrowth
497 //=======================================================================
498 void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersGrowth(CORBA::Short level)
499 throw ( SALOME::SALOME_Exception )
501 ::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth l =
502 (::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth) level;
503 if ( l < ::HYBRIDPlugin_Hypothesis::Layer_Growth_Inward ||
504 l > ::HYBRIDPlugin_Hypothesis::Layer_Growth_Outward )
505 THROW_SALOME_CORBA_EXCEPTION( "Invalid BoundaryLayersGrowth mode",SALOME::BAD_PARAM );
508 this->GetImpl()->SetBoundaryLayersGrowth(l);
509 SMESH::TPythonDump() << _this() << ".SetBoundaryLayersGrowth( " << level << " )";
512 //=======================================================================
513 //function : GetBoundaryLayersGrowth
514 //=======================================================================
515 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersGrowth()
518 return this->GetImpl()->GetBoundaryLayersGrowth();
521 //=======================================================================
522 //function : SetElementGeneration
523 //=======================================================================
524 void HYBRIDPlugin_Hypothesis_i::SetElementGeneration(CORBA::Short level)
525 throw ( SALOME::SALOME_Exception )
527 ::HYBRIDPlugin_Hypothesis::ElementGeneration l =
528 (::HYBRIDPlugin_Hypothesis::ElementGeneration) level;
529 if ( l < ::HYBRIDPlugin_Hypothesis::Generation_Tetra_Dominant ||
530 l > ::HYBRIDPlugin_Hypothesis::Generation_Hexa_Dominant )
531 THROW_SALOME_CORBA_EXCEPTION( "Invalid ElementGeneration mode",SALOME::BAD_PARAM );
534 this->GetImpl()->SetElementGeneration(l);
535 SMESH::TPythonDump() << _this() << ".SetElementGeneration( " << level << " )";
538 //=======================================================================
539 //function : GetElementGeneration
540 //=======================================================================
541 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetElementGeneration()
544 return this->GetImpl()->GetElementGeneration();
547 //=======================================================================
548 //function : SetAddMultinormals
549 //=======================================================================
550 void HYBRIDPlugin_Hypothesis_i::SetAddMultinormals(CORBA::Boolean toAddMultinormals)
553 this->GetImpl()->SetAddMultinormals(toAddMultinormals);
554 SMESH::TPythonDump() << _this() << ".SetAddMultinormals( " << toAddMultinormals << " )";
557 //=======================================================================
558 //function : GetAddMultinormals
559 //=======================================================================
560 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetAddMultinormals()
563 return this->GetImpl()->GetAddMultinormals();
566 //=======================================================================
567 //function : SetSmoothNormals
568 //=======================================================================
569 void HYBRIDPlugin_Hypothesis_i::SetSmoothNormals(CORBA::Boolean toSmoothNormals)
572 this->GetImpl()->SetSmoothNormals(toSmoothNormals);
573 SMESH::TPythonDump() << _this() << ".SetSmoothNormals( " << toSmoothNormals << " )";
576 //=======================================================================
577 //function : GetSmoothNormals
578 //=======================================================================
579 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetSmoothNormals()
582 return this->GetImpl()->GetSmoothNormals();
585 //=======================================================================
586 //function : SetHeightFirstLayer
587 //=======================================================================
588 void HYBRIDPlugin_Hypothesis_i::SetHeightFirstLayer(CORBA::Double toHeightFirstLayer)
591 this->GetImpl()->SetHeightFirstLayer(toHeightFirstLayer);
592 SMESH::TPythonDump() << _this() << ".SetHeightFirstLayer( " << toHeightFirstLayer << " )";
595 //=======================================================================
596 //function : GetHeightFirstLayer
597 //=======================================================================
598 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetHeightFirstLayer()
601 return this->GetImpl()->GetHeightFirstLayer();
604 //=======================================================================
605 //function : SetBoundaryLayersProgression
606 //=======================================================================
607 void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersProgression(CORBA::Double toBoundaryLayersProgression)
610 this->GetImpl()->SetBoundaryLayersProgression(toBoundaryLayersProgression);
611 SMESH::TPythonDump() << _this() << ".SetBoundaryLayersProgression( " << toBoundaryLayersProgression << " )";
614 //=======================================================================
615 //function : GetBoundaryLayersProgression
616 //=======================================================================
617 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersProgression()
620 return this->GetImpl()->GetBoundaryLayersProgression();
623 //=======================================================================
624 //function : SetMultinormalsAngle
625 //=======================================================================
626 void HYBRIDPlugin_Hypothesis_i::SetMultinormalsAngle(CORBA::Double toMultinormalsAngle)
629 this->GetImpl()->SetMultinormalsAngle(toMultinormalsAngle);
630 SMESH::TPythonDump() << _this() << ".SetMultinormalsAngle( " << toMultinormalsAngle << " )";
633 //=======================================================================
634 //function : GetMultinormalsAngle
635 //=======================================================================
636 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetMultinormalsAngle()
639 return this->GetImpl()->GetMultinormalsAngle();
642 //=======================================================================
643 //function : SetNbOfBoundaryLayers
644 //=======================================================================
645 void HYBRIDPlugin_Hypothesis_i::SetNbOfBoundaryLayers(CORBA::Short toNbOfBoundaryLayers)
648 this->GetImpl()->SetNbOfBoundaryLayers(toNbOfBoundaryLayers);
649 SMESH::TPythonDump() << _this() << ".SetNbOfBoundaryLayers( " << toNbOfBoundaryLayers << " )";
652 //=======================================================================
653 //function : GetNbOfBoundaryLayers
654 //=======================================================================
655 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetNbOfBoundaryLayers()
658 return this->GetImpl()->GetNbOfBoundaryLayers();
661 //=======================================================================
662 //function : SetEnforcedVertex
663 //=======================================================================
665 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
666 throw (SALOME::SALOME_Exception) {
668 MESSAGE("IDL : SetEnforcedVertex( "<< x << ", " << y << ", " << z << ", " << size << ")");
669 return p_SetEnforcedVertex(size, x, y, z);
672 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
673 throw (SALOME::SALOME_Exception) {
675 MESSAGE("IDL : SetEnforcedVertexNamed( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ")");
676 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
679 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
680 throw (SALOME::SALOME_Exception) {
682 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theGroupName << ")");
683 return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
686 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
687 throw (SALOME::SALOME_Exception) {
689 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ", " << theGroupName << ")");
690 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
693 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size)
694 throw (SALOME::SALOME_Exception) {
697 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
698 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
699 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
702 std::string theVertexEntry = theVertex->GetStudyEntry();
703 CORBA::Double x = 0, y = 0, z = 0;
704 CORBA::Boolean isCompound = false;
705 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
706 if (theVertexEntry.empty()) {
708 if (theVertex->GetShapeType() == GEOM::VERTEX) {
711 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
715 aName += theVertex->GetEntry();
716 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
717 if (!theSVertex->_is_nil())
718 theVertexEntry = theSVertex->GetID();
720 if (theVertexEntry.empty())
721 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
723 if (theVertex->GetShapeType() == GEOM::VERTEX) {
724 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
725 if (CORBA::is_nil(measureOp))
728 measureOp->PointCoordinates (theVertex, x, y, z);
729 MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
732 std::string theVertexName = theVertex->GetName();
733 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theVertexEntry << ", " << size<< ")");
735 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
738 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName)
739 throw (SALOME::SALOME_Exception) {
742 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
743 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
744 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
747 std::string theVertexEntry = theVertex->GetStudyEntry();
748 CORBA::Double x = 0, y = 0, z = 0;
749 CORBA::Boolean isCompound = false;
750 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
751 if (theVertexEntry.empty()) {
753 if (theVertex->GetShapeType() == GEOM::VERTEX) {
756 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
760 aName += theVertex->GetEntry();
761 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
762 if (!theSVertex->_is_nil())
763 theVertexEntry = theSVertex->GetID();
765 if (theVertexEntry.empty())
766 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
768 if (theVertex->GetShapeType() == GEOM::VERTEX) {
769 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
770 if (CORBA::is_nil(measureOp))
773 measureOp->PointCoordinates (theVertex, x, y, z);
774 MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
777 std::string theVertexName = theVertex->GetName();
778 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theVertexEntry << ", " << size<< ", " << theGroupName << ")");
780 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
783 bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x, CORBA::Double y, CORBA::Double z,
784 const char* theVertexName, const char* theVertexEntry, const char* theGroupName,
785 CORBA::Boolean isCompound)
786 throw (SALOME::SALOME_Exception) {
788 MESSAGE("IDL : p_SetEnforcedVertex(" << size << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\", " << isCompound<< ")");
789 bool newValue = false;
791 ::HYBRIDPlugin_Hypothesis::TCoordsHYBRIDEnforcedVertexMap coordsList;
792 ::HYBRIDPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap enfVertexEntryList;
793 if (std::string(theVertexEntry).empty()) {
794 coordsList = this->GetImpl()->_GetEnforcedVerticesByCoords();
795 std::vector<double> coords;
799 if (coordsList.find(coords) == coordsList.end()) {
800 MESSAGE("Coords not found: add it in coordsList");
804 MESSAGE("Coords already found, compare names");
805 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
806 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
807 MESSAGE("The names or size are different: update");
808 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
812 MESSAGE("The names and size are identical");
817 if (std::string(theVertexName).empty()) {
818 if (std::string(theGroupName).empty())
819 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ")";
821 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theGroupName << "\")";
824 if (std::string(theGroupName).empty())
825 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\")";
827 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\", \"" << theGroupName << "\")";
832 // if (isCompound || (!isCompound && !std::string(theVertexEntry).empty())) {
833 enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
834 // ::BLSURFPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap::const_iterator it = enfVertexEntryList.find(theVertexEntry);
835 if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
836 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
840 MESSAGE("Geom entry already found, compare names");
841 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
842 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
843 MESSAGE("The names or size are different: update");
844 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
848 MESSAGE("The names and size are identical");
853 if (std::string(theGroupName).empty())
854 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeom(" << theVertexEntry << ", " << size << ")";
856 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeomWithGroup(" << theVertexEntry << ", " << size << ", \"" << theGroupName << "\")";
861 this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
863 MESSAGE("IDL : SetEnforcedVertexEntry END");
867 //=======================================================================
868 //function : GetEnforcedVertex
869 //=======================================================================
871 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
872 throw (SALOME::SALOME_Exception)
876 bool isDone = this->GetImpl()->GetEnforcedVertex(x,y,z)->size;
877 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertex(" << x << ", " << y << ", " << z << ")";
880 catch (const std::invalid_argument& ex) {
881 SALOME::ExceptionStruct ExDescription;
882 ExDescription.text = ex.what();
883 ExDescription.type = SALOME::BAD_PARAM;
884 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
885 ExDescription.lineNumber = 513;
886 throw SALOME::SALOME_Exception(ExDescription);
888 catch (SALOME_Exception& ex) {
889 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
893 //=======================================================================
894 //function : GetEnforcedVertex
895 //=======================================================================
897 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
898 throw (SALOME::SALOME_Exception)
902 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
903 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
904 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
907 std::string theVertexEntry = theVertex->GetStudyEntry();
908 if (theVertexEntry.empty()) {
909 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
911 if (theVertex->GetShapeType() == GEOM::VERTEX)
913 if (theVertex->GetShapeType() == GEOM::COMPOUND)
915 aName += theVertex->GetEntry();
916 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
917 if (!theSVertex->_is_nil())
918 theVertexEntry = theSVertex->GetID();
920 if (theVertexEntry.empty())
921 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
923 std::string theVertexName = theVertex->GetName();
926 bool isDone = this->GetImpl()->GetEnforcedVertex(theVertexName)->size;
927 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertexGeom(" << theVertex << ")";
930 catch (const std::invalid_argument& ex) {
931 SALOME::ExceptionStruct ExDescription;
932 ExDescription.text = ex.what();
933 ExDescription.type = SALOME::BAD_PARAM;
934 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
935 ExDescription.lineNumber = 538;
936 throw SALOME::SALOME_Exception(ExDescription);
938 catch (SALOME_Exception& ex) {
939 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
943 //=======================================================================
944 //function : GetEnforcedVertices
945 //=======================================================================
947 HYBRIDPlugin::HYBRIDEnforcedVertexList* HYBRIDPlugin_Hypothesis_i::GetEnforcedVertices()
950 HYBRIDPlugin::HYBRIDEnforcedVertexList_var result = new HYBRIDPlugin::HYBRIDEnforcedVertexList();
952 const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList enfVertexList = this->GetImpl()->_GetEnforcedVertices();
953 result->length( enfVertexList.size() );
955 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList::const_iterator it = enfVertexList.begin();
957 for (int i = 0 ; it != enfVertexList.end(); ++it, ++i ) {
958 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* currentVertex = (*it);
959 HYBRIDPlugin::HYBRIDEnforcedVertex_var enfVertex = new HYBRIDPlugin::HYBRIDEnforcedVertex();
961 enfVertex->name = CORBA::string_dup(currentVertex->name.c_str());
963 enfVertex->geomEntry = CORBA::string_dup(currentVertex->geomEntry.c_str());
965 HYBRIDPlugin::TCoords_var coords = new HYBRIDPlugin::TCoords();
966 coords->length(currentVertex->coords.size());
967 for (size_t ind = 0; ind < currentVertex->coords.size(); ind++)
968 coords[ind] = currentVertex->coords[ind];
969 enfVertex->coords = coords;
971 enfVertex->groupName = CORBA::string_dup(currentVertex->groupName.c_str());
973 enfVertex->size = currentVertex->size;
975 enfVertex->isCompound = currentVertex->isCompound;
980 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
982 return result._retn();
985 //=======================================================================
986 //function : RemoveEnforcedVertex
987 //=======================================================================
989 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
990 throw (SALOME::SALOME_Exception)
994 bool res = this->GetImpl()->RemoveEnforcedVertex(x,y,z);
995 SMESH::TPythonDump() << " isDone = " << _this() << ".RemoveEnforcedVertex( " << x << ", " << y << ", " << z << " )";
998 catch (const std::invalid_argument& ex) {
999 SALOME::ExceptionStruct ExDescription;
1000 ExDescription.text = ex.what();
1001 ExDescription.type = SALOME::BAD_PARAM;
1002 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1003 ExDescription.lineNumber = 625;
1004 throw SALOME::SALOME_Exception(ExDescription);
1006 catch (SALOME_Exception& ex) {
1007 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1011 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
1012 throw (SALOME::SALOME_Exception)
1016 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1017 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1018 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1021 std::string theVertexEntry = theVertex->GetStudyEntry();
1022 if (theVertexEntry.empty()) {
1023 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1025 if (theVertex->GetShapeType() == GEOM::VERTEX)
1027 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1028 aName = "Compound_";
1029 aName += theVertex->GetEntry();
1030 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
1031 if (!theSVertex->_is_nil())
1032 theVertexEntry = theSVertex->GetID();
1034 if (theVertexEntry.empty())
1035 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1038 bool res = this->GetImpl()->RemoveEnforcedVertex(0,0,0, theVertexEntry.c_str());
1039 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom( " << theVertexEntry.c_str() << " )";
1042 catch (const std::invalid_argument& ex) {
1043 SALOME::ExceptionStruct ExDescription;
1044 ExDescription.text = ex.what();
1045 ExDescription.type = SALOME::BAD_PARAM;
1046 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1047 ExDescription.lineNumber = 648;
1048 throw SALOME::SALOME_Exception(ExDescription);
1050 catch (SALOME_Exception& ex) {
1051 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1055 //=======================================================================
1056 //function : ClearEnforcedVertices
1057 //=======================================================================
1059 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedVertices()
1062 this->GetImpl()->ClearEnforcedVertices();
1063 SMESH::TPythonDump () << _this() << ".ClearEnforcedVertices() ";
1066 //=======================================================================
1067 //function : ClearEnforcedMeshes
1068 //=======================================================================
1070 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedMeshes()
1073 this->GetImpl()->ClearEnforcedMeshes();
1074 SMESH::TPythonDump () << _this() << ".ClearEnforcedMeshes() ";
1077 //=======================================================================
1078 //function : GetEnforcedMeshes
1079 //=======================================================================
1081 HYBRIDPlugin::HYBRIDEnforcedMeshList* HYBRIDPlugin_Hypothesis_i::GetEnforcedMeshes()
1084 HYBRIDPlugin::HYBRIDEnforcedMeshList_var result = new HYBRIDPlugin::HYBRIDEnforcedMeshList();
1086 const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList enfMeshList = this->GetImpl()->_GetEnforcedMeshes();
1087 result->length( enfMeshList.size() );
1089 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList::const_iterator it = enfMeshList.begin();
1091 for (int i = 0 ; it != enfMeshList.end(); ++it, ++i ) {
1092 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMesh* currentMesh = (*it);
1093 HYBRIDPlugin::HYBRIDEnforcedMesh_var enfMesh = new HYBRIDPlugin::HYBRIDEnforcedMesh();
1095 enfMesh->name = CORBA::string_dup(currentMesh->name.c_str());
1097 enfMesh->entry = CORBA::string_dup(currentMesh->entry.c_str());
1099 enfMesh->elementType = currentMesh->elementType;
1101 enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
1106 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
1108 return result._retn();
1112 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource. The elements will be grouped in theGroupName.
1114 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
1115 throw (SALOME::SALOME_Exception)
1117 // #if HYBRID_VERSION >= 42
1118 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1120 // SALOME::ExceptionStruct ExDescription;
1121 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1122 // ExDescription.type = SALOME::BAD_PARAM;
1123 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1124 // ExDescription.lineNumber = 719;
1125 // throw SALOME::SALOME_Exception(ExDescription);
1130 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource.
1132 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
1133 throw (SALOME::SALOME_Exception)
1135 // MESSAGE("HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh");
1136 // #if HYBRID_VERSION >= 42
1137 return p_SetEnforcedMesh(theSource, theType);
1139 // SALOME::ExceptionStruct ExDescription;
1140 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1141 // ExDescription.type = SALOME::BAD_PARAM;
1142 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1143 // ExDescription.lineNumber = 750;
1144 // throw SALOME::SALOME_Exception(ExDescription);
1149 * \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.
1151 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
1152 throw (SALOME::SALOME_Exception)
1154 // #if HYBRID_VERSION >= 42
1155 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1157 // SALOME::ExceptionStruct ExDescription;
1158 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1159 // ExDescription.type = SALOME::BAD_PARAM;
1160 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1161 // ExDescription.lineNumber = 750;
1162 // throw SALOME::SALOME_Exception(ExDescription);
1167 * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
1169 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
1170 throw (SALOME::SALOME_Exception)
1172 // #if HYBRID_VERSION >= 42
1173 return p_SetEnforcedMesh(theSource, theType);
1175 // SALOME::ExceptionStruct ExDescription;
1176 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1177 // ExDescription.type = SALOME::BAD_PARAM;
1178 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1179 // ExDescription.lineNumber = 750;
1180 // throw SALOME::SALOME_Exception(ExDescription);
1184 bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
1185 throw (SALOME::SALOME_Exception)
1187 MESSAGE("HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh");
1190 if (CORBA::is_nil( theSource ))
1192 SALOME::ExceptionStruct ExDescription;
1193 ExDescription.text = "The source mesh CORBA object is NULL";
1194 ExDescription.type = SALOME::BAD_PARAM;
1195 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1196 ExDescription.lineNumber = 840;
1197 throw SALOME::SALOME_Exception(ExDescription);
1202 MESSAGE("Required type is NODE");
1205 MESSAGE("Required type is EDGE");
1208 MESSAGE("Required type is FACE");
1211 MESSAGE("Incompatible required type: " << theType);
1214 // MESSAGE("Required type is "<<theType);
1215 SMESH::array_of_ElementType_var types = theSource->GetTypes();
1216 MESSAGE("Available types:");
1217 for (CORBA::ULong i=0;i<types->length();i++){MESSAGE(types[i]);}
1218 if ( types->length() >= 1 && types[types->length()-1] < theType)
1220 MESSAGE("Required type not available");
1222 // SALOME::ExceptionStruct ExDescription;
1223 // ExDescription.text = "The source mesh has bad type";
1224 // ExDescription.type = SALOME::BAD_PARAM;
1225 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1226 // ExDescription.lineNumber = 840;
1227 // throw SALOME::SALOME_Exception(ExDescription);
1231 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1232 SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(theSource);
1234 SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
1235 SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
1236 SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
1238 std::string enfMeshName = theName;
1239 if (enfMeshName.empty())
1240 enfMeshName = SObj->GetName();
1245 bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
1246 if (theGroupName && theGroupName[0]) {
1247 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1248 << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
1251 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1252 << theSource << ".GetMesh(), " << theType << " )";
1257 catch (const std::invalid_argument& ex) {
1258 SALOME::ExceptionStruct ExDescription;
1259 ExDescription.text = ex.what();
1260 ExDescription.type = SALOME::BAD_PARAM;
1261 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1262 ExDescription.lineNumber = 840;
1263 throw SALOME::SALOME_Exception(ExDescription);
1265 catch (SALOME_Exception& ex) {
1266 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1269 else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
1271 MESSAGE("The source is a group")
1273 bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1274 if (theGroupName && theGroupName[0]) {
1275 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1276 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1279 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1280 << theSource << ", " << theType << " )";
1284 catch (const std::invalid_argument& ex) {
1285 SALOME::ExceptionStruct ExDescription;
1286 ExDescription.text = ex.what();
1287 ExDescription.type = SALOME::BAD_PARAM;
1288 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1289 ExDescription.lineNumber = 840;
1290 throw SALOME::SALOME_Exception(ExDescription);
1292 catch (SALOME_Exception& ex) {
1293 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1296 else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
1298 MESSAGE("The source is a group on geom")
1300 bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1301 if (theGroupName && theGroupName[0]) {
1302 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1303 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1306 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1307 << theSource << ", " << theType << " )";
1311 catch (const std::invalid_argument& ex) {
1312 SALOME::ExceptionStruct ExDescription;
1313 ExDescription.text = ex.what();
1314 ExDescription.type = SALOME::BAD_PARAM;
1315 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1316 ExDescription.lineNumber = 840;
1317 throw SALOME::SALOME_Exception(ExDescription);
1319 catch (SALOME_Exception& ex) {
1320 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1325 //=============================================================================
1327 * Get implementation
1329 //=============================================================================
1331 ::HYBRIDPlugin_Hypothesis* HYBRIDPlugin_Hypothesis_i::GetImpl()
1333 return (::HYBRIDPlugin_Hypothesis*)myBaseImpl;
1336 //================================================================================
1338 * \brief Verify whether hypothesis supports given entity type
1340 //================================================================================
1342 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
1344 return type == SMESH::DIM_3D;