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 
21 class VTKPVVTKEXTENSIONSFILTERSMATERIALINTERFACE_EXPORT vtkMaterialInterfaceProcessLoading
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 };
100 VTKPVVTKEXTENSIONSFILTERSMATERIALINTERFACE_EXPORT
101 std::ostream& operator<<(std::ostream& sout, const vtkMaterialInterfaceProcessLoading& fp);
102 VTKPVVTKEXTENSIONSFILTERSMATERIALINTERFACE_EXPORT
103 std::ostream& operator<<(
104  std::ostream& sout, const std::vector<vtkMaterialInterfaceProcessLoading>& vfp);
105 #endif
106 
vtkMaterialInterfaceProcessLoading::operator>
bool operator>(const vtkMaterialInterfaceProcessLoading &rhs) const
Comparison of two objects loading.
Definition: vtkMaterialInterfaceProcessLoading.h:61
vtkIdType
int vtkIdType
vtkMaterialInterfaceProcessLoading::operator<
bool operator<(const vtkMaterialInterfaceProcessLoading &rhs) const
Comparison of two objects loading.
Definition: vtkMaterialInterfaceProcessLoading.h:47
vtkMaterialInterfaceProcessLoading
Definition: vtkMaterialInterfaceProcessLoading.h:21
vtkMaterialInterfaceProcessLoading::operator>=
bool operator>=(const vtkMaterialInterfaceProcessLoading &rhs) const
Comparison of two objects loading.
Definition: vtkMaterialInterfaceProcessLoading.h:68
vtkType.h
vtkMaterialInterfaceProcessLoading::vtkMaterialInterfaceProcessLoading
vtkMaterialInterfaceProcessLoading()
Definition: vtkMaterialInterfaceProcessLoading.h:31
operator<<
VTKPVVTKEXTENSIONSFILTERSMATERIALINTERFACE_EXPORT std::ostream & operator<<(std::ostream &sout, const vtkMaterialInterfaceProcessLoading &fp)
vtkMaterialInterfaceProcessLoading::UpdateLoadFactor
vtkIdType UpdateLoadFactor(vtkIdType loadFactor)
Add to the load factor.
Definition: vtkMaterialInterfaceProcessLoading.h:91
vtkMaterialInterfaceProcessLoading::~vtkMaterialInterfaceProcessLoading
~vtkMaterialInterfaceProcessLoading()
Definition: vtkMaterialInterfaceProcessLoading.h:33
vtkMaterialInterfaceProcessLoading::operator==
bool operator==(const vtkMaterialInterfaceProcessLoading &rhs) const
Comparison of two objects loading.
Definition: vtkMaterialInterfaceProcessLoading.h:75
vtkMaterialInterfaceProcessLoading::Initialize
void Initialize(int id, vtkIdType loadFactor)
Set the id and load factor.
Definition: vtkMaterialInterfaceProcessLoading.h:38
vtkMaterialInterfaceProcessLoading::operator<=
bool operator<=(const vtkMaterialInterfaceProcessLoading &rhs) const
Comparison of two objects loading.
Definition: vtkMaterialInterfaceProcessLoading.h:54
vtkMaterialInterfaceProcessLoading::GetId
vtkIdType GetId() const
Return the process id.
Definition: vtkMaterialInterfaceProcessLoading.h:82
vtkMaterialInterfaceProcessLoading::GetLoadFactor
vtkIdType GetLoadFactor() const
Return the load factor.
Definition: vtkMaterialInterfaceProcessLoading.h:86