# cParsimCommunications Class Reference
[Parallel simulation extension]

`#include <cparsimcomm.h>`

Inheritance diagram for cParsimCommunications:

List of all members.

## Detailed Description

Basic communications layer for parallel simulation.

It provides an abstraction layer above MPI, PVM, shared-memory communications, etc.

This is an interface: functionality is added by specific subclasses for MPI, PVM, etc.

## Public Member Functions

virtual | ~cParsimCommunications ()
Lifecycle of communications library
virtual void | init ()=0
virtual void | shutdown ()=0
virtual int | getNumPartitions ()=0
virtual int | getProcId ()=0
Buffers, send, receive
virtual cCommBuffer * | createCommBuffer ()=0
virtual void | recycleCommBuffer (cCommBuffer *buffer)=0
virtual void | send (cCommBuffer *buffer, int tag, int destination)=0
virtual void | broadcast (cCommBuffer *buffer, int tag)
virtual bool | receiveBlocking (int filtTag, cCommBuffer *buffer, int &receivedTag, int &sourceProcId)=0
virtual bool | receiveNonblocking (int filtTag, cCommBuffer *buffer, int &receivedTag, int &sourceProcId)=0

## Constructor & Destructor Documentation

virtual cParsimCommunications::~cParsimCommunications | ( |  | ) | `[inline, virtual]`

| Virtual destructor.

## Member Function Documentation

virtual void cParsimCommunications::broadcast | ( | cCommBuffer * | buffer,
|  | int | tag
| ) | `[virtual]`

| Broadcasts packed data with given tag to all partitions. This default implementation just simply sends the data to every other partition.

virtual cCommBuffer* cParsimCommunications::createCommBuffer | ( |  | ) | `[pure virtual]`

| Creates an empty buffer that can be used to send/receive data.

virtual int cParsimCommunications::getNumPartitions | ( |  | ) | `[pure virtual]`

| Returns total number of partitions.

virtual int cParsimCommunications::getProcId | ( |  | ) | `[pure virtual]`

| Returns id of this partition, an integer in the range 0. .getNumPartitions()-1.

virtual void cParsimCommunications::init | ( |  | ) | `[pure virtual]`

| Init the library -- parameters (if there are any) should have been passed in constructor. This process may also include starting the program on all processors needed for the current simulation run, if it is not handled by the parallel runtime system (e.g. MPI handles it via mpirun).

virtual bool cParsimCommunications::receiveBlocking | ( | int | filtTag,
|  | cCommBuffer * | buffer,
|  | int & | receivedTag,
|  | int & | sourceProcId
| ) | `[pure virtual]`

| Receives packed data with given tag from given destination. Normally returns true; false is returned if blocking was interrupted by the user.

virtual bool cParsimCommunications::receiveNonblocking | ( | int | filtTag,
|  | cCommBuffer * | buffer,
|  | int & | receivedTag,
|  | int & | sourceProcId
| ) | `[pure virtual]`

| Receives packed data with given tag from given destination. Call is non-blocking -- it returns true if something has been received, false otherwise.

virtual void cParsimCommunications::recycleCommBuffer | ( | cCommBuffer * | buffer | ) | `[pure virtual]`

| Recycle communication buffer after use. May be used to implement pooling, etc.

virtual void cParsimCommunications::send | ( | cCommBuffer * | buffer,
|  | int | tag,
|  | int | destination
| ) | `[pure virtual]`

| Sends packed data with given tag to destination.

virtual void cParsimCommunications::shutdown | ( |  | ) | `[pure virtual]`

| Shutdown the communications library.

The documentation for this class was generated from the following file:

- cparsimcomm.h