vtkEquivalenceSet.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
12 #ifndef vtkEquivalenceSet_h
13 #define vtkEquivalenceSet_h
14 
15 #include "vtkObject.h"
16 #include "vtkPVVTKExtensionsFiltersGeneralModule.h" //needed for exports
17 class vtkIntArray;
18 
20 {
21 public:
22  vtkTypeMacro(vtkEquivalenceSet, vtkObject);
23  void PrintSelf(ostream& os, vtkIndent indent) override;
24  static vtkEquivalenceSet* New();
25 
26  void Initialize();
27  void AddEquivalence(int id1, int id2);
28 
29  // The length of the equivalent array...
30  // The Domain of the equivalance map is [0, numberOfMembers).
31  int GetNumberOfMembers();
32 
33  // Valid only after set is resolved.
34  // The range of the map is [0 numberOfResolvedSets)
35  int GetNumberOfResolvedSets() { return this->NumberOfResolvedSets; }
36 
37  // Return the id of the equivalent set.
38  int GetEquivalentSetId(int memberId);
39 
40  // Equivalent set ids are reassinged to be sequential.
41  // You cannot add anymore equivalences after this is called.
42  virtual int ResolveEquivalences();
43 
44  void DeepCopy(vtkEquivalenceSet* in);
45 
46  // Needed for sending the set over MPI.
47  // Be very careful with the pointer.
48  // I guess this means do not write to the memory.
49  int* GetPointer();
50 
51  // Free unused memory
52  void Squeeze();
53 
54  // Report used memory
55  vtkIdType Capacity();
56 
57  // We should fix the pointer API and hide this ivar.
58  int Resolved;
59 
60  int GetReference(int memberId);
61 
62 protected:
64  ~vtkEquivalenceSet() override;
65 
67 
68  // To merge connected framgments that have different ids because they were
69  // traversed by different processes or passes.
71 
72  // Return the id of the equivalent set.
73  void EquateInternal(int id1, int id2);
74 
75 private:
76  vtkEquivalenceSet(const vtkEquivalenceSet&) = delete;
77  void operator=(const vtkEquivalenceSet&) = delete;
78 };
79 
80 #endif
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
void DeepCopy(vtkPistonReference *self, vtkPistonReference *other)
int vtkIdType
vtkIntArray * EquivalenceArray
#define VTKPVVTKEXTENSIONSFILTERSGENERAL_EXPORT
static vtkObject * New()
void operator=(const vtkObjectBase &)
records groups of integers that are equivalent.