source: XIOS/dev/dev_cmip6_omp/src/event_client.cpp @ 1606

Last change on this file since 1606 was 1377, checked in by ymipsl, 6 years ago
  • Add more debugging information at info_level 100
  • Enforce synchronisation check for event on client side, using parameter "check_event_sync" at true

YM

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1#include "xios_spl.hpp"
2#include "event_client.hpp"
3#include "buffer_out.hpp"
4#include "message.hpp"
5#include "type.hpp"
6#include "mpi.hpp"
7#include "cxios.hpp"
8
9namespace xios
10{
11   const size_t CEventClient::headerSize = sizeof(int) + sizeof(size_t) + sizeof(int) + sizeof(int) + sizeof(int); // The two last one signify sizeof(classId) and sizeof(typeId)
12
13
14   CEventClient::CEventClient(int classId_, int typeId_)
15   {
16     classId = classId_;
17     typeId = typeId_;
18   }
19
20   void CEventClient::push(int rank, int nbSender, CMessage& msg)
21   {
22     nbSenders.push_back(nbSender);
23     ranks.push_back(rank);
24     messages.push_back(&msg);
25   }
26
27   bool CEventClient::isEmpty(void)
28   {
29     return ranks.empty();
30   }
31
32   std::list<int> CEventClient::getRanks(void)
33   {
34     return ranks;
35   }
36
37   std::list<int> CEventClient::getSizes(void)
38   {
39     std::list<CMessage*>::iterator it;
40     std::list<int> sizes;
41
42     for (it = messages.begin(); it != messages.end(); ++it) sizes.push_back((*it)->size() + headerSize);
43     return sizes;
44   }
45
46   void CEventClient::send(size_t timeLine, const std::list<int>& sizes, std::list<CBufferOut*>& buffers)
47   {
48     std::list<CBufferOut*>::iterator itBuff = buffers.begin();
49     std::list<int>::const_iterator itSizes = sizes.begin(), itSenders = nbSenders.begin();
50     std::list<CMessage*>::iterator itMsg = messages.begin();
51
52     if (CXios::checkEventSync) info(100)<<"Send event "<<timeLine<<" classId : "<<classId<<"  typeId : "<<typeId<<endl ;
53     for (; itBuff != buffers.end(); ++itBuff, ++itSizes, ++itSenders, ++itMsg)
54     {
55       **itBuff << *itSizes << timeLine << *itSenders << classId << typeId << **itMsg;
56     }
57   }
58}
Note: See TracBrowser for help on using the repository browser.