VTK  9.1.20211230
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 class vtkPointData;
44 
45 class VTKFILTERSSMP_EXPORT vtkSMPMergePoints : public vtkMergePoints
46 {
47 public:
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
56 
66  void Merge(vtkSMPMergePoints* locator, vtkIdType idx, vtkPointData* outPd, vtkPointData* inPd,
67  vtkIdList* idList);
68 
78 
82  vtkIdType GetMaxId() { return this->AtomicInsertionId - 1; }
83 
85 
89  {
90  if (!this->HashTable)
91  {
92  return 0;
93  }
94  vtkIdList* bucket = this->HashTable[idx];
95  return bucket ? bucket->GetNumberOfIds() : 0;
96  }
98 
102  vtkIdType GetNumberOfBuckets() override { return this->NumberOfBuckets; }
103 
104 protected:
106  ~vtkSMPMergePoints() override;
107 
108  std::atomic<vtkIdType> AtomicInsertionId;
109 
110 private:
111  vtkSMPMergePoints(const vtkSMPMergePoints&) = delete;
112  void operator=(const vtkSMPMergePoints&) = delete;
113 };
114 
115 #endif // vtkSMPMergePoints_h
list of point or cell ids
Definition: vtkIdList.h:140
vtkIdType GetNumberOfIds() const noexcept
Return the number of id's in the list.
Definition: vtkIdList.h:166
a simple class to control print indentation
Definition: vtkIndent.h:113
merge exactly coincident points
represent and manipulate point attribute data
Definition: vtkPointData.h:142
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 GetNumberOfBuckets() override
Returns the number of bins.
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
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:332