Salome HOME
Join modifications from branch OCC_development_for_3_2_0a2
[modules/smesh.git] / src / SMESH_I / SMESH_MEDMesh_i.cxx
index 71fc85c08e673ab86e5048c6d5efca9135e7709c..bbf9590069631a612e308244c12bfd7fcd7b9668 100644 (file)
@@ -24,7 +24,6 @@
 //  File   : SMESH_MEDMesh_i.cxx
 //  Module : SMESH
 
-using namespace std;
 #include "SMESH_MEDMesh_i.hxx"
 #include "SMESH_Mesh_i.hxx"
 
@@ -54,11 +53,15 @@ using namespace std;
 
 # include "Utils_ORB_INIT.hxx"
 # include "Utils_SINGLETON.hxx"
+# include "Utils_ExceptHandlers.hxx"
+
 extern "C"
 {
 #include <stdio.h>
 }
 
+using namespace std;
+
 //=============================================================================
 /*!
  * Default constructor
@@ -86,13 +89,17 @@ SMESH_MEDMesh_i::~SMESH_MEDMesh_i()
  */
 //=============================================================================
 SMESH_MEDMesh_i::SMESH_MEDMesh_i(::SMESH_Mesh_i * m_i):_meshId(""),
-_compte(false),
-_creeFamily(false), _famIdent(0), _indexElts(0), _indexEnts(0)
+                                                      _compte(false),
+                                                      _creeFamily(false),
+                                                      _famIdent(0),
+                                                      _indexElts(0),
+                                                      _indexEnts(0)
 {
+       BEGIN_OF("Constructor SMESH_MEDMesh_i");
+
        _mesh_i = m_i;
        _meshDS = _mesh_i->GetImpl().GetMeshDS();
 
-       BEGIN_OF("Constructor SMESH_MEDMesh_i");
        END_OF("Constructor SMESH_MEDMesh_i");
 }
 
@@ -162,13 +169,55 @@ CORBA::Long SMESH_MEDMesh_i::getMeshDimension()throw(SALOME::SALOME_Exception)
                        SALOME::INTERNAL_ERROR);
        return 3;
 }
