1 | |
---|
2 | #include "xmlioserver_spl.hpp" |
---|
3 | #include "cxios.hpp" |
---|
4 | #include "client.hpp" |
---|
5 | #include "server.hpp" |
---|
6 | #include "xml_parser.hpp" |
---|
7 | #include <boost/functional/hash.hpp> |
---|
8 | #include <mpi.h> |
---|
9 | |
---|
10 | namespace xios |
---|
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 | 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 | CClient::initialize(codeId,localComm,returnComm) ; |
---|
47 | |
---|
48 | } |
---|
49 | |
---|
50 | void CXios::clientFinalize(void) |
---|
51 | { |
---|
52 | 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 | CServer::initialize() ; |
---|
65 | } |
---|
66 | |
---|
67 | void CXios::parseFile(const string& filename) |
---|
68 | { |
---|
69 | xml::CXMLParser::ParseFile(filename); |
---|
70 | } |
---|
71 | |
---|
72 | |
---|
73 | } |
---|