Salome HOME
Missing files
[modules/smesh.git] / src / SMESH_I / SMESH_ParallelMesh_i.cxx
1 // Copyright (C) 2007-2022  CEA/DEN, EDF R&D, 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
28 #include "SMESH_Gen_i.hxx"
29
30
31 #ifdef _DEBUG_
32 static int MYDEBUG = 0;
33 #else
34 static int MYDEBUG = 0;
35 #endif
36
37 //=============================================================================
38 /*!
39  *  Constructor
40  */
41 //=============================================================================
42
43 SMESH_ParallelMesh_i::SMESH_ParallelMesh_i( PortableServer::POA_ptr thePOA,
44                             SMESH_Gen_i*            gen_i )
45 : SMESH_Mesh_i(thePOA, gen_i)
46 {
47 }
48
49 //=============================================================================
50 /*!
51  *  Destructor
52  */
53 //=============================================================================
54
55 SMESH_ParallelMesh_i::~SMESH_ParallelMesh_i()
56 {
57 }
58
59 //=============================================================================
60 namespace
61 {
62   //!< implementation of struct used to call methods of SMESH_Mesh_i from SMESH_Mesh
63   // issue 0020918: groups removal is caused by hyp modification
64   // issue 0021208: to forget not loaded mesh data at hyp modification
65   struct TCallUp_i : public SMESH_ParallelMesh::TCallUp
66   {
67     SMESH_ParallelMesh_i* _mesh;
68     TCallUp_i(SMESH_ParallelMesh_i* mesh):_mesh(mesh) {}
69     void RemoveGroup (const int theGroupID) override { _mesh->removeGroup( theGroupID ); }
70     void HypothesisModified( int hypID,
71                              bool updIcons) override { _mesh->onHypothesisModified( hypID,
72                                                                                     updIcons ); }
73     void Load ()                            override { _mesh->Load(); }
74     bool IsLoaded()                         override { return _mesh->IsLoaded(); }
75     TopoDS_Shape GetShapeByEntry(const std::string& entry) override
76     {
77       GEOM::GEOM_Object_var go = SMESH_Gen_i::GetGeomObjectByEntry( entry );
78       return SMESH_Gen_i::GeomObjectToShape( go );
79     }
80   };
81 }
82
83 //================================================================================
84 /*!
85  * \brief Set mesh implementation
86  */
87 //================================================================================
88
89 void SMESH_ParallelMesh_i::SetImpl(::SMESH_ParallelMesh * impl)
90 {
91   if(MYDEBUG) MESSAGE("SMESH_ParallelMesh_i::SetImpl");
92   _impl = impl;
93   if ( _impl )
94     _impl->SetCallUp( new TCallUp_i(this));
95 }
96
97 //=============================================================================
98 /*!
99  * Return a mesh implementation
100  */
101 //=============================================================================
102
103 ::SMESH_ParallelMesh & SMESH_ParallelMesh_i::GetImpl()
104 {
105   if(MYDEBUG) MESSAGE("SMESH_ParallelMesh_i::GetImpl()");
106   return *_impl;
107 }