Changeset 1158 for XIOS/dev/dev_olga/src/node/domain.cpp
- Timestamp:
- 06/06/17 17:58:16 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_olga/src/node/domain.cpp
r1144 r1158 26 26 namespace xios { 27 27 28 /// ////////////////////// D finitions ////////////////////// ///28 /// ////////////////////// Définitions ////////////////////// /// 29 29 30 30 CDomain::CDomain(void) … … 79 79 } 80 80 81 const std::set<StdString> & CDomain::getRelFiles(void) const 82 { 83 return (this->relFiles); 84 } 85 86 81 87 /*! 82 88 Returns the number of indexes written by each server. … … 170 176 { 171 177 return ((this->zoom_i_index.isEmpty()) || (0 == this->zoom_i_index.numElements())); 172 // return ((this->zoom_ni_srv == 0) || 173 // (this->zoom_nj_srv == 0)); 178 174 179 } 175 180 … … 190 195 bool CDomain::isDistributed(void) const 191 196 { 192 return!((!ni.isEmpty() && (ni == ni_glo) && !nj.isEmpty() && (nj == nj_glo)) ||197 bool distributed = !((!ni.isEmpty() && (ni == ni_glo) && !nj.isEmpty() && (nj == nj_glo)) || 193 198 (!i_index.isEmpty() && i_index.numElements() == ni_glo*nj_glo)); 199 distributed |= (1 == CContext::getCurrent()->client->clientSize); 200 201 return distributed; 194 202 } 195 203 … … 221 229 222 230 //---------------------------------------------------------------- 231 232 /*! 233 Verify if all distribution information of a domain are available 234 This checking verifies the definition of distribution attributes (ni, nj, ibegin, jbegin) 235 */ 236 bool CDomain::distributionAttributesHaveValue() const 237 { 238 bool hasValues = true; 239 240 if (ni.isEmpty() && ibegin.isEmpty() && i_index.isEmpty()) 241 { 242 hasValues = false; 243 return hasValues; 244 } 245 246 return hasValues; 247 } 223 248 224 249 /*! … … 331 356 ni.setValue(ni_glo - ibeginVec[iIdx]); 332 357 } 333 } 334 335 // Now fill other attributes 336 if (type_attr::rectilinear == type) fillInRectilinearLonLat(); 358 } 337 359 } 338 360 else // unstructured domain … … 380 402 nj.setValue(1); 381 403 } 404 405 i_index.resize(ni); 406 for(int idx = 0; idx < ni; ++idx) i_index(idx)=ibegin+idx; 382 407 } 383 408 else … … 391 416 392 417 checkDomain(); 418 } 419 420 /*! 421 Fill in longitude and latitude whose values are read from file 422 */ 423 void CDomain::fillInLonLat() 424 { 425 switch (type) 426 { 427 case type_attr::rectilinear: 428 fillInRectilinearLonLat(); 429 break; 430 case type_attr::curvilinear: 431 fillInCurvilinearLonLat(); 432 break; 433 case type_attr::unstructured: 434 fillInUnstructuredLonLat(); 435 break; 436 437 default: 438 break; 439 } 440 393 441 } 394 442 … … 468 516 } 469 517 470 471 518 /* 519 Fill in longitude and latitude of curvilinear domain read from a file 520 If there are already longitude and latitude defined by model. We just igonore reading value. 521 */ 522 void CDomain::fillInCurvilinearLonLat() 523 { 524 if (!lonvalue_curvilinear_read_from_file.isEmpty() && lonvalue_2d.isEmpty()) 525 { 526 lonvalue_2d.resize(ni,nj); 527 for (int jdx = 0; jdx < nj; ++jdx) 528 for (int idx = 0; idx < ni; ++idx) 529 lonvalue_2d(idx,jdx) = lonvalue_curvilinear_read_from_file(idx+ibegin, jdx+jbegin); 530 531 lonvalue_curvilinear_read_from_file.free(); 532 } 533 534 if (!latvalue_curvilinear_read_from_file.isEmpty() && latvalue_2d.isEmpty()) 535 { 536 latvalue_2d.resize(ni,nj); 537 for (int jdx = 0; jdx < nj; ++jdx) 538 for (int idx = 0; idx < ni; ++idx) 539 latvalue_2d(idx,jdx) = latvalue_curvilinear_read_from_file(idx+ibegin, jdx+jbegin); 540 541 latvalue_curvilinear_read_from_file.free(); 542 } 543 544 if (!bounds_lonvalue_curvilinear_read_from_file.isEmpty() && bounds_lon_2d.isEmpty()) 545 { 546 bounds_lon_2d.resize(nvertex,ni,nj); 547 for (int jdx = 0; jdx < nj; ++jdx) 548 for (int idx = 0; idx < ni; ++idx) 549 for (int ndx = 0; ndx < nvertex; ++ndx) 550 bounds_lon_2d(ndx,idx,jdx) = bounds_lonvalue_curvilinear_read_from_file(ndx,idx+ibegin, jdx+jbegin); 551 552 bounds_lonvalue_curvilinear_read_from_file.free(); 553 } 554 555 if (!bounds_latvalue_curvilinear_read_from_file.isEmpty() && bounds_lat_2d.isEmpty()) 556 { 557 bounds_lat_2d.resize(nvertex,ni,nj); 558 for (int jdx = 0; jdx < nj; ++jdx) 559 for (int idx = 0; idx < ni; ++idx) 560 for (int ndx = 0; ndx < nvertex; ++ndx) 561 bounds_lat_2d(ndx,idx,jdx) = bounds_latvalue_curvilinear_read_from_file(ndx,idx+ibegin, jdx+jbegin); 562 563 bounds_latvalue_curvilinear_read_from_file.free(); 564 } 565 566 } 567 568 /* 569 Fill in longitude and latitude of unstructured domain read from a file 570 If there are already longitude and latitude defined by model. We just igonore reading value. 571 */ 572 void CDomain::fillInUnstructuredLonLat() 573 { 574 if (i_index.isEmpty()) 575 { 576 i_index.resize(ni); 577 for(int idx = 0; idx < ni; ++idx) i_index(idx)=ibegin+idx; 578 } 579 580 if (!lonvalue_unstructured_read_from_file.isEmpty() && lonvalue_1d.isEmpty()) 581 { 582 lonvalue_1d.resize(ni); 583 for (int idx = 0; idx < ni; ++idx) 584 lonvalue_1d(idx) = lonvalue_unstructured_read_from_file(i_index(idx)); 585 586 // We dont need these values anymore, so just delete them 587 lonvalue_unstructured_read_from_file.free(); 588 } 589 590 if (!latvalue_unstructured_read_from_file.isEmpty() && latvalue_1d.isEmpty()) 591 { 592 latvalue_1d.resize(ni); 593 for (int idx = 0; idx < ni; ++idx) 594 latvalue_1d(idx) = latvalue_unstructured_read_from_file(i_index(idx)); 595 596 // We dont need these values anymore, so just delete them 597 latvalue_unstructured_read_from_file.free(); 598 } 599 600 if (!bounds_lonvalue_unstructured_read_from_file.isEmpty() && bounds_lon_1d.isEmpty()) 601 { 602 int nbVertex = nvertex; 603 bounds_lon_1d.resize(nbVertex,ni); 604 for (int idx = 0; idx < ni; ++idx) 605 for (int jdx = 0; jdx < nbVertex; ++jdx) 606 bounds_lon_1d(jdx,idx) = bounds_lonvalue_unstructured_read_from_file(jdx, i_index(idx)); 607 608 // We dont need these values anymore, so just delete them 609 lonvalue_unstructured_read_from_file.free(); 610 } 611 612 if (!bounds_latvalue_unstructured_read_from_file.isEmpty() && bounds_lat_1d.isEmpty()) 613 { 614 int nbVertex = nvertex; 615 bounds_lat_1d.resize(nbVertex,ni); 616 for (int idx = 0; idx < ni; ++idx) 617 for (int jdx = 0; jdx < nbVertex; ++jdx) 618 bounds_lat_1d(jdx,idx) = bounds_latvalue_unstructured_read_from_file(jdx, i_index(idx)); 619 620 // We dont need these values anymore, so just delete them 621 lonvalue_unstructured_read_from_file.free(); 622 } 623 } 624 625 /* 626 Get global longitude and latitude of rectilinear domain. 627 */ 472 628 void CDomain::AllgatherRectilinearLonLat(CArray<double,1>& lon, CArray<double,1>& lat, CArray<double,1>& lon_g, CArray<double,1>& lat_g) 473 629 { … … 590 746 else 591 747 { 592 if (bounds_lat_start.isEmpty()) bounds_l on_start=-90. ;748 if (bounds_lat_start.isEmpty()) bounds_lat_start=-90. ; 593 749 if (bounds_lat_end.isEmpty()) bounds_lat_end=90 ; 594 750 } … … 695 851 for (int j = 0; j < nj; ++j) 696 852 for (int i = 0; i < ni; ++i) j_index(i+j*ni) = j+jbegin; 697 } 853 } 854 698 855 checkZoom(); 699 856 } … … 1431 1588 if (context->hasClient) 1432 1589 { 1433 // this->checkMask();1434 1590 this->computeConnectedClients(); 1435 // if (hasLonLat || hasArea || isCompressible_) this->computeConnectedClients();1436 1591 if (hasLonLat) 1437 1592 if (!context->hasServer) … … 1482 1637 if (context->hasClient) 1483 1638 { 1484 // this->completeLonLatClient();1485 1639 sendAttributes(); 1486 1640 } … … 2694 2848 } 2695 2849 2696 2697 2850 /*! 2698 2851 Receive area information from client(s) … … 2742 2895 2743 2896 } 2897 } 2898 2899 /*! 2900 Compare two domain objects. 2901 They are equal if only if they have identical attributes as well as their values. 2902 Moreover, they must have the same transformations. 2903 \param [in] domain Compared domain 2904 \return result of the comparison 2905 */ 2906 bool CDomain::isEqual(CDomain* obj) 2907 { 2908 vector<StdString> excludedAttr; 2909 excludedAttr.push_back("domain_ref"); 2910 bool objEqual = SuperClass::isEqual(obj, excludedAttr); 2911 if (!objEqual) return objEqual; 2912 2913 TransMapTypes thisTrans = this->getAllTransformations(); 2914 TransMapTypes objTrans = obj->getAllTransformations(); 2915 2916 TransMapTypes::const_iterator it, itb, ite; 2917 std::vector<ETranformationType> thisTransType, objTransType; 2918 for (it = thisTrans.begin(); it != thisTrans.end(); ++it) 2919 thisTransType.push_back(it->first); 2920 for (it = objTrans.begin(); it != objTrans.end(); ++it) 2921 objTransType.push_back(it->first); 2922 2923 if (thisTransType.size() != objTransType.size()) return false; 2924 for (int idx = 0; idx < thisTransType.size(); ++idx) 2925 objEqual &= (thisTransType[idx] == objTransType[idx]); 2926 2927 return objEqual; 2744 2928 } 2745 2929
Note: See TracChangeset
for help on using the changeset viewer.