1 // Copyright (C) 2004-2013 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.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : HYBRIDPlugin_Hypothesis_i.cxx
21 // Created : Wed Apr 2 13:53:01 2008
22 // Author : Edward AGAPOV (eap)
24 #include "HYBRIDPlugin_Hypothesis_i.hxx"
26 #include "SMESH_Gen.hxx"
27 #include "SMESH_PythonDump.hxx"
28 //#include "SMESH_Mesh.hxx"
29 //#include "SMESH_ProxyMesh.hxx"
30 //#include <StdMeshers_QuadToTriaAdaptor.hxx>
32 #include "Utils_CorbaException.hxx"
33 #include "utilities.h"
34 #include "SMESH_Mesh_i.hxx"
35 #include "SMESH_Group_i.hxx"
36 #include "SMESH_Gen_i.hxx"
37 #include "SMESH_TypeDefs.hxx"
38 #include "SMESHDS_GroupBase.hxx"
40 // SALOME KERNEL includes
41 #include "SALOMEDSClient.hxx"
42 #include <SALOMEDSClient_definitions.hxx>
44 // #include <SALOMEconfig.h>
45 // #include CORBA_SERVER_HEADER(SALOMEDS)
47 //=======================================================================
48 //function : HYBRIDPlugin_Hypothesis_i
49 //=======================================================================
50 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(),
62 //=======================================================================
63 //function : ~HYBRIDPlugin_Hypothesis_i
64 //=======================================================================
65 HYBRIDPlugin_Hypothesis_i::~HYBRIDPlugin_Hypothesis_i()
67 MESSAGE( "HYBRIDPlugin_Hypothesis_i::~HYBRIDPlugin_Hypothesis_i" );
70 //=======================================================================
71 //function : SetToMeshHoles
72 //=======================================================================
74 void HYBRIDPlugin_Hypothesis_i::SetToMeshHoles(CORBA::Boolean toMesh)
77 this->GetImpl()->SetToMeshHoles(toMesh);
78 SMESH::TPythonDump() << _this() << ".SetToMeshHoles( " << toMesh << " )";
81 //=======================================================================
82 //function : GetToMeshHoles
83 //=======================================================================
85 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToMeshHoles()
88 return this->GetImpl()->GetToMeshHoles();
91 //=======================================================================
92 //function : SetToMakeGroupsOfDomains
93 //=======================================================================
95 void HYBRIDPlugin_Hypothesis_i::SetToMakeGroupsOfDomains(CORBA::Boolean toMakeGroups)
98 this->GetImpl()->SetToMakeGroupsOfDomains(toMakeGroups);
99 SMESH::TPythonDump() << _this() << ".SetToMakeGroupsOfDomains( " << toMakeGroups << " )";
102 //=======================================================================
103 //function : GetToMakeGroupsOfDomains
104 //=======================================================================
106 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToMakeGroupsOfDomains()
109 return this->GetImpl()->GetToMakeGroupsOfDomains();
112 //=======================================================================
113 //function : SetMaximumMemory
114 //=======================================================================
116 void HYBRIDPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Double MB)
117 throw ( SALOME::SALOME_Exception )
120 THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
122 this->GetImpl()->SetMaximumMemory(MB);
123 SMESH::TPythonDump() << _this() << ".SetMaximumMemory( " << MB << " )";
126 //=======================================================================
127 //function : GetMaximumMemory
128 //=======================================================================
130 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetMaximumMemory()
133 return this->GetImpl()->GetMaximumMemory();
136 //=======================================================================
137 //function : SetInitialMemory
138 //=======================================================================
140 void HYBRIDPlugin_Hypothesis_i::SetInitialMemory(CORBA::Double MB)
141 throw ( SALOME::SALOME_Exception )
144 THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
146 this->GetImpl()->SetInitialMemory(MB);
147 SMESH::TPythonDump() << _this() << ".SetInitialMemory( " << MB << " )";
150 //=======================================================================
151 //function : GetInitialMemory
152 //=======================================================================
154 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetInitialMemory()
157 return this->GetImpl()->GetInitialMemory();
160 //=======================================================================
161 //function : SetOptimizationLevel
162 //=======================================================================
164 void HYBRIDPlugin_Hypothesis_i::SetOptimizationLevel(CORBA::Short level)
165 throw ( SALOME::SALOME_Exception )
167 ::HYBRIDPlugin_Hypothesis::OptimizationLevel l =
168 (::HYBRIDPlugin_Hypothesis::OptimizationLevel) level;
169 if ( l < ::HYBRIDPlugin_Hypothesis::None ||
170 l > ::HYBRIDPlugin_Hypothesis::Strong )
171 THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
174 this->GetImpl()->SetOptimizationLevel(l);
175 SMESH::TPythonDump() << _this() << ".SetOptimizationLevel( " << level << " )";
178 //=======================================================================
179 //function : GetOptimizationLevel
180 //=======================================================================
182 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetOptimizationLevel()
185 return this->GetImpl()->GetOptimizationLevel();
189 //=======================================================================
190 //function : SetCollisionMode
191 //=======================================================================
192 void HYBRIDPlugin_Hypothesis_i::SetCollisionMode(CORBA::Short level)
193 throw ( SALOME::SALOME_Exception )
195 ::HYBRIDPlugin_Hypothesis::CollisionMode l =
196 (::HYBRIDPlugin_Hypothesis::CollisionMode) level;
197 if ( l < ::HYBRIDPlugin_Hypothesis::Decrease ||
198 l > ::HYBRIDPlugin_Hypothesis::Stop )
199 THROW_SALOME_CORBA_EXCEPTION( "Invalid collision mode",SALOME::BAD_PARAM );
202 this->GetImpl()->SetCollisionMode(l);
203 SMESH::TPythonDump() << _this() << ".SetCollisionMode( " << level << " )";
206 //=======================================================================
207 //function : GetCollisionMode
208 //=======================================================================
209 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetCollisionMode()
212 return this->GetImpl()->GetCollisionMode();
215 //=======================================================================
216 //function : SetWorkingDirectory
217 //=======================================================================
218 void HYBRIDPlugin_Hypothesis_i::SetWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception )
221 THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
224 const char lastChar = *file.rbegin();
226 if ( lastChar != '\\' ) file += '\\';
228 if ( lastChar != '/' ) file += '/';
230 file += "HYBRID.log";
231 SMESH_Mesh_i::PrepareForWriting (file.c_str());
234 this->GetImpl()->SetWorkingDirectory(path);
235 SMESH::TPythonDump() << _this() << ".SetWorkingDirectory( '" << path << "' )";
238 //=======================================================================
239 //function : GetWorkingDirectory
240 //=======================================================================
241 char* HYBRIDPlugin_Hypothesis_i::GetWorkingDirectory()
244 return CORBA::string_dup( this->GetImpl()->GetWorkingDirectory().c_str() );
247 //=======================================================================
248 //function : SetKeepFiles
249 //=======================================================================
250 void HYBRIDPlugin_Hypothesis_i::SetKeepFiles(CORBA::Boolean toKeep)
253 this->GetImpl()->SetKeepFiles(toKeep);
254 SMESH::TPythonDump() << _this() << ".SetKeepFiles( " << toKeep << " )";
257 //=======================================================================
258 //function : GetKeepFiles
259 //=======================================================================
260 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetKeepFiles()
263 return this->GetImpl()->GetKeepFiles();
266 //=======================================================================
267 //function : SetVerboseLevel
268 //=======================================================================
269 void HYBRIDPlugin_Hypothesis_i::SetVerboseLevel(CORBA::Short level)
270 throw ( SALOME::SALOME_Exception )
272 if (level < 0 || level > 10 )
273 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbose level, valid range is [0-10]",
276 this->GetImpl()->SetVerboseLevel(level);
277 SMESH::TPythonDump() << _this() << ".SetVerboseLevel( " << level << " )";
280 //=======================================================================
281 //function : GetVerboseLevel
282 //=======================================================================
283 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetVerboseLevel()
286 return this->GetImpl()->GetVerboseLevel();
289 //=======================================================================
290 //function : SetToCreateNewNodes
291 //=======================================================================
293 void HYBRIDPlugin_Hypothesis_i::SetToCreateNewNodes(CORBA::Boolean toCreate)
296 this->GetImpl()->SetToCreateNewNodes(toCreate);
297 SMESH::TPythonDump() << _this() << ".SetToCreateNewNodes( " << toCreate << " )";
300 //=======================================================================
301 //function : GetToCreateNewNodes
302 //=======================================================================
304 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToCreateNewNodes()
307 return this->GetImpl()->GetToCreateNewNodes();
310 //=======================================================================
311 //function : SetToUseBoundaryRecoveryVersion
312 //=======================================================================
314 void HYBRIDPlugin_Hypothesis_i::SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse)
317 this->GetImpl()->SetToUseBoundaryRecoveryVersion(toUse);
318 SMESH::TPythonDump() << _this() << ".SetToUseBoundaryRecoveryVersion( " << toUse << " )";
321 //=======================================================================
322 //function : GetToUseBoundaryRecoveryVersion
323 //=======================================================================
325 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToUseBoundaryRecoveryVersion()
328 return this->GetImpl()->GetToUseBoundaryRecoveryVersion();
331 //=======================================================================
332 //function : SetFEMCorrection
333 //=======================================================================
335 void HYBRIDPlugin_Hypothesis_i::SetFEMCorrection(CORBA::Boolean toUseFem)
338 this->GetImpl()->SetFEMCorrection(toUseFem);
339 SMESH::TPythonDump() << _this() << ".SetFEMCorrection( " << toUseFem << " )";
342 //=======================================================================
343 //function : GetFEMCorrection
344 //=======================================================================
346 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetFEMCorrection()
349 return this->GetImpl()->GetFEMCorrection();
352 //=======================================================================
353 //function : SetToRemoveCentralPoint
354 //=======================================================================
356 void HYBRIDPlugin_Hypothesis_i::SetToRemoveCentralPoint(CORBA::Boolean toRemove)
359 this->GetImpl()->SetToRemoveCentralPoint(toRemove);
360 SMESH::TPythonDump() << _this() << ".SetToRemoveCentralPoint( " << toRemove << " )";
363 //=======================================================================
364 //function : GetToRemoveCentralPoint
365 //=======================================================================
367 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToRemoveCentralPoint()
370 return this->GetImpl()->GetToRemoveCentralPoint();
373 //=======================================================================
374 //function : SetTextOption
375 //=======================================================================
376 void HYBRIDPlugin_Hypothesis_i::SetTextOption(const char* option)
379 this->GetImpl()->SetTextOption(option);
380 SMESH::TPythonDump() << _this() << ".SetTextOption( '" << option << "' )";
383 //=======================================================================
384 //function : GetTextOption
385 //=======================================================================
386 char* HYBRIDPlugin_Hypothesis_i::GetTextOption()
389 return CORBA::string_dup( this->GetImpl()->GetTextOption().c_str() );
392 //=======================================================================
393 //function : SetToRemoveCentralPoint
394 //=======================================================================
396 void HYBRIDPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
399 THROW_SALOME_CORBA_EXCEPTION( "The volumic gradation must be > 1",SALOME::BAD_PARAM );
401 if (gradation != GetGradation()) {
402 this->GetImpl()->SetGradation(gradation);
403 SMESH::TPythonDump() << _this() << ".SetGradation( " << gradation << " )";
407 //=======================================================================
408 //function : GetToRemoveCentralPoint
409 //=======================================================================
411 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetGradation()
414 return this->GetImpl()->GetGradation();
417 //=======================================================================
418 //function : SetStandardOutputLog
419 //=======================================================================
420 void HYBRIDPlugin_Hypothesis_i::SetStandardOutputLog(CORBA::Boolean logInStandardOutput)
423 this->GetImpl()->SetStandardOutputLog(logInStandardOutput);
424 SMESH::TPythonDump() << _this() << ".SetPrintLogInFile( " << !logInStandardOutput << " )";
427 //=======================================================================
428 //function : GetStandardOutputLog
429 //=======================================================================
430 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetStandardOutputLog()
433 return this->GetImpl()->GetStandardOutputLog();
436 //=======================================================================
437 //function : SetRemoveLogOnSuccess
438 //=======================================================================
439 void HYBRIDPlugin_Hypothesis_i::SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess)
442 this->GetImpl()->SetRemoveLogOnSuccess(removeLogOnSuccess);
443 SMESH::TPythonDump() << _this() << ".SetRemoveLogOnSuccess( " << removeLogOnSuccess << " )";
446 //=======================================================================
447 //function : GetRemoveLogOnSuccess
448 //=======================================================================
449 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
452 return this->GetImpl()->GetRemoveLogOnSuccess();
455 //=======================================================================
456 //function : SetBoundaryLayersGrowth
457 //=======================================================================
458 void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersGrowth(CORBA::Short level)
459 throw ( SALOME::SALOME_Exception )
461 ::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth l =
462 (::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth) level;
463 if ( l < ::HYBRIDPlugin_Hypothesis::Layer_Growth_Inward ||
464 l > ::HYBRIDPlugin_Hypothesis::Layer_Growth_Outward )
465 THROW_SALOME_CORBA_EXCEPTION( "Invalid BoundaryLayersGrowth mode",SALOME::BAD_PARAM );
468 this->GetImpl()->SetBoundaryLayersGrowth(l);
469 SMESH::TPythonDump() << _this() << ".SetBoundaryLayersGrowth( " << level << " )";
472 //=======================================================================
473 //function : GetBoundaryLayersGrowth
474 //=======================================================================
475 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersGrowth()
478 return this->GetImpl()->GetBoundaryLayersGrowth();
481 //=======================================================================
482 //function : SetElementGeneration
483 //=======================================================================
484 void HYBRIDPlugin_Hypothesis_i::SetElementGeneration(CORBA::Short level)
485 throw ( SALOME::SALOME_Exception )
487 ::HYBRIDPlugin_Hypothesis::ElementGeneration l =
488 (::HYBRIDPlugin_Hypothesis::ElementGeneration) level;
489 if ( l < ::HYBRIDPlugin_Hypothesis::Generation_Tetra_Dominant ||
490 l > ::HYBRIDPlugin_Hypothesis::Generation_Hexa_Dominant )
491 THROW_SALOME_CORBA_EXCEPTION( "Invalid ElementGeneration mode",SALOME::BAD_PARAM );
494 this->GetImpl()->SetElementGeneration(l);
495 SMESH::TPythonDump() << _this() << ".SetElementGeneration( " << level << " )";
498 //=======================================================================
499 //function : GetElementGeneration
500 //=======================================================================
501 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetElementGeneration()
504 return this->GetImpl()->GetElementGeneration();
507 //=======================================================================
508 //function : SetAddMultinormals
509 //=======================================================================
510 void HYBRIDPlugin_Hypothesis_i::SetAddMultinormals(CORBA::Boolean toAddMultinormals)
513 this->GetImpl()->SetAddMultinormals(toAddMultinormals);
514 SMESH::TPythonDump() << _this() << ".SetAddMultinormals( " << toAddMultinormals << " )";
517 //=======================================================================
518 //function : GetAddMultinormals
519 //=======================================================================
520 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetAddMultinormals()
523 return this->GetImpl()->GetAddMultinormals();
526 //=======================================================================
527 //function : SetSmoothNormals
528 //=======================================================================
529 void HYBRIDPlugin_Hypothesis_i::SetSmoothNormals(CORBA::Boolean toSmoothNormals)
532 this->GetImpl()->SetSmoothNormals(toSmoothNormals);
533 SMESH::TPythonDump() << _this() << ".SetSmoothNormals( " << toSmoothNormals << " )";
536 //=======================================================================
537 //function : GetSmoothNormals
538 //=======================================================================
539 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetSmoothNormals()
542 return this->GetImpl()->GetSmoothNormals();
545 //=======================================================================
546 //function : SetHeightFirstLayer
547 //=======================================================================
548 void HYBRIDPlugin_Hypothesis_i::SetHeightFirstLayer(CORBA::Double toHeightFirstLayer)
551 this->GetImpl()->SetHeightFirstLayer(toHeightFirstLayer);
552 SMESH::TPythonDump() << _this() << ".SetHeightFirstLayer( " << toHeightFirstLayer << " )";
555 //=======================================================================
556 //function : GetHeightFirstLayer
557 //=======================================================================
558 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetHeightFirstLayer()
561 return this->GetImpl()->GetHeightFirstLayer();
564 //=======================================================================
565 //function : SetBoundaryLayersProgression
566 //=======================================================================
567 void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersProgression(CORBA::Double toBoundaryLayersProgression)
570 this->GetImpl()->SetBoundaryLayersProgression(toBoundaryLayersProgression);
571 SMESH::TPythonDump() << _this() << ".SetBoundaryLayersProgression( " << toBoundaryLayersProgression << " )";
574 //=======================================================================
575 //function : GetBoundaryLayersProgression
576 //=======================================================================
577 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersProgression()
580 return this->GetImpl()->GetBoundaryLayersProgression();
583 //=======================================================================
584 //function : SetMultinormalsAngle
585 //=======================================================================
586 void HYBRIDPlugin_Hypothesis_i::SetMultinormalsAngle(CORBA::Double toMultinormalsAngle)
589 this->GetImpl()->SetMultinormalsAngle(toMultinormalsAngle);
590 SMESH::TPythonDump() << _this() << ".SetMultinormalsAngle( " << toMultinormalsAngle << " )";
593 //=======================================================================
594 //function : GetMultinormalsAngle
595 //=======================================================================
596 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetMultinormalsAngle()
599 return this->GetImpl()->GetMultinormalsAngle();
602 //=======================================================================
603 //function : SetNbOfBoundaryLayers
604 //=======================================================================
605 void HYBRIDPlugin_Hypothesis_i::SetNbOfBoundaryLayers(CORBA::Short toNbOfBoundaryLayers)
608 this->GetImpl()->SetNbOfBoundaryLayers(toNbOfBoundaryLayers);
609 SMESH::TPythonDump() << _this() << ".SetNbOfBoundaryLayers( " << toNbOfBoundaryLayers << " )";
612 //=======================================================================
613 //function : GetNbOfBoundaryLayers
614 //=======================================================================
615 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetNbOfBoundaryLayers()
618 return this->GetImpl()->GetNbOfBoundaryLayers();
621 //=======================================================================
622 //function : SetEnforcedVertex
623 //=======================================================================
625 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
626 throw (SALOME::SALOME_Exception) {
628 MESSAGE("IDL : SetEnforcedVertex( "<< x << ", " << y << ", " << z << ", " << size << ")");
629 return p_SetEnforcedVertex(size, x, y, z);
632 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
633 throw (SALOME::SALOME_Exception) {
635 MESSAGE("IDL : SetEnforcedVertexNamed( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ")");
636 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
639 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
640 throw (SALOME::SALOME_Exception) {
642 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theGroupName << ")");
643 return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
646 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
647 throw (SALOME::SALOME_Exception) {
649 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ", " << theGroupName << ")");
650 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
653 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size)
654 throw (SALOME::SALOME_Exception) {
657 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
658 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
659 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
662 string theVertexEntry = theVertex->GetStudyEntry();
663 CORBA::Double x = 0, y = 0, z = 0;
664 CORBA::Boolean isCompound = false;
665 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
666 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
667 if (theVertexEntry.empty()) {
669 if (theVertex->GetShapeType() == GEOM::VERTEX) {
672 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
676 aName += theVertex->GetEntry();
677 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
678 if (!theSVertex->_is_nil())
679 theVertexEntry = theSVertex->GetID();
681 if (theVertexEntry.empty())
682 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
684 if (theVertex->GetShapeType() == GEOM::VERTEX) {
685 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
686 if (CORBA::is_nil(measureOp))
689 measureOp->PointCoordinates (theVertex, x, y, z);
690 MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
693 string theVertexName = theVertex->GetName();
694 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theVertexEntry << ", " << size<< ")");
696 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
699 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName)
700 throw (SALOME::SALOME_Exception) {
703 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
704 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
705 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
708 string theVertexEntry = theVertex->GetStudyEntry();
709 CORBA::Double x = 0, y = 0, z = 0;
710 CORBA::Boolean isCompound = false;
711 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
712 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
713 if (theVertexEntry.empty()) {
715 if (theVertex->GetShapeType() == GEOM::VERTEX) {
718 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
722 aName += theVertex->GetEntry();
723 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
724 if (!theSVertex->_is_nil())
725 theVertexEntry = theSVertex->GetID();
727 if (theVertexEntry.empty())
728 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
730 if (theVertex->GetShapeType() == GEOM::VERTEX) {
731 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
732 if (CORBA::is_nil(measureOp))
735 measureOp->PointCoordinates (theVertex, x, y, z);
736 MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
739 string theVertexName = theVertex->GetName();
740 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theVertexEntry << ", " << size<< ", " << theGroupName << ")");
742 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
745 bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x, CORBA::Double y, CORBA::Double z,
746 const char* theVertexName, const char* theVertexEntry, const char* theGroupName,
747 CORBA::Boolean isCompound)
748 throw (SALOME::SALOME_Exception) {
750 MESSAGE("IDL : p_SetEnforcedVertex(" << size << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\", " << isCompound<< ")");
751 bool newValue = false;
753 ::HYBRIDPlugin_Hypothesis::TCoordsHYBRIDEnforcedVertexMap coordsList;
754 ::HYBRIDPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap enfVertexEntryList;
755 if (string(theVertexEntry).empty()) {
756 coordsList = this->GetImpl()->_GetEnforcedVerticesByCoords();
757 std::vector<double> coords;
761 if (coordsList.find(coords) == coordsList.end()) {
762 MESSAGE("Coords not found: add it in coordsList");
766 MESSAGE("Coords already found, compare names");
767 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
768 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
769 MESSAGE("The names or size are different: update");
770 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
774 MESSAGE("The names and size are identical");
779 if (string(theVertexName).empty()) {
780 if (string(theGroupName).empty())
781 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ")";
783 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theGroupName << "\")";
786 if (string(theGroupName).empty())
787 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\")";
789 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\", \"" << theGroupName << "\")";
794 // if (isCompound || (!isCompound && !string(theVertexEntry).empty())) {
795 enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
796 // ::BLSURFPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap::const_iterator it = enfVertexEntryList.find(theVertexEntry);
797 if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
798 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
802 MESSAGE("Geom entry already found, compare names");
803 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
804 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
805 MESSAGE("The names or size are different: update");
806 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
810 MESSAGE("The names and size are identical");
815 if (string(theGroupName).empty())
816 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeom(" << theVertexEntry << ", " << size << ")";
818 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeomWithGroup(" << theVertexEntry << ", " << size << ", \"" << theGroupName << "\")";
823 this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
825 MESSAGE("IDL : SetEnforcedVertexEntry END");
829 //=======================================================================
830 //function : GetEnforcedVertex
831 //=======================================================================
833 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
834 throw (SALOME::SALOME_Exception)
838 bool isDone = this->GetImpl()->GetEnforcedVertex(x,y,z)->size;
839 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertex(" << x << ", " << y << ", " << z << ")";
842 catch (const std::invalid_argument& ex) {
843 SALOME::ExceptionStruct ExDescription;
844 ExDescription.text = ex.what();
845 ExDescription.type = SALOME::BAD_PARAM;
846 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
847 ExDescription.lineNumber = 513;
848 throw SALOME::SALOME_Exception(ExDescription);
850 catch (SALOME_Exception& ex) {
851 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
855 //=======================================================================
856 //function : GetEnforcedVertex
857 //=======================================================================
859 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
860 throw (SALOME::SALOME_Exception)
864 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
865 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
866 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
869 string theVertexEntry = theVertex->GetStudyEntry();
870 if (theVertexEntry.empty()) {
871 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
872 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
874 if (theVertex->GetShapeType() == GEOM::VERTEX)
876 if (theVertex->GetShapeType() == GEOM::COMPOUND)
878 aName += theVertex->GetEntry();
879 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
880 if (!theSVertex->_is_nil())
881 theVertexEntry = theSVertex->GetID();
883 if (theVertexEntry.empty())
884 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
886 string theVertexName = theVertex->GetName();
889 bool isDone = this->GetImpl()->GetEnforcedVertex(theVertexName)->size;
890 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertexGeom(" << theVertex << ")";
893 catch (const std::invalid_argument& ex) {
894 SALOME::ExceptionStruct ExDescription;
895 ExDescription.text = ex.what();
896 ExDescription.type = SALOME::BAD_PARAM;
897 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
898 ExDescription.lineNumber = 538;
899 throw SALOME::SALOME_Exception(ExDescription);
901 catch (SALOME_Exception& ex) {
902 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
906 //=======================================================================
907 //function : GetEnforcedVertices
908 //=======================================================================
910 HYBRIDPlugin::HYBRIDEnforcedVertexList* HYBRIDPlugin_Hypothesis_i::GetEnforcedVertices()
913 HYBRIDPlugin::HYBRIDEnforcedVertexList_var result = new HYBRIDPlugin::HYBRIDEnforcedVertexList();
915 const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList enfVertexList = this->GetImpl()->_GetEnforcedVertices();
916 result->length( enfVertexList.size() );
918 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList::const_iterator it = enfVertexList.begin();
920 for (int i = 0 ; it != enfVertexList.end(); ++it, ++i ) {
921 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* currentVertex = (*it);
922 HYBRIDPlugin::HYBRIDEnforcedVertex_var enfVertex = new HYBRIDPlugin::HYBRIDEnforcedVertex();
924 enfVertex->name = CORBA::string_dup(currentVertex->name.c_str());
926 enfVertex->geomEntry = CORBA::string_dup(currentVertex->geomEntry.c_str());
928 HYBRIDPlugin::TCoords_var coords = new HYBRIDPlugin::TCoords();
929 coords->length(currentVertex->coords.size());
930 for (int ind = 0; ind < currentVertex->coords.size(); ind++)
931 coords[ind] = currentVertex->coords[ind];
932 enfVertex->coords = coords;
934 enfVertex->groupName = CORBA::string_dup(currentVertex->groupName.c_str());
936 enfVertex->size = currentVertex->size;
938 enfVertex->isCompound = currentVertex->isCompound;
943 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
945 return result._retn();
948 //=======================================================================
949 //function : RemoveEnforcedVertex
950 //=======================================================================
952 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
953 throw (SALOME::SALOME_Exception)
957 bool res = this->GetImpl()->RemoveEnforcedVertex(x,y,z);
958 SMESH::TPythonDump() << " isDone = " << _this() << ".RemoveEnforcedVertex( " << x << ", " << y << ", " << z << " )";
961 catch (const std::invalid_argument& ex) {
962 SALOME::ExceptionStruct ExDescription;
963 ExDescription.text = ex.what();
964 ExDescription.type = SALOME::BAD_PARAM;
965 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
966 ExDescription.lineNumber = 625;
967 throw SALOME::SALOME_Exception(ExDescription);
969 catch (SALOME_Exception& ex) {
970 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
974 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
975 throw (SALOME::SALOME_Exception)
979 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
980 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
981 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
984 string theVertexEntry = theVertex->GetStudyEntry();
985 if (theVertexEntry.empty()) {
986 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
987 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
989 if (theVertex->GetShapeType() == GEOM::VERTEX)
991 if (theVertex->GetShapeType() == GEOM::COMPOUND)
993 aName += theVertex->GetEntry();
994 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
995 if (!theSVertex->_is_nil())
996 theVertexEntry = theSVertex->GetID();
998 if (theVertexEntry.empty())
999 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1002 bool res = this->GetImpl()->RemoveEnforcedVertex(0,0,0, theVertexEntry.c_str());
1003 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom( " << theVertexEntry.c_str() << " )";
1006 catch (const std::invalid_argument& ex) {
1007 SALOME::ExceptionStruct ExDescription;
1008 ExDescription.text = ex.what();
1009 ExDescription.type = SALOME::BAD_PARAM;
1010 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1011 ExDescription.lineNumber = 648;
1012 throw SALOME::SALOME_Exception(ExDescription);
1014 catch (SALOME_Exception& ex) {
1015 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1019 //=======================================================================
1020 //function : ClearEnforcedVertices
1021 //=======================================================================
1023 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedVertices()
1026 this->GetImpl()->ClearEnforcedVertices();
1027 SMESH::TPythonDump () << _this() << ".ClearEnforcedVertices() ";
1030 //=======================================================================
1031 //function : ClearEnforcedMeshes
1032 //=======================================================================
1034 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedMeshes()
1037 this->GetImpl()->ClearEnforcedMeshes();
1038 SMESH::TPythonDump () << _this() << ".ClearEnforcedMeshes() ";
1041 //=======================================================================
1042 //function : GetEnforcedMeshes
1043 //=======================================================================
1045 HYBRIDPlugin::HYBRIDEnforcedMeshList* HYBRIDPlugin_Hypothesis_i::GetEnforcedMeshes()
1048 HYBRIDPlugin::HYBRIDEnforcedMeshList_var result = new HYBRIDPlugin::HYBRIDEnforcedMeshList();
1050 const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList enfMeshList = this->GetImpl()->_GetEnforcedMeshes();
1051 result->length( enfMeshList.size() );
1053 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList::const_iterator it = enfMeshList.begin();
1055 for (int i = 0 ; it != enfMeshList.end(); ++it, ++i ) {
1056 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMesh* currentMesh = (*it);
1057 HYBRIDPlugin::HYBRIDEnforcedMesh_var enfMesh = new HYBRIDPlugin::HYBRIDEnforcedMesh();
1059 enfMesh->name = CORBA::string_dup(currentMesh->name.c_str());
1061 enfMesh->entry = CORBA::string_dup(currentMesh->entry.c_str());
1063 enfMesh->elementType = currentMesh->elementType;
1065 enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
1070 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
1072 return result._retn();
1076 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource. The elements will be grouped in theGroupName.
1078 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
1079 throw (SALOME::SALOME_Exception)
1081 // #if HYBRID_VERSION >= 42
1082 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1084 // SALOME::ExceptionStruct ExDescription;
1085 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1086 // ExDescription.type = SALOME::BAD_PARAM;
1087 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1088 // ExDescription.lineNumber = 719;
1089 // throw SALOME::SALOME_Exception(ExDescription);
1094 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource.
1096 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
1097 throw (SALOME::SALOME_Exception)
1099 // MESSAGE("HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh");
1100 // #if HYBRID_VERSION >= 42
1101 return p_SetEnforcedMesh(theSource, theType);
1103 // SALOME::ExceptionStruct ExDescription;
1104 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1105 // ExDescription.type = SALOME::BAD_PARAM;
1106 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1107 // ExDescription.lineNumber = 750;
1108 // throw SALOME::SALOME_Exception(ExDescription);
1113 * \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.
1115 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
1116 throw (SALOME::SALOME_Exception)
1118 // #if HYBRID_VERSION >= 42
1119 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1121 // SALOME::ExceptionStruct ExDescription;
1122 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1123 // ExDescription.type = SALOME::BAD_PARAM;
1124 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1125 // ExDescription.lineNumber = 750;
1126 // throw SALOME::SALOME_Exception(ExDescription);
1131 * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
1133 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
1134 throw (SALOME::SALOME_Exception)
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);
1148 bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
1149 throw (SALOME::SALOME_Exception)
1151 MESSAGE("HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh");
1154 if (CORBA::is_nil( theSource ))
1156 SALOME::ExceptionStruct ExDescription;
1157 ExDescription.text = "The source mesh CORBA object is NULL";
1158 ExDescription.type = SALOME::BAD_PARAM;
1159 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1160 ExDescription.lineNumber = 840;
1161 throw SALOME::SALOME_Exception(ExDescription);
1166 MESSAGE("Required type is NODE");
1169 MESSAGE("Required type is EDGE");
1172 MESSAGE("Required type is FACE");
1175 MESSAGE("Incompatible required type: " << theType);
1178 // MESSAGE("Required type is "<<theType);
1179 SMESH::array_of_ElementType_var types = theSource->GetTypes();
1180 MESSAGE("Available types:");
1181 for (int i=0;i<types->length();i++){MESSAGE(types[i]);}
1182 if ( types->length() >= 1 && types[types->length()-1] < theType)
1184 MESSAGE("Required type not available");
1186 // SALOME::ExceptionStruct ExDescription;
1187 // ExDescription.text = "The source mesh has bad type";
1188 // ExDescription.type = SALOME::BAD_PARAM;
1189 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1190 // ExDescription.lineNumber = 840;
1191 // throw SALOME::SALOME_Exception(ExDescription);
1195 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1196 SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
1198 SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
1199 SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
1200 SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
1202 string enfMeshName = theName;
1203 if (enfMeshName.empty())
1204 enfMeshName = SObj->GetName();
1209 bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
1210 if (theGroupName != "") {
1211 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1212 << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
1215 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1216 << theSource << ".GetMesh(), " << theType << " )";
1221 catch (const std::invalid_argument& ex) {
1222 SALOME::ExceptionStruct ExDescription;
1223 ExDescription.text = ex.what();
1224 ExDescription.type = SALOME::BAD_PARAM;
1225 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1226 ExDescription.lineNumber = 840;
1227 throw SALOME::SALOME_Exception(ExDescription);
1229 catch (SALOME_Exception& ex) {
1230 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1233 else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
1235 MESSAGE("The source is a group")
1237 bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1238 if (theGroupName != "") {
1239 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1240 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1243 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1244 << theSource << ", " << theType << " )";
1248 catch (const std::invalid_argument& ex) {
1249 SALOME::ExceptionStruct ExDescription;
1250 ExDescription.text = ex.what();
1251 ExDescription.type = SALOME::BAD_PARAM;
1252 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1253 ExDescription.lineNumber = 840;
1254 throw SALOME::SALOME_Exception(ExDescription);
1256 catch (SALOME_Exception& ex) {
1257 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1260 else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
1262 MESSAGE("The source is a group on geom")
1264 bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1265 if (theGroupName != "") {
1266 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1267 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1270 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1271 << theSource << ", " << theType << " )";
1275 catch (const std::invalid_argument& ex) {
1276 SALOME::ExceptionStruct ExDescription;
1277 ExDescription.text = ex.what();
1278 ExDescription.type = SALOME::BAD_PARAM;
1279 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1280 ExDescription.lineNumber = 840;
1281 throw SALOME::SALOME_Exception(ExDescription);
1283 catch (SALOME_Exception& ex) {
1284 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1289 //=============================================================================
1291 * Get implementation
1293 //=============================================================================
1295 ::HYBRIDPlugin_Hypothesis* HYBRIDPlugin_Hypothesis_i::GetImpl()
1297 return (::HYBRIDPlugin_Hypothesis*)myBaseImpl;
1300 //================================================================================
1302 * \brief Verify whether hypothesis supports given entity type
1304 //================================================================================
1306 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
1308 return type == SMESH::DIM_3D;