Salome HOME
sources v1.2
[modules/smesh.git] / src / SMESH_I / SMESH_subMesh_i.cxx
1 //  SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
2 //
3 //  Copyright (C) 2003  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. 
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SMESH_subMesh_i.cxx
25 //  Author : Paul RASCLE, EDF
26 //  Module : SMESH
27 //  $Header$
28
29 using namespace std;
30 using namespace std;
31 #include "SMESH_subMesh_i.hxx"
32 #include "SMESH_Gen_i.hxx"
33 #include "SMESH_Mesh_i.hxx"
34
35 #include "Utils_CorbaException.hxx"
36 #include "utilities.h"
37 #include "OpUtil.hxx"
38
39 //=============================================================================
40 /*!
41  *  
42  */
43 //=============================================================================
44
45 SMESH_subMesh_i::SMESH_subMesh_i()
46 {
47   MESSAGE("SMESH_subMesh_i::SMESH_subMesh_i default, not for use");
48     ASSERT(0);
49 }
50
51 //=============================================================================
52 /*!
53  *  
54  */
55 //=============================================================================
56
57 SMESH_subMesh_i::SMESH_subMesh_i(SMESH_Gen_i* gen_i,
58                                  SMESH_Mesh_i* mesh_i,
59                                  int localId)
60 {
61   MESSAGE("SMESH_subMesh_i::SMESH_subMesh_i");
62   _gen_i = gen_i;
63   _mesh_i = mesh_i;
64   _localId = localId;
65   // ****
66 }
67 //=============================================================================
68 /*!
69  *  
70  */
71 //=============================================================================
72
73 SMESH_subMesh_i::~SMESH_subMesh_i()
74 {
75   MESSAGE("SMESH_subMesh_i::~SMESH_subMesh_i");
76   // ****
77 }
78
79 //=============================================================================
80 /*!
81  *  
82  */
83 //=============================================================================
84
85 CORBA::Long SMESH_subMesh_i::GetNumberOfElements()
86   throw (SALOME::SALOME_Exception)
87 {
88   MESSAGE("SMESH_subMesh_i::GetNumberOfElements");
89   // ****
90 }
91
92 //=============================================================================
93 /*!
94  *  
95  */
96 //=============================================================================
97
98 CORBA::Long SMESH_subMesh_i::GetNumberOfNodes()
99   throw (SALOME::SALOME_Exception)
100 {
101   MESSAGE("SMESH_subMesh_i::GetNumberOfNodes");
102   // ****
103 }
104
105 //=============================================================================
106 /*!
107  *  
108  */
109 //=============================================================================
110   
111 SMESH::long_array* SMESH_subMesh_i::GetElementsId()
112   throw (SALOME::SALOME_Exception)
113 {
114   MESSAGE("SMESH_subMesh_i::GetElementsId");
115   // ****
116 }
117
118 //=============================================================================
119 /*!
120  *  
121  */
122 //=============================================================================
123   
124 SMESH::long_array* SMESH_subMesh_i::GetNodesId()
125   throw (SALOME::SALOME_Exception)
126 {
127   MESSAGE("SMESH_subMesh_i::GetNodesId");
128   // ****
129 }
130
131 //=============================================================================
132 /*!
133  *  
134  */
135 //=============================================================================
136   
137 SMESH::SMESH_Mesh_ptr SMESH_subMesh_i::GetFather()
138   throw (SALOME::SALOME_Exception)
139 {
140   MESSAGE("SMESH_subMesh_i::GetFather");
141   SMESH::SMESH_Mesh_var meshIor = _mesh_i->GetIor();
142   return SMESH::SMESH_Mesh::_duplicate(meshIor);
143 }
144
145 //=============================================================================
146 /*!
147  *  
148  */
149 //=============================================================================
150   
151 CORBA::Long SMESH_subMesh_i::GetId()
152 {
153   MESSAGE("SMESH_subMesh_i::GetId");
154   return _localId;
155 }
156
157 //=============================================================================
158 /*!
159  *  
160  */
161 //=============================================================================
162 SALOME_MED::FAMILY_ptr SMESH_subMesh_i::GetFamily()
163   throw (SALOME::SALOME_Exception)
164 {
165   SALOME_MED::MESH_var MEDMesh = GetFather()->GetMEDMesh();
166
167   SALOME_MED::Family_array_var families = 
168     MEDMesh->getFamilies(SALOME_MED::MED_NODE);
169     
170   for ( int i = 0; i < families->length(); i++ ) {
171     if ( families[i]->getIdentifier() == ( _localId ) )
172       return families[i];
173   }
174 }