1 // Copyright (C) 2004-2019 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,
31 ::SMESH_Gen* theGenImpl)
32 : SALOME::GenericObj_i( thePOA ),
33 SMESH_Hypothesis_i( thePOA ),
34 GHS3DPlugin_Hypothesis_i( thePOA, theGenImpl )
36 int id = myBaseImpl ? myBaseImpl->GetID() : theGenImpl->GetANewId();
40 myBaseImpl = new ::GHS3DPlugin_OptimizerHypothesis( id, theGenImpl );
45 const char* dumpMode( GHS3DPlugin::Mode mode )
48 case GHS3DPlugin::NO: return "GHS3DPlugin.NO";
49 case GHS3DPlugin::YES: return "GHS3DPlugin.YES";
50 case GHS3DPlugin::ONLY: return "GHS3DPlugin.ONLY";
51 default: return "GHS3DPlugin.NO";
57 void GHS3DPlugin_OptimizerHypothesis_i::SetOptimization( GHS3DPlugin::Mode mode )
59 if ((int) GetImpl()->GetOptimization() != (int) mode )
61 GetImpl()->SetOptimization( ::GHS3DPlugin_OptimizerHypothesis::Mode( mode ));
62 SMESH::TPythonDump() << _this() << ".SetOptimization( " << dumpMode( mode ) << " )";
66 GHS3DPlugin::Mode GHS3DPlugin_OptimizerHypothesis_i::GetOptimization()
68 return GHS3DPlugin::Mode( GetImpl()->GetOptimization() );
71 void GHS3DPlugin_OptimizerHypothesis_i::SetSplitOverConstrained( GHS3DPlugin::Mode mode )
73 if ((int) GetImpl()->GetSplitOverConstrained() != (int) mode )
75 GetImpl()->SetSplitOverConstrained((::GHS3DPlugin_OptimizerHypothesis::Mode) mode );
76 SMESH::TPythonDump() << _this() << ".SetSplitOverConstrained( " << dumpMode( mode ) << " )";
80 GHS3DPlugin::Mode GHS3DPlugin_OptimizerHypothesis_i::GetSplitOverConstrained()
82 return (GHS3DPlugin::Mode) GetImpl()->GetSplitOverConstrained();
85 void GHS3DPlugin_OptimizerHypothesis_i::SetSmoothOffSlivers( CORBA::Boolean toSmooth )
87 if ( GetImpl()->GetSmoothOffSlivers() != (bool) toSmooth )
89 GetImpl()->SetSmoothOffSlivers((bool) toSmooth );
90 SMESH::TPythonDump() << _this() << ".SetSmoothOffSlivers( " << toSmooth << " )";
94 CORBA::Boolean GHS3DPlugin_OptimizerHypothesis_i::GetSmoothOffSlivers()
96 return GetImpl()->GetSmoothOffSlivers();
99 void GHS3DPlugin_OptimizerHypothesis_i::SetPThreadsMode( GHS3DPlugin::PThreadsMode mode )
101 if ((int) GetImpl()->GetPThreadsMode() != (int) mode )
103 GetImpl()->SetPThreadsMode((::GHS3DPlugin_OptimizerHypothesis::PThreadsMode) mode );
107 case ::GHS3DPlugin_OptimizerHypothesis::SAFE: modeStr = "SAFE"; break;
108 case ::GHS3DPlugin_OptimizerHypothesis::AGGRESSIVE: modeStr = "AGGRESSIVE"; break;
109 default: modeStr = "NONE";
111 SMESH::TPythonDump() << _this() << ".SetPThreadsMode( GHS3DPlugin." << modeStr << " )";
115 GHS3DPlugin::PThreadsMode GHS3DPlugin_OptimizerHypothesis_i::GetPThreadsMode()
117 return (GHS3DPlugin::PThreadsMode) GetImpl()->GetPThreadsMode();
120 void GHS3DPlugin_OptimizerHypothesis_i::SetMaximalNumberOfThreads( CORBA::Short nb )
122 if ( GetImpl()->GetMaximalNumberOfThreads() != nb )
124 GetImpl()->SetMaximalNumberOfThreads( nb );
125 SMESH::TPythonDump() << _this() << ".SetMaximalNumberOfThreads( " << nb << " )";
129 CORBA::Short GHS3DPlugin_OptimizerHypothesis_i::GetMaximalNumberOfThreads()
131 return (CORBA::Short) GetImpl()->GetMaximalNumberOfThreads();
134 ::GHS3DPlugin_OptimizerHypothesis* GHS3DPlugin_OptimizerHypothesis_i::GetImpl()
136 return (::GHS3DPlugin_OptimizerHypothesis*)myBaseImpl;
139 CORBA::Boolean GHS3DPlugin_OptimizerHypothesis_i::IsDimSupported( SMESH::Dimension type )
141 return type == SMESH::DIM_3D;