Changeset 823 for XIOS/trunk
- Timestamp:
- 02/16/16 10:14:23 (8 years ago)
- Location:
- XIOS/trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/inputs/REMAP/iodef.xml
r821 r823 14 14 <field id="dst_field_regular" operation="instant" field_ref="tmp_field_2" grid_ref="dst_grid_regular" read_access="true"/> 15 15 <field id="dst_field_regular_pole" operation="instant" field_ref="src_field" domain_ref="dst_domain_regular_pole"/> 16 <field id="dst_field_regular_pole_1" operation="instant" field_ref="tmp_field" domain_ref="dst_domain_regular_pole"/> 16 17 </field_definition> 17 18 … … 27 28 <field field_ref="dst_field_regular_pole" name="field" /> 28 29 </file> 30 <file id="out_dst_regular_pole_1" name="out_dst_regular_pole_1" type="one_file"> 31 <field field_ref="dst_field_regular_pole_1" name="field" /> 32 </file> 29 33 <file id="output_dst_regular" name="output_dst_regular" type="one_file"> 30 34 <field field_ref="dst_field_regular" name="field" /> … … 39 43 <field id="src_field_regular_tmp" name="field" domain_ref="src_domain_regular_tmp" operation="instant"/> 40 44 </file> 41 42 45 <file id="output_src_curvilinear" name="output_src_curvilinear" mode="read" type="one_file"> 43 46 <field id="src_field_curvilinear" name="field_A" grid_ref="src_grid_curvilinear" operation="instant"/> -
XIOS/trunk/src/node/axis.cpp
r821 r823 911 911 } 912 912 913 void CAxis::duplicateTransformation(CAxis* src) 914 { 915 if (src->hasTransformation()) 916 { 917 this->setTransformations(src->getAllTransformations()); 918 } 919 } 920 913 921 /*! 914 922 * Go through the hierarchy to find the axis from which the transformations must be inherited -
XIOS/trunk/src/node/axis.hpp
r821 r823 113 113 TransMapTypes getAllTransformations(); 114 114 void fillInValues(const CArray<double,1>& values); 115 void duplicateTransformation(CAxis*); \ 115 116 116 117 public: -
XIOS/trunk/src/node/context.cpp
r806 r823 451 451 for (unsigned int i = 0; i < this->enabledReadModeFiles.size(); ++i) 452 452 (void)this->enabledReadModeFiles[i]->readAttributesOfEnabledFieldsInReadMode(); 453 } 454 455 void CContext::solveOnlyRefOfEnabledFields(bool sendToServer) 456 { 457 int size = this->enabledFiles.size(); 458 for (int i = 0; i < size; ++i) 459 { 460 this->enabledFiles[i]->solveOnlyRefOfEnabledFields(sendToServer); 461 } 462 463 for (int i = 0; i < size; ++i) 464 { 465 this->enabledFiles[i]->generateNewTransformationGridDest(); 466 } 453 467 } 454 468 … … 804 818 this->readAttributesOfEnabledFieldsInReadModeFiles(); 805 819 } 820 821 // Only search and rebuild all reference objects of enable fields, don't transform 822 this->solveOnlyRefOfEnabledFields(false); 823 806 824 // Search and rebuild all reference object of enabled fields 807 825 this->solveAllRefOfEnabledFields(false); -
XIOS/trunk/src/node/context.hpp
r775 r823 113 113 void checkAxisDomainsGridsEligibilityForCompressedOutput(); 114 114 void prepareTimeseries(void); 115 void solveOnlyRefOfEnabledFields(bool sendToServer); 115 116 void solveAllRefOfEnabledFields(bool sendToServer); 116 117 void buildFilterGraphOfEnabledFields(); -
XIOS/trunk/src/node/domain.cpp
r821 r823 1947 1947 } 1948 1948 1949 void CDomain::duplicateTransformation(CDomain* src) 1950 { 1951 if (src->hasTransformation()) 1952 { 1953 this->setTransformations(src->getAllTransformations()); 1954 } 1955 } 1956 1949 1957 /*! 1950 1958 * Go through the hierarchy to find the domain from which the transformations must be inherited -
XIOS/trunk/src/node/domain.hpp
r821 r823 78 78 TransMapTypes getAllTransformations(); 79 79 void redistribute(int nbLocalDomain); 80 void duplicateTransformation(CDomain*); 80 81 81 82 public: -
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)); -
XIOS/trunk/src/node/field.hpp
r775 r823 110 110 void solveServerOperation(void); 111 111 void solveCheckMaskIndex(bool doSendingIndex); 112 void solveAllReferenceEnabledField(bool doSending2Sever); 112 void solveAllReferenceEnabledField(bool doSending2Server); 113 void solveOnlyReferenceEnabledField(bool doSending2Server); 114 void generateNewTransformationGridDest(); 115 void updateRef(CGrid* grid); 116 void buildGridTransformationGraph(); 113 117 void solveGridDomainAxisRef(bool checkAtt); 114 118 void solveTransformedGrid(); … … 196 200 197 201 bool areAllReferenceSolved; 202 bool isReferenceSolved; 198 203 std::pair<StdString,StdString> domAxisIds_; 199 204 bool isReadDataRequestPending; -
XIOS/trunk/src/node/file.cpp
r811 r823 647 647 \param [in] sendToServer: Send all info to server (true) or only a part of it (false) 648 648 */ 649 void CFile::solveOnlyRefOfEnabledFields(bool sendToServer) 650 { 651 int size = this->enabledFields.size(); 652 for (int i = 0; i < size; ++i) 653 { 654 this->enabledFields[i]->solveOnlyReferenceEnabledField(sendToServer); 655 // this->enabledFields[i]->buildGridTransformationGraph(); 656 } 657 } 658 659 void CFile::generateNewTransformationGridDest() 660 { 661 int size = this->enabledFields.size(); 662 for (int i = 0; i < size; ++i) 663 { 664 this->enabledFields[i]->generateNewTransformationGridDest(); 665 } 666 } 667 668 /*! 669 \brief Resolve all reference of active fields. 670 In order to know exactly which data each active field has, a search for all its 671 reference to find its parents or/and its base reference object must be done. Moreover 672 during this search, there are some information that can only be sent to server AFTER 673 all information of active fields are created on server side, e.g: checking mask or index 674 \param [in] sendToServer: Send all info to server (true) or only a part of it (false) 675 */ 649 676 void CFile::solveAllRefOfEnabledFields(bool sendToServer) 650 677 { -
XIOS/trunk/src/node/file.hpp
r775 r823 106 106 void solveFieldRefInheritance(bool apply); 107 107 void processEnabledFile(void); 108 void solveOnlyRefOfEnabledFields(bool sendToServer); 109 void generateNewTransformationGridDest(); 108 110 void solveAllRefOfEnabledFields(bool sendToServer); 109 111 void buildFilterGraphOfEnabledFields(CGarbageCollector& gc); -
XIOS/trunk/src/node/grid.cpp
r821 r823 32 32 , transformations_(0), isTransformed_(false) 33 33 , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false) 34 , gridSrc_() 34 35 { 35 36 setVirtualDomainGroup(); … … 46 47 , transformations_(0), isTransformed_(false) 47 48 , axisPositionInGrid_(), positionDimensionDistributed_(1), hasDomainAxisBaseRef_(false) 49 , gridSrc_() 48 50 { 49 51 setVirtualDomainGroup(); … … 551 553 } 552 554 555 CGrid* CGrid::cloneGrid(const StdString& idNewGrid, CGrid* gridSrc) 556 { 557 std::vector<CAxis*> axisSrcTmp = gridSrc->getAxis(), axisSrc; 558 std::vector<CDomain*> domainSrcTmp = gridSrc->getDomains(), domainSrc; 559 for (int idx = 0; idx < axisSrcTmp.size(); ++idx) 560 { 561 CAxis* axis = CAxis::createAxis(); 562 axis->duplicateAttributes(axisSrcTmp[idx]); 563 axis->duplicateTransformation(axisSrcTmp[idx]); 564 axis->solveRefInheritance(true); 565 axis->solveInheritanceTransformation(); 566 axisSrc.push_back(axis); 567 } 568 569 for (int idx = 0; idx < domainSrcTmp.size(); ++idx) 570 { 571 CDomain* domain = CDomain::createDomain(); 572 domain->duplicateAttributes(domainSrcTmp[idx]); 573 domain->duplicateTransformation(domainSrcTmp[idx]); 574 domain->solveRefInheritance(true); 575 domain->solveInheritanceTransformation(); 576 domainSrc.push_back(domain); 577 } 578 579 CGrid* grid = CGrid::createGrid(idNewGrid, domainSrc, axisSrc, gridSrc->axis_domain_order); 580 581 return grid; 582 } 583 553 584 StdString CGrid::generateId(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 554 585 const CArray<bool,1>& axisDomainOrder) … … 588 619 589 620 return id.str(); 621 } 622 623 StdString CGrid::generateId(const CGrid* gridSrc, const CGrid* gridDest) 624 { 625 StdString idSrc = gridSrc->getId(); 626 StdString idDest = gridDest->getId(); 627 628 std::ostringstream id; 629 id << idSrc << "__" << idDest; 630 631 return id.str(); 590 632 } 591 633 … … 1298 1340 } 1299 1341 1342 void CGrid::addTransGridSource(CGrid* gridSrc) 1343 { 1344 if (gridSrc_.end() == gridSrc_.find(gridSrc)) 1345 gridSrc_.insert(make_pair(gridSrc,make_pair(false,""))); 1346 } 1347 1348 std::map<CGrid*,std::pair<bool,StdString> >& CGrid::getTransGridSource() 1349 { 1350 return gridSrc_; 1351 } 1352 1300 1353 /*! 1301 1354 Complete all the necessary (and lacking) attributes of a grid -
XIOS/trunk/src/node/grid.hpp
r821 r823 127 127 static StdString generateId(const std::vector<CDomain*>& domains, const std::vector<CAxis*>& axis, 128 128 const CArray<bool,1>& axisDomainOrder = CArray<bool,1>()); 129 static StdString generateId(const CGrid* gridSrc, const CGrid* gridDest); 130 static CGrid* cloneGrid(const StdString& idNewGrid, CGrid* gridSrc); 129 131 130 132 public: … … 191 193 bool isTransformed(); 192 194 void setTransformed(); 195 void addTransGridSource(CGrid* gridSrc); 196 std::map<CGrid*, std::pair<bool,StdString> >& getTransGridSource(); 193 197 194 198 public: … … 242 246 void setTransformationAlgorithms(); 243 247 244 std::vector<int> globalDim_; 248 245 249 246 250 private: … … 267 271 CGridTransformation* transformations_; 268 272 bool hasDomainAxisBaseRef_; 273 std::vector<int> globalDim_; 274 std::map<CGrid*, std::pair<bool,StdString> > gridSrc_; 269 275 }; // class CGrid 270 276 -
XIOS/trunk/src/transformation/grid_transformation.cpp
r821 r823 43 43 } 44 44 45 // std::vector<CAxis*> axisSrcTmp = gridSource_->getAxis(), axisSrc;46 // std::vector<CDomain*> domainSrcTmp = gridSource_->getDomains(), domainSrc;47 // for (int idx = 0; idx < axisSrcTmp.size(); ++idx)48 // {49 // CAxis* axis = CAxis::createAxis();50 // axis->axis_ref.setValue(axisSrcTmp[idx]->getId());51 // axis->solveRefInheritance(true);52 // axis->solveInheritanceTransformation();53 // axis->checkAttributesOnClient();54 // axisSrc.push_back(axis);55 // }56 //57 // for (int idx = 0; idx < domainSrcTmp.size(); ++idx)58 // {59 // CDomain* domain = CDomain::createDomain();60 // domain->domain_ref.setValue(domainSrcTmp[idx]->getId());61 // domain->solveRefInheritance(true);62 // domain->solveInheritanceTransformation();63 // domain->checkAttributesOnClient();64 // domainSrc.push_back(domain);65 // }66 //67 // gridSource_ = CGrid::createGrid(domainSrc, axisSrc, gridDestination_->axis_domain_order);68 // gridSource_->computeGridGlobalDimension(domainSrc, axisSrc, gridDestination_->axis_domain_order);69 70 45 initializeMappingOfOriginalGridSource(); 71 // initializeAlgorithms();72 46 } 73 47
Note: See TracChangeset
for help on using the changeset viewer.