1 // Copyright (C) 2007-2023 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 number of threads for a parallel computation
88 //=============================================================================
89 CORBA::Long SMESH_ParallelMesh_i::GetNbThreads(){
90 return DownCast()->GetNbThreads();
93 //=============================================================================
95 * \brief Set the number of threads for a parallel computation
97 //=============================================================================
98 void SMESH_ParallelMesh_i::SetNbThreads(CORBA::Long nbThreads){
99 DownCast()->SetNbThreads(nbThreads);
102 //=============================================================================
104 * \brief Get the ressource to connect to
106 //=============================================================================
107 char* SMESH_ParallelMesh_i::GetResource(){
108 return CORBA::string_dup(DownCast()->GetResource().c_str());
111 //=============================================================================
113 * \brief Set the ressource to connect to
115 //=============================================================================
116 void SMESH_ParallelMesh_i::SetResource(const char* aResource){
117 DownCast()->SetResource(std::string(aResource));
120 //=============================================================================
122 * \brief Get the number of processor to use on ressource
124 //=============================================================================
125 CORBA::Long SMESH_ParallelMesh_i::GetNbProc(){
126 return DownCast()->GetNbProc();
129 //=============================================================================
131 * \brief Set the number of processor to use on ressource
133 //=============================================================================
134 void SMESH_ParallelMesh_i::SetNbProc(CORBA::Long nbProcs){
135 DownCast()->SetNbProc(nbProcs);
138 //=============================================================================
140 * \brief Get the number of processor per node to use on ressource
142 //=============================================================================
143 CORBA::Long SMESH_ParallelMesh_i::GetNbProcPerNode(){
144 return DownCast()->GetNbProcPerNode();
147 //=============================================================================
149 * \brief Set the number of processor per node to use on ressource
151 //=============================================================================
152 void SMESH_ParallelMesh_i::SetNbProcPerNode(CORBA::Long nbProcPerNodes){
153 DownCast()->SetNbProcPerNode(nbProcPerNodes);
156 //=============================================================================
158 * \brief Get the number of node to use on ressource
160 //=============================================================================
161 CORBA::Long SMESH_ParallelMesh_i::GetNbNode(){
162 return DownCast()->GetNbNode();
165 //=============================================================================
167 * \brief Set the number of node to use on ressource
169 //=============================================================================
170 void SMESH_ParallelMesh_i::SetNbNode(CORBA::Long nbNodes){
171 DownCast()->SetNbNode(nbNodes);
174 //=============================================================================
176 * \brief Get the wckey to use on ressource
178 //=============================================================================
179 char* SMESH_ParallelMesh_i::GetWcKey(){
180 return CORBA::string_dup(DownCast()->GetWcKey().c_str());
183 //=============================================================================
185 * \brief Set the wckey to use on ressource
187 //=============================================================================
188 void SMESH_ParallelMesh_i::SetWcKey(const char* wcKey){
189 DownCast()->SetWcKey(std::string(wcKey));