Ignore:
Timestamp:
04/19/11 15:06:51 (13 years ago)
Author:
hozdoba
Message:
 
Location:
XMLIO_V2/dev/dev_rv/src/xmlio/node
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.cpp

    r168 r180  
    44#include "object_template_impl.hpp" 
    55#include "group_template_impl.hpp" 
     6 
     7#include <algorithm> 
    68 
    79namespace xmlioserver { 
     
    1315      : CObjectTemplate<CDomain>(), CDomainAttributes() 
    1416      , isChecked(false), local_mask(new CMask()), relFiles() 
     17      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 
    1518   { /* Ne rien faire de plus */ } 
    1619 
     
    1821      : CObjectTemplate<CDomain>(id), CDomainAttributes() 
    1922      , isChecked(false), local_mask(new CMask()), relFiles() 
     23      , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 
    2024   { /* Ne rien faire de plus */ } 
    2125 
     
    3034   } 
    3135 
     36   //---------------------------------------------------------------- 
     37 
    3238   bool CDomain::IsWritten(const StdString & filename) const 
    3339   { 
     
    3541   } 
    3642 
     43   //---------------------------------------------------------------- 
     44 
    3745   void CDomain::addRelFile(const StdString & filename) 
    3846   { 
    3947      this->relFiles.insert(filename); 
     48   } 
     49 
     50   //---------------------------------------------------------------- 
     51 
     52   void CDomain::fromBinary(StdIStream & is) 
     53   { 
     54      SuperClass::fromBinary(is); 
     55       
     56      this->ibegin_sub.push_back(this->ibegin.getValue()); 
     57      this->jbegin_sub.push_back(this->jbegin.getValue()); 
     58      this->iend_sub.push_back(this->iend.getValue()); 
     59      this->jend_sub.push_back(this->jend.getValue());       
     60       
     61#define CLEAR_ATT(name_)\ 
     62      SuperClassAttribute::operator[](#name_)->clear() 
     63 
     64         CLEAR_ATT(mask); 
     65         CLEAR_ATT(data_n_index); 
     66         CLEAR_ATT(data_i_index); 
     67         CLEAR_ATT(data_j_index); 
     68          
     69         CLEAR_ATT(data_ni); 
     70         CLEAR_ATT(data_nj); 
     71         CLEAR_ATT(data_ibegin); 
     72         CLEAR_ATT(data_jbegin); 
     73          
     74         CLEAR_ATT(ni); 
     75         CLEAR_ATT(nj); 
     76          
     77         CLEAR_ATT(latvalue); 
     78         CLEAR_ATT(lonvalue); 
     79#undef CLEAR_ATT 
     80 
     81      this->ibegin.setValue(*std::min_element(this->ibegin_sub.begin(),this->ibegin_sub.end())); 
     82      this->jbegin.setValue(*std::min_element(this->jbegin_sub.begin(),this->jbegin_sub.end())); 
     83      this->iend.setValue(*std::max_element(this->iend_sub.begin(),this->iend_sub.end())); 
     84      this->jend.setValue(*std::max_element(this->jend_sub.begin(),this->jend_sub.end())); 
     85       
     86      this->checkGlobalDomain(); 
     87      this->checkLocalIDomain(); 
     88      this->checkLocalJDomain(); 
     89      this->completeMask(); 
     90       
     91      this->isChecked = true; 
    4092   } 
    4193 
     
    150202         mask.setValue(__arr); 
    151203      } 
    152  
    153204   } 
    154205 
     
    157208 
    158209   void CDomain::checkDomainData(void) 
    159    { 
     210   {      
    160211      if (!data_dim.isEmpty() && 
    161212         !(data_dim.getValue() == 1 || data_dim.getValue() == 2)) 
     
    252303         { 
    253304            const int dni = data_ni.getValue() * data_nj.getValue(); 
     305             
    254306            ARRAY_CREATE(__arri, int, 1, [dni]); 
    255307            ARRAY_CREATE(__arrj, int, 1, [dni]);                
     
    289341   void CDomain::completeMask(void) 
    290342   { 
    291       this->local_mask->resize(data_ni.getValue(), data_nj.getValue()); 
     343      this->local_mask->resize(ni.getValue(), nj.getValue()); 
    292344      /*this->local_mask->setDataPosition 
    293345         (data_dim.getValue(), data_ni.getValue(), data_nj.getValue(), 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.hpp

    r173 r180  
    6363 
    6464      public : 
     65       
     66         /// Autres /// 
     67         virtual void fromBinary(StdIStream & is); 
    6568 
    6669         /// Accesseurs /// 
     
    9093         std::set<StdString> relFiles; 
    9194 
     95         std::vector<int> ibegin_sub, iend_sub, jbegin_sub, jend_sub; 
     96 
    9297   }; // class CDomain 
    9398 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.cpp

    r168 r180  
    3434 
    3535   const ARRAY(int, 1) & CGrid::getStoreIndex(void) const 
    36    { return (this->storeIndex ); } 
     36   {  
     37      return (this->storeIndex ); 
     38   } 
     39 
     40   //--------------------------------------------------------------- 
     41 
    3742   const ARRAY(int, 1) & CGrid::getOutIIndex(void)  const 
    38    { return (this->out_i_index ); } 
     43   {  
     44      return (this->out_i_index );  
     45   } 
     46 
     47   //--------------------------------------------------------------- 
     48 
    3949   const ARRAY(int, 1) & CGrid::getOutJIndex(void)  const 
    40    { return (this->out_j_index ); } 
     50   {  
     51      return (this->out_j_index );  
     52   } 
     53 
     54   //--------------------------------------------------------------- 
     55 
    4156   const ARRAY(int, 1) & CGrid::getOutLIndex(void)  const 
    42    { return (this->out_l_index ); } 
     57   {  
     58      return (this->out_l_index );  
     59   } 
     60 
     61   //--------------------------------------------------------------- 
    4362 
    4463   const boost::shared_ptr<CAxis>   CGrid::getRelAxis  (void) const 
    45    { return (this->axis ); } 
     64   {  
     65      return (this->axis );  
     66   } 
     67 
     68   //--------------------------------------------------------------- 
     69 
    4670   const boost::shared_ptr<CDomain> CGrid::getRelDomain(void) const 
    47    { return (this->domain ); } 
    48  
    49    bool CGrid::hasAxis(void) const { return (this->withAxis); } 
     71   {  
     72      return (this->domain );  
     73   } 
     74 
     75   //--------------------------------------------------------------- 
     76 
     77   bool CGrid::hasAxis(void) const  
     78   {  
     79      return (this->withAxis);  
     80   } 
    5081 
    5182   //--------------------------------------------------------------- 
     
    5990      this->isChecked = true; 
    6091   } 
     92 
     93   //--------------------------------------------------------------- 
    6194 
    6295   void CGrid::solveDomainRef(void) 
     
    76109   } 
    77110 
     111   //--------------------------------------------------------------- 
     112 
    78113   void CGrid::solveAxisRef(void) 
    79114   { 
     
    95130 
    96131   void CGrid::computeIndex(void) 
    97    { 
     132   {     
    98133      const int ni   = domain->ni.getValue() , 
    99134                nj   = domain->nj.getValue() , 
     
    113148                    data_j_index = domain->data_j_index.getValue() ; 
    114149 
    115       /*std::cout << data_n_index        << " : " 
    116                   << data_i_index.size() << " : " 
    117                   << data_j_index.size() << std::endl;*/ 
     150      /*std::cout << data_n_index  << " : " 
     151                  << data_i_index  << " : " 
     152                  << data_j_index  << std::endl; */ 
    118153 
    119154      ARRAY(bool, 2) mask = domain->mask.getValue() ; 
     
    204239   } 
    205240 
     241   //--------------------------------------------------------------- 
     242 
    206243   template <> 
    207244      void CGrid::outputField 
     
    211248         (*field)[(*out_i_index)[n]][(*out_j_index)[n]] = (*stored)[n] ; 
    212249   } 
     250 
     251   //--------------------------------------------------------------- 
    213252 
    214253   template <> 
     
    230269         (*stored)[i] = data[(*storeIndex)[i]] ; 
    231270   } 
     271    
     272   //--------------------------------------------------------------- 
     273    
     274   void CGrid::toBinary  (StdOStream & os) const 
     275   { 
     276      SuperClass::toBinary(os); 
     277      this->storeIndex->toBinary(os); 
     278      this->out_i_index->toBinary(os); 
     279      this->out_j_index->toBinary(os); 
     280      this->out_l_index->toBinary(os); 
     281   } 
     282 
     283   //--------------------------------------------------------------- 
     284    
     285   void CGrid::fromBinary(StdIStream & is) 
     286   { 
     287      SuperClass::fromBinary(is); 
     288       
     289      ARRAY_CREATE(storeIndex_ , int, 1, [1]); 
     290      ARRAY_CREATE(out_l_index_, int, 1, [1]); 
     291      ARRAY_CREATE(out_i_index_, int, 1, [1]); 
     292      ARRAY_CREATE(out_j_index_, int, 1, [1]); 
     293       
     294      storeIndex_ ->fromBinary(is); 
     295      out_i_index_->fromBinary(is); 
     296      out_j_index_->fromBinary(is); 
     297      out_l_index_->fromBinary(is); 
     298       
     299   } 
    232300 
    233301   ///--------------------------------------------------------------- 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.hpp

    r173 r180  
    4949         /// Traitements /// 
    5050         void solveReference(void); 
     51 
     52         virtual void toBinary  (StdOStream & os) const; 
     53         virtual void fromBinary(StdIStream & is); 
    5154 
    5255         /// Tests /// 
Note: See TracChangeset for help on using the changeset viewer.