vtkMaterialInterfaceIdListItem.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
10 #ifndef vtkMaterialInterfaceIdListItem_h
11 #define vtkMaterialInterfaceIdListItem_h
12 
13 #include "vtkPVVTKExtensionsFiltersMaterialInterfaceModule.h" //needed for exports
14 
16 {
17 public:
18  enum
19  {
20  LOCAL_ID = 0,
21  GLOBAL_ID = 1,
22  SIZE = 2
23  };
24  //
25  vtkMaterialInterfaceIdListItem() { this->Clear(); }
26  vtkMaterialInterfaceIdListItem(int globalId) { this->Initialize(-1, globalId); }
27  //
29  {
30  this->Initialize(other.GetLocalId(), other.GetGlobalId());
31  }
32  //
33  ~vtkMaterialInterfaceIdListItem() { this->Clear(); }
34  //
35  void Clear()
36  {
37  this->Data[LOCAL_ID] = -1;
38  this->Data[GLOBAL_ID] = -1;
39  }
40  //
41  void Initialize(int localId, int globalId)
42  {
43  this->Data[LOCAL_ID] = localId;
44  this->Data[GLOBAL_ID] = globalId;
45  }
46  //
47  int GetLocalId() const { return this->Data[LOCAL_ID]; }
48  //
49  int GetGlobalId() const { return this->Data[GLOBAL_ID]; }
50  // Comparison made by global id.
51  bool operator<(const vtkMaterialInterfaceIdListItem& other) const
52  {
53  return this->GetGlobalId() < other.GetGlobalId();
54  }
55  // Comparison made by global id.
56  bool operator<=(const vtkMaterialInterfaceIdListItem& other) const
57  {
58  return this->GetGlobalId() <= other.GetGlobalId();
59  }
60  // Comparison made by global id.
61  bool operator>(const vtkMaterialInterfaceIdListItem& other) const
62  {
63  return this->GetGlobalId() > other.GetGlobalId();
64  }
65  // Comparison made by global id.
66  bool operator>=(const vtkMaterialInterfaceIdListItem& other) const
67  {
68  return this->GetGlobalId() >= other.GetGlobalId();
69  }
70  // Comparison made by global id.
71  bool operator==(const vtkMaterialInterfaceIdListItem& other) const
72  {
73  return this->GetGlobalId() == other.GetGlobalId();
74  }
75  //
77  {
78  this->Initialize(other.GetLocalId(), other.GetGlobalId());
79  return *this;
80  }
81 
82 private:
83  int Data[SIZE];
84 };
85 #endif
#define VTKPVVTKEXTENSIONSFILTERSMATERIALINTERFACE_EXPORT
void Initialize(int localId, int globalId)
bool operator==(const vtkMaterialInterfaceIdListItem &other) const
bool operator>=(const vtkMaterialInterfaceIdListItem &other) const
bool operator<(const vtkMaterialInterfaceIdListItem &other) const
vtkMaterialInterfaceIdListItem(const vtkMaterialInterfaceIdListItem &other)
bool operator>(const vtkMaterialInterfaceIdListItem &other) const
bool operator<=(const vtkMaterialInterfaceIdListItem &other) const
Elemental data type for fragment id list containers.
vtkMaterialInterfaceIdListItem & operator=(const vtkMaterialInterfaceIdListItem &other)