4#ifndef vtkCellGridSidesCache_h
5#define vtkCellGridSidesCache_h
9#include "vtkCommonDataModelModule.h"
16#include <unordered_map>
19VTK_ABI_NAMESPACE_BEGIN
58 return (this->CellType < other.
CellType) ||
60 ((this->DOF < other.
DOF) || (this->DOF == other.
DOF && this->SideId < other.
SideId)));
71 std::unordered_map<std::size_t, Entry>&
GetHashes() {
return this->Hashes; }
74 template <
typename C,
typename T =
typename C::value_type>
78 std::size_t NN = conn.size();
85 for (std::size_t jj = 1; jj < NN; ++jj)
93 bool forward = conn[(ss + 1) % NN] > conn[(ss + NN - 1) % NN];
95 std::size_t hashedValue = std::hash<std::size_t>{}(NN);
100 for (std::size_t ii = 0; ii < NN; ++ii)
102 std::size_t hashedToken = std::hash<T>{}(conn[(ss + ii) % NN]);
109 for (std::size_t ii = 0; ii < NN; ++ii)
111 std::size_t hashedToken = std::hash<T>{}(conn[(ss + NN - ii) % NN]);
142 template <
typename C,
typename T =
typename C::value_type>
146 auto hashedValue = this->HashSide(shape, conn);
147 this->Hashes[hashedValue].Sides.insert(
Side{ cellType, shape, cell, side });
158 std::unordered_map<std::size_t, Entry>
Hashes;
Hold a map from hash-ids (representing sides of cells of multiple types) to details on the cells that...
void AddSide(vtkStringToken cellType, vtkIdType cell, int side, vtkStringToken shape, const C &conn)
Add a side with the given shape and connectivity to the request's state.
void Initialize()
Empty the cache of all hashes.
std::unordered_map< std::size_t, Entry > & GetHashes()
Return the map of hashed side information.
static vtkCellGridSidesCache * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::size_t HashSide(vtkStringToken shape, const C &conn)
Compute the hash of a side (but do not insert a side into the map).
vtkCellGridSidesCache()=default
~vtkCellGridSidesCache() override=default
std::unordered_map< std::size_t, Entry > Hashes
Combine 4- and 8-byte integers into a single hash value.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
abstract base class for most VTK objects
Represent a string by its integer hash.
Hash GetId() const
Return the token's ID (usually its hash but possibly not in the case of collisions).
Each hash entry corresponds to one or more sides of one or more cells.
Records held by a hash-entry that represent the side of one cell.
int SideId
The ID of the side being hashed.
vtkStringToken CellType
The type of cell whose side is hashed.
bool operator<(const Side &other) const
Compare side-hashes to allow set insertion.
vtkStringToken SideShape
The shape of the side being hashed.
vtkIdType DOF
The degree of freedom starting the hash sequence.