Salome HOME
updated copyright message
[modules/smesh.git] / src / SMESH_I / SMESH_ParallelMesh_i.cxx
1 // Copyright (C) 2007-2023  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 namespace
51 {
52   //!< implementation of struct used to call methods of SMESH_Mesh_i from SMESH_Mesh
53   // issue 0020918: groups removal is caused by hyp modification
54   // issue 0021208: to forget not loaded mesh data at hyp modification
55   struct TCallUp_i : public SMESH_ParallelMesh::TCallUp
56   {
57     SMESH_ParallelMesh_i* _mesh;
58     TCallUp_i(SMESH_ParallelMesh_i* mesh):_mesh(mesh) {}
59     void RemoveGroup (const int theGroupID) override { _mesh->removeGroup( theGroupID ); }
60     void HypothesisModified( int hypID,
61                              bool updIcons) override { _mesh->onHypothesisModified( hypID,
62                                                                                     updIcons ); }
63     void Load ()                            override { _mesh->Load(); }
64     bool IsLoaded()                         override { return _mesh->IsLoaded(); }
65     TopoDS_Shape GetShapeByEntry(const std::string& entry) override
66     {
67       GEOM::GEOM_Object_var go = SMESH_Gen_i::GetGeomObjectByEntry( entry );
68       return SMESH_Gen_i::GeomObjectToShape( go );
69     }
70   };
71 }
72
73 //================================================================================
74 /*!
75  * \brief Set mesh implementation
76  */
77 //================================================================================
78
79 void SMESH_ParallelMesh_i::SetImpl(::SMESH_ParallelMesh * impl)
80 {
81   if(MYDEBUG) MESSAGE("SMESH_ParallelMesh_i::SetImpl");
82   _impl = impl;
83   if ( _impl )
84     _impl->SetCallUp( new TCallUp_i(this));
85 }
86
87 //=============================================================================
88 /*!
89  * Return a mesh implementation
90  */
91 //=============================================================================
92
93 ::SMESH_ParallelMesh & SMESH_ParallelMesh_i::GetImpl()
94 {
95   if(MYDEBUG) MESSAGE("SMESH_ParallelMesh_i::GetImpl()");
96   return *_impl;
97 }