Changeset 497 for XIOS


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

Making a minor change of info output

+) Use a more beautiful format for name of info output file
+) Do a same thing to error file

Test
+) On curie
+) Passed

Location:
XIOS/trunk/src
Files:
6 edited

Legend:

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

    r493 r497  
    249249       std::filebuf* fb = m_infoStream.rdbuf(); 
    250250       StdStringStream fileNameClient; 
    251        fileNameClient << fileName <<"_client_" << getRank() << ".out"; 
     251       int numDigit = 0; 
     252       int size = 0; 
     253       MPI_Comm_size(CXios::globalComm, &size); 
     254       while (size) 
     255       { 
     256         size /= 10; 
     257         ++numDigit; 
     258       } 
     259 
     260       fileNameClient << fileName <<"_client_" << std::setfill('0') << std::setw(numDigit) << getRank() << ".out"; 
    252261       fb->open(fileNameClient.str().c_str(), std::ios::out); 
    253262       if (!fb->is_open()) 
  • XIOS/trunk/src/cxios.cpp

    r491 r497  
    1616  string CXios::xiosCodeId="xios.x" ; 
    1717  string CXios::infoFile="./info_output"; 
     18  string CXios::errorFile="./error_output"; 
    1819 
    1920  bool CXios::isClient ; 
     
    7576  { 
    7677    initialize(); 
    77  
    78 //    if (!usingServer) ERROR("void CXios::initServerSide(void)",<<"using_server is set to <false> and server initialization is called") ; 
    7978    isClient=true; 
    8079    isServer=false ; 
  • XIOS/trunk/src/cxios.hpp

    r491 r497  
    1414     static string xiosCodeId ; 
    1515     static string infoFile; 
     16     static string errorFile; 
    1617 
    1718     static void initialize(void) ; 
  • XIOS/trunk/src/exception.cpp

    r335 r497  
    33/// boost headers /// 
    44#include <boost/cast.hpp> 
     5#include "client.hpp" 
     6#include "server.hpp" 
     7#include "cxios.hpp" 
    58 
    69namespace xios 
     
    2326 
    2427   CException::~CException(void) 
    25    {  
     28   { 
    2629      if (desc_rethrow) 
    2730#ifdef __XIOS_NOABORT 
    28         throw (*this);  
     31      { 
     32        throw (*this); 
     33      } 
    2934#else 
     35     { 
     36      StdOFStream fileStream; 
     37      StdStringStream fileNameErr; 
     38      std::streambuf* psbuf; 
     39      if (CXios::isClient) fileNameErr<< CXios::errorFile <<"_client_" << CClient::getRank() << ".err"; 
     40      else fileNameErr<< CXios::errorFile <<"_server_" << CServer::getRank() << ".err"; 
     41 
     42      fileStream.open(fileNameErr.str().c_str(), std::ofstream::out); 
     43      psbuf = fileStream.rdbuf(); 
     44      std::cerr.rdbuf(psbuf); 
    3045      std::cerr << this->getMessage() << std::endl; 
     46      fileStream.close(); 
    3147      abort(); 
     48      } 
     49 
    3250#endif 
    3351   } 
  • XIOS/trunk/src/log.hpp

    r490 r497  
    1818      if (l<=level) 
    1919      { 
    20 //        rdbuf(cout.rdbuf()) ; 
    2120        rdbuf(strBuf_); 
    2221        *this<<"-> "<<name<<" : " ; 
  • XIOS/trunk/src/server.cpp

    r493 r497  
    416416       std::filebuf* fb = m_infoStream.rdbuf(); 
    417417       StdStringStream fileNameServer; 
    418        fileNameServer << fileName <<"_server_"<<getRank() << ".out"; 
     418       int numDigit = 0; 
     419       int size = 0; 
     420       MPI_Comm_size(CXios::globalComm, &size); 
     421       while (size) 
     422       { 
     423         size /= 10; 
     424         ++numDigit; 
     425       } 
     426 
     427       fileNameServer << fileName <<"_server_" << std::setfill('0') << std::setw(numDigit) << getRank() << ".out"; 
    419428       fb->open(fileNameServer.str().c_str(), std::ios::out); 
    420429       if (!fb->is_open()) 
Note: See TracChangeset for help on using the changeset viewer.