Changeset 201
- Timestamp:
- 05/24/11 08:21:57 (14 years ago)
- 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 1 1 #include "attribute_template.hpp" 2 3 2 #include "attribute_template_impl.hpp" 3 4 #include <cfloat> 4 5 5 6 namespace xmlioserver … … 31 32 template <> // Chaîne de caractÚres. 32 33 void CAttributeTemplate<StdString>::fromString(const StdString & str) 33 { this->setValue(str); } 34 { 35 this->setValue(str); 36 } 34 37 35 38 template <> // Entier … … 43 46 { 44 47 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)", 45 73 << "[ str = " << str << " ] Bad cast !"); 46 74 } … … 141 169 } 142 170 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 143 178 //--------------------------------------------------------------- 144 179 … … 171 206 } 172 207 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 173 216 ///-------------------------------------------------------------- 174 217 } // namespace tree -
XMLIO_V2/dev/dev_rv/src/xmlio/attribute_template_impl.hpp
r187 r201 135 135 void CAttributeTemplate<bool>::fromString(const StdString & str); 136 136 137 template <> // Double 138 void CAttributeTemplate<double>::fromString(const StdString & str); 139 137 140 template<> // Tableau 138 141 void CAttributeTemplate<ARRAY(double, 1)>::fromString(const StdString & str); … … 150 153 template <> // Booléen 151 154 void CAttributeTemplate<bool>::toBinary(StdOStream & os) const; 155 156 template <> // Double 157 void CAttributeTemplate<double>::toBinary(StdOStream & os) const; 152 158 153 159 //--------------------------------------------------------------- … … 163 169 template <> // Booléen 164 170 void CAttributeTemplate<bool>::fromBinary(StdIStream & is); 171 172 template <> // Double 173 void CAttributeTemplate<double>::fromBinary(StdIStream & is); 165 174 166 175 ///-------------------------------------------------------------- -
XMLIO_V2/dev/dev_rv/src/xmlio/config/field_attribute.conf
r191 r201 17 17 //DECLARE_ATTRIBUTE(StdString, zoom_ref) 18 18 DECLARE_ATTRIBUTE(StdString, field_ref) 19 20 DECLARE_ATTRIBUTE(double, default_value) -
XMLIO_V2/dev/dev_rv/src/xmlio/config/properties.conf
r199 r201 14 14 DECLARE_PROPERTY (StdString, OUTPUT_PATH, "./data/" ) 15 15 16 /// Default Value /// 17 DECLARE_PROPERTY (double, FIELD_DEFAULT_VALUE, 1E-10) 18 16 19 /// Buffer Size /// 17 20 DECLARE_PROPERTY (StdSize, BUFFER_CLIENT_SIZE, 1E6) // 1 Mo -
XMLIO_V2/dev/dev_rv/src/xmlio/fake_client/fake_nemo.f90
r187 r201 60 60 child_type = GFIELD) 61 61 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) 66 67 67 68 CALL xml_tree_add(parent_hdl = temp_mod_, & -
XMLIO_V2/dev/dev_rv/src/xmlio/fortran/macro.inc
r152 r201 1 1 #define iarg_bool(name) ,name 2 #define iarg_double(name) ,name 2 3 #define iarg_int(name) ,name 3 4 #define iarg_StdString(name) ,name iarg_int(name##_size) … … 11 12 12 13 #define arg_bool(name) ,name##_ 14 #define arg_double(name) ,name##_ 13 15 #define arg_int(name) ,name##_ 14 16 #define arg_StdString(name) ,name##_ … … 23 25 #define dec_int(name) \ 24 26 INTEGER (kind = C_INT) :: name; 27 28 #define dec_double(name) \ 29 REAL (kind = C_DOUBLE) :: name; 25 30 26 31 #define dec_StdString(name) \ … … 56 61 #define def_int(name) \ 57 62 INTEGER, OPTIONAL, INTENT(IN) :: name##_ 63 64 #define def_double(name) \ 65 REAL(kind=8), OPTIONAL, INTENT(IN) :: name##_ 58 66 59 67 #define def_StdString(name) \ … … 97 105 #define ip_bool(class, name) ip_simple(class, name) 98 106 #define ip_int(class, name) ip_simple(class, name) 107 #define ip_double(class, name) ip_simple(class, name) 99 108 100 109 #define ip_StdString(class, name) \ -
XMLIO_V2/dev/dev_rv/src/xmlio/iface/interface.cpp.in
r189 r201 364 364 //------------------------------------------------------------------- 365 365 366 void xios_set_timestep(double ts_year, double ts_month , double ts_day,366 void xios_set_timestep(double ts_year, double ts_month , double ts_day, 367 367 double ts_hour, double ts_minute, double ts_second) 368 368 { -
XMLIO_V2/dev/dev_rv/src/xmlio/output/nc4_data_output.cpp
r189 r201 67 67 if (domain->isEmpty()) return; 68 68 69 int dvm = 1; 70 69 71 std::vector<StdString> dim0, dim1; 70 72 StdString domid = (!domain->name.isEmpty()) … … 101 103 SuperClassWriter::addDimension(lonid_loc, domain->zoom_ni_loc.getValue()); 102 104 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(), 105 109 domid); 106 110 if (isCurvilinear) … … 131 135 domain->data_ibegin.getValue(), 132 136 domain->data_jbegin.getValue()*/); 137 138 SuperClassWriter::setDefaultValue(maskid, &dvm); 133 139 134 140 SuperClassWriter::definition_end(); … … 224 230 bool wtime = !(!field->operation.isEmpty() && 225 231 ( field->operation.getValue().compare("once") == 0)); 226 232 227 233 if (wtime) dims.push_back(timeid); 228 234 … … 278 284 ("interval_write", field->getRelFile()->output_freq.getValue(), &fieldid); 279 285 } 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 } 280 301 281 302 { // Ecriture des coordonnées … … 381 402 382 403 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) 384 405 { 385 406 SuperClassWriter::addAttribute(StdString("ibegin_").append(domid), ibegin); 386 SuperClassWriter::addAttribute(StdString(" iend_" ).append(domid), iend);407 SuperClassWriter::addAttribute(StdString("ni_" ).append(domid), ni); 387 408 SuperClassWriter::addAttribute(StdString("jbegin_").append(domid), jbegin); 388 SuperClassWriter::addAttribute(StdString(" jend_" ).append(domid), jend);409 SuperClassWriter::addAttribute(StdString("nj_" ).append(domid), nj); 389 410 } 390 411 -
XMLIO_V2/dev/dev_rv/src/xmlio/output/nc4_data_output.hpp
r189 r201 52 52 protected : 53 53 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); 55 55 56 56 void writeFileAttributes(const StdString & name, -
XMLIO_V2/dev/dev_rv/src/xmlio/output/onetcdf4.hpp
r189 r201 53 53 //---------------------------------------------------------------- 54 54 public : 55 56 template <class T> 57 void setDefaultValue(const StdString & varname, const T * value = NULL); 55 58 56 59 template <class T> … … 137 140 this->writeData_(grpid, varid, sstart, scount, data->data()); 138 141 } 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 } 139 159 140 160 ///--------------------------------------------------------------- -
XMLIO_V2/dev/dev_rv/xmlioserver.geany
r200 r201 19 19 20 20 [files] 21 <<<<<<< .mine 22 current_page=11 23 FILE_NAME_0=0;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/xmlioserver_spl.hpp;0;3 24 FILE_NAME_1=878;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/main_server.cpp;0;3 25 FILE_NAME_2=3127;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/buffer_pair.hpp;0;3 26 FILE_NAME_3=1355;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/buffer_list.cpp;0;3 27 FILE_NAME_4=4378;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/circular_buffer.cpp;0;3 28 FILE_NAME_5=225;Conf;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/config/properties.conf;0;3 29 FILE_NAME_6=4055;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/server.cpp;0;3 30 FILE_NAME_7=294;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/client.cpp;0;3 31 FILE_NAME_8=1060;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/client.hpp;0;3 32 FILE_NAME_9=0;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/node/grid.hpp;0;3 33 FILE_NAME_10=14160;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/node/grid.cpp;0;3 34 FILE_NAME_11=17768;C++;0;16;0;1;0;/home/herve/dev/dev_rv/src/xmlio/node/domain.cpp;0;3 35 ======= 21 36 current_page=2 22 37 FILE_NAME_0=840;Make;0;16;1;1;0;/work/dev_rv/Makefile.wk;0;3 … … 37 52 FILE_NAME_15=950;C++;0;16;0;1;0;/work/dev_rv/src/xmlio/buffer_impl.hpp;0;3 38 53 FILE_NAME_16=588;Conf;0;16;0;1;0;/work/dev_rv/src/xmlio/config/properties.conf;0;3 54 >>>>>>> .r200 39 55 40 56 [build-menu]
Note: See TracChangeset
for help on using the changeset viewer.