VTK  9.3.1
vtkStaticFaceHashLinksTemplate.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
45 #ifndef vtkStaticFaceHashLinksTemplate_h
46 #define vtkStaticFaceHashLinksTemplate_h
47 
48 #include "vtkABINamespace.h"
49 #include "vtkType.h"
50 
51 #include <memory>
52 #include <vector>
53 
54 VTK_ABI_NAMESPACE_BEGIN
56 VTK_ABI_NAMESPACE_END
57 
58 VTK_ABI_NAMESPACE_BEGIN
62 template <typename TInputIdType, typename TFaceIdType>
64 {
65 public:
67 
72 
76  void Reset();
77 
81  vtkIdType GetNumberOfFaces() const { return this->NumberOfFaces; }
82 
86  vtkIdType GetNumberOfHashes() const { return this->NumberOfHashes; }
87 
92  {
93  return this->FaceOffsets.get()[hash + 1] - this->FaceOffsets.get()[hash];
94  }
95 
99  TInputIdType* GetCellIdOfFacesInHash(vtkIdType hash) const
100  {
101  return this->CellIdOfFaceLinks.get() + this->FaceOffsets.get()[hash];
102  }
103 
107  TFaceIdType* GetFaceIdOfFacesInHash(vtkIdType hash) const
108  {
109  return this->FaceIdOfFaceLinks.get() + this->FaceOffsets.get()[hash];
110  }
111 
112 protected:
115  std::shared_ptr<TInputIdType> CellIdOfFaceLinks;
116  std::shared_ptr<TFaceIdType> FaceIdOfFaceLinks;
117  std::shared_ptr<vtkIdType> FaceOffsets;
118 
119 private:
121  void operator=(const vtkStaticFaceHashLinksTemplate&) = delete;
122 
123  struct GeometryInformation;
124 
125  struct CountFaces;
126 
127  template <typename TCellOffSetIdType>
128  struct CreateFacesInformation;
129 
130  template <typename TCellOffSetIdType>
131  struct CountHashes;
132 
133  struct PrefixSum;
134 
135  template <typename TCellOffSetIdType>
136  struct BuildFaceHashLinks;
137 
138  template <typename TCellOffSetIdType>
139  void BuildHashLinksInternal(vtkUnstructuredGrid* input, GeometryInformation& geometryInformation);
140 };
141 
142 VTK_ABI_NAMESPACE_END
143 #include "vtkStaticFaceHashLinksTemplate.txx"
144 
145 #endif // vtkStaticFaceHashLinksTemplate_h
146 // VTK-HeaderTest-Exclude: vtkStaticFaceHashLinksTemplate.h
vtkIdType GetNumberOfFacesInHash(vtkIdType hash) const
Get the number of faces in a particular hash.
Templated on types of ids defining an edge.
std::shared_ptr< TInputIdType > CellIdOfFaceLinks
std::shared_ptr< TFaceIdType > FaceIdOfFaceLinks
TFaceIdType * GetFaceIdOfFacesInHash(vtkIdType hash) const
Get face id of faces in a particular hash.
int vtkIdType
Definition: vtkType.h:315
vtkIdType GetNumberOfFaces() const
Get number of faces.
TInputIdType * GetCellIdOfFacesInHash(vtkIdType hash) const
Get cell id of faces in a particular hash.
vtkIdType GetNumberOfHashes() const
Get the number of hashes.
dataset represents arbitrary combinations of all possible cell types
void BuildHashLinks(vtkUnstructuredGrid *input)
Build the hash links.
void Reset()
Reset the hash links and free the memory.