vtkMaterialInterfaceProcessLoading.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: $RCSfile$
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
22 #ifndef vtkMaterialInterfaceProcessLoading_h
23 #define vtkMaterialInterfaceProcessLoading_h
24 
25 #include "vtkPVVTKExtensionsFiltersMaterialInterfaceModule.h" //needed for exports
26 
27 #include "vtkType.h"
28 #include <cassert>
29 #include <iostream>
30 #include <vector>
31 
33 {
34 public:
35  enum
36  {
37  ID = 0,
38  LOADING = 1,
39  SIZE = 2
40  };
41  //
42  vtkMaterialInterfaceProcessLoading() { this->Initialize(-1, 0); }
43  //
44  ~vtkMaterialInterfaceProcessLoading() { this->Initialize(-1, 0); }
46 
49  void Initialize(int id, vtkIdType loadFactor)
50  {
51  this->Data[ID] = id;
52  this->Data[LOADING] = loadFactor;
53  }
55 
59  {
60  return this->Data[LOADING] < rhs.Data[LOADING];
61  }
66  {
67  return this->Data[LOADING] <= rhs.Data[LOADING];
68  }
73  {
74  return this->Data[LOADING] > rhs.Data[LOADING];
75  }
80  {
81  return this->Data[LOADING] >= rhs.Data[LOADING];
82  }
87  {
88  return this->Data[LOADING] == rhs.Data[LOADING];
89  }
93  vtkIdType GetId() const { return this->Data[ID]; }
97  vtkIdType GetLoadFactor() const { return this->Data[LOADING]; }
99 
103  {
104  assert("Update would make loading negative." && (this->Data[LOADING] + loadFactor) >= 0);
105  return this->Data[LOADING] += loadFactor;
106  }
107 
108 private:
109  vtkIdType Data[SIZE];
110 };
112 std::ostream& operator<<(std::ostream& sout, const vtkMaterialInterfaceProcessLoading& fp);
114 std::ostream& operator<<(
115  std::ostream& sout, const std::vector<vtkMaterialInterfaceProcessLoading>& vfp);
116 #endif
117 
118 
119 // VTK-HeaderTest-Exclude: vtkMaterialInterfaceProcessLoading.h
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)