1 // Copyright (C) 2004-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
19 // File : GHS3DPlugin_OptimizerHypothesis_i.cxx
20 // Created : Tue Nov 1 17:46:39 2016
22 #include "GHS3DPlugin_OptimizerHypothesis_i.hxx"
24 #include <SMESH_Gen.hxx>
25 #include <SMESH_PythonDump.hxx>
27 #include <Utils_CorbaException.hxx>
29 GHS3DPlugin_OptimizerHypothesis_i::
30 GHS3DPlugin_OptimizerHypothesis_i (PortableServer::POA_ptr thePOA,
32 ::SMESH_Gen* theGenImpl)
33 : SALOME::GenericObj_i( thePOA ),
34 SMESH_Hypothesis_i( thePOA ),
35 GHS3DPlugin_Hypothesis_i( thePOA, theStudyId, theGenImpl )
37 int id = myBaseImpl ? myBaseImpl->GetID() : theGenImpl->GetANewId();
41 myBaseImpl = new ::GHS3DPlugin_OptimizerHypothesis( id, theStudyId, theGenImpl );
46 const char* dumpMode( GHS3DPlugin::Mode mode )
49 case GHS3DPlugin::NO: return "GHS3DPlugin.NO";
50 case GHS3DPlugin::YES: return "GHS3DPlugin.YES";
51 case GHS3DPlugin::ONLY: return "GHS3DPlugin.ONLY";
52 default: return "GHS3DPlugin.NO";
58 void GHS3DPlugin_OptimizerHypothesis_i::SetOptimization( GHS3DPlugin::Mode mode )
60 if ((int) GetImpl()->GetOptimization() != (int) mode )
62 GetImpl()->SetOptimization( ::GHS3DPlugin_OptimizerHypothesis::Mode( mode ));
63 SMESH::TPythonDump() << _this() << ".SetOptimization( " << dumpMode( mode ) << " )";
67 GHS3DPlugin::Mode GHS3DPlugin_OptimizerHypothesis_i::GetOptimization()
69 return GHS3DPlugin::Mode( GetImpl()->GetOptimization() );
72 void GHS3DPlugin_OptimizerHypothesis_i::SetSplitOverConstrained( GHS3DPlugin::Mode mode )
74 if ((int) GetImpl()->GetSplitOverConstrained() != (int) mode )
76 GetImpl()->SetSplitOverConstrained((::GHS3DPlugin_OptimizerHypothesis::Mode) mode );
77 SMESH::TPythonDump() << _this() << ".SetSplitOverConstrained( " << dumpMode( mode ) << " )";
81 GHS3DPlugin::Mode GHS3DPlugin_OptimizerHypothesis_i::GetSplitOverConstrained()
83 return (GHS3DPlugin::Mode) GetImpl()->GetSplitOverConstrained();
86 void GHS3DPlugin_OptimizerHypothesis_i::SetSmoothOffSlivers( CORBA::Boolean toSmooth )
88 if ( GetImpl()->GetSmoothOffSlivers() != (bool) toSmooth )
90 GetImpl()->SetSmoothOffSlivers((bool) toSmooth );
91 SMESH::TPythonDump() << _this() << ".SetSmoothOffSlivers( " << toSmooth << " )";
95 CORBA::Boolean GHS3DPlugin_OptimizerHypothesis_i::GetSmoothOffSlivers()
97 return GetImpl()->GetSmoothOffSlivers();
100 void GHS3DPlugin_OptimizerHypothesis_i::SetPThreadsMode( GHS3DPlugin::PThreadsMode mode )
102 if ((int) GetImpl()->GetPThreadsMode() != (int) mode )
104 GetImpl()->SetPThreadsMode((::GHS3DPlugin_OptimizerHypothesis::PThreadsMode) mode );
108 case ::GHS3DPlugin_OptimizerHypothesis::SAFE: modeStr = "SAFE"; break;
109 case ::GHS3DPlugin_OptimizerHypothesis::AGGRESSIVE: modeStr = "AGGRESSIVE"; break;
110 default: modeStr = "NONE";
112 SMESH::TPythonDump() << _this() << ".SetPThreadsMode( GHS3DPlugin." << modeStr << " )";
116 GHS3DPlugin::PThreadsMode GHS3DPlugin_OptimizerHypothesis_i::GetPThreadsMode()
118 return (GHS3DPlugin::PThreadsMode) GetImpl()->GetPThreadsMode();
121 void GHS3DPlugin_OptimizerHypothesis_i::SetMaximalNumberOfThreads( CORBA::Short nb )
123 if ( GetImpl()->GetMaximalNumberOfThreads() != nb )
125 GetImpl()->SetMaximalNumberOfThreads( nb );
126 SMESH::TPythonDump() << _this() << ".SetMaximalNumberOfThreads( " << nb << " )";
130 CORBA::Short GHS3DPlugin_OptimizerHypothesis_i::GetMaximalNumberOfThreads()
132 return (CORBA::Short) GetImpl()->GetMaximalNumberOfThreads();
135 ::GHS3DPlugin_OptimizerHypothesis* GHS3DPlugin_OptimizerHypothesis_i::GetImpl()
137 return (::GHS3DPlugin_OptimizerHypothesis*)myBaseImpl;
140 CORBA::Boolean GHS3DPlugin_OptimizerHypothesis_i::IsDimSupported( SMESH::Dimension type )
142 return type == SMESH::DIM_3D;