vtkSharedMemoryCommunicator Class Reference
[C++/Common/Vtk/Parallel]

Provides communication using shared memory. More...

#include <vtkSharedMemoryCommunicator.h>

Inheritance diagram for vtkSharedMemoryCommunicator:

Inheritance graph
[legend]
Collaboration diagram for vtkSharedMemoryCommunicator:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 vtkTypeRevisionMacro (vtkSharedMemoryCommunicator, vtkCommunicator)
virtual void PrintSelf (ostream &os, vtkIndent indent)
 Print the state of this object.
virtual int Send (int *data, int length, int remoteThreadId, int tag)
 This method sends data to another process.
virtual int Send (unsigned long *data, int length, int remoteThreadId, int tag)
 This method sends data to another process.
virtual int Send (char *data, int length, int remoteThreadId, int tag)
 This method sends data to another process.
virtual int Send (unsigned char *data, int length, int remoteThreadId, int tag)
 This method sends data to another process.
virtual int Send (float *data, int length, int remoteThreadId, int tag)
 This method sends data to another process.
virtual int Send (double *data, int length, int remoteThreadId, int tag)
 This method sends data to another process.
virtual int Send (vtkDataObject *data, int remoteThreadId, int tag)
 This method sends data to another process.
virtual int Send (vtkDataArray *data, int remoteThreadId, int tag)
 This method sends data to another process.
virtual int Receive (int *data, int length, int remoteThreadId, int tag)
 This method receives data from a corresponding send.
virtual int Receive (unsigned long *data, int length, int remoteThreadId, int tag)
 This method receives data from a corresponding send.
virtual int Receive (char *data, int length, int remoteThreadId, int tag)
 This method receives data from a corresponding send.
virtual int Receive (unsigned char *data, int length, int remoteThreadId, int tag)
 This method receives data from a corresponding send.
virtual int Receive (float *data, int length, int remoteThreadId, int tag)
 This method receives data from a corresponding send.
virtual int Receive (double *data, int length, int remoteThreadId, int tag)
 This method receives data from a corresponding send.
virtual int Receive (vtkDataObject *data, int remoteThreadId, int tag)
 This method receives data from a corresponding send.
virtual int Receive (vtkDataArray *data, int remoteThreadId, int tag)
 This method receives data from a corresponding send.

Static Public Member Functions

static vtkSharedMemoryCommunicatorNew ()
 Instantiate a new object of this type.

Protected Member Functions

void Initialize (int nThreads, int forceDeepCopy)
 vtkSharedMemoryCommunicator ()
 Ctor.
 ~vtkSharedMemoryCommunicator ()
 Dtor.
int Send (vtkDataObject *object, void *data, int dataLength, int remoteThreadId, int tag)
 This method sends data to another process.
int Receive (vtkDataObject *object, void *data, int dataLength, int remoteThreadId, int tag)
 This method receives data from a corresponding send.
int Send (vtkDataArray *object, int dataLength, int remoteThreadId, int tag)
 This method sends data to another process.
int Receive (vtkDataArray *object, int dataLength, int remoteThreadId, int tag)
 This method receives data from a corresponding send.
vtkSharedMemoryCommunicatorMessage * NewMessage (vtkDataObject *object, void *data, int dataLength)
vtkSharedMemoryCommunicatorMessage * NewMessage (vtkDataArray *object, void *data, int dataLength)
void DeleteMessage (vtkSharedMemoryCommunicatorMessage *message)
void AddMessage (vtkSharedMemoryCommunicatorMessage *message)
vtkSharedMemoryCommunicatorMessage * FindMessage (int sendId, int tag)
void SignalNewMessage (vtkSharedMemoryCommunicator *receiveCommunicator)
void WaitForNewMessage ()

Protected Attributes

int NumberOfThreads
int Initialized
int LocalThreadId
int WaitingForId
int ForceDeepCopy
vtkSimpleCriticalSectionMessageListLock
 It is not enough to block on the messages, we have to mutex the whole send interaction.
vtkSharedMemoryCommunicator ** Communicators
 Each thread has its own communicator.
vtkSharedMemoryCommunicatorParent
vtkSharedMemoryCommunicatorMessage * MessageListStart
 Double linked list.
vtkSharedMemoryCommunicatorMessage * MessageListEnd
vtkThreadMessagerMessager

Friends

class vtkThreadedController

Detailed Description

Provides communication using shared memory.

This class is used together with vtkThreadedController for communication between threads. Once initialized, it creates one communicator per thread. The messages to be sent are copied to the message list of the appropriate communicator by the sending thread and then read by the receiving thread. Mutexes are used to ensure safe access to the data structures. By default, when an object is sent, it is copied with DeepCopy. This behavior can be changed by un-setting ForceDeepCopy.

