Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# vtkThreadedController Class Reference

`#include <vtkThreadedController.h>`

Inheritance diagram for vtkThreadedController:

[legend]
Collaboration diagram for vtkThreadedController:

[legend]
List of all members.

## Detailed Description

Allows communication between running threads.

Date:
  2002/11/04 21:26:50

Revision:
  1.15

vtkThreadedController uses a vtkMultiThreader to spawn threads. The communication is accomplished using a vtkSharedMemoryCommunicator. The RMI communicator is identical to the user communicator. Note that each thread gets its own vtkThreadedController to accomplish thread safety.

See also:
  vtkMultiProcessController vtkMultiThreader vtkSharedMemoryCommunicator vtkInputPort vtkOutputPort

Created by:
  - Martin, Ken

CVS contributions (if > 5%):
  - Martin, Ken (76%)
  - Geveci, Berk (15%)

CVS logs (CVSweb):
  - .`cxx` (`/Parallel/vtkThreadedController.cxx)`
  - .`h` (`/Parallel/vtkThreadedController.h)`

Tests:
  vtkThreadedController (Tests)

Definition at line 55 of file vtkThreadedController.h.

## Public Types

typedef vtkMultiProcessController | Superclass

## Public Methods

virtual const char * | GetClassName ()
virtual int | IsA (const char *type)
void | PrintSelf (ostream &os, vtkIndent indent)
virtual void | SingleMethodExecute ()
virtual void | MultipleMethodExecute ()
virtual void | Barrier ()
virtual void | CreateOutputWindow ()
virtual void | Initialize (int *argc, char ***argv, int)
virtual void | Initialize (int *argc, char ***argv)
virtual void | Finalize ()
virtual void | Finalize (int)
virtual int | GetLocalProcessId ()

## Static Public Methods

vtkThreadedController * | New ()
int | IsTypeOf (const char *type)
vtkThreadedController * | SafeDownCast (vtkObject *o)

## Protected Types

typedef int | ThreadIdType

## Protected Methods

| vtkThreadedController ()
| ~vtkThreadedController ()
void | CreateProcessControllers ()
void | Start (int threadIdx)
void | ResetControllers ()
vtkMultiProcessController * | GetLocalController ()

## Static Protected Methods

VTK_THREAD_RETURN_TYPE | vtkThreadedControllerStart (void *arg)
void | WaitForPreviousBarrierToEnd ()
void | BarrierStarted ()
void | BarrierEnded ()
void | SignalNextThread ()
void | InitializeBarrier ()
void | WaitForNextThread ()

## Protected Attributes

vtkThreadedController ** | Controllers
ThreadIdType | ThreadId
int | LastNumberOfProcesses
vtkMultiThreader * | MultiThreader
int | MultipleMethodFlag

## Static Protected Attributes

vtkSimpleCriticalSection | CounterLock
int | Counter
int | IsBarrierInProgress
vtkSimpleCriticalSection * | BarrierLock
vtkSimpleCriticalSection * | BarrierInProgress

## Member Typedef Documentation

typedef vtkMultiProcessController vtkThreadedController::Superclass

| Reimplemented from vtkMultiProcessController. Definition at line 59 of file vtkThreadedController.h.

typedef int vtkThreadedController::ThreadIdType`[protected]`

| Definition at line 123 of file vtkThreadedController.h.

## Constructor & Destructor Documentation

vtkThreadedController::vtkThreadedController | ( |  | ) | `[protected]`

vtkThreadedController::~vtkThreadedController | ( |  | ) | `[protected]`

## Member Function Documentation

vtkThreadedController* vtkThreadedController::New | ( |  | ) | `[static]`

| Create an object with Debug turned off, modified time initialized to zero, and reference counting on. Reimplemented from vtkMultiProcessController.

virtual const char* vtkThreadedController::GetClassName | ( |  | ) | `[virtual]`

| Reimplemented from vtkMultiProcessController.

int vtkThreadedController::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 vtkMultiProcessController.

virtual int vtkThreadedController::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 vtkMultiProcessController.

vtkThreadedController* vtkThreadedController::SafeDownCast | ( | vtkObject * | o | ) | `[static]`

| Reimplemented from vtkMultiProcessController.

void vtkThreadedController::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 vtkMultiProcessController.

virtual void vtkThreadedController::Initialize | ( | int * | argc,
|  | char *** | argv,
|  | int |
| ) | `[inline, virtual]`

| This method is for setting up the processes. Definition at line 64 of file vtkThreadedController.h. References vtkMultiProcessController::Initialize().

virtual void vtkThreadedController::Initialize | ( | int * | argc,
|  | char *** | argv
| ) | `[virtual]`

| This method is for setting up the processes.

virtual void vtkThreadedController::Finalize | ( |  | ) | `[virtual]`

| This method is for setting up the processes. Implements vtkMultiProcessController.

virtual void vtkThreadedController::Finalize | ( | int |  | ) | `[inline, virtual]`

| This method is for setting up the processes. Implements vtkMultiProcessController. Definition at line 68 of file vtkThreadedController.h. References vtkMultiProcessController::Finalize().

virtual int vtkThreadedController::GetLocalProcessId | ( |  | ) | `[virtual]`

| This method returns an integer from 0 to (NumberOfProcesses-1) indicating which process we are in. Note: The correct controller is passed as an argument to the initial function (SingleMethod/MultipleMethod). Calling this method on another controller may give wrong results. Reimplemented from vtkMultiProcessController.

virtual void vtkThreadedController::SingleMethodExecute | ( |  | ) | `[virtual]`

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

virtual void vtkThreadedController::MultipleMethodExecute | ( |  | ) | `[virtual]`

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

virtual void vtkThreadedController::Barrier | ( |  | ) | `[virtual]`

| This method can be used to synchronize the threads. Implements vtkMultiProcessController.

virtual void vtkThreadedController::CreateOutputWindow | ( |  | ) | `[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. Implements vtkMultiProcessController.

void vtkThreadedController::CreateProcessControllers | ( |  | ) | `[protected]`

void vtkThreadedController::Start | ( | int | threadIdx | ) | `[protected]`

| First method called after threads are spawned.

void vtkThreadedController::ResetControllers | ( |  | ) | `[protected]`

VTK_THREAD_RETURN_TYPE vtkThreadedController::vtkThreadedControllerStart | ( | void * | arg | ) | `[static, protected]`

void vtkThreadedController::WaitForPreviousBarrierToEnd | ( |  | ) | `[static, protected]`

void vtkThreadedController::BarrierStarted | ( |  | ) | `[static, protected]`

void vtkThreadedController::BarrierEnded | ( |  | ) | `[static, protected]`

void vtkThreadedController::SignalNextThread | ( |  | ) | `[static, protected]`

void vtkThreadedController::InitializeBarrier | ( |  | ) | `[static, protected]`

void vtkThreadedController::WaitForNextThread | ( |  | ) | `[static, protected]`

vtkMultiProcessController* vtkThreadedController::GetLocalController | ( |  | ) | `[protected, 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. Reimplemented from vtkMultiProcessController.

## Member Data Documentation

vtkThreadedController** vtkThreadedController::Controllers`[protected]`

| Definition at line 111 of file vtkThreadedController.h.

vtkSimpleCriticalSection vtkThreadedController::CounterLock`[static, protected]`

| Definition at line 129 of file vtkThreadedController.h.

int vtkThreadedController::Counter`[static, protected]`

| Definition at line 130 of file vtkThreadedController.h.

int vtkThreadedController::IsBarrierInProgress`[static, protected]`

| Definition at line 131 of file vtkThreadedController.h.

vtkSimpleCriticalSection* vtkThreadedController::BarrierLock`[static, protected]`

| Definition at line 142 of file vtkThreadedController.h.

vtkSimpleCriticalSection* vtkThreadedController::BarrierInProgress`[static, protected]`

| Definition at line 143 of file vtkThreadedController.h.

ThreadIdType vtkThreadedController::ThreadId`[protected]`

| Definition at line 146 of file vtkThreadedController.h.

int vtkThreadedController::LastNumberOfProcesses`[protected]`

| Definition at line 148 of file vtkThreadedController.h.

vtkMultiThreader* vtkThreadedController::MultiThreader`[protected]`

| Definition at line 150 of file vtkThreadedController.h.

int vtkThreadedController::MultipleMethodFlag`[protected]`

| Definition at line 152 of file vtkThreadedController.h.

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

- Parallel/vtkThreadedController.h