Changeset 449 for XIOS/trunk/src/node/domain.cpp
- Timestamp:
- 09/19/13 17:05:07 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/domain.cpp
r435 r449 22 22 : CObjectTemplate<CDomain>(), CDomainAttributes() 23 23 , isChecked(false), relFiles() 24 , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub()25 , ibegin_zoom_sub(), jbegin_zoom_sub(), ni_zoom_sub(), nj_zoom_sub()26 , lonvalue_sub(), latvalue_sub()27 24 { /* Ne rien faire de plus */ } 28 25 … … 30 27 : CObjectTemplate<CDomain>(id), CDomainAttributes() 31 28 , isChecked(false), relFiles() 32 , ibegin_sub(), iend_sub(), jbegin_sub(), jend_sub() 33 , ibegin_zoom_sub(), jbegin_zoom_sub(),ni_zoom_sub(), nj_zoom_sub() 34 , lonvalue_sub(), latvalue_sub() 35 { /* Ne rien faire de plus */ } 29 { /* Ne rien faire de plus */ } 36 30 37 31 CDomain::~CDomain(void) 38 32 { 39 vector<CArray<double,1>* >::iterator it;40 for(it=lonvalue_sub.begin();it<lonvalue_sub.end();it++) delete *it;41 for(it=latvalue_sub.begin();it<latvalue_sub.end();it++) delete *it;42 33 } 43 34 … … 46 37 const std::set<StdString> & CDomain::getRelFiles(void) const 47 38 { 48 return (this->relFiles); 39 return (this->relFiles); 49 40 } 50 41 … … 79 70 } 80 71 81 //----------------------------------------------------------------82 /*83 void CDomain::fromBinary(StdIStream & is)84 {85 SuperClass::fromBinary(is);86 87 if ( !this->ibegin.isEmpty() &&88 !this->jbegin.isEmpty() &&89 !this->iend.isEmpty() &&90 !this->jend.isEmpty() &&91 !this->latvalue.isEmpty() &&92 !this->lonvalue.isEmpty())93 {94 95 this->ibegin_sub.push_back(this->ibegin.getValue());96 this->jbegin_sub.push_back(this->jbegin.getValue());97 this->iend_sub.push_back(this->iend.getValue());98 this->jend_sub.push_back(this->jend.getValue());99 100 this->ibegin_zoom_sub.push_back(this->zoom_ibegin_loc.getValue());101 this->jbegin_zoom_sub.push_back(this->zoom_jbegin_loc.getValue());102 this->ni_zoom_sub.push_back(this->zoom_ni_loc.getValue());103 this->nj_zoom_sub.push_back(this->zoom_nj_loc.getValue());104 105 this->latvalue_sub.push_back(this->latvalue.getValue());106 this->lonvalue_sub.push_back(this->lonvalue.getValue());107 }108 109 #define CLEAR_ATT(name_)\110 SuperClassAttribute::operator[](#name_)->reset()111 112 CLEAR_ATT(mask);113 CLEAR_ATT(data_n_index);114 CLEAR_ATT(data_i_index);115 CLEAR_ATT(data_j_index);116 117 CLEAR_ATT(data_ni);118 CLEAR_ATT(data_nj);119 CLEAR_ATT(data_ibegin);120 CLEAR_ATT(data_jbegin);121 122 CLEAR_ATT(ni);123 CLEAR_ATT(nj);124 125 #undef CLEAR_ATT126 127 if ( !this->ibegin.isEmpty() &&128 !this->jbegin.isEmpty() &&129 !this->iend.isEmpty() &&130 !this->jend.isEmpty() &&131 !this->latvalue.isEmpty() &&132 !this->lonvalue.isEmpty())133 {134 135 this->ibegin.setValue(*std::min_element(this->ibegin_sub.begin(),this->ibegin_sub.end()));136 this->jbegin.setValue(*std::min_element(this->jbegin_sub.begin(),this->jbegin_sub.end()));137 this->iend.setValue(*std::max_element(this->iend_sub.begin(),this->iend_sub.end()));138 this->jend.setValue(*std::max_element(this->jend_sub.begin(),this->jend_sub.end()));139 }140 }141 */142 72 //---------------------------------------------------------------- 143 73 … … 150 80 void CDomain::checkGlobalDomain(void) 151 81 { 152 if ((ni_glo.isEmpty() || ni_glo.getValue() <= 0 ) || 82 if (!type.isEmpty() && type==type_attr::unstructured) 83 { 84 if (ni_glo.isEmpty() || ni_glo <= 0 ) 85 { 86 ERROR("CDomain::checkAttributes(void)", 87 << "[ Id = " << this->getId() << " ] " 88 << "The global domain is badly defined," 89 << " check the \'ni_glo\' value !") 90 } 91 nj_glo=ni_glo ; 92 ni_glo=1 ; 93 if (!ni.isEmpty()) nj=ni ; 94 if (!ibegin.isEmpty()) jbegin=ibegin ; 95 if (!iend.isEmpty()) jend=iend ; 96 ni=1 ; 97 ibegin=1 ; 98 iend=1 ; 99 } 100 else if ((ni_glo.isEmpty() || ni_glo.getValue() <= 0 ) || 153 101 (nj_glo.isEmpty() || nj_glo.getValue() <= 0 )) 154 102 { … … 173 121 ni.setValue(iend.getValue() - ibegin.getValue() + 1) ; 174 122 175 else if (!ibegin.isEmpty() && !iend.isEmpty() && 176 !ni.isEmpty() && (iend.getValue() != ibegin.getValue() + ni.getValue() - 1))177 {178 ERROR("CDomain::checkAttributes(void)",179 << "The domain si wrong defined,"180 << " iend is different of (ibegin + ni - 1) !") ;123 else if (!ibegin.isEmpty() && !iend.isEmpty() && !ni.isEmpty() ) 124 { 125 if (iend.getValue() != ibegin.getValue() + ni.getValue() - 1) 126 ERROR("CDomain::checkAttributes(void)", 127 << "The domain si wrong defined," 128 << " iend is different of (ibegin + ni - 1) !") ; 181 129 } 182 130 else … … 190 138 if (ni.getValue() < 0 || ibegin.getValue() > iend.getValue() || 191 139 ibegin.getValue() < 1 || iend.getValue() > ni_glo.getValue()) 140 { 141 cout<<ni_glo<<" "<<ni<<" "<<ibegin<<" "<<iend<<endl; 142 192 143 ERROR("CDomain::checkAttributes(void)", 193 144 << "[ Id = " << this->getId() << " ] " 194 145 << "Local domain is wrong defined," 195 146 << " Check the value : ni, ni_glo, ibegin, iend") ; 196 147 } 197 148 } 198 149 … … 210 161 nj.setValue(jend.getValue() - jbegin.getValue() + 1) ; 211 162 212 else if (!jbegin.isEmpty() && !jend.isEmpty() && !nj.isEmpty() &&213 (jend.getValue() != jbegin.getValue() + nj.getValue() - 1))214 {215 ERROR("CDomain::checkAttributes(void)",216 << "The domain is wrong defined,"217 << " iend is different of (jbegin + nj - 1) !") ;163 else if (!jbegin.isEmpty() && !jend.isEmpty() && !nj.isEmpty() ) 164 { 165 if (jend.getValue() != jbegin.getValue() + nj.getValue() - 1) 166 ERROR("CDomain::checkAttributes(void)", 167 << "The domain is wrong defined," 168 << " iend is different of (jbegin + nj - 1) !") ; 218 169 } 219 170 else … … 229 180 << "Domain is wrong defined," 230 181 << " Check the values : nj, nj_glo, jbegin, jend") ; 182 183 ibegin_client=ibegin ; iend_client=iend ; ni_client=ni ; 184 jbegin_client=jbegin ; jend_client=jend ; nj_client=nj ; 231 185 } 232 186 … … 416 370 CArray<double,1> lonvalue_temp(ni*nj) ; 417 371 CArray<double,1> latvalue_temp(ni*nj) ; 418 419 if ( lonvalue.numElements() == ni*nj && latvalue.numElements() == ni*nj ) isCurvilinear=true ; 420 else if ( lonvalue.numElements() == ni && latvalue.numElements() == nj ) isCurvilinear=false ; 421 else ERROR("void CDomain::completeLonLatClient(void)",<<"the grid is nor curvilinear, nor cartesian, because the size of longitude and latitude array is not coherent with the domain size"<<endl 422 <<"lonvalue size = " << lonvalue.numElements() << "different of ni or ni*nj"<<endl 423 <<"latvalue size = " << latvalue.numElements() << "different of nj or ni*nj" ) ; 424 if (isCurvilinear) 372 CArray<double,2> bounds_lon_temp(nvertex,ni*nj) ; 373 CArray<double,2> bounds_lat_temp(nvertex,ni*nj) ; 374 375 if (type.isEmpty()) 376 { 377 if ( lonvalue.numElements() == ni*nj && latvalue.numElements() == ni*nj ) 378 { 379 type.setValue(type_attr::curvilinear) ; 380 isCurvilinear=true ; 381 } 382 else if ( lonvalue.numElements() == ni && latvalue.numElements() == nj ) 383 { 384 type.setValue(type_attr::regular) ; 385 isCurvilinear=false ; 386 } 387 else ERROR("void CDomain::completeLonLatClient(void)",<<"the grid is nor curvilinear, nor cartesian, because the size of longitude and latitude array is not coherent with the domain size"<<endl 388 <<"lonvalue size = " << lonvalue.numElements() << "different of ni or ni*nj"<<endl 389 <<"latvalue size = " << latvalue.numElements() << "different of nj or ni*nj" ) ; 390 } 391 if (type==type_attr::curvilinear || type==type_attr::unstructured) 425 392 { 426 393 lonvalue_temp=lonvalue ; 427 394 latvalue_temp=latvalue ; 395 if (hasBounds) bounds_lon_temp=bounds_lon ; 396 if (hasBounds) bounds_lat_temp=bounds_lat ; 428 397 } 429 398 else … … 435 404 lonvalue_temp(k)=lonvalue(i) ; 436 405 latvalue_temp(k)=latvalue(j) ; 406 if (hasBounds) 407 { 408 for(int n=0;n<nvertex;n++) 409 { 410 bounds_lon_temp(n,k)=bounds_lon(n,i) ; 411 bounds_lat_temp(n,k)=bounds_lat(n,j) ; 412 } 413 } 437 414 } 438 415 } 439 416 440 441 const int zoom_ibegin_client = zoom_ibegin_loc.getValue(),442 zoom_jbegin_client = zoom_jbegin_loc.getValue(),443 zoom_ni_client = zoom_ni_loc.getValue(),444 zoom_nj_client = zoom_nj_loc.getValue();445 446 417 StdSize dm = zoom_ni_client * zoom_nj_client; 447 418 … … 453 424 for (int j = 0; j < zoom_nj_client; j++) 454 425 { 455 lonvalue(i + j * zoom_ni_client) = lonvalue_temp( (i + zoom_ibegin_client -1) + (j + zoom_jbegin_client -1)*ni.getValue() ); 456 latvalue(i + j * zoom_ni_client) = latvalue_temp( (i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni.getValue() ); 426 // lonvalue(i + j * zoom_ni_client) = lonvalue_temp( (i + zoom_ibegin_client -1) + (j + zoom_jbegin_client -1)*ni ); 427 // latvalue(i + j * zoom_ni_client) = latvalue_temp( (i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni ); 428 lonvalue(i + j * zoom_ni_client) = lonvalue_temp( (i + zoom_ibegin_client-ibegin) + (j + zoom_jbegin_client -jbegin)*ni ); 429 latvalue(i + j * zoom_ni_client) = latvalue_temp( (i + zoom_ibegin_client - ibegin)+(j + zoom_jbegin_client - jbegin)*ni ); 430 if (hasBounds) 431 { 432 for(int n=0;n<nvertex;n++) 433 { 434 // bounds_lon(n,i + j * zoom_ni_client) = bounds_lon_temp( n, (i + zoom_ibegin_client -1) + (j + zoom_jbegin_client -1)*ni ); 435 // bounds_lat(n,i + j * zoom_ni_client) = bounds_lat_temp( n, (i + zoom_ibegin_client -1)+(j + zoom_jbegin_client -1)*ni ); 436 bounds_lon(n,i + j * zoom_ni_client) = bounds_lon_temp( n, (i + zoom_ibegin_client - ibegin) + (j + zoom_jbegin_client -jbegin)*ni ); 437 bounds_lat(n,i + j * zoom_ni_client) = bounds_lat_temp( n, (i + zoom_ibegin_client - ibegin)+(j + zoom_jbegin_client -jbegin)*ni ); 438 } 439 } 457 440 } 458 441 } 459 }442 } 460 443 461 //----------------------------------------------------------------462 463 void CDomain::completeLonLatServer(void)464 {465 CArray<double,1> lonvalue_temp ;466 CArray<double,1> latvalue_temp ;467 468 const int ibegin_serv = ibegin.getValue(),469 jbegin_serv = jbegin.getValue(),470 zoom_ni_serv = zoom_ni_loc.getValue(),471 zoom_nj_serv = zoom_nj_loc.getValue(),472 ibegin_zoom_srv = zoom_ibegin_loc.getValue(),473 jbegin_zoom_srv = zoom_jbegin_loc.getValue();474 475 476 if (this->data_dim.getValue() == 2)477 {478 StdSize dm = zoom_ni_serv * zoom_nj_serv;479 480 lonvalue_temp.resize(dm);481 latvalue_temp.resize(dm);482 483 for (StdSize k = 0; k < lonvalue_sub.size(); k++)484 {485 CArray<double,1> lonvalue_loc(*(lonvalue_sub[k])) ;486 CArray<double,1> latvalue_loc (*(latvalue_sub[k]));487 488 const int zoom_ibegin_cl = ibegin_zoom_sub[k], zoom_ni_cl = ni_zoom_sub[k],489 zoom_jbegin_cl = jbegin_zoom_sub[k], zoom_nj_cl = nj_zoom_sub[k],490 ibegin_cl = ibegin_sub[k] ,491 jbegin_cl = jbegin_sub[k] ,492 ni_cl = iend_sub[k] - ibegin_sub[k] + 1;493 494 for (int i = 0; i < zoom_ni_cl; i++)495 {496 for (int j = 0; j < zoom_nj_cl; j++)497 {498 int ii = i + (ibegin_cl-1) - (ibegin_serv - 1) + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1);499 int jj = j + (jbegin_cl-1) - (jbegin_serv - 1) + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1);500 lonvalue_temp(ii + jj * zoom_ni_serv) = lonvalue_loc(i + j * zoom_ni_cl);501 latvalue_temp(ii + jj * zoom_ni_serv) = latvalue_loc(i + j * zoom_ni_cl);502 }503 }504 }505 506 lonvalue.reference(lonvalue_temp.copy()) ;507 latvalue.reference(latvalue_temp.copy()) ;508 }509 else510 {511 lonvalue_temp.resize(zoom_ni_serv);512 latvalue_temp.resize(zoom_nj_serv);513 514 for (StdSize k = 0; k < lonvalue_sub.size(); k++)515 {516 CArray<double,1> lonvalue_loc(*(lonvalue_sub[k]));517 CArray<double,1> latvalue_loc(*(latvalue_sub[k]));518 519 const int zoom_ibegin_cl = ibegin_zoom_sub[k], zoom_ni_cl = ni_zoom_sub[k],520 zoom_jbegin_cl = jbegin_zoom_sub[k], zoom_nj_cl = nj_zoom_sub[k];521 522 for (int i = 0; i < zoom_ni_cl; i++)523 lonvalue_temp(i /*- (ibegin_serv - 1)*/ + (zoom_ibegin_cl - 1) - (ibegin_zoom_srv - 1)) = lonvalue_loc(i);524 525 for (int j = 0; j < zoom_nj_cl; j++)526 latvalue_temp(j /*- (jbegin_serv - 1)*/ + (zoom_jbegin_cl - 1) - (jbegin_zoom_srv - 1)) = latvalue_loc(j);527 }528 lonvalue.reference(lonvalue_temp.copy()) ;529 latvalue.reference(latvalue_temp.copy()) ;530 }531 }532 444 533 445 //---------------------------------------------------------------- … … 547 459 else 548 460 { 549 int zoom_iend = zoom_ibegin .getValue() + zoom_ni.getValue()- 1;550 int zoom_jend = zoom_jbegin .getValue() + zoom_nj.getValue()- 1;461 int zoom_iend = zoom_ibegin + zoom_ni - 1; 462 int zoom_jend = zoom_jbegin + zoom_nj - 1; 551 463 552 if (zoom_ibegin.getValue() < 1 || zoom_jbegin.getValue() < 1 || 553 zoom_iend > ni_glo.getValue() || zoom_jend > nj_glo.getValue()) 464 if (zoom_ibegin < 1 || zoom_jbegin < 1 || zoom_iend > ni_glo || zoom_jend > nj_glo) 554 465 ERROR("CDomain::checkZoom(void)", 555 466 << "Zoom is wrong defined," … … 559 470 else 560 471 { 561 this->zoom_ni.setValue(this->ni_glo.getValue()); 562 this->zoom_nj.setValue(this->nj_glo.getValue()); 563 this->zoom_ibegin.setValue(1); 564 this->zoom_jbegin.setValue(1); 565 } 566 // Résolution des données locales de zoom. 567 { 568 int zoom_iend = zoom_ibegin.getValue() + zoom_ni.getValue() - 1; 569 int zoom_jend = zoom_jbegin.getValue() + zoom_nj.getValue() - 1; 472 zoom_ni = ni_glo; 473 zoom_nj = nj_glo; 474 zoom_ibegin = 1; 475 zoom_jbegin = 1; 476 } 477 478 // compute client zoom indices 479 480 int zoom_iend=zoom_ibegin+zoom_ni-1 ; 481 zoom_ibegin_client = ibegin_client > zoom_ibegin ? ibegin_client : zoom_ibegin ; 482 zoom_iend_client = iend_client < zoom_iend ? iend_client : zoom_iend ; 483 zoom_ni_client=zoom_iend_client-zoom_ibegin_client+1 ; 484 if (zoom_ni_client<0) zoom_ni_client=0 ; 485 486 487 int zoom_jend=zoom_jbegin+zoom_nj-1 ; 488 zoom_jbegin_client = jbegin_client > zoom_jbegin ? jbegin_client : zoom_jbegin ; 489 zoom_jend_client = jend_client < zoom_jend ? jend_client : zoom_jend ; 490 zoom_nj_client=zoom_jend_client-zoom_jbegin_client+1 ; 491 if (zoom_nj_client<0) zoom_nj_client=0 ; 492 493 cout << zoom_ibegin<<" "<<zoom_ni <<" "<< zoom_jbegin<<" "<<zoom_nj<<endl ; 494 cout << zoom_ibegin_client<<" "<<zoom_ni_client <<" "<< zoom_jbegin_client<<" "<<zoom_nj_client<<endl ; 495 cout << ibegin_client<<" "<<iend_client <<" "<< jbegin_client<<" "<<jend_client<<endl ; 496 /* 497 { 498 int zoom_iend = zoom_ibegin + zoom_ni - 1; 499 int zoom_jend = zoom_jbegin + zoom_nj - 1; 570 500 571 if ((zoom_ibegin.getValue() > iend.getValue()) || 572 (zoom_iend < ibegin.getValue())) 573 { 574 zoom_ni_loc.setValue(0); 575 zoom_ibegin_loc.setValue(zoom_ibegin.getValue()); 501 if ( zoom_ibegin > iend || zoom_iend < ibegin ) 502 { 503 zoom_ni_loc = 0 ; 504 zoom_ibegin_loc = zoom_ibegin ; 576 505 } 577 506 else 578 507 { 579 int zoom_ibegin_loc_ = (zoom_ibegin.getValue() > ibegin.getValue()) 580 ? zoom_ibegin.getValue() 581 : ibegin.getValue(); 582 int zoom_iend_loc_ = (zoom_iend < iend.getValue()) 583 ? zoom_iend 584 : iend.getValue(); 508 int zoom_ibegin_loc_ = (zoom_ibegin > ibegin) ? zoom_ibegin : ibegin ; 509 int zoom_iend_loc_ = (zoom_iend < iend) ? zoom_iend : iend ; 585 510 int zoom_ni_loc_ = zoom_iend_loc_ - zoom_ibegin_loc_ + 1; 586 511 587 zoom_ni_loc .setValue(zoom_ni_loc_);588 zoom_ibegin_loc .setValue(zoom_ibegin_loc_-ibegin.getValue()+1);512 zoom_ni_loc = zoom_ni_loc_; 513 zoom_ibegin_loc = zoom_ibegin_loc_-ibegin.getValue()+1; 589 514 } 590 515 591 if ((zoom_jbegin.getValue() > jend.getValue()) || 592 (zoom_jend < jbegin.getValue())) 593 { 594 zoom_nj_loc.setValue(0); 595 zoom_jbegin_loc.setValue(zoom_jbegin.getValue()); 516 if ( zoom_jbegin > jend || zoom_jend < jbegin ) 517 { 518 zoom_nj_loc = 0 ; 519 zoom_jbegin_loc = zoom_jbegin ; 596 520 } 597 521 else 598 522 { 599 int zoom_jbegin_loc_ = (zoom_jbegin.getValue() > jbegin.getValue()) 600 ? zoom_jbegin.getValue() 601 : jbegin.getValue(); 602 int zoom_jend_loc_ = (zoom_jend < jend.getValue()) 603 ? zoom_jend 604 : jend.getValue(); 523 int zoom_jbegin_loc_ = ( zoom_jbegin > jbegin ) ? zoom_jbegin : jbegin ; 524 int zoom_jend_loc_ = (zoom_jend < jend) ? zoom_jend : jend ; 605 525 int zoom_nj_loc_ = zoom_jend_loc_ - zoom_jbegin_loc_ + 1; 606 526 607 zoom_nj_loc.setValue(zoom_nj_loc_); 608 zoom_jbegin_loc.setValue(zoom_jbegin_loc_-jbegin.getValue()+1); 609 } 610 } 611 } 612 527 zoom_nj_loc = zoom_nj_loc_; 528 zoom_jbegin_loc = zoom_jbegin_loc_-jbegin.getValue()+1; 529 } 530 } 531 */ 532 } 533 534 void CDomain::checkBounds(void) 535 { 536 if (!nvertex.isEmpty() && !bounds_lon.isEmpty() && !bounds_lat.isEmpty()) 537 { 538 hasBounds=true ; 539 540 } 541 else 542 { 543 hasBounds=false; 544 nvertex=0 ; 545 } 546 } 547 613 548 //---------------------------------------------------------------- 614 549 … … 623 558 624 559 this->checkZoom(); 560 this->checkBounds(); 625 561 626 562 if (context->hasClient) … … 629 565 this->checkDomainData(); 630 566 this->checkCompression(); 631 632 this->ibegin_sub.push_back(this->ibegin.getValue()); 633 this->jbegin_sub.push_back(this->jbegin.getValue()); 634 this->iend_sub.push_back(this->iend.getValue()); 635 this->jend_sub.push_back(this->jend.getValue()); 636 637 this->ibegin_zoom_sub.push_back(this->zoom_ibegin_loc.getValue()); 638 this->jbegin_zoom_sub.push_back(this->zoom_jbegin_loc.getValue()); 639 this->ni_zoom_sub.push_back(this->zoom_ni_loc.getValue()); 640 this->nj_zoom_sub.push_back(this->zoom_nj_loc.getValue()); 641 642 this->latvalue_sub.push_back(new CArray<double,1>(latvalue.copy())); 643 this->lonvalue_sub.push_back(new CArray<double,1>(lonvalue.copy())); 644 645 646 // if (!this->isEmpty()) 647 // { 648 this->completeLonLatClient(); 649 // } 650 this->completeMask(); 651 567 this->completeLonLatClient(); 652 568 } 653 569 else … … 722 638 CContextClient* client=context->client ; 723 639 int nbServer=client->serverSize ; 724 640 641 /* 725 642 // compute client zoom indices 726 643 int zoom_iend=zoom_ibegin.getValue()+zoom_ni.getValue()-1 ; … … 735 652 zoom_nj_client=zoom_jend_client-zoom_jbegin_client+1 ; 736 653 if (zoom_nj_client<0) zoom_nj_client=0 ; 737 654 */ 738 655 // find how much client are connected to a server 656 int zoom_iend=zoom_ibegin+zoom_ni-1 ; 657 int zoom_jend=zoom_jbegin+zoom_nj-1 ; 658 739 659 jend_srv=0 ; 740 660 for(int ns=0;ns<nbServer;ns++) … … 747 667 ib = ibegin_client>ibegin_srv ? ibegin_client : ibegin_srv ; 748 668 ie= iend_client< iend_srv? iend_client : iend_srv ; 749 in=ie-ib+1 ; 669 in=ie-ib+1 ; 750 670 if (in<0) in=0 ; 751 671 … … 837 757 838 758 list<shared_ptr<CMessage> > list_msg ; 839 list<CArray<double,1>* > list_indi,list_indj,list_lon,list_lat ; 759 list< CArray<int,1>* > list_indi,list_indj ; 760 list< CArray<double,1>* >list_lon,list_lat ; 761 list< CArray<double,2>* >list_boundslon,list_boundslat ; 840 762 841 763 for(int ns=0;ns<connectedServer.size();ns++) … … 844 766 jb=jb_srv[ns] ; je=je_srv[ns] ; jn=jn_srv[ns] ; 845 767 846 CArray< double,1> indi(in*jn) ;847 CArray< double,1> indj(in*jn) ;768 CArray<int,1> indi(in*jn) ; 769 CArray<int,1> indj(in*jn) ; 848 770 CArray<double,1> lon(in*jn) ; 849 771 CArray<double,1> lat(in*jn) ; 772 CArray<double,2> boundslon(nvertex,in*jn) ; 773 CArray<double,2> boundslat(nvertex,in*jn) ; 850 774 851 775 … … 859 783 lon(ind_loc)=lonvalue(ind_client) ; 860 784 lat(ind_loc)=latvalue(ind_client) ; 785 if (hasBounds) 786 { 787 for(int n=0;n<nvertex;n++) 788 { 789 boundslon(n,ind_loc)=bounds_lon(n,ind_client); 790 boundslat(n,ind_loc)=bounds_lat(n,ind_client); 791 } 792 } 861 793 indi(ind_loc)=i ; 862 794 indj(ind_loc)=j ; 863 795 } 864 796 865 list_indi.push_back(new CArray< double,1>(indi.copy())) ;866 list_indj.push_back(new CArray< double,1>(indj.copy())) ;797 list_indi.push_back(new CArray<int,1>(indi.copy())) ; 798 list_indj.push_back(new CArray<int,1>(indj.copy())) ; 867 799 list_lon.push_back(new CArray<double,1>(lon.copy())) ; 868 800 list_lat.push_back(new CArray<double,1>(lat.copy())) ; 801 if (hasBounds) list_boundslon.push_back(new CArray<double,2>(boundslon.copy())) ; 802 if (hasBounds) list_boundslat.push_back(new CArray<double,2>(boundslat.copy())) ; 869 803 870 804 list_msg.push_back(shared_ptr<CMessage>(new CMessage)) ; 871 805 872 *list_msg.back()<<this->getId()<<isCurvilinear ; 806 *list_msg.back()<<this->getId()<<(int)type ; // enum ne fonctionne pour les message => ToFix 807 *list_msg.back()<<isCurvilinear ; 873 808 *list_msg.back()<<*list_indi.back()<<*list_indj.back()<<*list_lon.back()<<*list_lat.back() ; 809 if (hasBounds) *list_msg.back()<<*list_boundslon.back()<<*list_boundslat.back(); 874 810 event.push(connectedServer[ns],nbSenders[ns],*list_msg.back()) ; 875 811 } … … 877 813 client->sendEvent(event) ; 878 814 879 list<CArray<double,1>* >::iterator it; 880 for(it=list_indi.begin();it!=list_indi.end();it++) delete *it; 881 for(it=list_indj.begin();it!=list_indj.end();it++) delete *it; 882 for(it=list_lon.begin();it!=list_lon.end();it++) delete *it; 883 for(it=list_lat.begin();it!=list_lat.end();it++) delete *it; 815 816 for(list<CArray<int,1>* >::iterator it=list_indi.begin();it!=list_indi.end();it++) delete *it; 817 for(list<CArray<int,1>* >::iterator it=list_indj.begin();it!=list_indj.end();it++) delete *it; 818 for(list<CArray<double,1>* >::iterator it=list_lon.begin();it!=list_lon.end();it++) delete *it; 819 for(list<CArray<double,1>* >::iterator it=list_lat.begin();it!=list_lat.end();it++) delete *it; 820 if (hasBounds) for(list<CArray<double,2>* >::iterator it=list_boundslon.begin();it!=list_boundslon.end();it++) delete *it; 821 if (hasBounds) for(list<CArray<double,2>* >::iterator it=list_boundslat.begin();it!=list_boundslat.end();it++) delete *it; 884 822 885 823 } … … 940 878 lonvalue_srv.resize(zoom_ni_srv*zoom_nj_srv) ; 941 879 latvalue_srv.resize(zoom_ni_srv*zoom_nj_srv) ; 880 if (hasBounds) bounds_lon_srv.resize(nvertex,zoom_ni_srv*zoom_nj_srv) ; 881 if (hasBounds) bounds_lat_srv.resize(nvertex,zoom_ni_srv*zoom_nj_srv) ; 942 882 } 943 883 … … 956 896 void CDomain::recvLonLat(CBufferIn& buffer) 957 897 { 958 CArray< double,1> indi ;959 CArray< double,1> indj ;898 CArray<int,1> indi ; 899 CArray<int,1> indj ; 960 900 CArray<double,1> lon ; 961 901 CArray<double,1> lat ; 962 963 buffer>>isCurvilinear>>indi>>indj>>lon>>lat ; 902 CArray<double,2> boundslon ; 903 CArray<double,2> boundslat ; 904 905 int type_int ; 906 buffer>>type_int>>isCurvilinear>>indi>>indj>>lon>>lat ; 907 if (hasBounds) buffer>>boundslon>>boundslat ; 908 type.setValue((type_attr::t_enum)type_int) ; // probleme des type enum avec les buffers : ToFix 964 909 965 910 int i,j,ind_srv ; … … 971 916 lonvalue_srv(ind_srv)=lon(ind) ; 972 917 latvalue_srv(ind_srv)=lat(ind) ; 918 if (hasBounds) 919 { 920 for(int n=0;n<nvertex;n++) 921 { 922 bounds_lon_srv(n,ind_srv)=boundslon(n,ind) ; 923 bounds_lat_srv(n,ind_srv)=boundslat(n,ind) ; 924 } 925 } 973 926 } 974 927 } 975 928 //---------------------------------------------------------------- 976 929 977 void CDomain::completeMask(void) 978 { 979 this->local_mask.resize(zoom_ni_loc,zoom_nj_loc); 980 } 981 982 //---------------------------------------------------------------- 983 984 CArray<int,2> CDomain::getLocalMask(void) const 985 { 986 return (this->local_mask); 987 } 988 989 //---------------------------------------------------------------- 990 991 const std::vector<int> & CDomain::getIBeginSub(void) const 992 { 993 return (this->ibegin_sub); 994 } 995 996 //---------------------------------------------------------------- 997 998 const std::vector<int> & CDomain::getIBeginZoomSub(void) const 999 { 1000 return (this->ibegin_zoom_sub); 1001 } 1002 1003 const std::vector<int> & CDomain::getNiZoomSub(void) const 1004 { 1005 return (this->ni_zoom_sub); 1006 } 1007 1008 //---------------------------------------------------------------- 1009 1010 const std::vector<int> & CDomain::getIEndSub(void) const 1011 { 1012 return (this->iend_sub); 1013 } 1014 1015 //---------------------------------------------------------------- 1016 1017 const std::vector<int> & CDomain::getJBeginSub(void) const 1018 { 1019 return (this->jbegin_sub); 1020 } 1021 1022 //---------------------------------------------------------------- 1023 1024 const std::vector<int> & CDomain::getJBeginZoomSub(void) const 1025 { 1026 return (this->jbegin_zoom_sub); 1027 } 1028 1029 const std::vector<int> & CDomain::getNjZoomSub(void) const 1030 { 1031 return (this->nj_zoom_sub); 1032 } 1033 1034 1035 //---------------------------------------------------------------- 1036 1037 const std::vector<int> & CDomain::getJEndSub(void) const 1038 { 1039 return (this->jend_sub); 1040 } 1041 1042 //---------------------------------------------------------------- 1043 1044 const std::vector<CArray<double, 1>* > & CDomain::getLonValueSub(void) const 1045 { 1046 return (this->lonvalue_sub); 1047 } 1048 1049 //---------------------------------------------------------------- 1050 1051 const std::vector<CArray<double,1>*> & CDomain::getLatValueSub(void) const 1052 { 1053 return (this->latvalue_sub); 1054 } 930 1055 931 1056 932 ///---------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.