Salome HOME
updated copyright message
[modules/homard.git] / src / HOMARD / HOMARD_DriverTools.cxx
index 49dbd12bc7192505b2750ce1f65b1da839cebd5c..5a7740bb6a6016270089bd2584bf0f6991fb23e2 100644 (file)
@@ -1,23 +1,20 @@
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2011-2023  CEA/DEN, EDF R&D
 //
-//  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 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, or (at your option) any later version.
 //
-//  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.
+// 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
+// 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
-//
-// ----------------------------------------------------------------------------
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //  File   : HOMARD_DriverTools.cxx
 //  Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
@@ -30,6 +27,7 @@
 #include "HOMARD_Hypothesis.hxx"
 #include "HOMARD_Iteration.hxx"
 #include "HOMARD_Zone.hxx"
+#include "HOMARD_YACS.hxx"
 #include <sstream>
 #include <cstdlib>
 #include "utilities.h"
 namespace HOMARD
 {
 
-  const char* const SEPARATOR = "|";
+  std::string SEPARATOR = "|" ;
 
   /*!
     \brief Read next chunk of data from the string
     \internal
-    
+
     The function tries to read next chunk of the data from the input string \a str.
     The parameter \a start specifies the start position of next chunk. If the operation
     read the chunk successfully, after its completion this parameter will refer to the
     start position of the next chunk. The function returns resulting chunk as a string.
     The status of the operation is returned via \a ok parameter.
-    
+
     \param str source data stream string
     \param start start position to get next chunk
     \param ok in this variable the status of the chunk reading operation is returned
@@ -81,6 +79,7 @@ namespace HOMARD
     case Hypothesis: signature = "HYPO"; break;
     case Iteration:  signature = "ITER"; break;
     case Boundary:   signature = "BOUNDARY"; break;
+    case YACS:       signature = "YACS"; break;
     default: break;
     }
     signature += separator();
@@ -93,11 +92,11 @@ namespace HOMARD
   */
   std::string separator()
   {
-    return std::string( SEPARATOR );
+    return SEPARATOR ;
   }
 
 // =======================
-// Case
+// 1.1. Case
 // =======================
   /*!
     \brief Dump case to the string
@@ -107,11 +106,13 @@ namespace HOMARD
   std::string Dump( const HOMARD_Cas& cas )
   {
     std::stringstream os;
+    std::string saux ;
     // ...
-    MESSAGE( ". Dump du cas "<<cas.GetName());
+    MESSAGE( ". Sauvegarde du cas "<<cas.GetName());
     os << cas.GetName();
     os << separator() << cas.GetDirName();
     os << separator() << cas.GetConfType();
+    os << separator() << cas.GetExtType();
 
     std::vector<double> coor = cas.GetBoundingBox();
     os << separator() << coor.size();
@@ -132,11 +133,17 @@ namespace HOMARD
     os << separator() << ListString.size();
     for ( it = ListString.begin(); it != ListString.end(); ++it )
          os << separator() << *it;
-    return os.str();
+
+    os << separator() << cas.GetPyram();
+
+    saux = os.str();
+//     MESSAGE( ". Fin avec "<<saux);
+    return saux ;
   }
 //
-// Iteration
-// ==========
+// ==============
+// 1.2. Iteration
+// ==============
 //
   /*!
     \brief Dump iteration to the string
@@ -146,18 +153,19 @@ namespace HOMARD
   std::string Dump( const HOMARD_Iteration& iteration )
   {
     std::stringstream os;
+    std::string saux ;
     // ...
-    MESSAGE( ". Dump de l'iteration "<<iteration.GetName());
+    MESSAGE( ". Sauvegarde de l'iteration "<<iteration.GetName());
     os << iteration.GetName();
-    os << separator() << iteration.GetEtat();
+    os << separator() << iteration.GetState();
     os << separator() << iteration.GetNumber();
     os << separator() << iteration.GetMeshFile();
-    os << separator() << iteration.GetMessFile();
+    os << separator() << iteration.GetLogFile();
     os << separator() << iteration.GetMeshName();
     os << separator() << iteration.GetFieldFile();
     os << separator() << iteration.GetTimeStep();
     os << separator() << iteration.GetRank();
-    os << separator() << iteration.GetIterParent();
+    os << separator() << iteration.GetIterParentName();
     //
     std::list<std::string> ListString = iteration.GetIterations();
     os << separator() << ListString.size();
@@ -167,12 +175,16 @@ namespace HOMARD
 
     os << separator() << iteration.GetHypoName();
     os << separator() << iteration.GetCaseName();
-    os << separator() << iteration.GetDirName();
-    return os.str();
+    os << separator() << iteration.GetDirNameLoc();
+
+    saux = os.str();
+//     MESSAGE( ". Fin avec "<<saux);
+    return saux ;
   }
 //
-// hypothese
-// ==============================
+// ==============
+// 1.3. hypothese
+// ==============
   /*!
     \brief Dump hypothesis to the string
     \param hypothesis hypothesis being dumped
@@ -181,8 +193,9 @@ namespace HOMARD
   std::string Dump( const HOMARD_Hypothesis& hypothesis )
   {
     std::stringstream os;
+    std::string saux ;
     // ...
-    MESSAGE( ". Dump de l'hypothese "<<hypothesis.GetName());
+    MESSAGE( ". Sauvegarde de l'hypothese "<<hypothesis.GetName());
     os << hypothesis.GetName();
     os << separator() << hypothesis.GetCaseCreation();
     os << separator() << hypothesis.GetAdapType();
@@ -193,10 +206,10 @@ namespace HOMARD
     os << separator() << hypothesis.GetThreshR();
     os << separator() << hypothesis.GetUnRefThrType();
     os << separator() << hypothesis.GetThreshC();
-    os << separator() << hypothesis.GetUseCompI();
+    os << separator() << hypothesis.GetUseField();
+    os << separator() << hypothesis.GetUseComp();
     os << separator() << hypothesis.GetTypeFieldInterp();
 
-
     std::list<std::string> ListString = hypothesis.GetIterations();
     std::list<std::string>::const_iterator it;
     os << separator() << ListString.size();
@@ -208,7 +221,7 @@ namespace HOMARD
     for ( it = ListString.begin(); it != ListString.end(); ++it )
           os << separator() << *it;
 
-    ListString = hypothesis.GetListComp();
+    ListString = hypothesis.GetComps();
     os << separator() << ListString.size();
     for ( it = ListString.begin(); it != ListString.end(); ++it )
          os << separator() << *it;
@@ -218,15 +231,24 @@ namespace HOMARD
     for ( it = ListString.begin(); it != ListString.end(); ++it )
           os << separator() << *it;
 
-    ListString = hypothesis.GetListFieldInterp();
+    ListString = hypothesis.GetFieldInterps();
     os << separator() << ListString.size();
     for ( it = ListString.begin(); it != ListString.end(); ++it )
           os << separator() << *it;
-    return os.str();
+
+    os << separator() << hypothesis.GetNivMax();
+    os << separator() << hypothesis.GetDiamMin();
+    os << separator() << hypothesis.GetAdapInit();
+    os << separator() << hypothesis.GetExtraOutput();
+
+    saux = os.str();
+//     MESSAGE( ". Fin avec "<<saux);
+    return saux ;
   }
 //
-// Zone
-// =========================
+// =========
+// 1.4. Zone
+// =========
 
   /*!
     \brief Dump zone to the string
@@ -236,16 +258,14 @@ namespace HOMARD
   std::string Dump( const HOMARD_Zone& zone )
   {
     std::stringstream os;
+    std::string saux ;
+    MESSAGE( ". Sauvegarde de la zone "<<zone.GetName());
     os << zone.GetName();
-    os << separator() << zone.GetZoneType();
-
-    std::vector<double> box = zone.GetBox();
-    for ( int i = 0; i < box.size(); i++ )
-      os << separator() << ( i < box.size() ? box[i] : 0. );
+    os << separator() << zone.GetType();
 
-    std::vector<double> sphere = zone.GetSphere();
-    for ( int i = 0; i < 4; i++ )
-      os << separator() << ( i < sphere.size() ? sphere[i] : 0. );
+    std::vector<double> coords = zone.GetCoords();
+    for ( int i = 0; i < coords.size(); i++ )
+      os << separator() << ( i < coords.size() ? coords[i] : 0. );
 
     std::vector<double> limit = zone.GetLimit();
     for ( int i = 0; i < 3; i++ )
@@ -256,11 +276,13 @@ namespace HOMARD
     std::list<std::string>::const_iterator it;
     for ( it = hypos.begin(); it != hypos.end(); ++it )
       os << separator() << *it;
-    return os.str();  
-
 
+    saux = os.str();
+//     MESSAGE( ". Fin avec "<<saux);
+    return saux ;
   }
 //
+// ==============================
 // 1.5. Archivage d'une frontiere
 // ==============================
 
@@ -272,25 +294,32 @@ namespace HOMARD
   std::string Dump( const HOMARD_Boundary& boundary )
   {
     std::stringstream os;
+    std::string saux ;
+    MESSAGE( ". Sauvegarde de la frontiere "<<boundary.GetName());
+
+    int BoundaryType = boundary.GetType() ;
 
     os << boundary.GetName() ;
-    os << separator() << boundary.GetBoundaryType() ;
+    os << separator() << BoundaryType ;
     os << separator() << boundary.GetCaseCreation() ;
-    os << separator() << boundary.GetMeshFile();
-    os << separator() << boundary.GetMeshName();
 
-    std::vector<double> coor = boundary.GetLimit();
-    for ( int i = 0; i < coor.size(); i++ )
-          os << separator() << coor[i];
-
-    coor = boundary.GetCylinder() ; 
-    for ( int i = 0; i < coor.size(); i++ )
-          os << separator() << coor[i];
-
-    coor = boundary.GetSphere() ; 
-    for ( int i = 0; i < coor.size(); i++ )
-          os << separator() << coor[i];
-    return os.str();
+    if ( BoundaryType == -1 )
+    {
+      os << separator() << boundary.GetDataFile();
+    }
+    else if ( BoundaryType == 0 )
+    {
+      os << separator() << boundary.GetMeshName();
+      os << separator() << boundary.GetDataFile();
+    }
+    else {
+      std::vector<double> coor = boundary.GetCoords() ;
+      for ( int i = 0; i < coor.size(); i++ )
+            os << separator() << coor[i];
+      std::vector<double> limit = boundary.GetLimit();
+      for ( int i = 0; i < limit.size(); i++ )
+            os << separator() << limit[i];
+    }
 
     std::list<std::string> ListString = boundary.GetGroups();
     std::list<std::string>::const_iterator it;
@@ -298,12 +327,37 @@ namespace HOMARD
     for ( it = ListString.begin(); it != ListString.end(); ++it )
           os << separator() << *it;
 
+    saux = os.str();
+//     MESSAGE( ". Fin avec "<<saux);
+    return saux ;
   }
 
 //
-// Restauration des objets
+// =========
+// 1.6. YACS
+// =========
+
+  /*!
+    \brief Dump YACS to the string
+    \param yacs yacs being dumped
+    \return string representation of the zone
+  */
+  std::string Dump( const HOMARD_YACS& yacs )
+  {
+    std::stringstream os;
+    std::string saux ;
+    MESSAGE( ". Sauvegarde du schema YACS "<<yacs.GetName());
+    os << yacs.GetName();
+    os << separator() << yacs.GetType();
+
+    saux = os.str();
+//     MESSAGE( ". Fin avec "<<saux);
+    return saux ;
+  }
+//
+// 2. Restauration des objets
 // ==========================
-// Case
+// 2.1. Case
 // ==========================
 //
   /*!
@@ -314,6 +368,7 @@ namespace HOMARD
   */
   bool Restore( HOMARD_Cas& cas, const std::string& stream )
   {
+    MESSAGE( ". Restoration du cas ");
     std::string::size_type start = 0;
     std::string chunk, chunkNext;
     bool ok;
@@ -330,6 +385,10 @@ namespace HOMARD
     if ( !ok ) return false;
     cas.SetConfType( atoi( chunk.c_str() ) );
 
+    chunk = getNextChunk( stream, start, ok );
+    if ( !ok ) return false;
+    cas.SetExtType( atoi( chunk.c_str() ) );
+
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
 
@@ -356,7 +415,7 @@ namespace HOMARD
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
     size = atoi( chunk.c_str() );
-    for ( int i = 0; i < size; i++ ) 
+    for ( int i = 0; i < size; i++ )
     {
       chunk = getNextChunk( stream, start, ok );
       if ( !ok ) return false;
@@ -374,11 +433,17 @@ namespace HOMARD
       if ( !ok ) return false;
       cas.AddBoundaryGroup( chunk.c_str(), chunkNext.c_str() );
     }
+
+    chunk = getNextChunk( stream, start, ok );
+    if ( !ok ) return false;
+    cas.SetPyram( atoi( chunk.c_str() ) );
+
     return true;
   }
 //
-//  Iteration
-// =================================
+// ==============
+// 2.2. Iteration
+// ==============
   /*!
     \brief Restore iteration from the string
     \param iteration iteration being restored
@@ -396,7 +461,7 @@ namespace HOMARD
     iteration.SetName( chunk.c_str() );
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
-    iteration.SetEtat( (bool)atoi( chunk.c_str() ) );
+    iteration.SetState( atoi( chunk.c_str() ) );
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
     iteration.SetNumber( atoi( chunk.c_str() ) );
@@ -405,7 +470,7 @@ namespace HOMARD
     iteration.SetMeshFile( chunk.c_str() );
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
-    iteration.SetMessFile( chunk.c_str() );
+    iteration.SetLogFile( chunk.c_str() );
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
     iteration.SetMeshName( chunk.c_str() );
@@ -423,7 +488,7 @@ namespace HOMARD
     iteration.SetTimeStepRank( timestep, rank );
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
-    iteration.SetIterParent( chunk.c_str() );
+    iteration.SetIterParentName( chunk.c_str() );
     //
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
@@ -431,9 +496,9 @@ namespace HOMARD
     for ( int i = 0; i < size; i++ ) {
       chunk = getNextChunk( stream, start, ok );
       if ( !ok ) return false;
-      iteration.AddIteration( chunk.c_str() );
+      iteration.LinkNextIteration( chunk.c_str() );
     }
-    // 
+    //
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
     iteration.SetHypoName( chunk.c_str() );
@@ -442,13 +507,14 @@ namespace HOMARD
     iteration.SetCaseName( chunk.c_str() );
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
-    iteration.SetDirName( chunk.c_str() );
+    iteration.SetDirNameLoc( chunk.c_str() );
     return true;
   }
 
 //
-// hypothese
-// =================================
+// ==============
+// 2.3. hypothese
+// ==============
   /*!
     \brief Restore hypothesis from the string
     \param hypothesis hypothesis being restored
@@ -458,7 +524,7 @@ namespace HOMARD
   bool Restore( HOMARD_Hypothesis& hypothesis, const std::string& stream )
   {
     std::string::size_type start = 0;
-    std::string chunk;
+    std::string chunk, chunkNext;
     bool ok;
 
     chunk = getNextChunk( stream, start, ok );
@@ -501,6 +567,10 @@ namespace HOMARD
     double threshc = strtod( chunk.c_str(), 0 );
     hypothesis.SetUnRefThr( typethc, threshc );
 
+    chunk = getNextChunk( stream, start, ok );
+    if ( !ok ) return false;
+    hypothesis.SetUseField(atoi(chunk.c_str()));
+
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
     hypothesis.SetUseComp(atoi(chunk.c_str()));
@@ -515,7 +585,7 @@ namespace HOMARD
     for ( int i = 0; i < size; i++ ) {
       chunk = getNextChunk( stream, start, ok );
       if ( !ok ) return false;
-      hypothesis.AddIteration( chunk.c_str() );
+      hypothesis.LinkIteration( chunk.c_str() );
     }
 
     chunk = getNextChunk( stream, start, ok );
@@ -524,7 +594,11 @@ namespace HOMARD
     for ( int i = 0; i < size; i++ ) {
       chunk = getNextChunk( stream, start, ok );
       if ( !ok ) return false;
-      hypothesis.AddZone( chunk.c_str() );
+      i++;
+      chunkNext = getNextChunk( stream, start, ok );
+      int typeuse = atoi( chunkNext.c_str() );
+      if ( !ok ) return false;
+      hypothesis.AddZone( chunk.c_str(), typeuse );
     }
 
     chunk = getNextChunk( stream, start, ok );
@@ -551,14 +625,36 @@ namespace HOMARD
     for ( int i = 0; i < size; i++ ) {
       chunk = getNextChunk( stream, start, ok );
       if ( !ok ) return false;
-      hypothesis.AddFieldInterp( chunk.c_str() );
+      i++;
+      chunkNext = getNextChunk( stream, start, ok );
+      int TypeInterp = atoi( chunkNext.c_str() );
+      if ( !ok ) return false;
+      hypothesis.AddFieldInterpType( chunk.c_str(), TypeInterp );
     }
+
+    chunk = getNextChunk( stream, start, ok );
+    if ( !ok ) return false;
+    hypothesis.SetNivMax( atoi( chunk.c_str() ) );
+
+    chunk = getNextChunk( stream, start, ok );
+    if ( !ok ) return false;
+    hypothesis.SetDiamMin( strtod( chunk.c_str(), 0 ) );
+
+    chunk = getNextChunk( stream, start, ok );
+    if ( !ok ) return false;
+    hypothesis.SetAdapInit( strtod( chunk.c_str(), 0 ) );
+
+    chunk = getNextChunk( stream, start, ok );
+    if ( !ok ) return false;
+    hypothesis.SetExtraOutput( strtod( chunk.c_str(), 0 ) );
+
     return true;
   }
 
 //
-// Zone
-// ============================
+// =========
+// 2.4. Zone
+// =========
   /*!
     \brief Restore zone from the string
     \param zone zone being restored
@@ -570,32 +666,38 @@ namespace HOMARD
     std::string::size_type start = 0;
     std::string chunk;
     bool ok;
-    // 
+    //
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
     zone.SetName( chunk.c_str() );
     //
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
-    zone.SetZoneType( atoi( chunk.c_str() ) );
-    //
+    int ZoneType = atoi( chunk.c_str() ) ;
+    zone.SetType( ZoneType );
+    // Les coordonnees des zones : le nombre depend du type
     std::vector<double> coords;
-    coords.resize( 6 );
-    for ( int i = 0; i < 6; i++ ) {
-      chunk = getNextChunk( stream, start, ok );
-      if ( !ok ) return false;
-      coords[i] = strtod( chunk.c_str(), 0 );
-    }
-    zone.SetBox( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5] );
-    //
-    for ( int i = 0; i < 4; i++ ) {
+    int lgcoords ;
+    if ( ZoneType == 2 || ( ZoneType >= 11 && ZoneType <= 13 ) ) { lgcoords = 6 ; }
+    else if ( ZoneType == 4 ) { lgcoords = 4 ; }
+    else if ( ZoneType == 5 || ( ZoneType >= 31 && ZoneType <= 33 ) ) { lgcoords = 8 ; }
+    else if ( ZoneType == 7 || ( ZoneType >= 61 && ZoneType <= 63 ) ) { lgcoords = 9 ; }
+    else return false;
+    coords.resize( lgcoords );
+    for ( int i = 0; i < lgcoords; i++ ) {
       chunk = getNextChunk( stream, start, ok );
       if ( !ok ) return false;
       coords[i] = strtod( chunk.c_str(), 0 );
     }
-    zone.SetSphere( coords[0], coords[1], coords[2], coords[3] );
-
-    //
+    if ( ZoneType == 2 || ( ZoneType >= 11 && ZoneType <= 13 ) )
+    { zone.SetBox( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5] ); }
+    else if ( ZoneType == 4 )
+    { zone.SetSphere( coords[0], coords[1], coords[2], coords[3] ); }
+    else if ( ZoneType == 5 || ( ZoneType >= 31 && ZoneType <= 33 ) )
+    { zone.SetCylinder( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6], coords[7] ); }
+    else if ( ZoneType == 7 || ( ZoneType >= 61 && ZoneType <= 63 ) )
+    { zone.SetPipe( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6], coords[7], coords[8] ); }
+    // Remarque : la taille de coords est suffisante pour les limites
     for ( int i = 0; i < 3; i++ ) {
       chunk = getNextChunk( stream, start, ok );
       if ( !ok ) return false;
@@ -614,8 +716,8 @@ namespace HOMARD
     return true;
   }
 
-
 //
+// =================================
 // 2.5. Restauration d'une frontiere
 // =================================
 
@@ -623,7 +725,7 @@ namespace HOMARD
     \brief Restore boundary from the string
     \param boundary boundary being restored
     \param stream string representation of the boundary
-    \return \c true if zone is correctly restored or \c false otherwise
+    \return \c true if the boundary is correctly restored or \c false otherwise
   */
   bool Restore( HOMARD_Boundary& boundary, const std::string& stream )
   {
@@ -637,46 +739,63 @@ namespace HOMARD
 
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
-    boundary.SetBoundaryType(atoi( chunk.c_str()) );
+    int BoundaryType = atoi( chunk.c_str() ) ;
+    boundary.SetType( BoundaryType );
 
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
     boundary.SetCaseCreation( chunk.c_str() );
 
-    chunk = getNextChunk( stream, start, ok );
-    if ( !ok ) return false;
-    boundary.SetMeshFile( chunk.c_str() );
-
-    chunk = getNextChunk( stream, start, ok );
-    if ( !ok ) return false;
-    boundary.SetMeshName( chunk.c_str() );
-
-
-    std::vector<double> coords;
-    coords.resize( 3 );
-    for ( int i = 0; i < 3; i++ ) {
+    // Si analytique, les coordonnees des frontieres : le nombre depend du type
+    // Si discret, le maillage
+    // Si CAO, la géométrie
+    int lgcoords ;
+    if ( BoundaryType == -1 ) { lgcoords = -1 ; }
+    else if ( BoundaryType == 1 ) { lgcoords = 7 ; }
+    else if ( BoundaryType == 2 ) { lgcoords = 4 ; }
+    else { lgcoords = 0 ; }
+//
+    if ( lgcoords == -1 )
+    {
       chunk = getNextChunk( stream, start, ok );
       if ( !ok ) return false;
-      coords[i] = strtod( chunk.c_str(), 0 );
+      boundary.SetDataFile( chunk.c_str() );
     }
-    boundary.SetLimit( coords[0], coords[1], coords[2]);
-
-    coords.resize( 7 );
-    for ( int i = 0; i < 7; i++ ) {
+    else if ( lgcoords == 0 )
+    {
       chunk = getNextChunk( stream, start, ok );
       if ( !ok ) return false;
-      coords[i] = strtod( chunk.c_str(), 0 );
-    }
-    boundary.SetCylinder(coords[0],coords[1],coords[2],coords[3],coords[4],coords[5],coords[6]);
+      boundary.SetMeshName( chunk.c_str() );
 
-    coords.resize( 4 );
-    for ( int i = 0; i < 4; i++ ) {
       chunk = getNextChunk( stream, start, ok );
       if ( !ok ) return false;
-      coords[i] = strtod( chunk.c_str(), 0 );
+      boundary.SetDataFile( chunk.c_str() );
     }
-    boundary.SetSphere( coords[0], coords[1], coords[2], coords[3]);
-
+    else
+    { std::vector<double> coords;
+      coords.resize( lgcoords );
+      for ( int i = 0; i < lgcoords; i++ ) {
+        chunk = getNextChunk( stream, start, ok );
+        if ( !ok ) return false;
+        coords[i] = strtod( chunk.c_str(), 0 );
+      }
+      if ( BoundaryType == 1 )
+      { boundary.SetCylinder(coords[0],coords[1],coords[2],coords[3],coords[4],coords[5],coords[6]); }
+      else if ( BoundaryType == 2 )
+      { boundary.SetSphere( coords[0], coords[1], coords[2], coords[3]); }
+      else if ( BoundaryType == 3 )
+      { boundary.SetConeA( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6]); }
+      else if ( BoundaryType == 4 )
+      { boundary.SetConeR( coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], coords[6], coords[7]); }
+      // Remarque : la taille de coords est suffisante pour les limites
+      for ( int i = 0; i < 3; i++ ) {
+        chunk = getNextChunk( stream, start, ok );
+        if ( !ok ) return false;
+        coords[i] = strtod( chunk.c_str(), 0 );
+      }
+      boundary.SetLimit( coords[0], coords[1], coords[2]);
+    }
+    // Les groupes
     chunk = getNextChunk( stream, start, ok );
     if ( !ok ) return false;
     int size = atoi( chunk.c_str() );
@@ -689,4 +808,33 @@ namespace HOMARD
     return true;
   }
 
+//
+// ==================================
+// 2.6. Restauration d'un schema YACS
+// ==================================
+
+  /*!
+    \brief Restore a schema YACS from the string
+    \param yacs yacs being restored
+    \param stream string representation of the schema yacs
+    \return \c true if yacs is correctly restored or \c false otherwise
+  */
+  bool Restore( HOMARD_YACS& yacs, const std::string& stream )
+  {
+    std::string::size_type start = 0;
+    std::string chunk;
+    bool ok;
+
+    chunk = getNextChunk( stream, start, ok );
+    if ( !ok ) return false;
+    yacs.SetName( chunk.c_str() );
+
+    chunk = getNextChunk( stream, start, ok );
+    if ( !ok ) return false;
+    int YACSType = atoi( chunk.c_str() ) ;
+    yacs.SetType( YACSType );
+
+    return true;
+  }
+
 } // namespace HOMARD /end/