source: XIOS/dev/branch_yushan_merged/src/event_client.cpp @ 1205

Last change on this file since 1205 was 814, checked in by mhnguyen, 8 years ago

Correcting a bug on compilation with Intel whose version < 13.1

+) Use sizeof with type.

Test
+) On Curie
+) Compilation succeds with Intel: 12.1.9, 13.1.3 and version > 14

  • 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.5 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
8namespace xios
9{
10   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)
11
12
13   CEventClient::CEventClient(int classId_, int typeId_)
14   {
15     classId = classId_;
16     typeId = typeId_;
17   }
18
19   void CEventClient::push(int rank, int nbSender, CMessage& msg)
20   {
21     nbSenders.push_back(nbSender);
22     ranks.push_back(rank);
23     messages.push_back(&msg);
24   }
25
26   bool CEventClient::isEmpty(void)
27   {
28     return ranks.empty();
29   }
30
31   std::list<int> CEventClient::getRanks(void)
32   {
33     return ranks;
34   }
35
36   std::list<int> CEventClient::getSizes(void)
37   {
38     std::list<CMessage*>::iterator it;
39     std::list<int> sizes;
40
41     for (it = messages.begin(); it != messages.end(); ++it) sizes.push_back((*it)->size() + headerSize);
42     return sizes;
43   }
44
45   void CEventClient::send(size_t timeLine, const std::list<int>& sizes, std::list<CBufferOut*>& buffers)
46   {
47     std::list<CBufferOut*>::iterator itBuff = buffers.begin();
48     std::list<int>::const_iterator itSizes = sizes.begin(), itSenders = nbSenders.begin();
49     std::list<CMessage*>::iterator itMsg = messages.begin();
50
51     for (; itBuff != buffers.end(); ++itBuff, ++itSizes, ++itSenders, ++itMsg)
52     {
53       **itBuff << *itSizes << timeLine << *itSenders << classId << typeId << **itMsg;
54     }
55   }
56}
Note: See TracBrowser for help on using the repository browser.