VTK  9.3.0
vtkProcessGroup.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
4 
32 #ifndef vtkProcessGroup_h
33 #define vtkProcessGroup_h
34 
35 #include "vtkObject.h"
36 #include "vtkParallelCoreModule.h" // For export macro
37 
38 VTK_ABI_NAMESPACE_BEGIN
40 class vtkCommunicator;
41 
42 class VTKPARALLELCORE_EXPORT vtkProcessGroup : public vtkObject
43 {
44 public:
45  vtkTypeMacro(vtkProcessGroup, vtkObject);
46  static vtkProcessGroup* New();
47  void PrintSelf(ostream& os, vtkIndent indent) override;
48 
50 
56  void Initialize(vtkCommunicator* communicator);
58 
60 
63  vtkGetObjectMacro(Communicator, vtkCommunicator);
65 
73  void SetCommunicator(vtkCommunicator* communicator);
74 
76 
79  vtkGetMacro(NumberOfProcessIds, int);
81 
88  int GetProcessId(int pos) { return this->ProcessIds[pos]; }
89 
95 
102  int FindProcessId(int processId);
103 
108  int AddProcessId(int processId);
109 
116  int RemoveProcessId(int processId);
117 
122 
126  void Copy(vtkProcessGroup* group);
127 
128 protected:
130  ~vtkProcessGroup() override;
131 
134 
136 
137 private:
138  vtkProcessGroup(const vtkProcessGroup&) = delete;
139  void operator=(const vtkProcessGroup&) = delete;
140 };
141 
142 VTK_ABI_NAMESPACE_END
143 #endif // vtkProcessGroup_h
Used to send/receive messages in a multiprocess environment.
a simple class to control print indentation
Definition: vtkIndent.h:29
Multiprocessing communication superclass.
abstract base class for most VTK objects
Definition: vtkObject.h:52
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).