VTK  9.1.0
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
45#ifndef vtkProcessGroup_h
46#define vtkProcessGroup_h
47
48#include "vtkObject.h"
49#include "vtkParallelCoreModule.h" // For export macro
50
52class vtkCommunicator;
53
54class VTKPARALLELCORE_EXPORT vtkProcessGroup : public vtkObject
55{
56public:
57 vtkTypeMacro(vtkProcessGroup, vtkObject);
59 void PrintSelf(ostream& os, vtkIndent indent) override;
60
62
68 void Initialize(vtkCommunicator* communicator);
70
72
75 vtkGetObjectMacro(Communicator, vtkCommunicator);
77
85 void SetCommunicator(vtkCommunicator* communicator);
86
88
91 vtkGetMacro(NumberOfProcessIds, int);
93
100 int GetProcessId(int pos) { return this->ProcessIds[pos]; }
101
107
114 int FindProcessId(int processId);
115
120 int AddProcessId(int processId);
121
128 int RemoveProcessId(int processId);
129
134
138 void Copy(vtkProcessGroup* group);
139
140protected:
143
146
148
149private:
150 vtkProcessGroup(const vtkProcessGroup&) = delete;
151 void operator=(const vtkProcessGroup&) = delete;
152};
153
154#endif // vtkProcessGroup_h
Used to send/receive messages in a multiprocess environment.
a simple class to control print indentation
Definition: vtkIndent.h:113
Multiprocessing communication superclass.
abstract base class for most VTK objects
Definition: vtkObject.h:82
A subgroup of processes from a communicator.
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).