source: XIOS/trunk/src/cxios.cpp @ 317

Last change on this file since 317 was 317, checked in by ymipsl, 12 years ago

Buffer client and buffer size may now be defining from iodex.xml file.
Defaults values are also specified.

YM

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1
2#include "xmlioserver_spl.hpp"
3#include "cxios.hpp"
4#include "client_ym.hpp"
5#include "server_ym.hpp"
6#include "tree_manager.hpp"
7#include <boost/functional/hash.hpp>
8#include <mpi.h>
9
10namespace xmlioserver
11{
12  string CXios::rootFile="./iodef.xml" ;
13  string CXios::xiosCodeId="xios.x" ;
14 
15  bool CXios::isClient ;
16  bool CXios::isServer ;
17  MPI_Comm CXios::globalComm ;
18  bool CXios::usingOasis ;
19  bool CXios::usingServer ;   
20  size_t CXios::bufferSize ;
21  double CXios::bufferServerFactorSize=2 ;
22  size_t CXios::defaultBufferSize=1024*1024*100 ; // 100Mo
23  double CXios::defaultBufferServerFactorSize=2 ;
24 
25  void CXios::initialize()
26  {
27    tree::CTreeManager::ParseFile(rootFile);
28    usingServer=getin<bool>("using_server",false) ;
29    usingOasis=getin<bool>("using_oasis",false) ;
30    info.setLevel(getin<int>("info_level",0)) ;
31    bufferSize=getin<size_t>("buffer_size",defaultBufferSize) ;
32    bufferServerFactorSize=getin<double>("buffer_server_factor_size",defaultBufferServerFactorSize) ;
33    globalComm=MPI_COMM_WORLD ;
34  }
35
36
37  void CXios::initClientSide(const string& codeId, MPI_Comm& localComm, MPI_Comm& returnComm)
38  {
39     
40    initialize() ;
41   
42    isClient=true;
43    if (usingServer) isServer=false;
44    else isServer=true ;
45   
46    ym::CClient::initialize(codeId,localComm,returnComm) ;
47
48  }   
49
50  void CXios::clientFinalize(void)
51  {
52     ym::CClient::finalize() ;   
53  }   
54 
55 
56  void CXios::initServerSide(void)
57  {
58    initialize();
59
60    if (!usingServer) ERROR("void CXios::initServerSide(void)",<<"using_server is set to <false> and server initialization is called") ;
61    isClient=true;
62    isServer=false ;
63
64    ym::CServer::initialize() ;
65  } 
66 
67
68}
Note: See TracBrowser for help on using the repository browser.