Ignore:
Timestamp:
10/21/11 19:01:35 (13 years ago)
Author:
ymipsl
Message:

reprise en main de la version de H. Ozdoba. Correction de différentes erreurs de conception et bug.
Version NEMO operationnel en client/server, interoperabilita avec OASIS, reconstition de fichiers via netcdf4/HDF5

YM

Location:
XMLIO_V2/dev/common/src/xmlio/node
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/common/src/xmlio/node/context.cpp

    r278 r286  
    143143#define DECLARE_NODE_PAR(Name_, name_) 
    144144#include "node_type.conf" 
    145             std::cout << name << std::endl; 
     145 
    146146            DEBUG(<< "L'élément nommé \'"     << name 
    147147                  << "\' dans le contexte \'" << CObjectFactory::GetCurrentContextId() 
  • XMLIO_V2/dev/common/src/xmlio/node/domain.cpp

    r278 r286  
    517517            const int zoom_ibegin_cl = ibegin_zoom_sub[k], zoom_ni_cl = ni_zoom_sub[k], 
    518518                      zoom_jbegin_cl = jbegin_zoom_sub[k], zoom_nj_cl = nj_zoom_sub[k], 
     519                      ibegin_cl = ibegin_sub[k] , 
     520                      jbegin_cl = jbegin_sub[k] , 
    519521                      ni_cl = iend_sub[k] - ibegin_sub[k] + 1; 
    520522                       
     
    523525               for (int j = 0; j < zoom_nj_cl; j++) 
    524526               { 
    525                   int ii = i /*- (ibegin_serv - 1)*/ + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1); 
    526                   int jj = j /*- (jbegin_serv - 1)*/ + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1); 
     527                  int ii = i + (ibegin_cl-1) - (ibegin_serv - 1) + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1); 
     528                  int jj = j + (jbegin_cl-1) - (jbegin_serv - 1) + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1); 
    527529                  (*lonvalue_temp)[ii + jj * zoom_ni_serv] = 
    528530                  (*lonvalue_loc)[i + j * zoom_ni_cl]; 
     
    602604         { 
    603605            zoom_ni_loc.setValue(0); 
    604             zoom_ibegin_loc.setValue(-1); 
     606            zoom_ibegin_loc.setValue(zoom_ibegin.getValue()); 
    605607         } 
    606608         else 
     
    622624         { 
    623625            zoom_nj_loc.setValue(0); 
    624             zoom_jbegin_loc.setValue(-1); 
     626            zoom_jbegin_loc.setValue(zoom_jbegin.getValue()); 
    625627         } 
    626628         else 
     
    662664         this->iend_sub.push_back(this->iend.getValue()); 
    663665         this->jend_sub.push_back(this->jend.getValue());  
     666 
     667         this->ibegin_zoom_sub.push_back(this->zoom_ibegin_loc.getValue()); 
     668         this->jbegin_zoom_sub.push_back(this->zoom_jbegin_loc.getValue()); 
     669         this->ni_zoom_sub.push_back(this->zoom_ni_loc.getValue()); 
     670         this->nj_zoom_sub.push_back(this->zoom_nj_loc.getValue()); 
    664671       
    665672         this->latvalue_sub.push_back(this->latvalue.getValue()); 
    666673         this->lonvalue_sub.push_back(this->lonvalue.getValue());   
    667           
    668          if (!this->isEmpty()) 
    669          { 
     674 
     675 
     676//         if (!this->isEmpty()) 
     677//         { 
    670678            this->completeLonLatClient(); 
    671          } 
     679//         } 
    672680      } 
    673681      else 
    674682      { // CÃŽté serveur uniquement 
    675          if (!this->isEmpty()) 
     683//         if (!this->isEmpty()) 
    676684            this->completeLonLatServer(); 
    677685      } 
     
    707715   { 
    708716      return (this->ibegin_zoom_sub); 
     717   } 
     718 
     719   const std::vector<int> & CDomain::getNiZoomSub(void) const 
     720   { 
     721      return (this->ni_zoom_sub); 
    709722   } 
    710723                
     
    729742      return (this->jbegin_zoom_sub); 
    730743   } 
     744 
     745   const std::vector<int> & CDomain::getNjZoomSub(void) const 
     746   { 
     747      return (this->nj_zoom_sub); 
     748   } 
    731749                   
    732750    
     
    735753   const std::vector<int> & CDomain::getJEndSub(void) const 
    736754   { 
    737       return (this->iend_sub); 
     755      return (this->jend_sub); 
    738756   } 
    739757    
  • XMLIO_V2/dev/common/src/xmlio/node/domain.hpp

    r278 r286  
    8080         const std::vector<int> & getIBeginZoomSub(void) const; 
    8181         const std::vector<int> & getJBeginZoomSub(void) const; 
     82         const std::vector<int> & getNiZoomSub(void) const; 
     83         const std::vector<int> & getNjZoomSub(void) const; 
    8284          
    8385         const std::vector<ARRAY(double, 1)> & getLonValueSub(void) const; 
  • XMLIO_V2/dev/common/src/xmlio/node/field.cpp

    r278 r286  
    220220         sset.insert(refer_ptr); 
    221221         baseRefObject = refer_sptr; 
    222          refObject.push_back(refer_sptr); 
     222//ym         refObject.push_back(refer_sptr); 
    223223      } 
    224224   } 
  • XMLIO_V2/dev/common/src/xmlio/node/field.hpp

    r278 r286  
    166166//      std::cout       << "(writeDate <= currDate) = " << std::boolalpha << (writeDate <= currDate) << std::endl;    
    167167    
    168        //std::cout << ">> " << currDate <<  " : Envoi de données " << this->getBaseFieldId() << std::endl; 
     168      std::cout << ">> " << currDate <<  " : Envoi de données " << this->getBaseFieldId() << std::endl; 
     169      std::cout << ">> next operation "  << opeDate<<std::endl; 
    169170      if (opeDate <= currDate) 
    170171      { 
     
    180181          
    181182         *last_operation = currDate; 
    182 //         std::cout << "(*last_operation = currDate) : " << *last_operation << " = " << currDate << std::endl;  
     183         std::cout << "(*last_operation = currDate) : " << *last_operation << " = " << currDate << std::endl;  
    183184      } 
    184185       
     
    188189         this->incrementNStep(); 
    189190         *last_Write = writeDate; 
    190 //         std::cout << "(*last_Write = currDate) : " << *last_Write << " = " << currDate       << std::endl; 
     191         std::cout << "(*last_Write = currDate) : " << *last_Write << " = " << currDate << std::endl; 
    191192         return (true);         
    192193      } 
  • XMLIO_V2/dev/common/src/xmlio/node/file.cpp

    r266 r286  
    6262      this->enabledFields = this->getAllFields(); 
    6363 
     64      std::cout<<"---> File :"<<this->name.getValue()<<std::endl ; 
    6465      for ( it = this->enabledFields.begin() ; it != this->enabledFields.end(); it++ ) 
    6566      { 
     
    8687         } 
    8788 
    88          // Le champ est finalement actif, on ajoute la référence au champ de base. 
     89         // Le champ est finalement actif, on y ajoute sa propre reference. 
     90         (*it)->refObject.push_back(*it); 
     91         // Le champ est finalement actif, on y ajoute la référence au champ de base. 
     92         std::cout<<"    Field Enabled : "<<(*it)->getId()<<std::endl ; 
    8993         (*it)->setRelFile(CObjectFactory::GetObject(this)); 
    9094         (*it)->baseRefObject->refObject.push_back(*it); 
     95         // A faire, ajouter les references intermediaires... 
    9196      } 
    9297 
     
    133138   } 
    134139 
     140   void CFile::close(void) 
     141   { 
     142     this->data_out->closeFile(); 
     143   } 
    135144   //---------------------------------------------------------------- 
    136145 
  • XMLIO_V2/dev/common/src/xmlio/node/file.hpp

    r219 r286  
    6363 
    6464         void initializeDataOutput(boost::shared_ptr<io::CDataOutput> dout); 
    65  
     65         void close(void) ; 
     66          
    6667         /// Traitements /// 
    6768         virtual void solveDescInheritance(const CAttributeMap * const parent = 0); 
  • XMLIO_V2/dev/common/src/xmlio/node/grid.cpp

    r278 r286  
    55#include "object_template_impl.hpp" 
    66#include "group_template_impl.hpp" 
     7#include <iostream> 
     8#include "mpi_manager.hpp" 
    79 
    810namespace xmlioserver { 
     
    140142      for (StdSize s = 0; s < shape_.size(); s++) 
    141143         retvalue *= shape_[s]; 
     144      return (retvalue); 
     145   } 
     146 
     147   StdSize CGrid::getDataSize(void) const 
     148   { 
     149      StdSize retvalue ; 
     150      retvalue=domain->data_ni.getValue() ; 
     151      if (domain->data_dim.getValue()==2) retvalue*=domain->data_nj.getValue() ; 
     152      if (this->withAxis) retvalue*=this->axis->size.getValue() ; 
     153 
    142154      return (retvalue); 
    143155   } 
     
    437449      const std::vector<int> & ibegin = this->domain->getIBeginSub(); 
    438450      const std::vector<int> & jbegin = this->domain->getJBeginSub(); 
     451      const std::vector<int> & iend = this->domain->getIEndSub(); 
     452      const std::vector<int> & jend = this->domain->getJEndSub(); 
    439453      const std::vector<int> & ibegin_zoom = this->domain->getIBeginZoomSub(); 
    440454      const std::vector<int> & jbegin_zoom = this->domain->getJBeginZoomSub(); 
     455      const std::vector<int> & ni_zoom = this->domain->getNiZoomSub(); 
     456      const std::vector<int> & nj_zoom = this->domain->getNjZoomSub(); 
    441457       
    442458      const int ibegin_srv  = this->domain->ibegin.getValue(); 
    443459      const int jbegin_srv  = this->domain->jbegin.getValue(); 
     460      const int iend_srv  = this->domain->iend.getValue(); 
     461      const int jend_srv  = this->domain->jend.getValue(); 
    444462      const int zoom_ni_srv = this->domain->zoom_ni_loc.getValue(); 
    445463      const int zoom_nj_srv = this->domain->zoom_nj_loc.getValue(); 
     
    447465      const int ibegin_zoom_srv = this->domain->zoom_ibegin_loc.getValue(); 
    448466      const int jbegin_zoom_srv = this->domain->zoom_jbegin_loc.getValue(); 
    449             
     467       const int iend_zoom_srv = ibegin_zoom_srv + zoom_ni_srv-1 ; 
     468      const int  jend_zoom_srv = jbegin_zoom_srv + zoom_nj_srv-1 ; 
     469         
     470//      std::cout<<"----> computeIndexServer !!"<<std::endl ; 
    450471      StdSize dn = 0;       
    451472      for (StdSize j = 1; j < this->out_i_index.size(); j++) 
     
    466487         int ibegin_zoom_cl = ibegin[i]; //ibegin_zoom[i]; 
    467488         int jbegin_zoom_cl = jbegin[i]; //jbegin_zoom[i]; 
     489         int iend_zoom_cl = iend[i]; //ibegin_zoom[i]; 
     490         int jend_zoom_cl = jend[i]; //jbegin_zoom[i]; 
     491 
     492         int ibegin_cl = ibegin[i]; //ibegin[i]; 
     493         int jbegin_cl = jbegin[i]; //jbegin[i]; 
     494         int iend_cl = iend[i]; //ibegin[i]; 
     495         int jend_cl = jend[i]; //jbegin[i]; 
    468496          
    469497         if (ibegin_zoom.size() != 0) 
     
    471499            ibegin_zoom_cl = ibegin_zoom[i]; 
    472500            jbegin_zoom_cl = jbegin_zoom[i]; 
     501            iend_zoom_cl = ibegin_zoom[i]+ni_zoom[i]-1; 
     502            jend_zoom_cl = jbegin_zoom[i]+nj_zoom[i]-1; 
    473503         } 
    474504          
    475          for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++) 
    476          { 
    477             (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 
     505//         std::cout<<"--> client No "<<i<<std::endl ; 
     506//         std::cout<<" ibegin "<<ibegin[i]<<" iend "<<iend[i]<<" jbegin "<<jbegin[i]<<" jend "<<jend[i]<<std::endl ; 
     507//         std::cout<<"zoom cl : ibegin "<<ibegin_zoom_cl<<" iend "<<iend_zoom_cl<<" jbegin "<<jbegin_zoom_cl<<" jend "<<jend_zoom_cl<<std::endl ; 
     508//         std::cout<<"--> server "<<std::endl ; 
     509//         std::cout<<" ibegin "<<ibegin_srv<<" iend "<<iend_srv<<" jbegin "<<jbegin_srv<<" jend "<<jend_srv<<std::endl ; 
     510//        std::cout<<"zoom : ibegin "<<ibegin_zoom_srv<<" iend "<<iend_zoom_srv<< " ni "<<zoom_ni_srv<<" jbegin "<<jbegin_zoom_srv<<" jend "<<jend_zoom_srv<<" nj "<<zoom_nj_srv<<std::endl ; 
     511//         std::cout<<"zoom_size "<<ibegin_zoom.size()<<std::endl ; 
     512 
     513         if (comm::CMPIManager::IsClient()) 
     514         { 
     515           for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++) 
     516           { 
     517              (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 
     518 
     519//            (*out_i_index_srv)[n] = (*out_i_index_cl)[m]  
     520//                                  /*+ (ibegin_cl - 1) - (ibegin_srv - 1)*/ + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1); 
     521//            (*out_j_index_srv)[n] = (*out_j_index_cl)[m] 
     522//                                  /*+ (jbegin_cl - 1) - (jbegin_srv - 1)*/ + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1); 
     523//            (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 
     524              (*out_i_index_srv)[n] = (*out_i_index_cl)[m] + ibegin_cl - 1 - (ibegin_srv + ibegin_zoom_srv - 1) + 1 ; 
     525              (*out_j_index_srv)[n] = (*out_j_index_cl)[m] + jbegin_cl - 1 - (jbegin_srv + jbegin_zoom_srv - 1) + 1 ; 
     526              (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 
     527           } 
     528         } 
     529         else 
     530         { 
     531           for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++) 
     532           { 
     533              (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 
    478534            (*out_i_index_srv)[n] = (*out_i_index_cl)[m]  
    479                                   /*+ (ibegin_cl - 1) - (ibegin_srv - 1)*/ + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1); 
     535                                   + (ibegin_cl - 1) - (ibegin_srv - 1) + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1); 
    480536            (*out_j_index_srv)[n] = (*out_j_index_cl)[m] 
    481                                   /*+ (jbegin_cl - 1) - (jbegin_srv - 1)*/ + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1); 
     537                                   + (jbegin_cl - 1) - (jbegin_srv - 1) + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1); 
    482538            (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 
     539           }          
     540             
    483541         } 
    484542                   
    485          dn += storeIndex_cl->size();                  
    486       } 
    487             
     543         dn += storeIndex_cl->size();  
     544//         std::cout<<"storeIndex_cl->size() "<<storeIndex_cl->size()<<std::endl;                
     545       
     546//         std::cout<<"storeIndex_srv->size() "<<storeIndex_srv->size()<<std::endl;                
     547      } 
     548       
    488549      if (storeIndex_srv->size() != 0) 
    489550      { 
     
    496557         const int jend_t   = 
    497558            *std::max_element(out_j_index_srv->begin(), out_j_index_srv->end()); 
    498              
     559                
     560//                std::cout<< "[ grille = "      << this->getId() 
     561//                         << ", ibegin_t = "    << ibegin_t 
     562//                         << ", jbegin_t = "    << jbegin_t 
     563//                         << ", iend_t = "      << iend_t 
     564//                         << ", jend_t = "      << jend_t 
     565//                         << ", zoom_ni_srv = " << zoom_ni_srv 
     566//                         << ", zoom_nj_srv = " << zoom_nj_srv 
     567//                         << ", nb subdomain = "   << out_i_index.size()-1<<std::endl   ;   
     568                                  
    499569         if ((ibegin_t < 0) || (jbegin_t < 0) || 
    500570             (iend_t >= zoom_ni_srv) || (jend_t >= zoom_nj_srv)) 
     
    508578                  << ", zoom_ni_srv = " << zoom_ni_srv 
    509579                  << ", zoom_nj_srv = " << zoom_nj_srv 
     580                  << ", nb subdomain = "   << out_i_index.size()-1 
    510581                  <<" ] Erreur d'indexation de la grille au niveau du serveur") ; 
    511582         } 
  • XMLIO_V2/dev/common/src/xmlio/node/grid.hpp

    r266 r286  
    7171         StdSize getLocalSize(void) const; 
    7272         StdSize getGlobalSize(void) const; 
     73         StdSize  getDataSize(void) const; 
    7374         std::vector<StdSize> getLocalShape(void) const; 
    7475         std::vector<StdSize> getGlobalShape(void) const; 
     
    133134      void CGrid::inputField(const  ARRAY(double, n) field, ARRAY(double, 1) stored) const 
    134135   { 
    135       if (this->getGlobalSize() != field->num_elements()) 
     136      if (this->getDataSize() != field->num_elements()) 
    136137         ERROR("CGrid::inputField(const  ARRAY(double, n) field, ARRAY(double, 1) stored)", 
    137                 << "[ Taille des données attendue = " << this->getGlobalSize()       << ", " 
     138                << "[ Taille des données attendue = " << this->getDataSize()       << ", " 
    138139                << "Taille des données reçue = "      << field->num_elements() << " ] " 
    139140                << "Le tableau de données n'a pas la bonne taille !") ; 
  • XMLIO_V2/dev/common/src/xmlio/node/variable.hpp

    r274 r286  
    6464 
    6565             
    66             template <typename T> inline void getData(T & _data) const; 
     66            template <typename T> inline T getData(void) const; 
     67//            bool inline getData<bool>(void) const ; 
     68             
    6769            template <typename T, StdSize N> 
    6870               inline void getData(ARRAY(T, N) _data_array) const; 
     
    8183      }; // class CVar 
    8284 
     85      
     86      template <typename T> 
     87      T CVariable::getData(void) const 
     88      { 
     89         T retval ; 
     90         std::stringstream sstr(std::stringstream::in | std::stringstream::out);  
     91         sstr<<content ; 
     92         sstr>>retval ; 
     93         if (sstr.fail()) ERROR("CVariable::getdata()", 
     94               << "Cannot convert string <" << content << "> into type required" ); 
     95         return retval ; 
     96      }  
     97 
     98      template<> 
     99      bool CVariable::getData<bool>(void) const 
     100      { 
     101         if (content.compare("true")==0 || content.compare(".true.")==0 || content.compare(".TRUE.")==0) return true ;  
     102         else if (content.compare("false")==0 || content.compare(".false.")==0 || content.compare(".FALSE.")==0) return false ;  
     103         else ERROR("CVariable::getdata()", 
     104               << "Cannot convert string <" << content << "> into type required" ); 
     105         return false ; 
     106      }  
    83107      ///-------------------------------------------------------------- 
    84108 
Note: See TracChangeset for help on using the changeset viewer.