VTK  9.2.20230201
vtkSMPMergePoints.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSMPMergePoints.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 =========================================================================*/
33 #ifndef vtkSMPMergePoints_h
34 #define vtkSMPMergePoints_h
35 
36 #include "vtkFiltersSMPModule.h" // For export macro
37 #include "vtkIdList.h" // For inline functions
38 #include "vtkMergePoints.h"
39 #include "vtkType.h" // For vtkIdType
40 
41 #include <atomic> // for std::atomic
42 
43 VTK_ABI_NAMESPACE_BEGIN
44 class vtkPointData;
45 
46 class VTKFILTERSSMP_EXPORT vtkSMPMergePoints : public vtkMergePoints
47 {
48 public:
51  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
57 
67  void Merge(vtkSMPMergePoints* locator, vtkIdType idx, vtkPointData* outPd, vtkPointData* inPd,
68  vtkIdList* idList);
69 
79 
83  vtkIdType GetMaxId() { return this->AtomicInsertionId - 1; }
84 
86 
90  {
91  if (!this->HashTable)
92  {
93  return 0;
94  }
95  vtkIdList* bucket = this->HashTable[idx];
96  return bucket ? bucket->GetNumberOfIds() : 0;
97  }
99 
103  vtkIdType GetNumberOfBuckets() VTK_FUTURE_CONST override { return this->NumberOfBuckets; }
104 
105 protected:
107  ~vtkSMPMergePoints() override;
108 
109  std::atomic<vtkIdType> AtomicInsertionId;
110 
111 private:
112  vtkSMPMergePoints(const vtkSMPMergePoints&) = delete;
113  void operator=(const vtkSMPMergePoints&) = delete;
114 };
115 
116 VTK_ABI_NAMESPACE_END
117 #endif // vtkSMPMergePoints_h
list of point or cell ids
Definition: vtkIdList.h:144
vtkIdType GetNumberOfIds() const noexcept
Return the number of id's in the list.
Definition: vtkIdList.h:170
a simple class to control print indentation
Definition: vtkIndent.h:120
merge exactly coincident points
represent and manipulate point attribute data
Definition: vtkPointData.h:151
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:327