Changeset 265


Ignore:
Timestamp:
09/06/11 11:57:45 (13 years ago)
Author:
hozdoba
Message:

Corrections après tests sur titane

Location:
XMLIO_V2/dev/dev_rv/src/xmlio
Files:
4 added
36 edited

Legend:

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

    r259 r265  
    9898      CBuffer::getBufferDataType<ARRAY(type, 1)>(void) const { return (type_enum); }; 
    9999 
    100       BufferDataTypeGetter(bool,     TBOOL8); 
    101       BufferDataTypeGetter(char,     TCHAR8); 
    102       BufferDataTypeGetter(float,    TFLOAT32); 
    103       BufferDataTypeGetter(double,   TDOUBLE64); 
     100      BufferDataTypeGetter(bool, TBOOL8); 
     101      BufferDataTypeGetter(char, TCHAR8); 
     102      BufferDataTypeGetter(float, TFLOAT32); 
     103      BufferDataTypeGetter(double, TDOUBLE64); 
    104104      BufferDataTypeGetter(long int, TINT32); 
    105105 
  • XMLIO_V2/dev/dev_rv/src/xmlio/calendar.cpp

    r202 r265  
    5353 
    5454      CDate & CCalendar::update(int step) 
    55       { return (this->getCurrentDate() = this->getCurrentDate() + step * this->timestep); } 
     55      {  
     56         std::cout << "step : " << step << std::endl; 
     57         return (this->getCurrentDate() = this->getInitDate() + step * this->timestep); 
     58      } 
    5659 
    5760      //----------------------------------------------------------------- 
  • XMLIO_V2/dev/dev_rv/src/xmlio/calendar_util.cpp

    r157 r265  
    3737      { 
    3838         CDuration dur(ddr); 
    39          dur.year = -dur.year;  dur.month  = -dur.month ; dur.day    = -dur.day; 
    40          dur.hour = -dur.hour;  dur.minute = -dur.minute; dur.second = -dur.second; 
     39         dur.year   = -dur.year; 
     40         dur.month  = -dur.month; 
     41         dur.day    = -dur.day; 
     42         dur.hour   = -dur.hour; 
     43         dur.minute = -dur.minute; 
     44         dur.second = -dur.second; 
    4145         return (dur); 
    4246      } 
     
    6872 
    6973         // Ajustement des mois en fonction des jours. 
    70          int signVal = drr.day/fabs(drr.day); 
     74         int signVal = (drr.day != 0) ? drr.day/fabs(drr.day) : 0; 
    7175         CDate dtt(dt); dtt.addMonth (signVal); 
    7276 
     
    7781         if (day <  0) { drr.month --; day += c.getMonthLength(dtt); } 
    7882         if (day >= c.getMonthLength(dtt)) { drr.month ++; day -= c.getMonthLength(dtt); } // << ProblÚme ici 
    79          if (day == 0) day = c.getMonthLength(dtt); 
    80  
     83         if (day == 0){ day = c.getMonthLength(dtt); drr.month --; } 
     84          
    8185         drr.resolve(dt.getRelCalendar()); 
    8286 
    8387         // Ajustement des années en fonction des mois. 
    8488         month += dt.getMonth() + drr.month; 
    85          if (month <  0) { year --; month += c.getYearLength(); } 
    86          if (month >= c.getYearLength()) { year ++; month -= c.getYearLength(); } 
    87          if (month == 0) month = c.getYearLength(); 
     89         if (month <  0) { drr.year --; month += c.getYearLength(); } 
     90         if (month >  c.getYearLength()) { drr.year ++; month -= c.getYearLength(); } 
     91         if (month == 0){ month = c.getYearLength(); drr.year--; } 
    8892 
    8993         year += dt.getYear() + drr.year; 
     
    118122      { 
    119123         // TODO :: Vérifier que les deux dates (dt0 et dt1) ont une référence vers le même calendrier. 
    120          if (dt0.getYear()   < dt1.getYear())   return true; if (dt0.getMonth()  < dt1.getMonth())  return true; 
    121          if (dt0.getDay()    < dt1.getDay())    return true; if (dt0.getHour()   < dt1.getHour())   return true; 
    122          if (dt0.getMinute() < dt1.getMinute()) return true; if (dt0.getSecond() < dt1.getSecond()) return true; 
     124         if   (dt0.getYear()  < dt1.getYear()) 
     125         {  
     126            return true; 
     127         } 
     128         else if (dt0.getYear() == dt1.getYear()) 
     129         {  
     130            if   (dt0.getMonth()  < dt1.getMonth()) 
     131            { 
     132               return true; 
     133            } 
     134            else if (dt0.getMonth() == dt1.getMonth()) 
     135            { 
     136               if   (dt0.getDay()  < dt1.getDay()) 
     137               { 
     138                   return true; 
     139               } 
     140               else if (dt0.getDay() == dt1.getDay()) 
     141               { 
     142                  if    (dt0.getHour()  < dt1.getHour()) 
     143                  { 
     144                     return true; 
     145                  } 
     146                  else if (dt0.getHour() == dt1.getHour()) 
     147                  {  
     148                     if   (dt0.getMinute()  < dt1.getMinute()) 
     149                     { 
     150                        return true; 
     151                     } 
     152                     else if (dt0.getMinute() == dt1.getMinute()) 
     153                     { 
     154                        if (dt0.getSecond() < dt1.getSecond()) 
     155                           return true; 
     156                     } 
     157                  } 
     158               } 
     159            } 
     160         } 
    123161         return false; 
    124162      } 
  • XMLIO_V2/dev/dev_rv/src/xmlio/config/field_attribute.conf

    r202 r265  
    77 
    88DECLARE_ATTRIBUTE(StdString, freq_op) 
     9DECLARE_ATTRIBUTE(StdString, freq_offset) 
    910DECLARE_ATTRIBUTE(int,       level) 
    1011DECLARE_ATTRIBUTE(int,       prec) 
  • XMLIO_V2/dev/dev_rv/src/xmlio/config/file_attribute.conf

    r152 r265  
    22DECLARE_ATTRIBUTE(StdString, description) 
    33 
     4DECLARE_ATTRIBUTE(StdString, name_suffix) 
     5 
    46DECLARE_ATTRIBUTE(StdString, output_freq) 
    5  
    67DECLARE_ATTRIBUTE(int,       output_level) 
    78 
  • XMLIO_V2/dev/dev_rv/src/xmlio/config/functor_type.conf

    r188 r265  
    88 
    99#ifdef __XMLIO_COnce__ 
    10    DECLARE_FUNCTOR(Once , once) 
     10   DECLARE_FUNCTOR(Once, once) 
    1111#endif //__XMLIO_COnce__ 
    1212 
     13#ifdef __XMLIO_CMaximum__ 
     14   DECLARE_FUNCTOR(Maximum , maximum) 
     15#endif //__XMLIO_CMaximum__ 
     16 
     17#ifdef __XMLIO_CMinimum__ 
     18   DECLARE_FUNCTOR(Minimum , minimum) 
     19#endif //__XMLIO_CMinimum__ 
     20 
     21 
    1322#undef DECLARE_FUNCTOR 
  • XMLIO_V2/dev/dev_rv/src/xmlio/data_treatment.cpp

    r214 r265  
    3838         // Mise à jour cÃŽté client 
    3939         this->currentContext->getCalendar()->update(step); 
     40//         std::cout <<  "current date : " << this->currentContext->getCalendar()->getCurrentDate() << std::endl; 
    4041         if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT) 
    4142         { // Mise à jour cÃŽté serveur 
     
    4950         // Mise à jour cÃŽté client 
    5051         this->currentContext->getCalendar()->setTimeStep(duration); 
     52         std::cout << "timestep :" << duration << std::endl; 
    5153         if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT) 
    5254         { // Mise à jour cÃŽté serveur 
  • XMLIO_V2/dev/dev_rv/src/xmlio/data_treatment.hpp

    r229 r265  
    8181            boost::shared_ptr<CFile> file = *it; 
    8282            StdString filename = (!file->name.isEmpty()) 
    83                                ? file->name.getValue() : file->getId(); 
     83                               ?   file->name.getValue() : file->getId(); 
    8484            StdOStringStream oss; 
    85             oss << "wk/data/" << filename << "_node" << comm::CMPIManager::GetCommRank() << ".nc"; 
     85            if (!CObjectFactory::GetObject<CContext> 
     86                (CObjectFactory::GetCurrentContextId())->output_dir.isEmpty()) 
     87                oss << CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId())->output_dir.getValue(); 
     88            oss << filename; 
     89            if (!file->name_suffix.isEmpty()) 
     90                oss << file->name_suffix.getValue(); 
     91            if (comm::CMPIManager::GetCommSize() > 1) 
     92                oss << "_node" << comm::CMPIManager::GetCommRank(); 
     93            oss << ".nc"; 
    8694            boost::shared_ptr<io::CDataOutput> dout(new T(oss.str(), false)); 
    8795            file->initializeDataOutput(dout); 
     
    93101            (const StdString & fieldId, const ARRAY(float, N) & data) 
    94102      { 
    95                 typedef typename boost::multi_array<double, N>::size_type sizetp; 
     103        typedef typename boost::multi_array<double, N>::size_type sizetp; 
    96104         std::vector<sizetp> shape; 
    97105         const sizetp * shapearr = data->shape(); 
    98106 
    99107         shape.assign(shapearr, shapearr + N); 
    100          ARRAY_CREATE(datad, double, N, [shape]); 
    101          datad->assign(data->begin(), data->end()); 
     108         ARRAY(double, N) datad(new CArray<double, N>(shape)); 
     109         for (StdSize i = 0; i < datad->num_elements(); i++) 
     110          datad->data()[i] = data->data()[i]; 
    102111 
    103112         this->write_data(fieldId, datad); 
     
    110119         const date::CDate & currDate = 
    111120                this->currentContext->getCalendar()->getCurrentDate(); 
     121         const date::CDuration & timestep =  
     122               this->currentContext->getCalendar()->getTimeStep(); 
    112123         const std::vector<boost::shared_ptr<CField> > & refField= 
    113124               CObjectFactory::GetObject<CField>(fieldId)->getAllReference(); 
    114125         std::vector<boost::shared_ptr<CField> >::const_iterator 
    115126               it = refField.begin(), end = refField.end(); 
    116  
     127//       std::cout << "nb :" << refField.size() << std::endl; 
    117128         for (; it != end; it++) 
    118129         { 
    119130            boost::shared_ptr<CField> field = *it; 
    120131            boost::shared_ptr<CFile>  file  = field->getRelFile(); 
    121             if (field->updateData(currDate, data)) 
     132//            std::cout << ">> " << fieldId << ", " << file->getId() << std::endl; 
     133            if (field->updateData(currDate, timestep, data)) 
    122134            { 
    123135               if (CXIOSManager::GetStatus() == CXIOSManager::LOC_CLIENT) 
     
    131143               } 
    132144            } 
    133             return; 
    134145         } 
    135146 
  • XMLIO_V2/dev/dev_rv/src/xmlio/duration.cpp

    r152 r265  
    5050         while (!in.eof()) 
    5151         { 
    52                in >> v >> c; 
     52               if (!(in >> v >> c))  
     53               { 
     54                 //DEBUG("----> Pb StdIStream & operator>>(StdIStream & in , CDuration & duration)") ; 
     55                 //if (in.eof())  DEBUG("----> Fin de fichier StdIStream & operator>>(StdIStream & in , CDuration & duration)") ; 
     56               } 
     57               if (in.eof())   
     58               { 
     59                 //DEBUG("----> Fin de fichier StdIStream & operator>>(StdIStream & in , CDuration & duration)") ; 
     60                 break ; 
     61               } 
    5362               switch (c) 
    5463               { 
    55                   case 'y': duration.year   = v; continue; 
    56                   case 'd': duration.day    = v; continue; 
    57                   case 'h': duration.hour   = v; continue; 
    58                   case 's': duration.second = v; continue; 
     64                  case 'y': duration.year   = v; break; 
     65                  case 'd': duration.day    = v; break; 
     66                  case 'h': duration.hour   = v; break; 
     67                  case 's': duration.second = v; break; 
    5968                  case 'm': 
     69                  { 
    6070                     in >> c; 
    6171                     if     (c == 'i') duration.minute = v; 
     
    6474                     { 
    6575                        StdString valc("m"); valc.append(1, c); 
    66                         DEBUG("La chaine \"" << valc << "\" ne permet pas de définir une unité de durée."); 
    67                         continue; 
     76                        //DEBUG("La chaine \"" << valc << "\" ne permet pas de définir une unité de durée."); 
     77                        break; 
    6878                     } 
    69                      continue; 
     79                     break; 
     80                  } 
    7081                  default: 
    7182                     StdString valc; valc.append(1, c); 
    72                      DEBUG("La chaine \"" << valc << "\" ne permet pas de définir une unité de durée."); 
    73                      continue; 
     83                     //DEBUG("La chaine \"" << valc << "\" ne permet pas de définir une unité de durée."); 
     84                     break; 
    7485               } 
    7586            } 
  • XMLIO_V2/dev/dev_rv/src/xmlio/fake_client/fake_lmdz.f90

    r177 r265  
    66 
    77   ! Modules de la bibliothÚque xmlioserver 
    8    USE IXMLIOSERVER 
     8   USE XIOS 
    99   USE ISO_C_BINDING 
    1010 
  • XMLIO_V2/dev/dev_rv/src/xmlio/fake_client/fake_nemo.f90

    r202 r265  
    66 
    77   ! Modules de la bibliothÚque xmlioserver 
    8    USE IXMLIOSERVER 
     8   USE XIOS 
    99   USE ISO_C_BINDING 
    1010 
  • XMLIO_V2/dev/dev_rv/src/xmlio/fake_client/fake_orchidee.f90

    r177 r265  
    66 
    77   ! Modules de la bibliothÚque xmlioserver 
    8    USE IXMLIOSERVER 
     8   USE XIOS 
    99   USE ISO_C_BINDING 
    1010 
  • XMLIO_V2/dev/dev_rv/src/xmlio/fortran/ixmlioserver.f03.in

    r208 r265  
    66#include "macro.inc" 
    77 
    8 MODULE IXMLIOSERVER 
     8MODULE XIOS 
    99   USE, INTRINSIC :: ISO_C_BINDING 
    1010 
     
    110110 
    111111      SUBROUTINE xios_write_data(fieldid, fieldid_size, data_k8, data_Xsize, data_Ysize, data_Zsize) BIND(C) 
    112          import C_INT, C_CHAR, C_PTR, C_FLOAT, C_DOUBLE, C_BOOL 
     112         import C_INT, C_CHAR, C_PTR, C_DOUBLE, C_BOOL 
    113113         CHARACTER(kind = C_CHAR), DIMENSION(*) :: fieldid 
    114114         INTEGER  (kind = C_INT),  VALUE        :: fieldid_size 
     
    116116         INTEGER  (kind = C_INT), VALUE         :: data_Xsize, data_Ysize, data_Zsize 
    117117      END SUBROUTINE xios_write_data 
     118       
     119      SUBROUTINE xios_write_data_f(fieldid, fieldid_size, data_k4, data_Xsize, data_Ysize, data_Zsize) BIND(C) 
     120         import C_INT, C_CHAR, C_PTR, C_FLOAT, C_BOOL 
     121         CHARACTER(kind = C_CHAR), DIMENSION(*) :: fieldid 
     122         INTEGER  (kind = C_INT),  VALUE        :: fieldid_size 
     123         REAL(kind = C_FLOAT), DIMENSION(*)     :: data_k4 
     124         INTEGER  (kind = C_INT), VALUE         :: data_Xsize, data_Ysize, data_Zsize 
     125      END SUBROUTINE xios_write_data_f 
     126 
     127      SUBROUTINE  xios_init_ioserver(comm_client) BIND(C) 
     128         import C_INT 
     129         INTEGER  (kind = C_INT) :: comm_client 
     130      END SUBROUTINE xios_init_ioserver 
    118131 
    119132#define DECLARE_ATTRIBUTE(type, name) \ 
     
    149162 
    150163   CONTAINS ! Fonctions disponibles pour les utilisateurs. 
     164 
     165   SUBROUTINE  init_ioserver(comm_client) 
     166      INTEGER, INTENT(INOUT) :: comm_client 
     167      CALL xios_init_ioserver(comm_client) 
     168   END SUBROUTINE init_ioserver 
    151169 
    152170   SUBROUTINE handle_create(ret, dtype, idt) 
     
    165183   SUBROUTINE update_calendar(step) 
    166184      INTEGER, INTENT(IN):: step 
    167       IF (step < 1) THEN 
    168          PRINT *, "L'argument 'step' ne peut être négatif ou nul" 
    169          STOP 
    170       END IF 
    171185      CALL xios_update_calendar(step) 
    172186   END SUBROUTINE update_calendar 
     
    255269   SUBROUTINE dtreatment_end(context_hdl) 
    256270      TYPE(XHandle), INTENT(IN), VALUE :: context_hdl 
    257       CALL context_set_current(context_hdl) 
     271      !CALL context_set_current(context_hdl) 
    258272      CALL xios_dtreatment_end() 
    259273   END SUBROUTINE dtreatment_end 
    260274 
    261    SUBROUTINE write_data (fieldid,                         & 
    262                           data1d_k8, data2d_k8, data3d_k8) 
     275   SUBROUTINE write_data (fieldid, data1d_k4, data2d_k4, data3d_k4, data1d_k8, data2d_k8, data3d_k8) 
    263276      CHARACTER(len = *), INTENT(IN)                     :: fieldid 
    264277      REAL(kind = 8), DIMENSION(*), OPTIONAL, INTENT(IN) :: data1d_k8(:), data2d_k8(:,:), data3d_k8(:,:,:) 
     278      REAL(kind = 4), DIMENSION(*), OPTIONAL, INTENT(IN) :: data1d_k4(:), data2d_k4(:,:), data3d_k4(:,:,:) 
     279       
    265280      IF((.NOT. PRESENT(data1d_k8)) .AND. & 
    266281         (.NOT. PRESENT(data2d_k8)) .AND. & 
     
    269284         STOP 
    270285      END IF 
     286       
    271287      IF (PRESENT (data1d_k8)) THEN 
    272          CALL xios_write_data(fieldid, len(fieldid), data1d_k8, & 
    273                               size(data1d_k8, 1), -1, -1) 
     288         CALL xios_write_data(fieldid, len(fieldid), data1d_k8, size(data1d_k8, 1), -1, -1) 
    274289      ELSE IF (PRESENT (data2d_k8)) THEN 
    275          CALL xios_write_data(fieldid, len(fieldid), data2d_k8, & 
    276                               size(data2d_k8, 1), size(data2d_k8, 2), -1) 
     290         CALL xios_write_data(fieldid, len(fieldid), data2d_k8, size(data2d_k8, 1), size(data2d_k8, 2), -1) 
    277291      ELSE IF (PRESENT (data3d_k8)) THEN 
    278          CALL xios_write_data(fieldid, len(fieldid), data3d_k8, & 
    279                               size(data3d_k8, 1), size(data3d_k8, 2), size(data3d_k8, 3)) 
    280       END IF 
     292         CALL xios_write_data(fieldid, len(fieldid), data3d_k8, size(data3d_k8, 1), size(data3d_k8, 2), size(data3d_k8, 3)) 
     293      END IF 
     294       
     295      IF (PRESENT (data1d_k4)) THEN 
     296         CALL xios_write_data_f(fieldid, len(fieldid), data1d_k4, size(data1d_k4, 1), -1, -1) 
     297      ELSE IF (PRESENT (data2d_k4)) THEN 
     298         CALL xios_write_data_f(fieldid, len(fieldid), data2d_k4, size(data2d_k4, 1), size(data2d_k4, 2), -1) 
     299      ELSE IF (PRESENT (data3d_k4)) THEN 
     300         CALL xios_write_data_f(fieldid, len(fieldid), data3d_k4, size(data3d_k4, 1), size(data3d_k4, 2), size(data3d_k4, 3)) 
     301      END IF 
     302       
     303       
    281304   END SUBROUTINE 
    282305 
     
    389412   END SUBROUTINE set_file_attributes 
    390413 
    391 END MODULE IXMLIOSERVER 
     414END MODULE XIOS 
  • XMLIO_V2/dev/dev_rv/src/xmlio/functor.cpp

    r205 r265  
    88 
    99      CFunctor::CFunctor(const StdString & id, ARRAY(double, 1) doutput) 
    10          : SuperClass(id), doutput(doutput) 
     10         : SuperClass(id), doutput(doutput), nbcall(0) 
    1111      { /* Ne rien faire de plus */  } 
    1212 
     
    3939      ARRAY(double, 1) CFunctor::operator ()(const ARRAY(double, 1) dinput) 
    4040      { 
     41         this->nbcall++; 
    4142         if (dinput->size() != this->doutput->size()) 
    4243            ERROR("CFunctor::operator ()(dinput)", 
     
    4849      } 
    4950 
     51      void CFunctor::final(void)  
     52      { 
     53         this->nbcall = 0; 
     54      }  
     55 
    5056      //--------------------------------------------------------------- 
    5157 
  • XMLIO_V2/dev/dev_rv/src/xmlio/functor.hpp

    r205 r265  
    2828            virtual ~CFunctor(void); 
    2929 
     30            //Traitement /// 
     31            virtual void final(void); 
     32 
    3033         protected : 
    3134 
     
    4851            DoubleArray doutput; 
    4952             
     53         protected : 
     54            /// Propriétés protégées ///    
     55            int nbcall;             
    5056      }; // class CFunctor 
    5157   } // namespace func 
  • XMLIO_V2/dev/dev_rv/src/xmlio/functor/average.cpp

    r205 r265  
    1616      //--------------------------------------------------------------- 
    1717 
    18       void CAverage::apply(const DoubleArray         UNUSED(dinput), 
    19                                  DoubleArray         UNUSED(doutput)) 
     18      void CAverage::apply(const DoubleArray _dinput, 
     19                                 DoubleArray _doutput) 
    2020      { 
    21          ERROR("CAverage::apply(...)", << "Not implemented yet !"); 
     21         const double * it1  = _dinput->data(), 
     22                      * end1 = _dinput->data() + _dinput->num_elements();  
     23               double * it   = _doutput->data(); 
     24         if (this->nbcall == 1) 
     25              for (; it1 != end1; it1++, it++) *it  = *it1; 
     26         else for (; it1 != end1; it1++, it++) *it += *it1;                
    2227      } 
    23  
    24       //--------------------------------------------------------------- 
    25  
     28       
     29      void CAverage::final(void) 
     30      { 
     31          double * it1  = this->getDataOutput()->data(), 
     32                 * end1 = this->getDataOutput()->data() + this->getDataOutput()->num_elements(); 
     33          for (; it1 != end1; it1++) *it1 /= this->nbcall; 
     34          this->nbcall = 0;                                                    
     35      } 
    2636   } // namespace func 
    2737} // namespace xmlioserver 
  • XMLIO_V2/dev/dev_rv/src/xmlio/functor/average.hpp

    r205 r265  
    2727            /// Traitement /// 
    2828            virtual void apply(const DoubleArray dinput, DoubleArray doutput); 
    29  
     29            virtual void final(void) ; 
     30             
    3031            /// Destructeur /// 
    3132            virtual ~CAverage(void); 
  • XMLIO_V2/dev/dev_rv/src/xmlio/functor/functor_type.hpp

    r152 r265  
    55#include "instant.hpp" 
    66#include "once.hpp" 
     7#include "maximum.hpp" 
     8#include "minimum.hpp" 
    79 
    810#endif //__XMLIO_functor_type__ 
  • XMLIO_V2/dev/dev_rv/src/xmlio/functor/instant.cpp

    r205 r265  
    1616      //--------------------------------------------------------------- 
    1717 
    18       void CInstant::apply(const DoubleArray         UNUSED(dinput), 
    19                                  DoubleArray         UNUSED(doutput)) 
     18      void CInstant::apply(const DoubleArray _dinput, 
     19                                 DoubleArray _doutput) 
    2020      { 
    21          ERROR("CInstant::apply(...)", << "Not implemented yet !"); 
     21         const double * it1  = _dinput->data(), 
     22                      * end1 = _dinput->data() + _dinput->num_elements(); 
     23         double * it   = _doutput->data(); 
     24         for (; it1 != end1; it1++, it++) *it  = *it1; 
    2225      } 
    2326 
  • XMLIO_V2/dev/dev_rv/src/xmlio/functor/once.cpp

    r205 r265  
    1616      //--------------------------------------------------------------- 
    1717 
    18       void COnce::apply(const DoubleArray         UNUSED(dinput), 
    19                               DoubleArray         UNUSED(doutput)) 
     18      void COnce::apply(const DoubleArray _dinput, 
     19                              DoubleArray _doutput) 
    2020      { 
    21          ERROR("COnce::apply(...)", << "Not implemented yet !"); 
     21         const double * it1  = _dinput->data(), 
     22                      * end1 = _dinput->data() + _dinput->num_elements(); 
     23               double * it   = _doutput->data(); 
     24        for (; it1 != end1; it1++, it++) *it  = *it1; 
    2225      } 
    2326 
  • XMLIO_V2/dev/dev_rv/src/xmlio/iface/interface.cpp.in

    r237 r265  
    9797void xios_handle_create (XPtr * const _ret, XDType _dtype, const XString _id, XSize _id_len) 
    9898{ 
    99    MAKE_STRING(__id, _id, _id_len); 
    100    switch(_dtype) 
    101    { 
    102       case (ECONTEXT): 
    103          // Si le context n'existe pas, on retourne un handle vide/nul. 
    104          *_ret = (!CObjectFactory::HasObject<CContext>(__id)) 
    105                ? 0 : CObjectFactory::GetObject<CContext>(__id).get(); 
    106          return ; 
    107       CASE_ELEM(AXIS   , Axis) 
    108       CASE_ELEM(DOMAIN , Domain) 
    109       CASE_ELEM(FIELD  , Field) 
    110       CASE_ELEM(FILE   , File) 
    111       CASE_ELEM(GRID   , Grid) 
    112       default : 
    113          *_ret = 0; 
    114          return; 
     99   try 
     100   { 
     101      MAKE_STRING(__id, _id, _id_len); 
     102      switch(_dtype) 
     103      { 
     104         case (ECONTEXT): 
     105        { 
     106             *_ret = 0; 
     107            // Si le context n'existe pas, on retourne un handle vide/nul. 
     108            //*_ret = (!CObjectFactory::HasObject<CContext>(__id)) 
     109            //      ? 0 : CObjectFactory::GetObject<CContext>(__id).get(); 
     110            std::vector<boost::shared_ptr<CContext> > def_vector =  
     111                CContext::GetContextGroup()->getChildList(); 
     112           for (StdSize i = 0; i < def_vector.size(); i++) 
     113           { 
     114              //std::cout << "_ " << def_vector[i]->getId() << std::endl;   
     115              if (def_vector[i]->getId().compare(__id) == 0) 
     116                 *_ret = def_vector[i].get(); 
     117           } 
     118           //std::cout << __id << "=" << *_ret << std::endl;     
     119            return ; 
     120         } 
     121         CASE_ELEM(AXIS   , Axis) 
     122         CASE_ELEM(DOMAIN , Domain) 
     123         CASE_ELEM(FIELD  , Field) 
     124         CASE_ELEM(FILE   , File) 
     125         CASE_ELEM(GRID   , Grid) 
     126         default : 
     127            *_ret = 0; 
     128            return; 
     129      } 
     130   } 
     131   catch (CException & exc) 
     132   { 
     133      std::cerr << exc.getMessage() << std::endl; 
     134      exit (EXIT_FAILURE); 
    115135   } 
    116136} 
     
    127147      CTreeManager::ParseFile(__filename); 
    128148      //~ StdOStringStream oss; 
    129       //~ oss << StdString("data/def/def_client_pre.") 
     149      //~ oss << StdString("def_client_pre.") 
    130150      //~     << CMPIManager::GetCommRank(CMPIManager::GetCommWorld()); 
    131151      //~ CTreeManager::PrintTreeToFile(oss.str()); 
     
    147167      CTreeManager::ParseString(__xmlcontent); 
    148168      //~ StdOStringStream oss; 
    149       //~ oss << StdString("data/def/def_client_pre.") 
     169      //~ oss << StdString("def_client_pre.") 
    150170      //~     << CMPIManager::GetCommRank(CMPIManager::GetCommWorld()); 
    151171      //~ CTreeManager::PrintTreeToFile(oss.str()); 
     
    162182void xios_context_set_current (XPtr const _ctx, bool _wswap) 
    163183{ 
    164    boost::shared_ptr<CContext> context = CObjectFactory::GetObject<CContext> ((CContext*)_ctx); 
    165    CTreeManager::SetCurrentContextId(context->getId()); 
     184   try 
     185   { 
     186      //boost::shared_ptr<CContext> context = CObjectFactory::GetObject<CContext> ((CContext*)_ctx); 
     187       CTreeManager::SetCurrentContextId(((CContext*)_ctx)->getId()); 
     188   } 
     189   catch (CException & exc) 
     190   { 
     191      std::cerr << exc.getMessage() << std::endl; 
     192      exit (EXIT_FAILURE); 
     193   } 
    166194} 
    167195 
     
    284312{ 
    285313   MAKE_STRING(__filename, _filename, _filename_len); 
    286    if (_filename_len != -1) 
    287       CTreeManager::PrintTreeToFile(__filename); 
    288    else 
    289       CTreeManager::PrintTreeToStream(std::clog); 
    290 } 
     314   try 
     315   { 
     316      if (_filename_len != -1) 
     317         CTreeManager::PrintTreeToFile(__filename); 
     318      else 
     319         CTreeManager::PrintTreeToStream(std::clog); 
     320   } 
     321   catch (CException & exc) 
     322   { 
     323      std::cerr << exc.getMessage() << std::endl; 
     324      exit (EXIT_FAILURE); 
     325   } 
     326} 
     327 
     328//------------------------------------------------------------------- 
     329 
     330void xios_init_ioserver(MPIComm * comm_client) 
     331{ 
     332   try 
     333   { 
     334      MPIComm comm_client_server, comm_server; 
     335      CMPIManager::Initialise(NULL, NULL); 
     336      CMPIManager::DispatchClient(false, *comm_client, comm_client_server, comm_server); 
     337   } 
     338   catch (CException & exc) 
     339   { 
     340      std::cerr << exc.getMessage() << std::endl; 
     341      exit (EXIT_FAILURE); 
     342   } 
     343} 
     344 
    291345 
    292346//------------------------------------------------------------------- 
     
    301355             CObjectFactory::GetObject<CContext>(__context); 
    302356      StdOStringStream oss; 
    303       //~ oss << StdString("data/def/def_client_next.") 
    304       //~     << CMPIManager::GetCommRank(CMPIManager::GetCommWorld()); 
    305       //~ CTreeManager::PrintTreeToFile(oss.str()); 
    306       //~ oss.str(""); 
     357      oss << StdString("def_client_next.") 
     358          << CMPIManager::GetCommRank(CMPIManager::GetCommWorld()); 
     359      CTreeManager::PrintTreeToFile(oss.str()); 
     360      oss.str(""); 
    307361 
    308362      boost::shared_ptr<CDataTreatment> dt(new CDataTreatment (context)); 
    309363      context->setDataTreatment(dt); 
    310364 
    311       oss << StdString("data/def/def_client_end.") 
     365      oss << StdString("def_client_end.") 
    312366          << CMPIManager::GetCommRank(CMPIManager::GetCommWorld()); 
    313367      CTreeManager::PrintTreeToFile(oss.str()); 
     
    350404void xios_dtreatment_end(void) 
    351405{ 
    352  
     406   try 
     407   { 
     408           CMPIManager::Finalize(); 
     409   } 
     410   catch (CException & exc) 
     411   { 
     412      std::cerr << exc.getMessage() << std::endl; 
     413      exit (EXIT_FAILURE); 
     414   } 
    353415} 
    354416 
     
    358420                     XSize data_Xsize, XSize data_Ysize, XSize data_Zsize) 
    359421{ 
    360  
    361 } 
     422   MAKE_STRING(__field_id, _field_id, _field_id_len); 
     423   try 
     424   { 
     425      boost::shared_ptr<CContext> context = 
     426      CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     427      boost::shared_ptr<data::CDataTreatment> dtreat = context->getDataTreatment(); 
     428      if (data_Ysize==-1 && data_Zsize==-1) 
     429      { 
     430         ARRAY(double, 1) data(new CArray<double, 1>(boost::extents [data_Xsize])); 
     431         std::copy(data_k8, data_k8+data->num_elements(), data->data()); 
     432         dtreat->write_data(__field_id, data); 
     433         return; 
     434      } 
     435      else if (data_Zsize==-1) 
     436      { 
     437         ARRAY(double, 2) data(new CArray<double, 2>(boost::extents [data_Xsize][data_Ysize])); 
     438         std::copy(data_k8, data_k8+data->num_elements(), data->data()); 
     439         dtreat->write_data(__field_id, data); 
     440         return; 
     441      } 
     442      else 
     443      { 
     444         ARRAY(double, 3) data(new CArray<double, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize])); 
     445         std::copy(data_k8, data_k8+data->num_elements(), data->data()); 
     446         dtreat->write_data(__field_id, data); 
     447         return; 
     448      } 
     449   } 
     450   catch (CException & exc) 
     451   { 
     452      std::cerr << exc.getMessage() << std::endl; 
     453      exit (EXIT_FAILURE); 
     454   } 
     455} 
     456 
     457//------------------------------------------------------------------- 
     458 
     459void xios_write_data_f(const XString _field_id, XSize _field_id_len, float * data_k4, 
     460                       XSize data_Xsize, XSize data_Ysize, XSize data_Zsize) 
     461{ 
     462   MAKE_STRING(__field_id, _field_id, _field_id_len); 
     463   try 
     464   { 
     465      boost::shared_ptr<CContext> context = 
     466      CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     467      boost::shared_ptr<data::CDataTreatment> dtreat = context->getDataTreatment(); 
     468      if (data_Ysize==-1 && data_Zsize==-1) 
     469      { 
     470         ARRAY(float, 1) data(new CArray<float, 1>(boost::extents [data_Xsize])); 
     471         std::copy(data_k4, &(data_k4[data->num_elements()]), data->data()); 
     472         dtreat->write_data(__field_id, data); 
     473         return; 
     474      } 
     475      else if (data_Zsize==-1) 
     476      { 
     477         ARRAY(float, 2) data(new CArray<float, 2>(boost::extents [data_Xsize][data_Ysize])); 
     478         std::copy(data_k4, &(data_k4[data->num_elements()]), data->data()); 
     479         dtreat->write_data(__field_id, data); 
     480         return; 
     481      } 
     482      else 
     483      { 
     484         ARRAY(float, 3) data(new CArray<float, 3>(boost::extents [data_Xsize][data_Ysize][data_Zsize])); 
     485         std::copy(data_k4, &(data_k4[data->num_elements()]), data->data()); 
     486         dtreat->write_data(__field_id, data); 
     487         return; 
     488      } 
     489   } 
     490   catch (CException & exc) 
     491   { 
     492      std::cerr << exc.getMessage() << std::endl; 
     493      exit (EXIT_FAILURE); 
     494   } 
     495} 
     496 
    362497 
    363498//------------------------------------------------------------------- 
     
    367502   try 
    368503   { 
     504      boost::shared_ptr<CContext> context = 
     505      CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     506      boost::shared_ptr<data::CDataTreatment> dtreat = context->getDataTreatment(); 
     507      dtreat->update_calendar(step); 
    369508   } 
    370509   catch (CException & exc) 
     
    382521   try 
    383522   { 
     523      date::CDuration dur = {ts_year, ts_month, ts_day, ts_hour, ts_minute, ts_second}; 
     524      boost::shared_ptr<CContext> context = 
     525      CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     526      boost::shared_ptr<data::CDataTreatment> dtreat = context->getDataTreatment(); 
     527      dtreat->set_timestep(dur); 
    384528   } 
    385529   catch (CException & exc) 
  • XMLIO_V2/dev/dev_rv/src/xmlio/manager/tree_manager.cpp

    r180 r265  
    3030   CObjectFactory::CreateObject<C##Name_##Definition>(C##Name_##Definition::GetDefName()); 
    3131#define DECLARE_NODE_PAR(Name_, name_) 
    32 #include "../config/node_type.conf" 
     32#include "node_type.conf" 
    3333 
    3434         return (context); 
  • XMLIO_V2/dev/dev_rv/src/xmlio/manager/xios_manager.cpp

    r202 r265  
    55#include "nc4_data_output.hpp" 
    66#include "attribute_template_impl.hpp" 
     7#include "group_template_impl.hpp" 
    78 
    89namespace xmlioserver 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/axis.cpp

    r237 r265  
    5555      if (size != true_size) 
    5656         ERROR("CAxis::checkAttributes(void)", 
    57                << "Le tableau \'zvalue\' a une taille différente" 
    58                << " de celle indiquée dans l'attribut \'size\'") 
     57               << "Le tableau \'zvalue\' a une taille différente de celle indiquée dans l'attribut \'size\'") 
    5958 
    6059      this->isChecked = true; 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.cpp

    r196 r265  
    381381            data_n_index.setValue(dni); 
    382382             
    383             for(int count = 0, i = 0; i  < data_ni.getValue(); i++) 
     383            //for(int count = 0, i = 0; i  < data_ni.getValue(); i++) 
     384            //for(int j = 0; j < data_nj.getValue(); j++, count++) 
     385             
     386            for(int count = 0, j = 0; j  < data_nj.getValue(); j++) 
    384387            { 
    385                for(int j = 0; j < data_nj.getValue(); j++, count++) 
     388               for(int i = 0; i < data_ni.getValue(); i++, count++) 
    386389               { 
    387390                  (*__arri)[count] = i+1 ; 
     
    399402   //---------------------------------------------------------------- 
    400403    
    401    void CDomain::completeLonLat(void) 
     404   void CDomain::completeLonLatClient(void) 
     405   { 
     406      ARRAY_CREATE(lonvalue_temp, double, 1, [0]); 
     407      ARRAY_CREATE(latvalue_temp, double, 1, [0]); 
     408       
     409      const int zoom_ibegin_client  = zoom_ibegin_loc.getValue(), 
     410                zoom_jbegin_client  = zoom_jbegin_loc.getValue(), 
     411                zoom_ni_client      = zoom_ni_loc.getValue(), 
     412                zoom_nj_client      = zoom_nj_loc.getValue(); 
     413                 
     414      ARRAY(double, 1) lonvalue_ = this->lonvalue.getValue(), 
     415                       latvalue_ = this->latvalue.getValue(); 
     416                 
     417      if (this->data_dim.getValue() == 2) 
     418      { 
     419         StdSize dm = zoom_ni_client * zoom_nj_client; 
     420 
     421         lonvalue_temp->resize(boost::extents[dm]); 
     422         latvalue_temp->resize(boost::extents[dm]); 
     423          
     424         for (int i = 0; i < zoom_ni_client; i++) 
     425         { 
     426            for (int j = 0; j < zoom_nj_client; j++) 
     427            { 
     428               (*lonvalue_temp)[i + j * zoom_ni_client] = (*lonvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()];               
     429               (*latvalue_temp)[i + j * zoom_ni_client] = (*latvalue_)[(i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue()]; 
     430            } 
     431         } 
     432         this->lonvalue.setValue(lonvalue_temp); 
     433         this->latvalue.setValue(latvalue_temp); 
     434      } 
     435      else 
     436      { 
     437         lonvalue_temp->resize(boost::extents[zoom_ni_client]); 
     438         latvalue_temp->resize(boost::extents[zoom_nj_client]); 
     439          
     440         for (int i = zoom_ibegin_client - 1; i < (zoom_ni_client - zoom_ibegin_client + 1); i++) 
     441         { 
     442            (*lonvalue_temp)[i] = (*lonvalue_)[i];  
     443         } 
     444          
     445         for (int j = zoom_ibegin_client - 1; j < (zoom_nj_client - zoom_jbegin_client + 1); j++) 
     446         { 
     447            (*latvalue_temp)[j] = (*latvalue_)[j]; 
     448         } 
     449          
     450         this->lonvalue.setValue(lonvalue_temp); 
     451         this->latvalue.setValue(latvalue_temp); 
     452      }   
     453   } 
     454  
     455   //---------------------------------------------------------------- 
     456       
     457   void CDomain::completeLonLatServer(void) 
    402458   { 
    403459      ARRAY_CREATE(lonvalue_temp, double, 1, [0]); 
     
    441497               for (int j = jbegin_loc - jbegin_serv; j < (jend_loc - jbegin_serv + 1); j++) 
    442498               { 
    443                   (*lonvalue_)[i + j * this->ni.getValue()] = (*lonvalue_loc)[l];               
    444                   (*latvalue_)[i + j * this->ni.getValue()] = (*latvalue_loc)[l++]; 
     499                  (*lonvalue_)[i + j * this->ni.getValue()] = (*lonvalue_loc)[l];      // erreur         
     500                  (*latvalue_)[i + j * this->ni.getValue()] = (*latvalue_loc)[l++];    // erreur 
    445501               } 
    446502            } 
     
    572628         this->checkDomainData(); 
    573629         this->checkCompression(); 
     630          
     631         this->ibegin_sub.push_back(this->ibegin.getValue()); 
     632         this->jbegin_sub.push_back(this->jbegin.getValue()); 
     633         this->iend_sub.push_back(this->iend.getValue()); 
     634         this->jend_sub.push_back(this->jend.getValue());  
     635       
     636         this->latvalue_sub.push_back(this->latvalue.getValue()); 
     637         this->lonvalue_sub.push_back(this->lonvalue.getValue());   
     638          
     639         if (!this->isEmpty()) 
     640         { 
     641            this->completeLonLatClient(); 
     642         } 
    574643      } 
    575644      else 
    576645      { // CÃŽté serveur uniquement 
    577646         if (!this->isEmpty()) 
    578             this->completeLonLat(); 
     647            this->completeLonLatServer(); 
    579648      } 
    580649      this->completeMask(); 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.hpp

    r184 r265  
    9090         /// Mutateur /// 
    9191         void addRelFile(const StdString & filename); 
    92          void completeLonLat(void); 
     92         void completeLonLatServer(void); 
     93         void completeLonLatClient(void); 
    9394          
    9495         /// Destructeur /// 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/field.cpp

    r206 r265  
    1919      , grid(), file() 
    2020      , freq_operation(), freq_write() 
     21      , nstep(0) 
    2122      , last_Write(), last_operation() 
    2223      , foperation() 
    23       , data() 
     24      , data(new CArray<double, 1>(boost::extents[0])) 
    2425   { /* Ne rien faire de plus */ } 
    2526 
     
    2930      , grid(), file() 
    3031      , freq_operation(), freq_write() 
     32      , nstep(0) 
    3133      , last_Write(), last_operation() 
    3234      , foperation() 
    33       , data() 
     35      , data(new CArray<double, 1>(boost::extents[0])) 
    3436   { /* Ne rien faire de plus */ } 
    3537 
     
    8890   {  
    8991      return (this->file); 
     92   } 
     93    
     94   StdSize CField::getNStep(void) const 
     95   { 
     96      return (this->nstep); 
     97   } 
     98    
     99   void CField::incrementNStep(void) 
     100   { 
     101      this->nstep++; 
    90102   } 
    91103 
     
    236248      else 
    237249      { 
     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                   
    238260         this->freq_operation = CDuration::FromString(freq_op.getValue()); 
    239261         this->freq_write     = CDuration::FromString(this->file->output_freq.getValue()); 
     
    242264         this->last_operation = boost::shared_ptr<xmlioserver::date::CDate> 
    243265                        (new date::CDate(_context->getCalendar()->getInitDate())); 
     266         const CDuration toffset = this->freq_operation - freq_offset_ - _context->getCalendar()->getTimeStep();  
     267         *this->last_operation  = *this->last_operation - toffset;   
    244268          
    245269#define DECLARE_FUNCTOR(MType, mtype)              \ 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/field.hpp

    r229 r265  
    6464      public : 
    6565 
     66         StdSize getNStep(void) const; 
     67 
    6668         const date::CDuration & getFreqOperation(void) const; 
    6769         const date::CDuration & getFreqWrite(void) const; 
     
    7880         /// Mutateur /// 
    7981         void setRelFile(const boost::shared_ptr<CFile> _file); 
     82         void incrementNStep(void); 
    8083 
    8184         template <StdSize N> 
    8285            inline bool updateData 
    83                (const date::CDate & currDate, const ARRAY(double, N) data); 
     86               (const date::CDate & currDate, const date::CDuration & timestep, const ARRAY(double, N) data); 
    8487 
    8588         bool updateDataServer 
     
    118121         date::CDuration freq_operation, freq_write; 
    119122 
     123         StdSize nstep; 
    120124         boost::shared_ptr<date::CDate>    last_Write, last_operation; 
    121125         boost::shared_ptr<func::CFunctor> foperation; 
     
    146150 
    147151   template <StdSize N> 
    148       bool CField::updateData(const date::CDate & currDate, const ARRAY(double, N) data) 
    149    { 
    150       if ((*last_operation + freq_operation) >= currDate) 
     152      bool CField::updateData(const date::CDate & currDate, const date::CDuration & timestep, const ARRAY(double, N) _data) 
     153   {         
     154      const date::CDate opeDate      = *last_operation + freq_operation; 
     155      const date::CDate writeDate    = *last_Write     + freq_write;        
     156 
     157//      std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl; 
     158//      std::cout << "Champ : "     << this->getBaseFieldId() << std::endl; 
     159//      std::cout << "CurrDate : "  << currDate  << std::endl; 
     160//      std::cout << "opeDate : "   << opeDate   << " = " << *last_operation << " + " << freq_operation << std::endl; 
     161//      std::cout       << "writeDate : " << writeDate << " = " << *last_Write     << " + " << freq_write     << std::endl; 
     162//      std::cout << "(opeDate <= currDate)   = " << std::boolalpha << (opeDate <= currDate)   << std::endl; 
     163//      std::cout       << "(writeDate <= currDate) = " << std::boolalpha << (writeDate <= currDate) << std::endl;    
     164    
     165       //std::cout << ">> " << currDate <<  " : Envoi de données " << this->getBaseFieldId() << std::endl; 
     166      if (opeDate <= currDate) 
    151167      { 
    152          ARRAY_CREATE(input, double, 1, [0]); 
    153          input->resize(boost::extents[data->size()]); 
    154          this->grid->inputField(data, input); 
     168         //std::cout << "> " << currDate << ": Operation du champs" << this->getBaseFieldId() << std::endl; 
     169          
     170         if (this->data->num_elements() != this->grid->storeIndex[0]->num_elements()) 
     171         { 
     172            this->data->resize(boost::extents[this->grid->storeIndex[0] ->num_elements()]); 
     173         } 
     174             
     175         ARRAY_CREATE(input, double, 1, [this->data->num_elements()]); 
     176         this->grid->inputField(_data, input);           
    155177         (*this->foperation)(input); 
     178          
    156179         *last_operation = currDate; 
     180//         std::cout << "(*last_operation = currDate) : " << *last_operation << " = " << currDate << std::endl;  
    157181      } 
    158182       
    159       if ((*last_Write + freq_write) >= currDate) 
     183      if (writeDate < (currDate + freq_operation)) 
    160184      { 
    161          *last_Write = currDate; 
    162          return (true); 
     185         this->foperation->final(); 
     186         this->incrementNStep(); 
     187         *last_Write = writeDate; 
     188//         std::cout << "(*last_Write = currDate) : " << *last_Write << " = " << currDate       << std::endl; 
     189         return (true);         
    163190      } 
     191//      std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl; 
    164192      return (false); 
    165193   }; 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/file.cpp

    r214 r265  
    106106   { 
    107107      this->setVirtualFieldGroup 
    108          (CObjectFactory::CreateObject<CFieldGroup>(newVFieldGroupId)); 
     108         (CObjectFactory::CreateObject<CFieldGroup>(/*newVFieldGroupId*/)); 
    109109   } 
    110110 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/file.hpp

    r257 r265  
    5353         std::vector<boost::shared_ptr<CField> > 
    5454            getEnabledFields(int default_outputlevel = 5, 
    55                              int default_level       = 1, 
    56                              bool default_enabled    = true); 
     55                             int default_level = 1, 
     56                             bool default_enabled = true); 
    5757 
    5858      public : 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.cpp

    r205 r265  
     1 
    12#include "grid.hpp" 
    23 
     
    100101   //--------------------------------------------------------------- 
    101102 
    102    std::vector<StdSize> CGrid::getShape(void) const 
     103   std::vector<StdSize> CGrid::getLocalShape(void) const 
    103104   { 
    104105      std::vector<StdSize> retvalue; 
    105       retvalue.push_back(this->domain->ni.getValue()); 
    106       retvalue.push_back(this->domain->nj.getValue()); 
     106      retvalue.push_back(domain->zoom_ni_loc.getValue()); 
     107      retvalue.push_back(domain->zoom_nj_loc.getValue()); 
    107108      if (this->withAxis) 
    108109         retvalue.push_back(this->axis->size.getValue()); 
     
    111112   //--------------------------------------------------------------- 
    112113    
    113    StdSize CGrid::getSize(void) const 
     114   StdSize CGrid::getLocalSize(void) const 
    114115   { 
    115116      StdSize retvalue = 1; 
    116       std::vector<StdSize> shape_ = this->getShape(); 
     117      std::vector<StdSize> shape_ = this->getLocalShape(); 
     118      for (StdSize s = 0; s < shape_.size(); s++) 
     119         retvalue *= shape_[s]; 
     120      return (retvalue); 
     121   } 
     122    
     123   //--------------------------------------------------------------- 
     124 
     125   std::vector<StdSize> CGrid::getGlobalShape(void) const 
     126   { 
     127      std::vector<StdSize> retvalue; 
     128      retvalue.push_back(domain->ni.getValue()); 
     129      retvalue.push_back(domain->nj.getValue()); 
     130      if (this->withAxis) 
     131         retvalue.push_back(this->axis->size.getValue()); 
     132      return (retvalue); 
     133   } 
     134   //--------------------------------------------------------------- 
     135    
     136   StdSize CGrid::getGlobalSize(void) const 
     137   { 
     138      StdSize retvalue = 1; 
     139      std::vector<StdSize> shape_ = this->getGlobalShape(); 
    117140      for (StdSize s = 0; s < shape_.size(); s++) 
    118141         retvalue *= shape_[s]; 
     
    129152      if (this->storeIndex.size() == 1) 
    130153      { 
     154          
    131155         this->computeIndex() ; 
    132       } 
    133       else 
    134       { 
    135          this->computeIndexServer(); 
    136       } 
     156         ARRAY_CREATE(storeIndex_ , int, 1, [0]); 
     157         ARRAY_CREATE(out_l_index_, int, 1, [0]); 
     158         ARRAY_CREATE(out_i_index_, int, 1, [0]); 
     159         ARRAY_CREATE(out_j_index_, int, 1, [0]); 
     160                  
     161         this->storeIndex .push_front(storeIndex_); 
     162         this->out_i_index.push_front(out_i_index_); 
     163         this->out_j_index.push_front(out_j_index_); 
     164         this->out_l_index.push_front(out_l_index_); 
     165      } 
     166      this->computeIndexServer(); 
    137167      this->isChecked = true; 
    138168   } 
     
    177207 
    178208   void CGrid::computeIndex(void) 
    179    {   
     209   {     
     210    
    180211      const int ni   = domain->ni.getValue() , 
    181212                nj   = domain->nj.getValue() , 
     
    200231 
    201232      ARRAY(bool, 2) mask = domain->mask.getValue() ; 
     233      ARRAY(int, 2) local_mask =  this->domain->getLocalMask(); 
    202234 
    203235      int indexCount = 0; 
     
    210242                temp_j = (data_dim == 1) ? -1 
    211243                       : (*data_j_index)[n] + data_jbegin; 
    212             i = (data_dim == 1) ? (temp_i - 2) % ni 
     244            i = (data_dim == 1) ? (temp_i - 1) % ni 
    213245                                : (temp_i - 1) ; 
    214             j = (data_dim == 1) ? (temp_i - 2) / ni 
     246            j = (data_dim == 1) ? (temp_i - 1) / ni 
    215247                                : (temp_j - 1) ; 
    216248 
     
    226258      ARRAY_ASSIGN(this->out_i_index[0], int, 1, [indexCount]); 
    227259      ARRAY_ASSIGN(this->out_j_index[0], int, 1, [indexCount]); 
    228  
     260       
     261      // for(int count = 0, indexCount = 0,  l = 0; l < size; l++) 
     262      // for(int n = 0, i = 0, j = 0; n < data_n_index; n++, count++) 
     263 
     264      //for(int n = 0, i = 0, j = 0, count = 0, indexCount = 0; n < data_n_index;  n++) 
     265      //for(int l = 0; l < size; l++, count++) 
     266       
    229267      for(int count = 0, indexCount = 0,  l = 0; l < size; l++) 
    230268      { 
     
    234272                temp_j = (data_dim == 1) ? -1 
    235273                       : (*data_j_index)[n] + data_jbegin; 
    236             i = (data_dim == 1) ? (temp_i - 2) % ni 
     274            i = (data_dim == 1) ? (temp_i - 1) % ni 
    237275                                : (temp_i - 1) ; 
    238             j = (data_dim == 1) ? (temp_i - 2) / ni 
     276            j = (data_dim == 1) ? (temp_i - 1) / ni 
    239277                                : (temp_j - 1) ; 
    240278 
     
    250288         } 
    251289      } 
     290 
     291 
     292//      if (this->storeIndex[0]->size() != 0) 
     293//         for (StdSize u = 0; u < this->storeIndex[0]->size(); u++) 
     294//            (*local_mask)[(*out_i_index[0])[u]][(*out_j_index[0])[u]] = 1; 
     295                                  
     296//      std::cout << "indexCount" << indexCount << std::endl;  
     297//      std::cout << this->getId() << " : "  << (*this->storeIndex[0]).num_elements() << std::endl; 
     298//      StdOFStream ofs2(("log_client_"+this->getId()).c_str()); 
     299//      for (StdSize h = 0; h < storeIndex[0]->size(); h++) 
     300//      { 
     301//        ofs2 << "(" << (*storeIndex[0])[h]  << ";" 
     302//             << (*out_i_index[0])[h] << "," 
     303//             << (*out_j_index[0])[h] << "," 
     304//             << (*out_l_index[0])[h] << ")" << std::endl; 
     305//      } 
     306//      ofs2.close();    
    252307   } 
    253308 
     
    282337         (const ARRAY(double, 1) stored,  ARRAY(double, 3) field) const 
    283338   { 
     339      //std::cout <<"champ : " ; 
    284340      for(StdSize n = 0; n < storeIndex[0]->num_elements(); n++) 
     341      { 
    285342         (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]][(*out_l_index[0])[n]] = (*stored)[n] ; 
     343         /*if (storeIndex[0]->num_elements() == 31) 
     344         { 
     345            std::cout << "( " << (*field)[(*out_i_index[0])[n]][(*out_j_index[0])[n]][(*out_l_index[0])[n]] << ", " 
     346                      << (*out_i_index[0])[n] << ", " 
     347                      << (*out_j_index[0])[n] << ", " 
     348                      << (*out_l_index[0])[n] << ")"; 
     349         }*/ 
     350      } 
     351      //std::cout << std::endl; 
     352 
    286353   } 
    287354 
     
    311378      (const double * const data, ARRAY(double, 1) stored) const 
    312379   { 
    313       const StdSize size = storeIndex[0]->num_elements() ; 
     380      const StdSize size = (this->storeIndex[0])->num_elements() ; 
     381//    std::cout << this->getId() << "> size : " << size << std::endl; 
    314382      stored->resize(boost::extents[size]) ; 
    315383      for(StdSize i = 0; i < size; i++) 
     
    365433   void CGrid::computeIndexServer(void) 
    366434   { 
    367       ARRAY(int, 1) storeIndex_srv   =  this->storeIndex[0]; 
    368       ARRAY(int, 1) out_i_index_srv  =  this->out_i_index[0]; 
    369       ARRAY(int, 1) out_j_index_srv  =  this->out_j_index[0]; 
    370       ARRAY(int, 1) out_l_index_srv  =  this->out_l_index[0]; 
    371  
    372435      ARRAY(int, 2) local_mask =  this->domain->getLocalMask(); 
    373436       
     
    375438      const std::vector<int> & jbegin = this->domain->getJBeginSub(); 
    376439       
    377       const int ibegin_srv = this->domain->ibegin.getValue(); 
    378       const int jbegin_srv = this->domain->jbegin.getValue(); 
    379       const int zoom_ni_srv   = this->domain->zoom_ni_loc.getValue(); 
    380       const int zoom_nj_srv   = this->domain->zoom_nj_loc.getValue(); 
     440      const int ibegin_srv  = this->domain->ibegin.getValue(); 
     441      const int jbegin_srv  = this->domain->jbegin.getValue(); 
     442      const int zoom_ni_srv = this->domain->zoom_ni_loc.getValue(); 
     443      const int zoom_nj_srv = this->domain->zoom_nj_loc.getValue(); 
    381444       
    382445      const int ibegin_zoom_srv = this->domain->zoom_ibegin_loc.getValue(); 
     
    387450         dn += this->out_i_index[j]->size(); 
    388451          
    389       ARRAY_ASSIGN(storeIndex_srv , int, 1, [dn]); 
    390       ARRAY_ASSIGN(out_i_index_srv, int, 1, [dn]); 
    391       ARRAY_ASSIGN(out_j_index_srv, int, 1, [dn]); 
    392       ARRAY_ASSIGN(out_l_index_srv, int, 1, [dn]); 
     452      ARRAY_CREATE(storeIndex_srv , int, 1, [dn]); 
     453      ARRAY_CREATE(out_i_index_srv, int, 1, [dn]); 
     454      ARRAY_CREATE(out_j_index_srv, int, 1, [dn]); 
     455      ARRAY_CREATE(out_l_index_srv, int, 1, [dn]); 
    393456       
    394457      for (StdSize i = 0, dn = 0; i < ibegin.size(); i++) 
     
    404467         for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++) 
    405468         { 
    406             (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]  + dn; // Faux mais inutile dans tous les cas. 
     469            (*storeIndex_srv)[n]  = (*storeIndex_cl)[m]; // Faux mais inutile dans le cas serveur. 
    407470            (*out_i_index_srv)[n] = (*out_i_index_cl)[m]  
    408471                                  + (ibegin_cl - 1) - (ibegin_srv - 1) - (ibegin_zoom_srv - 1); 
     
    438501            (*local_mask)[(*out_i_index_srv)[u]][(*out_j_index_srv)[u]] = 1; 
    439502 
    440       //~ StdOFStream ofs(this->getId().c_str()); 
    441       //~ for (StdSize h = 0; h < storeIndex_srv->size(); h++) 
    442       //~ { 
    443         //~ ofs << "(" << (*storeIndex_srv)[h]  << ";" 
    444             //~ << (*out_i_index_srv)[h] << "," 
    445             //~ << (*out_j_index_srv)[h] << "," 
    446             //~ << (*out_l_index_srv)[h] << ")" << std::endl; 
    447       //~ } 
    448       //~ ofs.close(); 
     503//      StdOFStream ofs(("log_server_"+this->getId()).c_str()); 
     504//      for (StdSize h = 0; h < storeIndex_srv->size(); h++) 
     505//      { 
     506//        ofs << "(" << (*storeIndex_srv)[h]  << ";" 
     507//            << (*out_i_index_srv)[h] << "," 
     508//            << (*out_j_index_srv)[h] << "," 
     509//            << (*out_l_index_srv)[h] << ")" << std::endl; 
     510//      } 
     511//       ofs.close(); 
     512    
     513      this->storeIndex [0] = storeIndex_srv ; 
     514      this->out_i_index[0] = out_i_index_srv; 
     515      this->out_j_index[0] = out_j_index_srv; 
     516      this->out_l_index[0] = out_l_index_srv; 
     517       
    449518      this->storeIndex.resize(1); 
    450519      this->out_i_index.resize(1); 
     
    454523   } 
    455524    
    456    //---------------------------------------------------------------- 
    457525    
    458526   void CGrid::inputFieldServer 
  • XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.hpp

    r205 r265  
    6868 
    6969         StdSize getDimension(void) const; 
    70          StdSize getSize(void) const; 
    71          std::vector<StdSize> getShape(void) const; 
     70          
     71         StdSize getLocalSize(void) const; 
     72         StdSize getGlobalSize(void) const; 
     73         std::vector<StdSize> getLocalShape(void) const; 
     74         std::vector<StdSize> getGlobalShape(void) const; 
    7275 
    7376         /// Entrées-sorties de champs /// 
     
    130133      void CGrid::inputField(const  ARRAY(double, n) field, ARRAY(double, 1) stored) const 
    131134   { 
    132       if (this->getSize() != field->num_elements()) 
     135      if (this->getGlobalSize() != field->num_elements()) 
    133136         ERROR("CGrid::inputField(const  ARRAY(double, n) field, ARRAY(double, 1) stored)", 
    134                 << "[ Taille des données attendue = " << this->getSize()       << ", " 
     137                << "[ Taille des données attendue = " << this->getGlobalSize()       << ", " 
    135138                << "Taille des données reçue = "      << field->num_elements() << " ] " 
    136139                << "Le tableau de données n'a pas la bonne taille !") ; 
    137       this->storeField_arr(field.data(), stored) ; 
     140      this->storeField_arr(field->data(), stored) ; 
    138141   } 
    139142 
  • XMLIO_V2/dev/dev_rv/src/xmlio/object_factory_impl.hpp

    r173 r265  
    5353       
    5454      ERROR("CObjectFactory::GetObject(const U * const object)", 
    55                << "[type = " << U::GetName() << "]" 
     55               << "[type = " << U::GetName() << ", " 
     56               << "adress = " << object << "]" 
    5657               << " object was not found !"); 
    5758      return (boost::shared_ptr<U>()); // jamais atteint 
  • XMLIO_V2/dev/dev_rv/src/xmlio/output/nc4_data_output.cpp

    r205 r265  
     1 
    12#include "nc4_data_output.hpp" 
    23 
     
    137138                  domain->data_jbegin.getValue()*/); 
    138139                   
    139                SuperClassWriter::setDefaultValue(maskid, &dvm); 
     140               //SuperClassWriter::setDefaultValue(maskid, &dvm); 
    140141 
    141142               SuperClassWriter::definition_end(); 
     
    223224                             ? field->name.getValue() : field->getBaseFieldReference()->getId(); 
    224225 
    225          unsigned int ssize = domain->ni.getValue() * domain->nj.getValue(); 
     226         unsigned int ssize = domain->zoom_ni_loc.getValue() * domain->zoom_nj_loc.getValue(); 
    226227         bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize); 
    227228 
     
    380381         if (grid->hasAxis()) // 3D 
    381382         { 
    382             ARRAY(double, 3) field_data3D;             
     383            ARRAY(double, 3) field_data3D (new CArray<double,3>(grid->getLocalShape()/*, boost::c_storage_order()*/));             
    383384            grid->outputField(field_data, field_data3D); 
    384             SuperClassWriter::writeData(field_data3D, fieldid, true, 0); 
     385            SuperClassWriter::writeData(field_data3D, fieldid, true, field->getNStep()-1); 
    385386             
    386387         } 
    387388         else // 2D 
    388389         { 
    389             ARRAY(double, 3) field_data2D; 
     390            ARRAY(double, 2) field_data2D (new CArray<double, 2>(grid->getLocalShape()/*, boost::c_storage_order()*/)); 
    390391            grid->outputField(field_data,  field_data2D); 
    391             SuperClassWriter::writeData(field_data2D, fieldid, true, 0); 
     392            SuperClassWriter::writeData(field_data2D, fieldid, true, field->getNStep()-1); 
    392393         } 
    393394      } 
  • XMLIO_V2/dev/dev_rv/src/xmlio/output/onetcdf4.cpp

    r254 r265  
    142142      } 
    143143       
     144      StdString CONetCDF4::getUnlimitedDimensionName(void) 
     145      { 
     146         char full_name_in[NC_MAX_NAME +1]; 
     147         int grpid = this->getGroup(path); 
     148         int dimid = this->getUnlimitedDimension(); 
     149                               
     150         if (dimid == -1) return (std::string()); 
     151            CheckError(nc_inq_dimname(grpid, dimid, full_name_in)); 
     152                                           
     153         StdString dimname(full_name_in); 
     154         return (dimname); 
     155      } 
     156       
    144157      //--------------------------------------------------------------- 
    145158       
     
    166179         return (retvalue); 
    167180      } 
     181 
     182      std::vector<std::string> CONetCDF4::getDimensionsIdList (const std::string * _varname) 
     183      { 
     184         char full_name_in[NC_MAX_NAME +1]; 
     185         int nbdim = 0, *dimid = NULL; 
     186         int grpid = this->getCurrentGroup(); 
     187         int varid = (_varname != NULL) ? this->getVariable(*_varname) : NC_GLOBAL; 
     188         std::vector<std::string> retvalue; 
     189                                    
     190         if (_varname != NULL) 
     191         { 
     192            CheckError(nc_inq_varndims(grpid, varid, &nbdim)); 
     193            dimid = new int[nbdim](); 
     194            CheckError(nc_inq_vardimid(grpid, varid, dimid)); 
     195         } 
     196         else 
     197         { 
     198            CheckError(nc_inq_dimids(grpid, &nbdim, NULL, 1)); 
     199            dimid = new int[nbdim](); 
     200            CheckError(nc_inq_dimids(grpid, NULL, dimid, 1)); 
     201         } 
     202                                         
     203         for (int i = 0; i < nbdim; i++) 
     204         { 
     205            CheckError(nc_inq_dimname(grpid, dimid[i], full_name_in)); 
     206            std::string dimname(full_name_in); 
     207            retvalue.push_back(dimname); 
     208         } 
     209         delete [] dimid; 
     210                                                                                                                                                       
     211         return (retvalue); 
     212      } 
     213 
    168214 
    169215      //--------------------------------------------------------------- 
     
    271317                                        const std::vector<StdSize> * start, 
    272318                                        const std::vector<StdSize> * count) 
    273       { 
    274          std::vector<StdSize> sizes = this->getDimensions(name);        
    275          std::vector<StdSize>::const_iterator 
     319      {    
     320         std::vector<std::size_t> sizes  = this->getDimensions(name); 
     321         std::vector<std::string> iddims = this->getDimensionsIdList (&name);    
     322         std::vector<std::size_t>::const_iterator 
    276323            it  = sizes.begin(), end = sizes.end(); 
    277324         int i = 0; 
     325       
     326         if (iddims.begin()->compare(this->getUnlimitedDimensionName()) == 0) 
     327         { 
     328            sstart.push_back(record); 
     329            scount.push_back(1);  
     330            if ((start == NULL) && 
     331                (count == NULL)) i++; 
     332            it++; 
     333         } 
    278334 
    279335         for (;it != end; it++) 
    280          { 
    281             StdSize  s = *it; 
     336         {       
    282337            if ((start != NULL) && (count != NULL)) 
    283338            { 
    284                if (s == UNLIMITED_DIM) 
    285                { 
    286                   sstart.push_back(record); 
    287                   scount.push_back(1); 
    288                } 
    289                else 
    290                { 
    291                   sstart.push_back((*start)[i]); 
    292                   scount.push_back((*count)[i]); 
    293                   array_size *= (*count)[i]; 
    294                   i++; 
    295                } 
     339               sstart.push_back((*start)[i]); 
     340               scount.push_back((*count)[i]); 
     341               array_size *= (*count)[i]; 
     342               i++; 
    296343            } 
    297344            else 
    298345            { 
    299                if (s == UNLIMITED_DIM) 
    300                { 
    301                   sstart.push_back(record); 
    302                   scount.push_back(1); 
    303                } 
    304                else 
    305                { 
    306                   sstart.push_back(0); 
    307                   scount.push_back(sizes[i]); 
    308                   array_size *= sizes[i]; 
    309                } 
     346               sstart.push_back(0); 
     347               scount.push_back(sizes[i]); 
     348               array_size *= sizes[i]; 
    310349               i++; 
    311350            } 
    312351         } 
     352          
     353          
     354//         for (StdSize u = 0; u < sstart.size(); u++) 
     355//            std::cout << "(" << sstart[u] << "," << scount[u]  << ")" ; 
     356//         std::cout << std::endl; 
    313357      } 
    314358 
  • XMLIO_V2/dev/dev_rv/src/xmlio/output/onetcdf4.hpp

    r264 r265  
    1212#define MPI_INCLUDED 
    1313#include <netcdf.h> 
    14 extern "C" 
    15 { 
     14extern "C" { 
    1615#include <netcdf_par.h> 
    1716} 
     
    9594            int getVariable(const StdString & varname); 
    9695            int getDimension(const StdString & dimname); 
    97             std::vector<StdSize> getDimensions(const StdString & varname); 
    98             int getUnlimitedDimension(void); 
     96            std::vector<StdSize>   getDimensions       (const StdString & varname); 
     97            std::vector<StdString> getDimensionsIdList (const StdString * varname); 
     98            int       getUnlimitedDimension(void); 
     99            StdString getUnlimitedDimensionName(void); 
    99100 
    100101            bool varExist(const StdString & varname); 
     
    145146         this->getWriteDataInfos 
    146147         (name, record, array_size,  sstart, scount, start, count); 
     148         if (data->num_elements() != array_size) 
     149         { 
     150            ERROR("CONetCDF4::writeData(...)", 
     151                  << "[ input array size = "  << data->num_elements() 
     152                  << ", intern array size = " << array_size 
     153                  << " ] Invalid input data !" ); 
     154         } 
     155          
    147156         this->writeData_(grpid, varid, sstart, scount, data->data()); 
    148157      } 
Note: See TracChangeset for help on using the changeset viewer.