+//=============================================================================
+/*!
+ * CORBA: Accessor for the boolean _isAGrid
+ */
+//=============================================================================
+CORBA::Boolean SMESH_MEDMesh_i::getIsAGrid() throw (SALOME::SALOME_Exception)
+{
+  MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!!!");
 
+  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+
+  return false;
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for the connectivities, to see if they exist
+ */
+//=============================================================================
+CORBA::Boolean
+SMESH_MEDMesh_i::existConnectivity(SALOME_MED::medConnectivity connectivityType,
+                                  SALOME_MED::medEntityMesh entity)
+  throw (SALOME::SALOME_Exception)
+{
+  MESSAGE("!!!!!! IMPLEMENTED BUT ONLY PARTIALLY !!!!!!");
+
+
+  return false;
+
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Coordinate
+ */
+//=============================================================================
+CORBA::Double SMESH_MEDMesh_i::getCoordinate(CORBA::Long Number, CORBA::Long Axis)
+  throw (SALOME::SALOME_Exception)
+{
+  MESSAGE("!!!!!! NOT YET IMPLEMENTED !!!!");
+
+  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+
+  return 0.0;
+}
 //=============================================================================
 /*!
  * CORBA: Accessor for Coordinates System
  */
 //=============================================================================
-char *SMESH_MEDMesh_i::getCoordinateSystem() throw(SALOME::SALOME_Exception)
+char *SMESH_MEDMesh_i::getCoordinatesSystem() throw(SALOME::SALOME_Exception)
 {
        if (_mesh_i == 0)
                THROW_SALOME_CORBA_EXCEPTION("No associated Mesh",
@@ -192,13 +241,13 @@ char *SMESH_MEDMesh_i::getCoordinateSystem() throw(SALOME::SALOME_Exception)
  * CORBA: Accessor for Coordinates
  */
 //=============================================================================
-Engines::double_array * SMESH_MEDMesh_i::getCoordinates(
+SALOME_MED::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;
+       SALOME_MED::double_array_var myseq = new SALOME_MED::double_array;
        try
        {
                // PN  : En dur
@@ -208,7 +257,7 @@ Engines::double_array * SMESH_MEDMesh_i::getCoordinates(
                myseq->length(nbNodes * spaceDimension);
                int i = 0;
 
-               SMDS_Iterator<const SMDS_MeshNode *> * itNodes=_meshDS->nodesIterator();
+               SMDS_NodeIteratorPtr itNodes=_meshDS->nodesIterator();
                while(itNodes->more())
                {
                        const SMDS_MeshNode* node = itNodes->next();
@@ -234,7 +283,6 @@ Engines::double_array * SMESH_MEDMesh_i::getCoordinates(
                        }
                        i++;
                }
-               delete itNodes;
        }
        catch(...)
        {
@@ -250,13 +298,13 @@ Engines::double_array * SMESH_MEDMesh_i::getCoordinates(
  * CORBA: Accessor for Coordinates Names
  */
 //=============================================================================
-Engines::string_array *
+SALOME_MED::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;
+       SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
        try
        {
                // PN : en dur
@@ -281,13 +329,13 @@ Engines::string_array *
  * CORBA: Accessor for Coordinates Units
  */
 //=============================================================================
-Engines::string_array *
+SALOME_MED::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;
+       SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
        try
        {
                // PN : en dur
@@ -436,13 +484,14 @@ CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED::
                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");
+               MESSAGE("Exception en accedant au nombre d élements");
                THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object",
                        SALOME::INTERNAL_ERROR);
        }
@@ -453,10 +502,12 @@ CORBA::Long SMESH_MEDMesh_i::getNumberOfElements(SALOME_MED::
  * 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)
+SALOME_MED::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",
@@ -474,6 +525,7 @@ Engines::long_array *
                        SALOME::BAD_PARAM);
 
        int index = _mapIndToSeqElts[geomElement];
+
        return _seq_elemId[index]._retn();
 }
 
@@ -482,9 +534,10 @@ Engines::long_array *
  * CORBA: Accessor for connectivities
  */
 //=============================================================================
-Engines::long_array *
-       SMESH_MEDMesh_i::getConnectivityIndex(SALOME_MED::medConnectivity mode,
-       SALOME_MED::medEntityMesh entity) throw(SALOME::SALOME_Exception)
+SALOME_MED::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);
@@ -496,10 +549,12 @@ Engines::long_array *
  * 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)
+CORBA::Long
+SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode,
+                                 SALOME_MED::medEntityMesh entity,
+                                 SALOME_MED::medGeometryElement type,
+                                 const SALOME_MED::long_array & connectivity)
+  throw(SALOME::SALOME_Exception)
 {
        const char *LOC = "getElementNumber ";
        MESSAGE(LOC << "Pas Implemente dans SMESH");
@@ -513,7 +568,7 @@ CORBA::Long SMESH_MEDMesh_i::getElementNumber(SALOME_MED::medConnectivity mode,
  * not implemented for MED_ALL_ENTITIES and MED_MAILLE
  */
 //=============================================================================
-Engines::long_array *
+SALOME_MED::long_array *
        SMESH_MEDMesh_i::getReverseConnectivity(SALOME_MED::
        medConnectivity mode) throw(SALOME::SALOME_Exception)
 {
@@ -527,7 +582,7 @@ Engines::long_array *
  * CORBA: Accessor for connectivities
  */
 //=============================================================================
-Engines::long_array *
+SALOME_MED::long_array *
        SMESH_MEDMesh_i::getReverseConnectivityIndex(SALOME_MED::
        medConnectivity mode) throw(SALOME::SALOME_Exception)
 {
@@ -641,7 +696,53 @@ SALOME_MED::GROUP_ptr SMESH_MEDMesh_i::getGroup(SALOME_MED::
        MESSAGE(" Pas d implementation des groupes dans SMESH");
        THROW_SALOME_CORBA_EXCEPTION("No group implementation", SALOME::BAD_PARAM);
 }
+//=============================================================================
+/*!
+ * CORBA: Returns references for the global numbering index
+ */
+//=============================================================================
+SALOME_MED::long_array*
+SMESH_MEDMesh_i::getGlobalNumberingIndex(SALOME_MED::medEntityMesh entity)
+  throw (SALOME::SALOME_Exception)
+{
+  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
+
+  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+
+  return NULL;
+}
+//=============================================================================
+/*!
+ * CORBA: Returns references for the support of boundary elements of type
+ * entity
+ */
+//=============================================================================
+SALOME_MED::SUPPORT_ptr
+SMESH_MEDMesh_i::getBoundaryElements(SALOME_MED::medEntityMesh entity)
+  throw (SALOME::SALOME_Exception)
+{
+  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
+
+  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+
+  return NULL;
+}
+//=============================================================================
+/*!
+ * CORBA: Returns references for the support of the skin of the support
+ * mySupport3D
+ */
+//=============================================================================
+SALOME_MED::SUPPORT_ptr
+SMESH_MEDMesh_i::getSkin(SALOME_MED::SUPPORT_ptr mySupport3D)
+  throw (SALOME::SALOME_Exception)
+{
+  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
+
+  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
 
+  return NULL;
+}
 //=============================================================================
 /*!
  * CORBA: 
@@ -850,7 +951,7 @@ void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
                int trouveSeg3 = 0;
                SALOME_MED::medGeometryElement medElement;
 
-               SMDS_Iterator<const SMDS_MeshEdge*> * itEdges=_meshDS->edgesIterator();
+               SMDS_EdgeIteratorPtr itEdges=_meshDS->edgesIterator();
                while(itEdges->more())
                {
                        const SMDS_MeshEdge* elem = itEdges->next();
@@ -884,16 +985,15 @@ void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
                        int index = _mapIndToSeqElts[medElement];
                        SCRUTE(index);
                        // Traitement de l arete
+
                        int longueur = _seq_elemId[index]->length();
                        _seq_elemId[index]->length(longueur + nb_of_nodes);
 
-                       SMDS_Iterator<const SMDS_MeshNode*> * itn=_meshDS->nodesIterator();
+                       SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
 
                        for(int k=0; itn->more(); k++)
                                _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
-                       delete itn;
                }
-               delete itEdges;
 
                _mapNbTypes[SALOME_MED::MED_EDGE] = trouveSeg2 + trouveSeg3;
 
@@ -908,7 +1008,7 @@ void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
                _mapIndToSeqElts[SALOME_MED::MED_QUAD4] = _indexElts++;
                _mapIndToVectTypes[SALOME_MED::MED_FACE] = _indexEnts++;
 
-               SMDS_Iterator<const SMDS_MeshFace*> * itFaces=_meshDS->facesIterator();
+               SMDS_FaceIteratorPtr itFaces=_meshDS->facesIterator();
                while(itFaces->more())
                {
                        const SMDS_MeshFace * elem = itFaces->next();
@@ -954,18 +1054,16 @@ void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
                        SCRUTE(index);
 
                        // Traitement de la face
-                       // Attention La numérotation des noeuds Med commence a 1
+                       // Attention La numérotation des noeuds Med commence a 1
 
                        int longueur = _seq_elemId[index]->length();
                        _seq_elemId[index]->length(longueur + nb_of_nodes);
 
-                       SMDS_Iterator<const SMDS_MeshNode*> * itn=_meshDS->nodesIterator();
+                       SMDS_NodeIteratorPtr itn=_meshDS->nodesIterator();
 
                        for(int k=0; itn->more(); k++)
                                _seq_elemId[index][longueur + k] = itn->next()->GetID()+1;
-                       delete itn;
                } //itFaces
-               delete itFaces;
 
                _mapNbTypes[SALOME_MED::MED_FACE] =
                        trouveTria3 + trouveTria6 + trouveQuad4;
@@ -976,7 +1074,7 @@ void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
 
                int trouveHexa8 = 0;
 
-               SMDS_Iterator<const SMDS_MeshVolume*> * itVolumes=_meshDS->volumesIterator();
+               SMDS_VolumeIteratorPtr itVolumes=_meshDS->volumesIterator();
                while(itVolumes->more())
                {
                        const SMDS_MeshVolume * elem = itVolumes->next();
@@ -994,12 +1092,10 @@ void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
                        int longueur = _seq_elemId[index]->length();
                        _seq_elemId[index]->length(longueur + nb_of_nodes);
 
-                       SMDS_Iterator<const SMDS_MeshNode*> * itn=_meshDS->nodesIterator();
+                       SMDS_NodeIteratorPtr 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]
@@ -1016,6 +1112,7 @@ void SMESH_MEDMesh_i::calculeNbElts() throw(SALOME::SALOME_Exception)
 //=============================================================================
 void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception)
 {
+  Unexpect aCatch(SALOME_SalomeException);
        string famDes = ("Je ne sais pas");
        string famName0 = "Famille_";
        string famName;
@@ -1024,7 +1121,7 @@ void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception)
        if (_creeFamily == false)
        {
                _creeFamily = true;
-               SMESH_subMesh_i *subMeshServant;
+               //SMESH_subMesh_i *subMeshServant;
 
                map < int, SMESH_subMesh_i * >::iterator it;
                for (it = _mesh_i->_mapSubMesh_i.begin();
@@ -1047,3 +1144,63 @@ void SMESH_MEDMesh_i::createFamilies() throw(SALOME::SALOME_Exception)
                }
        }
 };
+//=============================================================================
+/*!
+ * Gives informations of the considered mesh.
+ */
+//=============================================================================
+SALOME_MED::MESH::meshInfos * SMESH_MEDMesh_i::getMeshGlobal()
+  throw (SALOME::SALOME_Exception)
+{
+  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
+
+  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+
+  return NULL;
+}
+//=============================================================================
+/*!
+ * Gives informations on coordinates of the considered mesh.
+ */
+//=============================================================================
+SALOME_MED::MESH::coordinateInfos * SMESH_MEDMesh_i::getCoordGlobal()
+  throw (SALOME::SALOME_Exception)
+{
+  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
+
+  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+
+  return NULL;
+}
+//=============================================================================
+/*!
+ * Gives informations on connectivities of the considered mesh for the entity
+ * entity.
+ */
+//=============================================================================
+SALOME_MED::MESH::connectivityInfos *
+SMESH_MEDMesh_i::getConnectGlobal(SALOME_MED::medEntityMesh entity)
+  throw (SALOME::SALOME_Exception)
+{
+  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
+
+  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+
+  return NULL;
+}
+//=============================================================================
+/*!
+ * Gives the type of the element number of entity entity
+ */
+//=============================================================================
+SALOME_MED::medGeometryElement
+SMESH_MEDMesh_i::getElementType(SALOME_MED::medEntityMesh entity,
+                               CORBA::Long number)
+  throw (SALOME::SALOME_Exception)
+{
+  MESSAGE("!!!! NOT YET IMPLEMENTED !!!!!");
+
+  THROW_SALOME_CORBA_EXCEPTION("Unimplemented Method", SALOME::BAD_PARAM);
+
+  return (SALOME_MED::medGeometryElement) 0;
+}