Nektar++
Public Member Functions | List of all members
Nektar::SpatialDomains::GeometryHash Struct Reference

Unary function that constructs a hash of a Geometry object, based on the vertex IDs. More...

#include <Geometry.h>

Inheritance diagram for Nektar::SpatialDomains::GeometryHash:
[legend]

Public Member Functions

std::size_t operator() (GeometrySharedPtr const &p) const
 

Detailed Description

Unary function that constructs a hash of a Geometry object, based on the vertex IDs.

Definition at line 247 of file Geometry.h.

Member Function Documentation

◆ operator()()

std::size_t Nektar::SpatialDomains::GeometryHash::operator() ( GeometrySharedPtr const &  p) const
inline

Definition at line 249 of file Geometry.h.

References Nektar::hash_range().

250  {
251  int i;
252  size_t seed = 0;
253  int nVert = p->GetNumVerts();
254  std::vector<unsigned int> ids(nVert);
255 
256  for (i = 0; i < nVert; ++i)
257  {
258  ids[i] = p->GetVid(i);
259  }
260  std::sort(ids.begin(), ids.end());
261  hash_range(seed, ids.begin(), ids.end());
262 
263  return seed;
264  }
std::size_t hash_range(Iter first, Iter last)
Definition: HashUtils.hpp:69