Ignore:
Timestamp:
09/22/14 14:17:33 (10 years ago)
Author:
mhnguyen
Message:

Ticket 50: Implementing the getting/setting methods for Fortran interface

+) Add some C and Fortran functions to set and get data to/from CVariable with an id
+) Add method to send, receive and dispatch in CVariable
+) Add dispatch method in server class

Test
-) On Curie
-) Test data: integer, float, double, boolean, string
-) File: one and multiple, using_server: ON and OFF
+) All test cases passed and had correct results

File:
1 edited

Legend:

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

    r401 r489  
    3838    pendingEvent=true ; 
    3939  } 
    40    
     40 
    4141  bool CContextServer::hasPendingEvent(void) 
    4242  { 
    4343    return pendingEvent ; 
    4444  } 
    45    
     45 
    4646  bool CContextServer::eventLoop(void) 
    4747  { 
     
    5858    int count ; 
    5959    char * addr ; 
    60     MPI_Status status;  
     60    MPI_Status status; 
    6161    map<int,CServerBuffer*>::iterator it; 
    62      
     62 
    6363    for(rank=0;rank<commSize;rank++) 
    6464    { 
     
    6666      { 
    6767        traceOff() ; 
    68         MPI_Iprobe(rank,20,interComm,&flag,&status);      
     68        MPI_Iprobe(rank,20,interComm,&flag,&status); 
    6969        traceOn() ; 
    7070        if (flag==true) 
    7171        { 
    7272          it=buffers.find(rank) ; 
    73           if (it==buffers.end())  
     73          if (it==buffers.end()) 
    7474            it=(buffers.insert(pair<int,CServerBuffer*>(rank,new CServerBuffer))).first ; 
    7575          MPI_Get_count(&status,MPI_CHAR,&count) ; 
     
    8484    } 
    8585  } 
    86    
     86 
    8787  void CContextServer::checkPendingRequest(void) 
    8888  { 
     
    9494    int count ; 
    9595    MPI_Status status ; 
    96      
     96 
    9797    for(it=pendingRequest.begin();it!=pendingRequest.end();it++) 
    9898    { 
     
    108108      } 
    109109    } 
    110      
    111     for(itRecv=recvRequest.begin();itRecv!=recvRequest.end();itRecv++)  
     110 
     111    for(itRecv=recvRequest.begin();itRecv!=recvRequest.end();itRecv++) 
    112112    { 
    113113      pendingRequest.erase(*itRecv) ; 
     
    115115    } 
    116116  } 
    117    
     117 
    118118  void CContextServer::processRequest(int rank, char* buff,int count) 
    119119  { 
    120      
     120 
    121121    CBufferIn buffer(buff,count) ; 
    122122    char* startBuffer,endBuffer ; 
     
    124124    size_t timeLine ; 
    125125    map<size_t,CEventServer*>::iterator it ; 
    126         
     126 
    127127    while(count>0) 
    128128    { 
     
    136136 
    137137      buffer.advance(size) ; 
    138       count=buffer.remain() ;            
    139     }  
    140    
    141   } 
    142      
     138      count=buffer.remain() ; 
     139    } 
     140 
     141  } 
     142 
    143143  void CContextServer::processEvents(void) 
    144144  { 
    145145    map<size_t,CEventServer*>::iterator it ; 
    146146    CEventServer* event ; 
    147      
     147 
    148148    it=events.find(currentTimeLine) ; 
    149     if (it!=events.end())  
     149    if (it!=events.end()) 
    150150    { 
    151151      event=it->second ; 
     
    162162     } 
    163163   } 
    164         
     164 
    165165  CContextServer::~CContextServer() 
    166166  { 
    167167    map<int,CServerBuffer*>::iterator it ; 
    168     for(it=buffers.begin();it!=buffers.end();++it) delete it->second ;  
    169   }  
     168    for(it=buffers.begin();it!=buffers.end();++it) delete it->second ; 
     169  } 
    170170 
    171171 
     
    178178    list<CEventServer::SSubEvent>::iterator it ; 
    179179    CContext::setCurrent(context->getId()) ; 
    180          
     180 
    181181    if (event.classId==CContext::GetType() && event.type==CContext::EVENT_ID_CONTEXT_FINALIZE) 
    182182    { 
     
    198198    else if (event.classId==CFile::GetType()) CFile::dispatchEvent(event) ; 
    199199    else if (event.classId==CFileGroup::GetType()) CFileGroup::dispatchEvent(event) ; 
     200    else if (event.classId==CVariable::GetType()) CVariable::dispatchEvent(event) ; 
    200201    else 
    201202    { 
Note: See TracChangeset for help on using the changeset viewer.