1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 // File : HYBRIDPlugin_Hypothesis_i.cxx
22 // Author : Christian VAN WAMBEKE (CEA)
25 #include "HYBRIDPlugin_Hypothesis_i.hxx"
27 #include "SMESH_Gen.hxx"
28 #include "SMESH_PythonDump.hxx"
29 //#include "SMESH_Mesh.hxx"
30 //#include "SMESH_ProxyMesh.hxx"
31 //#include <StdMeshers_QuadToTriaAdaptor.hxx>
33 #include "Utils_CorbaException.hxx"
34 #include "utilities.h"
35 #include "SMESH_Mesh_i.hxx"
36 #include "SMESH_Group_i.hxx"
37 #include "SMESH_Gen_i.hxx"
38 #include "SMESH_TypeDefs.hxx"
39 #include "SMESHDS_GroupBase.hxx"
41 // SALOME KERNEL includes
42 #include "SALOMEDSClient.hxx"
43 #include <SALOMEDSClient_definitions.hxx>
45 // #include <SALOMEconfig.h>
46 // #include CORBA_SERVER_HEADER(SALOMEDS)
48 //=======================================================================
49 //function : HYBRIDPlugin_Hypothesis_i
50 //=======================================================================
51 HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
53 ::SMESH_Gen* theGenImpl)
54 : SALOME::GenericObj_i( thePOA ),
55 SMESH_Hypothesis_i( thePOA )
57 MESSAGE( "HYBRIDPlugin_Hypothesis_i::HYBRIDPlugin_Hypothesis_i" );
58 myBaseImpl = new ::HYBRIDPlugin_Hypothesis (theGenImpl->GetANewId(),
63 //=======================================================================
64 //function : ~HYBRIDPlugin_Hypothesis_i
65 //=======================================================================
66 HYBRIDPlugin_Hypothesis_i::~HYBRIDPlugin_Hypothesis_i()
68 MESSAGE( "HYBRIDPlugin_Hypothesis_i::~HYBRIDPlugin_Hypothesis_i" );
71 //=======================================================================
72 //function : SetLayersOnAllWrap
73 //=======================================================================
75 void HYBRIDPlugin_Hypothesis_i::SetLayersOnAllWrap(CORBA::Boolean toMesh)
78 this->GetImpl()->SetLayersOnAllWrap(toMesh);
79 SMESH::TPythonDump() << _this() << ".SetLayersOnAllWrap( " << toMesh << " )";
82 //=======================================================================
83 //function : GetLayersOnAllWrap
84 //=======================================================================
86 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetLayersOnAllWrap()
89 return this->GetImpl()->GetLayersOnAllWrap();
92 //=======================================================================
93 //function : SetToMeshHoles
94 //=======================================================================
96 void HYBRIDPlugin_Hypothesis_i::SetToMeshHoles(CORBA::Boolean toMesh)
99 this->GetImpl()->SetToMeshHoles(toMesh);
100 SMESH::TPythonDump() << _this() << ".SetToMeshHoles( " << toMesh << " )";
103 //=======================================================================
104 //function : GetToMeshHoles
105 //=======================================================================
107 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToMeshHoles()
110 return this->GetImpl()->GetToMeshHoles();
113 //=======================================================================
114 //function : SetToMakeGroupsOfDomains
115 //=======================================================================
117 void HYBRIDPlugin_Hypothesis_i::SetToMakeGroupsOfDomains(CORBA::Boolean toMakeGroups)
120 this->GetImpl()->SetToMakeGroupsOfDomains(toMakeGroups);
121 SMESH::TPythonDump() << _this() << ".SetToMakeGroupsOfDomains( " << toMakeGroups << " )";
124 //=======================================================================
125 //function : GetToMakeGroupsOfDomains
126 //=======================================================================
128 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToMakeGroupsOfDomains()
131 return this->GetImpl()->GetToMakeGroupsOfDomains();
134 //=======================================================================
135 //function : SetMaximumMemory
136 //=======================================================================
138 void HYBRIDPlugin_Hypothesis_i::SetMaximumMemory(CORBA::Double MB)
139 throw ( SALOME::SALOME_Exception )
142 THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
144 this->GetImpl()->SetMaximumMemory(MB);
145 SMESH::TPythonDump() << _this() << ".SetMaximumMemory( " << MB << " )";
148 //=======================================================================
149 //function : GetMaximumMemory
150 //=======================================================================
152 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetMaximumMemory()
155 return this->GetImpl()->GetMaximumMemory();
158 //=======================================================================
159 //function : SetInitialMemory
160 //=======================================================================
162 void HYBRIDPlugin_Hypothesis_i::SetInitialMemory(CORBA::Double MB)
163 throw ( SALOME::SALOME_Exception )
166 THROW_SALOME_CORBA_EXCEPTION( "Invalid memory size",SALOME::BAD_PARAM );
168 this->GetImpl()->SetInitialMemory(MB);
169 SMESH::TPythonDump() << _this() << ".SetInitialMemory( " << MB << " )";
172 //=======================================================================
173 //function : GetInitialMemory
174 //=======================================================================
176 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetInitialMemory()
179 return this->GetImpl()->GetInitialMemory();
182 //=======================================================================
183 //function : SetOptimizationLevel
184 //=======================================================================
186 void HYBRIDPlugin_Hypothesis_i::SetOptimizationLevel(CORBA::Short level)
187 throw ( SALOME::SALOME_Exception )
189 ::HYBRIDPlugin_Hypothesis::OptimizationLevel l =
190 (::HYBRIDPlugin_Hypothesis::OptimizationLevel) level;
191 if ( l < ::HYBRIDPlugin_Hypothesis::None ||
192 l > ::HYBRIDPlugin_Hypothesis::Strong )
193 THROW_SALOME_CORBA_EXCEPTION( "Invalid optimization level",SALOME::BAD_PARAM );
196 this->GetImpl()->SetOptimizationLevel(l);
197 SMESH::TPythonDump() << _this() << ".SetOptimizationLevel( " << level << " )";
200 //=======================================================================
201 //function : GetOptimizationLevel
202 //=======================================================================
204 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetOptimizationLevel()
207 return this->GetImpl()->GetOptimizationLevel();
211 //=======================================================================
212 //function : SetCollisionMode
213 //=======================================================================
214 void HYBRIDPlugin_Hypothesis_i::SetCollisionMode(CORBA::Short level)
215 throw ( SALOME::SALOME_Exception )
217 ::HYBRIDPlugin_Hypothesis::CollisionMode l =
218 (::HYBRIDPlugin_Hypothesis::CollisionMode) level;
219 if ( l < ::HYBRIDPlugin_Hypothesis::Decrease ||
220 l > ::HYBRIDPlugin_Hypothesis::Stop )
221 THROW_SALOME_CORBA_EXCEPTION( "Invalid collision mode",SALOME::BAD_PARAM );
224 this->GetImpl()->SetCollisionMode(l);
225 SMESH::TPythonDump() << _this() << ".SetCollisionMode( " << level << " )";
228 //=======================================================================
229 //function : GetCollisionMode
230 //=======================================================================
231 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetCollisionMode()
234 return this->GetImpl()->GetCollisionMode();
237 //=======================================================================
238 //function : SetWorkingDirectory
239 //=======================================================================
240 void HYBRIDPlugin_Hypothesis_i::SetWorkingDirectory(const char* path) throw ( SALOME::SALOME_Exception )
243 THROW_SALOME_CORBA_EXCEPTION( "Null working directory",SALOME::BAD_PARAM );
245 std::string file(path);
246 const char lastChar = *file.rbegin();
248 if ( lastChar != '\\' ) file += '\\';
250 if ( lastChar != '/' ) file += '/';
252 file += "HYBRID.log";
253 SMESH_Mesh_i::PrepareForWriting (file.c_str());
256 this->GetImpl()->SetWorkingDirectory(path);
257 SMESH::TPythonDump() << _this() << ".SetWorkingDirectory( '" << path << "' )";
260 //=======================================================================
261 //function : GetWorkingDirectory
262 //=======================================================================
263 char* HYBRIDPlugin_Hypothesis_i::GetWorkingDirectory()
266 return CORBA::string_dup( this->GetImpl()->GetWorkingDirectory().c_str() );
269 //=======================================================================
270 //function : SetKeepFiles
271 //=======================================================================
272 void HYBRIDPlugin_Hypothesis_i::SetKeepFiles(CORBA::Boolean toKeep)
275 this->GetImpl()->SetKeepFiles(toKeep);
276 SMESH::TPythonDump() << _this() << ".SetKeepFiles( " << toKeep << " )";
279 //=======================================================================
280 //function : GetKeepFiles
281 //=======================================================================
282 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetKeepFiles()
285 return this->GetImpl()->GetKeepFiles();
288 //=======================================================================
289 //function : SetVerboseLevel
290 //=======================================================================
291 void HYBRIDPlugin_Hypothesis_i::SetVerboseLevel(CORBA::Short level)
292 throw ( SALOME::SALOME_Exception )
294 if (level < 0 || level > 10 )
295 THROW_SALOME_CORBA_EXCEPTION( "Invalid verbose level, valid range is [0-10]",
298 this->GetImpl()->SetVerboseLevel(level);
299 SMESH::TPythonDump() << _this() << ".SetVerboseLevel( " << level << " )";
302 //=======================================================================
303 //function : GetVerboseLevel
304 //=======================================================================
305 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetVerboseLevel()
308 return this->GetImpl()->GetVerboseLevel();
311 //=======================================================================
312 //function : SetToCreateNewNodes
313 //=======================================================================
315 void HYBRIDPlugin_Hypothesis_i::SetToCreateNewNodes(CORBA::Boolean toCreate)
318 this->GetImpl()->SetToCreateNewNodes(toCreate);
319 SMESH::TPythonDump() << _this() << ".SetToCreateNewNodes( " << toCreate << " )";
322 //=======================================================================
323 //function : GetToCreateNewNodes
324 //=======================================================================
326 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToCreateNewNodes()
329 return this->GetImpl()->GetToCreateNewNodes();
332 //=======================================================================
333 //function : SetToUseBoundaryRecoveryVersion
334 //=======================================================================
336 void HYBRIDPlugin_Hypothesis_i::SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse)
339 this->GetImpl()->SetToUseBoundaryRecoveryVersion(toUse);
340 SMESH::TPythonDump() << _this() << ".SetToUseBoundaryRecoveryVersion( " << toUse << " )";
343 //=======================================================================
344 //function : GetToUseBoundaryRecoveryVersion
345 //=======================================================================
347 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToUseBoundaryRecoveryVersion()
350 return this->GetImpl()->GetToUseBoundaryRecoveryVersion();
353 //=======================================================================
354 //function : SetFEMCorrection
355 //=======================================================================
357 void HYBRIDPlugin_Hypothesis_i::SetFEMCorrection(CORBA::Boolean toUseFem)
360 this->GetImpl()->SetFEMCorrection(toUseFem);
361 SMESH::TPythonDump() << _this() << ".SetFEMCorrection( " << toUseFem << " )";
364 //=======================================================================
365 //function : GetFEMCorrection
366 //=======================================================================
368 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetFEMCorrection()
371 return this->GetImpl()->GetFEMCorrection();
374 //=======================================================================
375 //function : SetToRemoveCentralPoint
376 //=======================================================================
378 void HYBRIDPlugin_Hypothesis_i::SetToRemoveCentralPoint(CORBA::Boolean toRemove)
381 this->GetImpl()->SetToRemoveCentralPoint(toRemove);
382 SMESH::TPythonDump() << _this() << ".SetToRemoveCentralPoint( " << toRemove << " )";
385 //=======================================================================
386 //function : GetToRemoveCentralPoint
387 //=======================================================================
389 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetToRemoveCentralPoint()
392 return this->GetImpl()->GetToRemoveCentralPoint();
395 //=======================================================================
396 //function : SetTextOption
397 //=======================================================================
398 void HYBRIDPlugin_Hypothesis_i::SetTextOption(const char* option)
401 this->GetImpl()->SetAdvancedOption(option);
402 SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << option << "' )";
405 //=======================================================================
406 //function : GetTextOption
407 //=======================================================================
408 char* HYBRIDPlugin_Hypothesis_i::GetTextOption()
411 return CORBA::string_dup( this->GetImpl()->GetAdvancedOption().c_str() );
414 //=======================================================================
415 //function : SetAdvancedOption
416 //=======================================================================
417 void HYBRIDPlugin_Hypothesis_i::SetAdvancedOption(const char* theOptAndVals )
419 if ( theOptAndVals && GetImpl()->GetAdvancedOption() != theOptAndVals )
421 GetImpl()->SetAdvancedOption( theOptAndVals );
422 SMESH::TPythonDump() << _this() << ".SetAdvancedOption( '" << theOptAndVals << "' )";
426 //=======================================================================
427 //function : GetAdvancedOption
428 //=======================================================================
429 char* HYBRIDPlugin_Hypothesis_i::GetAdvancedOption()
431 return CORBA::string_dup( GetImpl()->GetAdvancedOption().c_str() );
434 //=======================================================================
435 //function : SetToRemoveCentralPoint
436 //=======================================================================
438 void HYBRIDPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
441 THROW_SALOME_CORBA_EXCEPTION( "The volumic gradation must be > 1",SALOME::BAD_PARAM );
443 if (gradation != GetGradation()) {
444 this->GetImpl()->SetGradation(gradation);
445 SMESH::TPythonDump() << _this() << ".SetGradation( " << gradation << " )";
449 //=======================================================================
450 //function : GetToRemoveCentralPoint
451 //=======================================================================
453 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetGradation()
456 return this->GetImpl()->GetGradation();
459 //=======================================================================
460 //function : SetStandardOutputLog
461 //=======================================================================
462 void HYBRIDPlugin_Hypothesis_i::SetStandardOutputLog(CORBA::Boolean logInStandardOutput)
465 this->GetImpl()->SetStandardOutputLog(logInStandardOutput);
466 SMESH::TPythonDump() << _this() << ".SetPrintLogInFile( " << !logInStandardOutput << " )";
469 //=======================================================================
470 //function : GetStandardOutputLog
471 //=======================================================================
472 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetStandardOutputLog()
475 return this->GetImpl()->GetStandardOutputLog();
478 //=======================================================================
479 //function : SetRemoveLogOnSuccess
480 //=======================================================================
481 void HYBRIDPlugin_Hypothesis_i::SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess)
484 this->GetImpl()->SetRemoveLogOnSuccess(removeLogOnSuccess);
485 SMESH::TPythonDump() << _this() << ".SetRemoveLogOnSuccess( " << removeLogOnSuccess << " )";
488 //=======================================================================
489 //function : GetRemoveLogOnSuccess
490 //=======================================================================
491 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
494 return this->GetImpl()->GetRemoveLogOnSuccess();
497 //=======================================================================
498 //function : SetBoundaryLayersGrowth
499 //=======================================================================
500 void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersGrowth(CORBA::Short level)
501 throw ( SALOME::SALOME_Exception )
503 ::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth l =
504 (::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth) level;
505 if ( l < ::HYBRIDPlugin_Hypothesis::Layer_Growth_Inward ||
506 l > ::HYBRIDPlugin_Hypothesis::Layer_Growth_Outward )
507 THROW_SALOME_CORBA_EXCEPTION( "Invalid BoundaryLayersGrowth mode",SALOME::BAD_PARAM );
510 this->GetImpl()->SetBoundaryLayersGrowth(l);
511 SMESH::TPythonDump() << _this() << ".SetBoundaryLayersGrowth( " << level << " )";
514 //=======================================================================
515 //function : GetBoundaryLayersGrowth
516 //=======================================================================
517 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersGrowth()
520 return this->GetImpl()->GetBoundaryLayersGrowth();
523 //=======================================================================
524 //function : SetElementGeneration
525 //=======================================================================
526 void HYBRIDPlugin_Hypothesis_i::SetElementGeneration(CORBA::Short level)
527 throw ( SALOME::SALOME_Exception )
529 ::HYBRIDPlugin_Hypothesis::ElementGeneration l =
530 (::HYBRIDPlugin_Hypothesis::ElementGeneration) level;
531 if ( l < ::HYBRIDPlugin_Hypothesis::Generation_Tetra_Dominant ||
532 l > ::HYBRIDPlugin_Hypothesis::Generation_Hexa_Dominant )
533 THROW_SALOME_CORBA_EXCEPTION( "Invalid ElementGeneration mode",SALOME::BAD_PARAM );
536 this->GetImpl()->SetElementGeneration(l);
537 SMESH::TPythonDump() << _this() << ".SetElementGeneration( " << level << " )";
540 //=======================================================================
541 //function : GetElementGeneration
542 //=======================================================================
543 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetElementGeneration()
546 return this->GetImpl()->GetElementGeneration();
549 //=======================================================================
550 //function : SetAddMultinormals
551 //=======================================================================
552 void HYBRIDPlugin_Hypothesis_i::SetAddMultinormals(CORBA::Boolean toAddMultinormals)
555 this->GetImpl()->SetAddMultinormals(toAddMultinormals);
556 SMESH::TPythonDump() << _this() << ".SetAddMultinormals( " << toAddMultinormals << " )";
559 //=======================================================================
560 //function : GetAddMultinormals
561 //=======================================================================
562 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetAddMultinormals()
565 return this->GetImpl()->GetAddMultinormals();
568 //=======================================================================
569 //function : SetSmoothNormals
570 //=======================================================================
571 void HYBRIDPlugin_Hypothesis_i::SetSmoothNormals(CORBA::Boolean toSmoothNormals)
574 this->GetImpl()->SetSmoothNormals(toSmoothNormals);
575 SMESH::TPythonDump() << _this() << ".SetSmoothNormals( " << toSmoothNormals << " )";
578 //=======================================================================
579 //function : GetSmoothNormals
580 //=======================================================================
581 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetSmoothNormals()
584 return this->GetImpl()->GetSmoothNormals();
587 //=======================================================================
588 //function : SetHeightFirstLayer
589 //=======================================================================
590 void HYBRIDPlugin_Hypothesis_i::SetHeightFirstLayer(CORBA::Double toHeightFirstLayer)
593 this->GetImpl()->SetHeightFirstLayer(toHeightFirstLayer);
594 SMESH::TPythonDump() << _this() << ".SetHeightFirstLayer( " << toHeightFirstLayer << " )";
597 //=======================================================================
598 //function : GetHeightFirstLayer
599 //=======================================================================
600 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetHeightFirstLayer()
603 return this->GetImpl()->GetHeightFirstLayer();
606 //=======================================================================
607 //function : SetBoundaryLayersProgression
608 //=======================================================================
609 void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersProgression(CORBA::Double toBoundaryLayersProgression)
612 this->GetImpl()->SetBoundaryLayersProgression(toBoundaryLayersProgression);
613 SMESH::TPythonDump() << _this() << ".SetBoundaryLayersProgression( " << toBoundaryLayersProgression << " )";
616 //=======================================================================
617 //function : GetBoundaryLayersProgression
618 //=======================================================================
619 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersProgression()
622 return this->GetImpl()->GetBoundaryLayersProgression();
625 //=======================================================================
626 //function : SetMultinormalsAngle
627 //=======================================================================
628 void HYBRIDPlugin_Hypothesis_i::SetMultinormalsAngle(CORBA::Double toMultinormalsAngle)
631 this->GetImpl()->SetMultinormalsAngle(toMultinormalsAngle);
632 SMESH::TPythonDump() << _this() << ".SetMultinormalsAngle( " << toMultinormalsAngle << " )";
635 //=======================================================================
636 //function : GetMultinormalsAngle
637 //=======================================================================
638 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetMultinormalsAngle()
641 return this->GetImpl()->GetMultinormalsAngle();
644 //=======================================================================
645 //function : SetNbOfBoundaryLayers
646 //=======================================================================
647 void HYBRIDPlugin_Hypothesis_i::SetNbOfBoundaryLayers(CORBA::Short toNbOfBoundaryLayers)
650 this->GetImpl()->SetNbOfBoundaryLayers(toNbOfBoundaryLayers);
651 SMESH::TPythonDump() << _this() << ".SetNbOfBoundaryLayers( " << toNbOfBoundaryLayers << " )";
654 //=======================================================================
655 //function : GetNbOfBoundaryLayers
656 //=======================================================================
657 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetNbOfBoundaryLayers()
660 return this->GetImpl()->GetNbOfBoundaryLayers();
663 //=======================================================================
664 //function : SetEnforcedVertex
665 //=======================================================================
667 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
668 throw (SALOME::SALOME_Exception) {
670 MESSAGE("IDL : SetEnforcedVertex( "<< x << ", " << y << ", " << z << ", " << size << ")");
671 return p_SetEnforcedVertex(size, x, y, z);
674 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
675 throw (SALOME::SALOME_Exception) {
677 MESSAGE("IDL : SetEnforcedVertexNamed( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ")");
678 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
681 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
682 throw (SALOME::SALOME_Exception) {
684 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theGroupName << ")");
685 return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
688 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
689 throw (SALOME::SALOME_Exception) {
691 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ", " << theGroupName << ")");
692 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
695 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size)
696 throw (SALOME::SALOME_Exception) {
699 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
700 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
701 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
704 std::string theVertexEntry = theVertex->GetStudyEntry();
705 CORBA::Double x = 0, y = 0, z = 0;
706 CORBA::Boolean isCompound = false;
707 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
708 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
709 if (theVertexEntry.empty()) {
711 if (theVertex->GetShapeType() == GEOM::VERTEX) {
714 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
718 aName += theVertex->GetEntry();
719 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
720 if (!theSVertex->_is_nil())
721 theVertexEntry = theSVertex->GetID();
723 if (theVertexEntry.empty())
724 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
726 if (theVertex->GetShapeType() == GEOM::VERTEX) {
727 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
728 if (CORBA::is_nil(measureOp))
731 measureOp->PointCoordinates (theVertex, x, y, z);
732 MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
735 std::string theVertexName = theVertex->GetName();
736 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theVertexEntry << ", " << size<< ")");
738 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
741 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName)
742 throw (SALOME::SALOME_Exception) {
745 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
746 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
747 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
750 std::string theVertexEntry = theVertex->GetStudyEntry();
751 CORBA::Double x = 0, y = 0, z = 0;
752 CORBA::Boolean isCompound = false;
753 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
754 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
755 if (theVertexEntry.empty()) {
757 if (theVertex->GetShapeType() == GEOM::VERTEX) {
760 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
764 aName += theVertex->GetEntry();
765 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
766 if (!theSVertex->_is_nil())
767 theVertexEntry = theSVertex->GetID();
769 if (theVertexEntry.empty())
770 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
772 if (theVertex->GetShapeType() == GEOM::VERTEX) {
773 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
774 if (CORBA::is_nil(measureOp))
777 measureOp->PointCoordinates (theVertex, x, y, z);
778 MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
781 std::string theVertexName = theVertex->GetName();
782 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theVertexEntry << ", " << size<< ", " << theGroupName << ")");
784 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
787 bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x, CORBA::Double y, CORBA::Double z,
788 const char* theVertexName, const char* theVertexEntry, const char* theGroupName,
789 CORBA::Boolean isCompound)
790 throw (SALOME::SALOME_Exception) {
792 MESSAGE("IDL : p_SetEnforcedVertex(" << size << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\", " << isCompound<< ")");
793 bool newValue = false;
795 ::HYBRIDPlugin_Hypothesis::TCoordsHYBRIDEnforcedVertexMap coordsList;
796 ::HYBRIDPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap enfVertexEntryList;
797 if (std::string(theVertexEntry).empty()) {
798 coordsList = this->GetImpl()->_GetEnforcedVerticesByCoords();
799 std::vector<double> coords;
803 if (coordsList.find(coords) == coordsList.end()) {
804 MESSAGE("Coords not found: add it in coordsList");
808 MESSAGE("Coords already found, compare names");
809 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
810 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
811 MESSAGE("The names or size are different: update");
812 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
816 MESSAGE("The names and size are identical");
821 if (std::string(theVertexName).empty()) {
822 if (std::string(theGroupName).empty())
823 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ")";
825 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theGroupName << "\")";
828 if (std::string(theGroupName).empty())
829 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\")";
831 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\", \"" << theGroupName << "\")";
836 // if (isCompound || (!isCompound && !std::string(theVertexEntry).empty())) {
837 enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
838 // ::BLSURFPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap::const_iterator it = enfVertexEntryList.find(theVertexEntry);
839 if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
840 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
844 MESSAGE("Geom entry already found, compare names");
845 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
846 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
847 MESSAGE("The names or size are different: update");
848 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
852 MESSAGE("The names and size are identical");
857 if (std::string(theGroupName).empty())
858 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeom(" << theVertexEntry << ", " << size << ")";
860 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeomWithGroup(" << theVertexEntry << ", " << size << ", \"" << theGroupName << "\")";
865 this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
867 MESSAGE("IDL : SetEnforcedVertexEntry END");
871 //=======================================================================
872 //function : GetEnforcedVertex
873 //=======================================================================
875 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
876 throw (SALOME::SALOME_Exception)
880 bool isDone = this->GetImpl()->GetEnforcedVertex(x,y,z)->size;
881 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertex(" << x << ", " << y << ", " << z << ")";
884 catch (const std::invalid_argument& ex) {
885 SALOME::ExceptionStruct ExDescription;
886 ExDescription.text = ex.what();
887 ExDescription.type = SALOME::BAD_PARAM;
888 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
889 ExDescription.lineNumber = 513;
890 throw SALOME::SALOME_Exception(ExDescription);
892 catch (SALOME_Exception& ex) {
893 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
897 //=======================================================================
898 //function : GetEnforcedVertex
899 //=======================================================================
901 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
902 throw (SALOME::SALOME_Exception)
906 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
907 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
908 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
911 std::string theVertexEntry = theVertex->GetStudyEntry();
912 if (theVertexEntry.empty()) {
913 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
914 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
916 if (theVertex->GetShapeType() == GEOM::VERTEX)
918 if (theVertex->GetShapeType() == GEOM::COMPOUND)
920 aName += theVertex->GetEntry();
921 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
922 if (!theSVertex->_is_nil())
923 theVertexEntry = theSVertex->GetID();
925 if (theVertexEntry.empty())
926 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
928 std::string theVertexName = theVertex->GetName();
931 bool isDone = this->GetImpl()->GetEnforcedVertex(theVertexName)->size;
932 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertexGeom(" << theVertex << ")";
935 catch (const std::invalid_argument& ex) {
936 SALOME::ExceptionStruct ExDescription;
937 ExDescription.text = ex.what();
938 ExDescription.type = SALOME::BAD_PARAM;
939 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
940 ExDescription.lineNumber = 538;
941 throw SALOME::SALOME_Exception(ExDescription);
943 catch (SALOME_Exception& ex) {
944 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
948 //=======================================================================
949 //function : GetEnforcedVertices
950 //=======================================================================
952 HYBRIDPlugin::HYBRIDEnforcedVertexList* HYBRIDPlugin_Hypothesis_i::GetEnforcedVertices()
955 HYBRIDPlugin::HYBRIDEnforcedVertexList_var result = new HYBRIDPlugin::HYBRIDEnforcedVertexList();
957 const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList enfVertexList = this->GetImpl()->_GetEnforcedVertices();
958 result->length( enfVertexList.size() );
960 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList::const_iterator it = enfVertexList.begin();
962 for (int i = 0 ; it != enfVertexList.end(); ++it, ++i ) {
963 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* currentVertex = (*it);
964 HYBRIDPlugin::HYBRIDEnforcedVertex_var enfVertex = new HYBRIDPlugin::HYBRIDEnforcedVertex();
966 enfVertex->name = CORBA::string_dup(currentVertex->name.c_str());
968 enfVertex->geomEntry = CORBA::string_dup(currentVertex->geomEntry.c_str());
970 HYBRIDPlugin::TCoords_var coords = new HYBRIDPlugin::TCoords();
971 coords->length(currentVertex->coords.size());
972 for (size_t ind = 0; ind < currentVertex->coords.size(); ind++)
973 coords[ind] = currentVertex->coords[ind];
974 enfVertex->coords = coords;
976 enfVertex->groupName = CORBA::string_dup(currentVertex->groupName.c_str());
978 enfVertex->size = currentVertex->size;
980 enfVertex->isCompound = currentVertex->isCompound;
985 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
987 return result._retn();
990 //=======================================================================
991 //function : RemoveEnforcedVertex
992 //=======================================================================
994 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
995 throw (SALOME::SALOME_Exception)
999 bool res = this->GetImpl()->RemoveEnforcedVertex(x,y,z);
1000 SMESH::TPythonDump() << " isDone = " << _this() << ".RemoveEnforcedVertex( " << x << ", " << y << ", " << z << " )";
1003 catch (const std::invalid_argument& ex) {
1004 SALOME::ExceptionStruct ExDescription;
1005 ExDescription.text = ex.what();
1006 ExDescription.type = SALOME::BAD_PARAM;
1007 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1008 ExDescription.lineNumber = 625;
1009 throw SALOME::SALOME_Exception(ExDescription);
1011 catch (SALOME_Exception& ex) {
1012 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1016 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
1017 throw (SALOME::SALOME_Exception)
1021 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1022 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1023 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1026 std::string theVertexEntry = theVertex->GetStudyEntry();
1027 if (theVertexEntry.empty()) {
1028 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1029 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1031 if (theVertex->GetShapeType() == GEOM::VERTEX)
1033 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1034 aName = "Compound_";
1035 aName += theVertex->GetEntry();
1036 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1037 if (!theSVertex->_is_nil())
1038 theVertexEntry = theSVertex->GetID();
1040 if (theVertexEntry.empty())
1041 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1044 bool res = this->GetImpl()->RemoveEnforcedVertex(0,0,0, theVertexEntry.c_str());
1045 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom( " << theVertexEntry.c_str() << " )";
1048 catch (const std::invalid_argument& ex) {
1049 SALOME::ExceptionStruct ExDescription;
1050 ExDescription.text = ex.what();
1051 ExDescription.type = SALOME::BAD_PARAM;
1052 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1053 ExDescription.lineNumber = 648;
1054 throw SALOME::SALOME_Exception(ExDescription);
1056 catch (SALOME_Exception& ex) {
1057 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1061 //=======================================================================
1062 //function : ClearEnforcedVertices
1063 //=======================================================================
1065 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedVertices()
1068 this->GetImpl()->ClearEnforcedVertices();
1069 SMESH::TPythonDump () << _this() << ".ClearEnforcedVertices() ";
1072 //=======================================================================
1073 //function : ClearEnforcedMeshes
1074 //=======================================================================
1076 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedMeshes()
1079 this->GetImpl()->ClearEnforcedMeshes();
1080 SMESH::TPythonDump () << _this() << ".ClearEnforcedMeshes() ";
1083 //=======================================================================
1084 //function : GetEnforcedMeshes
1085 //=======================================================================
1087 HYBRIDPlugin::HYBRIDEnforcedMeshList* HYBRIDPlugin_Hypothesis_i::GetEnforcedMeshes()
1090 HYBRIDPlugin::HYBRIDEnforcedMeshList_var result = new HYBRIDPlugin::HYBRIDEnforcedMeshList();
1092 const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList enfMeshList = this->GetImpl()->_GetEnforcedMeshes();
1093 result->length( enfMeshList.size() );
1095 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList::const_iterator it = enfMeshList.begin();
1097 for (int i = 0 ; it != enfMeshList.end(); ++it, ++i ) {
1098 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMesh* currentMesh = (*it);
1099 HYBRIDPlugin::HYBRIDEnforcedMesh_var enfMesh = new HYBRIDPlugin::HYBRIDEnforcedMesh();
1101 enfMesh->name = CORBA::string_dup(currentMesh->name.c_str());
1103 enfMesh->entry = CORBA::string_dup(currentMesh->entry.c_str());
1105 enfMesh->elementType = currentMesh->elementType;
1107 enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
1112 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
1114 return result._retn();
1118 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource. The elements will be grouped in theGroupName.
1120 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
1121 throw (SALOME::SALOME_Exception)
1123 // #if HYBRID_VERSION >= 42
1124 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1126 // SALOME::ExceptionStruct ExDescription;
1127 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1128 // ExDescription.type = SALOME::BAD_PARAM;
1129 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1130 // ExDescription.lineNumber = 719;
1131 // throw SALOME::SALOME_Exception(ExDescription);
1136 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource.
1138 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
1139 throw (SALOME::SALOME_Exception)
1141 // MESSAGE("HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh");
1142 // #if HYBRID_VERSION >= 42
1143 return p_SetEnforcedMesh(theSource, theType);
1145 // SALOME::ExceptionStruct ExDescription;
1146 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1147 // ExDescription.type = SALOME::BAD_PARAM;
1148 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1149 // ExDescription.lineNumber = 750;
1150 // throw SALOME::SALOME_Exception(ExDescription);
1155 * \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.
1157 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
1158 throw (SALOME::SALOME_Exception)
1160 // #if HYBRID_VERSION >= 42
1161 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1163 // SALOME::ExceptionStruct ExDescription;
1164 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1165 // ExDescription.type = SALOME::BAD_PARAM;
1166 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1167 // ExDescription.lineNumber = 750;
1168 // throw SALOME::SALOME_Exception(ExDescription);
1173 * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
1175 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
1176 throw (SALOME::SALOME_Exception)
1178 // #if HYBRID_VERSION >= 42
1179 return p_SetEnforcedMesh(theSource, theType);
1181 // SALOME::ExceptionStruct ExDescription;
1182 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1183 // ExDescription.type = SALOME::BAD_PARAM;
1184 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1185 // ExDescription.lineNumber = 750;
1186 // throw SALOME::SALOME_Exception(ExDescription);
1190 bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
1191 throw (SALOME::SALOME_Exception)
1193 MESSAGE("HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh");
1196 if (CORBA::is_nil( theSource ))
1198 SALOME::ExceptionStruct ExDescription;
1199 ExDescription.text = "The source mesh CORBA object is NULL";
1200 ExDescription.type = SALOME::BAD_PARAM;
1201 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1202 ExDescription.lineNumber = 840;
1203 throw SALOME::SALOME_Exception(ExDescription);
1208 MESSAGE("Required type is NODE");
1211 MESSAGE("Required type is EDGE");
1214 MESSAGE("Required type is FACE");
1217 MESSAGE("Incompatible required type: " << theType);
1220 // MESSAGE("Required type is "<<theType);
1221 SMESH::array_of_ElementType_var types = theSource->GetTypes();
1222 MESSAGE("Available types:");
1223 for (CORBA::ULong i=0;i<types->length();i++){MESSAGE(types[i]);}
1224 if ( types->length() >= 1 && types[types->length()-1] < theType)
1226 MESSAGE("Required type not available");
1228 // SALOME::ExceptionStruct ExDescription;
1229 // ExDescription.text = "The source mesh has bad type";
1230 // ExDescription.type = SALOME::BAD_PARAM;
1231 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1232 // ExDescription.lineNumber = 840;
1233 // throw SALOME::SALOME_Exception(ExDescription);
1237 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1238 SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
1240 SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
1241 SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
1242 SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
1244 std::string enfMeshName = theName;
1245 if (enfMeshName.empty())
1246 enfMeshName = SObj->GetName();
1251 bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
1252 if (theGroupName && theGroupName[0]) {
1253 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1254 << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
1257 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1258 << theSource << ".GetMesh(), " << theType << " )";
1263 catch (const std::invalid_argument& ex) {
1264 SALOME::ExceptionStruct ExDescription;
1265 ExDescription.text = ex.what();
1266 ExDescription.type = SALOME::BAD_PARAM;
1267 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1268 ExDescription.lineNumber = 840;
1269 throw SALOME::SALOME_Exception(ExDescription);
1271 catch (SALOME_Exception& ex) {
1272 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1275 else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
1277 MESSAGE("The source is a group")
1279 bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1280 if (theGroupName && theGroupName[0]) {
1281 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1282 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1285 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1286 << theSource << ", " << theType << " )";
1290 catch (const std::invalid_argument& ex) {
1291 SALOME::ExceptionStruct ExDescription;
1292 ExDescription.text = ex.what();
1293 ExDescription.type = SALOME::BAD_PARAM;
1294 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1295 ExDescription.lineNumber = 840;
1296 throw SALOME::SALOME_Exception(ExDescription);
1298 catch (SALOME_Exception& ex) {
1299 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1302 else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
1304 MESSAGE("The source is a group on geom")
1306 bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1307 if (theGroupName && theGroupName[0]) {
1308 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1309 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1312 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1313 << theSource << ", " << theType << " )";
1317 catch (const std::invalid_argument& ex) {
1318 SALOME::ExceptionStruct ExDescription;
1319 ExDescription.text = ex.what();
1320 ExDescription.type = SALOME::BAD_PARAM;
1321 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1322 ExDescription.lineNumber = 840;
1323 throw SALOME::SALOME_Exception(ExDescription);
1325 catch (SALOME_Exception& ex) {
1326 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1331 //=============================================================================
1333 * Get implementation
1335 //=============================================================================
1337 ::HYBRIDPlugin_Hypothesis* HYBRIDPlugin_Hypothesis_i::GetImpl()
1339 return (::HYBRIDPlugin_Hypothesis*)myBaseImpl;
1342 //================================================================================
1344 * \brief Verify whether hypothesis supports given entity type
1346 //================================================================================
1348 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
1350 return type == SMESH::DIM_3D;