Changeset 638


Ignore:
Timestamp:
07/17/15 13:58:12 (9 years ago)
Author:
rlacroix
Message:

Add a source filter and two terminal filters.

Location:
XIOS/trunk/src
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/field.cpp

    r632 r638  
    1010#include "xios_spl.hpp" 
    1111#include "type.hpp" 
     12#include "timer.hpp" 
    1213#include "context_client.hpp" 
    1314#include "context_server.hpp" 
     
    202203 
    203204    for (list< CArray<double,1>* >::iterator it = list_data.begin(); it != list_data.end(); it++) delete *it; 
     205  } 
     206 
     207  void CField::sendUpdateData(const CArray<double,1>& data) 
     208  { 
     209    CTimer::get("XIOS Send Data").resume(); 
     210 
     211    CContext* context = CContext::getCurrent(); 
     212    CContextClient* client = context->client; 
     213 
     214    CEventClient event(getType(), EVENT_ID_UPDATE_DATA); 
     215 
     216    map<int, CArray<int,1>* >::iterator it; 
     217    list<CMessage> list_msg; 
     218    list<CArray<double,1> > list_data; 
     219 
     220    if (!grid->doGridHaveDataDistributed()) 
     221    { 
     222       if (0 == client->clientRank) 
     223       { 
     224          for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++) 
     225          { 
     226            int rank = (*it).first; 
     227            CArray<int,1>& index = *(it->second); 
     228 
     229            list_msg.push_back(CMessage()); 
     230            list_data.push_back(CArray<double,1>(index.numElements())); 
     231 
     232            CArray<double,1>& data_tmp = list_data.back(); 
     233            for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n)); 
     234 
     235            list_msg.back() << getId() << data_tmp; 
     236            event.push(rank, 1, list_msg.back()); 
     237          } 
     238          client->sendEvent(event); 
     239       } else client->sendEvent(event); 
     240    } 
     241    else 
     242    { 
     243      for (it = grid->storeIndex_toSrv.begin(); it != grid->storeIndex_toSrv.end(); it++) 
     244      { 
     245        int rank = (*it).first; 
     246        CArray<int,1>& index = *(it->second); 
     247 
     248        list_msg.push_back(CMessage()); 
     249        list_data.push_back(CArray<double,1>(index.numElements())); 
     250 
     251        CArray<double,1>& data_tmp = list_data.back(); 
     252        for (int n = 0; n < data_tmp.numElements(); n++) data_tmp(n) = data(index(n)); 
     253 
     254        list_msg.back() << getId() << data_tmp; 
     255        event.push(rank, grid->nbSenders[rank], list_msg.back()); 
     256      } 
     257      client->sendEvent(event); 
     258    } 
     259     
     260    CTimer::get("XIOS Send Data").suspend(); 
    204261  } 
    205262 
  • XIOS/trunk/src/node/field.hpp

    r630 r638  
    139139        static bool dispatchEvent(CEventServer& event) ; 
    140140        void sendUpdateData(void) ; 
     141        void sendUpdateData(const CArray<double,1>& data); 
    141142        static void recvUpdateData(CEventServer& event) ; 
    142143        void recvUpdateData(vector<int>& ranks, vector<CBufferIn*>& buffers) ; 
Note: See TracChangeset for help on using the changeset viewer.