VTK  9.2.6
vtkProcessGroup.h
Go to the documentation of this file.
1// -*- c++ -*-
2/*=========================================================================
3
4 Program: Visualization Toolkit
5 Module: vtkProcessGroup.h
6
7 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
8 All rights reserved.
9 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16/*----------------------------------------------------------------------------
17 Copyright (c) Sandia Corporation
18 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
19----------------------------------------------------------------------------*/
20
47
48#ifndef vtkProcessGroup_h
49#define vtkProcessGroup_h
50
51#include "vtkObject.h"
52#include "vtkParallelCoreModule.h" // For export macro
53
55class vtkCommunicator;
56
57class VTKPARALLELCORE_EXPORT vtkProcessGroup : public vtkObject
58{
59public:
60 vtkTypeMacro(vtkProcessGroup, vtkObject);
62 void PrintSelf(ostream& os, vtkIndent indent) override;
63
65
71 void Initialize(vtkCommunicator* communicator);
73
75
78 vtkGetObjectMacro(Communicator, vtkCommunicator);
80
88 void SetCommunicator(vtkCommunicator* communicator);
89
91
94 vtkGetMacro(NumberOfProcessIds, int);
96
103 int GetProcessId(int pos) { return this->ProcessIds[pos]; }
104
110
117 int FindProcessId(int processId);
118
123 int AddProcessId(int processId);
124
131 int RemoveProcessId(int processId);
132
137
141 void Copy(vtkProcessGroup* group);
142
143protected:
146
149
151
152private:
153 vtkProcessGroup(const vtkProcessGroup&) = delete;
154 void operator=(const vtkProcessGroup&) = delete;
155};
156
157#endif // vtkProcessGroup_h
Used to send/receive messages in a multiprocess environment.
a simple class to control print indentation
Definition vtkIndent.h:40
Multiprocessing communication superclass.
int GetProcessId(int pos)
Given a position in the group, returns the id of the process in the communicator this group is based ...
~vtkProcessGroup() override
int FindProcessId(int processId)
Given a process id in the communicator, this method returns its location in the group or -1 if it is ...
int AddProcessId(int processId)
Add a process id to the end of the group (if it is not already in the group).
static vtkProcessGroup * New()
void Initialize(vtkCommunicator *communicator)
Initialize the group to the given controller or communicator.
void SetCommunicator(vtkCommunicator *communicator)
Set the communicator.
vtkCommunicator * Communicator
void RemoveAllProcessIds()
Removes all the processes ids from the group, leaving the group empty.
void Initialize(vtkMultiProcessController *controller)
Initialize the group to the given controller or communicator.
int GetLocalProcessId()
Get the process id for the local process (as defined by the group's communicator).
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void Copy(vtkProcessGroup *group)
Copies the given group's communicator and process ids.
int RemoveProcessId(int processId)
Remove the given process id from the group (assuming it is in the group).