See also:
vtkCommunicator vtkThreadedController
Note:
This class has been depreciated as of VTK 5.2.

Definition at line 49 of file vtkSharedMemoryCommunicator.h.


Constructor & Destructor Documentation

vtkSharedMemoryCommunicator::vtkSharedMemoryCommunicator (  )  [protected]

Ctor.

vtkSharedMemoryCommunicator::~vtkSharedMemoryCommunicator (  )  [protected]

Dtor.


Member Function Documentation

vtkSharedMemoryCommunicator::vtkTypeRevisionMacro ( vtkSharedMemoryCommunicator  ,
vtkCommunicator   
)

static vtkSharedMemoryCommunicator* vtkSharedMemoryCommunicator::New (  )  [static]

Instantiate a new object of this type.

This is the only method that objects of this type may be created.

Returns:
The new object.

Reimplemented from vtkObject.

virtual void vtkSharedMemoryCommunicator::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Print the state of this object.

Parameters:
os The output stream.
indent The indentation level. Used for formating output.

Reimplemented from vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Send ( int *  data,
int  length,
int  remoteThreadId,
int  tag 
) [virtual]

This method sends data to another process.

Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The destination thread.
tag The destination tag.

Implements vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Send ( unsigned long *  data,
int  length,
int  remoteThreadId,
int  tag 
) [virtual]

This method sends data to another process.

Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The destination thread.
tag The destination tag.

Implements vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Send ( char *  data,
int  length,
int  remoteThreadId,
int  tag 
) [virtual]

This method sends data to another process.

Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The destination thread.
tag The destination tag.

Implements vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Send ( unsigned char *  data,
int  length,
int  remoteThreadId,
int  tag 
) [virtual]

This method sends data to another process.

Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The destination thread.
tag The destination tag.

Implements vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Send ( float *  data,
int  length,
int  remoteThreadId,
int  tag 
) [virtual]

This method sends data to another process.

Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The destination thread.
tag The destination tag.

Implements vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Send ( double *  data,
int  length,
int  remoteThreadId,
int  tag 
) [virtual]

This method sends data to another process.

Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The destination thread.
tag The destination tag.

Implements vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Send ( vtkDataObject data,
int  remoteThreadId,
int  tag 
) [virtual]

This method sends data to another process.

Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The destination thread.
tag The destination tag.

Reimplemented from vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Send ( vtkDataArray data,
int  remoteThreadId,
int  tag 
) [virtual]

This method sends data to another process.

Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The destination thread.
tag The destination tag.

Reimplemented from vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Receive ( int *  data,
int  length,
int  remoteThreadId,
int  tag 
) [virtual]

This method receives data from a corresponding send.

It blocks until the receive is finished. It calls methods in "data" to communicate the sending data.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The source thread.
tag The source tag.

Implements vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Receive ( unsigned long *  data,
int  length,
int  remoteThreadId,
int  tag 
) [virtual]

This method receives data from a corresponding send.

It blocks until the receive is finished. It calls methods in "data" to communicate the sending data.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The source thread.
tag The source tag.

Implements vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Receive ( char *  data,
int  length,
int  remoteThreadId,
int  tag 
) [virtual]

This method receives data from a corresponding send.

It blocks until the receive is finished. It calls methods in "data" to communicate the sending data.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The source thread.
tag The source tag.

Implements vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Receive ( unsigned char *  data,
int  length,
int  remoteThreadId,
int  tag 
) [virtual]

This method receives data from a corresponding send.

It blocks until the receive is finished. It calls methods in "data" to communicate the sending data.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The source thread.
tag The source tag.

Implements vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Receive ( float *  data,
int  length,
int  remoteThreadId,
int  tag 
) [virtual]

This method receives data from a corresponding send.

It blocks until the receive is finished. It calls methods in "data" to communicate the sending data.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The source thread.
tag The source tag.

Implements vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Receive ( double *  data,
int  length,
int  remoteThreadId,
int  tag 
) [virtual]

This method receives data from a corresponding send.

It blocks until the receive is finished. It calls methods in "data" to communicate the sending data.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The source thread.
tag The source tag.

Implements vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Receive ( vtkDataObject data,
int  remoteThreadId,
int  tag 
) [virtual]

This method receives data from a corresponding send.

It blocks until the receive is finished. It calls methods in "data" to communicate the sending data.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The source thread.
tag The source tag.

Reimplemented from vtkCommunicator.

virtual int vtkSharedMemoryCommunicator::Receive ( vtkDataArray data,
int  remoteThreadId,
int  tag 
) [virtual]

