Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "SMESH_MEDSupport_i.hxx"
00028 #include "utilities.h"
00029 #include "Utils_CorbaException.hxx"
00030 #include "Utils_ExceptHandlers.hxx"
00031
00032 #include <TopoDS_Iterator.hxx>
00033 #include "SMESHDS_Mesh.hxx"
00034
00035 #include "SMESH_subMesh.hxx"
00036 #include "SMESH_Mesh_i.hxx"
00037 #include "SMESH_subMesh_i.hxx"
00038
00039 using namespace std;
00040
00041
00042
00046
00047 SMESH_MEDSupport_i::SMESH_MEDSupport_i()
00048 {
00049 BEGIN_OF("Default Constructor SMESH_MEDSupport_i");
00050 END_OF("Default Constructor SMESH_MEDSupport_i");
00051 }
00052
00053
00057
00058 SMESH_MEDSupport_i::SMESH_MEDSupport_i(SMESH_subMesh_i * sm, string name,
00059 string description, SALOME_MED::medEntityMesh entity)
00060 :_subMesh_i(sm), _name(name), _description(description), _entity(entity),
00061 _seqNumber(false), _seqLength(0)
00062 {
00063 BEGIN_OF("Constructor SMESH_MEDSupport_i");
00064
00065 _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS();
00066
00067 int subMeshId = _subMesh_i->GetId();
00068
00069 MESSAGE(" subMeshId " << subMeshId)
00070
00071 if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) !=
00072 _subMesh_i->_mesh_i->_mapSubMesh.end())
00073 {
00074 ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId];
00075 _subMeshDS = subMesh->GetSubMeshDS();
00076 }
00077
00078 if (_entity == SALOME_MED::MED_NODE)
00079 {
00080 _numberOfGeometricType = 1;
00081 _geometricType = new SALOME_MED::medGeometryElement[1];
00082 _geometricType[0] = SALOME_MED::MED_NONE;
00083 }
00084 else
00085 {
00086 MESSAGE("Pas implemente dans cette version");
00087 THROW_SALOME_CORBA_EXCEPTION
00088 ("Seules les familles de noeuds sont implementees ",
00089 SALOME::BAD_PARAM);
00090 }
00091
00092 END_OF("Constructor SMESH_MEDSupport_i");
00093 }
00094
00095
00099
00100 SMESH_MEDSupport_i::
00101 SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s):_subMesh_i(s._subMesh_i),
00102 _name(s._name), _description(s._description), _entity(s._entity),
00103 _seqNumber(false), _seqLength(0)
00104 {
00105 BEGIN_OF("Constructor SMESH_MEDSupport_i");
00106
00107 _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS();
00108
00109 int subMeshId = _subMesh_i->GetId();
00110 if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) !=
00111 _subMesh_i->_mesh_i->_mapSubMesh.end())
00112 {
00113 ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId];
00114 _subMeshDS = subMesh->GetSubMeshDS();
00115 }
00116
00117 END_OF("Constructor SMESH_MEDSupport_i");
00118 }
00119
00120
00124
00125
00126 SMESH_MEDSupport_i::~SMESH_MEDSupport_i()
00127 {
00128 }
00129
00130
00134
00135
00136 CORBA::Long SMESH_MEDSupport_i::getCorbaIndex()throw(SALOME::SALOME_Exception)
00137 {
00138 if (_subMeshDS == NULL)
00139 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
00140 SALOME::INTERNAL_ERROR);
00141 MESSAGE("Not implemented for SMESH_i");
00142 THROW_SALOME_CORBA_EXCEPTION("Not Implemented ", SALOME::BAD_PARAM);
00143
00144 }
00145
00146
00150
00151
00152 char *SMESH_MEDSupport_i::getName() throw(SALOME::SALOME_Exception)
00153 {
00154 if (_subMeshDS==NULL)
00155 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
00156 SALOME::INTERNAL_ERROR);
00157 return CORBA::string_dup(_name.c_str());
00158
00159 }
00160
00161
00165
00166
00167 char *SMESH_MEDSupport_i::getDescription() throw(SALOME::SALOME_Exception)
00168 {
00169 if (_subMeshDS==NULL)
00170 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
00171 SALOME::INTERNAL_ERROR);
00172 return CORBA::string_dup(_description.c_str());
00173 }
00174
00175
00179
00180
00181 SALOME_MED::GMESH_ptr SMESH_MEDSupport_i::getMesh()throw(SALOME::
00182 SALOME_Exception)
00183 {
00184 if (_subMeshDS==NULL)
00185 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
00186 SALOME::INTERNAL_ERROR);
00187
00188 return _subMesh_i->_mesh_i->GetMEDMesh();
00189 }
00190
00191
00195
00196
00197 CORBA::Boolean SMESH_MEDSupport_i::isOnAllElements()throw(SALOME::
00198 SALOME_Exception)
00199 {
00200 if (_subMeshDS==NULL)
00201 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
00202 SALOME::INTERNAL_ERROR);
00203 if (_seqNumber == false)
00204 {
00205 if (_entity != SALOME_MED::MED_NONE)
00206 {
00207 _seqLength = _subMeshDS->NbNodes();
00208 _seqNumber = true;
00209 }
00210 else
00211 {
00212 MESSAGE("Only Node Families are implemented ");
00213 THROW_SALOME_CORBA_EXCEPTION("Not implemented Yet ",
00214 SALOME::BAD_PARAM);
00215 }
00216 }
00217 try
00218 {
00219 _isOnAllElements = (_seqLength == _meshDS->NbNodes());
00220 }
00221 catch(...)
00222 {
00223 MESSAGE("unable to acces related Mesh");
00224 THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
00225 SALOME::INTERNAL_ERROR);
00226 };
00227 return _isOnAllElements;
00228 }
00229
00230
00234
00235
00236 SALOME_MED::medEntityMesh SMESH_MEDSupport_i::getEntity()throw(SALOME::
00237 SALOME_Exception)
00238 {
00239 if (_subMeshDS==NULL)
00240 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
00241 SALOME::INTERNAL_ERROR);
00242 return _entity;
00243 }
00244
00245
00249
00250
00251 SALOME_MED::medGeometryElement_array *
00252 SMESH_MEDSupport_i::getTypes()throw(SALOME::SALOME_Exception)
00253 {
00254 if (_subMeshDS==NULL)
00255 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
00256 SALOME::INTERNAL_ERROR);
00257 SALOME_MED::medGeometryElement_array_var myseq =
00258 new SALOME_MED::medGeometryElement_array;
00259 try
00260 {
00261 int mySeqLength = _numberOfGeometricType;
00262 myseq->length(mySeqLength);
00263 for (int i = 0; i < mySeqLength; i++)
00264 {
00265 myseq[i] = _geometricType[i];
00266 }
00267 }
00268 catch(...)
00269 {
00270 MESSAGE("Exception lors de la recherche des differents types");
00271 THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support Types",
00272 SALOME::INTERNAL_ERROR);
00273 }
00274 return myseq._retn();
00275 }
00276
00277
00282
00283 CORBA::Long SMESH_MEDSupport_i::getNumberOfElements(SALOME_MED::
00284 medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
00285 {
00286 if (_subMeshDS==NULL)
00287 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
00288 SALOME::INTERNAL_ERROR);
00289 return _numberOfGeometricType;
00290
00291 }
00292
00293
00297
00298
00299 SALOME_TYPES::ListOfLong * SMESH_MEDSupport_i::getNumber(
00300 SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
00301 {
00302 Unexpect aCatch(SALOME_SalomeException);
00303 if (_subMeshDS==NULL)
00304 THROW_SALOME_CORBA_EXCEPTION("No associated Support",
00305 SALOME::INTERNAL_ERROR);
00306
00307
00308 if (geomElement != SALOME_MED::MED_NONE)
00309 THROW_SALOME_CORBA_EXCEPTION("Not implemented", SALOME::BAD_PARAM);
00310
00311 SALOME_TYPES::ListOfLong_var myseq = new SALOME_TYPES::ListOfLong;
00312
00313 int i = 0;
00314 myseq->length(_subMeshDS->NbNodes());
00315
00316 SMDS_NodeIteratorPtr it = _subMeshDS->GetNodes();
00317 while(it->more())
00318 {
00319 myseq[i] = it->next()->GetID();
00320 i++;
00321 };
00322
00323 SCRUTE(myseq->length());
00324 MESSAGE("End of SMESH_MEDSupport_i::getNumber");
00325 return myseq._retn();
00326
00327 }
00328
00329
00333
00334
00335 SALOME_TYPES::ListOfLong * SMESH_MEDSupport_i::getNumberFromFile(
00336 SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
00337 {
00338 return getNumber(geomElement);
00339 }
00340
00341
00346
00347
00348 SALOME_TYPES::ListOfLong *
00349 SMESH_MEDSupport_i::getNumberIndex()throw(SALOME::SALOME_Exception)
00350 {
00351 MESSAGE("Not implemented for SMESH_i");
00352 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
00353 return NULL;
00354 }
00355
00359
00360
00361 CORBA::Long SMESH_MEDSupport_i::getNumberOfGaussPoint(SALOME_MED::
00362 medGeometryElement geomElement) throw(SALOME::SALOME_Exception)
00363 {
00364 MESSAGE("Not implemented for SMESH_i");
00365 return 0;
00366 }
00367
00371
00372 CORBA::Long SMESH_MEDSupport_i::getNumberOfTypes()
00373 throw (SALOME::SALOME_Exception)
00374 {
00375 MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
00376 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
00377 return 0;
00378 }
00379
00384
00385 SALOME_TYPES::ListOfLong* SMESH_MEDSupport_i::getNumbersOfGaussPoint()
00386 throw (SALOME::SALOME_Exception)
00387 {
00388 MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
00389 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
00390 return NULL;
00391 }
00392
00396
00397 void SMESH_MEDSupport_i::getBoundaryElements()
00398 throw (SALOME::SALOME_Exception)
00399 {
00400 MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
00401 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
00402 }
00403
00407
00408 SALOME_MED::SUPPORT::supportInfos * SMESH_MEDSupport_i::getSupportGlobal()
00409 throw (SALOME::SALOME_Exception)
00410 {
00411 MESSAGE("!!! NOT YET IMPLEMENTED !!!!");
00412 THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM);
00413 return NULL;
00414 }