Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkMultiProcessController Class Reference

#include <vtkMultiProcessController.h>

Inheritance diagram for vtkMultiProcessController:

Inheritance graph
[legend]
Collaboration diagram for vtkMultiProcessController:

Collaboration graph
[legend]
List of all members.

Detailed Description

Multiprocessing communication superclass.

vtkMultiProcessController is used to control multiple processes in a distributed computing environment. It has methods for executing single/multiple method(s) on multiple processors, triggering registered callbacks (Remote Methods) (AddRMI(), TriggerRMI()) and communication. Please note that the communication is done using the communicator which is accessible to the user. Therefore it is possible to get the communicator with GetCommunicator() and use it to send and receive data. This is the encoured communication method. The internal (RMI) communications are done using a second internal communicator (called RMICommunicator).

See also:
vtkMPIController vtkCommunicator vtkMPICommunicator
Examples:
vtkMultiProcessController (Examples)
Tests:
vtkMultiProcessController (Tests)

Definition at line 66 of file vtkMultiProcessController.h.
int Send (int *data, int length, int remoteProcessId, int tag)
int Send (unsigned long *data, int length, int remoteProcessId, int tag)
int Send (char *data, int length, int remoteProcessId, int tag)
int Send (unsigned char *data, int length, int remoteProcessId, int tag)
int Send (float *data, int length, int remoteProcessId, int tag)
int Send (double *data, int length, int remoteProcessId, int tag)
int Send (vtkDataObject *data, int remoteId, int tag)
static void SetGlobalController (vtkMultiProcessController *controller)
int Send (vtkDataArray *data, int remoteId, int tag)
int Receive (int *data, int length, int remoteProcessId, int tag)
int Receive (unsigned long *data, int length, int remoteProcessId, int tag)
int Receive (char *data, int length, int remoteProcessId, int tag)
int Receive (unsigned char *data, int length, int remoteProcessId, int tag)
int Receive (float *data, int length, int remoteProcessId, int tag)
int Receive (double *data, int length, int remoteProcessId, int tag)
int Receive (vtkDataObject *data, int remoteId, int tag)
int Receive (vtkDataArray *data, int remoteId, int tag)
 vtkMultiProcessController ()
 ~vtkMultiProcessController ()
void ProcessRMI (int remoteProcessId, void *arg, int argLength, int rmiTag)
virtual vtkMultiProcessControllerGetLocalController ()
int MaximumNumberOfProcesses
int NumberOfProcesses
int LocalProcessId
vtkProcessFunctionType SingleMethod
void * SingleData
vtkProcessFunctionType MultipleMethod [MAX_PROCESSES]
void * MultipleData [MAX_PROCESSES]
vtkCollectionRMIs
int BreakFlag
int ForceDeepCopy
vtkOutputWindowOutputWindow
vtkCommunicatorCommunicator
vtkCommunicatorRMICommunicator

Public Types

typedef vtkObject Superclass
enum  Errors { RMI_NO_ERROR, RMI_TAG_ERROR, RMI_ARG_ERROR }
enum  Consts {
  MAX_PROCESSES = 8192, ANY_SOURCE = -1, INVALID_SOURCE = -2, RMI_TAG = 315167,
  RMI_ARG_TAG = 315168, BREAK_RMI_TAG = 239954
}

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
void PrintSelf (ostream &os, vtkIndent indent)
virtual void Finalize ()=0
virtual void CreateOutputWindow ()=0
void AddRMI (vtkRMIFunctionType, void *localArg, int tag)
void TriggerRMI (int remoteProcessId, void *arg, int argLength, int tag)
virtual void Barrier ()=0
virtual void Initialize (int *vtkNotUsed(argc), char ***vtkNotUsed(argv))=0
virtual void Initialize (int *vtkNotUsed(argc), char ***vtkNotUsed(argv), int initializedExternally)=0
virtual void Finalize (int finalizedExternally)=0
virtual void SetNumberOfProcesses (int num)
virtual int GetNumberOfProcesses ()
void SetSingleMethod (vtkProcessFunctionType, void *data)
virtual void SingleMethodExecute ()=0
void SetMultipleMethod (int index, vtkProcessFunctionType, void *data)
virtual void MultipleMethodExecute ()=0
virtual int GetLocalProcessId ()
int RemoveFirstRMI (int tag)
void RemoveRMI (vtkRMIFunctionType f, void *arg, int tag)
void TriggerBreakRMIs ()
void TriggerRMI (int remoteProcessId, const char *arg, int tag)
void TriggerRMI (int remoteProcessId, int tag)
int ProcessRMIs (int reportErrors)
int ProcessRMIs ()
virtual void SetBreakFlag (int)
virtual int GetBreakFlag ()
virtual vtkCommunicatorGetCommunicator ()

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkMultiProcessControllerSafeDownCast (vtkObject *o)
static vtkMultiProcessControllerGetGlobalController ()


