Salome HOME
Updated copyright comment
[modules/smesh.git] / src / SMESH_I / SMESH_ParallelMesh_i.cxx
1 // Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : SMESH_ParallelMesh_i.cxx
23 //  Author : Yoann AUDOUIN, EDF
24 //  Module : SMESH
25
26 #include "SMESH_ParallelMesh_i.hxx"
27 #include "SMESH_Mesh_i.hxx"
28
29 #include "SMESH_Gen_i.hxx"
30
31
32 //=============================================================================
33 namespace
34 {
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
39   {
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,
45                                                                                     updIcons ); }
46     void Load ()                            override { _mesh->Load(); }
47     bool IsLoaded()                         override { return _mesh->IsLoaded(); }
48     TopoDS_Shape GetShapeByEntry(const std::string& entry) override
49     {
50       GEOM::GEOM_Object_var go = SMESH_Gen_i::GetGeomObjectByEntry( entry );
51       return SMESH_Gen_i::GeomObjectToShape( go );
52     }
53   };
54 }
55
56 ::SMESH_ParallelMesh* SMESH_ParallelMesh_i::DownCast()
57 {
58   ::SMESH_ParallelMesh* myImpl = dynamic_cast<::SMESH_ParallelMesh*>(_impl);
59   if (myImpl == NULL)
60     THROW_SALOME_CORBA_EXCEPTION("Could not cast as ParallelMesh", SALOME::INTERNAL_ERROR);
61
62   return myImpl;
63 }
64
65 //=============================================================================
66 /*!
67  * \brief Get the parallellism method
68  */
69 //=============================================================================
70
71 CORBA::Long SMESH_ParallelMesh_i::GetParallelismMethod(){
72   return DownCast()->GetParallelismMethod();
73 }
74
75 //=============================================================================
76 /*!
77  * \brief Set the parallellism method
78  */
79 //=============================================================================
80 void SMESH_ParallelMesh_i::SetParallelismMethod(CORBA::Long aMethod){
81   DownCast()->SetParallelismMethod(aMethod);
82 }
83
84 //=============================================================================
85 /*!
86  * \brief Get the parallell dimension
87  */
88 //=============================================================================
89
90 CORBA::Long SMESH_ParallelMesh_i::GetParallelismDimension(){
91   return DownCast()->GetParallelismDimension();
92 }
93
94 //=============================================================================
95 /*!
96  * \brief Set the parallell dimension
97  */
98 //=============================================================================
99 void SMESH_ParallelMesh_i::SetParallelismDimension(CORBA::Long aDim){
100   DownCast()->SetParallelismDimension(aDim);
101 }
102
103 //=============================================================================
104 /*!
105  * \brief Get the number of threads for a parallel computation
106  */
107 //=============================================================================
108 CORBA::Long SMESH_ParallelMesh_i::GetNbThreads(){
109   return DownCast()->GetNbThreads();
110 }
111
112 //=============================================================================
113 /*!
114  * \brief Set the number of threads for a parallel computation
115  */
116 //=============================================================================
117 void SMESH_ParallelMesh_i::SetNbThreads(CORBA::Long nbThreads){
118   DownCast()->SetNbThreads(nbThreads);
119 }
120
121 //=============================================================================
122 /*!
123  * \brief Get the ressource to connect to
124  */
125 //=============================================================================
126 char* SMESH_ParallelMesh_i::GetResource(){
127   return CORBA::string_dup(DownCast()->GetResource().c_str());
128 }
129
130 //=============================================================================
131 /*!
132  * \brief Set the ressource to connect to
133  */
134 //=============================================================================
135 void SMESH_ParallelMesh_i::SetResource(const char* aResource){
136   DownCast()->SetResource(std::string(aResource));
137 }
138
139 //=============================================================================
140 /*!
141  * \brief Get the number of processor to use on ressource
142  */
143 //=============================================================================
144 CORBA::Long SMESH_ParallelMesh_i::GetNbProc(){
145   return DownCast()->GetNbProc();
146 }
147
148 //=============================================================================
149 /*!
150  * \brief Set the number of processor to use on ressource
151  */
152 //=============================================================================
153 void SMESH_ParallelMesh_i::SetNbProc(CORBA::Long nbProcs){
154   DownCast()->SetNbProc(nbProcs);
155 }
156
157 //=============================================================================
158 /*!
159  * \brief Get the number of processor per node to use on ressource
160  */
161 //=============================================================================
162 CORBA::Long SMESH_ParallelMesh_i::GetNbProcPerNode(){
163   return DownCast()->GetNbProcPerNode();
164 }
165
166 //=============================================================================
167 /*!
168  * \brief Set the number of processor per node to use on ressource
169  */
170 //=============================================================================
171 void SMESH_ParallelMesh_i::SetNbProcPerNode(CORBA::Long nbProcPerNodes){
172   DownCast()->SetNbProcPerNode(nbProcPerNodes);
173 }
174
175 //=============================================================================
176 /*!
177  * \brief Get the number of node to use on ressource
178  */
179 //=============================================================================
180 CORBA::Long SMESH_ParallelMesh_i::GetNbNode(){
181   return DownCast()->GetNbNode();
182 }
183
184 //=============================================================================
185 /*!
186  * \brief Set the number of node to use on ressource
187  */
188 //=============================================================================
189 void SMESH_ParallelMesh_i::SetNbNode(CORBA::Long nbNodes){
190   DownCast()->SetNbNode(nbNodes);
191 }
192
193 //=============================================================================
194 /*!
195  * \brief Get the wckey to use on ressource
196  */
197 //=============================================================================
198 char* SMESH_ParallelMesh_i::GetWcKey(){
199   return CORBA::string_dup(DownCast()->GetWcKey().c_str());
200 }
201
202 //=============================================================================
203 /*!
204  * \brief Set the wckey to use on ressource
205  */
206 //=============================================================================
207 void SMESH_ParallelMesh_i::SetWcKey(const char* wcKey){
208   DownCast()->SetWcKey(std::string(wcKey));
209 }
210
211 //=============================================================================
212 /*!
213  * \brief Get the walltime to use on ressource
214  */
215 //=============================================================================
216 char* SMESH_ParallelMesh_i::GetWalltime(){
217   return CORBA::string_dup(DownCast()->GetWalltime().c_str());
218 }
219
220 //=============================================================================
221 /*!
222  * \brief Set the walltime to use on ressource
223  */
224 //=============================================================================
225 void SMESH_ParallelMesh_i::SetWalltime(const char* walltime){
226   DownCast()->SetWalltime(std::string(walltime));
227 }