source: XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/daemons_manager.cpp @ 1878

Last change on this file since 1878 was 1878, checked in by ymipsl, 4 years ago

Coupling Branch.
Implementing a coupler scheduler, to impose order for intercommunicator creation between several coupling context.
Two way coupling is now working.

YM

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#include "daemons_manager.hpp"
2#include "cxios.hpp"
3#include "ressources_manager.hpp"
4#include "services_manager.hpp"
5#include "contexts_manager.hpp"
6#include "servers_ressource.hpp"
7#include "server.hpp"
8
9namespace xios
10{
11  using namespace std ;
12
13  CDaemonsManager::CDaemonsManager(bool isXiosServer) : isServer_(isXiosServer)
14  {
15    MPI_Comm xiosComm = CXios::getXiosComm() ;
16    int commRank ;
17    MPI_Comm_rank(xiosComm,&commRank) ;
18    MPI_Comm splitComm ;
19    MPI_Comm_split(xiosComm,isXiosServer,commRank,&splitComm) ;
20   
21    CXios::launchRessourcesManager(isXiosServer) ;
22    CXios::launchServicesManager(isXiosServer) ;
23    CXios::launchContextsManager(isXiosServer) ;
24    CXios::launchCouplerManager(isXiosServer) ;
25
26    if (isXiosServer) CServer::launchServersRessource(splitComm) ;
27    MPI_Comm_free(&splitComm) ;
28  }
29
30  CDaemonsManager::~CDaemonsManager()
31  {
32    CXios::finalizeContextsManager() ;
33    CXios::finalizeCouplerManager() ;
34    CXios::finalizeServicesManager() ;
35    CXios::finalizeRessourcesManager() ;
36  }
37
38  bool CDaemonsManager::eventLoop(void)
39  {
40    CXios::getRessourcesManager()->eventLoop() ;
41    CXios::getServicesManager()->eventLoop() ;
42    CXios::getContextsManager()->eventLoop() ;
43    if (isServer_) return CServer::getServersRessource()->eventLoop(false) ;
44    else  return CXios::getPoolRessource()->eventLoop(false) ;
45  }
46 
47  bool CDaemonsManager::servicesEventLoop(void)
48  {
49    CXios::getRessourcesManager()->eventLoop() ;
50    CXios::getServicesManager()->eventLoop() ;
51    CXios::getContextsManager()->eventLoop() ;
52    if (isServer_) return CServer::getServersRessource()->eventLoop(true) ;
53    else  return CXios::getPoolRessource()->eventLoop(true) ;
54  } 
55
56}
Note: See TracBrowser for help on using the repository browser.