Member Typedef Documentation

typedef vtkObject vtkMultiProcessController::Superclass
 

Reimplemented from vtkObject.

Reimplemented in vtkDummyController, vtkMPIController, and vtkSocketController.

Definition at line 69 of file vtkMultiProcessController.h.


Member Enumeration Documentation

enum vtkMultiProcessController::Errors
 

Enumerator:
RMI_NO_ERROR 
RMI_TAG_ERROR 
RMI_ARG_ERROR 

Definition at line 210 of file vtkMultiProcessController.h.

enum vtkMultiProcessController::Consts
 

Enumerator:
MAX_PROCESSES 
ANY_SOURCE 
INVALID_SOURCE 
RMI_TAG 
RMI_ARG_TAG 
BREAK_RMI_TAG 

Reimplemented in vtkSocketController.

Definition at line 217 of file vtkMultiProcessController.h.


Constructor & Destructor Documentation

vtkMultiProcessController::vtkMultiProcessController  )  [protected]
 

vtkMultiProcessController::~vtkMultiProcessController  )  [protected]
 


Member Function Documentation

virtual const char* vtkMultiProcessController::GetClassName  )  [virtual]
 

Reimplemented from vtkObject.

Reimplemented in vtkDummyController, vtkMPIController, and vtkSocketController.

static int vtkMultiProcessController::IsTypeOf const char *  type  )  [static]
 

Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkObject.

Reimplemented in vtkDummyController, vtkMPIController, and vtkSocketController.

virtual int vtkMultiProcessController::IsA const char *  type  )  [virtual]
 

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkObject.

Reimplemented in vtkDummyController, vtkMPIController, and vtkSocketController.

static vtkMultiProcessController* vtkMultiProcessController::SafeDownCast vtkObject o  )  [static]
 

Reimplemented from vtkObject.

Reimplemented in vtkDummyController, vtkMPIController, and vtkSocketController.

void vtkMultiProcessController::PrintSelf ostream &  os,
vtkIndent  indent
[virtual]
 

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObject.

Reimplemented in vtkDummyController, vtkMPIController, and vtkSocketController.

virtual void vtkMultiProcessController::Initialize int *  vtkNotUsed(argc),
char ***  vtkNotUsed(argv)
[pure virtual]
 

This method is for setting up the processes. If a subclass needs to initialize process communication (i.e. MPI) it would over ride this method.

Referenced by vtkSocketController::Initialize(), and vtkMPIController::Initialize().

virtual void vtkMultiProcessController::Initialize int *  vtkNotUsed(argc),
char ***  vtkNotUsed(argv),
int  initializedExternally
[pure virtual]
 

This method is for setting up the processes. If a subclass needs to initialize process communication (i.e. MPI) it would over ride this method. Provided for initialization outside vtk.

Implemented in vtkMPIController.

virtual void vtkMultiProcessController::Finalize  )  [pure virtual]
 

This method is for cleaning up. If a subclass needs to clean up process communication (i.e. MPI) it would over ride this method.

Implemented in vtkDummyController, vtkMPIController, and vtkSocketController.

Referenced by vtkMPIController::Finalize().

virtual void vtkMultiProcessController::Finalize int  finalizedExternally  )  [pure virtual]
 

This method is for cleaning up. If a subclass needs to clean up process communication (i.e. MPI) it would over ride this method. Provided for finalization outside vtk.

Implemented in vtkDummyController, vtkMPIController, and vtkSocketController.

virtual void vtkMultiProcessController::SetNumberOfProcesses int  num  )  [virtual]
 

Set the number of processes you will be using. This defaults to the maximum number available. If you set this to a value higher than the default, you will get an error.

Reimplemented in vtkSocketController.

virtual int vtkMultiProcessController::GetNumberOfProcesses  )  [virtual]
 

This method is for cleaning up. If a subclass needs to clean up process communication (i.e. MPI) it would over ride this method. Provided for finalization outside vtk.

void vtkMultiProcessController::SetSingleMethod vtkProcessFunctionType  ,
void *  data
 

Set the SingleMethod to f() and the UserData of the for the method to be executed by all of the processes when SingleMethodExecute is called. All the processes will start by calling this function.

virtual void vtkMultiProcessController::SingleMethodExecute  )  [pure virtual]
 

Execute the SingleMethod (as define by SetSingleMethod) using this->NumberOfProcesses processes. This will only return when all the processes finish executing their methods.

Implemented in vtkDummyController, vtkMPIController, and vtkSocketController.

void vtkMultiProcessController::SetMultipleMethod int  index,
vtkProcessFunctionType  ,
void *  data
 

