Ignore:
Timestamp:
09/21/11 09:42:30 (13 years ago)
Author:
hozdoba
Message:

Corrections

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

Legend:

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

    r274 r278  
    88 
    99#include "calendar_type.hpp" 
     10#include "duration.hpp" 
    1011 
    1112#include "data_treatment.hpp" 
     
    8283               << "Impossible de définir un calendrier (un attribut est manquant)."); 
    8384 
    84 #define DECLARE_CALENDAR(MType  , mtype)                        \ 
    85    if (calendar_type.getValue().compare(#mtype) == 0)           \ 
    86    {                                                            \ 
    87       this->calendar =  boost::shared_ptr<date::CCalendar>      \ 
    88          (new date::C##MType##Calendar(start_date.getValue())); \ 
    89       return;                                                   \ 
     85#define DECLARE_CALENDAR(MType  , mtype)                            \ 
     86   if (calendar_type.getValue().compare(#mtype) == 0)               \ 
     87   {                                                                \ 
     88      this->calendar =  boost::shared_ptr<date::CCalendar>          \ 
     89         (new date::C##MType##Calendar(start_date.getValue()));     \ 
     90      if (!this->timestep.isEmpty())                                \ 
     91       this->calendar->setTimeStep                                  \ 
     92          (date::CDuration::FromString(this->timestep.getValue())); \ 
     93      return;                                                       \ 
    9094   } 
    9195#include "calendar_type.conf" 
     
    103107 
    104108      // PARSING POUR GESTION DES ENFANTS 
    105       xml::THashAttributes attributes; 
     109      xml::THashAttributes attributes = node.getAttributes(); 
     110 
     111      if (attributes.end() != attributes.find("src")) 
     112      { 
     113         StdIFStream ifs ( attributes["src"].c_str() , StdIFStream::in ); 
     114         if (!ifs.good()) 
     115            ERROR("CContext::parse(xml::CXMLNode & node)", 
     116                  << "[ filename = " << attributes["src"] << " ] Bad xml stream !"); 
     117         xml::CXMLParser::ParseInclude(ifs, *this); 
     118      } 
    106119 
    107120      if (node.getElementName().compare(CContext::GetName())) 
  • XMLIO_V2/dev/common/src/xmlio/node/domain.cpp

    r274 r278  
    2020      , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[0][0])), relFiles() 
    2121      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 
    22       , ibegin_zoom_sub(), jbegin_zoom_sub() 
     22      , ibegin_zoom_sub(), jbegin_zoom_sub(), ni_zoom_sub(), nj_zoom_sub() 
    2323      , lonvalue_sub(), latvalue_sub() 
    2424   { /* Ne rien faire de plus */ } 
     
    2828      , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[0][0])), relFiles() 
    2929      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 
    30       , ibegin_zoom_sub(), jbegin_zoom_sub() 
     30      , ibegin_zoom_sub(), jbegin_zoom_sub(),ni_zoom_sub(), nj_zoom_sub() 
    3131      , lonvalue_sub(), latvalue_sub() 
    3232   { /* Ne rien faire de plus */ } 
     
    100100         this->ibegin_zoom_sub.push_back(this->zoom_ibegin_loc.getValue()); 
    101101         this->jbegin_zoom_sub.push_back(this->zoom_jbegin_loc.getValue()); 
     102         this->ni_zoom_sub.push_back(this->zoom_ni_loc.getValue()); 
     103         this->nj_zoom_sub.push_back(this->zoom_nj_loc.getValue()); 
    102104       
    103105         this->latvalue_sub.push_back(this->latvalue.getValue()); 
     
    151153          (nj_glo.isEmpty() || nj_glo.getValue() <= 0 )) 
    152154      { 
    153          abort(); 
    154155         ERROR("CDomain::checkAttributes(void)", 
    155156               << "[ Id = " << this->getId() << " ] " 
     
    454455            for (int j = 0; j < zoom_nj_client; j++) 
    455456            { 
    456                (*lonvalue_temp)[i + j * zoom_ni_client] = (*lonvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()];               
    457                (*latvalue_temp)[i + j * zoom_ni_client] = (*latvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()]; 
     457               (*lonvalue_temp)[i + j * zoom_ni_client] = 
     458               (*lonvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()];               
     459               (*latvalue_temp)[i + j * zoom_ni_client] = 
     460               (*latvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()]; 
    458461            } 
    459462         } 
     
    488491      ARRAY_CREATE(latvalue_temp, double, 1, [0]); 
    489492       
    490       const int ibegin_serv  = ibegin.getValue(), 
    491                 jbegin_serv  = jbegin.getValue(), 
    492                 zoom_ni_serv = zoom_ni_loc.getValue(), 
    493                 zoom_nj_serv = zoom_nj_loc.getValue(); 
     493      const int ibegin_serv     = ibegin.getValue(), 
     494                jbegin_serv     = jbegin.getValue(), 
     495                zoom_ni_serv    = zoom_ni_loc.getValue(), 
     496                zoom_nj_serv    = zoom_nj_loc.getValue(), 
     497                ibegin_zoom_srv = zoom_ibegin_loc.getValue(), 
     498                jbegin_zoom_srv = zoom_jbegin_loc.getValue(); 
    494499                       
    495500      /*std::cout << "Rang du serveur :" << comm::CMPIManager::GetCommRank()   << std::endl 
     
    498503                << "Zoom_loc begin : " << zoom_ibegin_loc << ", " << zoom_jbegin_loc <<  std::endl 
    499504                << "Zoom_loc size : "  << zoom_ni_loc << ", " << zoom_nj_loc <<  std::endl;*/ 
    500        
    501        
    502       ARRAY(double, 1) lonvalue_ = this->lonvalue.getValue(), 
    503                        latvalue_ = this->latvalue.getValue(); 
    504505                        
    505506      if (this->data_dim.getValue() == 2) 
    506507      { 
    507          StdSize dm = zoom_ni_serv * zoom_nj_serv; 
    508          StdSize dn = this->ni.getValue() * this->nj.getValue(); 
    509           
    510          lonvalue_->resize(boost::extents[dn]); 
    511          latvalue_->resize(boost::extents[dn]); 
     508         StdSize dm = zoom_ni_serv * zoom_nj_serv;       
     509          
    512510         lonvalue_temp->resize(boost::extents[dm]); 
    513511         latvalue_temp->resize(boost::extents[dm]); 
     
    515513         for (StdSize k = 0; k < lonvalue_sub.size(); k++) 
    516514         { 
    517             int l = 0; 
    518515            ARRAY(double, 1) lonvalue_loc = this->lonvalue_sub[k], 
    519516                             latvalue_loc = this->latvalue_sub[k]; 
    520             const int ibegin_loc = ibegin_sub[k], iend_loc = iend_sub[k], 
    521                       jbegin_loc = jbegin_sub[k], jend_loc = jend_sub[k]; 
     517            const int zoom_ibegin_cl = ibegin_zoom_sub[k], zoom_ni_cl = ni_zoom_sub[k], 
     518                      zoom_jbegin_cl = jbegin_zoom_sub[k], zoom_nj_cl = nj_zoom_sub[k], 
     519                      ni_cl = iend_sub[k] - ibegin_sub[k] + 1; 
    522520                       
    523             for (int i = ibegin_loc - ibegin_serv; i < (iend_loc - ibegin_serv + 1); i++) 
     521            for (int i = 0; i < zoom_ni_cl; i++) 
    524522            { 
    525                for (int j = jbegin_loc - jbegin_serv; j < (jend_loc - jbegin_serv + 1); j++) 
     523               for (int j = 0; j < zoom_nj_cl; j++) 
    526524               { 
    527                   (*lonvalue_)[i + j * this->ni.getValue()] = (*lonvalue_loc)[l];      // erreur         
    528                   (*latvalue_)[i + j * this->ni.getValue()] = (*latvalue_loc)[l++];    // erreur 
     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                  (*lonvalue_temp)[ii + jj * zoom_ni_serv] = 
     528                  (*lonvalue_loc)[i + j * zoom_ni_cl]; 
     529                  (*latvalue_temp)[ii + jj * zoom_ni_serv] =  
     530                  (*latvalue_loc)[i + j * zoom_ni_cl]; 
    529531               } 
    530532            } 
     
    535537      else 
    536538      { 
    537          lonvalue_->resize(boost::extents[this->ni.getValue()]); 
    538          latvalue_->resize(boost::extents[this->nj.getValue()]); 
    539539         lonvalue_temp->resize(boost::extents[zoom_ni_serv]); 
    540540         latvalue_temp->resize(boost::extents[zoom_nj_serv]); 
     
    542542         for (StdSize k = 0; k < lonvalue_sub.size(); k++) 
    543543         { 
    544             int l = 0; 
    545544            ARRAY(double, 1) lonvalue_loc = this->lonvalue_sub[k], 
    546545                             latvalue_loc = this->latvalue_sub[k]; 
    547             const int ibegin_loc = ibegin_sub[k], iend_loc = iend_sub[k], 
    548                       jbegin_loc = jbegin_sub[k], jend_loc = jend_sub[k]; 
     546            const int zoom_ibegin_cl = ibegin_zoom_sub[k], zoom_ni_cl = ni_zoom_sub[k], 
     547                      zoom_jbegin_cl = jbegin_zoom_sub[k], zoom_nj_cl = nj_zoom_sub[k]; 
    549548                       
    550             for (int i = ibegin_loc - ibegin_serv; i < (iend_loc - ibegin_loc + 1); i++) 
    551                (*lonvalue_)[i] = (*lonvalue_loc)[l++]; 
     549            for (int i = 0; i < zoom_ni_cl; i++) 
     550               (*lonvalue_temp)[i /*- (ibegin_serv - 1)*/ + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1)] = 
     551               (*lonvalue_loc)[i]; 
    552552                
    553             for (int j = jbegin_loc - jbegin_serv; j < (jend_loc - jbegin_loc + 1); j++) 
    554                (*latvalue_)[j] = (*latvalue_loc)[l++]; 
     553            for (int j = 0; j < zoom_nj_cl; j++) 
     554               (*latvalue_temp)[j /*- (jbegin_serv - 1)*/ + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1)] = 
     555               (*latvalue_loc)[j]; 
    555556         }        
    556557         this->lonvalue.setValue(lonvalue_temp); 
  • XMLIO_V2/dev/common/src/xmlio/node/domain.hpp

    r274 r278  
    113113 
    114114         std::vector<int> ibegin_sub, iend_sub, jbegin_sub, jend_sub; 
    115          std::vector<int> ibegin_zoom_sub, jbegin_zoom_sub; 
     115         std::vector<int> ibegin_zoom_sub, jbegin_zoom_sub, ni_zoom_sub, nj_zoom_sub; 
    116116         std::vector<ARRAY(double, 1)> lonvalue_sub, latvalue_sub; 
    117117 
  • XMLIO_V2/dev/common/src/xmlio/node/field.cpp

    r266 r278  
    4747 
    4848   bool CField::updateDataServer 
    49       (const date::CDate & currDate, const std::deque<ARRAY(double, 1)> storedClient) 
    50    { 
    51       if ((*last_operation + freq_operation) >= currDate) 
    52       { 
    53          ARRAY_CREATE(input, double, 1, [0]); 
    54          this->grid->inputFieldServer(storedClient, input); 
     49      (const date::CDate & currDate, 
     50       const std::deque<ARRAY(double, 1)> storedClient) 
     51   { 
     52      const date::CDate opeDate      = *last_operation + freq_operation; 
     53      const date::CDate writeDate    = *last_Write     + freq_write;  
     54       
     55      if (opeDate <= currDate) 
     56      { 
     57         if (this->data->num_elements() != this->grid->storeIndex[0]->num_elements()) 
     58         { 
     59            this->data->resize(boost::extents[this->grid->storeIndex[0] ->num_elements()]); 
     60         }   
     61         ARRAY_CREATE(input, double, 1, [this->data->num_elements()]); 
     62         this->grid->inputFieldServer(storedClient, input);           
    5563         (*this->foperation)(input); 
    5664         *last_operation = currDate; 
    5765      } 
    58  
    59       if ((*last_Write + freq_write) >= currDate) 
    60       { 
    61          *last_Write = currDate; 
    62          return (true); 
     66      if (writeDate < (currDate + freq_operation)) 
     67      { 
     68         this->foperation->final(); 
     69         this->incrementNStep(); 
     70         *last_Write = writeDate; 
     71         return (true);         
    6372      } 
    6473      return (false); 
     
    232241               << "Impossible de définir une opération pour le champ !"); 
    233242      } 
     243       
     244      CDuration freq_offset_ = NoneDu; 
     245      if (!freq_offset.isEmpty()) 
     246      { 
     247         freq_offset_ = CDuration::FromString(freq_offset.getValue()); 
     248      } 
     249      else 
     250      { 
     251         freq_offset.setValue(NoneDu.toString()); 
     252      }   
    234253 
    235254      if (CXIOSManager::GetStatus() == CXIOSManager::LOC_SERVER) 
     
    245264         this->foperation     = 
    246265             boost::shared_ptr<func::CFunctor>(new CInstant(this->data)); 
     266              
     267         const CDuration toffset = this->freq_operation - freq_offset_ - _context->getCalendar()->getTimeStep();  
     268         *this->last_operation   = *this->last_operation - toffset;  
    247269      } 
    248270      else 
    249       { 
    250          CDuration freq_offset_ = NoneDu; 
    251          if (!freq_offset.isEmpty()) 
    252          { 
    253             freq_offset_ = CDuration::FromString(freq_offset.getValue()); 
    254          } 
    255          else 
    256          { 
    257             freq_offset.setValue(NoneDu.toString()); 
    258          }    
    259                    
     271      {                   
    260272         this->freq_operation = CDuration::FromString(freq_op.getValue()); 
    261273         this->freq_write     = CDuration::FromString(this->file->output_freq.getValue()); 
     
    264276         this->last_operation = boost::shared_ptr<xmlioserver::date::CDate> 
    265277                        (new date::CDate(_context->getCalendar()->getInitDate())); 
     278                         
    266279         const CDuration toffset = this->freq_operation - freq_offset_ - _context->getCalendar()->getTimeStep();  
    267          *this->last_operation  = *this->last_operation - toffset;   
     280         *this->last_operation   = *this->last_operation - toffset;   
    268281          
    269282#define DECLARE_FUNCTOR(MType, mtype)              \ 
  • XMLIO_V2/dev/common/src/xmlio/node/field.hpp

    r268 r278  
    170170      { 
    171171         //std::cout << "> " << currDate << ": Operation du champs" << this->getBaseFieldId() << std::endl; 
    172           
    173172         if (this->data->num_elements() != this->grid->storeIndex[0]->num_elements()) 
    174173         { 
  • XMLIO_V2/dev/common/src/xmlio/node/grid.cpp

    r274 r278  
    463463         ARRAY(int, 1) out_j_index_cl  =  this->out_j_index[i + 1]; 
    464464         ARRAY(int, 1) out_l_index_cl  =  this->out_l_index[i + 1]; 
    465           
    466          const int ibegin_cl = ibegin[i]; 
    467          const int jbegin_cl = jbegin[i]; 
    468           
     465                  
    469466         int ibegin_zoom_cl = ibegin[i]; //ibegin_zoom[i]; 
    470467         int jbegin_zoom_cl = jbegin[i]; //jbegin_zoom[i]; 
     
    480477            (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 
    481478            (*out_i_index_srv)[n] = (*out_i_index_cl)[m]  
    482                                   /*+ (ibegin_cl - 1)*/ - (ibegin_srv - 1) + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1);  
     479                                  /*+ (ibegin_cl - 1) - (ibegin_srv - 1)*/ + (ibegin_zoom_cl - 1) - (ibegin_zoom_srv - 1); 
    483480            (*out_j_index_srv)[n] = (*out_j_index_cl)[m] 
    484                                   /*+ (jbegin_cl - 1)*/ - (jbegin_srv - 1) + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1); 
     481                                  /*+ (jbegin_cl - 1) - (jbegin_srv - 1)*/ + (jbegin_zoom_cl - 1) - (jbegin_zoom_srv - 1); 
    485482            (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 
    486483         } 
     
    532529      this->out_i_index[0] = out_i_index_srv; 
    533530      this->out_j_index[0] = out_j_index_srv; 
    534       this->out_l_index[0] = out_l_index_srv; 
    535        
    536       this->storeIndex.resize(1); 
    537       this->out_i_index.resize(1); 
    538       this->out_j_index.resize(1); 
    539       this->out_l_index.resize(1); 
    540        
     531      this->out_l_index[0] = out_l_index_srv;       
    541532   } 
    542533    
     
    552543                << "Les données d'un client sont manquantes !") ; 
    553544      if (storedServer.get() != NULL) 
    554          storedServer->resize(boost::extents[this->storeIndex.size()-1]); 
     545         storedServer->resize(boost::extents[this->storeIndex[0]->num_elements()]); 
    555546      else  
    556          ARRAY_ASSIGN(storedServer, double, 1, [this->storeIndex.size()-1]); 
     547         ARRAY_ASSIGN(storedServer, double, 1, [this->storeIndex[0]->num_elements()]); 
    557548          
    558549      for (StdSize i = 0, n = 0; i < storedClient.size(); i++) 
Note: See TracChangeset for help on using the changeset viewer.