Changeset 499


Ignore:
Timestamp:
10/09/14 12:28:27 (10 years ago)
Author:
mhnguyen
Message:

Improving format of info and error file

+) Change name of info and error file into xios_client(server)_rank
+) Make format prettier

Test
+) On local: Fedora 20, gcc 4.8
+) Work as expected

Location:
XIOS/trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/client.cpp

    r497 r499  
    258258       } 
    259259 
    260        fileNameClient << fileName <<"_client_" << std::setfill('0') << std::setw(numDigit) << getRank() << ".out"; 
     260       fileNameClient << fileName << "_" << std::setfill('0') << std::setw(numDigit) << getRank() << ".out"; 
    261261       fb->open(fileNameClient.str().c_str(), std::ios::out); 
    262262       if (!fb->is_open()) 
     
    265265 
    266266       info.write2File(fb); 
     267       report.write2File(fb); 
    267268     } 
    268269 
     
    271272     { 
    272273       info.write2StdOut(); 
     274       report.write2StdOut(); 
    273275     } 
    274276 
  • XIOS/trunk/src/cxios.cpp

    r497 r499  
    1515  string CXios::rootFile="./iodef.xml" ; 
    1616  string CXios::xiosCodeId="xios.x" ; 
    17   string CXios::infoFile="./info_output"; 
    18   string CXios::errorFile="./error_output"; 
     17  string CXios::clientFile="./xios_client"; 
     18  string CXios::serverFile="./xios_server"; 
    1919 
    2020  bool CXios::isClient ; 
     
    2828  double CXios::defaultBufferServerFactorSize=2 ; 
    2929  bool CXios::printInfo2File; 
     30  bool CXios::isServerSide; 
    3031 
    3132 
     
    5253    CClient::initialize(codeId,localComm,returnComm) ; 
    5354 
    54     if (usingServer) isServer=false; 
    55     else isServer=true ; 
     55    if (usingServer) isServerSide = isServer=false; 
     56    else isServerSide = isServer=true; 
    5657 
    5758    if (printInfo2File) 
    58       CClient::openInfoStream(infoFile); 
     59      CClient::openInfoStream(clientFile); 
    5960    else 
    6061      CClient::openInfoStream(); 
     
    7677  { 
    7778    initialize(); 
     79 
    7880    isClient=true; 
    7981    isServer=false ; 
     82 
     83    isServerSide = true; 
    8084 
    8185    // Initialize all aspects MPI 
     
    8387 
    8488    if (printInfo2File) 
    85       CServer::openInfoStream(infoFile); 
     89      CServer::openInfoStream(serverFile); 
    8690    else 
    8791      CServer::openInfoStream(); 
  • XIOS/trunk/src/cxios.hpp

    r497 r499  
    1313     static string rootFile ; 
    1414     static string xiosCodeId ; 
    15      static string infoFile; 
    16      static string errorFile; 
     15     static string clientFile; 
     16     static string serverFile; 
    1717 
    1818     static void initialize(void) ; 
     
    4444 
    4545     public: 
    46       //! Setting xios to use server mode 
    47       static void setUsingServer(); 
     46     //! Setting xios to use server mode 
     47     static void setUsingServer(); 
    4848 
    49       //! Setting xios NOT to use server mode 
    50       static void setNotUsingServer(); 
     49     //! Setting xios NOT to use server mode 
     50     static void setNotUsingServer(); 
     51 
     52      //! A silly variable to detect whether one process is in client or server side. Should be removed on refactoring code 
     53     static bool isServerSide; 
    5154 
    5255  } ; 
  • XIOS/trunk/src/exception.cpp

    r497 r499  
    3434#else 
    3535     { 
     36      int numDigit = 0; 
     37      int size = 0; 
     38      MPI_Comm_size(CXios::globalComm, &size); 
     39      while (size) 
     40      { 
     41        size /= 10; 
     42        ++numDigit; 
     43      } 
     44 
    3645      StdOFStream fileStream; 
    3746      StdStringStream fileNameErr; 
    3847      std::streambuf* psbuf; 
    39       if (CXios::isClient) fileNameErr<< CXios::errorFile <<"_client_" << CClient::getRank() << ".err"; 
    40       else fileNameErr<< CXios::errorFile <<"_server_" << CServer::getRank() << ".err"; 
     48      if (CXios::isServerSide) 
     49        fileNameErr << CXios::serverFile << "_" << std::setfill('0') 
     50                    << std::setw(numDigit) << CServer::getRank() << ".err"; 
     51      else 
     52        fileNameErr << CXios::clientFile << "_" << std::setfill('0') 
     53                    << std::setw(numDigit) << CClient::getRank() << ".err"; 
     54 
    4155 
    4256      fileStream.open(fileNameErr.str().c_str(), std::ofstream::out); 
  • XIOS/trunk/src/server.cpp

    r497 r499  
    425425       } 
    426426 
    427        fileNameServer << fileName <<"_server_" << std::setfill('0') << std::setw(numDigit) << getRank() << ".out"; 
     427       fileNameServer << fileName <<"_" << std::setfill('0') << std::setw(numDigit) << getRank() << ".out"; 
    428428       fb->open(fileNameServer.str().c_str(), std::ios::out); 
    429429       if (!fb->is_open()) 
     
    432432 
    433433       info.write2File(fb); 
     434       report.write2File(fb); 
    434435     } 
    435436 
     
    438439     { 
    439440       info.write2StdOut(); 
     441       report.write2StdOut(); 
    440442     } 
    441443 
Note: See TracChangeset for help on using the changeset viewer.