From dd138f193fb5fa1d7339e62de896c4913485afca Mon Sep 17 00:00:00 2001 From: jrt Date: Thu, 4 Sep 2003 10:41:22 +0000 Subject: [PATCH] Update to match the new implementation of SMDS --- src/SMESH_I/SMESH_Gen_i.cxx | 4 +- src/SMESH_I/SMESH_MEDMesh_i.cxx | 1309 ++++++++++++++-------------- src/SMESH_I/SMESH_MEDMesh_i.hxx | 220 +++-- src/SMESH_I/SMESH_MEDSupport_i.cxx | 353 ++++---- src/SMESH_I/SMESH_MEDSupport_i.hxx | 130 ++- src/SMESH_I/SMESH_MeshEditor_i.cxx | 245 +++--- src/SMESH_I/SMESH_MeshEditor_i.hxx | 35 +- src/SMESH_I/SMESH_Mesh_i.cxx | 756 ++++++++-------- 8 files changed, 1479 insertions(+), 1573 deletions(-) diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 1594966ef..fa5152ed2 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -571,7 +571,7 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, int meshId = myMesh->GetId(); SMESH_Mesh_i* meshServant = myStudyContext->mapMesh_i[meshId]; ::SMESH_Mesh& myLocMesh = meshServant->GetImpl(); - Handle(SMESHDS_Mesh) mySMESHDSMesh = myLocMesh.GetMeshDS(); + SMESHDS_Mesh* mySMESHDSMesh = myLocMesh.GetMeshDS(); SCRUTE(mySMESHDSMesh->NbNodes()); if (mySMESHDSMesh->NbNodes()>0) {//checks if the mesh is not empty @@ -1136,7 +1136,7 @@ bool SMESH_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, int meshId = myNewMesh->GetId(); SMESH_Mesh_i* meshServant = myStudyContext->mapMesh_i[meshId]; ::SMESH_Mesh& myLocMesh = meshServant->GetImpl(); - Handle(SMESHDS_Mesh) mySMESHDSMesh = myLocMesh.GetMeshDS(); + SMESHDS_Mesh* mySMESHDSMesh = myLocMesh.GetMeshDS(); DriverMED_R_SMESHDS_Mesh* myReader = new DriverMED_R_SMESHDS_Mesh; diff --git a/src/SMESH_I/SMESH_MEDMesh_i.cxx b/src/SMESH_I/SMESH_MEDMesh_i.cxx index 807c20ae7..71fc85c08 100644 --- a/src/SMESH_I/SMESH_MEDMesh_i.cxx +++ b/src/SMESH_I/SMESH_MEDMesh_i.cxx @@ -31,9 +31,6 @@ using namespace std; #include "SMESHDS_Mesh.hxx" #include "SMESHDS_SubMesh.hxx" -#include "SMDS_MapIteratorOfExtendedMap.hxx" -#include "SMDS_MapOfMeshElement.hxx" - #include #include #include @@ -62,7 +59,6 @@ extern "C" #include } - //============================================================================= /*! * Default constructor @@ -71,9 +67,10 @@ extern "C" // PN Est-ce un const ? SMESH_MEDMesh_i::SMESH_MEDMesh_i() { - BEGIN_OF("Default Constructor SMESH_MEDMesh_i"); - END_OF("Default Constructor SMESH_MEDMesh_i"); + BEGIN_OF("Default Constructor SMESH_MEDMesh_i"); + END_OF("Default Constructor SMESH_MEDMesh_i"); } + //============================================================================= /*! * Destructor @@ -82,23 +79,21 @@ SMESH_MEDMesh_i::SMESH_MEDMesh_i() SMESH_MEDMesh_i::~SMESH_MEDMesh_i() { } + //============================================================================= /*! * Constructor */ //============================================================================= -SMESH_MEDMesh_i::SMESH_MEDMesh_i( ::SMESH_Mesh_i* m_i ) :_meshId(""), - _compte(false), - _creeFamily(false), - _famIdent(0), - _indexElts(0), - _indexEnts(0) +SMESH_MEDMesh_i::SMESH_MEDMesh_i(::SMESH_Mesh_i * m_i):_meshId(""), +_compte(false), +_creeFamily(false), _famIdent(0), _indexElts(0), _indexEnts(0) { - _mesh_i = m_i; - _meshDS = _mesh_i->GetImpl().GetMeshDS(); + _mesh_i = m_i; + _meshDS = _mesh_i->GetImpl().GetMeshDS(); - BEGIN_OF("Constructor SMESH_MEDMesh_i"); - END_OF("Constructor SMESH_MEDMesh_i"); + BEGIN_OF("Constructor SMESH_MEDMesh_i"); + END_OF("Constructor SMESH_MEDMesh_i"); } //============================================================================= @@ -106,257 +101,259 @@ SMESH_MEDMesh_i::SMESH_MEDMesh_i( ::SMESH_Mesh_i* m_i ) :_meshId(""), * CORBA: Accessor for Name */ //============================================================================= -char * SMESH_MEDMesh_i::getName() - throw (SALOME::SALOME_Exception) +char *SMESH_MEDMesh_i::getName() throw(SALOME::SALOME_Exception) { - if (_meshDS == NULL) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); + if (_meshDS == NULL) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); - try - { - // A COMPLETER PAR LE NOM DU MAILLAGE - //return CORBA::string_dup(_mesh_i->getName().c_str()); - return CORBA::string_dup("toto"); - } - catch(...) - { - MESSAGE("Exception en accedant au nom"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ - ,SALOME::INTERNAL_ERROR); - } + try + { + // A COMPLETER PAR LE NOM DU MAILLAGE + //return CORBA::string_dup(_mesh_i->getName().c_str()); + return CORBA::string_dup("toto"); + } + catch(...) + { + MESSAGE("Exception en accedant au nom"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } } + //============================================================================= /*! * CORBA: Accessor for corbaindex cuisine interne */ //============================================================================= -CORBA::Long SMESH_MEDMesh_i::getCorbaIndex() - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_MEDMesh_i::getCorbaIndex()throw(SALOME::SALOME_Exception) { - MESSAGE("Non Implemente"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ - ,SALOME::BAD_PARAM); + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); } + //============================================================================= /*! * CORBA: Accessor for Space Dimension */ //============================================================================= -CORBA::Long SMESH_MEDMesh_i::getSpaceDimension() - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_MEDMesh_i::getSpaceDimension()throw(SALOME::SALOME_Exception) { - // PN : Il semblerait que la dimension soit fixee a 3 - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - return 3; + // PN : Il semblerait que la dimension soit fixee a 3 + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + return 3; } + //============================================================================= /*! * CORBA: Accessor for Mesh Dimension */ //============================================================================= -CORBA::Long SMESH_MEDMesh_i::getMeshDimension() - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_MEDMesh_i::getMeshDimension()throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - // PN : Il semblerait que la dimension soit fixee a 3 - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - return 3; + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + // PN : Il semblerait que la dimension soit fixee a 3 + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + return 3; } + //============================================================================= /*! * CORBA: Accessor for Coordinates System */ //============================================================================= -char * SMESH_MEDMesh_i::getCoordinateSystem() - throw (SALOME::SALOME_Exception) +char *SMESH_MEDMesh_i::getCoordinateSystem() throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - // PN : En dur. Non encore prevu - try - { - string systcoo="CARTESIEN"; - return CORBA::string_dup(systcoo.c_str()); - } - catch(...) - { - MESSAGE("Exception en accedant au maillage"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ - ,SALOME::INTERNAL_ERROR); - } + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + // PN : En dur. Non encore prevu + try + { + string systcoo = "CARTESIEN"; + return CORBA::string_dup(systcoo.c_str()); + } + catch(...) + { + MESSAGE("Exception en accedant au maillage"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } } + //============================================================================= /*! * CORBA: Accessor for Coordinates */ //============================================================================= -Engines::double_array * SMESH_MEDMesh_i::getCoordinates(SALOME_MED::medModeSwitch typeSwitch) - throw (SALOME::SALOME_Exception) +Engines::double_array * SMESH_MEDMesh_i::getCoordinates( + SALOME_MED::medModeSwitch typeSwitch) throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - Engines::double_array_var myseq = new Engines::double_array; - try - { - // PN : En dur - int spaceDimension=3; - int nbNodes=_meshDS->NbNodes(); - SCRUTE(nbNodes); - myseq->length(nbNodes*spaceDimension); - int i = 0; - SMDS_MeshNodesIterator itNodes(_meshDS); - for (;itNodes.More();itNodes.Next()) + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + Engines::double_array_var myseq = new Engines::double_array; + try { + // PN : En dur + int spaceDimension = 3; + int nbNodes = _meshDS->NbNodes(); + SCRUTE(nbNodes); + myseq->length(nbNodes * spaceDimension); + int i = 0; - const Handle(SMDS_MeshElement)& elem = itNodes.Value(); - const Handle(SMDS_MeshNode)& node =_meshDS->GetNode(1,elem); + SMDS_Iterator * itNodes=_meshDS->nodesIterator(); + while(itNodes->more()) + { + const SMDS_MeshNode* node = itNodes->next(); - if (typeSwitch == SALOME_MED::MED_FULL_INTERLACE) - { - myseq[i*3]=node->X(); - myseq[i*3+1]=node->Y(); - myseq[i*3+2]=node->Z(); - SCRUTE(myseq[i*3]); - SCRUTE(myseq[i*3+1]); - SCRUTE(myseq[i*3+2]); - } - else - { - ASSERT(typeSwitch == SALOME_MED::MED_NO_INTERLACE); - myseq[i]=node->X(); - myseq[i+nbNodes]=node->Y(); - myseq[i+(nbNodes*2)]=node->Z(); - SCRUTE(myseq[i]); - SCRUTE(myseq[i+nbNodes]); - SCRUTE(myseq[i+(nbNodes*2)]); - } - i++; + if (typeSwitch == SALOME_MED::MED_FULL_INTERLACE) + { + myseq[i * 3] = node->X(); + myseq[i * 3 + 1] = node->Y(); + myseq[i * 3 + 2] = node->Z(); + SCRUTE(myseq[i * 3]); + SCRUTE(myseq[i * 3 + 1]); + SCRUTE(myseq[i * 3 + 2]); + } + else + { + ASSERT(typeSwitch == SALOME_MED::MED_NO_INTERLACE); + myseq[i] = node->X(); + myseq[i + nbNodes] = node->Y(); + myseq[i + (nbNodes * 2)] = node->Z(); + SCRUTE(myseq[i]); + SCRUTE(myseq[i + nbNodes]); + SCRUTE(myseq[i + (nbNodes * 2)]); + } + i++; + } + delete itNodes; } - } - catch(...) - { - MESSAGE("Exception en accedant aux coordonnees"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ - ,SALOME::INTERNAL_ERROR); - } - return myseq._retn(); + catch(...) + { + MESSAGE("Exception en accedant aux coordonnees"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } + return myseq._retn(); } + //============================================================================= /*! * CORBA: Accessor for Coordinates Names */ //============================================================================= -Engines::string_array * SMESH_MEDMesh_i::getCoordinatesNames() - throw (SALOME::SALOME_Exception) +Engines::string_array * + SMESH_MEDMesh_i::getCoordinatesNames()throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - Engines::string_array_var myseq = new Engines::string_array; - try - { - // PN : en dur - int spaceDimension=3; - myseq->length(spaceDimension); - myseq[0]=CORBA::string_dup("x"); - myseq[1]=CORBA::string_dup("y"); - myseq[2]=CORBA::string_dup("z"); - } - catch(...) - { - MESSAGE("Exception en accedant aux noms des coordonnees"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ - ,SALOME::INTERNAL_ERROR); - } - return myseq._retn(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + Engines::string_array_var myseq = new Engines::string_array; + try + { + // PN : en dur + int spaceDimension = 3; + myseq->length(spaceDimension); + myseq[0] = CORBA::string_dup("x"); + myseq[1] = CORBA::string_dup("y"); + myseq[2] = CORBA::string_dup("z"); + } + catch(...) + { + MESSAGE("Exception en accedant aux noms des coordonnees"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } + return myseq._retn(); } + //============================================================================= /*! * CORBA: Accessor for Coordinates Units */ //============================================================================= -Engines::string_array * SMESH_MEDMesh_i::getCoordinatesUnits() - throw (SALOME::SALOME_Exception) +Engines::string_array * + SMESH_MEDMesh_i::getCoordinatesUnits()throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - Engines::string_array_var myseq = new Engines::string_array; - try - { - // PN : en dur - int spaceDimension=3; - myseq->length(spaceDimension); - myseq[0]=CORBA::string_dup("m"); - myseq[1]=CORBA::string_dup("m"); - myseq[2]=CORBA::string_dup("m"); - } - catch(...) - { - MESSAGE("Exception en accedant aux unites des coordonnees"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ - ,SALOME::INTERNAL_ERROR); - } - return myseq._retn(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + Engines::string_array_var myseq = new Engines::string_array; + try + { + // PN : en dur + int spaceDimension = 3; + myseq->length(spaceDimension); + myseq[0] = CORBA::string_dup("m"); + myseq[1] = CORBA::string_dup("m"); + myseq[2] = CORBA::string_dup("m"); + } + catch(...) + { + MESSAGE("Exception en accedant aux unites des coordonnees"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } + return myseq._retn(); } + //============================================================================= /*! * CORBA: Accessor for Number of Nodes */ //============================================================================= -CORBA::Long SMESH_MEDMesh_i::getNumberOfNodes() - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_MEDMesh_i::getNumberOfNodes()throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - try - { - return _meshDS->NbNodes(); - } - catch(...) - { - MESSAGE("Exception en accedant au nombre de noeuds"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ - ,SALOME::INTERNAL_ERROR); - } + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + try + { + return _meshDS->NbNodes(); + } + catch(...) + { + MESSAGE("Exception en accedant au nombre de noeuds"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } } + //============================================================================= /*! * CORBA: Accessor for number of Types */ //============================================================================= -CORBA::Long SMESH_MEDMesh_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity) - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_MEDMesh_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity) +throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - try - { - if (! _compte) - calculeNbElts(); - int retour = 0; - if ( _mapNbTypes.find(entity)!=_mapNbTypes.end()) - retour=_mapNbTypes[entity]; - return retour; - } - catch(...) - { - MESSAGE("Exception en accedant au nombre de Types"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ - ,SALOME::INTERNAL_ERROR); - } + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + try + { + if (!_compte) + calculeNbElts(); + int retour = 0; + if (_mapNbTypes.find(entity) != _mapNbTypes.end()) + retour = _mapNbTypes[entity]; + return retour; + } + catch(...) + { + MESSAGE("Exception en accedant au nombre de Types"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } } //============================================================================= @@ -365,49 +362,51 @@ CORBA::Long SMESH_MEDMesh_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity) * Not implemented for MED_ALL_ENTITIES */ //============================================================================= -SALOME_MED::medGeometryElement_array * SMESH_MEDMesh_i::getTypes (SALOME_MED::medEntityMesh entity) - throw (SALOME::SALOME_Exception) +SALOME_MED::medGeometryElement_array * + SMESH_MEDMesh_i::getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME:: + SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - if (entity ==SALOME_MED::MED_ALL_ENTITIES) - THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES",\ - SALOME::BAD_PARAM); - if (! _compte) - calculeNbElts(); - SALOME_MED::medGeometryElement_array_var myseq = - new SALOME_MED::medGeometryElement_array; - try - { - if ( _mapNbTypes.find(entity) ==_mapNbTypes.end()) - THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh"\ - ,SALOME::BAD_PARAM); - int nbTypes=_mapNbTypes[entity]; - - myseq->length(nbTypes); - - if ( _mapIndToVectTypes.find(entity) ==_mapIndToVectTypes.end()) - THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh"\ - ,SALOME::INTERNAL_ERROR); - - int index=_mapIndToVectTypes[entity]; - ASSERT( _TypesId[index].size()!=0); - int i=0; - vector::iterator it; - for (it=_TypesId[index].begin();it!=_TypesId[index].end();it++) + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + if (entity == SALOME_MED::MED_ALL_ENTITIES) + THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES", + SALOME::BAD_PARAM); + if (!_compte) + calculeNbElts(); + SALOME_MED::medGeometryElement_array_var myseq = + new SALOME_MED::medGeometryElement_array; + try { - myseq[i++]=*it; - }; - } - catch(...) - { - MESSAGE("Exception en accedant aux differents types"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ - ,SALOME::INTERNAL_ERROR); - } - return myseq._retn(); + if (_mapNbTypes.find(entity) == _mapNbTypes.end()) + THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh", + SALOME::BAD_PARAM); + int nbTypes = _mapNbTypes[entity]; + + myseq->length(nbTypes); + + if (_mapIndToVectTypes.find(entity) == _mapIndToVectTypes.end()) + THROW_SALOME_CORBA_EXCEPTION("No Such Entity in the mesh", + SALOME::INTERNAL_ERROR); + + int index = _mapIndToVectTypes[entity]; + ASSERT(_TypesId[index].size() != 0); + int i = 0; + vector < SALOME_MED::medGeometryElement >::iterator it; + for (it = _TypesId[index].begin(); it != _TypesId[index].end(); it++) + { + myseq[i++] = *it; + }; + } + catch(...) + { + MESSAGE("Exception en accedant aux differents types"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); + } + return myseq._retn(); } + //============================================================================= /*! * CORBA: Returns number of elements of type medGeometryElement @@ -418,307 +417,309 @@ SALOME_MED::medGeometryElement_array * SMESH_MEDMesh_i::getTypes (SALOME_MED::me * qui ne doit pas pouvoir avoir deux valeurs differentes pour un geomElement */ //============================================================================= -CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED::medEntityMesh entity, - SALOME_MED::medGeometryElement geomElement) - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED:: + medEntityMesh entity, + SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - if (geomElement == SALOME_MED::MED_ALL_ELEMENTS) - THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ELEMENTS", \ - SALOME::BAD_PARAM); - if (! _compte) - calculeNbElts(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + if (geomElement == SALOME_MED::MED_ALL_ELEMENTS) + THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ELEMENTS", + SALOME::BAD_PARAM); + if (!_compte) + calculeNbElts(); - try - { - int retour = 0; - if ( _mapIndToSeqElts.find(geomElement)!=_mapIndToSeqElts.end()) - { - int index = _mapIndToSeqElts[geomElement]; - retour=_seq_elemId[index]->length(); + try + { + int retour = 0; + if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end()) + { + int index = _mapIndToSeqElts[geomElement]; + retour = _seq_elemId[index]->length(); + } + return retour; + } + catch(...) + { + MESSAGE("Exception en accedant au nombre d élements"); + THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object", + SALOME::INTERNAL_ERROR); } - return retour; - } - catch(...) - { - MESSAGE("Exception en accedant au nombre d élements"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\ - ,SALOME::INTERNAL_ERROR); - } } + //============================================================================= /*! * CORBA: Accessor for connectivities */ //============================================================================= -Engines::long_array * SMESH_MEDMesh_i::getConnectivity(SALOME_MED::medModeSwitch typeSwitch, - SALOME_MED::medConnectivity mode, - SALOME_MED::medEntityMesh entity, - SALOME_MED::medGeometryElement geomElement) - throw (SALOME::SALOME_Exception) +Engines::long_array * + SMESH_MEDMesh_i::getConnectivity(SALOME_MED::medModeSwitch typeSwitch, + SALOME_MED::medConnectivity mode, SALOME_MED::medEntityMesh entity, + SALOME_MED::medGeometryElement geomElement) throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - if (mode != SALOME_MED::MED_NODAL) - THROW_SALOME_CORBA_EXCEPTION("Not Implemented",\ - SALOME::BAD_PARAM); - if (typeSwitch == SALOME_MED::MED_NO_INTERLACE) - THROW_SALOME_CORBA_EXCEPTION("Not Yet Implemented",\ - SALOME::BAD_PARAM); - if (! _compte) - calculeNbElts(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + if (mode != SALOME_MED::MED_NODAL) + THROW_SALOME_CORBA_EXCEPTION("Not Implemented", SALOME::BAD_PARAM); + if (typeSwitch == SALOME_MED::MED_NO_INTERLACE) + THROW_SALOME_CORBA_EXCEPTION("Not Yet Implemented", SALOME::BAD_PARAM); + if (!_compte) + calculeNbElts(); - // Faut-il renvoyer un pointeur vide ??? - if ( _mapIndToSeqElts.find(geomElement)!=_mapIndToSeqElts.end()) - THROW_SALOME_CORBA_EXCEPTION("No Such Element in the mesh"\ - ,SALOME::BAD_PARAM); + // Faut-il renvoyer un pointeur vide ??? + if (_mapIndToSeqElts.find(geomElement) != _mapIndToSeqElts.end()) + THROW_SALOME_CORBA_EXCEPTION("No Such Element in the mesh", + SALOME::BAD_PARAM); - int index=_mapIndToSeqElts[geomElement]; - return _seq_elemId[index]._retn(); + int index = _mapIndToSeqElts[geomElement]; + return _seq_elemId[index]._retn(); } + //============================================================================= /*! * CORBA: Accessor for connectivities */ //============================================================================= -Engines::long_array* SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode, - SALOME_MED::medEntityMesh entity) - throw (SALOME::SALOME_Exception) +Engines::long_array * + SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode, + SALOME_MED::medEntityMesh entity) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ - ,SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } + //============================================================================= /*! * CORBA: Find an element corresponding to the given connectivity */ //============================================================================= CORBA::Long SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode, - SALOME_MED::medEntityMesh entity, - SALOME_MED::medGeometryElement type, - const Engines::long_array & connectivity -) - throw (SALOME::SALOME_Exception) + SALOME_MED::medEntityMesh entity, + SALOME_MED::medGeometryElement type, + const Engines::long_array & connectivity)throw(SALOME::SALOME_Exception) { - const char * LOC = "getElementNumber "; - MESSAGE(LOC<<"Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ - ,SALOME::BAD_PARAM); - return -1; + const char *LOC = "getElementNumber "; + MESSAGE(LOC << "Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return -1; } + //============================================================================= /*! * CORBA: Accessor for Ascendant connectivities * not implemented for MED_ALL_ENTITIES and MED_MAILLE */ //============================================================================= -Engines::long_array* SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED::medConnectivity mode) - throw (SALOME::SALOME_Exception) +Engines::long_array * + SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED:: + medConnectivity mode) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ - ,SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } + //============================================================================= /*! * CORBA: Accessor for connectivities */ //============================================================================= -Engines::long_array* SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED::medConnectivity mode) - throw (SALOME::SALOME_Exception) +Engines::long_array * + SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED:: + medConnectivity mode) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ - ,SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } + //============================================================================= /*! * CORBA: Returns number of families within the mesh */ //============================================================================= -CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED::medEntityMesh entity) - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_MEDMesh_i::getNumberOfFamilies(SALOME_MED:: + medEntityMesh entity) throw(SALOME::SALOME_Exception) { - if (_creeFamily == false) - createFamilies(); - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - return _families.size(); + if (_creeFamily == false) + createFamilies(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + return _families.size(); } + //============================================================================= /*! * CORBA: Returns number of groups within the mesh */ //============================================================================= -CORBA::Long SMESH_MEDMesh_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity) - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_MEDMesh_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity) +throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - MESSAGE(" Pas d implementation des groupes dans SMESH"); - return 0; + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + MESSAGE(" Pas d implementation des groupes dans SMESH"); + return 0; } + //============================================================================= /*! * CORBA: Returns references for families within the mesh */ //============================================================================= -SALOME_MED::Family_array * SMESH_MEDMesh_i::getFamilies(SALOME_MED::medEntityMesh entity) - throw (SALOME::SALOME_Exception) +SALOME_MED::Family_array * + SMESH_MEDMesh_i::getFamilies(SALOME_MED:: + medEntityMesh entity) throw(SALOME::SALOME_Exception) { - if (_creeFamily == false) - createFamilies(); - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array; - int nbfam= _families.size(); - myseq->length(nbfam); - int i = 0; - vector::iterator it; - for (it=_families.begin();it!=_families.end();it++) - { - myseq[i++]=*it; - }; - return myseq._retn(); + if (_creeFamily == false) + createFamilies(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array; + int nbfam = _families.size(); + myseq->length(nbfam); + int i = 0; + vector < SALOME_MED::FAMILY_ptr >::iterator it; + for (it = _families.begin(); it != _families.end(); it++) + { + myseq[i++] = *it; + }; + return myseq._retn(); } + //============================================================================= /*! * CORBA: Returns references for family i within the mesh */ //============================================================================= -SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED::medEntityMesh entity, - CORBA::Long i) - throw (SALOME::SALOME_Exception) +SALOME_MED::FAMILY_ptr SMESH_MEDMesh_i::getFamily(SALOME_MED:: + medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception) { - if (_creeFamily == false) - createFamilies(); - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); + if (_creeFamily == false) + createFamilies(); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); - SCRUTE(_families[i]->getName()); - MESSAGE ( " SMESH_MEDMesh_i::getFamily " << i ) - return _families[i]; + SCRUTE(_families[i]->getName()); + MESSAGE(" SMESH_MEDMesh_i::getFamily " << i) return _families[i]; } + //============================================================================= /*! * CORBA: Returns references for groups within the mesh */ //============================================================================= -SALOME_MED::Group_array * SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) - throw (SALOME::SALOME_Exception) +SALOME_MED::Group_array * + SMESH_MEDMesh_i::getGroups(SALOME_MED::medEntityMesh entity) throw(SALOME:: + SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - MESSAGE(" Pas d implementation des groupes dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("No group implementation"\ - ,SALOME::BAD_PARAM); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + MESSAGE(" Pas d implementation des groupes dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM); } + //============================================================================= /*! * CORBA: Returns references for group i within the mesh */ //============================================================================= -SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED::medEntityMesh entity, - CORBA::Long i) - throw (SALOME::SALOME_Exception) +SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED:: + medEntityMesh entity, CORBA::Long i) throw(SALOME::SALOME_Exception) { - if (_mesh_i == 0) - THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \ - SALOME::INTERNAL_ERROR); - MESSAGE(" Pas d implementation des groupes dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("No group implementation"\ - ,SALOME::BAD_PARAM); + if (_mesh_i == 0) + THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", + SALOME::INTERNAL_ERROR); + MESSAGE(" Pas d implementation des groupes dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM); } + //============================================================================= /*! * CORBA: */ //============================================================================= -SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED::SUPPORT_ptr mySupport) - throw (SALOME::SALOME_Exception) +SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getVolume(SALOME_MED:: + SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ - ,SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } + //============================================================================= /*! * CORBA: */ //============================================================================= -SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED::SUPPORT_ptr mySupport) - throw (SALOME::SALOME_Exception) +SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getArea(SALOME_MED:: + SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ - ,SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } + //============================================================================= /*! * CORBA: */ //============================================================================= -SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED::SUPPORT_ptr mySupport) - throw (SALOME::SALOME_Exception) +SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getLength(SALOME_MED:: + SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ - ,SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } + //============================================================================= /*! * CORBA: */ //============================================================================= -SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED::SUPPORT_ptr mySupport) - throw (SALOME::SALOME_Exception) +SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNormal(SALOME_MED:: + SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ - ,SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } + //============================================================================= /*! * CORBA: */ //============================================================================= -SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED::SUPPORT_ptr mySupport) - throw (SALOME::SALOME_Exception) +SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getBarycenter(SALOME_MED:: + SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) { - MESSAGE("Pas Implemente dans SMESH"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ - ,SALOME::BAD_PARAM); - return 0; + MESSAGE("Pas Implemente dans SMESH"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } + //============================================================================= /*! * CORBA: */ //============================================================================= -SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED::SUPPORT_ptr mySupport) - throw (SALOME::SALOME_Exception) +SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED:: + SUPPORT_ptr mySupport) throw(SALOME::SALOME_Exception) { - MESSAGE("Non Implemente"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ - ,SALOME::BAD_PARAM); - return 0; + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } + //============================================================================= /*! * CORBA: add the Mesh in the StudyManager @@ -726,313 +727,323 @@ SALOME_MED::FIELD_ptr SMESH_MEDMesh_i::getNeighbourhood(SALOME_MED::SUPPORT_ptr */ //============================================================================= void SMESH_MEDMesh_i::addInStudy(SALOMEDS::Study_ptr myStudy, - SALOME_MED::MESH_ptr myIor) - throw (SALOME::SALOME_Exception) + SALOME_MED::MESH_ptr myIor) throw(SALOME::SALOME_Exception) { - BEGIN_OF("MED_Mesh_i::addInStudy"); - if ( _meshId != "" ) - { - MESSAGE("Mesh already in Study"); - THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", \ - SALOME::BAD_PARAM); - }; + BEGIN_OF("MED_Mesh_i::addInStudy"); + if (_meshId != "") + { + MESSAGE("Mesh already in Study"); + THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", + SALOME::BAD_PARAM); + }; - /* - SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder(); - - // Create SComponent labelled 'MED' if it doesn't already exit - SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED"); - if ( CORBA::is_nil(medfather) ) - { - MESSAGE("Add Component MED"); - medfather = myBuilder->NewComponent("MED"); - //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED"); - SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow( - myBuilder->FindOrCreateAttribute(medfather, "AttributeName")); - aName->SetValue("MED"); - - myBuilder->DefineComponentInstance(medfather,myIor); - - } ; - - MESSAGE("Add a mesh Object under MED"); - myBuilder->NewCommand(); - SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather); - - ORB_INIT &init = *SINGLETON_::Instance() ; - ASSERT(SINGLETON_::IsAlreadyExisting()) ; - CORBA::ORB_var &orb = init(0,0); - string iorStr = orb->object_to_string(myIor); - //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.c_str()); - SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow( - myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR")); - aIOR->SetValue(iorStr.c_str()); - - //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str()); - SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow( - myBuilder->FindOrCreateAttribute(newObj, "AttributeName")); - aName->SetValue(_mesh_i->getName().c_str()); - - _meshId = newObj->GetID(); - myBuilder->CommitCommand(); - - */ - END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)"); + /* + * SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder(); + * + * // Create SComponent labelled 'MED' if it doesn't already exit + * SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED"); + * if ( CORBA::is_nil(medfather) ) + * { + * MESSAGE("Add Component MED"); + * medfather = myBuilder->NewComponent("MED"); + * //myBuilder->AddAttribute (medfather,SALOMEDS::Name,"MED"); + * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow( + * myBuilder->FindOrCreateAttribute(medfather, "AttributeName")); + * aName->SetValue("MED"); + * + * myBuilder->DefineComponentInstance(medfather,myIor); + * + * } ; + * + * MESSAGE("Add a mesh Object under MED"); + * myBuilder->NewCommand(); + * SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather); + * + * ORB_INIT &init = *SINGLETON_::Instance() ; + * ASSERT(SINGLETON_::IsAlreadyExisting()) ; + * CORBA::ORB_var &orb = init(0,0); + * string iorStr = orb->object_to_string(myIor); + * //myBuilder->AddAttribute(newObj,SALOMEDS::IOR,iorStr.c_str()); + * SALOMEDS::AttributeIOR_var aIOR = SALOMEDS::AttributeIOR::_narrow( + * myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR")); + * aIOR->SetValue(iorStr.c_str()); + * + * //myBuilder->AddAttribute(newObj,SALOMEDS::Name,_mesh_i->getName().c_str()); + * SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow( + * myBuilder->FindOrCreateAttribute(newObj, "AttributeName")); + * aName->SetValue(_mesh_i->getName().c_str()); + * + * _meshId = newObj->GetID(); + * myBuilder->CommitCommand(); + * + */ + END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)"); } + //============================================================================= /*! * CORBA: write mesh in a med file */ //============================================================================= -void SMESH_MEDMesh_i::write(CORBA::Long i, const char* driverMeshName) - throw (SALOME::SALOME_Exception) +void SMESH_MEDMesh_i::write(CORBA::Long i, const char *driverMeshName) +throw(SALOME::SALOME_Exception) { - MESSAGE("Non Implemente"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ - ,SALOME::BAD_PARAM); + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); } + //============================================================================= /*! * CORBA: read mesh in a med file */ //============================================================================= -void SMESH_MEDMesh_i::read(CORBA::Long i) - throw (SALOME::SALOME_Exception) +void SMESH_MEDMesh_i::read(CORBA::Long i) throw(SALOME::SALOME_Exception) { - MESSAGE("Non Implemente"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ - ,SALOME::BAD_PARAM); + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); } + //============================================================================= /*! * CORBA : release driver */ //============================================================================= -void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) - throw (SALOME::SALOME_Exception) +void SMESH_MEDMesh_i::rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception) { - MESSAGE("Non Implemente"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ - ,SALOME::BAD_PARAM); + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); } + //============================================================================= /*! * CORBA : attach driver */ //============================================================================= -CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType, - const char* fileName, const char* meshName) - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_MEDMesh_i::addDriver(SALOME_MED::medDriverTypes driverType, + const char *fileName, const char *meshName) throw(SALOME::SALOME_Exception) { - MESSAGE("Non Implemente"); - THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method"\ - ,SALOME::BAD_PARAM); - return 0; + MESSAGE("Non Implemente"); + THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM); + return 0; } + //============================================================================= /*! * Calcule le Nb d'elements par entite geometrique */ //============================================================================= -void SMESH_MEDMesh_i::calculeNbElts() - throw (SALOME::SALOME_Exception) +void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception) { - if (! _compte) - { - _compte=true; - - _mapNbTypes[SALOME_MED::MED_NODE]=1; - // On compte les aretes MED_SEG2 ou MED_SEG3 - // On range les elements dans les vecteurs correspondants - - _mapIndToSeqElts[SALOME_MED::MED_SEG2]=_indexElts++; - _mapIndToSeqElts[SALOME_MED::MED_SEG3]=_indexElts++; - _mapIndToVectTypes[SALOME_MED::MED_EDGE]=_indexEnts++; - - int trouveSeg2=0; - int trouveSeg3=0; - SALOME_MED::medGeometryElement medElement; - SMDS_MeshEdgesIterator itEdges(_meshDS); - for (;itEdges.More();itEdges.Next()) + if (!_compte) { - const Handle(SMDS_MeshElement)& elem = itEdges.Value(); - int nb_of_nodes = elem->NbNodes(); + _compte = true; - switch (nb_of_nodes) - { - case 2 : - { - medElement=SALOME_MED::MED_SEG2; - if (trouveSeg2==0) - { - trouveSeg2=1; - _TypesId[SALOME_MED::MED_EDGE].push_back(SALOME_MED::MED_SEG2); + _mapNbTypes[SALOME_MED::MED_NODE] = 1; + // On compte les aretes MED_SEG2 ou MED_SEG3 + // On range les elements dans les vecteurs correspondants - } - break; - } - case 3 : - { - medElement=SALOME_MED::MED_SEG3; - if (trouveSeg3==0) - { - trouveSeg3=1; - _TypesId[SALOME_MED::MED_EDGE].push_back(SALOME_MED::MED_SEG3); - } - break; - } - } - int index=_mapIndToSeqElts[medElement]; - SCRUTE(index); - // Traitement de l arete - int longueur=_seq_elemId[index]->length(); - _seq_elemId[index]->length(longueur + nb_of_nodes); + _mapIndToSeqElts[SALOME_MED::MED_SEG2] = _indexElts++; + _mapIndToSeqElts[SALOME_MED::MED_SEG3] = _indexElts++; + _mapIndToVectTypes[SALOME_MED::MED_EDGE] = _indexEnts++; - for (int k=0; kGetConnection(k+1) +1; - } - } + int trouveSeg2 = 0; + int trouveSeg3 = 0; + SALOME_MED::medGeometryElement medElement; - _mapNbTypes[SALOME_MED::MED_EDGE]=trouveSeg2 + trouveSeg3; + SMDS_Iterator * itEdges=_meshDS->edgesIterator(); + while(itEdges->more()) + { + const SMDS_MeshEdge* elem = itEdges->next(); + int nb_of_nodes = elem->NbNodes(); - // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6 - // On range les elements dans les vecteurs correspondants - int trouveTria3=0; - int trouveTria6=0; - int trouveQuad4=0; + switch (nb_of_nodes) + { + case 2: + { + medElement = SALOME_MED::MED_SEG2; + if (trouveSeg2 == 0) + { + trouveSeg2 = 1; + _TypesId[SALOME_MED::MED_EDGE]. + push_back(SALOME_MED::MED_SEG2); + } + break; + } + case 3: + { + medElement = SALOME_MED::MED_SEG3; + if (trouveSeg3 == 0) + { + trouveSeg3 = 1; + _TypesId[SALOME_MED::MED_EDGE]. + push_back(SALOME_MED::MED_SEG3); + } + break; + } + } + int index = _mapIndToSeqElts[medElement]; + SCRUTE(index); + // Traitement de l arete + int longueur = _seq_elemId[index]->length(); + _seq_elemId[index]->length(longueur + nb_of_nodes); - _mapIndToSeqElts[SALOME_MED::MED_TRIA3]=_indexElts++; - _mapIndToSeqElts[SALOME_MED::MED_TRIA6]=_indexElts++; - _mapIndToSeqElts[SALOME_MED::MED_QUAD4]=_indexElts++; - _mapIndToVectTypes[SALOME_MED::MED_FACE]=_indexEnts++; + SMDS_Iterator * itn=_meshDS->nodesIterator(); - SMDS_MeshFacesIterator itFaces(_meshDS); - for (;itFaces.More();itFaces.Next()) - { + for(int k=0; itn->more(); k++) + _seq_elemId[index][longueur + k] = itn->next()->GetID()+1; + delete itn; + } + delete itEdges; - const Handle(SMDS_MeshElement)& elem = itFaces.Value(); - int nb_of_nodes = elem->NbNodes(); + _mapNbTypes[SALOME_MED::MED_EDGE] = trouveSeg2 + trouveSeg3; - switch (nb_of_nodes) - { - case 3 : - { - medElement=SALOME_MED::MED_TRIA3; - if (trouveTria3==0) - { - trouveTria3=1; - _TypesId[SALOME_MED::MED_FACE].push_back(SALOME_MED::MED_TRIA3); - } - break; - } - case 4 : - { - medElement=SALOME_MED::MED_QUAD4; - if (trouveQuad4==0) - { - trouveQuad4=1; - _TypesId[SALOME_MED::MED_FACE].push_back(SALOME_MED::MED_QUAD4); - } - break; - } - case 6 : - { - medElement=SALOME_MED::MED_TRIA6; - if (trouveTria6==0) - { - trouveTria6=1; - _TypesId[SALOME_MED::MED_FACE].push_back(SALOME_MED::MED_TRIA6); - } - break; - } - } - int index=_mapIndToSeqElts[medElement]; - SCRUTE(index); + // On compte les faces MED_TRIA3, MED_HEXA8, MED_TRIA6 + // On range les elements dans les vecteurs correspondants + int trouveTria3 = 0; + int trouveTria6 = 0; + int trouveQuad4 = 0; - // Traitement de la face - // Attention La numérotation des noeuds Med commence a 1 + _mapIndToSeqElts[SALOME_MED::MED_TRIA3] = _indexElts++; + _mapIndToSeqElts[SALOME_MED::MED_TRIA6] = _indexElts++; + _mapIndToSeqElts[SALOME_MED::MED_QUAD4] = _indexElts++; + _mapIndToVectTypes[SALOME_MED::MED_FACE] = _indexEnts++; + SMDS_Iterator * itFaces=_meshDS->facesIterator(); + while(itFaces->more()) + { + const SMDS_MeshFace * elem = itFaces->next(); + int nb_of_nodes = elem->NbNodes(); - int longueur = _seq_elemId[index]->length(); - _seq_elemId[index]->length(longueur+nb_of_nodes); + switch (nb_of_nodes) + { + case 3: + { + medElement = SALOME_MED::MED_TRIA3; + if (trouveTria3 == 0) + { + trouveTria3 = 1; + _TypesId[SALOME_MED::MED_FACE]. + push_back(SALOME_MED::MED_TRIA3); + } + break; + } + case 4: + { + medElement = SALOME_MED::MED_QUAD4; + if (trouveQuad4 == 0) + { + trouveQuad4 = 1; + _TypesId[SALOME_MED::MED_FACE]. + push_back(SALOME_MED::MED_QUAD4); + } + break; + } + case 6: + { + medElement = SALOME_MED::MED_TRIA6; + if (trouveTria6 == 0) + { + trouveTria6 = 1; + _TypesId[SALOME_MED::MED_FACE]. + push_back(SALOME_MED::MED_TRIA6); + } + break; + } + } + int index = _mapIndToSeqElts[medElement]; + SCRUTE(index); - for (int k=0; kGetConnection(k+1) +1; - } + // Traitement de la face + // Attention La numérotation des noeuds Med commence a 1 - } - _mapNbTypes[SALOME_MED::MED_FACE]=trouveTria3 + trouveTria6 + trouveQuad4; + int longueur = _seq_elemId[index]->length(); + _seq_elemId[index]->length(longueur + nb_of_nodes); - _mapIndToSeqElts[SALOME_MED::MED_HEXA8]=_indexElts++; - _mapIndToVectTypes[SALOME_MED::MED_CELL]=_indexEnts++; - int index=_mapIndToSeqElts[medElement]; + SMDS_Iterator * itn=_meshDS->nodesIterator(); - int trouveHexa8=0; - SMDS_MeshVolumesIterator itVolumes(_meshDS); - for (;itVolumes.More();itVolumes.Next()) - { - const Handle(SMDS_MeshElement)& elem = itVolumes.Value(); + for(int k=0; itn->more(); k++) + _seq_elemId[index][longueur + k] = itn->next()->GetID()+1; + delete itn; + } //itFaces + delete itFaces; - int nb_of_nodes = elem->NbNodes(); - medElement=SALOME_MED::MED_HEXA8; - ASSERT(nb_of_nodes=8); + _mapNbTypes[SALOME_MED::MED_FACE] = + trouveTria3 + trouveTria6 + trouveQuad4; - if (trouveHexa8 == 0) - { - trouveHexa8=1; - _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8); - }; - // Traitement de la maille - int longueur=_seq_elemId[index]->length(); - _seq_elemId[index]->length(longueur+nb_of_nodes); + _mapIndToSeqElts[SALOME_MED::MED_HEXA8] = _indexElts++; + _mapIndToVectTypes[SALOME_MED::MED_CELL] = _indexEnts++; + int index = _mapIndToSeqElts[medElement]; - for (int k=0; kGetConnection(k+1) +1; - } + int trouveHexa8 = 0; - } + SMDS_Iterator * itVolumes=_meshDS->volumesIterator(); + while(itVolumes->more()) + { + const SMDS_MeshVolume * elem = itVolumes->next(); - _mapNbTypes[SALOME_MED::MED_CELL]=trouveHexa8; - _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES] - =trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 + trouveSeg3 ; - } /* fin du _compte */ + int nb_of_nodes = elem->NbNodes(); + medElement = SALOME_MED::MED_HEXA8; + ASSERT(nb_of_nodes = 8); + + if (trouveHexa8 == 0) + { + trouveHexa8 = 1; + _TypesId[SALOME_MED::MED_CELL].push_back(SALOME_MED::MED_HEXA8); + }; + // Traitement de la maille + int longueur = _seq_elemId[index]->length(); + _seq_elemId[index]->length(longueur + nb_of_nodes); + + SMDS_Iterator * itn=_meshDS->nodesIterator(); + for(int k=0; itn->more(); k++) + _seq_elemId[index][longueur + k] = itn->next()->GetID()+1; + delete itn; + } + delete itVolumes; + + _mapNbTypes[SALOME_MED::MED_CELL] = trouveHexa8; + _mapNbTypes[SALOME_MED::MED_ALL_ENTITIES] + = + trouveHexa8 + trouveTria3 + trouveTria6 + trouveQuad4 + trouveSeg2 + + trouveSeg3; + }// fin du _compte }; + //============================================================================= /*! * Creation des familles */ //============================================================================= -void SMESH_MEDMesh_i::createFamilies() - throw (SALOME::SALOME_Exception) +void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception) { - string famDes=("Je ne sais pas"); - string famName0="Famille_"; - string famName; - char numero[10]; + string famDes = ("Je ne sais pas"); + string famName0 = "Famille_"; + string famName; + char numero[10]; - if ( _creeFamily == false) - { - _creeFamily = true; - SMESH_subMesh_i* subMeshServant; + if (_creeFamily == false) + { + _creeFamily = true; + SMESH_subMesh_i *subMeshServant; - map::iterator it; - for (it = _mesh_i->_mapSubMesh_i.begin(); it != _mesh_i->_mapSubMesh_i.end(); it++) { - SMESH_subMesh_i* submesh_i = (*it).second; - int famIdent = (*it).first; + map < int, SMESH_subMesh_i * >::iterator it; + for (it = _mesh_i->_mapSubMesh_i.begin(); + it != _mesh_i->_mapSubMesh_i.end(); it++) + { + SMESH_subMesh_i *submesh_i = (*it).second; + int famIdent = (*it).first; - ASSERT (famIdent<999999999); - sprintf(numero,"%d\n",famIdent); - famName=famName0 + numero; + ASSERT(famIdent < 999999999); + sprintf(numero, "%d\n", famIdent); + famName = famName0 + numero; - SMESH_MEDFamily_i * famservant= new SMESH_MEDFamily_i(famIdent, submesh_i, - famName, famDes, SALOME_MED::MED_NODE); - SALOME_MED::FAMILY_ptr famille = - SALOME_MED::FAMILY::_narrow(famservant->POA_SALOME_MED::FAMILY::_this()); - _families.push_back(famille); - } - } /* fin du _compte */ + SMESH_MEDFamily_i *famservant = + new SMESH_MEDFamily_i(famIdent, submesh_i, + famName, famDes, SALOME_MED::MED_NODE); + SALOME_MED::FAMILY_ptr famille = + SALOME_MED::FAMILY::_narrow(famservant-> + POA_SALOME_MED::FAMILY::_this()); + _families.push_back(famille); + } + } }; - diff --git a/src/SMESH_I/SMESH_MEDMesh_i.hxx b/src/SMESH_I/SMESH_MEDMesh_i.hxx index 6760ea93b..73370701a 100644 --- a/src/SMESH_I/SMESH_MEDMesh_i.hxx +++ b/src/SMESH_I/SMESH_MEDMesh_i.hxx @@ -37,147 +37,131 @@ #include "SMDS_MeshElement.hxx" #include "SMDS_MeshNode.hxx" -#include "SMDS_MeshFacesIterator.hxx" -#include "SMDS_MeshEdgesIterator.hxx" -#include "SMDS_MeshNodesIterator.hxx" -#include "SMDS_MeshVolumesIterator.hxx" #define MED_NBR_GEOMETRIE_MAILLE 15 #define MED_NBR_TYPE 5 - class SMESH_Mesh_i; class SMESH_MEDMesh_i: - public POA_SALOME_MED::MESH, - public PortableServer::RefCountServantBase + public POA_SALOME_MED::MESH, public PortableServer::RefCountServantBase { -public : + public: private: protected: + // C++ object containing values + ::SMESH_Mesh_i * _mesh_i; + SMESHDS_Mesh *_meshDS; -private : + string _meshId; + bool _compte; + bool _creeFamily; + int _indexElts; + int _indexEnts; + int _famIdent; -protected: - // C++ object containing values - ::SMESH_Mesh_i* _mesh_i; - Handle (SMESHDS_Mesh) _meshDS; - - string _meshId; - bool _compte; - bool _creeFamily; - int _indexElts; - int _indexEnts; - int _famIdent; + map < SALOME_MED::medGeometryElement, int >_mapIndToSeqElts; + Engines::long_array_var _seq_elemId[MED_NBR_GEOMETRIE_MAILLE]; - map _mapIndToSeqElts; - Engines::long_array_var _seq_elemId[MED_NBR_GEOMETRIE_MAILLE]; + map < SALOME_MED::medEntityMesh, int >_mapNbTypes; + map < SALOME_MED::medEntityMesh, int >_mapIndToVectTypes; + vector < SALOME_MED::medGeometryElement > + _TypesId[MED_NBR_GEOMETRIE_MAILLE]; - map _mapNbTypes; - map _mapIndToVectTypes; - vector _TypesId[MED_NBR_GEOMETRIE_MAILLE]; + vector < SALOME_MED::FAMILY_ptr > _families; + public: - vector _families; -public: + // Constructors and associated internal methods + SMESH_MEDMesh_i(); + SMESH_MEDMesh_i(SMESH_Mesh_i * m); + ~SMESH_MEDMesh_i(); - // Constructors and associated internal methods - SMESH_MEDMesh_i(); - SMESH_MEDMesh_i(SMESH_Mesh_i* m); - ~SMESH_MEDMesh_i(); + // IDL Methods + char *getName() throw(SALOME::SALOME_Exception); + CORBA::Long getSpaceDimension() throw(SALOME::SALOME_Exception); + CORBA::Long getMeshDimension() throw(SALOME::SALOME_Exception); - // IDL Methods - char * getName() throw (SALOME::SALOME_Exception); - CORBA::Long getSpaceDimension() throw (SALOME::SALOME_Exception); - CORBA::Long getMeshDimension() throw (SALOME::SALOME_Exception); + char *getCoordinateSystem() throw(SALOME::SALOME_Exception); + Engines::double_array * getCoordinates(SALOME_MED::medModeSwitch typeSwitch) + throw(SALOME::SALOME_Exception); + Engines::string_array * getCoordinatesNames() + throw(SALOME::SALOME_Exception); + Engines::string_array * getCoordinatesUnits() + throw(SALOME::SALOME_Exception); + CORBA::Long getNumberOfNodes() throw(SALOME::SALOME_Exception); - char * getCoordinateSystem() - throw (SALOME::SALOME_Exception); - Engines::double_array* getCoordinates(SALOME_MED::medModeSwitch typeSwitch) - throw (SALOME::SALOME_Exception); - Engines::string_array* getCoordinatesNames() - throw (SALOME::SALOME_Exception); - Engines::string_array* getCoordinatesUnits() - throw (SALOME::SALOME_Exception); - CORBA::Long getNumberOfNodes() - throw (SALOME::SALOME_Exception); + CORBA::Long getNumberOfTypes(SALOME_MED::medEntityMesh entity) + throw(SALOME::SALOME_Exception); + SALOME_MED::medGeometryElement_array * + getTypes(SALOME_MED::medEntityMesh entity) throw(SALOME:: + SALOME_Exception); - CORBA::Long getNumberOfTypes (SALOME_MED::medEntityMesh entity) - throw (SALOME::SALOME_Exception); - SALOME_MED::medGeometryElement_array* getTypes(SALOME_MED::medEntityMesh entity) - throw (SALOME::SALOME_Exception); + CORBA::Long getNumberOfElements(SALOME_MED::medEntityMesh entity, + SALOME_MED::medGeometryElement geomElement) + throw(SALOME::SALOME_Exception); + Engines::long_array * getConnectivity(SALOME_MED::medModeSwitch typeSwitch, + SALOME_MED::medConnectivity mode, + SALOME_MED::medEntityMesh entity, + SALOME_MED::medGeometryElement geomElement) + throw(SALOME::SALOME_Exception); + Engines::long_array * getConnectivityIndex(SALOME_MED::medConnectivity mode, + SALOME_MED::medEntityMesh entity) throw(SALOME::SALOME_Exception); - CORBA::Long getNumberOfElements (SALOME_MED::medEntityMesh entity, - SALOME_MED::medGeometryElement geomElement) - throw (SALOME::SALOME_Exception); - Engines::long_array* getConnectivity (SALOME_MED::medModeSwitch typeSwitch, - SALOME_MED::medConnectivity mode, - SALOME_MED::medEntityMesh entity, - SALOME_MED::medGeometryElement geomElement) - throw (SALOME::SALOME_Exception); - Engines::long_array* getConnectivityIndex(SALOME_MED::medConnectivity mode, - SALOME_MED::medEntityMesh entity) - throw (SALOME::SALOME_Exception); + CORBA::Long getElementNumber(SALOME_MED::medConnectivity mode, + SALOME_MED::medEntityMesh entity, + SALOME_MED::medGeometryElement type, + const Engines::long_array & connectivity) + throw(SALOME::SALOME_Exception); - CORBA::Long getElementNumber(SALOME_MED::medConnectivity mode, - SALOME_MED::medEntityMesh entity, - SALOME_MED::medGeometryElement type, - const Engines::long_array & connectivity) - throw (SALOME::SALOME_Exception); + Engines::long_array * + getReverseConnectivity(SALOME_MED::medConnectivity mode) throw(SALOME:: + SALOME_Exception); + Engines::long_array * + getReverseConnectivityIndex(SALOME_MED:: + medConnectivity mode) throw(SALOME::SALOME_Exception); - Engines::long_array* getReverseConnectivity(SALOME_MED::medConnectivity mode) + // Family and Group + CORBA::Long getNumberOfFamilies(SALOME_MED::medEntityMesh entity) + throw(SALOME::SALOME_Exception); + CORBA::Long getNumberOfGroups(SALOME_MED::medEntityMesh entity) + throw(SALOME::SALOME_Exception); + SALOME_MED::Family_array * getFamilies(SALOME_MED::medEntityMesh entity) + throw(SALOME::SALOME_Exception); + SALOME_MED::FAMILY_ptr getFamily(SALOME_MED::medEntityMesh entity, + CORBA::Long i) throw(SALOME::SALOME_Exception); + SALOME_MED::Group_array * getGroups(SALOME_MED::medEntityMesh entity) + throw(SALOME::SALOME_Exception); + SALOME_MED::GROUP_ptr getGroup(SALOME_MED::medEntityMesh entity, + CORBA::Long i) throw(SALOME::SALOME_Exception); + // + SALOME_MED::FIELD_ptr getVolume(SALOME_MED::SUPPORT_ptr mySupport) + throw(SALOME::SALOME_Exception); + SALOME_MED::FIELD_ptr getArea(SALOME_MED::SUPPORT_ptr mySupport) + throw(SALOME::SALOME_Exception); + SALOME_MED::FIELD_ptr getLength(SALOME_MED::SUPPORT_ptr mySupport) + throw(SALOME::SALOME_Exception); + SALOME_MED::FIELD_ptr getNormal(SALOME_MED::SUPPORT_ptr mySupport) + throw(SALOME::SALOME_Exception); + SALOME_MED::FIELD_ptr getBarycenter(SALOME_MED::SUPPORT_ptr mySupport) + throw(SALOME::SALOME_Exception); + SALOME_MED::FIELD_ptr getNeighbourhood(SALOME_MED::SUPPORT_ptr mySupport) + throw(SALOME::SALOME_Exception); - throw (SALOME::SALOME_Exception); - Engines::long_array* getReverseConnectivityIndex(SALOME_MED::medConnectivity mode) - throw (SALOME::SALOME_Exception); + // Others + void addInStudy(SALOMEDS::Study_ptr myStudy, + SALOME_MED::MESH_ptr myIor) throw(SALOME::SALOME_Exception); + CORBA::Long addDriver(SALOME_MED::medDriverTypes driverType, + const char *fileName, const char *meshName) + throw(SALOME::SALOME_Exception); + void rmDriver(CORBA::Long i) throw(SALOME::SALOME_Exception); + void read(CORBA::Long i) throw(SALOME::SALOME_Exception); + void write(CORBA::Long i, const char *driverMeshName) + throw(SALOME::SALOME_Exception); - // Family and Group - CORBA::Long getNumberOfFamilies (SALOME_MED::medEntityMesh entity) - throw (SALOME::SALOME_Exception); - CORBA::Long getNumberOfGroups (SALOME_MED::medEntityMesh entity) - throw (SALOME::SALOME_Exception); - SALOME_MED::Family_array* getFamilies (SALOME_MED::medEntityMesh entity) - throw (SALOME::SALOME_Exception); - SALOME_MED::FAMILY_ptr getFamily (SALOME_MED::medEntityMesh entity, - CORBA::Long i) - throw (SALOME::SALOME_Exception); - SALOME_MED::Group_array* getGroups (SALOME_MED::medEntityMesh entity) - throw (SALOME::SALOME_Exception); - SALOME_MED::GROUP_ptr getGroup (SALOME_MED::medEntityMesh entity, - CORBA::Long i) - throw (SALOME::SALOME_Exception); - // - SALOME_MED::FIELD_ptr getVolume (SALOME_MED::SUPPORT_ptr mySupport) - throw (SALOME::SALOME_Exception); - SALOME_MED::FIELD_ptr getArea (SALOME_MED::SUPPORT_ptr mySupport) - throw (SALOME::SALOME_Exception); - SALOME_MED::FIELD_ptr getLength (SALOME_MED::SUPPORT_ptr mySupport) - throw (SALOME::SALOME_Exception); - SALOME_MED::FIELD_ptr getNormal (SALOME_MED::SUPPORT_ptr mySupport) - throw (SALOME::SALOME_Exception); - SALOME_MED::FIELD_ptr getBarycenter (SALOME_MED::SUPPORT_ptr mySupport) - throw (SALOME::SALOME_Exception); - SALOME_MED::FIELD_ptr getNeighbourhood (SALOME_MED::SUPPORT_ptr mySupport) - throw (SALOME::SALOME_Exception); + // Cuisine interne + CORBA::Long getCorbaIndex() throw(SALOME::SALOME_Exception); - - // Others - void addInStudy (SALOMEDS::Study_ptr myStudy, - SALOME_MED::MESH_ptr myIor) - throw (SALOME::SALOME_Exception); - CORBA::Long addDriver (SALOME_MED::medDriverTypes driverType, - const char* fileName, const char* meshName) - throw (SALOME::SALOME_Exception); - void rmDriver (CORBA::Long i) - throw (SALOME::SALOME_Exception); - void read (CORBA::Long i) - throw (SALOME::SALOME_Exception); - void write (CORBA::Long i, const char* driverMeshName) - throw (SALOME::SALOME_Exception); - - // Cuisine interne - CORBA::Long getCorbaIndex() throw (SALOME::SALOME_Exception); - - // - void calculeNbElts() throw (SALOME::SALOME_Exception); - void createFamilies() throw (SALOME::SALOME_Exception); + // + void calculeNbElts() throw(SALOME::SALOME_Exception); + void createFamilies() throw(SALOME::SALOME_Exception); }; #endif /* _MED_MESH_I_HXX_ */ 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"); + 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(); + 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(); - } + MESSAGE(" subMeshId " << subMeshId) - 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); - } + 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"); + 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); + } } - _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; + try + { + _isOnAllElements = (_seqLength == _meshDS->NbNodes()); + } + 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(...) - { - MESSAGE("Exception lors de la recherche des differents types"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support Types", \ - SALOME::INTERNAL_ERROR); - } - return myseq._retn(); + 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(); } //============================================================================= @@ -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); + 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); - // 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; - 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(); - 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++; - }; + 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(); -SCRUTE(myseq->length()); -MESSAGE("yyyyy"); - 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; } - diff --git a/src/SMESH_I/SMESH_MEDSupport_i.hxx b/src/SMESH_I/SMESH_MEDSupport_i.hxx index dccbe8d52..81d59dc4a 100644 --- a/src/SMESH_I/SMESH_MEDSupport_i.hxx +++ b/src/SMESH_I/SMESH_MEDSupport_i.hxx @@ -1,28 +1,28 @@ -// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses +// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // // // -// File : SMESH_MEDSupport_i.hxx -// Module : SMESH +// File : SMESH_MEDSupport_i.hxx +// Module : SMESH #ifndef _MED_SMESH_MEDSUPPORT_I_HXX_ #define _MED_SMESH_MEDSUPPORT_I_HXX_ @@ -40,62 +40,52 @@ class SMESH_subMesh_i; -class SMESH_MEDSupport_i: - public POA_SALOME_MED::SUPPORT, - public PortableServer::RefCountServantBase +class SMESH_MEDSupport_i: + public POA_SALOME_MED::SUPPORT, public PortableServer::RefCountServantBase { + public: -protected : - SMESH_MEDSupport_i(); - ~SMESH_MEDSupport_i(); +// Constructors and associated internal methods + SMESH_MEDSupport_i(SMESH_subMesh_i * sm, + string name, string description, SALOME_MED::medEntityMesh entity); + SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s); +// IDL Methods + char *getName() throw(SALOME::SALOME_Exception); + char *getDescription() throw(SALOME::SALOME_Exception); + SALOME_MED::MESH_ptr getMesh() throw(SALOME::SALOME_Exception); + CORBA::Boolean isOnAllElements() throw(SALOME::SALOME_Exception); + SALOME_MED::medEntityMesh getEntity() throw(SALOME::SALOME_Exception); + CORBA::Long getNumberOfElements(SALOME_MED::medGeometryElement geomElement) + throw(SALOME::SALOME_Exception); + Engines::long_array * getNumber(SALOME_MED::medGeometryElement geomElement) + throw(SALOME::SALOME_Exception); + Engines::long_array * getNumberIndex() throw(SALOME::SALOME_Exception); + CORBA::Long getNumberOfGaussPoints(SALOME_MED:: + medGeometryElement geomElement) throw(SALOME::SALOME_Exception); + SALOME_MED::medGeometryElement_array * + getTypes() throw(SALOME::SALOME_Exception); + CORBA::Long getCorbaIndex() throw(SALOME::SALOME_Exception); + void createSeq() throw(SALOME::SALOME_Exception); -public : - - Handle_SMESHDS_SubMesh _subMeshDS; - ::SMESH_subMesh_i* _subMesh_i; + public: //public field + const SMESHDS_SubMesh * _subMeshDS; + ::SMESH_subMesh_i * _subMesh_i; - Handle_SMESHDS_Mesh _meshDS; - string _name; - string _description; - bool _isOnAllElements; - bool _seqNumber; - int _seqLength; + SMESHDS_Mesh * _meshDS; + string _name; + string _description; + bool _isOnAllElements; + bool _seqNumber; + int _seqLength; - SALOME_MED::medEntityMesh _entity; - SALOME_MED::medGeometryElement * _geometricType; - int _numberOfGeometricType; - - -public: - - // Constructors and associated internal methods - SMESH_MEDSupport_i(SMESH_subMesh_i* sm, - string name, - string description, - SALOME_MED::medEntityMesh entity); - SMESH_MEDSupport_i(const SMESH_MEDSupport_i & s); - - // IDL Methods - char * getName() throw (SALOME::SALOME_Exception); - char * getDescription() throw (SALOME::SALOME_Exception); - SALOME_MED::MESH_ptr getMesh() throw (SALOME::SALOME_Exception); - CORBA::Boolean isOnAllElements() throw (SALOME::SALOME_Exception); - SALOME_MED::medEntityMesh getEntity() throw (SALOME::SALOME_Exception); - CORBA::Long getNumberOfElements(SALOME_MED::medGeometryElement geomElement) - throw (SALOME::SALOME_Exception); - Engines::long_array* getNumber(SALOME_MED::medGeometryElement geomElement) - throw (SALOME::SALOME_Exception); - Engines::long_array* getNumberIndex() - throw (SALOME::SALOME_Exception); - CORBA::Long getNumberOfGaussPoints(SALOME_MED::medGeometryElement geomElement) - throw (SALOME::SALOME_Exception); - SALOME_MED::medGeometryElement_array* getTypes() - throw (SALOME::SALOME_Exception); - CORBA::Long getCorbaIndex() throw (SALOME::SALOME_Exception); - void createSeq() throw (SALOME::SALOME_Exception); - + SALOME_MED::medEntityMesh _entity; + SALOME_MED::medGeometryElement * _geometricType; + int _numberOfGeometricType; + protected: + SMESH_MEDSupport_i(); + ~SMESH_MEDSupport_i(); }; #endif /* _MED_MEDSUPPORT_I_HXX_ */ diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index f95fc67e0..5c7909428 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -29,9 +29,6 @@ using namespace std; #include "SMESH_MeshEditor_i.hxx" -#include "SMDS_MeshEdgesIterator.hxx" -#include "SMDS_MeshFacesIterator.hxx" -#include "SMDS_MeshVolumesIterator.hxx" #include "SMDS_MeshEdge.hxx" #include "SMDS_MeshFace.hxx" #include "SMDS_MeshVolume.hxx" @@ -41,16 +38,15 @@ using namespace std; #include #include - - //============================================================================= /*! * */ //============================================================================= -SMESH_MeshEditor_i::SMESH_MeshEditor_i(const Handle(SMESHDS_Mesh)& theMesh) { - _myMeshDS = theMesh; +SMESH_MeshEditor_i::SMESH_MeshEditor_i(SMESHDS_Mesh* theMesh) +{ + _myMeshDS = theMesh; }; //============================================================================= @@ -59,13 +55,16 @@ SMESH_MeshEditor_i::SMESH_MeshEditor_i(const Handle(SMESHDS_Mesh)& theMesh) { */ //============================================================================= -CORBA::Boolean SMESH_MeshEditor_i::RemoveElements(const SMESH::long_array& IDsOfElements) { - for (int i = 0 ; i< IDsOfElements.length(); i++) { - CORBA::Long index = IDsOfElements[i]; - _myMeshDS->RemoveElement(index); - MESSAGE ( "Element "<< index << " was removed" ) - } - return true; +CORBA::Boolean SMESH_MeshEditor_i::RemoveElements(const SMESH:: + long_array & IDsOfElements) +{ + for (int i = 0; i < IDsOfElements.length(); i++) + { + CORBA::Long index = IDsOfElements[i]; + _myMeshDS->RemoveElement(index); + MESSAGE("Element " << index << " was removed") + } + return true; }; //============================================================================= @@ -74,66 +73,23 @@ CORBA::Boolean SMESH_MeshEditor_i::RemoveElements(const SMESH::long_array& IDsOf */ //============================================================================= -CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::long_array& IDsOfNodes) { - - // Here we try to collect all 1D, 2D and 3D elements which contain at least one - // of in order to remove such elements. - // This seems correct since e.g a triangle without 1 vertex looks nonsense. - TColStd_MapOfInteger elemsToRemove; - - for (int i = 0 ; i< IDsOfNodes.length(); i++) { - - CORBA::Long ID = IDsOfNodes[i]; - - SMDS_MeshEdgesIterator edgeIt(_myMeshDS); - for (; edgeIt.More(); edgeIt.Next()) { - Handle(SMDS_MeshEdge) anEdge = Handle(SMDS_MeshEdge)::DownCast(edgeIt.Value()); - for (Standard_Integer i = 0; i < anEdge->NbNodes(); i++) { - if (anEdge->GetConnection(i) == ID) { - Standard_Integer elemID = anEdge->GetID(); - if (!elemsToRemove.Contains(elemID)) elemsToRemove.Add(elemID); +CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH:: + long_array & IDsOfNodes) +{ + // It's nodes' turn to die + for (int i = 0; i < IDsOfNodes.length(); i++) + { + const SMDS_MeshNode * node=_myMeshDS->FindNode(IDsOfNodes[i]); + if(node==NULL) + { + MESSAGE("SMESH_MeshEditor_i::RemoveNodes: Node "<RemoveNode(IDsOfNodes[i]); + MESSAGE("Node " << index << " was removed") } - } - } - - SMDS_MeshFacesIterator faceIt(_myMeshDS); - for (; faceIt.More(); faceIt.Next()) { - Handle(SMDS_MeshFace) aFace = Handle(SMDS_MeshFace)::DownCast(faceIt.Value()); - for (Standard_Integer i = 0; i < aFace->NbNodes(); i++) { - if (aFace->GetConnection(i) == ID) { - Standard_Integer elemID = aFace->GetID(); - if (!elemsToRemove.Contains(elemID)) elemsToRemove.Add(elemID); - } - } - } - - SMDS_MeshVolumesIterator volIt(_myMeshDS); - for (; volIt.More(); volIt.Next()) { - Handle(SMDS_MeshVolume) aVol = Handle(SMDS_MeshVolume)::DownCast(volIt.Value()); - for (Standard_Integer i = 0; i < aVol->NbNodes(); i++) { - if (aVol->GetConnection(i) == ID) { - Standard_Integer elemID = aVol->GetID(); - if (!elemsToRemove.Contains(elemID)) elemsToRemove.Add(elemID); - } - } - } - } - - // Now remove them! - TColStd_MapIteratorOfMapOfInteger it(elemsToRemove); - for (; it.More(); it.Next()) { - Standard_Integer elemID = it.Key(); - _myMeshDS->RemoveElement(elemID); - MESSAGE("RemoveNodes(): element removed: " << elemID) - } - - // It's nodes' turn to die - for (int i = 0 ; i< IDsOfNodes.length(); i++) { - CORBA::Long index = IDsOfNodes[i]; - _myMeshDS->RemoveNode(index); - MESSAGE ( "Node "<< index << " was removed" ) - } - return true; + return true; }; //============================================================================= @@ -142,14 +98,16 @@ CORBA::Boolean SMESH_MeshEditor_i::RemoveNodes(const SMESH::long_array& IDsOfNod */ //============================================================================= -CORBA::Boolean SMESH_MeshEditor_i::AddEdge(const SMESH::long_array& IDsOfNodes) { - int NbNodes = IDsOfNodes.length(); - if ( NbNodes == 2 ) { - CORBA::Long index1 = IDsOfNodes[0]; - CORBA::Long index2 = IDsOfNodes[1]; - int idTri = _myMeshDS->AddEdge(index1,index2); - } - return true; +CORBA::Boolean SMESH_MeshEditor_i::AddEdge(const SMESH::long_array & IDsOfNodes) +{ + int NbNodes = IDsOfNodes.length(); + if (NbNodes == 2) + { + CORBA::Long index1 = IDsOfNodes[0]; + CORBA::Long index2 = IDsOfNodes[1]; + _myMeshDS->AddEdge(index1, index2); + } + return true; } //============================================================================= @@ -159,12 +117,11 @@ CORBA::Boolean SMESH_MeshEditor_i::AddEdge(const SMESH::long_array& IDsOfNodes) //============================================================================= CORBA::Boolean SMESH_MeshEditor_i::AddNode(CORBA::Double x, - CORBA::Double y, - CORBA::Double z) { - MESSAGE( " AddNode " << x << " , " << y << " , " << z ) - int idNode = _myMeshDS->AddNode(x,y,z); - MESSAGE( " idNode " << idNode ) - return true; + CORBA::Double y, CORBA::Double z) +{ + MESSAGE(" AddNode " << x << " , " << y << " , " << z) + int idNode = _myMeshDS->AddNode(x, y, z)->GetID(); + MESSAGE(" idNode " << idNode) return true; } //============================================================================= @@ -173,21 +130,25 @@ CORBA::Boolean SMESH_MeshEditor_i::AddNode(CORBA::Double x, */ //============================================================================= -CORBA::Boolean SMESH_MeshEditor_i::AddFace(const SMESH::long_array& IDsOfNodes) { - int NbNodes = IDsOfNodes.length(); - if ( NbNodes == 3 ) { - CORBA::Long index1 = IDsOfNodes[0]; - CORBA::Long index2 = IDsOfNodes[1]; - CORBA::Long index3 = IDsOfNodes[2]; - int idTri = _myMeshDS->AddFace(index1,index2,index3); - } else if ( NbNodes == 4 ) { - CORBA::Long index1 = IDsOfNodes[0]; - CORBA::Long index2 = IDsOfNodes[1]; - CORBA::Long index3 = IDsOfNodes[2]; - CORBA::Long index4 = IDsOfNodes[3]; - int idTri = _myMeshDS->AddFace(index1,index2,index3,index4); - } - return true; +CORBA::Boolean SMESH_MeshEditor_i::AddFace(const SMESH::long_array & IDsOfNodes) +{ + int NbNodes = IDsOfNodes.length(); + if (NbNodes == 3) + { + CORBA::Long index1 = IDsOfNodes[0]; + CORBA::Long index2 = IDsOfNodes[1]; + CORBA::Long index3 = IDsOfNodes[2]; + _myMeshDS->AddFace(index1, index2, index3); + } + else if (NbNodes == 4) + { + CORBA::Long index1 = IDsOfNodes[0]; + CORBA::Long index2 = IDsOfNodes[1]; + CORBA::Long index3 = IDsOfNodes[2]; + CORBA::Long index4 = IDsOfNodes[3]; + _myMeshDS->AddFace(index1, index2, index3, index4); + } + return true; }; //============================================================================= @@ -196,39 +157,49 @@ CORBA::Boolean SMESH_MeshEditor_i::AddFace(const SMESH::long_array& IDsOfNodes) */ //============================================================================= -CORBA::Boolean SMESH_MeshEditor_i::AddVolume(const SMESH::long_array& IDsOfNodes) { - int NbNodes = IDsOfNodes.length(); - if ( NbNodes == 4 ) { - CORBA::Long index1 = IDsOfNodes[0]; - CORBA::Long index2 = IDsOfNodes[1]; - CORBA::Long index3 = IDsOfNodes[2]; - CORBA::Long index4 = IDsOfNodes[3]; - int idTetra = _myMeshDS->AddVolume(index1,index2,index3,index4); - } else if ( NbNodes == 5 ) { - CORBA::Long index1 = IDsOfNodes[0]; - CORBA::Long index2 = IDsOfNodes[1]; - CORBA::Long index3 = IDsOfNodes[2]; - CORBA::Long index4 = IDsOfNodes[3]; - CORBA::Long index5 = IDsOfNodes[4]; - int idPyramid = _myMeshDS->AddVolume(index1,index2,index3,index4,index5); - } else if ( NbNodes == 6 ) { - CORBA::Long index1 = IDsOfNodes[0]; - CORBA::Long index2 = IDsOfNodes[1]; - CORBA::Long index3 = IDsOfNodes[2]; - CORBA::Long index4 = IDsOfNodes[3]; - CORBA::Long index5 = IDsOfNodes[4]; - CORBA::Long index6 = IDsOfNodes[5]; - int idPrism = _myMeshDS->AddVolume(index1,index2,index3,index4,index5,index6); - } else if ( NbNodes == 8 ) { - CORBA::Long index1 = IDsOfNodes[0]; - CORBA::Long index2 = IDsOfNodes[1]; - CORBA::Long index3 = IDsOfNodes[2]; - CORBA::Long index4 = IDsOfNodes[3]; - CORBA::Long index5 = IDsOfNodes[4]; - CORBA::Long index6 = IDsOfNodes[5]; - CORBA::Long index7 = IDsOfNodes[6]; - CORBA::Long index8 = IDsOfNodes[7]; - int idHexa = _myMeshDS->AddVolume(index1,index2,index3,index4,index5,index6,index7,index8); - } - return true; +CORBA::Boolean SMESH_MeshEditor_i::AddVolume(const SMESH:: + long_array & IDsOfNodes) +{ + int NbNodes = IDsOfNodes.length(); + if (NbNodes == 4) + { + CORBA::Long index1 = IDsOfNodes[0]; + CORBA::Long index2 = IDsOfNodes[1]; + CORBA::Long index3 = IDsOfNodes[2]; + CORBA::Long index4 = IDsOfNodes[3]; + _myMeshDS->AddVolume(index1, index2, index3, index4); + } + else if (NbNodes == 5) + { + CORBA::Long index1 = IDsOfNodes[0]; + CORBA::Long index2 = IDsOfNodes[1]; + CORBA::Long index3 = IDsOfNodes[2]; + CORBA::Long index4 = IDsOfNodes[3]; + CORBA::Long index5 = IDsOfNodes[4]; + _myMeshDS->AddVolume(index1, index2, index3, index4, index5); + } + else if (NbNodes == 6) + { + CORBA::Long index1 = IDsOfNodes[0]; + CORBA::Long index2 = IDsOfNodes[1]; + CORBA::Long index3 = IDsOfNodes[2]; + CORBA::Long index4 = IDsOfNodes[3]; + CORBA::Long index5 = IDsOfNodes[4]; + CORBA::Long index6 = IDsOfNodes[5]; + _myMeshDS->AddVolume(index1, index2, index3, index4, index5, index6); + } + else if (NbNodes == 8) + { + CORBA::Long index1 = IDsOfNodes[0]; + CORBA::Long index2 = IDsOfNodes[1]; + CORBA::Long index3 = IDsOfNodes[2]; + CORBA::Long index4 = IDsOfNodes[3]; + CORBA::Long index5 = IDsOfNodes[4]; + CORBA::Long index6 = IDsOfNodes[5]; + CORBA::Long index7 = IDsOfNodes[6]; + CORBA::Long index8 = IDsOfNodes[7]; + _myMeshDS->AddVolume(index1, index2, index3, index4, index5, index6, + index7, index8); + } + return true; }; diff --git a/src/SMESH_I/SMESH_MeshEditor_i.hxx b/src/SMESH_I/SMESH_MeshEditor_i.hxx index 44e2652a8..0c75c7de0 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.hxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.hxx @@ -34,30 +34,27 @@ #include "SMESHDS_Mesh.hxx" - -class SMESH_MeshEditor_i: - public POA_SMESH::SMESH_MeshEditor +class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor { -public: - SMESH_MeshEditor_i(const Handle(SMESHDS_Mesh)& theMesh); + public: + SMESH_MeshEditor_i(SMESHDS_Mesh * theMesh); - virtual ~SMESH_MeshEditor_i() {}; + virtual ~ SMESH_MeshEditor_i() + { + }; - // --- CORBA - CORBA::Boolean RemoveElements(const SMESH::long_array& IDsOfElements); - CORBA::Boolean RemoveNodes(const SMESH::long_array& IDsOfNodes); + // --- CORBA + CORBA::Boolean RemoveElements(const SMESH::long_array & IDsOfElements); + CORBA::Boolean RemoveNodes(const SMESH::long_array & IDsOfNodes); - CORBA::Boolean AddNode(CORBA::Double x, - CORBA::Double y, - CORBA::Double z); - CORBA::Boolean AddEdge(const SMESH::long_array& IDsOfNodes); - CORBA::Boolean AddFace(const SMESH::long_array& IDsOfNodes); - CORBA::Boolean AddVolume(const SMESH::long_array& IDsOfNodes); + CORBA::Boolean AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z); + CORBA::Boolean AddEdge(const SMESH::long_array & IDsOfNodes); + CORBA::Boolean AddFace(const SMESH::long_array & IDsOfNodes); + CORBA::Boolean AddVolume(const SMESH::long_array & IDsOfNodes); -private: - SMESH::SMESH_subMesh_var _myMesh; - Handle (SMESHDS_Mesh) _myMeshDS; + private: + SMESH::SMESH_subMesh_var _myMesh; + SMESHDS_Mesh *_myMeshDS; }; #endif - diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index c8d05d74e..9dee0f562 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -26,7 +26,6 @@ // Module : SMESH // $Header$ -using namespace std; using namespace std; #include "SMESH_Mesh_i.hxx" #include "SMESH_subMesh_i.hxx" @@ -40,22 +39,12 @@ using namespace std; #include "OpUtil.hxx" #include "TCollection_AsciiString.hxx" -// #include "SMESHDS_ListOfAsciiString.hxx" -// #include "SMESHDS_ListIteratorOfListOfAsciiString.hxx" -#include "TColStd_ListOfInteger.hxx" -#include "TColStd_ListOfReal.hxx" -#include "TColStd_ListIteratorOfListOfInteger.hxx" -#include "TColStd_ListIteratorOfListOfReal.hxx" #include "SMESHDS_Command.hxx" #include "SMESHDS_CommandType.hxx" -#include "SMESHDS_ListOfCommand.hxx" -#include "SMESHDS_ListIteratorOfListOfCommand.hxx" -#include "Handle_SMESHDS_Command.hxx" - #include "SMESH_MeshEditor_i.hxx" + #include #include -//#include //**** SMESHDS en champ @@ -67,8 +56,8 @@ using namespace std; SMESH_Mesh_i::SMESH_Mesh_i() { - MESSAGE("SMESH_Mesh_i: default constructor, not for use"); - ASSERT(0); + MESSAGE("SMESH_Mesh_i: default constructor, not for use"); + ASSERT(0); }; //============================================================================= @@ -77,16 +66,14 @@ SMESH_Mesh_i::SMESH_Mesh_i() */ //============================================================================= -SMESH_Mesh_i::SMESH_Mesh_i(SMESH_Gen_i* gen_i, - GEOM::GEOM_Gen_ptr geomEngine, - CORBA::Long studyId, - int localId) +SMESH_Mesh_i::SMESH_Mesh_i(SMESH_Gen_i * gen_i, + GEOM::GEOM_Gen_ptr geomEngine, CORBA::Long studyId, int localId) { - MESSAGE("SMESH_Mesh_i"); - _gen_i = gen_i; - _id = localId; - _geom = GEOM::GEOM_Gen::_narrow(geomEngine); - _studyId = studyId; + MESSAGE("SMESH_Mesh_i"); + _gen_i = gen_i; + _id = localId; + _geom = GEOM::GEOM_Gen::_narrow(geomEngine); + _studyId = studyId; } //============================================================================= @@ -97,11 +84,10 @@ SMESH_Mesh_i::SMESH_Mesh_i(SMESH_Gen_i* gen_i, SMESH_Mesh_i::~SMESH_Mesh_i() { - MESSAGE("~SMESH_Mesh_i"); - // **** + MESSAGE("~SMESH_Mesh_i"); + // **** }; - //============================================================================= /*! * @@ -109,144 +95,139 @@ SMESH_Mesh_i::~SMESH_Mesh_i() //============================================================================= CORBA::Boolean SMESH_Mesh_i::AddHypothesis(GEOM::GEOM_Shape_ptr aSubShape, - SMESH::SMESH_Hypothesis_ptr anHyp) - throw (SALOME::SALOME_Exception) + SMESH::SMESH_Hypothesis_ptr anHyp) throw(SALOME::SALOME_Exception) { - MESSAGE("AddHypothesis"); - // **** proposer liste de subShape (selection multiple) + MESSAGE("AddHypothesis"); + // **** proposer liste de subShape (selection multiple) - GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape); - if (CORBA::is_nil(mySubShape)) - THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", \ - SALOME::BAD_PARAM); + GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape); + if (CORBA::is_nil(mySubShape)) + THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", + SALOME::BAD_PARAM); - SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp); - if (CORBA::is_nil(myHyp)) - THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", \ - SALOME::BAD_PARAM); - bool ret = false; - try - { - TopoDS_Shape myLocSubShape= - _gen_i->_ShapeReader->GetShape(_geom,mySubShape); - int hypId = myHyp->GetId(); - ret = _impl->AddHypothesis(myLocSubShape, hypId); - } - catch (SALOME_Exception& S_ex) - { - THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \ - SALOME::BAD_PARAM); - } - return ret; -}; - -//============================================================================= -/*! - * - */ -//============================================================================= - -CORBA::Boolean -SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Shape_ptr aSubShape, - SMESH::SMESH_Hypothesis_ptr anHyp) - throw (SALOME::SALOME_Exception) -{ - MESSAGE("RemoveHypothesis"); - // **** proposer liste de subShape (selection multiple) - - GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape); - if (CORBA::is_nil(mySubShape)) - THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", \ - SALOME::BAD_PARAM); - - SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp); - if (CORBA::is_nil(myHyp)) - THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", \ - SALOME::BAD_PARAM); - - bool ret = false; - try - { - TopoDS_Shape myLocSubShape= - _gen_i->_ShapeReader->GetShape(_geom,mySubShape); - int hypId = myHyp->GetId(); - ret = _impl->RemoveHypothesis(myLocSubShape, hypId); - } - catch (SALOME_Exception& S_ex) - { - THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), \ - SALOME::BAD_PARAM); - } - return ret; -}; - -//============================================================================= -/*! - * - */ -//============================================================================= - -SMESH::ListOfHypothesis* -SMESH_Mesh_i::GetHypothesisList(GEOM::GEOM_Shape_ptr aSubShape) - throw (SALOME::SALOME_Exception) -{ - MESSAGE("GetHypothesisList"); - // **** -}; - -//============================================================================= -/*! - * - */ -//============================================================================= -SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetElementsOnShape(GEOM::GEOM_Shape_ptr aSubShape) - throw (SALOME::SALOME_Exception) -{ - MESSAGE("SMESH_Mesh_i::GetElementsOnShape"); - GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape); - if (CORBA::is_nil(mySubShape)) - THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", \ - SALOME::BAD_PARAM); - - int subMeshId = 0; - try - { - SMESH_subMesh_i* subMeshServant; - TopoDS_Shape myLocSubShape - = _gen_i->_ShapeReader->GetShape(_geom,mySubShape); - - //Get or Create the SMESH_subMesh object implementation - - ::SMESH_subMesh * mySubMesh - = _impl->GetSubMesh(myLocSubShape); - subMeshId = mySubMesh->GetId(); - - // create a new subMesh object servant if there is none for the shape - - if (_mapSubMesh.find(subMeshId) != _mapSubMesh.end()) + SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp); + if (CORBA::is_nil(myHyp)) + THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", + SALOME::BAD_PARAM); + bool ret = false; + try { - ASSERT(_mapSubMesh_i.find(subMeshId) != _mapSubMesh_i.end()); - subMeshServant = _mapSubMesh_i[subMeshId]; + TopoDS_Shape myLocSubShape = + _gen_i->_ShapeReader->GetShape(_geom, mySubShape); + int hypId = myHyp->GetId(); + ret = _impl->AddHypothesis(myLocSubShape, hypId); } - else + catch(SALOME_Exception & S_ex) { - // create and activate the CORBA servant of Mesh - subMeshServant = new SMESH_subMesh_i(_gen_i, this, subMeshId); - SMESH::SMESH_subMesh_var subMesh - = SMESH::SMESH_subMesh::_narrow(subMeshServant->_this()); - _mapSubMesh[subMeshId] = mySubMesh; - _mapSubMesh_i[subMeshId] = subMeshServant; - _mapSubMeshIor[subMeshId] - = SMESH::SMESH_subMesh::_duplicate(subMesh); + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); } - } - catch (SALOME_Exception& S_ex) - { - THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); - } + return ret; +}; - ASSERT(_mapSubMeshIor.find(subMeshId) != _mapSubMeshIor.end()); - return SMESH::SMESH_subMesh::_duplicate(_mapSubMeshIor[subMeshId]); +//============================================================================= +/*! + * + */ +//============================================================================= + +CORBA::Boolean + SMESH_Mesh_i::RemoveHypothesis(GEOM::GEOM_Shape_ptr aSubShape, + SMESH::SMESH_Hypothesis_ptr anHyp) throw(SALOME::SALOME_Exception) +{ + MESSAGE("RemoveHypothesis"); + // **** proposer liste de subShape (selection multiple) + + GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape); + if (CORBA::is_nil(mySubShape)) + THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", + SALOME::BAD_PARAM); + + SMESH::SMESH_Hypothesis_var myHyp = SMESH::SMESH_Hypothesis::_narrow(anHyp); + if (CORBA::is_nil(myHyp)) + THROW_SALOME_CORBA_EXCEPTION("bad hypothesis reference", + SALOME::BAD_PARAM); + + bool ret = false; + try + { + TopoDS_Shape myLocSubShape = + _gen_i->_ShapeReader->GetShape(_geom, mySubShape); + int hypId = myHyp->GetId(); + ret = _impl->RemoveHypothesis(myLocSubShape, hypId); + } + catch(SALOME_Exception & S_ex) + { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); + } + return ret; +}; + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH::ListOfHypothesis * + SMESH_Mesh_i::GetHypothesisList(GEOM::GEOM_Shape_ptr aSubShape) +throw(SALOME::SALOME_Exception) +{ + MESSAGE("GetHypothesisList"); + // **** +}; + +//============================================================================= +/*! + * + */ +//============================================================================= +SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetElementsOnShape(GEOM:: + GEOM_Shape_ptr aSubShape) throw(SALOME::SALOME_Exception) +{ + MESSAGE("SMESH_Mesh_i::GetElementsOnShape"); + GEOM::GEOM_Shape_var mySubShape = GEOM::GEOM_Shape::_narrow(aSubShape); + if (CORBA::is_nil(mySubShape)) + THROW_SALOME_CORBA_EXCEPTION("bad subShape reference", + SALOME::BAD_PARAM); + + int subMeshId = 0; + try + { + SMESH_subMesh_i *subMeshServant; + TopoDS_Shape myLocSubShape + = _gen_i->_ShapeReader->GetShape(_geom, mySubShape); + + //Get or Create the SMESH_subMesh object implementation + + ::SMESH_subMesh * mySubMesh = _impl->GetSubMesh(myLocSubShape); + subMeshId = mySubMesh->GetId(); + + // create a new subMesh object servant if there is none for the shape + + if (_mapSubMesh.find(subMeshId) != _mapSubMesh.end()) + { + ASSERT(_mapSubMesh_i.find(subMeshId) != _mapSubMesh_i.end()); + subMeshServant = _mapSubMesh_i[subMeshId]; + } + else + { + // create and activate the CORBA servant of Mesh + subMeshServant = new SMESH_subMesh_i(_gen_i, this, subMeshId); + SMESH::SMESH_subMesh_var subMesh + = SMESH::SMESH_subMesh::_narrow(subMeshServant->_this()); + _mapSubMesh[subMeshId] = mySubMesh; + _mapSubMesh_i[subMeshId] = subMeshServant; + _mapSubMeshIor[subMeshId] + = SMESH::SMESH_subMesh::_duplicate(subMesh); + } + } + catch(SALOME_Exception & S_ex) + { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); + } + + ASSERT(_mapSubMeshIor.find(subMeshId) != _mapSubMeshIor.end()); + return SMESH::SMESH_subMesh::_duplicate(_mapSubMeshIor[subMeshId]); } //============================================================================= @@ -255,62 +236,63 @@ SMESH::SMESH_subMesh_ptr SMESH_Mesh_i::GetElementsOnShape(GEOM::GEOM_Shape_ptr a */ //============================================================================= -SMESH::log_array* SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet) - throw (SALOME::SALOME_Exception) +SMESH::log_array * SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet) +throw(SALOME::SALOME_Exception) { - MESSAGE("SMESH_Mesh_i::GetLog"); + MESSAGE("SMESH_Mesh_i::GetLog"); - SMESH::log_array_var aLog; - try - { - const SMESHDS_ListOfCommand& logDS =_impl->GetLog(); - aLog = new SMESH::log_array; - int indexLog = 0; - int lg = logDS.Extent(); - SCRUTE(lg); - aLog->length(lg); - SMESHDS_ListIteratorOfListOfCommand its(logDS); - while(its.More()) - { - Handle(SMESHDS_Command) com = its.Value(); - int comType = com->GetType(); - //SCRUTE(comType); - int lgcom = com->GetNumber(); - //SCRUTE(lgcom); - const TColStd_ListOfInteger& intList = com->GetIndexes(); - int inum = intList.Extent(); - //SCRUTE(inum); - TColStd_ListIteratorOfListOfInteger ii(intList); - const TColStd_ListOfReal& coordList = com->GetCoords(); - int rnum = coordList.Extent(); - //SCRUTE(rnum); - TColStd_ListIteratorOfListOfReal ir(coordList); - aLog[indexLog].commandType = comType; - aLog[indexLog].number = lgcom; - aLog[indexLog].coords.length(rnum); - aLog[indexLog].indexes.length(inum); - for (int i=0; iClearLog(); - } - catch (SALOME_Exception& S_ex) - { - THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); - } - return aLog._retn(); + SMESH::log_array_var aLog; + try + { + list < SMESHDS_Command * >logDS = _impl->GetLog(); + aLog = new SMESH::log_array; + int indexLog = 0; + int lg = logDS.size(); + SCRUTE(lg); + aLog->length(lg); + list < SMESHDS_Command * >::iterator its = logDS.begin(); + while (its != logDS.end()) + { + SMESHDS_Command *com = *its; + int comType = com->GetType(); + //SCRUTE(comType); + int lgcom = com->GetNumber(); + //SCRUTE(lgcom); + const list < int >&intList = com->GetIndexes(); + int inum = intList.size(); + //SCRUTE(inum); + list < int >::const_iterator ii = intList.begin(); + const list < double >&coordList = com->GetCoords(); + int rnum = coordList.size(); + //SCRUTE(rnum); + list < double >::const_iterator ir = coordList.begin(); + aLog[indexLog].commandType = comType; + aLog[indexLog].number = lgcom; + aLog[indexLog].coords.length(rnum); + aLog[indexLog].indexes.length(inum); + for (int i = 0; i < rnum; i++) + { + aLog[indexLog].coords[i] = *ir; + //MESSAGE(" "<ClearLog(); + } + catch(SALOME_Exception & S_ex) + { + THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); + } + return aLog._retn(); } // SMESH::string_array* SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet) @@ -330,97 +312,97 @@ SMESH::log_array* SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet) // SMESHDS_ListIteratorOfListOfCommand its(logDS); // while(its.More()) // { -// Handle(SMESHDS_Command) com = its.Value(); -// int comType = com->GetType(); -// SCRUTE(comType); -// int lgcom = com->GetNumber(); -// SCRUTE(lgcom); -// logSize += lgcom; -// aLog->length(logSize); -// SCRUTE(logSize); -// const TColStd_ListOfInteger& intList = com->GetIndexes(); -// TColStd_ListIteratorOfListOfInteger ii(intList); -// const TColStd_ListOfReal& coordList = com->GetCoords(); -// TColStd_ListIteratorOfListOfReal ir(coordList); -// for (int icom = 1; icom <= lgcom; icom++) -// { -// ostringstream S; -// switch (comType) -// { -// case SMESHDS_AddNode: -// S << "AddNode " << ii.Value(); ii.Next(); -// S << " " << ir.Value(); ir.Next(); -// S << " " << ir.Value(); ir.Next(); -// S << " " << ir.Value(); ir.Next(); -// break; -// case SMESHDS_AddEdge: -// S << "AddEdge " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// break; -// case SMESHDS_AddTriangle: -// S << "AddFace " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// break; -// case SMESHDS_AddQuadrangle: -// S << "AddFace " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// break; -// case SMESHDS_AddTetrahedron: -// S << "AddVolume " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// break; -// case SMESHDS_AddPyramid: -// S << "AddVolume " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// break; -// case SMESHDS_AddPrism: -// S << "AddVolume " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// break; -// case SMESHDS_AddHexahedron: -// S << "AddVolume " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// S << " " << ii.Value(); ii.Next(); -// break; -// case SMESHDS_RemoveNode: -// S << "RemoveNode " << ii.Value(); ii.Next(); -// break; -// case SMESHDS_RemoveElement: -// S << "RemoveElement " << ii.Value(); ii.Next(); -// break; -// default: -// ASSERT(0); -// break; -// } -// string ch = S.str(); -// SCRUTE(ch); -// aLog[indexLog++] = CORBA::string_dup(ch.c_str()); -// } -// its.Next(); +// Handle(SMESHDS_Command) com = its.Value(); +// int comType = com->GetType(); +// SCRUTE(comType); +// int lgcom = com->GetNumber(); +// SCRUTE(lgcom); +// logSize += lgcom; +// aLog->length(logSize); +// SCRUTE(logSize); +// const TColStd_ListOfInteger& intList = com->GetIndexes(); +// TColStd_ListIteratorOfListOfInteger ii(intList); +// const TColStd_ListOfReal& coordList = com->GetCoords(); +// TColStd_ListIteratorOfListOfReal ir(coordList); +// for (int icom = 1; icom <= lgcom; icom++) +// { +// ostringstream S; +// switch (comType) +// { +// case SMESHDS_AddNode: +// S << "AddNode " << ii.Value(); ii.Next(); +// S << " " << ir.Value(); ir.Next(); +// S << " " << ir.Value(); ir.Next(); +// S << " " << ir.Value(); ir.Next(); +// break; +// case SMESHDS_AddEdge: +// S << "AddEdge " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_AddTriangle: +// S << "AddFace " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_AddQuadrangle: +// S << "AddFace " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_AddTetrahedron: +// S << "AddVolume " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_AddPyramid: +// S << "AddVolume " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_AddPrism: +// S << "AddVolume " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_AddHexahedron: +// S << "AddVolume " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// S << " " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_RemoveNode: +// S << "RemoveNode " << ii.Value(); ii.Next(); +// break; +// case SMESHDS_RemoveElement: +// S << "RemoveElement " << ii.Value(); ii.Next(); +// break; +// default: +// ASSERT(0); +// break; +// } +// string ch = S.str(); +// SCRUTE(ch); +// aLog[indexLog++] = CORBA::string_dup(ch.c_str()); +// } +// its.Next(); // } // if (clearAfterGet) _impl->ClearLog(); // } @@ -437,11 +419,10 @@ SMESH::log_array* SMESH_Mesh_i::GetLog(CORBA::Boolean clearAfterGet) */ //============================================================================= -void SMESH_Mesh_i::ClearLog() - throw (SALOME::SALOME_Exception) +void SMESH_Mesh_i::ClearLog() throw(SALOME::SALOME_Exception) { - MESSAGE("SMESH_Mesh_i::ClearLog"); - // **** + MESSAGE("SMESH_Mesh_i::ClearLog"); + // **** } //============================================================================= @@ -450,11 +431,10 @@ void SMESH_Mesh_i::ClearLog() */ //============================================================================= -CORBA::Long SMESH_Mesh_i::GetId() - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::GetId()throw(SALOME::SALOME_Exception) { - MESSAGE("SMESH_Mesh_i::GetId"); - return _id; + MESSAGE("SMESH_Mesh_i::GetId"); + return _id; } //============================================================================= @@ -463,21 +443,9 @@ CORBA::Long SMESH_Mesh_i::GetId() */ //============================================================================= -CORBA::Long SMESH_Mesh_i::GetStudyId() - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::GetStudyId()throw(SALOME::SALOME_Exception) { - return _studyId; -} -//============================================================================= -/*! - * - */ -//============================================================================= - -void SMESH_Mesh_i::SetImpl(::SMESH_Mesh* impl) -{ - MESSAGE("SMESH_Mesh_i::SetImpl"); - _impl = impl; + return _studyId; } //============================================================================= @@ -486,10 +454,22 @@ void SMESH_Mesh_i::SetImpl(::SMESH_Mesh* impl) */ //============================================================================= -::SMESH_Mesh& SMESH_Mesh_i::GetImpl() +void SMESH_Mesh_i::SetImpl(::SMESH_Mesh * impl) { - MESSAGE("SMESH_Mesh_i::GetImpl()"); - return *_impl; + MESSAGE("SMESH_Mesh_i::SetImpl"); + _impl = impl; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +::SMESH_Mesh & SMESH_Mesh_i::GetImpl() +{ + MESSAGE("SMESH_Mesh_i::GetImpl()"); + return *_impl; } //============================================================================= @@ -500,8 +480,8 @@ void SMESH_Mesh_i::SetImpl(::SMESH_Mesh* impl) GEOM::GEOM_Gen_ptr SMESH_Mesh_i::GetGeomEngine() { - MESSAGE("SMESH_Mesh_i::GetGeomEngine"); - return GEOM::GEOM_Gen::_duplicate(_geom); + MESSAGE("SMESH_Mesh_i::GetGeomEngine"); + return GEOM::GEOM_Gen::_duplicate(_geom); } //============================================================================= @@ -512,9 +492,9 @@ GEOM::GEOM_Gen_ptr SMESH_Mesh_i::GetGeomEngine() void SMESH_Mesh_i::SetIor(SMESH::SMESH_Mesh_ptr myIor) { - MESSAGE("SMESH_Mesh_i::SetIor"); - _myIor = SMESH::SMESH_Mesh::_duplicate(myIor); - ASSERT(! CORBA::is_nil(_myIor)); + MESSAGE("SMESH_Mesh_i::SetIor"); + _myIor = SMESH::SMESH_Mesh::_duplicate(myIor); + ASSERT(!CORBA::is_nil(_myIor)); } //============================================================================= @@ -525,10 +505,11 @@ void SMESH_Mesh_i::SetIor(SMESH::SMESH_Mesh_ptr myIor) SMESH::SMESH_Mesh_ptr SMESH_Mesh_i::GetIor() { - MESSAGE("SMESH_Mesh_i::GetIor"); - ASSERT(! CORBA::is_nil(_myIor)); - return SMESH::SMESH_Mesh::_duplicate(_myIor); + MESSAGE("SMESH_Mesh_i::GetIor"); + ASSERT(!CORBA::is_nil(_myIor)); + return SMESH::SMESH_Mesh::_duplicate(_myIor); } + //============================================================================= /*! * @@ -537,9 +518,10 @@ SMESH::SMESH_Mesh_ptr SMESH_Mesh_i::GetIor() SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor() { - SMESH_MeshEditor_i* aMeshEditor = new SMESH_MeshEditor_i(_impl->GetMeshDS()); - SMESH::SMESH_MeshEditor_var aMesh = aMeshEditor->_this(); - return aMesh._retn(); + SMESH_MeshEditor_i *aMeshEditor = + new SMESH_MeshEditor_i(_impl->GetMeshDS()); + SMESH::SMESH_MeshEditor_var aMesh = aMeshEditor->_this(); + return aMesh._retn(); } //============================================================================= @@ -548,35 +530,17 @@ SMESH::SMESH_MeshEditor_ptr SMESH_Mesh_i::GetMeshEditor() */ //============================================================================= -void SMESH_Mesh_i::ExportMED( const char* file ) - throw (SALOME::SALOME_Exception) +void SMESH_Mesh_i::ExportMED(const char *file) throw(SALOME::SALOME_Exception) { - _impl->ExportMED( file ); + _impl->ExportMED(file); } -void SMESH_Mesh_i::ExportDAT( const char* file ) - throw (SALOME::SALOME_Exception) +void SMESH_Mesh_i::ExportDAT(const char *file) throw(SALOME::SALOME_Exception) { - _impl->ExportDAT( file ); + _impl->ExportDAT(file); } -void SMESH_Mesh_i::ExportUNV( const char* file ) - throw (SALOME::SALOME_Exception) +void SMESH_Mesh_i::ExportUNV(const char *file) throw(SALOME::SALOME_Exception) { - _impl->ExportUNV( file ); -} - - -//============================================================================= -/*! - * - */ -//============================================================================= - -SALOME_MED::MESH_ptr SMESH_Mesh_i::GetMEDMesh() - throw (SALOME::SALOME_Exception) -{ - SMESH_MEDMesh_i* aMedMesh = new SMESH_MEDMesh_i( this ); - SALOME_MED::MESH_var aMesh = aMedMesh->_this(); - return aMesh._retn(); + _impl->ExportUNV(file); } //============================================================================= @@ -584,10 +548,12 @@ SALOME_MED::MESH_ptr SMESH_Mesh_i::GetMEDMesh() * */ //============================================================================= -CORBA::Long SMESH_Mesh_i::NbNodes() - throw (SALOME::SALOME_Exception) + +SALOME_MED::MESH_ptr SMESH_Mesh_i::GetMEDMesh()throw(SALOME::SALOME_Exception) { - return _impl->NbNodes(); + SMESH_MEDMesh_i *aMedMesh = new SMESH_MEDMesh_i(this); + SALOME_MED::MESH_var aMesh = aMedMesh->_this(); + return aMesh._retn(); } //============================================================================= @@ -595,10 +561,9 @@ CORBA::Long SMESH_Mesh_i::NbNodes() * */ //============================================================================= -CORBA::Long SMESH_Mesh_i::NbEdges() - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbNodes()throw(SALOME::SALOME_Exception) { - return _impl->NbEdges(); + return _impl->NbNodes(); } //============================================================================= @@ -606,20 +571,9 @@ CORBA::Long SMESH_Mesh_i::NbEdges() * */ //============================================================================= -CORBA::Long SMESH_Mesh_i::NbFaces() - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbEdges()throw(SALOME::SALOME_Exception) { - return _impl->NbFaces(); -} -CORBA::Long SMESH_Mesh_i::NbTriangles() - throw (SALOME::SALOME_Exception) -{ - return _impl->NbTriangles(); -} -CORBA::Long SMESH_Mesh_i::NbQuadrangles() - throw (SALOME::SALOME_Exception) -{ - return _impl->NbQuadrangles(); + return _impl->NbEdges(); } //============================================================================= @@ -627,20 +581,19 @@ CORBA::Long SMESH_Mesh_i::NbQuadrangles() * */ //============================================================================= -CORBA::Long SMESH_Mesh_i::NbVolumes() - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbFaces()throw(SALOME::SALOME_Exception) { - return _impl->NbVolumes(); + return _impl->NbFaces(); } -CORBA::Long SMESH_Mesh_i::NbTetras() - throw (SALOME::SALOME_Exception) + +CORBA::Long SMESH_Mesh_i::NbTriangles()throw(SALOME::SALOME_Exception) { - return _impl->NbTetras(); + return _impl->NbTriangles(); } -CORBA::Long SMESH_Mesh_i::NbHexas() - throw (SALOME::SALOME_Exception) + +CORBA::Long SMESH_Mesh_i::NbQuadrangles()throw(SALOME::SALOME_Exception) { - return _impl->NbHexas(); + return _impl->NbQuadrangles(); } //============================================================================= @@ -648,8 +601,27 @@ CORBA::Long SMESH_Mesh_i::NbHexas() * */ //============================================================================= -CORBA::Long SMESH_Mesh_i::NbSubMesh() - throw (SALOME::SALOME_Exception) +CORBA::Long SMESH_Mesh_i::NbVolumes()throw(SALOME::SALOME_Exception) { - return _impl->NbSubMesh(); + return _impl->NbVolumes(); +} + +CORBA::Long SMESH_Mesh_i::NbTetras()throw(SALOME::SALOME_Exception) +{ + return _impl->NbTetras(); +} + +CORBA::Long SMESH_Mesh_i::NbHexas()throw(SALOME::SALOME_Exception) +{ + return _impl->NbHexas(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +CORBA::Long SMESH_Mesh_i::NbSubMesh()throw(SALOME::SALOME_Exception) +{ + return _impl->NbSubMesh(); }