Changeset 201 for XMLIO_V2/dev


Ignore:
Timestamp:
05/24/11 08:21:57 (13 years ago)
Author:
hozdoba
Message:
 
Location:
XMLIO_V2/dev/dev_rv
Files:
11 edited

Legend:

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

    r171 r201  
    11#include "attribute_template.hpp" 
    2  
    32#include "attribute_template_impl.hpp" 
     3 
     4#include <cfloat> 
    45 
    56namespace xmlioserver 
     
    3132      template <> // Chaîne de caractÚres. 
    3233         void CAttributeTemplate<StdString>::fromString(const StdString & str) 
    33       { this->setValue(str); } 
     34      {  
     35         this->setValue(str);  
     36      } 
    3437 
    3538      template <> // Entier 
     
    4346         { 
    4447            ERROR("void CAttributeTemplate<int>::fromString(const StdString & str)", 
     48                  << "[ str = " << str << " ] Bad cast !"); 
     49         } 
     50      } 
     51 
     52      template <> // Double 
     53         void CAttributeTemplate<double>::fromString(const StdString & str) 
     54      { 
     55         if (str.find("max") != StdString::npos) 
     56         { 
     57            this->setValue(DBL_MAX); 
     58            return; 
     59         } 
     60         if (str.find("min") != StdString::npos) 
     61         { 
     62            this->setValue(DBL_MIN); 
     63            return; 
     64         } 
     65          
     66         try 
     67         { 
     68            this->setValue(boost::lexical_cast<double>(str)); 
     69         } 
     70         catch(boost::bad_lexical_cast &) 
     71         { 
     72            ERROR("void CAttributeTemplate<double>::fromString(const StdString & str)", 
    4573                  << "[ str = " << str << " ] Bad cast !"); 
    4674         } 
     
    141169      } 
    142170 
     171      template <> // Double 
     172         void CAttributeTemplate<double>::toBinary(StdOStream & os) const 
     173      { 
     174         double value = this->getValue(); 
     175         os.write (reinterpret_cast<const char*>(&value) , sizeof(double)); 
     176      } 
     177 
    143178      //--------------------------------------------------------------- 
    144179 
     
    171206      } 
    172207 
     208      template <> // Double 
     209         void CAttributeTemplate<double>::fromBinary(StdIStream & is) 
     210      { 
     211         double value = 0.; 
     212         is.read (reinterpret_cast<char*>(&value), sizeof(double)); 
     213         this->setValue(value); 
     214      } 
     215 
    173216      ///-------------------------------------------------------------- 
    174217   } // namespace tree 
  • XMLIO_V2/dev/dev_rv/src/xmlio/attribute_template_impl.hpp

    r187 r201  
    135135         void CAttributeTemplate<bool>::fromString(const StdString & str); 
    136136 
     137      template <> // Double 
     138         void CAttributeTemplate<double>::fromString(const StdString & str); 
     139 
    137140      template<> // Tableau 
    138141         void CAttributeTemplate<ARRAY(double, 1)>::fromString(const StdString & str); 
     
    150153      template <> // Booléen 
    151154         void CAttributeTemplate<bool>::toBinary(StdOStream & os) const; 
     155          
     156      template <> // Double 
     157         void CAttributeTemplate<double>::toBinary(StdOStream & os) const; 
    152158 
    153159      //--------------------------------------------------------------- 
     
    163169      template <> // Booléen 
    164170         void CAttributeTemplate<bool>::fromBinary(StdIStream & is); 
     171          
     172      template <> // Double 
     173         void CAttributeTemplate<double>::fromBinary(StdIStream & is); 
    165174 
    166175      ///-------------------------------------------------------------- 
  • XMLIO_V2/dev/dev_rv/src/xmlio/config/field_attribute.conf

    r191 r201  
    1717//DECLARE_ATTRIBUTE(StdString, zoom_ref) 
    1818DECLARE_ATTRIBUTE(StdString, field_ref) 
     19 
     20DECLARE_ATTRIBUTE(double, default_value) 
  • XMLIO_V2/dev/dev_rv/src/xmlio/config/properties.conf

    r199 r201  
    1414DECLARE_PROPERTY  (StdString, OUTPUT_PATH,    "./data/" ) 
    1515 
     16/// Default Value /// 
     17DECLARE_PROPERTY (double, FIELD_DEFAULT_VALUE,  1E-10) 
     18 
    1619/// Buffer Size /// 
    1720DECLARE_PROPERTY (StdSize, BUFFER_CLIENT_SIZE,  1E6) // 1 Mo 
  • XMLIO_V2/dev/dev_rv/src/xmlio/fake_client/fake_nemo.f90

    r187 r201  
    6060                        child_type  = GFIELD) 
    6161 
    62       CALL set_field_attributes(field_hdl = temp_mod_, & 
    63                                 ftype     = GFIELD,    & 
    64                                 unit_     = "SI",      & 
    65                                 prec_     = 8) 
     62      CALL set_field_attributes(field_hdl      = temp_mod_, & 
     63                                ftype          = GFIELD,    & 
     64                                unit_          = "SI",      & 
     65                                default_value_ = 10E-10_8,& 
     66                                prec_          = 8) 
    6667 
    6768      CALL xml_tree_add(parent_hdl  = temp_mod_,       & 
  • XMLIO_V2/dev/dev_rv/src/xmlio/fortran/macro.inc

    r152 r201  
    11#define iarg_bool(name) ,name 
     2#define iarg_double(name) ,name 
    23#define iarg_int(name) ,name 
    34#define iarg_StdString(name) ,name iarg_int(name##_size) 
     
    1112 
    1213#define arg_bool(name) ,name##_ 
     14#define arg_double(name) ,name##_ 
    1315#define arg_int(name) ,name##_ 
    1416#define arg_StdString(name) ,name##_ 
     
    2325#define dec_int(name) \ 
    2426   INTEGER (kind = C_INT) :: name; 
     27    
     28#define dec_double(name) \ 
     29   REAL (kind = C_DOUBLE) :: name; 
    2530 
    2631#define dec_StdString(name) \ 
     
    5661#define def_int(name) \ 
    5762   INTEGER,  OPTIONAL, INTENT(IN) :: name##_ 
     63    
     64#define def_double(name) \ 
     65   REAL(kind=8),  OPTIONAL, INTENT(IN) :: name##_ 
    5866 
    5967#define def_StdString(name) \ 
     
    97105#define ip_bool(class, name) ip_simple(class, name) 
    98106#define ip_int(class, name) ip_simple(class, name) 
     107#define ip_double(class, name) ip_simple(class, name) 
    99108 
    100109#define ip_StdString(class, name) \ 
  • XMLIO_V2/dev/dev_rv/src/xmlio/iface/interface.cpp.in

    r189 r201  
    364364//------------------------------------------------------------------- 
    365365 
    366 void xios_set_timestep(double ts_year, double ts_month, double ts_day, 
     366void xios_set_timestep(double ts_year, double ts_month , double ts_day, 
    367367                       double ts_hour, double ts_minute, double ts_second) 
    368368{ 
  • XMLIO_V2/dev/dev_rv/src/xmlio/output/nc4_data_output.cpp

    r189 r201  
    6767         if (domain->isEmpty()) return; 
    6868 
     69         int dvm = 1; 
     70 
    6971         std::vector<StdString> dim0, dim1; 
    7072         StdString domid     = (!domain->name.isEmpty()) 
     
    101103               SuperClassWriter::addDimension(lonid_loc, domain->zoom_ni_loc.getValue()); 
    102104               SuperClassWriter::addDimension(latid_loc, domain->zoom_nj_loc.getValue()); 
    103                this->writeLocalAttributes(domain->ibegin.getValue(), domain->iend.getValue(), 
    104                                           domain->jbegin.getValue(), domain->jend.getValue(), 
     105               this->writeLocalAttributes(domain->zoom_ibegin_loc.getValue(), 
     106                                          domain->zoom_ni_loc.getValue(), 
     107                                          domain->zoom_jbegin_loc.getValue(), 
     108                                          domain->zoom_nj_loc.getValue(), 
    105109                                          domid); 
    106110               if (isCurvilinear) 
     
    131135                  domain->data_ibegin.getValue(), 
    132136                  domain->data_jbegin.getValue()*/); 
     137                   
     138               SuperClassWriter::setDefaultValue(maskid, &dvm); 
    133139 
    134140               SuperClassWriter::definition_end(); 
     
    224230         bool wtime   = !(!field->operation.isEmpty() && 
    225231                         ( field->operation.getValue().compare("once") == 0)); 
    226  
     232                          
    227233         if (wtime) dims.push_back(timeid); 
    228234 
     
    278284                        ("interval_write", field->getRelFile()->output_freq.getValue(), &fieldid); 
    279285               } 
     286                
     287               if (!field->default_value.isEmpty()) 
     288               { 
     289                  double default_value = field->default_value.getValue(); 
     290                  float fdefault_value = (float)default_value; 
     291                  if (type == NC_DOUBLE) 
     292                     SuperClassWriter::setDefaultValue(fieldid, &default_value); 
     293                  else 
     294                     SuperClassWriter::setDefaultValue(fieldid, &fdefault_value); 
     295               } 
     296               else 
     297               { 
     298                  double * default_value = NULL; 
     299                  SuperClassWriter::setDefaultValue(fieldid, default_value); 
     300               }              
    280301 
    281302               {  // Ecriture des coordonnées 
     
    381402       
    382403      void CNc4DataOutput::writeLocalAttributes 
    383          (int ibegin, int iend, int jbegin, int jend, StdString domid) 
     404         (int ibegin, int ni, int jbegin, int nj, StdString domid) 
    384405      { 
    385406         SuperClassWriter::addAttribute(StdString("ibegin_").append(domid), ibegin); 
    386          SuperClassWriter::addAttribute(StdString("iend_"  ).append(domid), iend); 
     407         SuperClassWriter::addAttribute(StdString("ni_"    ).append(domid), ni); 
    387408         SuperClassWriter::addAttribute(StdString("jbegin_").append(domid), jbegin); 
    388          SuperClassWriter::addAttribute(StdString("jend_"  ).append(domid), jend); 
     409         SuperClassWriter::addAttribute(StdString("nj_"    ).append(domid), nj); 
    389410      } 
    390411 
  • XMLIO_V2/dev/dev_rv/src/xmlio/output/nc4_data_output.hpp

    r189 r201  
    5252         protected : 
    5353          
    54             void writeLocalAttributes(int ibegin, int iend, int jbegin, int jend, StdString domid); 
     54            void writeLocalAttributes(int ibegin, int ni, int jbegin, int nj, StdString domid); 
    5555 
    5656            void writeFileAttributes(const StdString & name, 
  • XMLIO_V2/dev/dev_rv/src/xmlio/output/onetcdf4.hpp

    r189 r201  
    5353      //---------------------------------------------------------------- 
    5454         public : 
     55          
     56            template <class T> 
     57               void setDefaultValue(const StdString & varname, const T * value = NULL); 
    5558          
    5659            template <class T> 
     
    137140         this->writeData_(grpid, varid, sstart, scount, data->data()); 
    138141      } 
     142       
     143      //---------------------------------------------------------------- 
     144            
     145      template <class T> 
     146         void CONetCDF4::setDefaultValue(const StdString & varname, const T * value) 
     147      { 
     148         int grpid = this->getCurrentGroup(); 
     149         int varid = this->getVariable(varname); 
     150          
     151         if (value != NULL) 
     152         { 
     153            CheckError(nc_def_var_fill(grpid, varid, 0, value)); 
     154            this->addAttribute(StdString("missing_value"), *value, &varname); 
     155         } 
     156         else 
     157            CheckError(nc_def_var_fill(grpid, varid, 1, NULL));          
     158      } 
    139159      
    140160      ///--------------------------------------------------------------- 
  • XMLIO_V2/dev/dev_rv/xmlioserver.geany

    r200 r201  
    1919 
    2020[files] 
     21<<<<<<< .mine 
     22current_page=11 
     23FILE_NAME_0=0;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/xmlioserver_spl.hpp;0;3 
     24FILE_NAME_1=878;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/main_server.cpp;0;3 
     25FILE_NAME_2=3127;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/buffer_pair.hpp;0;3 
     26FILE_NAME_3=1355;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/buffer_list.cpp;0;3 
     27FILE_NAME_4=4378;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/circular_buffer.cpp;0;3 
     28FILE_NAME_5=225;Conf;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/config/properties.conf;0;3 
     29FILE_NAME_6=4055;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/server.cpp;0;3 
     30FILE_NAME_7=294;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/client.cpp;0;3 
     31FILE_NAME_8=1060;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/client.hpp;0;3 
     32FILE_NAME_9=0;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/node/grid.hpp;0;3 
     33FILE_NAME_10=14160;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/node/grid.cpp;0;3 
     34FILE_NAME_11=17768;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/node/domain.cpp;0;3 
     35======= 
    2136current_page=2 
    2237FILE_NAME_0=840;Make;0;16;1;1;0;/work/dev_rv/Makefile.wk;0;3 
     
    3752FILE_NAME_15=950;C++;0;16;0;1;0;/work/dev_rv/src/xmlio/buffer_impl.hpp;0;3 
    3853FILE_NAME_16=588;Conf;0;16;0;1;0;/work/dev_rv/src/xmlio/config/properties.conf;0;3 
     54>>>>>>> .r200 
    3955 
    4056[build-menu] 
Note: See TracChangeset for help on using the changeset viewer.