vtkMaterialInterfaceProcessLoading.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
3 // SPDX-License-Identifier: BSD-3-Clause
11 #ifndef vtkMaterialInterfaceProcessLoading_h
12 #define vtkMaterialInterfaceProcessLoading_h
13 
14 #include "vtkPVVTKExtensionsFiltersMaterialInterfaceModule.h" //needed for exports
15 
16 #include "vtkType.h" // for vtkIdType
17 #include <cassert> // for assert
18 #include <iostream> // for std::ostream
19 #include <vector> // for std::vector
20 
22 {
23 public:
24  enum
25  {
26  ID = 0,
27  LOADING = 1,
28  SIZE = 2
29  };
30  //
31  vtkMaterialInterfaceProcessLoading() { this->Initialize(-1, 0); }
32  //
33  ~vtkMaterialInterfaceProcessLoading() { this->Initialize(-1, 0); }
35 
38  void Initialize(int id, vtkIdType loadFactor)
39  {
40  this->Data[ID] = id;
41  this->Data[LOADING] = loadFactor;
42  }
44 
48  {
49  return this->Data[LOADING] < rhs.Data[LOADING];
50  }
55  {
56  return this->Data[LOADING] <= rhs.Data[LOADING];
57  }
62  {
63  return this->Data[LOADING] > rhs.Data[LOADING];
64  }
69  {
70  return this->Data[LOADING] >= rhs.Data[LOADING];
71  }
76  {
77  return this->Data[LOADING] == rhs.Data[LOADING];
78  }
82  vtkIdType GetId() const { return this->Data[ID]; }
86  vtkIdType GetLoadFactor() const { return this->Data[LOADING]; }
88 
92  {
93  assert("Update would make loading negative." && (this->Data[LOADING] + loadFactor) >= 0);
94  return this->Data[LOADING] += loadFactor;
95  }
96 
97 private:
98  vtkIdType Data[SIZE];
99 };
101 std::ostream& operator<<(std::ostream& sout, const vtkMaterialInterfaceProcessLoading& fp);
103 std::ostream& operator<<(
104  std::ostream& sout, const std::vector<vtkMaterialInterfaceProcessLoading>& vfp);
105 #endif
106 
bool operator>(const vtkMaterialInterfaceProcessLoading &rhs) const
Comparison of two objects loading.
bool operator<(const vtkMaterialInterfaceProcessLoading &rhs) const
Comparison of two objects loading.
Data type to represent a node in a multiprocess job and its current loading state.
#define VTKPVVTKEXTENSIONSFILTERSMATERIALINTERFACE_EXPORT
vtkIdType GetLoadFactor() const
Return the load factor.
bool operator>=(const vtkMaterialInterfaceProcessLoading &rhs) const
Comparison of two objects loading.
int vtkIdType
void Initialize(int id, vtkIdType loadFactor)
Set the id and load factor.
bool operator==(const vtkMaterialInterfaceProcessLoading &rhs) const
Comparison of two objects loading.
vtkIdType GetId() const
Return the process id.
bool operator<=(const vtkMaterialInterfaceProcessLoading &rhs) const
Comparison of two objects loading.
vtkIdType UpdateLoadFactor(vtkIdType loadFactor)
Add to the load factor.
VTKPVVTKEXTENSIONSFILTERSMATERIALINTERFACE_EXPORT std::ostream & operator<<(std::ostream &sout, const vtkMaterialInterfaceProcessLoading &fp)