1 // Copyright (C) 2007-2015 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()->SetTextOption(option);
402 SMESH::TPythonDump() << _this() << ".SetTextOption( '" << option << "' )";
405 //=======================================================================
406 //function : GetTextOption
407 //=======================================================================
408 char* HYBRIDPlugin_Hypothesis_i::GetTextOption()
411 return CORBA::string_dup( this->GetImpl()->GetTextOption().c_str() );
414 //=======================================================================
415 //function : SetToRemoveCentralPoint
416 //=======================================================================
418 void HYBRIDPlugin_Hypothesis_i::SetGradation(CORBA::Double gradation)
421 THROW_SALOME_CORBA_EXCEPTION( "The volumic gradation must be > 1",SALOME::BAD_PARAM );
423 if (gradation != GetGradation()) {
424 this->GetImpl()->SetGradation(gradation);
425 SMESH::TPythonDump() << _this() << ".SetGradation( " << gradation << " )";
429 //=======================================================================
430 //function : GetToRemoveCentralPoint
431 //=======================================================================
433 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetGradation()
436 return this->GetImpl()->GetGradation();
439 //=======================================================================
440 //function : SetStandardOutputLog
441 //=======================================================================
442 void HYBRIDPlugin_Hypothesis_i::SetStandardOutputLog(CORBA::Boolean logInStandardOutput)
445 this->GetImpl()->SetStandardOutputLog(logInStandardOutput);
446 SMESH::TPythonDump() << _this() << ".SetPrintLogInFile( " << !logInStandardOutput << " )";
449 //=======================================================================
450 //function : GetStandardOutputLog
451 //=======================================================================
452 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetStandardOutputLog()
455 return this->GetImpl()->GetStandardOutputLog();
458 //=======================================================================
459 //function : SetRemoveLogOnSuccess
460 //=======================================================================
461 void HYBRIDPlugin_Hypothesis_i::SetRemoveLogOnSuccess(CORBA::Boolean removeLogOnSuccess)
464 this->GetImpl()->SetRemoveLogOnSuccess(removeLogOnSuccess);
465 SMESH::TPythonDump() << _this() << ".SetRemoveLogOnSuccess( " << removeLogOnSuccess << " )";
468 //=======================================================================
469 //function : GetRemoveLogOnSuccess
470 //=======================================================================
471 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetRemoveLogOnSuccess()
474 return this->GetImpl()->GetRemoveLogOnSuccess();
477 //=======================================================================
478 //function : SetBoundaryLayersGrowth
479 //=======================================================================
480 void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersGrowth(CORBA::Short level)
481 throw ( SALOME::SALOME_Exception )
483 ::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth l =
484 (::HYBRIDPlugin_Hypothesis::BoundaryLayersGrowth) level;
485 if ( l < ::HYBRIDPlugin_Hypothesis::Layer_Growth_Inward ||
486 l > ::HYBRIDPlugin_Hypothesis::Layer_Growth_Outward )
487 THROW_SALOME_CORBA_EXCEPTION( "Invalid BoundaryLayersGrowth mode",SALOME::BAD_PARAM );
490 this->GetImpl()->SetBoundaryLayersGrowth(l);
491 SMESH::TPythonDump() << _this() << ".SetBoundaryLayersGrowth( " << level << " )";
494 //=======================================================================
495 //function : GetBoundaryLayersGrowth
496 //=======================================================================
497 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersGrowth()
500 return this->GetImpl()->GetBoundaryLayersGrowth();
503 //=======================================================================
504 //function : SetElementGeneration
505 //=======================================================================
506 void HYBRIDPlugin_Hypothesis_i::SetElementGeneration(CORBA::Short level)
507 throw ( SALOME::SALOME_Exception )
509 ::HYBRIDPlugin_Hypothesis::ElementGeneration l =
510 (::HYBRIDPlugin_Hypothesis::ElementGeneration) level;
511 if ( l < ::HYBRIDPlugin_Hypothesis::Generation_Tetra_Dominant ||
512 l > ::HYBRIDPlugin_Hypothesis::Generation_Hexa_Dominant )
513 THROW_SALOME_CORBA_EXCEPTION( "Invalid ElementGeneration mode",SALOME::BAD_PARAM );
516 this->GetImpl()->SetElementGeneration(l);
517 SMESH::TPythonDump() << _this() << ".SetElementGeneration( " << level << " )";
520 //=======================================================================
521 //function : GetElementGeneration
522 //=======================================================================
523 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetElementGeneration()
526 return this->GetImpl()->GetElementGeneration();
529 //=======================================================================
530 //function : SetAddMultinormals
531 //=======================================================================
532 void HYBRIDPlugin_Hypothesis_i::SetAddMultinormals(CORBA::Boolean toAddMultinormals)
535 this->GetImpl()->SetAddMultinormals(toAddMultinormals);
536 SMESH::TPythonDump() << _this() << ".SetAddMultinormals( " << toAddMultinormals << " )";
539 //=======================================================================
540 //function : GetAddMultinormals
541 //=======================================================================
542 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetAddMultinormals()
545 return this->GetImpl()->GetAddMultinormals();
548 //=======================================================================
549 //function : SetSmoothNormals
550 //=======================================================================
551 void HYBRIDPlugin_Hypothesis_i::SetSmoothNormals(CORBA::Boolean toSmoothNormals)
554 this->GetImpl()->SetSmoothNormals(toSmoothNormals);
555 SMESH::TPythonDump() << _this() << ".SetSmoothNormals( " << toSmoothNormals << " )";
558 //=======================================================================
559 //function : GetSmoothNormals
560 //=======================================================================
561 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::GetSmoothNormals()
564 return this->GetImpl()->GetSmoothNormals();
567 //=======================================================================
568 //function : SetHeightFirstLayer
569 //=======================================================================
570 void HYBRIDPlugin_Hypothesis_i::SetHeightFirstLayer(CORBA::Double toHeightFirstLayer)
573 this->GetImpl()->SetHeightFirstLayer(toHeightFirstLayer);
574 SMESH::TPythonDump() << _this() << ".SetHeightFirstLayer( " << toHeightFirstLayer << " )";
577 //=======================================================================
578 //function : GetHeightFirstLayer
579 //=======================================================================
580 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetHeightFirstLayer()
583 return this->GetImpl()->GetHeightFirstLayer();
586 //=======================================================================
587 //function : SetBoundaryLayersProgression
588 //=======================================================================
589 void HYBRIDPlugin_Hypothesis_i::SetBoundaryLayersProgression(CORBA::Double toBoundaryLayersProgression)
592 this->GetImpl()->SetBoundaryLayersProgression(toBoundaryLayersProgression);
593 SMESH::TPythonDump() << _this() << ".SetBoundaryLayersProgression( " << toBoundaryLayersProgression << " )";
596 //=======================================================================
597 //function : GetBoundaryLayersProgression
598 //=======================================================================
599 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetBoundaryLayersProgression()
602 return this->GetImpl()->GetBoundaryLayersProgression();
605 //=======================================================================
606 //function : SetMultinormalsAngle
607 //=======================================================================
608 void HYBRIDPlugin_Hypothesis_i::SetMultinormalsAngle(CORBA::Double toMultinormalsAngle)
611 this->GetImpl()->SetMultinormalsAngle(toMultinormalsAngle);
612 SMESH::TPythonDump() << _this() << ".SetMultinormalsAngle( " << toMultinormalsAngle << " )";
615 //=======================================================================
616 //function : GetMultinormalsAngle
617 //=======================================================================
618 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetMultinormalsAngle()
621 return this->GetImpl()->GetMultinormalsAngle();
624 //=======================================================================
625 //function : SetNbOfBoundaryLayers
626 //=======================================================================
627 void HYBRIDPlugin_Hypothesis_i::SetNbOfBoundaryLayers(CORBA::Short toNbOfBoundaryLayers)
630 this->GetImpl()->SetNbOfBoundaryLayers(toNbOfBoundaryLayers);
631 SMESH::TPythonDump() << _this() << ".SetNbOfBoundaryLayers( " << toNbOfBoundaryLayers << " )";
634 //=======================================================================
635 //function : GetNbOfBoundaryLayers
636 //=======================================================================
637 CORBA::Short HYBRIDPlugin_Hypothesis_i::GetNbOfBoundaryLayers()
640 return this->GetImpl()->GetNbOfBoundaryLayers();
643 //=======================================================================
644 //function : SetEnforcedVertex
645 //=======================================================================
647 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size)
648 throw (SALOME::SALOME_Exception) {
650 MESSAGE("IDL : SetEnforcedVertex( "<< x << ", " << y << ", " << z << ", " << size << ")");
651 return p_SetEnforcedVertex(size, x, y, z);
654 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName)
655 throw (SALOME::SALOME_Exception) {
657 MESSAGE("IDL : SetEnforcedVertexNamed( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ")");
658 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", "");
661 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theGroupName)
662 throw (SALOME::SALOME_Exception) {
664 MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theGroupName << ")");
665 return p_SetEnforcedVertex(size, x, y, z, "", "", theGroupName);
668 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size, const char* theVertexName, const char* theGroupName)
669 throw (SALOME::SALOME_Exception) {
671 MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< x << ", " << y << ", " << z << ", " << size << ", " << theVertexName << ", " << theGroupName << ")");
672 return p_SetEnforcedVertex(size, x, y, z, theVertexName, "", theGroupName);
675 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size)
676 throw (SALOME::SALOME_Exception) {
679 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
680 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
681 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
684 std::string theVertexEntry = theVertex->GetStudyEntry();
685 CORBA::Double x = 0, y = 0, z = 0;
686 CORBA::Boolean isCompound = false;
687 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
688 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
689 if (theVertexEntry.empty()) {
691 if (theVertex->GetShapeType() == GEOM::VERTEX) {
694 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
698 aName += theVertex->GetEntry();
699 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
700 if (!theSVertex->_is_nil())
701 theVertexEntry = theSVertex->GetID();
703 if (theVertexEntry.empty())
704 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
706 if (theVertex->GetShapeType() == GEOM::VERTEX) {
707 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
708 if (CORBA::is_nil(measureOp))
711 measureOp->PointCoordinates (theVertex, x, y, z);
712 MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
715 std::string theVertexName = theVertex->GetName();
716 MESSAGE("IDL : SetEnforcedVertexGeom( "<< theVertexEntry << ", " << size<< ")");
718 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), "", isCompound);
721 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, CORBA::Double size, const char* theGroupName)
722 throw (SALOME::SALOME_Exception) {
725 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
726 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
727 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
730 std::string theVertexEntry = theVertex->GetStudyEntry();
731 CORBA::Double x = 0, y = 0, z = 0;
732 CORBA::Boolean isCompound = false;
733 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
734 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
735 if (theVertexEntry.empty()) {
737 if (theVertex->GetShapeType() == GEOM::VERTEX) {
740 if (theVertex->GetShapeType() == GEOM::COMPOUND) {
744 aName += theVertex->GetEntry();
745 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
746 if (!theSVertex->_is_nil())
747 theVertexEntry = theSVertex->GetID();
749 if (theVertexEntry.empty())
750 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
752 if (theVertex->GetShapeType() == GEOM::VERTEX) {
753 GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations( smeshGen->GetCurrentStudy()->StudyId() );
754 if (CORBA::is_nil(measureOp))
757 measureOp->PointCoordinates (theVertex, x, y, z);
758 MESSAGE("Point coordinates from measureOp: " << x << ", " << y << ", " << z);
761 std::string theVertexName = theVertex->GetName();
762 MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theVertexEntry << ", " << size<< ", " << theGroupName << ")");
764 return p_SetEnforcedVertex(size, x, y, z, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName, isCompound);
767 bool HYBRIDPlugin_Hypothesis_i:: p_SetEnforcedVertex(CORBA::Double size, CORBA::Double x, CORBA::Double y, CORBA::Double z,
768 const char* theVertexName, const char* theVertexEntry, const char* theGroupName,
769 CORBA::Boolean isCompound)
770 throw (SALOME::SALOME_Exception) {
772 MESSAGE("IDL : p_SetEnforcedVertex(" << size << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\", " << isCompound<< ")");
773 bool newValue = false;
775 ::HYBRIDPlugin_Hypothesis::TCoordsHYBRIDEnforcedVertexMap coordsList;
776 ::HYBRIDPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap enfVertexEntryList;
777 if (std::string(theVertexEntry).empty()) {
778 coordsList = this->GetImpl()->_GetEnforcedVerticesByCoords();
779 std::vector<double> coords;
783 if (coordsList.find(coords) == coordsList.end()) {
784 MESSAGE("Coords not found: add it in coordsList");
788 MESSAGE("Coords already found, compare names");
789 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(x, y, z);
790 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
791 MESSAGE("The names or size are different: update");
792 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
796 MESSAGE("The names and size are identical");
801 if (std::string(theVertexName).empty()) {
802 if (std::string(theGroupName).empty())
803 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertex(" << x << ", " << y << ", " << z << ", " << size << ")";
805 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theGroupName << "\")";
808 if (std::string(theGroupName).empty())
809 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\")";
811 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", " << size << ", \"" << theVertexName << "\", \"" << theGroupName << "\")";
816 // if (isCompound || (!isCompound && !std::string(theVertexEntry).empty())) {
817 enfVertexEntryList = this->GetImpl()->_GetEnforcedVerticesByEntry();
818 // ::BLSURFPlugin_Hypothesis::TGeomEntryHYBRIDEnforcedVertexMap::const_iterator it = enfVertexEntryList.find(theVertexEntry);
819 if ( enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
820 MESSAGE("Geom entry not found: add it in enfVertexEntryList");
824 MESSAGE("Geom entry already found, compare names");
825 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex *enfVertex = this->GetImpl()->GetEnforcedVertex(theVertexEntry);
826 if ((enfVertex->name != theVertexName) || (enfVertex->groupName != theGroupName) || (enfVertex->size != size)) {
827 MESSAGE("The names or size are different: update");
828 // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
832 MESSAGE("The names and size are identical");
837 if (std::string(theGroupName).empty())
838 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeom(" << theVertexEntry << ", " << size << ")";
840 SMESH::TPythonDump() << "isDone = " << _this() << ".SetEnforcedVertexGeomWithGroup(" << theVertexEntry << ", " << size << ", \"" << theGroupName << "\")";
845 this->GetImpl()->SetEnforcedVertex(theVertexName, theVertexEntry, theGroupName, size, x, y, z, isCompound);
847 MESSAGE("IDL : SetEnforcedVertexEntry END");
851 //=======================================================================
852 //function : GetEnforcedVertex
853 //=======================================================================
855 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
856 throw (SALOME::SALOME_Exception)
860 bool isDone = this->GetImpl()->GetEnforcedVertex(x,y,z)->size;
861 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertex(" << x << ", " << y << ", " << z << ")";
864 catch (const std::invalid_argument& ex) {
865 SALOME::ExceptionStruct ExDescription;
866 ExDescription.text = ex.what();
867 ExDescription.type = SALOME::BAD_PARAM;
868 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
869 ExDescription.lineNumber = 513;
870 throw SALOME::SALOME_Exception(ExDescription);
872 catch (SALOME_Exception& ex) {
873 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
877 //=======================================================================
878 //function : GetEnforcedVertex
879 //=======================================================================
881 CORBA::Double HYBRIDPlugin_Hypothesis_i::GetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
882 throw (SALOME::SALOME_Exception)
886 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
887 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
888 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
891 std::string theVertexEntry = theVertex->GetStudyEntry();
892 if (theVertexEntry.empty()) {
893 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
894 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
896 if (theVertex->GetShapeType() == GEOM::VERTEX)
898 if (theVertex->GetShapeType() == GEOM::COMPOUND)
900 aName += theVertex->GetEntry();
901 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
902 if (!theSVertex->_is_nil())
903 theVertexEntry = theSVertex->GetID();
905 if (theVertexEntry.empty())
906 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
908 std::string theVertexName = theVertex->GetName();
911 bool isDone = this->GetImpl()->GetEnforcedVertex(theVertexName)->size;
912 SMESH::TPythonDump() << "aSize = " << _this() << ".GetEnforcedVertexGeom(" << theVertex << ")";
915 catch (const std::invalid_argument& ex) {
916 SALOME::ExceptionStruct ExDescription;
917 ExDescription.text = ex.what();
918 ExDescription.type = SALOME::BAD_PARAM;
919 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
920 ExDescription.lineNumber = 538;
921 throw SALOME::SALOME_Exception(ExDescription);
923 catch (SALOME_Exception& ex) {
924 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
928 //=======================================================================
929 //function : GetEnforcedVertices
930 //=======================================================================
932 HYBRIDPlugin::HYBRIDEnforcedVertexList* HYBRIDPlugin_Hypothesis_i::GetEnforcedVertices()
935 HYBRIDPlugin::HYBRIDEnforcedVertexList_var result = new HYBRIDPlugin::HYBRIDEnforcedVertexList();
937 const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList enfVertexList = this->GetImpl()->_GetEnforcedVertices();
938 result->length( enfVertexList.size() );
940 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertexList::const_iterator it = enfVertexList.begin();
942 for (int i = 0 ; it != enfVertexList.end(); ++it, ++i ) {
943 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedVertex* currentVertex = (*it);
944 HYBRIDPlugin::HYBRIDEnforcedVertex_var enfVertex = new HYBRIDPlugin::HYBRIDEnforcedVertex();
946 enfVertex->name = CORBA::string_dup(currentVertex->name.c_str());
948 enfVertex->geomEntry = CORBA::string_dup(currentVertex->geomEntry.c_str());
950 HYBRIDPlugin::TCoords_var coords = new HYBRIDPlugin::TCoords();
951 coords->length(currentVertex->coords.size());
952 for (size_t ind = 0; ind < currentVertex->coords.size(); ind++)
953 coords[ind] = currentVertex->coords[ind];
954 enfVertex->coords = coords;
956 enfVertex->groupName = CORBA::string_dup(currentVertex->groupName.c_str());
958 enfVertex->size = currentVertex->size;
960 enfVertex->isCompound = currentVertex->isCompound;
965 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
967 return result._retn();
970 //=======================================================================
971 //function : RemoveEnforcedVertex
972 //=======================================================================
974 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z)
975 throw (SALOME::SALOME_Exception)
979 bool res = this->GetImpl()->RemoveEnforcedVertex(x,y,z);
980 SMESH::TPythonDump() << " isDone = " << _this() << ".RemoveEnforcedVertex( " << x << ", " << y << ", " << z << " )";
983 catch (const std::invalid_argument& ex) {
984 SALOME::ExceptionStruct ExDescription;
985 ExDescription.text = ex.what();
986 ExDescription.type = SALOME::BAD_PARAM;
987 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
988 ExDescription.lineNumber = 625;
989 throw SALOME::SALOME_Exception(ExDescription);
991 catch (SALOME_Exception& ex) {
992 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
996 bool HYBRIDPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
997 throw (SALOME::SALOME_Exception)
1001 if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1002 MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1003 THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1006 std::string theVertexEntry = theVertex->GetStudyEntry();
1007 if (theVertexEntry.empty()) {
1008 GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1009 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1011 if (theVertex->GetShapeType() == GEOM::VERTEX)
1013 if (theVertex->GetShapeType() == GEOM::COMPOUND)
1014 aName = "Compound_";
1015 aName += theVertex->GetEntry();
1016 SALOMEDS::SObject_ptr theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1017 if (!theSVertex->_is_nil())
1018 theVertexEntry = theSVertex->GetID();
1020 if (theVertexEntry.empty())
1021 THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1024 bool res = this->GetImpl()->RemoveEnforcedVertex(0,0,0, theVertexEntry.c_str());
1025 SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom( " << theVertexEntry.c_str() << " )";
1028 catch (const std::invalid_argument& ex) {
1029 SALOME::ExceptionStruct ExDescription;
1030 ExDescription.text = ex.what();
1031 ExDescription.type = SALOME::BAD_PARAM;
1032 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1033 ExDescription.lineNumber = 648;
1034 throw SALOME::SALOME_Exception(ExDescription);
1036 catch (SALOME_Exception& ex) {
1037 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1041 //=======================================================================
1042 //function : ClearEnforcedVertices
1043 //=======================================================================
1045 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedVertices()
1048 this->GetImpl()->ClearEnforcedVertices();
1049 SMESH::TPythonDump () << _this() << ".ClearEnforcedVertices() ";
1052 //=======================================================================
1053 //function : ClearEnforcedMeshes
1054 //=======================================================================
1056 void HYBRIDPlugin_Hypothesis_i::ClearEnforcedMeshes()
1059 this->GetImpl()->ClearEnforcedMeshes();
1060 SMESH::TPythonDump () << _this() << ".ClearEnforcedMeshes() ";
1063 //=======================================================================
1064 //function : GetEnforcedMeshes
1065 //=======================================================================
1067 HYBRIDPlugin::HYBRIDEnforcedMeshList* HYBRIDPlugin_Hypothesis_i::GetEnforcedMeshes()
1070 HYBRIDPlugin::HYBRIDEnforcedMeshList_var result = new HYBRIDPlugin::HYBRIDEnforcedMeshList();
1072 const ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList enfMeshList = this->GetImpl()->_GetEnforcedMeshes();
1073 result->length( enfMeshList.size() );
1075 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMeshList::const_iterator it = enfMeshList.begin();
1077 for (int i = 0 ; it != enfMeshList.end(); ++it, ++i ) {
1078 ::HYBRIDPlugin_Hypothesis::THYBRIDEnforcedMesh* currentMesh = (*it);
1079 HYBRIDPlugin::HYBRIDEnforcedMesh_var enfMesh = new HYBRIDPlugin::HYBRIDEnforcedMesh();
1081 enfMesh->name = CORBA::string_dup(currentMesh->name.c_str());
1083 enfMesh->entry = CORBA::string_dup(currentMesh->entry.c_str());
1085 enfMesh->elementType = currentMesh->elementType;
1087 enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
1092 // SMESH::TPythonDump() << "allEnforcedVertices = " << _this() << ".GetEnforcedVertices()";
1094 return result._retn();
1098 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource. The elements will be grouped in theGroupName.
1100 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
1101 throw (SALOME::SALOME_Exception)
1103 // #if HYBRID_VERSION >= 42
1104 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1106 // SALOME::ExceptionStruct ExDescription;
1107 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1108 // ExDescription.type = SALOME::BAD_PARAM;
1109 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1110 // ExDescription.lineNumber = 719;
1111 // throw SALOME::SALOME_Exception(ExDescription);
1116 * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource.
1118 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType)
1119 throw (SALOME::SALOME_Exception)
1121 // MESSAGE("HYBRIDPlugin_Hypothesis_i::SetEnforcedMesh");
1122 // #if HYBRID_VERSION >= 42
1123 return p_SetEnforcedMesh(theSource, theType);
1125 // SALOME::ExceptionStruct ExDescription;
1126 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1127 // ExDescription.type = SALOME::BAD_PARAM;
1128 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1129 // ExDescription.lineNumber = 750;
1130 // throw SALOME::SALOME_Exception(ExDescription);
1135 * \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.
1137 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
1138 throw (SALOME::SALOME_Exception)
1140 // #if HYBRID_VERSION >= 42
1141 return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
1143 // SALOME::ExceptionStruct ExDescription;
1144 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1145 // ExDescription.type = SALOME::BAD_PARAM;
1146 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1147 // ExDescription.lineNumber = 750;
1148 // throw SALOME::SALOME_Exception(ExDescription);
1153 * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
1155 bool HYBRIDPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
1156 throw (SALOME::SALOME_Exception)
1158 // #if HYBRID_VERSION >= 42
1159 return p_SetEnforcedMesh(theSource, theType);
1161 // SALOME::ExceptionStruct ExDescription;
1162 // ExDescription.text = "Bad version of HYBRID. It must >= 4.2.";
1163 // ExDescription.type = SALOME::BAD_PARAM;
1164 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1165 // ExDescription.lineNumber = 750;
1166 // throw SALOME::SALOME_Exception(ExDescription);
1170 bool HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
1171 throw (SALOME::SALOME_Exception)
1173 MESSAGE("HYBRIDPlugin_Hypothesis_i::p_SetEnforcedMesh");
1176 if (CORBA::is_nil( theSource ))
1178 SALOME::ExceptionStruct ExDescription;
1179 ExDescription.text = "The source mesh CORBA object is NULL";
1180 ExDescription.type = SALOME::BAD_PARAM;
1181 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1182 ExDescription.lineNumber = 840;
1183 throw SALOME::SALOME_Exception(ExDescription);
1188 MESSAGE("Required type is NODE");
1191 MESSAGE("Required type is EDGE");
1194 MESSAGE("Required type is FACE");
1197 MESSAGE("Incompatible required type: " << theType);
1200 // MESSAGE("Required type is "<<theType);
1201 SMESH::array_of_ElementType_var types = theSource->GetTypes();
1202 MESSAGE("Available types:");
1203 for (CORBA::ULong i=0;i<types->length();i++){MESSAGE(types[i]);}
1204 if ( types->length() >= 1 && types[types->length()-1] < theType)
1206 MESSAGE("Required type not available");
1208 // SALOME::ExceptionStruct ExDescription;
1209 // ExDescription.text = "The source mesh has bad type";
1210 // ExDescription.type = SALOME::BAD_PARAM;
1211 // ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1212 // ExDescription.lineNumber = 840;
1213 // throw SALOME::SALOME_Exception(ExDescription);
1217 SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1218 SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
1220 SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
1221 SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
1222 SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
1224 std::string enfMeshName = theName;
1225 if (enfMeshName.empty())
1226 enfMeshName = SObj->GetName();
1231 bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
1232 if (theGroupName && theGroupName[0]) {
1233 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1234 << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
1237 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1238 << theSource << ".GetMesh(), " << theType << " )";
1243 catch (const std::invalid_argument& ex) {
1244 SALOME::ExceptionStruct ExDescription;
1245 ExDescription.text = ex.what();
1246 ExDescription.type = SALOME::BAD_PARAM;
1247 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1248 ExDescription.lineNumber = 840;
1249 throw SALOME::SALOME_Exception(ExDescription);
1251 catch (SALOME_Exception& ex) {
1252 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1255 else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
1257 MESSAGE("The source is a group")
1259 bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1260 if (theGroupName && theGroupName[0]) {
1261 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1262 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1265 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1266 << theSource << ", " << theType << " )";
1270 catch (const std::invalid_argument& ex) {
1271 SALOME::ExceptionStruct ExDescription;
1272 ExDescription.text = ex.what();
1273 ExDescription.type = SALOME::BAD_PARAM;
1274 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1275 ExDescription.lineNumber = 840;
1276 throw SALOME::SALOME_Exception(ExDescription);
1278 catch (SALOME_Exception& ex) {
1279 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1282 else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
1284 MESSAGE("The source is a group on geom")
1286 bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
1287 if (theGroupName && theGroupName[0]) {
1288 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
1289 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
1292 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
1293 << theSource << ", " << theType << " )";
1297 catch (const std::invalid_argument& ex) {
1298 SALOME::ExceptionStruct ExDescription;
1299 ExDescription.text = ex.what();
1300 ExDescription.type = SALOME::BAD_PARAM;
1301 ExDescription.sourceFile = "HYBRIDPlugin_Hypothesis_i.cxx";
1302 ExDescription.lineNumber = 840;
1303 throw SALOME::SALOME_Exception(ExDescription);
1305 catch (SALOME_Exception& ex) {
1306 THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1311 //=============================================================================
1313 * Get implementation
1315 //=============================================================================
1317 ::HYBRIDPlugin_Hypothesis* HYBRIDPlugin_Hypothesis_i::GetImpl()
1319 return (::HYBRIDPlugin_Hypothesis*)myBaseImpl;
1322 //================================================================================
1324 * \brief Verify whether hypothesis supports given entity type
1326 //================================================================================
1328 CORBA::Boolean HYBRIDPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
1330 return type == SMESH::DIM_3D;