This method receives data from a corresponding send.

It blocks until the receive is finished. It calls methods in "data" to communicate the sending data.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The source thread.
tag The source tag.

Reimplemented from vtkCommunicator.

void vtkSharedMemoryCommunicator::Initialize ( int  nThreads,
int  forceDeepCopy 
) [protected]

int vtkSharedMemoryCommunicator::Send ( vtkDataObject object,
void *  data,
int  dataLength,
int  remoteThreadId,
int  tag 
) [protected]

This method sends data to another process.

Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The destination thread.
tag The destination tag.

int vtkSharedMemoryCommunicator::Receive ( vtkDataObject object,
void *  data,
int  dataLength,
int  remoteThreadId,
int  tag 
) [protected]

This method receives data from a corresponding send.

It blocks until the receive is finished. It calls methods in "data" to communicate the sending data.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The source thread.
tag The source tag.

int vtkSharedMemoryCommunicator::Send ( vtkDataArray object,
int  dataLength,
int  remoteThreadId,
int  tag 
) [protected]

This method sends data to another process.

Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The destination thread.
tag The destination tag.

int vtkSharedMemoryCommunicator::Receive ( vtkDataArray object,
int  dataLength,
int  remoteThreadId,
int  tag 
) [protected]

This method receives data from a corresponding send.

It blocks until the receive is finished. It calls methods in "data" to communicate the sending data.

Parameters:
data The data to be sent.
length The number of data items.
remoteThreadId The source thread.
tag The source tag.

vtkSharedMemoryCommunicatorMessage* vtkSharedMemoryCommunicator::NewMessage ( vtkDataObject object,
void *  data,
int  dataLength 
) [protected]

vtkSharedMemoryCommunicatorMessage* vtkSharedMemoryCommunicator::NewMessage ( vtkDataArray object,
void *  data,
int  dataLength 
) [protected]

void vtkSharedMemoryCommunicator::DeleteMessage ( vtkSharedMemoryCommunicatorMessage *  message  )  [protected]

void vtkSharedMemoryCommunicator::AddMessage ( vtkSharedMemoryCommunicatorMessage *  message  )  [protected]

vtkSharedMemoryCommunicatorMessage* vtkSharedMemoryCommunicator::FindMessage ( int  sendId,
int  tag 
) [protected]

void vtkSharedMemoryCommunicator::SignalNewMessage ( vtkSharedMemoryCommunicator receiveCommunicator  )  [protected]

void vtkSharedMemoryCommunicator::WaitForNewMessage (  )  [protected]


Friends And Related Function Documentation

friend class vtkThreadedController [friend]

Definition at line 270 of file vtkSharedMemoryCommunicator.h.


Member Data Documentation

int vtkSharedMemoryCommunicator::NumberOfThreads [protected]

Definition at line 277 of file vtkSharedMemoryCommunicator.h.

int vtkSharedMemoryCommunicator::Initialized [protected]

Definition at line 278 of file vtkSharedMemoryCommunicator.h.

int vtkSharedMemoryCommunicator::LocalThreadId [protected]

Definition at line 281 of file vtkSharedMemoryCommunicator.h.

int vtkSharedMemoryCommunicator::WaitingForId [protected]

Definition at line 282 of file vtkSharedMemoryCommunicator.h.

int vtkSharedMemoryCommunicator::ForceDeepCopy [protected]

Definition at line 284 of file vtkSharedMemoryCommunicator.h.

vtkSimpleCriticalSection* vtkSharedMemoryCommunicator::MessageListLock [protected]

It is not enough to block on the messages, we have to mutex the whole send interaction.

I was trying to avoid a central mutex (oh well).

Definition at line 291 of file vtkSharedMemoryCommunicator.h.

vtkSharedMemoryCommunicator** vtkSharedMemoryCommunicator::Communicators [protected]

Each thread has its own communicator.

Definition at line 297 of file vtkSharedMemoryCommunicator.h.

vtkSharedMemoryCommunicator* vtkSharedMemoryCommunicator::Parent [protected]

Definition at line 299 of file vtkSharedMemoryCommunicator.h.

vtkSharedMemoryCommunicatorMessage* vtkSharedMemoryCommunicator::MessageListStart [protected]

Double linked list.

Definition at line 304 of file vtkSharedMemoryCommunicator.h.

vtkSharedMemoryCommunicatorMessage* vtkSharedMemoryCommunicator::MessageListEnd [protected]

Definition at line 305 of file vtkSharedMemoryCommunicator.h.

vtkThreadMessager* vtkSharedMemoryCommunicator::Messager [protected]

Definition at line 373 of file vtkSharedMemoryCommunicator.h.


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