X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESH_I%2FSMESH_MEDSupport_i.cxx;h=7b9b8f255edf2382f40ac17f4db20abdb9db2b5f;hp=23754e1f3adb0dd4a31ec2adc6c3a9fe9bb923c5;hb=dd138f193fb5fa1d7339e62de896c4913485afca;hpb=fb91f8b9075475d655d351cd580d270aa50762b6 diff --git a/src/SMESH_I/SMESH_MEDSupport_i.cxx b/src/SMESH_I/SMESH_MEDSupport_i.cxx index 23754e1f3..7b9b8f255 100644 --- a/src/SMESH_I/SMESH_MEDSupport_i.cxx +++ b/src/SMESH_I/SMESH_MEDSupport_i.cxx @@ -31,7 +31,6 @@ using namespace std; #include #include "SMESHDS_Mesh.hxx" -#include "SMDS_MapIteratorOfExtendedMap.hxx" #include "SMESH_subMesh.hxx" #include "SMESH_Mesh_i.hxx" @@ -44,8 +43,8 @@ using namespace std; //============================================================================= SMESH_MEDSupport_i::SMESH_MEDSupport_i() { - BEGIN_OF("Default Constructor SMESH_MEDSupport_i"); - END_OF("Default Constructor SMESH_MEDSupport_i"); + BEGIN_OF("Default Constructor SMESH_MEDSupport_i"); + END_OF("Default Constructor SMESH_MEDSupport_i"); } //============================================================================= @@ -53,70 +52,68 @@ SMESH_MEDSupport_i::SMESH_MEDSupport_i() * Constructor */ //============================================================================= -SMESH_MEDSupport_i::SMESH_MEDSupport_i(SMESH_subMesh_i* sm, - string name, - string description, - SALOME_MED::medEntityMesh entity) : - _subMesh_i(sm), - _name(name), - _description(description), - _entity(entity), - _seqNumber(false), - _seqLength(0) +SMESH_MEDSupport_i::SMESH_MEDSupport_i(SMESH_subMesh_i * sm, string name, + string description, SALOME_MED::medEntityMesh entity) + :_subMesh_i(sm), _name(name), _description(description), _entity(entity), + _seqNumber(false), _seqLength(0) { - BEGIN_OF("Constructor SMESH_MEDSupport_i"); - - _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS(); - - int subMeshId = _subMesh_i->GetId(); - - MESSAGE ( " subMeshId " << subMeshId ) - if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) != _subMesh_i->_mesh_i->_mapSubMesh.end()) { - ::SMESH_subMesh* subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId]; - - _subMeshDS = subMesh->GetSubMeshDS(); - } - - if ( _entity == SALOME_MED::MED_NODE) - { - _numberOfGeometricType = 1 ; - _geometricType = new SALOME_MED::medGeometryElement[1] ; - _geometricType[0] = SALOME_MED::MED_NONE ; - } - else - { - MESSAGE("Pas implemente dans cette version"); - THROW_SALOME_CORBA_EXCEPTION("Seules les familles de noeuds sont implementees ", \ - SALOME::BAD_PARAM); - } - - END_OF("Constructor SMESH_MEDSupport_i"); + BEGIN_OF("Constructor SMESH_MEDSupport_i"); + + _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS(); + + int subMeshId = _subMesh_i->GetId(); + + MESSAGE(" subMeshId " << subMeshId) + + if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) != + _subMesh_i->_mesh_i->_mapSubMesh.end()) + { + ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId]; + _subMeshDS = subMesh->GetSubMeshDS(); + } + + if (_entity == SALOME_MED::MED_NODE) + { + _numberOfGeometricType = 1; + _geometricType = new SALOME_MED::medGeometryElement[1]; + _geometricType[0] = SALOME_MED::MED_NONE; + } + else + { + MESSAGE("Pas implemente dans cette version"); + THROW_SALOME_CORBA_EXCEPTION + ("Seules les familles de noeuds sont implementees ", + SALOME::BAD_PARAM); + } + + END_OF("Constructor SMESH_MEDSupport_i"); } + //============================================================================= /*! * Constructor */ //============================================================================= -SMESH_MEDSupport_i::SMESH_MEDSupport_i(const SMESH_MEDSupport_i &s) : - _subMesh_i(s._subMesh_i), - _name(s._name), - _description(s._description), - _entity(s._entity), - _seqNumber(false), - _seqLength(0) +SMESH_MEDSupport_i:: +SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s):_subMesh_i(s._subMesh_i), +_name(s._name), _description(s._description), _entity(s._entity), +_seqNumber(false), _seqLength(0) { - BEGIN_OF("Constructor SMESH_MEDSupport_i"); + BEGIN_OF("Constructor SMESH_MEDSupport_i"); - _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS(); + _meshDS = _subMesh_i->_mesh_i->GetImpl().GetMeshDS(); - int subMeshId = _subMesh_i->GetId(); - if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) != _subMesh_i->_mesh_i->_mapSubMesh.end()) { - ::SMESH_subMesh* subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId]; - _subMeshDS = subMesh->GetSubMeshDS(); - } + int subMeshId = _subMesh_i->GetId(); + if (_subMesh_i->_mesh_i->_mapSubMesh.find(subMeshId) != + _subMesh_i->_mesh_i->_mapSubMesh.end()) + { + ::SMESH_subMesh * subMesh = _subMesh_i->_mesh_i->_mapSubMesh[subMeshId]; + _subMeshDS = subMesh->GetSubMeshDS(); + } - END_OF("Constructor SMESH_MEDSupport_i"); + END_OF("Constructor SMESH_MEDSupport_i"); } + //============================================================================= /*! * Destructor @@ -126,21 +123,20 @@ SMESH_MEDSupport_i::SMESH_MEDSupport_i(const SMESH_MEDSupport_i &s) : SMESH_MEDSupport_i::~SMESH_MEDSupport_i() { } + //============================================================================= /*! * CORBA: Accessor for Corba Index */ //============================================================================= -CORBA::Long SMESH_MEDSupport_i::getCorbaIndex() - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_MEDSupport_i::getCorbaIndex()throw(SALOME::SALOME_Exception) { - if (_subMeshDS==NULL) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ - SALOME::INTERNAL_ERROR); - MESSAGE("Not implemented for SMESH_i"); - THROW_SALOME_CORBA_EXCEPTION("Not Implemented ", \ - SALOME::BAD_PARAM); + if (_subMeshDS == NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); + MESSAGE("Not implemented for SMESH_i"); + THROW_SALOME_CORBA_EXCEPTION("Not Implemented ", SALOME::BAD_PARAM); } @@ -150,13 +146,12 @@ CORBA::Long SMESH_MEDSupport_i::getCorbaIndex() */ //============================================================================= -char * SMESH_MEDSupport_i::getName() - throw (SALOME::SALOME_Exception) +char *SMESH_MEDSupport_i::getName() throw(SALOME::SALOME_Exception) { - if (_subMeshDS.IsNull()) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ - SALOME::INTERNAL_ERROR); - return CORBA::string_dup(_name.c_str()); + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); + return CORBA::string_dup(_name.c_str()); } @@ -166,13 +161,12 @@ char * SMESH_MEDSupport_i::getName() */ //============================================================================= -char* SMESH_MEDSupport_i::getDescription() - throw (SALOME::SALOME_Exception) +char *SMESH_MEDSupport_i::getDescription() throw(SALOME::SALOME_Exception) { - if (_subMeshDS.IsNull()) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ - SALOME::INTERNAL_ERROR); - return CORBA::string_dup(_description.c_str()); + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); + return CORBA::string_dup(_description.c_str()); } //============================================================================= @@ -181,14 +175,14 @@ char* SMESH_MEDSupport_i::getDescription() */ //============================================================================= -SALOME_MED::MESH_ptr SMESH_MEDSupport_i::getMesh() - throw (SALOME::SALOME_Exception) +SALOME_MED::MESH_ptr SMESH_MEDSupport_i::getMesh()throw(SALOME:: + SALOME_Exception) { - if (_subMeshDS.IsNull()) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ - SALOME::INTERNAL_ERROR); - - return _subMesh_i->_mesh_i->GetMEDMesh(); + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); + + return _subMesh_i->_mesh_i->GetMEDMesh(); } //============================================================================= @@ -197,48 +191,37 @@ SALOME_MED::MESH_ptr SMESH_MEDSupport_i::getMesh() */ //============================================================================= -CORBA::Boolean SMESH_MEDSupport_i::isOnAllElements() - throw (SALOME::SALOME_Exception) +CORBA::Boolean SMESH_MEDSupport_i::isOnAllElements()throw(SALOME:: + SALOME_Exception) { - if (_subMeshDS.IsNull()) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ - SALOME::INTERNAL_ERROR); - if (_seqNumber == false) - { - if (_entity != SALOME_MED::MED_NONE) - { - int i = 0; - const SMDS_MapOfMeshElement& myNodesMap = _subMeshDS->GetNodes(); - for (SMDS_MapIteratorOfExtendedMap it(myNodesMap); it.More(); it.Next()) - { - const Handle(SMDS_MeshElement)& elem = myNodesMap.FindID(it.Key()->GetID()); - const Handle(SMDS_MeshNode)& node = _meshDS->GetNode(1,elem); - i ++; + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); + if (_seqNumber == false) + { + if (_entity != SALOME_MED::MED_NONE) + { + _seqLength = _subMeshDS->NbNodes(); + _seqNumber = true; + } + else + { + MESSAGE("Only Node Families are implemented "); + THROW_SALOME_CORBA_EXCEPTION("Not implemented Yet ", + SALOME::BAD_PARAM); + } + } + try + { + _isOnAllElements = (_seqLength == _meshDS->NbNodes()); } - _seqLength=i; - _seqNumber=true; - } - else - { - MESSAGE("Only Node Families are implemented "); - THROW_SALOME_CORBA_EXCEPTION("Not implemented Yet ", \ - SALOME::BAD_PARAM); - } - } - try - { - if (_seqLength == _meshDS->NbNodes()) - _isOnAllElements=true; - else - _isOnAllElements=false; - } - catch(...) - { - MESSAGE("unable to acces related Mesh"); - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - }; - return _isOnAllElements; + catch(...) + { + MESSAGE("unable to acces related Mesh"); + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + }; + return _isOnAllElements; } //============================================================================= @@ -247,13 +230,13 @@ CORBA::Boolean SMESH_MEDSupport_i::isOnAllElements() */ //============================================================================= -SALOME_MED::medEntityMesh SMESH_MEDSupport_i::getEntity() - throw (SALOME::SALOME_Exception) +SALOME_MED::medEntityMesh SMESH_MEDSupport_i::getEntity()throw(SALOME:: + SALOME_Exception) { - if (_subMeshDS.IsNull()) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ - SALOME::INTERNAL_ERROR); - return _entity; + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); + return _entity; } //============================================================================= @@ -262,29 +245,30 @@ SALOME_MED::medEntityMesh SMESH_MEDSupport_i::getEntity() */ //============================================================================= -SALOME_MED::medGeometryElement_array * SMESH_MEDSupport_i::getTypes() - throw (SALOME::SALOME_Exception) +SALOME_MED::medGeometryElement_array * + SMESH_MEDSupport_i::getTypes()throw(SALOME::SALOME_Exception) { - if (_subMeshDS.IsNull()) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ - SALOME::INTERNAL_ERROR); - SALOME_MED::medGeometryElement_array_var myseq = new SALOME_MED::medGeometryElement_array; - try - { - int mySeqLength = _numberOfGeometricType; - myseq->length(mySeqLength); - for (int i=0;ilength(mySeqLength); + for (int i = 0; i < mySeqLength; i++) + { + myseq[i] = _geometricType[i]; + } + } + catch(...) { - myseq[i]=_geometricType[i]; + MESSAGE("Exception lors de la recherche des differents types"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support Types", + SALOME::INTERNAL_ERROR); } - } - catch(...) - { - MESSAGE("Exception lors de la recherche des differents types"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support Types", \ - SALOME::INTERNAL_ERROR); - } - return myseq._retn(); + return myseq._retn(); } //============================================================================= @@ -293,13 +277,13 @@ SALOME_MED::medGeometryElement_array * SMESH_MEDSupport_i::getTypes() * existing in the support */ //============================================================================= -CORBA::Long SMESH_MEDSupport_i::getNumberOfElements(SALOME_MED::medGeometryElement geomElement) - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_MEDSupport_i::getNumberOfElements(SALOME_MED:: + medGeometryElement geomElement) throw(SALOME::SALOME_Exception) { - if (_subMeshDS.IsNull()) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ - SALOME::INTERNAL_ERROR); - return _numberOfGeometricType; + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); + return _numberOfGeometricType; } @@ -309,39 +293,38 @@ CORBA::Long SMESH_MEDSupport_i::getNumberOfElements(SALOME_MED::medGeometryEleme */ //============================================================================= -Engines::long_array * SMESH_MEDSupport_i::getNumber(SALOME_MED::medGeometryElement geomElement) - throw (SALOME::SALOME_Exception) +Engines::long_array * SMESH_MEDSupport_i::getNumber( + SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception) { - if (_subMeshDS.IsNull()) - THROW_SALOME_CORBA_EXCEPTION("No associated Support", \ - SALOME::INTERNAL_ERROR); - - - // A changer s'il ne s agit plus seulement de famille de noeuds - if (geomElement != SALOME_MED::MED_NONE) - THROW_SALOME_CORBA_EXCEPTION("Not implemented", \ - SALOME::BAD_PARAM); - - Engines::long_array_var myseq= new Engines::long_array; - - int i =0; - const SMDS_MapOfMeshElement& myNodesMap = _subMeshDS->GetNodes(); - for (SMDS_MapIteratorOfExtendedMap it(myNodesMap); it.More(); it.Next()) - { - const Handle(SMDS_MeshElement)& elem = myNodesMap.FindID(it.Key()->GetID()); - const Handle(SMDS_MeshNode)& node = _meshDS->GetNode(1,elem); - myseq->length(i+1); - myseq[i]=node->GetID(); -SCRUTE(node->GetID()); -SCRUTE(myseq[i]); - i++; - }; - -SCRUTE(myseq->length()); -MESSAGE("yyyyy"); - return myseq._retn(); - + if (_subMeshDS==NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Support", + SALOME::INTERNAL_ERROR); + + // A changer s'il ne s agit plus seulement de famille de noeuds + if (geomElement != SALOME_MED::MED_NONE) + THROW_SALOME_CORBA_EXCEPTION("Not implemented", SALOME::BAD_PARAM); + + Engines::long_array_var myseq = new Engines::long_array; + + int i = 0; + myseq->length(_subMeshDS->NbNodes()); + const set & myNodesMap = _subMeshDS->GetNodes(); + set::const_iterator it=myNodesMap.begin(); + + for (; it!=myNodesMap.end(); it++) + { + myseq[i] = (*it)->GetID(); + SCRUTE((*it)->GetID()); + SCRUTE(myseq[i]); + i++; + }; + + SCRUTE(myseq->length()); + MESSAGE("End of SMESH_MEDSupport_i::getNumber"); + return myseq._retn(); + } + //============================================================================= /*! * CORBA: Global Nodes Index (optionnaly designed by the user) @@ -349,13 +332,12 @@ MESSAGE("yyyyy"); */ //============================================================================= -Engines::long_array * SMESH_MEDSupport_i::getNumberIndex() - throw (SALOME::SALOME_Exception) +Engines::long_array * + SMESH_MEDSupport_i::getNumberIndex()throw(SALOME::SALOME_Exception) { - MESSAGE("Not implemented for SMESH_i"); - THROW_SALOME_CORBA_EXCEPTION("Not Implemented", \ - SALOME::BAD_PARAM); - return 0; + MESSAGE("Not implemented for SMESH_i"); + THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM); + return 0; } //============================================================================= @@ -364,10 +346,9 @@ Engines::long_array * SMESH_MEDSupport_i::getNumberIndex() */ //============================================================================= -CORBA::Long SMESH_MEDSupport_i::getNumberOfGaussPoints(SALOME_MED::medGeometryElement geomElement) - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_MEDSupport_i::getNumberOfGaussPoints(SALOME_MED:: + medGeometryElement geomElement) throw(SALOME::SALOME_Exception) { - MESSAGE("Not implemented for SMESH_i"); - return 0; + MESSAGE("Not implemented for SMESH_i"); + return 0; } -