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