1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
/////////////////////////////////////////////////////////////
// //
// Copyright (c) 2003-2014 by The University of Queensland //
// Centre for Geoscience Computing //
// http://earth.uq.edu.au/centre-geoscience-computing //
// //
// Primary Business: Brisbane, Queensland, Australia //
// Licensed under the Open Software License version 3.0 //
// http://www.apache.org/licenses/LICENSE-2.0 //
// //
/////////////////////////////////////////////////////////////
#ifndef __BROADCAST_CMD_H
#define __BROADCAST_CMD_H
#include "Parallel/mpicmdbuf.h"
#include "Parallel/mpivbuf.h"
#include "Parallel/mpibarrier.h"
#include "Parallel/RankAndComm.h"
/*!
\brief base class for broadcast commands
*/
class BroadcastCommand
{
private:
int m_commandId;
CVarMPIBuffer m_varBuffer;
CMPIBarrier m_barrier;
CMPILCmdBuffer m_cmdBuffer;
public:
BroadcastCommand(const MpiRankAndComm &rankAndComm, int cmdId);
virtual ~BroadcastCommand(){}
/**
* Appends namedWithType.getTypeString() and namedWithType.getName()
* strings to the data buffer.
*/
template <typename TmplData>
void appendTypeAndName(const TmplData &namedWithType);
/**
* Appends specified argument data (basic type) to the buffer.
*/
template <typename TmplData>
void append(const TmplData &basicTypeData);
/**
* Packs the specified data into the data-buffer.
*/
template <typename TmplPackable>
void packInto(const TmplPackable&);
/**
* Returns the command id of this broadcast-command.
*/
const int& getCommandId() const;
/**
* Broadcasts the command (ie the command id).
*/
void broadcastCommand();
/**
* Broadcasts the data buffer.
*/
void broadcastBuffer();
/**
* Barrier wait.
*/
void wait(const std::string &barrierName);
/**
* Broadcasts command and data buffer, then does
* a barrier wait.
*/
void broadcast();
};
#include "Parallel/BroadCast_cmd.hpp"
#endif // BROADCAST_CMD_H
|