1 // SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
3 // Copyright (C) 2003 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.
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESH_MEDSupport_i.cxx
28 #include "SMESH_MEDSupport_i.hxx"
29 #include "utilities.h"
30 #include "Utils_CorbaException.hxx"
31 #include "Utils_ExceptHandlers.hxx"
33 #include <TopoDS_Iterator.hxx>
34 #include "SMESHDS_Mesh.hxx"
36 #include "SMESH_subMesh.hxx"
37 #include "SMESH_Mesh_i.hxx"
38 #include "SMESH_subMesh_i.hxx"
41 //=============================================================================
45 //=============================================================================
46 SMESH_MEDSupport_i::SMESH_MEDSupport_i()
48 BEGIN_OF("Default Constructor SMESH_MEDSupport_i");
49 END_OF("Default Constructor SMESH_MEDSupport_i");
52 //=============================================================================
56 //=============================================================================
57 SMESH_MEDSupport_i::SMESH_MEDSupport_i(SMESH_subMesh_i * sm, string name,
58 string description, SALOME_MED::medEntityMesh entity)
59 :_subMesh_i(sm), _name(name), _description(description), _entity(entity),
60 _seqNumber(false), _seqLength(0)
62 BEGIN_OF("Constructor SMESH_MEDSupport_i");
64 _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS();
66 int subMeshId = _subMesh_i->GetId();
68 MESSAGE(" subMeshId " << subMeshId)
70 if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) !=
71 _subMesh_i->_mesh_i->_mapSubMesh.end())
73 ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId];
74 _subMeshDS = subMesh->GetSubMeshDS();
77 if (_entity == SALOME_MED::MED_NODE)
79 _numberOfGeometricType = 1;
80 _geometricType = new SALOME_MED::medGeometryElement[1];
81 _geometricType[0] = SALOME_MED::MED_NONE;
85 MESSAGE("Pas implemente dans cette version");
86 THROW_SALOME_CORBA_EXCEPTION
87 ("Seules les familles de noeuds sont implementees ",
91 END_OF("Constructor SMESH_MEDSupport_i");
94 //=============================================================================
98 //=============================================================================
100 SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s):_subMesh_i(s._subMesh_i),
101 _name(s._name), _description(s._description), _entity(s._entity),
102 _seqNumber(false), _seqLength(0)
104 BEGIN_OF("Constructor SMESH_MEDSupport_i");
106 _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS();
108 int subMeshId = _subMesh_i->GetId();
109 if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) !=
110 _subMesh_i->_mesh_i->_mapSubMesh.end())
112 ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId];
113 _subMeshDS = subMesh->GetSubMeshDS();
116 END_OF("Constructor SMESH_MEDSupport_i");
119 //=============================================================================
123 //=============================================================================
125 SMESH_MEDSupport_i::~SMESH_MEDSupport_i()
129 //=============================================================================
131 * CORBA: Accessor for Corba Index
133 //=============================================================================
135 CORBA::Long SMESH_MEDSupport_i::getCorbaIndex()throw(SALOME::SALOME_Exception)
137 if (_subMeshDS == NULL)
138 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
139 SALOME::INTERNAL_ERROR);
140 MESSAGE("Not implemented for SMESH_i");
141 THROW_SALOME_CORBA_EXCEPTION("Not Implemented ", SALOME::BAD_PARAM);
145 //=============================================================================
147 * CORBA: Accessor for Name
149 //=============================================================================
151 char *SMESH_MEDSupport_i::getName() throw(SALOME::SALOME_Exception)
153 if (_subMeshDS==NULL)
154 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
155 SALOME::INTERNAL_ERROR);
156 return CORBA::string_dup(_name.c_str());
160 //=============================================================================
162 * CORBA: Accessor for Description
164 //=============================================================================
166 char *SMESH_MEDSupport_i::getDescription() throw(SALOME::SALOME_Exception)
168 if (_subMeshDS==NULL)
169 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
170 SALOME::INTERNAL_ERROR);
171 return CORBA::string_dup(_description.c_str());
174 //=============================================================================
176 * CORBA: Accessor for Mesh
178 //=============================================================================
180 SALOME_MED::MESH_ptr SMESH_MEDSupport_i::getMesh()throw(SALOME::
183 if (_subMeshDS==NULL)
184 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
185 SALOME::INTERNAL_ERROR);
187 return _subMesh_i->_mesh_i->GetMEDMesh();
190 //=============================================================================
192 * CORBA: boolean indicating if support concerns all elements
194 //=============================================================================
196 CORBA::Boolean SMESH_MEDSupport_i::isOnAllElements()throw(SALOME::
199 if (_subMeshDS==NULL)
200 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
201 SALOME::INTERNAL_ERROR);
202 if (_seqNumber == false)
204 if (_entity != SALOME_MED::MED_NONE)
206 _seqLength = _subMeshDS->NbNodes();
211 MESSAGE("Only Node Families are implemented ");
212 THROW_SALOME_CORBA_EXCEPTION("Not implemented Yet ",
218 _isOnAllElements = (_seqLength == _meshDS->NbNodes());
222 MESSAGE("unable to acces related Mesh");
223 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
224 SALOME::INTERNAL_ERROR);
226 return _isOnAllElements;
229 //=============================================================================
231 * CORBA: Accessor for type of support's entity
233 //=============================================================================
235 SALOME_MED::medEntityMesh SMESH_MEDSupport_i::getEntity()throw(SALOME::
238 if (_subMeshDS==NULL)
239 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
240 SALOME::INTERNAL_ERROR);
244 //=============================================================================
246 * CORBA: Accessor for types of geometry elements
248 //=============================================================================
250 SALOME_MED::medGeometryElement_array *
251 SMESH_MEDSupport_i::getTypes()throw(SALOME::SALOME_Exception)
253 if (_subMeshDS==NULL)
254 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
255 SALOME::INTERNAL_ERROR);
256 SALOME_MED::medGeometryElement_array_var myseq =
257 new SALOME_MED::medGeometryElement_array;
260 int mySeqLength = _numberOfGeometricType;
261 myseq->length(mySeqLength);
262 for (int i = 0; i < mySeqLength; i++)
264 myseq[i] = _geometricType[i];
269 MESSAGE("Exception lors de la recherche des differents types");
270 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support Types",
271 SALOME::INTERNAL_ERROR);
273 return myseq._retn();
276 //=============================================================================
278 * CORBA: Number of different types of geometry elements
279 * existing in the support
281 //=============================================================================
282 CORBA::Long SMESH_MEDSupport_i::getNumberOfElements(SALOME_MED::
283 medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
285 if (_subMeshDS==NULL)
286 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
287 SALOME::INTERNAL_ERROR);
288 return _numberOfGeometricType;
292 //=============================================================================
296 //=============================================================================
298 SALOME_MED::long_array * SMESH_MEDSupport_i::getNumber(
299 SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
301 Unexpect aCatch(SALOME_SalomeException);
302 if (_subMeshDS==NULL)
303 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
304 SALOME::INTERNAL_ERROR);
306 // A changer s'il ne s agit plus seulement de famille de noeuds
307 if (geomElement != SALOME_MED::MED_NONE)
308 THROW_SALOME_CORBA_EXCEPTION("Not implemented", SALOME::BAD_PARAM);
310 SALOME_MED::long_array_var myseq = new SALOME_MED::long_array;
313 myseq->length(_subMeshDS->NbNodes());
315 SMDS_NodeIteratorPtr it = _subMeshDS->GetNodes();
318 myseq[i] = it->next()->GetID();
322 SCRUTE(myseq->length());
323 MESSAGE("End of SMESH_MEDSupport_i::getNumber");
324 return myseq._retn();
328 //=============================================================================
330 * CORBA: Global Nodes Index (optionnaly designed by the user)
331 * CORBA: ??????????????????????????????
333 //=============================================================================
335 SALOME_MED::long_array *
336 SMESH_MEDSupport_i::getNumberIndex()throw(SALOME::SALOME_Exception)
338 MESSAGE("Not implemented for SMESH_i");
339 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
342 //=============================================================================
344 * CORBA: Array containing indexes for elements included in the support
346 //=============================================================================
348 CORBA::Long SMESH_MEDSupport_i::getNumberOfGaussPoint(SALOME_MED::
349 medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
351 MESSAGE("Not implemented for SMESH_i");
354 //=============================================================================
356 * Gives the number of types of elements included in the support
358 //=============================================================================
359 CORBA::Long SMESH_MEDSupport_i::getNumberOfTypes()
360 throw (SALOME::SALOME_Exception)
362 MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
363 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
366 //=============================================================================
368 * Gives CORBA: Array containing the numbers of Gauss point of elements
369 * included in the support
371 //=============================================================================
372 SALOME_MED::long_array* SMESH_MEDSupport_i::getNumbersOfGaussPoint()
373 throw (SALOME::SALOME_Exception)
375 MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
376 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
379 //=============================================================================
381 * build the object which will contain all the boundary elements of the mesh.
383 //=============================================================================
384 void SMESH_MEDSupport_i::getBoundaryElements()
385 throw (SALOME::SALOME_Exception)
387 MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
388 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
390 //=============================================================================
392 * Gives information on the support
394 //=============================================================================
395 SALOME_MED::SUPPORT::supportInfos * SMESH_MEDSupport_i::getSupportGlobal()
396 throw (SALOME::SALOME_Exception)
398 MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
399 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);