1 // Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SMESH_ParallelMesh_i.cxx
23 // Author : Yoann AUDOUIN, EDF
26 #include "SMESH_ParallelMesh_i.hxx"
27 #include "SMESH_Mesh_i.hxx"
29 #include "SMESH_Gen_i.hxx"
32 //=============================================================================
35 //!< implementation of struct used to call methods of SMESH_Mesh_i from SMESH_Mesh
36 // issue 0020918: groups removal is caused by hyp modification
37 // issue 0021208: to forget not loaded mesh data at hyp modification
38 struct TCallUp_i : public SMESH_ParallelMesh::TCallUp
40 SMESH_ParallelMesh_i* _mesh;
41 TCallUp_i(SMESH_ParallelMesh_i* mesh):_mesh(mesh) {}
42 void RemoveGroup (const int theGroupID) override { _mesh->removeGroup( theGroupID ); }
43 void HypothesisModified( int hypID,
44 bool updIcons) override { _mesh->onHypothesisModified( hypID,
46 void Load () override { _mesh->Load(); }
47 bool IsLoaded() override { return _mesh->IsLoaded(); }
48 TopoDS_Shape GetShapeByEntry(const std::string& entry) override
50 GEOM::GEOM_Object_var go = SMESH_Gen_i::GetGeomObjectByEntry( entry );
51 return SMESH_Gen_i::GeomObjectToShape( go );
56 ::SMESH_ParallelMesh* SMESH_ParallelMesh_i::DownCast()
58 ::SMESH_ParallelMesh* myImpl = dynamic_cast<::SMESH_ParallelMesh*>(_impl);
60 THROW_SALOME_CORBA_EXCEPTION("Could not cast as ParallelMesh", SALOME::INTERNAL_ERROR);
65 //=============================================================================
67 * \brief Get the parallellism method
69 //=============================================================================
71 CORBA::Long SMESH_ParallelMesh_i::GetParallelismMethod(){
72 return DownCast()->GetParallelismMethod();
75 //=============================================================================
77 * \brief Set the parallellism method
79 //=============================================================================
80 void SMESH_ParallelMesh_i::SetParallelismMethod(CORBA::Long aMethod){
81 DownCast()->SetParallelismMethod(aMethod);
84 //=============================================================================
86 * \brief Get the parallell dimension
88 //=============================================================================
90 CORBA::Long SMESH_ParallelMesh_i::GetParallelismDimension(){
91 return DownCast()->GetParallelismDimension();
94 //=============================================================================
96 * \brief Set the parallell dimension
98 //=============================================================================
99 void SMESH_ParallelMesh_i::SetParallelismDimension(CORBA::Long aDim){
100 DownCast()->SetParallelismDimension(aDim);
103 //=============================================================================
105 * \brief Get the number of threads for a parallel computation
107 //=============================================================================
108 CORBA::Long SMESH_ParallelMesh_i::GetNbThreads(){
109 return DownCast()->GetNbThreads();
112 //=============================================================================
114 * \brief Set the number of threads for a parallel computation
116 //=============================================================================
117 void SMESH_ParallelMesh_i::SetNbThreads(CORBA::Long nbThreads){
118 DownCast()->SetNbThreads(nbThreads);
121 //=============================================================================
123 * \brief Get the ressource to connect to
125 //=============================================================================
126 char* SMESH_ParallelMesh_i::GetResource(){
127 return CORBA::string_dup(DownCast()->GetResource().c_str());
130 //=============================================================================
132 * \brief Set the ressource to connect to
134 //=============================================================================
135 void SMESH_ParallelMesh_i::SetResource(const char* aResource){
136 DownCast()->SetResource(std::string(aResource));
139 //=============================================================================
141 * \brief Get the number of processor to use on ressource
143 //=============================================================================
144 CORBA::Long SMESH_ParallelMesh_i::GetNbProc(){
145 return DownCast()->GetNbProc();
148 //=============================================================================
150 * \brief Set the number of processor to use on ressource
152 //=============================================================================
153 void SMESH_ParallelMesh_i::SetNbProc(CORBA::Long nbProcs){
154 DownCast()->SetNbProc(nbProcs);
157 //=============================================================================
159 * \brief Get the number of processor per node to use on ressource
161 //=============================================================================
162 CORBA::Long SMESH_ParallelMesh_i::GetNbProcPerNode(){
163 return DownCast()->GetNbProcPerNode();
166 //=============================================================================
168 * \brief Set the number of processor per node to use on ressource
170 //=============================================================================
171 void SMESH_ParallelMesh_i::SetNbProcPerNode(CORBA::Long nbProcPerNodes){
172 DownCast()->SetNbProcPerNode(nbProcPerNodes);
175 //=============================================================================
177 * \brief Get the number of node to use on ressource
179 //=============================================================================
180 CORBA::Long SMESH_ParallelMesh_i::GetNbNode(){
181 return DownCast()->GetNbNode();
184 //=============================================================================
186 * \brief Set the number of node to use on ressource
188 //=============================================================================
189 void SMESH_ParallelMesh_i::SetNbNode(CORBA::Long nbNodes){
190 DownCast()->SetNbNode(nbNodes);
193 //=============================================================================
195 * \brief Get the wckey to use on ressource
197 //=============================================================================
198 char* SMESH_ParallelMesh_i::GetWcKey(){
199 return CORBA::string_dup(DownCast()->GetWcKey().c_str());
202 //=============================================================================
204 * \brief Set the wckey to use on ressource
206 //=============================================================================
207 void SMESH_ParallelMesh_i::SetWcKey(const char* wcKey){
208 DownCast()->SetWcKey(std::string(wcKey));
211 //=============================================================================
213 * \brief Get the walltime to use on ressource
215 //=============================================================================
216 char* SMESH_ParallelMesh_i::GetWalltime(){
217 return CORBA::string_dup(DownCast()->GetWalltime().c_str());
220 //=============================================================================
222 * \brief Set the walltime to use on ressource
224 //=============================================================================
225 void SMESH_ParallelMesh_i::SetWalltime(const char* walltime){
226 DownCast()->SetWalltime(std::string(walltime));