Changeset 2206 for XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp
- Timestamp:
- 08/24/21 13:48:12 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp
r2203 r2206 400 400 CATCH_DUMP_ATTR 401 401 402 CDomain* CGrid::getAssociatedDomain(const string& domainId )402 CDomain* CGrid::getAssociatedDomain(const string& domainId, bool noError) 403 403 { 404 404 const regex r("\\[[0-9]*\\]"); … … 413 413 } 414 414 std::vector<CDomain*> domainList = this->getDomains(); 415 if (domainList.empty()) ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"no domain is compsing the grid"); 415 if (domainList.empty()) 416 if (noError) return nullptr ; 417 else ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"no domain is composing the grid"); 416 418 if (id.empty()) 417 419 { … … 419 421 { 420 422 if (domainList.size()==1) return domainList[0] ; 421 else ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"the grid contain more than 1 domain, use [#n] to specify which one must be retrieved"); 423 else 424 if (noError) return nullptr ; 425 else ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"the grid contain more than 1 domain, use [#n] to specify which one must be retrieved"); 422 426 } 423 427 else 424 428 { 425 429 if (domainList.size()>pos) return domainList[pos] ; 430 else if (noError) return nullptr ; 426 431 else ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"the position of the requested domain [ pos = "<<pos 427 432 <<" ] is greater than the number of domain composing the grid [ numDomain = "<<domainList.size()<<" ]"); … … 434 439 int nbDomain=0 ; 435 440 for(int i=0; i<domainList.size();i++) if (domainList[i]->getTemplateId()==id) nbDomain++ ; 436 if (nbDomain>1) ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"no domain with the id = "<<id 441 if (nbDomain>1) 442 if (noError) return nullptr ; 443 else ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"no domain with the id = "<<id 437 444 <<" is composing the grid") ; 438 if (nbDomain==0) ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"the grid contain more than 1 domain with the id = " 445 if (nbDomain==0) 446 if (noError) return nullptr ; 447 else ERROR("CGrid::getAssociatedDomain(const string& domainId)", <<"the grid contain more than 1 domain with the id = " 439 448 <<id<<" , use [#n] to specify which one must be retrieved") ; 440 449 for(int i=0; i<domainList.size();i++) if (domainList[i]->getTemplateId()==id) return domainList[i] ; … … 448 457 currentPos++ ; 449 458 } 450 ERROR("CGrid::getAssociatedDomain(const string& domainId)",<<"Cannot find domain with [ id = "<< id <<" ] at [ pos = "<<pos<<" ] in the grid"); 459 if (noError) return nullptr ; 460 else ERROR("CGrid::getAssociatedDomain(const string& domainId)",<<"Cannot find domain with [ id = "<< id <<" ] at [ pos = "<<pos<<" ] in the grid"); 451 461 } 452 462 } 453 463 } 454 464 455 CAxis* CGrid::getAssociatedAxis(const string& axisId )465 CAxis* CGrid::getAssociatedAxis(const string& axisId, bool noError) 456 466 { 457 467 const regex r("\\[[0-9]*\\]"); … … 466 476 } 467 477 std::vector<CAxis*> axisList = this->getAxis(); 468 if (axisList.empty()) ERROR("CGrid::getAssociatedAxis(const string& AxisId)", <<"no axis is composing the grid"); 478 if (axisList.empty()) 479 if (noError) return nullptr; 480 else ERROR("CGrid::getAssociatedAxis(const string& AxisId)", <<"no axis is composing the grid"); 469 481 if (id.empty()) 470 482 { … … 472 484 { 473 485 if (axisList.size()==1) return axisList[0] ; 474 else ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<"the grid contain more than 1 axis, use [#n] to specify which one must be retrieved"); 486 else 487 if (noError) return nullptr; 488 else ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<"the grid contain more than 1 axis, use [#n] to specify which one must be retrieved"); 475 489 } 476 490 else 477 491 { 478 492 if (axisList.size()>pos) return axisList[pos] ; 479 else ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<"the position of the requested axis [ pos = "<<pos 493 else 494 if (noError) return nullptr; 495 else ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<"the position of the requested axis [ pos = "<<pos 480 496 <<" ] is greater than the number of axis composing the grid [ numAxis = "<<axisList.size()<<" ]"); 481 497 } … … 487 503 int nbAxis=0 ; 488 504 for(int i=0; i<axisList.size();i++) if (axisList[i]->getTemplateId()==id) nbAxis++ ; 489 if (nbAxis>1) ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<"no axis with the id = "<<id 505 if (nbAxis>1) 506 if (noError) return nullptr; 507 else ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<"no axis with the id = "<<id 490 508 <<" is composing the grid") ; 491 if (nbAxis==0) ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<"the grid contain more than 1 axis with the id = " 509 if (nbAxis==0) 510 if (noError) return nullptr; 511 else ERROR("CGrid::getAssociatedAxis(const string& axisId)", <<"the grid contain more than 1 axis with the id = " 492 512 <<id<<" , use [#n] to specify which one must be retrieved") ; 493 513 for(int i=0; i<axisList.size();i++) if (axisList[i]->getTemplateId()==id) return axisList[i] ; … … 501 521 currentPos++ ; 502 522 } 503 ERROR("CGrid::getAssociatedAxis(const string& axisId)",<<"Cannot find axis with [ id = "<< id <<" ] at [ pos = "<<pos<<" ] in the grid"); 523 if (noError) return nullptr; 524 else ERROR("CGrid::getAssociatedAxis(const string& axisId)",<<"Cannot find axis with [ id = "<< id <<" ] at [ pos = "<<pos<<" ] in the grid"); 504 525 } 505 526 } 506 527 } 507 528 508 CScalar* CGrid::getAssociatedScalar(const string& scalarId )529 CScalar* CGrid::getAssociatedScalar(const string& scalarId, bool noError) 509 530 { 510 531 const regex r("\\[[0-9]*\\]"); … … 519 540 } 520 541 std::vector<CScalar*> scalarList = this->getScalars(); 521 if (scalarList.empty()) ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"no scalar is composing the grid"); 542 if (scalarList.empty()) 543 if (noError) return nullptr; 544 else ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"no scalar is composing the grid"); 522 545 if (id.empty()) 523 546 { … … 525 548 { 526 549 if (scalarList.size()==1) return scalarList[0] ; 527 else ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"the grid contain more than 1 scalar, use [#n] to specify which one must be retrieved"); 550 else 551 if (noError) return nullptr; 552 else ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"the grid contain more than 1 scalar, use [#n] to specify which one must be retrieved"); 528 553 } 529 554 else 530 555 { 531 556 if (scalarList.size()>pos) return scalarList[pos] ; 532 else ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"the position of the requested scalar [ pos = "<<pos 557 else 558 if (noError) return nullptr; 559 else ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"the position of the requested scalar [ pos = "<<pos 533 560 <<" ] is greater than the number of scalar composing the grid [ numScalar = "<<scalarList.size()<<" ]"); 534 561 } … … 540 567 int nbScalar=0 ; 541 568 for(int i=0; i<scalarList.size();i++) if (scalarList[i]->getTemplateId()==id) nbScalar++ ; 542 if (nbScalar>1) ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"no scalar with the id = "<<id 569 if (nbScalar>1) 570 if (noError) return nullptr; 571 else ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"no scalar with the id = "<<id 543 572 <<" is composing the grid") ; 544 if (nbScalar==0) ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"the grid contain more than 1 scalar with the id = " 573 if (nbScalar==0) 574 if (noError) return nullptr; 575 else ERROR("CGrid::getAssociatedScalar(const string& scalarId)", <<"the grid contain more than 1 scalar with the id = " 545 576 <<id<<" , use [#n] to specify which one must be retrieved") ; 546 577 for(int i=0; i<scalarList.size();i++) if (scalarList[i]->getTemplateId()==id) return scalarList[i] ; … … 554 585 currentPos++ ; 555 586 } 556 ERROR("CGrid::getAssociatedScalar(const string& scalarId)",<<"Cannot find scalar with [ id = "<< id <<" ] at [ pos = "<<pos<<" ] in the grid"); 587 if (noError) return nullptr; 588 else ERROR("CGrid::getAssociatedScalar(const string& scalarId)",<<"Cannot find scalar with [ id = "<< id <<" ] at [ pos = "<<pos<<" ] in the grid"); 557 589 } 558 590 } … … 1774 1806 pScalar->solveInheritanceTransformation(); 1775 1807 } 1808 } 1809 CATCH_DUMP_ATTR 1810 1811 bool CGrid::activateFieldWorkflow(CGarbageCollector& gc) 1812 TRY 1813 { 1814 setDomainList(); 1815 for (auto domainId : domList_) 1816 { 1817 CDomain* pDom = CDomain::get(domainId); 1818 bool ret = pDom->activateFieldWorkflow(gc); 1819 if (!ret) return false ; 1820 } 1821 1822 setAxisList(); 1823 for (auto axisId : axisList_) 1824 { 1825 CAxis* pAxis = CAxis::get(axisId); 1826 bool ret = pAxis->activateFieldWorkflow(gc); 1827 if (!ret) return false ; 1828 } 1829 1830 setScalarList(); 1831 for (auto scalarId : scalarList_) 1832 { 1833 CScalar* pScalar = CScalar::get(scalarId); 1834 bool ret = pScalar->activateFieldWorkflow(gc); 1835 if (!ret) return false ; 1836 } 1837 return true ; 1776 1838 } 1777 1839 CATCH_DUMP_ATTR
Note: See TracChangeset
for help on using the changeset viewer.