Set the MultipleMethod to f() and the UserData of the for the method to be executed by the process index when MultipleMethodExecute is called. This is for having each process start with a different function and data argument.

virtual void vtkMultiProcessController::MultipleMethodExecute  )  [pure virtual]
 

Execute the MultipleMethods (as define by calling SetMultipleMethod for each of the required this->NumberOfProcesses methods) using this->NumberOfProcesses processes.

Implemented in vtkDummyController, vtkMPIController, and vtkSocketController.

virtual int vtkMultiProcessController::GetLocalProcessId  )  [virtual]
 

Tells you which process [0, NumProcess) you are in.

Reimplemented in vtkDummyController.

static vtkMultiProcessController* vtkMultiProcessController::GetGlobalController  )  [static]
 

This convenience method returns the controller associated with the local process. It returns NULL until the processes are spawned. It is better if you hang on to the controller passed as an argument to the SingleMethod or MultipleMethod functions.

virtual void vtkMultiProcessController::CreateOutputWindow  )  [pure virtual]
 

This method can be used to tell the controller to create a special output window in which all messages are preceded by the process id.

Implemented in vtkDummyController, vtkMPIController, and vtkSocketController.

void vtkMultiProcessController::AddRMI vtkRMIFunctionType  ,
void *  localArg,
int  tag
 

Register remote method invocation in the receiving process which makes the call. It must have a unique tag as an RMI id. The vtkRMIFunctionType has several arguments: localArg (same as passed in), remoteArg, remoteArgLength (memory passed by process triggering the RMI), remoteProcessId.

int vtkMultiProcessController::RemoveFirstRMI int  tag  ) 
 

Remove the first RMI matching the tag.

void vtkMultiProcessController::RemoveRMI vtkRMIFunctionType  f,
void *  arg,
int  tag
[inline]
 

Take an RMI away.

Definition at line 160 of file vtkMultiProcessController.h.

void vtkMultiProcessController::TriggerRMI int  remoteProcessId,
void *  arg,
int  argLength,
int  tag
 

A method to trigger a method invocation in another process.

void vtkMultiProcessController::TriggerBreakRMIs  ) 
 

A conveniance method. Called on process 0 to break "ProcessRMIs" loop on all other processes.

void vtkMultiProcessController::TriggerRMI int  remoteProcessId,
const char *  arg,
int  tag
[inline]
 

Convenience method when the arg is a string.

Definition at line 174 of file vtkMultiProcessController.h.

void vtkMultiProcessController::TriggerRMI int  remoteProcessId,
int  tag
[inline]
 

Convenience method when there is no argument.

Definition at line 181 of file vtkMultiProcessController.h.

int vtkMultiProcessController::ProcessRMIs int  reportErrors  ) 
 

Calling this method gives control to the controller to start processing RMIs. Possible return values are: RMI_NO_ERROR, RMI_TAG_ERROR : rmi tag could not be received, RMI_ARG_ERROR : rmi arg could not be received. If reportErrors is false, no vtkErrorMacro is called. ProcessRMIs() calls ProcessRMIs(int) with reportErrors = 0.

int vtkMultiProcessController::ProcessRMIs  ) 
 

Calling this method gives control to the controller to start processing RMIs. Possible return values are: RMI_NO_ERROR, RMI_TAG_ERROR : rmi tag could not be received, RMI_ARG_ERROR : rmi arg could not be received. If reportErrors is false, no vtkErrorMacro is called. ProcessRMIs() calls ProcessRMIs(int) with reportErrors = 0.

virtual void vtkMultiProcessController::SetBreakFlag int   )  [virtual]
 

Setting this flag to 1 will cause the ProcessRMIs loop to return. This also causes vtkUpStreamPorts to return from their WaitForUpdate loops.

virtual int vtkMultiProcessController::GetBreakFlag  )  [virtual]
 

Setting this flag to 1 will cause the ProcessRMIs loop to return. This also causes vtkUpStreamPorts to return from their WaitForUpdate loops.

virtual vtkCommunicator* vtkMultiProcessController::GetCommunicator  )  [virtual]
 

virtual void vtkMultiProcessController::Barrier  )  [pure virtual]
 

This method can be used to synchronize processes.

Implemented in vtkDummyController, vtkMPIController, and vtkSocketController.

static void vtkMultiProcessController::SetGlobalController vtkMultiProcessController controller  )  [static]
 

This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process.

int vtkMultiProcessController::Send int *  data,
int  length,
int  remoteProcessId,
int  tag
[inline]
 

This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Definition at line 351 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Send().

int vtkMultiProcessController::Send unsigned long *  data,
int  length,
int  remoteProcessId,
int  tag
[inline]
 

