Changeset 823 for XIOS/trunk/src/node/field.cpp
- Timestamp:
- 02/16/16 10:14:23 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/node/field.cpp
r790 r823 34 34 , nstep(0), nstepMax(0) 35 35 , hasOutputFile(false) 36 , domAxisIds_("", ""), areAllReferenceSolved(false) 36 , domAxisIds_("", ""), areAllReferenceSolved(false), isReferenceSolved(false) 37 37 , useCompressedOutput(false) 38 38 , isReadDataRequestPending(false) … … 45 45 , nstep(0), nstepMax(0) 46 46 , hasOutputFile(false) 47 , domAxisIds_("", ""), areAllReferenceSolved(false) 47 , domAxisIds_("", ""), areAllReferenceSolved(false), isReferenceSolved(false) 48 48 , useCompressedOutput(false) 49 49 , isReadDataRequestPending(false) … … 492 492 //---------------------------------------------------------------- 493 493 494 void CField::solve AllReferenceEnabledField(bool doSending2Sever)494 void CField::solveOnlyReferenceEnabledField(bool doSending2Server) 495 495 { 496 496 CContext* context = CContext::getCurrent(); 497 if (!isReferenceSolved) 498 { 499 isReferenceSolved = true; 500 501 if (context->hasClient) 502 { 503 solveRefInheritance(true); 504 if (hasDirectFieldReference()) getDirectFieldReference()->solveOnlyReferenceEnabledField(false); 505 } 506 else if (context->hasServer) 507 solveServerOperation(); 508 509 solveGridReference(); 510 511 if (context->hasClient) 512 { 513 solveGenerateGrid(); 514 buildGridTransformationGraph(); 515 } 516 } 517 } 518 519 /*! 520 Build up graph of grids which plays role of destination and source in grid transformation 521 This function should be called before \func solveGridReference() 522 */ 523 void CField::buildGridTransformationGraph() 524 { 525 CContext* context = CContext::getCurrent(); 526 if (context->hasClient) 527 { 528 if (grid && !grid->isTransformed() && hasDirectFieldReference() && grid != getDirectFieldReference()->grid) 529 { 530 grid->addTransGridSource(getDirectFieldReference()->grid); 531 } 532 } 533 } 534 535 /*! 536 Generate a new grid destination if there are more than one grid source pointing to a same grid destination 537 */ 538 void CField::generateNewTransformationGridDest() 539 { 540 CContext* context = CContext::getCurrent(); 541 if (context->hasClient) 542 { 543 std::map<CGrid*,std::pair<bool,StdString> >& gridSrcMap = grid->getTransGridSource(); 544 if (1 < gridSrcMap.size()) 545 { 546 // Search for grid source 547 CGrid* gridSrc = grid; 548 CField* currField = this; 549 std::vector<CField*> hieraField; 550 551 while (currField->hasDirectFieldReference() && (gridSrc == grid)) 552 { 553 hieraField.push_back(currField); 554 CField* tmp = currField->getDirectFieldReference(); 555 currField = tmp; 556 gridSrc = currField->grid; 557 } 558 559 if (gridSrcMap.end() != gridSrcMap.find(gridSrc)) 560 { 561 CGrid* gridTmp; 562 std::pair<bool,StdString> newGridDest = gridSrcMap[gridSrc]; 563 if (newGridDest.first) 564 { 565 StdString newIdGridDest = newGridDest.second; 566 if (!CGrid::has(newIdGridDest)) 567 { 568 ERROR("CGrid* CGrid::generateNewTransformationGridDest()", 569 << " Something wrong happened! Grid whose id " << newIdGridDest 570 << "should exist "); 571 } 572 gridTmp = CGrid::get(newIdGridDest); 573 } 574 else 575 { 576 StdString newIdGridDest = CGrid::generateId(gridSrc, grid); 577 gridTmp = CGrid::cloneGrid(newIdGridDest, grid); 578 579 (gridSrcMap[gridSrc]).first = true; 580 (gridSrcMap[gridSrc]).second = newIdGridDest; 581 } 582 583 // Update all descendants 584 for (std::vector<CField*>::iterator it = hieraField.begin(); it != hieraField.end(); ++it) 585 { 586 (*it)->grid = gridTmp; 587 (*it)->updateRef((*it)->grid); 588 } 589 } 590 } 591 } 592 } 593 594 void CField::updateRef(CGrid* grid) 595 { 596 if (!grid_ref.isEmpty()) grid_ref.setValue(grid->getId()); 597 else 598 { 599 std::vector<CAxis*> axisTmp = grid->getAxis(); 600 std::vector<CDomain*> domainTmp = grid->getDomains(); 601 if ((1<axisTmp.size()) || (1<domainTmp.size())) 602 ERROR("void CField::updateRef(CGrid* grid)", 603 << "More than one domain or axis is available for domain_ref/axis_ref of field " << this->getId()); 604 605 if ((!domain_ref.isEmpty()) && (domainTmp.empty())) 606 ERROR("void CField::updateRef(CGrid* grid)", 607 << "Incoherent between available domain and domain_ref of field " << this->getId()); 608 if ((!axis_ref.isEmpty()) && (axisTmp.empty())) 609 ERROR("void CField::updateRef(CGrid* grid)", 610 << "Incoherent between available axis and axis_ref of field " << this->getId()); 611 612 if (!domain_ref.isEmpty()) domain_ref.setValue(domainTmp[0]->getId()); 613 if (!axis_ref.isEmpty()) axis_ref.setValue(axisTmp[0]->getId()); 614 } 615 } 616 617 void CField::solveAllReferenceEnabledField(bool doSending2Server) 618 { 619 CContext* context = CContext::getCurrent(); 620 solveOnlyReferenceEnabledField(doSending2Server); 621 497 622 if (!areAllReferenceSolved) 498 623 { … … 509 634 solveGridReference(); 510 635 } 511 if (context->hasClient) 512 { 513 solveGenerateGrid(); 514 } 515 516 solveGridDomainAxisRef(doSending2Sever); 636 637 solveGridDomainAxisRef(doSending2Server); 517 638 518 639 if (context->hasClient) … … 521 642 } 522 643 523 solveCheckMaskIndex(doSending2Se ver);644 solveCheckMaskIndex(doSending2Server); 524 645 } 525 646 … … 773 894 if (!domain_ref.isEmpty()) 774 895 { 896 StdString tmp = domain_ref.getValue(); 775 897 if (CDomain::has(domain_ref)) 776 898 vecDom.push_back(CDomain::get(domain_ref));
Note: See TracChangeset
for help on using the changeset viewer.