VTK  9.3.20240417
vtkSMPMergePoints.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
21 #ifndef vtkSMPMergePoints_h
22 #define vtkSMPMergePoints_h
23 
24 #include "vtkFiltersSMPModule.h" // For export macro
25 #include "vtkIdList.h" // For inline functions
26 #include "vtkMergePoints.h"
27 #include "vtkType.h" // For vtkIdType
28 
29 #include <atomic> // for std::atomic
30 
31 VTK_ABI_NAMESPACE_BEGIN
32 class vtkPointData;
33 
34 class VTKFILTERSSMP_EXPORT vtkSMPMergePoints : public vtkMergePoints
35 {
36 public:
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
45 
55  void Merge(vtkSMPMergePoints* locator, vtkIdType idx, vtkPointData* outPd, vtkPointData* inPd,
56  vtkIdList* idList);
57 
67 
71  vtkIdType GetMaxId() { return this->AtomicInsertionId - 1; }
72 
74 
78  {
79  if (!this->HashTable)
80  {
81  return 0;
82  }
83  vtkIdList* bucket = this->HashTable[idx];
84  return bucket ? bucket->GetNumberOfIds() : 0;
85  }
87 
91  vtkIdType GetNumberOfBuckets() VTK_FUTURE_CONST override { return this->NumberOfBuckets; }
92 
93 protected:
95  ~vtkSMPMergePoints() override;
96 
97  std::atomic<vtkIdType> AtomicInsertionId;
98 
99 private:
100  vtkSMPMergePoints(const vtkSMPMergePoints&) = delete;
101  void operator=(const vtkSMPMergePoints&) = delete;
102 };
103 
104 VTK_ABI_NAMESPACE_END
105 #endif // vtkSMPMergePoints_h
list of point or cell ids
Definition: vtkIdList.h:133
vtkIdType GetNumberOfIds() const noexcept
Return the number of id's in the list.
Definition: vtkIdList.h:159
a simple class to control print indentation
Definition: vtkIndent.h:108
merge exactly coincident points
represent and manipulate point attribute data
Definition: vtkPointData.h:140
Class designed to help with merging of points in parallel.
~vtkSMPMergePoints() override
vtkIdType GetMaxId()
Returns the biggest id in the locator.
void FixSizeOfPointArray()
At the of the merge, this can be called to set the MaxId of the points array to the maximum id in the...
vtkIdType GetNumberOfIdsInBucket(vtkIdType idx)
Returns the number of points in a bin.
void InitializeMerge()
This should be called from 1 thread before any call to Merge.
std::atomic< vtkIdType > AtomicInsertionId
vtkIdType GetNumberOfBuckets() VTK_FUTURE_CONST override
Returns the number of bins.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard type and print methods.
static vtkSMPMergePoints * New()
void Merge(vtkSMPMergePoints *locator, vtkIdType idx, vtkPointData *outPd, vtkPointData *inPd, vtkIdList *idList)
Merge the points of one of the bins from the given locator to the same bin of the current locator.
int vtkIdType
Definition: vtkType.h:315