Changeset 1878 for XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp
- Timestamp:
- 05/13/20 23:15:06 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp
r1875 r1878 2446 2446 TRY 2447 2447 { 2448 // juste for test now, in future need an scheduler to avoid dead-lock 2449 for(auto it=enabledCouplerOut.begin();it!=enabledCouplerOut.end();++it) 2450 { 2451 (*it)->createInterCommunicator() ; 2452 } 2453 2454 for(auto it=enabledCouplerIn.begin();it!=enabledCouplerIn.end();++it) 2455 { 2456 (*it)->createInterCommunicator() ; 2457 } 2448 int rank=this->getIntraCommRank() ; 2449 map<string,list<CCouplerOut*>> listCouplerOut ; 2450 map<string,list<CCouplerIn*>> listCouplerIn ; 2451 2452 for(auto couplerOut : enabledCouplerOut) listCouplerOut[couplerOut->getCouplingContextId()].push_back(couplerOut) ; 2453 for(auto couplerIn : enabledCouplerIn) listCouplerIn[couplerIn->getCouplingContextId()].push_back(couplerIn) ; 2454 2455 CCouplerManager* couplerManager = CXios::getCouplerManager() ; 2456 if (rank==0) 2457 { 2458 for(auto couplerOut : listCouplerOut) couplerManager->registerCoupling(this->getContextId(),couplerOut.first) ; 2459 for(auto couplerIn : listCouplerIn) couplerManager->registerCoupling(couplerIn.first,this->getContextId()) ; 2460 } 2461 2462 do 2463 { 2464 for(auto couplerOut : listCouplerOut) 2465 { 2466 bool isNextCoupling ; 2467 if (rank==0) isNextCoupling = couplerManager->isNextCoupling(this->getContextId(),couplerOut.first) ; 2468 MPI_Bcast(&isNextCoupling,1,MPI_C_BOOL, 0, getIntraComm()) ; 2469 if (isNextCoupling) 2470 { 2471 addCouplingChanel(couplerOut.first, true) ; 2472 listCouplerOut.erase(couplerOut.first) ; 2473 break ; 2474 } 2475 } 2476 for(auto couplerIn : listCouplerIn) 2477 { 2478 bool isNextCoupling ; 2479 if (rank==0) isNextCoupling = couplerManager->isNextCoupling(couplerIn.first,this->getContextId()); 2480 MPI_Bcast(&isNextCoupling,1,MPI_C_BOOL, 0, getIntraComm()) ; 2481 if (isNextCoupling) 2482 { 2483 addCouplingChanel(couplerIn.first, false) ; 2484 listCouplerIn.erase(couplerIn.first) ; 2485 break ; 2486 } 2487 } 2488 2489 } while (!listCouplerOut.empty() || !listCouplerIn.empty()) ; 2490 2458 2491 } 2459 2492 CATCH_DUMP_ATTR
Note: See TracChangeset
for help on using the changeset viewer.