44 #define __CommunicationBuffer_ALLOC_CHUNK 1024 83 int resize(
int newSize);
107 int packArray(MPI_Comm communicator,
const void *src,
int n, MPI_Datatype type);
116 int unpackArray(MPI_Comm communicator,
void *dest,
int n, MPI_Datatype type);
128 int givePackSize(MPI_Comm communicator, MPI_Datatype type,
int size);
140 virtual int iSend(MPI_Comm communicator,
int dest,
int tag);
150 virtual int iRecv(MPI_Comm communicator,
int source,
int tag,
int count = 0);
158 int testCompletion();
168 int testCompletion(
int &source,
int &tag);
177 virtual int waitCompletion();
186 int bcast(MPI_Comm communicator,
int root);
231 virtual int resize(
int newSize) = 0;
235 virtual void init() = 0;
238 virtual void initForPacking() = 0;
240 virtual void initForUnpacking() = 0;
243 virtual int read(
bool &data);
246 virtual int write(
bool data);
248 virtual int givePackSizeOfInt(
int count);
249 virtual int givePackSizeOfDouble(
int count);
250 virtual int givePackSizeOfChar(
int count);
251 virtual int givePackSizeOfBool(
int count);
252 virtual int givePackSizeOfLong(
int count);
262 virtual int iSend(
int dest,
int tag) = 0;
271 virtual int iRecv(
int source,
int tag,
int count = 0) = 0;
279 virtual int testCompletion() = 0;
288 virtual int waitCompletion() = 0;
296 virtual int bcast(
int root) = 0;
321 virtual int write(
const int *src,
int n)
323 virtual int write(
const long *src,
int n)
325 virtual int write(
const unsigned long *src,
int n)
327 virtual int write(
const double *src,
int n)
329 virtual int write(
const char *src,
int n)
333 virtual int read(
int *dest,
int n)
335 virtual int read(
long *dest,
int n)
337 virtual int read(
unsigned long *dest,
int n)
339 virtual int read(
double *dest,
int n)
341 virtual int read(
char *dest,
int n)
virtual int read(long *dest, int n)
Reads count long values into array pointed by data.
virtual void init()
Initializes buffer to empty state.
int packArray(MPI_Comm communicator, const void *src, int n, MPI_Datatype type)
Packs array of a values of given type into buffer.
int bcast(MPI_Comm communicator, int root)
Initializes broadcast over collaborating processes.
int testCompletion(int &source, int &tag)
virtual ~StaticCommunicationBuffer()
Destructor.
The purpose of DataStream abstract class is to allow to store/restore context to different streams...
virtual int iRecv(int source, int tag, int count=0)
Starts standard mode, nonblocking receive.
char ComBuff_BYTE_TYPE
Type with size equal to one byte (sizeof (ComBuff_BYTE_TYPE) should be 1).
ComBuff_BYTE_TYPE * buff
Buffer. Dynamically allocated.
virtual int read(double *dest, int n)
Reads count double values into array pointed by data.
virtual void initForPacking()
Initialize for packing.
virtual int iSend(MPI_Comm communicator, int dest, int tag)
Starts standard mode, nonblocking send.
virtual int write(const char *src, int n)
Writes count char values from array pointed by data.
virtual int read(int *data, int count)=0
Reads count integer values into array pointed by data.
virtual int read(unsigned long *dest, int n)
Reads count unsigned long values into array pointed by data.
virtual int waitCompletion()
Waits until a completion of a nonblocking communication.
virtual int write(const unsigned long *src, int n)
Writes count unsigned long values from array pointed by data.
virtual int waitCompletion()
Waits until a completion of a nonblocking communication.
MPI_Request request
MPI request handle.
virtual int write(const double *src, int n)
Writes count double values from array pointed by data.
virtual int write(const int *data, int count)=0
Writes count integer values from array pointed by data.
int resize(int newSize)
Resizes buffer to given size.
virtual int testCompletion()
Tests if the operation identified by this->request is complete.
Class CommunicationBuffer provides abstraction for communication buffer.
int size
Size and current position in buffer in bytes (sizeof(char)).
virtual int resize(int newSize)
Resizes buffer to given size.
virtual int iSend(int dest, int tag)
Starts standard mode, nonblocking send.
virtual int write(bool data)
Writes a bool value.
CommunicationBuffer(MPI_Comm comm, int size, bool dynamic=0)
virtual void init()
Initializes buffer to empty state.
bool isDynamic
Dynamic flag (if true, buffer can grow, but reallocation is needed).
CommunicationBuffer(MPI_Comm comm, bool dynamic=0)
Constructor. Creates empty buffer, using given communicator for packing.
virtual int read(int *dest, int n)
Reads count integer values into array pointed by data.
virtual int iRecv(MPI_Comm communicator, int source, int tag, int count=0)
Starts standard mode, nonblocking receive.
int testCompletion()
Tests if the operation identified by this->request is complete.
StaticCommunicationBuffer(MPI_Comm comm, int size, bool dynamic=0)
virtual int bcast(int root)
Initializes broadcast over collaborating processes.
virtual int write(const int *src, int n)
Writes count integer values from array pointed by data.
virtual int write(const long *src, int n)
Writes count long values from array pointed by data.
int unpackArray(MPI_Comm communicator, void *dest, int n, MPI_Datatype type)
Unpacks array of values of given type from buffer.
StaticCommunicationBuffer(MPI_Comm comm, bool dynamic=0)
Constructor. Creates empty buffer, using given communicator for packing.
virtual ~CommunicationBuffer()
Destructor.
the oofem namespace is to define a context or scope in which all oofem names are defined.
virtual int read(bool &data)
Reads a bool value from data.
virtual void initForUnpacking()
Initialize for Unpacking (data already received)
virtual int read(char *dest, int n)
Reads count char values into array pointed by data.
MPI_Request giveRequest()
Returns associated MPI request handle.