Changeset 183


Ignore:
Timestamp:
04/26/11 09:38:40 (13 years ago)
Author:
hozdoba
Message:
 
Location:
XMLIO_V2/dev/dev_rv/src/xmlio
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/src/xmlio/array.hpp

    r182 r183  
    4747 
    4848      public: 
    49        
     49 
    5050         void toBinary  (StdOStream & os) const; 
    5151         void fromBinary(StdIStream & is); 
  • XMLIO_V2/dev/dev_rv/src/xmlio/fake_client/fake_nemo.f90

    r180 r183  
    1919                                                  comm_client_grp,   & ! communicateur du groupe de clients 
    2020                                                  comm_client_server   ! communicateur client-serveur 
    21       REAL(kind = 8), DIMENSION(10000)   :: real_array 
     21      REAL(kind = 8), DIMENSION(10000)  :: real_array 
    2222      INTEGER                           :: rankGrp, error 
    2323      INTEGER                           :: ibegin, iend, jbegin, jend, data_ni, data_ibegin 
     
    138138 
    139139      CALL set_field_attributes(field_hdl  = temp_mod,  & 
    140                                 ftype          = GFIELD,    & 
    141                                 operation_     = "instant", & 
     140                                ftype      = GFIELD,    & 
     141                                operation_ = "instant", & 
    142142                                enabled_   = .FALSE._1) 
    143143 
  • XMLIO_V2/dev/dev_rv/src/xmlio/manager/tree_manager.hpp

    r179 r183  
    2323            static void SetCurrentContextId(const StdString & id); 
    2424            static boost::shared_ptr<CContext> CreateContext(const StdString & id = StdString("")); 
     25             
     26            template<typename ObjType, typename AttType> // Pas encore implémenté 
     27               static void SetAttribute(ObjType & obj, const StdString & attname, const AttType & attvalue); 
     28            template<typename ObjType, typename AttType> // Pas encore implémenté 
     29               static void SetAttribute(const StdString & objname, const StdString & attname, const AttType & attvalue); 
    2530 
    2631            /// Sortie /// 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.cpp

    r182 r183  
    1414   CDomain::CDomain(void) 
    1515      : CObjectTemplate<CDomain>(), CDomainAttributes() 
    16       , isChecked(false), local_mask(new CMask()), relFiles() 
     16      , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[10][10])), relFiles() 
    1717      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 
    1818      , lonvalue_sub(), latvalue_sub() 
     
    2121   CDomain::CDomain(const StdString & id) 
    2222      : CObjectTemplate<CDomain>(id), CDomainAttributes() 
    23       , isChecked(false), local_mask(new CMask()), relFiles() 
     23      , isChecked(false), local_mask(new CArray<int, 2>(boost::extents[10][10])), relFiles() 
    2424      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 
    2525      , lonvalue_sub(), latvalue_sub() 
     
    112112   } 
    113113 
    114  
    115114   //---------------------------------------------------------------- 
    116115 
     
    162161         nj.setValue(jend.getValue() - jbegin.getValue() + 1) ; 
    163162 
    164       else if (!jbegin.isEmpty() && !jend.isEmpty() && 
    165                !nj.isEmpty() && (jend.getValue() != jbegin.getValue() + nj.getValue() - 1)) 
     163      else if (!jbegin.isEmpty() && !jend.isEmpty() && !nj.isEmpty() && 
     164               (jend.getValue() != jbegin.getValue() + nj.getValue() - 1)) 
    166165      { 
    167166         ERROR("CDomain::checkAttributes(void)", 
     
    188187   void CDomain::checkMask(void) 
    189188   { 
     189      using namespace std; 
     190       
     191      int ibegin_mask = 0, 
     192          jbegin_mask = 0, 
     193          iend_mask = iend.getValue() - ibegin.getValue(), 
     194          jend_mask = jend.getValue() - jbegin.getValue(); 
     195       
     196      if (!zoom_ibegin.isEmpty()) 
     197      { 
     198         int zoom_iend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1; 
     199         int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1; 
     200          
     201         ibegin_mask = max (ibegin.getValue(), zoom_ibegin.getValue()); 
     202         jbegin_mask = max (jbegin.getValue(), zoom_jbegin.getValue()); 
     203         iend_mask   = min (iend.getValue(), zoom_iend); 
     204         jend_mask   = min (jend.getValue(), zoom_jend); 
     205          
     206         ibegin_mask -= ibegin.getValue(); 
     207         jbegin_mask -= jbegin.getValue(); 
     208         iend_mask   -= ibegin.getValue(); 
     209         jend_mask   -= jbegin.getValue(); 
     210      } 
     211       
     212      //~ std::cout << "-------------------" << std::endl 
     213      //~           << "zoom : " << std::boolalpha << (!zoom_ibegin.isEmpty()) << std::endl 
     214      //~           << "size : " << ni.getValue()  << " X " << nj.getValue()   << std::endl 
     215      //~           << "i : " << ibegin_mask << ", " << iend_mask << std::endl 
     216      //~           << "j : " << jbegin_mask << ", " << jend_mask << std::endl 
     217      //~           << "-------------------" << std::endl; 
     218 
    190219      if (!mask.isEmpty()) 
    191220      { 
     221         ARRAY(bool, 2) mask_ = mask.getValue(); 
    192222         unsigned int niu = ni.getValue(), nju = nj.getValue(); 
    193          if ((mask.getValue()->shape()[0] != niu) || 
    194              (mask.getValue()->shape()[1] != nju)) 
     223         if ((mask_->shape()[0] != niu) || 
     224             (mask_->shape()[1] != nju)) 
    195225            ERROR("CDomain::checkAttributes(void)", 
    196226                  <<"Le masque n'a pas la même taille que le domaine local") ; 
     227                   
     228         for (int i = 0; i < ni.getValue(); i++) 
     229         { 
     230            for (int j = 0; j < nj.getValue(); j++) 
     231            { 
     232               if (i < ibegin_mask && i > iend_mask && 
     233                   j < jbegin_mask && j > jend_mask ) 
     234                     (*mask_)[i][j] = false; 
     235            } 
     236         } 
    197237      } 
    198238      else // (!mask.hasValue()) 
     
    201241         ARRAY_CREATE(__arr, bool, 2, [ni.getValue()][nj.getValue()]); 
    202242         for (int i = 0; i < ni.getValue(); i++) 
     243         { 
    203244            for (int j = 0; j < nj.getValue(); j++) 
    204                (*__arr)[i][j] = true; 
     245            { 
     246               if (i >= ibegin_mask && i <= iend_mask && 
     247                   j >= jbegin_mask && j <= jend_mask ) 
     248                     (*__arr)[i][j] = true; 
     249               else  (*__arr)[i][j] = false; 
     250            } 
     251         } 
     252                
     253                
    205254         mask.setValue(__arr); 
    206255         __arr.reset(); 
     
    315364            { 
    316365               for(int j = 0; j < data_nj.getValue(); j++, count++) 
    317                {  
     366               { 
    318367                  (*__arri)[count] = i+1 ; 
    319368                  (*__arrj)[count] = j+1 ; 
     
    385434   //---------------------------------------------------------------- 
    386435 
     436   void CDomain::checkZoom(void) 
     437   { 
     438      if (!this->zoom_ni.isEmpty() || !this->zoom_nj.isEmpty() || 
     439          !this->zoom_ibegin.isEmpty() || !this->zoom_jbegin.isEmpty()) 
     440      { 
     441         if (this->zoom_ni.isEmpty()     && this->zoom_nj.isEmpty() && 
     442             this->zoom_ibegin.isEmpty() && this->zoom_jbegin.isEmpty()) 
     443         { 
     444            ERROR("CDomain::checkZoom(void)", 
     445                  <<"Les attributs définissant un zoom doivent tous être définis") ; 
     446         } 
     447         else 
     448         { 
     449            int zoom_iend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1; 
     450            int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1; 
     451                 
     452            if (zoom_ibegin.getValue() < 1  || zoom_jbegin.getValue() < 1 || 
     453                zoom_iend > iend.getValue() || zoom_jend > jend.getValue()) 
     454               ERROR("CDomain::checkZoom(void)", 
     455                     << "Zoom mal défini," 
     456                     << " vérifiez les valeurs zoom_ni, zoom_nj, zoom_ibegin, zoom_ibegin") ; 
     457         } 
     458      }    
     459   } 
     460 
     461   //---------------------------------------------------------------- 
     462 
    387463   void CDomain::checkAttributes(void) 
    388464   { 
     
    392468      this->checkLocalIDomain(); 
    393469      this->checkLocalJDomain(); 
     470       
     471      this->checkZoom(); 
    394472 
    395473      if (this->latvalue_sub.size() == 0) 
    396       { 
     474      { // CÃŽté client uniquement 
    397475         this->checkMask(); 
    398476         this->checkDomainData(); 
     
    400478      } 
    401479      else 
    402       { 
     480      { // CÃŽté serveur uniquement 
    403481         this->completeLonLat(); 
    404482      } 
     
    412490   void CDomain::completeMask(void) 
    413491   { 
    414       this->local_mask->resize(ni.getValue(), nj.getValue()); 
    415       /*this->local_mask->setDataPosition 
    416          (data_dim.getValue(), data_ni.getValue(), data_nj.getValue(), 
    417           data_ibegin.getValue(), data_jbegin.getValue(), data_n_index.getValue(), 
    418           data_i_index.getValue(), data_j_index.getValue());*/ 
    419    } 
    420  
    421    //---------------------------------------------------------------- 
    422  
    423    boost::shared_ptr<CMask> CDomain::getLocalMask(void) const 
     492      this->local_mask->resize(boost::extents[ni.getValue()][nj.getValue()]); 
     493   } 
     494 
     495   //---------------------------------------------------------------- 
     496 
     497   ARRAY(int, 2) CDomain::getLocalMask(void) const 
    424498   { 
    425499      return (this->local_mask); 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.hpp

    r182 r183  
    55#include "xmlioserver_spl.hpp" 
    66#include "group_factory.hpp" 
    7 #include "mask.hpp" 
    87 
    98#include "declare_group.hpp" 
     
    5150      private : 
    5251 
    53          virtual void checkGlobalDomain(void); 
     52         void checkGlobalDomain(void); 
    5453 
    55          virtual void checkLocalIDomain(void); 
    56          virtual void checkLocalJDomain(void); 
     54         void checkLocalIDomain(void); 
     55         void checkLocalJDomain(void); 
    5756 
    58          virtual void checkMask(void); 
    59          virtual void checkDomainData(void); 
    60          virtual void checkCompression(void); 
     57         void checkMask(void); 
     58         void checkDomainData(void); 
     59         void checkCompression(void); 
     60          
     61         void checkZoom(void); 
    6162 
    62          virtual void completeMask(void); 
     63         void completeMask(void); 
    6364 
    6465      public : 
     
    6869 
    6970         /// Accesseurs /// 
    70          boost::shared_ptr<CMask> getLocalMask(void) const; 
     71         ARRAY(int, 2) getLocalMask(void) const; 
    7172          
    7273         const std::set<StdString> & getRelFiles(void) const; 
     
    102103         /// Proriétés protégées /// 
    103104         bool isChecked; 
    104          boost::shared_ptr<CMask> local_mask; 
     105         ARRAY(int, 2) local_mask; 
    105106         std::set<StdString> relFiles; 
    106107 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.cpp

    r182 r183  
    332332      const std::vector<int> & ibegin = this->domain->getIBeginSub(); 
    333333      const std::vector<int> & jbegin = this->domain->getJBeginSub(); 
     334       
     335      const int ibegin_srv = this->domain->ibegin.getValue(); 
     336      const int jbegin_srv = this->domain->jbegin.getValue(); 
    334337       
    335338      StdSize dn = 0;       
     
    355358         { 
    356359            (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]  + dn; 
    357             (*out_i_index_srv)[n] = (*out_i_index_cl)[m] + ibegin_cl - 1; 
    358             (*out_j_index_srv)[n] = (*out_j_index_cl)[m] + jbegin_cl - 1; 
     360            (*out_i_index_srv)[n] = (*out_i_index_cl)[m] + (ibegin_cl - 1) - (ibegin_srv - 1); 
     361            (*out_j_index_srv)[n] = (*out_j_index_cl)[m] + (jbegin_cl - 1) - (jbegin_srv - 1); 
    359362            (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 
    360363         } 
     
    375378       
    376379   } 
     380    
     381   //---------------------------------------------------------------- 
     382    
     383   void CGrid::inputFieldServer 
     384         (const std::deque<ARRAY(double, 1)> storedClient, 
     385                           ARRAY(double, 1)  storedServer) const 
     386   { 
     387      if (this->storeIndex.size()-1 != storedClient.size()) 
     388         ERROR("CGrid::inputFieldServer(...)", 
     389                << "[ Nombre de tableau attendu = " << (this->storeIndex.size()-1) << ", " 
     390                << "[ Nombre de tableau reçu = "    << storedClient.size() << "] " 
     391                << "Les données d'un client sont manquantes !") ; 
     392      if (storedServer.get() != NULL) 
     393         storedServer->resize(boost::extents[this->storeIndex.size()-1]); 
     394      else  
     395         ARRAY_ASSIGN(storedServer, double, 1, [this->storeIndex.size()-1]); 
     396          
     397      for (StdSize i = 0, n = 0; i < storedClient.size(); i++) 
     398         for (StdSize j = 0; j < storedClient[i]->num_elements(); j++) 
     399            (*storedServer)[n++] = (*storedClient[i])[j]; 
     400   } 
    377401 
    378402   ///--------------------------------------------------------------- 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.hpp

    r182 r183  
    6969         /// Entrées-sorties de champs /// 
    7070         template <StdSize n> 
    71             void inputField(const  ARRAY(double, n) field, ARRAY(double, 1) stored) const; 
     71            void inputField(const ARRAY(double, n) field, ARRAY(double, 1) stored) const; 
    7272             
    7373         void inputFieldServer(const std::deque<ARRAY(double, 1)> storedClient, 
  • XMLIO_V2/dev/dev_rv/src/xmlio/output/nc4_data_output.cpp

    r180 r183  
    7474         StdString maskid    = StdString("mask_").append(domid).append("_local"); 
    7575 
    76          boost::shared_ptr<CMask> mask = domain->getLocalMask(); 
     76         ARRAY(int, 2) mask = domain->getLocalMask(); 
    7777 
    7878         unsigned int ssize = domain->ni.getValue() * domain->nj.getValue(); 
  • XMLIO_V2/dev/dev_rv/src/xmlio/output/onetcdf4.cpp

    r152 r183  
    341341      } 
    342342 
    343       void CONetCDF4::writeData(const boost::shared_ptr<CMask> data, const StdString & name) 
     343      void CONetCDF4::writeData(const ARRAY(int, 2) data, const StdString & name) 
    344344      { 
    345345         int grpid = this->getCurrentGroup(); 
     
    349349 
    350350         this->getWriteDataInfos(name, 0, array_size,  sstart, scount, NULL, NULL); 
    351           CheckError(nc_put_vara_int(grpid, varid, &(sstart[0]), &(scount[0]), data->getData())); 
     351          CheckError(nc_put_vara_int(grpid, varid, &(sstart[0]), &(scount[0]), data->data())); 
    352352      } 
    353353 
  • XMLIO_V2/dev/dev_rv/src/xmlio/output/onetcdf4.hpp

    r157 r183  
    6262                              const std::vector<StdSize> * count = NULL); 
    6363 
    64             void writeData(const boost::shared_ptr<CMask> data, const StdString & name); 
     64            void writeData(const ARRAY(int, 2) data, const StdString & name); 
    6565 
    6666            /// Accesseur /// 
Note: See TracChangeset for help on using the changeset viewer.