This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Definition at line 364 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Send().

int vtkMultiProcessController::Send char *  data,
int  length,
int  remoteProcessId,
int  tag
[inline]
 

This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Definition at line 378 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Send().

int vtkMultiProcessController::Send unsigned char *  data,
int  length,
int  remoteProcessId,
int  tag
[inline]
 

This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Definition at line 391 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Send().

int vtkMultiProcessController::Send float *  data,
int  length,
int  remoteProcessId,
int  tag
[inline]
 

This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Definition at line 404 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Send().

int vtkMultiProcessController::Send double *  data,
int  length,
int  remoteProcessId,
int  tag
[inline]
 

This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Definition at line 417 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Send().

int vtkMultiProcessController::Send vtkDataObject data,
int  remoteId,
int  tag
[inline]
 

This method sends data to another process. Tag eliminates ambiguity when multiple sends or receives exist in the same process.

Definition at line 325 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Send().

int vtkMultiProcessController::Send vtkDataArray data,
int  remoteId,
int  tag
[inline]
 

Definition at line 338 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Send().

int vtkMultiProcessController::Receive int *  data,
int  length,
int  remoteProcessId,
int  tag
[inline]
 

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.

Definition at line 471 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Receive().

int vtkMultiProcessController::Receive unsigned long *  data,
int  length,
int  remoteProcessId,
int  tag
[inline]
 

Definition at line 484 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Receive().

int vtkMultiProcessController::Receive char *  data,
int  length,
int  remoteProcessId,
int  tag
[inline]
 

Definition at line 498 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Receive().

int vtkMultiProcessController::Receive unsigned char *  data,
int  length,
int  remoteProcessId,
int  tag
[inline]
 

Definition at line 511 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Receive().

int vtkMultiProcessController::Receive float *  data,
int  length,
int  remoteProcessId,
int  tag
[inline]
 

Definition at line 524 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Receive().

int vtkMultiProcessController::Receive double *  data,
int  length,
int  remoteProcessId,
int  tag
[inline]
 

Definition at line 537 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Receive().

int vtkMultiProcessController::Receive vtkDataObject data,
int  remoteId,
int  tag
[inline]
 

Definition at line 445 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Receive().

int vtkMultiProcessController::Receive vtkDataArray data,
int  remoteId,
int  tag
[inline]
 

Definition at line 458 of file vtkMultiProcessController.h.

References Communicator, and vtkCommunicator::Receive().

void vtkMultiProcessController::ProcessRMI int  remoteProcessId,
void *  arg,
int  argLength,
int  rmiTag
[protected]
 

virtual vtkMultiProcessController* vtkMultiProcessController::GetLocalController  )  [protected, virtual]
 


Member Data Documentation

int vtkMultiProcessController::MaximumNumberOfProcesses [protected]
 

Definition at line 277 of file vtkMultiProcessController.h.

int vtkMultiProcessController::NumberOfProcesses [protected]
 

Definition at line 278 of file vtkMultiProcessController.h.

int vtkMultiProcessController::LocalProcessId [protected]
 

Definition at line 280 of file vtkMultiProcessController.h.

vtkProcessFunctionType vtkMultiProcessController::SingleMethod [protected]
 

Definition at line 282 of file vtkMultiProcessController.h.

void* vtkMultiProcessController::SingleData [protected]
 

Definition at line 283 of file vtkMultiProcessController.h.

vtkProcessFunctionType vtkMultiProcessController::MultipleMethod[MAX_PROCESSES] [protected]
 

Definition at line 284 of file vtkMultiProcessController.h.

void* vtkMultiProcessController::MultipleData[MAX_PROCESSES] [protected]
 

Definition at line 285 of file vtkMultiProcessController.h.

vtkCollection* vtkMultiProcessController::RMIs [protected]
 

Definition at line 287 of file vtkMultiProcessController.h.

int vtkMultiProcessController::BreakFlag [protected]
 

Definition at line 291 of file vtkMultiProcessController.h.

int vtkMultiProcessController::ForceDeepCopy [protected]
 

Definition at line 301 of file vtkMultiProcessController.h.

vtkOutputWindow* vtkMultiProcessController::OutputWindow [protected]
 

Definition at line 303 of file vtkMultiProcessController.h.

vtkCommunicator* vtkMultiProcessController::Communicator [protected]
 

Definition at line 308 of file vtkMultiProcessController.h.

Referenced by Receive(), and Send().

vtkCommunicator* vtkMultiProcessController::RMICommunicator [protected]
 

Definition at line 317 of file vtkMultiProcessController.h.


The documentation for this class was generated from the following file:
Generated on Tue Jan 22 00:02:27 2008 for VTK by  doxygen 1.4.3-20050530