Changeset 184 for XMLIO_V2/dev/dev_rv
- Timestamp:
- 04/26/11 13:21:35 (13 years ago)
- Location:
- XMLIO_V2/dev/dev_rv/src/xmlio
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/xmlio/config/domain_attribute.conf
r180 r184 40 40 41 41 /* LOCAL */ 42 DECLARE_ATTRIBUTE(int , zoom_ni_loc) 43 DECLARE_ATTRIBUTE(int , zoom_nj_loc) 44 DECLARE_ATTRIBUTE(int , zoom_ibegin_loc) 45 DECLARE_ATTRIBUTE(int , zoom_jbegin_loc) 46 47 /* LOCAL */ 42 48 DECLARE_ATTRIBUTE(int , data_n_index) 43 49 DECLARE_ATTRIBUTE(ARRAY(int, 1) , data_i_index) -
XMLIO_V2/dev/dev_rv/src/xmlio/fake_client/fake_nemo.f90
r183 r184 24 24 TYPE(XDate) :: init_date_nemo = XDate(1985, 03, 15, 17, 35, 00) 25 25 TYPE(XHandle) :: nemo_style_ctxt = NULLHANDLE 26 TYPE(XHandle) :: temp_mod = NULLHANDLE, & 27 temp_mod_ = NULLHANDLE, & 28 temp_mod__ = NULLHANDLE 26 TYPE(XHandle) :: temp_mod = NULLHANDLE, & 27 temp_mod_ = NULLHANDLE, & 28 temp_mod__ = NULLHANDLE, & 29 temp_mod___ = NULLHANDLE 29 30 30 31 … … 130 131 long_name_ = "le champ 4", & 131 132 grid_ref_ = "simple_grille") 133 134 CALL xml_tree_add(parent_hdl = temp_mod, & 135 parent_type = GFIELD, & 136 child_hdl = temp_mod__, & 137 child_type = EFIELD, & 138 child_id = "champ_3D_k8_average_zoom") 139 140 CALL set_field_attributes(field_hdl = temp_mod__, & 141 ftype = EFIELD, & 142 prec_ = 8, & 143 operation_ = "average", & 144 name_ = "champ5", & 145 standard_name_ = "lechamp5", & 146 long_name_ = "le champ 5", & 147 grid_ref_ = "simple_grille_zoom") 132 148 133 149 CALL xml_tree_add(parent_hdl = temp_mod_, & … … 158 174 159 175 ! ---------> axis_definition 176 160 177 CALL handle_create(temp_mod, GAXIS, "axis_definition") 161 178 CALL xml_tree_add(parent_hdl = temp_mod, & … … 190 207 child_type = GDOMAIN, & 191 208 child_id = "all_domain") 192 193 CALL xml_tree_add(parent_hdl = temp_mod_, &194 parent_type = GDOMAIN, &195 child_hdl = temp_mod ,&196 child_type = EDOMAIN,&197 child_id = "simple_domaine 0")209 210 CALL xml_tree_add(parent_hdl = temp_mod_, & 211 parent_type = GDOMAIN, & 212 child_hdl = temp_mod___, & 213 child_type = GDOMAIN, & 214 child_id = "simple_domaine_grp") 198 215 199 216 IF (rankGrp .EQ. 0) THEN … … 211 228 data_ni = 50 212 229 data_ibegin = 1 213 END IF 214 215 CALL set_domain_attributes(domain_hdl = temp_mod, & 216 ftype = EDOMAIN, & 217 name_ = "domaine0", & 218 standard_name_ = "ledomaine0", & 219 long_name_ = "le domaine 0", & 230 END IF 231 232 CALL set_domain_attributes(domain_hdl = temp_mod___, & 233 ftype = GDOMAIN, & 220 234 lonvalue_ = real_array(1:((jend-jbegin+1)*(iend-ibegin+1))), & 221 235 latvalue_ = real_array(1:((jend-jbegin+1)*(iend-ibegin+1))), & … … 228 242 jend_ = jend, & 229 243 data_ni_ = data_ni, & 230 data_ibegin_ = data_ibegin) 244 data_ibegin_ = data_ibegin) 245 246 CALL xml_tree_add(parent_hdl = temp_mod___,& 247 parent_type = GDOMAIN, & 248 child_hdl = temp_mod, & 249 child_type = EDOMAIN, & 250 child_id = "simple_domaine0") 251 252 CALL set_domain_attributes(domain_hdl = temp_mod, & 253 ftype = EDOMAIN, & 254 name_ = "domaine0", & 255 standard_name_ = "ledomaine0", & 256 long_name_ = "le domaine 0") 257 258 CALL xml_tree_add(parent_hdl = temp_mod___,& 259 parent_type = GDOMAIN, & 260 child_hdl = temp_mod, & 261 child_type = EDOMAIN, & 262 child_id = "simple_domaine0_zoom") 263 264 CALL set_domain_attributes(domain_hdl = temp_mod, & 265 ftype = EDOMAIN, & 266 name_ = "domaine0zoom", & 267 standard_name_ = "ledomaine0zoom", & 268 long_name_ = "le domaine 0 zoom",& 269 zoom_ibegin_ = 21, & 270 zoom_jbegin_ = 5 , & 271 zoom_ni_ = 60, & 272 zoom_nj_ = 15) 231 273 232 274 CALL xml_tree_add(parent_hdl = temp_mod_, & … … 251 293 ftype = EDOMAIN, & 252 294 name_ = "domaine1", & 253 standard_name_ = "ledomaine 0", &295 standard_name_ = "ledomaine1", & 254 296 long_name_ = "le domaine 1", & 255 297 lonvalue_ = real_array(1:((jend-jbegin+1)*(iend-ibegin+1))), & … … 277 319 domain_ref_ = "simple_domaine1", & 278 320 axis_ref_ = "simple_axe") 321 322 CALL xml_tree_add(parent_hdl = temp_mod, & 323 parent_type = GGRID, & 324 child_hdl = temp_mod_, & 325 child_type = EGRID, & 326 child_id = "simple_grille_zoom") 327 328 CALL set_grid_attributes(grid_hdl = temp_mod_, & 329 ftype = EGRID, & 330 name_ = "grille2", & 331 description_ = "la grille 2", & 332 domain_ref_ = "simple_domaine0_zoom", & 333 axis_ref_ = "simple_axe") 279 334 280 335 ! ---------> file_definition … … 299 354 child_hdl = temp_mod__, & 300 355 child_type = EFIELD) 356 357 CALL set_field_attributes(field_hdl = temp_mod__, & 358 ftype = EFIELD, & 359 field_ref_ = "champ_3D_k8_average_zoom") 360 361 CALL xml_tree_add(parent_hdl = temp_mod_, & 362 parent_type = EFILE, & 363 child_hdl = temp_mod__, & 364 child_type = EFIELD) 301 365 302 366 CALL set_field_attributes(field_hdl = temp_mod__, & -
XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.cpp
r183 r184 41 41 { 42 42 return (this->relFiles); 43 } 44 45 //---------------------------------------------------------------- 46 47 bool CDomain::hasZoom(void) const 48 { 49 return ((this->zoom_ni.getValue() != this->ni_glo.getValue()) && 50 (this->zoom_nj.getValue() != this->nj_glo.getValue())); 51 } 52 53 //---------------------------------------------------------------- 54 55 bool CDomain::isEmpty(void) const 56 { 57 return ((this->zoom_ni_loc.getValue() == 0) || 58 (this->zoom_nj_loc.getValue() == 0)); 43 59 } 44 60 … … 196 212 if (!zoom_ibegin.isEmpty()) 197 213 { 198 int zoom_iend = zoom_ jbegin.getValue() + zoom_nj.getValue() - 1;214 int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1; 199 215 int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1; 200 216 … … 203 219 iend_mask = min (iend.getValue(), zoom_iend); 204 220 jend_mask = min (jend.getValue(), zoom_jend); 205 221 206 222 ibegin_mask -= ibegin.getValue(); 207 223 jbegin_mask -= jbegin.getValue(); … … 211 227 212 228 //~ std::cout << "-------------------" << std::endl 213 //~ << "zoom : " << std::boolalpha << (!zoom_ibegin.isEmpty()) << std::endl 214 //~ << "size : " << ni.getValue() << " X " << nj.getValue() << std::endl 215 //~ << "i : " << ibegin_mask << ", " << iend_mask << std::endl 216 //~ << "j : " << jbegin_mask << ", " << jend_mask << std::endl 217 //~ << "-------------------" << std::endl; 229 //~ << "zoom : " << std::boolalpha << this->hasZoom() << std::endl 230 //~ << "size : " << ni.getValue() << " X " << nj.getValue() << std::endl 231 //~ << "it : " << ibegin.getValue() << ", " << iend.getValue() << std::endl 232 //~ << "jt : " << jbegin.getValue() << ", " << jend.getValue() << std::endl 233 //~ << "im : " << ibegin_mask << ", " << iend_mask << std::endl 234 //~ << "jm : " << jbegin_mask << ", " << jend_mask << std::endl 235 //~ << "-------------------" << std::endl; 218 236 219 237 if (!mask.isEmpty()) … … 250 268 } 251 269 } 252 253 270 254 271 mask.setValue(__arr); … … 436 453 void CDomain::checkZoom(void) 437 454 { 455 // Résolution et vérification des données globales de zoom. 438 456 if (!this->zoom_ni.isEmpty() || !this->zoom_nj.isEmpty() || 439 457 !this->zoom_ibegin.isEmpty() || !this->zoom_jbegin.isEmpty()) … … 447 465 else 448 466 { 449 int zoom_iend = zoom_ jbegin.getValue() + zoom_nj.getValue() - 1;467 int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1; 450 468 int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1; 451 469 452 470 if (zoom_ibegin.getValue() < 1 || zoom_jbegin.getValue() < 1 || 453 zoom_iend > iend.getValue() || zoom_jend > jend.getValue())471 zoom_iend > ni_glo.getValue() || zoom_jend > nj_glo.getValue()) 454 472 ERROR("CDomain::checkZoom(void)", 455 473 << "Zoom mal défini," 456 474 << " vérifiez les valeurs zoom_ni, zoom_nj, zoom_ibegin, zoom_ibegin") ; 457 475 } 458 } 476 } 477 else 478 { 479 this->zoom_ni.setValue(this->ni_glo.getValue()); 480 this->zoom_nj.setValue(this->nj_glo.getValue()); 481 this->zoom_ibegin.setValue(1); 482 this->zoom_jbegin.setValue(1); 483 } 484 // Résolution des données locales de zoom. 485 { 486 int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1; 487 int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1; 488 489 if ((zoom_ibegin.getValue() > iend.getValue()) || 490 (zoom_iend < ibegin.getValue())) 491 { 492 zoom_ni_loc.setValue(0); 493 zoom_ibegin_loc.setValue(-1); 494 } 495 else 496 { 497 int zoom_ibegin_loc_ = (zoom_ibegin.getValue() > ibegin.getValue()) 498 ? zoom_ibegin.getValue() 499 : ibegin.getValue(); 500 int zoom_iend_loc_ = (zoom_iend < iend.getValue()) 501 ? zoom_iend 502 : iend.getValue(); 503 int zoom_ni_loc_ = zoom_iend_loc_ - zoom_ibegin_loc_ + 1; 504 505 zoom_ni_loc.setValue(zoom_ni_loc_); 506 zoom_ibegin_loc.setValue(zoom_ibegin_loc_-ibegin.getValue()+1); 507 } 508 509 if ((zoom_jbegin.getValue() > jend.getValue()) || 510 (zoom_jend < jbegin.getValue())) 511 { 512 zoom_nj_loc.setValue(0); 513 zoom_jbegin_loc.setValue(-1); 514 } 515 else 516 { 517 int zoom_jbegin_loc_ = (zoom_jbegin.getValue() > jbegin.getValue()) 518 ? zoom_jbegin.getValue() 519 : jbegin.getValue(); 520 int zoom_jend_loc_ = (zoom_jend < jend.getValue()) 521 ? zoom_jend 522 : jend.getValue(); 523 int zoom_nj_loc_ = zoom_jend_loc_ - zoom_jbegin_loc_ + 1; 524 525 zoom_nj_loc.setValue(zoom_nj_loc_); 526 zoom_jbegin_loc.setValue(zoom_jbegin_loc_-jbegin.getValue()+1); 527 } 528 } 459 529 } 460 530 -
XMLIO_V2/dev/dev_rv/src/xmlio/node/domain.hpp
r183 r184 83 83 /// Test /// 84 84 bool IsWritten(const StdString & filename) const; 85 bool hasZoom(void) const; 86 bool isEmpty(void) const; 85 87 86 88 public : -
XMLIO_V2/dev/dev_rv/src/xmlio/node/grid.cpp
r183 r184 148 148 149 149 void CGrid::computeIndex(void) 150 { 150 { 151 151 const int ni = domain->ni.getValue() , 152 152 nj = domain->nj.getValue() , … … 293 293 { 294 294 SuperClass::toBinary(os); 295 this->storeIndex[0]->toBinary(os); 296 this->out_i_index[0]->toBinary(os); 297 this->out_j_index[0]->toBinary(os); 298 this->out_l_index[0]->toBinary(os); 295 296 os.write (reinterpret_cast<const char*>(&this->isChecked), sizeof(bool)); 297 298 if (this->isChecked) 299 { 300 this->storeIndex [0]->toBinary(os); 301 this->out_i_index[0]->toBinary(os); 302 this->out_j_index[0]->toBinary(os); 303 this->out_l_index[0]->toBinary(os); 304 } 299 305 } 300 306 … … 303 309 void CGrid::fromBinary(StdIStream & is) 304 310 { 305 SuperClass::fromBinary(is); 306 307 ARRAY_CREATE(storeIndex_ , int, 1, [1]); 308 ARRAY_CREATE(out_l_index_, int, 1, [1]); 309 ARRAY_CREATE(out_i_index_, int, 1, [1]); 310 ARRAY_CREATE(out_j_index_, int, 1, [1]); 311 312 storeIndex_ ->fromBinary(is); 313 out_i_index_->fromBinary(is); 314 out_j_index_->fromBinary(is); 315 out_l_index_->fromBinary(is); 316 317 this->storeIndex .push_back(storeIndex_); 318 this->out_i_index.push_back(out_i_index_); 319 this->out_j_index.push_back(out_j_index_); 320 this->out_l_index.push_back(out_l_index_); 311 bool hasIndex = false; 312 SuperClass::fromBinary(is); 313 is.read (reinterpret_cast<char*>(&hasIndex), sizeof(bool)); 314 315 if (hasIndex) 316 { 317 ARRAY_CREATE(storeIndex_ , int, 1, [0]); 318 ARRAY_CREATE(out_l_index_, int, 1, [0]); 319 ARRAY_CREATE(out_i_index_, int, 1, [0]); 320 ARRAY_CREATE(out_j_index_, int, 1, [0]); 321 322 storeIndex_ ->fromBinary(is); 323 out_i_index_->fromBinary(is); 324 out_j_index_->fromBinary(is); 325 out_l_index_->fromBinary(is); 326 327 this->storeIndex .push_back(storeIndex_); 328 this->out_i_index.push_back(out_i_index_); 329 this->out_j_index.push_back(out_j_index_); 330 this->out_l_index.push_back(out_l_index_); 331 } 321 332 } 322 333 … … 336 347 const int jbegin_srv = this->domain->jbegin.getValue(); 337 348 349 const int ibegin_zoom_srv = this->domain->zoom_ibegin_loc.getValue(); 350 const int jbegin_zoom_srv = this->domain->zoom_jbegin_loc.getValue(); 351 338 352 StdSize dn = 0; 339 353 for (StdSize j = 1; j < this->out_i_index.size(); j++) 340 354 dn += this->out_i_index[j]->size(); 341 355 342 ARRAY_ASSIGN(storeIndex_srv , int, 1, [dn]);356 ARRAY_ASSIGN(storeIndex_srv , int, 1, [dn]); 343 357 ARRAY_ASSIGN(out_i_index_srv, int, 1, [dn]); 344 358 ARRAY_ASSIGN(out_j_index_srv, int, 1, [dn]); … … 347 361 for (StdSize i = 0, dn = 0; i < ibegin.size(); i++) 348 362 { 349 ARRAY(int, 1) storeIndex_cl = this->storeIndex [i+1];350 ARRAY(int, 1) out_i_index_cl = this->out_i_index[i +1];351 ARRAY(int, 1) out_j_index_cl = this->out_j_index[i +1];352 ARRAY(int, 1) out_l_index_cl = this->out_l_index[i +1];363 ARRAY(int, 1) storeIndex_cl = this->storeIndex [i + 1]; 364 ARRAY(int, 1) out_i_index_cl = this->out_i_index[i + 1]; 365 ARRAY(int, 1) out_j_index_cl = this->out_j_index[i + 1]; 366 ARRAY(int, 1) out_l_index_cl = this->out_l_index[i + 1]; 353 367 354 368 const int ibegin_cl = ibegin[i]; … … 357 371 for (StdSize n = dn, m = 0; n < (dn + storeIndex_cl->size()); n++, m++) 358 372 { 359 (*storeIndex_srv)[n] = (*storeIndex_cl)[m] + dn; 360 (*out_i_index_srv)[n] = (*out_i_index_cl)[m] + (ibegin_cl - 1) - (ibegin_srv - 1); 361 (*out_j_index_srv)[n] = (*out_j_index_cl)[m] + (jbegin_cl - 1) - (jbegin_srv - 1); 373 (*storeIndex_srv)[n] = (*storeIndex_cl)[m] + dn; // Faux mais inutile dans tous les cas. 374 (*out_i_index_srv)[n] = (*out_i_index_cl)[m] 375 + (ibegin_cl - 1) - (ibegin_srv - 1) - (ibegin_zoom_srv - 1); 376 (*out_j_index_srv)[n] = (*out_j_index_cl)[m] 377 + (jbegin_cl - 1) - (jbegin_srv - 1) - (jbegin_zoom_srv - 1); 362 378 (*out_l_index_srv)[n] = (*out_l_index_cl)[m]; 363 379 } … … 367 383 } 368 384 369 //~StdOFStream ofs(this->getId().c_str());370 //~for (StdSize h = 0; h < storeIndex_srv->size(); h++)371 //~{372 //~ofs << "(" << (*storeIndex_srv)[h] << ";"373 //~<< (*out_i_index_srv)[h] << ","374 //~<< (*out_j_index_srv)[h] << ","375 //~<< (*out_l_index_srv)[h] << ")" << std::endl;376 //~}377 //~ofs.close();385 StdOFStream ofs(this->getId().c_str()); 386 for (StdSize h = 0; h < storeIndex_srv->size(); h++) 387 { 388 ofs << "(" << (*storeIndex_srv)[h] << ";" 389 << (*out_i_index_srv)[h] << "," 390 << (*out_j_index_srv)[h] << "," 391 << (*out_l_index_srv)[h] << ")" << std::endl; 392 } 393 ofs.close(); 378 394 379 395 } … … 385 401 ARRAY(double, 1) storedServer) const 386 402 { 387 if ( this->storeIndex.size()-1!= storedClient.size())403 if ((this->storeIndex.size() -1 ) != storedClient.size()) 388 404 ERROR("CGrid::inputFieldServer(...)", 389 405 << "[ Nombre de tableau attendu = " << (this->storeIndex.size()-1) << ", "
Note: See TracChangeset
for help on using the changeset viewer.