Ignore:
Timestamp:
01/23/19 10:31:44 (5 years ago)
Author:
yushan
Message:

dev on ADA. add flag switch _usingEP/_usingMPI

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/branch_openmp/src/log.hpp

    r1342 r1642  
    55#include <iostream> 
    66#include <string> 
    7 #include <stdio.h> 
    8 #include <omp.h> 
    97 
    108namespace xios 
     
    1614    public : 
    1715    CLog(const string& name_, std::streambuf* sBuff = cout.rdbuf()) 
    18       : ostream(sBuff), level(0), name(name_), strBuf_(sBuff)  
     16      : ostream(sBuff), level(0), name(name_), strBuf_(sBuff) {} 
     17    CLog& operator()(int l) 
    1918    { 
    20       omp_init_lock( &mutex ); 
    21       for(int i=0; i<16; i++) 
    22         strBuf_array[i] = sBuff; 
     19      if (l<=level) 
     20      { 
     21        rdbuf(strBuf_); 
     22        *this<<"-> "<<name<<" : " ; 
     23      } 
     24      else rdbuf(NULL) ; 
     25      return *this; 
    2326    } 
    24  
    25     ~CLog() 
    26     { 
    27       omp_destroy_lock( &mutex ); 
    28     } 
    29  
    30     CLog& operator()(int l); 
    3127    void setLevel(int l) {level=l; } 
    3228    int getLevel() {return level ;} 
     
    5046     * \param [in] pointer to new streambuf 
    5147    */ 
    52     void changeStreamBuff(std::streambuf* sBuff)  
    53     {  
    54       strBuf_ = sBuff;  
    55       strBuf_array[omp_get_thread_num()] = sBuff; 
    56       rdbuf(sBuff); 
    57     } 
     48    void changeStreamBuff(std::streambuf* sBuff) { strBuf_ = sBuff; rdbuf(sBuff); } 
    5849 
    5950    int level ; 
    6051    string name ; 
    6152    std::streambuf* strBuf_; 
    62     std::streambuf* strBuf_array[16]; 
    63     omp_lock_t mutex; 
    6453  }; 
    6554 
     
    6756  extern CLog report; 
    6857  extern CLog error; 
    69  
    70   extern std::filebuf* info_FB[16]; 
    7158} 
    7259#endif 
Note: See TracChangeset for help on using the changeset viewer.