Salome HOME
correct small problem from the version in the MedFileV2_2 branch.
[modules/med.git] / src / MEDMEM / MEDMEM_GibiMeshDriver.cxx
index 0de7ab1a87206ae2ecda2ea4d0dde50c7ff61795..d401ffff140fbd2619c9f2b59f53cad7022987ca 100644 (file)
@@ -17,12 +17,24 @@ using namespace std;
 
 /////
 using namespace MED_EN;
+using namespace MEDMEM;
 /////
 
 
 /////
 const size_t GIBI_MESH_DRIVER::nb_geometrie_gibi;
-const medGeometryElement GIBI_MESH_DRIVER::geomGIBItoMED[nb_geometrie_gibi];
+
+const medGeometryElement GIBI_MESH_DRIVER::geomGIBItoMED[nb_geometrie_gibi] =
+     {   /*1 */ MED_POINT1 ,/*2 */ MED_SEG2   ,/*3 */ MED_SEG3   ,/*4 */ MED_TRIA3  ,/*5 */ MED_NONE   ,
+       /*6 */ MED_TRIA6  ,/*7 */ MED_NONE   ,/*8 */ MED_QUAD4  ,/*9 */ MED_NONE   ,/*10*/ MED_QUAD8  ,
+       /*11*/ MED_NONE   ,/*12*/ MED_NONE   ,/*13*/ MED_NONE   ,/*14*/ MED_HEXA8  ,/*15*/ MED_HEXA20 ,
+       /*16*/ MED_PENTA6 ,/*17*/ MED_PENTA15,/*18*/ MED_NONE   ,/*19*/ MED_NONE   ,/*20*/ MED_NONE   ,
+       /*21*/ MED_NONE   ,/*22*/ MED_NONE   ,/*23*/ MED_TETRA4 ,/*24*/ MED_TETRA10,/*25*/ MED_PYRA5  ,
+       /*26*/ MED_PYRA13 ,/*27*/ MED_NONE   ,/*28*/ MED_NONE   ,/*29*/ MED_NONE   ,/*30*/ MED_NONE   ,
+       /*31*/ MED_NONE   ,/*32*/ MED_NONE   ,/*33*/ MED_NONE   ,/*34*/ MED_NONE   ,/*35*/ MED_NONE   ,
+       /*36*/ MED_NONE   ,/*37*/ MED_NONE   ,/*38*/ MED_NONE   ,/*39*/ MED_NONE   ,/*40*/ MED_NONE   ,
+       /*41*/ MED_NONE   ,/*42*/ MED_NONE   ,/*43*/ MED_NONE   ,/*44*/ MED_NONE   ,/*45*/ MED_NONE   ,
+       /*46*/ MED_NONE   ,/*47*/ MED_NONE   };
 /////
 
 // Every memory allocation made in the MedDriver members function are desallocated in the Mesh destructor 
@@ -42,7 +54,13 @@ GIBI_MESH_DRIVER::GIBI_MESH_DRIVER(const string & fileName,
   _ptrMesh(ptrMesh)
   // A VOIR _medIdt(MED_INVALID), 
 {
-  _meshName=fileName.substr(0,fileName.rfind("."));
+//   _meshName=fileName.substr(0,fileName.rfind("."));
+    // mesh name construction from fileName
+    const string ext=".sauve"; // expected extension
+    string::size_type pos=fileName.find(ext,0);
+    string::size_type pos1=fileName.rfind('/');
+    _meshName = string(fileName,pos1+1,pos-pos1-1); //get rid of directory & extension
+    SCRUTE(_meshName);
 }
   
 GIBI_MESH_DRIVER::GIBI_MESH_DRIVER(const GIBI_MESH_DRIVER & driver): 
@@ -268,7 +286,7 @@ void GIBI_MESH_RDONLY_DRIVER::read(void) throw (MEDEXCEPTION)
                      {
                        if( i->groupes.size() ) // le groupe i contient des sous-maillages
                          {
-                           for( std::list<int>::iterator j=i->groupes.begin(); j!=i->groupes.end(); ++j)
+                           for( std::vector<int>::iterator j=i->groupes.begin(); j!=i->groupes.end(); ++j)
                              {
                                // pour chacun des sous-maillages j, on recupere les iterateurs *k sur les  maille 
                                // contenues et on les insere dans le groupe i
@@ -276,7 +294,7 @@ void GIBI_MESH_RDONLY_DRIVER::read(void) throw (MEDEXCEPTION)
                                for( ; k!=medi.groupes[*j-1].mailles.end(); ++k)
                                  i->mailles.insert(*k);
                              }
-                           i->groupes.clear(); // après avoir insere leur mailles, on efface les groupes composites
+                           i->groupes.clear(); // après avoir inséré leur mailles, on efface les groupes composites
                          }
                      }
                    
@@ -371,21 +389,18 @@ void GIBI_MESH_RDONLY_DRIVER::read(void) throw (MEDEXCEPTION)
        _ptrMesh->_groupEdge = groupEdge;
        _ptrMesh->_groupNode = groupNode;
 
-       //Affectation derniers attributs objet Mesh
-       _ptrMesh->_numberOfCellsGroups = _ptrMesh->_groupCell.size();
-       _ptrMesh->_numberOfFacesGroups = _ptrMesh->_groupFace.size();
-       _ptrMesh->_numberOfEdgesGroups = _ptrMesh->_groupEdge.size();
-       _ptrMesh->_numberOfNodesGroups = _ptrMesh->_groupNode.size();
-
        // appele en dernier car cette fonction detruit le maillage intermediaire!
        _ptrMesh->_connectivity = medi.getConnectivity(); 
 
        // calcul de la connectivite d-1 complete, avec renumerotation des groupes
-       if (_ptrMesh->_spaceDimension==3)
-           _ptrMesh->_connectivity->updateGroup(_ptrMesh->_groupFace) ;
-       else if (_ptrMesh->_spaceDimension==2)
-           _ptrMesh->_connectivity->updateGroup(_ptrMesh->_groupEdge) ;
+       //if (_ptrMesh->_spaceDimension==3)
+       //    _ptrMesh->_connectivity->updateGroup(_ptrMesh->_groupFace) ;
+       //else if (_ptrMesh->_spaceDimension==2)
+       //    _ptrMesh->_connectivity->updateGroup(_ptrMesh->_groupEdge) ;
        
+       // Creation des familles à partir des groupes
+       // NC : Cet appel pourra être différé quand la gestion de la cohérence famille/groupes sera assurée
+       _ptrMesh->createFamilies();
     }