Changeset 205


Ignore:
Timestamp:
05/26/11 13:34:49 (13 years ago)
Author:
hozdoba
Message:
 
Location:
XMLIO_V2/dev/dev_rv/src/xmlio
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/src/xmlio/fortran/ixmlioserver.f03.in

    r179 r205  
    146146#include "../config/grid_attribute.conf" 
    147147 
    148  
    149148   END INTERFACE 
    150149 
  • XMLIO_V2/dev/dev_rv/src/xmlio/functor.cpp

    r187 r205  
    77      /// ////////////////////// Définitions ////////////////////// /// 
    88 
    9       CFunctor::CFunctor(const StdString & id, ARRAY(double, 1) doutput, 
    10                          const CFunData & data, CFuncType type) 
    11          : SuperClass(id) 
    12          , doutput(doutput), size() 
    13          , data(data), type(type) 
    14       { this->resize(size); } 
    15  
    16       CFunctor::CFunctor(const StdString & id, DoubleArray doutput, 
    17                          const std::vector<StdSize> size, 
    18                          const CFunData & data, CFuncType type) 
    19          : SuperClass(id) 
    20          , doutput(doutput), size(size) 
    21          , data(data), type(type) 
    22       { this->resize(size); } 
     9      CFunctor::CFunctor(const StdString & id, ARRAY(double, 1) doutput) 
     10         : SuperClass(id), doutput(doutput) 
     11      { /* Ne rien faire de plus */  } 
    2312 
    2413      CFunctor::~CFunctor(void) 
     
    2716      //--------------------------------------------------------------- 
    2817 
    29       const CFunctor::CFunData  & CFunctor::getData(void) const 
    30       { return (this->data); } 
    31  
    32       CFunctor::CFuncType CFunctor::getType(void) const 
    33       { return (this->type); } 
    34  
    3518      ARRAY(double, 1) CFunctor::getDataOutput(void) const 
    36       { return (this->doutput); } 
    37  
    38       const std::vector<StdSize> & CFunctor::getShape(void) const 
    39       { return (this->size); } 
    40  
    41       StdSize CFunctor::getSize(void) const 
    42       { return (this->doutput->size()); } 
    43  
    44       //--------------------------------------------------------------- 
    45  
    46       void CFunctor::resize(StdSize x, StdSize y, StdSize z) 
    47       { 
    48          this->size.clear(); 
    49          this->size.push_back(x); 
    50          if (y != 1) this->size.push_back(y); 
    51          if (z != 1) this->size.push_back(z); 
    52          this->doutput->resize(boost::extents[x * y * z]); 
    53       } 
    54  
    55       void CFunctor::resize(const std::vector<StdSize> & sizes) 
    56       { 
    57          StdSize newsize = 1; 
    58          this->size.clear(); 
    59          std::vector<StdSize>::const_iterator it = sizes.begin(), end = sizes.end(); 
    60           
    61          for (; it!=end; it++) 
    62          {  
    63             StdSize size = *it; 
    64             newsize *= size; 
    65             this->size.push_back(size); 
    66          } 
    67          this->doutput->resize(boost::extents[newsize]); 
     19      {  
     20         return (this->doutput); 
    6821      } 
    6922 
     
    9144                   << ", output size = " << this->doutput->size() << " ]" 
    9245                   << " size of input array !=  size of output array !"); 
    93          this->apply(dinput, this->doutput, this->size, this->data); 
     46         this->apply(dinput, this->doutput); 
    9447         return (this->doutput); 
    9548      } 
  • XMLIO_V2/dev/dev_rv/src/xmlio/functor.hpp

    r202 r205  
    2020         public : 
    2121 
    22             typedef enum func_type { SPATIAL = 0, TEMPORAL } CFuncType; 
    23             typedef struct func_data 
    24             { int timestep; } CFunData; 
    25  
    2622            /// Accesseurs /// 
    27             CFuncType getType(void) const; 
    28             StdSize   getSize(void) const; 
    29  
    30             const CFunData  & getData(void) const; 
    31             const std::vector<StdSize> & getShape(void) const; 
    32  
    3323            DoubleArray getDataOutput(void) const; 
    34  
    35             /// Mutateur /// 
    36             void resize(StdSize x, StdSize y = 1, StdSize z = 1); 
    37             void resize(const std::vector<StdSize> & sizes); 
    38  
    3924            /// Opérateur /// 
    4025            DoubleArray operator ()(const DoubleArray dinput); 
     
    4631 
    4732            /// Traitement /// 
    48             virtual void apply(const DoubleArray dinput, DoubleArray doutput, 
    49                                const std::vector<StdSize> size, const CFunData & data) = 0; 
     33            virtual void apply(const DoubleArray dinput, DoubleArray doutput) = 0; 
    5034 
    5135            /// Autres /// 
     
    5337            virtual void fromString(const StdString & str); 
    5438 
    55  
    5639            /// Constructeurs /// 
    5740            CFunctor(void);                             // Not implemented. 
    58  
    59             CFunctor(const StdString & id, DoubleArray doutput, 
    60                      const CFunData & data, CFuncType type = TEMPORAL); 
    61  
    62             CFunctor(const StdString & id, DoubleArray doutput, 
    63                      const std::vector<StdSize> size, 
    64                      const CFunData & data, CFuncType type = TEMPORAL); 
    65  
     41            CFunctor(const StdString & id, DoubleArray doutput); 
    6642            CFunctor(const CFunctor & functor);         // Not implemented. 
    6743            CFunctor(const CFunctor * const functor);   // Not implemented. 
     
    7147            /// Propriétés privées /// 
    7248            DoubleArray doutput; 
    73             std::vector<StdSize> size; 
    74             CFunData data; CFuncType type; 
    75  
     49             
    7650      }; // class CFunctor 
    7751   } // namespace func 
  • XMLIO_V2/dev/dev_rv/src/xmlio/functor/average.cpp

    r152 r205  
    77      /// ////////////////////// Définitions ////////////////////// /// 
    88 
    9       CAverage::CAverage(DoubleArray doutput, 
    10                          const CFunData & data, 
    11                          const std::vector<size_t> size) 
    12          : SuperClass(StdString("average"), doutput, size, data) 
     9      CAverage::CAverage(DoubleArray doutput) 
     10         : SuperClass(StdString("average"), doutput) 
    1311      { /* Ne rien faire de plus */ } 
    1412 
     
    1917 
    2018      void CAverage::apply(const DoubleArray         UNUSED(dinput), 
    21                               DoubleArray            UNUSED(doutput), 
    22                            const std::vector<size_t> UNUSED(size), 
    23                            const CFunData &          UNUSED(data)) 
     19                                 DoubleArray         UNUSED(doutput)) 
    2420      { 
    2521         ERROR("CAverage::apply(...)", << "Not implemented yet !"); 
  • XMLIO_V2/dev/dev_rv/src/xmlio/functor/average.hpp

    r152 r205  
    1919 
    2020            /// Constructeurs /// 
    21             CAverage(void);                             // Not implemented. 
    22             CAverage(const CFunData & data); 
    23             CAverage(DoubleArray doutput, const CFunData & data, 
    24                      const std::vector<size_t> size); 
    25             CAverage(const CAverage & average);         // Not implemented. 
    26             CAverage(const CAverage * const average);   // Not implemented. 
     21            //CAverage(void);                             // Not implemented. 
     22            //CAverage(const CFunData & data); 
     23            CAverage(DoubleArray doutput); 
     24            //CAverage(const CAverage & average);         // Not implemented. 
     25            //CAverage(const CAverage * const average);   // Not implemented. 
    2726 
    2827            /// Traitement /// 
    29             virtual void apply(const DoubleArray dinput, DoubleArray doutput, 
    30                                const std::vector<size_t> size, const CFunData & data); 
     28            virtual void apply(const DoubleArray dinput, DoubleArray doutput); 
    3129 
    3230            /// Destructeur /// 
  • XMLIO_V2/dev/dev_rv/src/xmlio/functor/instant.cpp

    r152 r205  
    77      /// ////////////////////// Définitions ////////////////////// /// 
    88 
    9       CInstant::CInstant(DoubleArray doutput, 
    10                          const CFunData & data, 
    11                          const std::vector<size_t> size) 
    12          : SuperClass(StdString("instant"), doutput, size, data) 
     9      CInstant::CInstant(DoubleArray doutput) 
     10         : SuperClass(StdString("instant"), doutput) 
    1311      { /* Ne rien faire de plus */ } 
    1412 
     
    1917 
    2018      void CInstant::apply(const DoubleArray         UNUSED(dinput), 
    21                                  DoubleArray         UNUSED(doutput), 
    22                            const std::vector<size_t> UNUSED(size), 
    23                            const CFunData &          UNUSED(data)) 
     19                                 DoubleArray         UNUSED(doutput)) 
    2420      { 
    2521         ERROR("CInstant::apply(...)", << "Not implemented yet !"); 
  • XMLIO_V2/dev/dev_rv/src/xmlio/functor/instant.hpp

    r152 r205  
    1919 
    2020            /// Constructeurs /// 
    21             CInstant(void);                             // Not implemented. 
    22             CInstant(const CFunData & data); 
    23             CInstant(DoubleArray doutput, const CFunData & data, 
    24                      const std::vector<size_t> size); 
    25             CInstant(const CInstant & instant);         // Not implemented. 
    26             CInstant(const CInstant * const instant);   // Not implemented. 
     21            //CInstant(void);                             // Not implemented. 
     22            //CInstant(const CFunData & data); 
     23            CInstant(DoubleArray doutput); 
     24            //CInstant(const CInstant & instant);         // Not implemented. 
     25            //CInstant(const CInstant * const instant);   // Not implemented. 
    2726 
    2827            /// Traitement /// 
    29             virtual void apply(const DoubleArray dinput, DoubleArray doutput, 
    30                                const std::vector<size_t> size, const CFunData & data); 
     28            virtual void apply(const DoubleArray dinput, DoubleArray doutput); 
    3129 
    3230            /// Destructeur /// 
  • XMLIO_V2/dev/dev_rv/src/xmlio/functor/once.cpp

    r152 r205  
    77      /// ////////////////////// Définitions ////////////////////// /// 
    88 
    9       COnce::COnce(DoubleArray doutput, 
    10                    const CFunData & data, 
    11                    const std::vector<size_t> size) 
    12          : SuperClass(StdString("once"), doutput, size, data) 
     9      COnce::COnce(DoubleArray doutput) 
     10         : SuperClass(StdString("once"), doutput) 
    1311      { /* Ne rien faire de plus */ } 
    1412 
     
    1917 
    2018      void COnce::apply(const DoubleArray         UNUSED(dinput), 
    21                               DoubleArray         UNUSED(doutput), 
    22                         const std::vector<size_t> UNUSED(size), 
    23                         const CFunData &          UNUSED(data)) 
     19                              DoubleArray         UNUSED(doutput)) 
    2420      { 
    2521         ERROR("COnce::apply(...)", << "Not implemented yet !"); 
  • XMLIO_V2/dev/dev_rv/src/xmlio/functor/once.hpp

    r152 r205  
    1919 
    2020            /// Constructeurs /// 
    21             COnce(void);                       // Not implemented. 
    22             COnce(DoubleArray doutput, const CFunData & data, 
    23                   const std::vector<size_t> size); 
    24             COnce(const COnce & once);         // Not implemented. 
    25             COnce(const COnce * const once);   // Not implemented. 
     21            //COnce(void);                       // Not implemented. 
     22            COnce(DoubleArray doutput); 
     23            //COnce(const COnce & once);         // Not implemented. 
     24            //COnce(const COnce * const once);   // Not implemented. 
    2625 
    2726            /// Traitement /// 
    28             virtual void apply(const DoubleArray dinput, DoubleArray doutput, 
    29                                const std::vector<size_t> size, const CFunData & data); 
     27            virtual void apply(const DoubleArray dinput, DoubleArray doutput); 
    3028 
    3129            /// Destructeur /// 
  • XMLIO_V2/dev/dev_rv/src/xmlio/iface/interface.cpp.in

    r202 r205  
    365365void xios_update_calendar(int step) 
    366366{ 
    367  
     367   try 
     368   { 
     369   } 
     370   catch (CException & exc) 
     371   { 
     372      std::cerr << exc.getMessage() << std::endl; 
     373      exit (EXIT_FAILURE); 
     374   } 
    368375} 
    369376 
     
    373380                       double ts_hour, double ts_minute, double ts_second) 
    374381{ 
    375  
    376  
     382   try 
     383   { 
     384   } 
     385   catch (CException & exc) 
     386   { 
     387      std::cerr << exc.getMessage() << std::endl; 
     388      exit (EXIT_FAILURE); 
     389   } 
    377390} 
    378391 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/field.cpp

    r202 r205  
    183183      if (CXIOSManager::GetStatus() == CXIOSManager::LOC_SERVER) 
    184184      { 
    185          this->freq_operation = CDuration::FromString(this->file->output_freq.getValue()); 
    186          this->freq_write     = CDuration::FromString(this->file->output_freq.getValue()); 
    187          //this->foperation = boost::shared_ptr<func::CFunctor>(new CInstant()); 
     185         this->freq_operation = 
     186             CDuration::FromString(this->file->output_freq.getValue()); 
     187         this->freq_write     = 
     188             CDuration::FromString(this->file->output_freq.getValue()); 
     189         this->foperation     = 
     190             boost::shared_ptr<func::CFunctor>(new CInstant(this->data)); 
    188191      } 
    189192      else 
     
    192195         this->freq_write     = CDuration::FromString(this->file->output_freq.getValue()); 
    193196          
    194 #define DECLARE_FUNCTOR(MType, mtype) \ 
     197#define DECLARE_FUNCTOR(MType, mtype)              \ 
    195198   if  (operation.getValue().compare(#mtype) == 0) \ 
    196    { /*this->foperation = boost::shared_ptr<func::CFunctor>(new C##MType()); */ \ 
    197      return; } 
    198  
     199   {                                               \ 
     200      boost::shared_ptr<func::CFunctor>            \ 
     201            foperation_(new C##MType(this->data)); \ 
     202      this->foperation = foperation_;              \ 
     203      return;                                      \ 
     204   } 
    199205    
    200206#include "functor_type.conf" 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.cpp

    r200 r205  
    8989   {  
    9090      return (this->withAxis);  
     91   } 
     92 
     93   //--------------------------------------------------------------- 
     94 
     95   StdSize CGrid::getDimension(void) const 
     96   { 
     97      return ((this->withAxis)?3:2); 
     98   } 
     99 
     100   //--------------------------------------------------------------- 
     101 
     102   std::vector<StdSize> CGrid::getShape(void) const 
     103   { 
     104      std::vector<StdSize> retvalue; 
     105      retvalue.push_back(this->domain->ni.getValue()); 
     106      retvalue.push_back(this->domain->nj.getValue()); 
     107      if (this->withAxis) 
     108         retvalue.push_back(this->axis->size.getValue()); 
     109      return (retvalue); 
     110   } 
     111   //--------------------------------------------------------------- 
     112    
     113   StdSize CGrid::getSize(void) const 
     114   { 
     115      StdSize retvalue = 1; 
     116      std::vector<StdSize> shape_ = this->getShape(); 
     117      for (StdSize s = 0; s < shape_.size(); s++) 
     118         retvalue *= shape_[s]; 
     119      return (retvalue); 
    91120   } 
    92121 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.hpp

    r183 r205  
    6767         const boost::shared_ptr<CDomain> getRelDomain(void) const; 
    6868 
     69         StdSize getDimension(void) const; 
     70         StdSize getSize(void) const; 
     71         std::vector<StdSize> getShape(void) const; 
     72 
    6973         /// Entrées-sorties de champs /// 
    7074         template <StdSize n> 
     
    125129   template <StdSize n> 
    126130      void CGrid::inputField(const  ARRAY(double, n) field, ARRAY(double, 1) stored) const 
    127    { this->storeField_arr(field.data(), stored) ; } 
     131   { 
     132      if (this->getSize() != field->num_elements()) 
     133         ERROR("CGrid::inputField(const  ARRAY(double, n) field, ARRAY(double, 1) stored)", 
     134                << "[ Taille des données attendue = " << this->getSize()       << ", " 
     135                << "Taille des données reçue = "      << field->num_elements() << " ] " 
     136                << "Le tableau de données n'a pas la bonne taille !") ; 
     137      this->storeField_arr(field.data(), stored) ; 
     138   } 
    128139 
    129140   ///-------------------------------------------------------------- 
  • XMLIO_V2/dev/dev_rv/src/xmlio/output/nc4_data_output.cpp

    r204 r205  
    381381         { 
    382382            ARRAY(double, 3) field_data3D;             
    383             grid->outputField(field_data,  field_data3D); 
     383            grid->outputField(field_data, field_data3D); 
    384384            SuperClassWriter::writeData(field_data3D, fieldid, true, 0); 
    385385             
Note: See TracChangeset for help on using the changeset viewer.