Skip to content
Snippets Groups Projects
Commit 8cdc47d3 authored by Van Herck, Walter's avatar Van Herck, Walter
Browse files

Move Hash2Doubles to separate translation unit

parent 06604dd4
No related branches found
No related tags found
No related merge requests found
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Core/Computation/Hash2Doubles.cpp
//! @brief Implements class Hash2Doubles.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2017
//! @authors Scientific Computing Group at MLZ Garching
//! @authors J. Burle, J. M. Fisher, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke
//
// ************************************************************************** //
#include "Hash2Doubles.h"
// Simple exclusive or of the std::hash<double> of its parts
size_t Hash2Doubles::operator()(std::pair<double, double> doubles) const noexcept
{
return m_double_hash(doubles.first) ^ m_double_hash(doubles.second);
}
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file Core/Computation/Hash2Doubles.h
//! @brief Defines class Hash2Doubles.
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2017
//! @authors Scientific Computing Group at MLZ Garching
//! @authors J. Burle, J. M. Fisher, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke
//
// ************************************************************************** //
#ifndef HASH2DOUBLES_H
#define HASH2DOUBLES_H
#include <functional>
#include <utility>
class Hash2Doubles
{
public:
Hash2Doubles() {}
~Hash2Doubles() {}
size_t operator()(std::pair<double, double> doubles) const noexcept;
private:
std::hash<double> m_double_hash;
};
#endif // HASH2DOUBLES_H
...@@ -20,8 +20,3 @@ size_t HashKVector::operator()(kvector_t kvec) const noexcept ...@@ -20,8 +20,3 @@ size_t HashKVector::operator()(kvector_t kvec) const noexcept
{ {
return m_double_hash(kvec.x()) ^ m_double_hash(kvec.y()) ^ m_double_hash(kvec.z()); return m_double_hash(kvec.x()) ^ m_double_hash(kvec.y()) ^ m_double_hash(kvec.z());
} }
size_t Hash2Doubles::operator()(std::pair<double, double> doubles) const noexcept
{
return m_double_hash(doubles.first) ^ m_double_hash(doubles.second);
}
...@@ -31,15 +31,4 @@ private: ...@@ -31,15 +31,4 @@ private:
std::hash<double> m_double_hash; std::hash<double> m_double_hash;
}; };
class Hash2Doubles
{
public:
Hash2Doubles() {}
~Hash2Doubles() {}
size_t operator()(std::pair<double, double> doubles) const noexcept;
private:
std::hash<double> m_double_hash;
};
#endif // HASHKVECTOR_H #endif // HASHKVECTOR_H
...@@ -16,8 +16,9 @@ ...@@ -16,8 +16,9 @@
#ifndef SCALARFRESNELMAP_H #ifndef SCALARFRESNELMAP_H
#define SCALARFRESNELMAP_H #define SCALARFRESNELMAP_H
#include "HashKVector.h" #include "Hash2Doubles.h"
#include "IFresnelMap.h" #include "IFresnelMap.h"
#include "Vectors3D.h"
#include <unordered_map> #include <unordered_map>
#include <utility> #include <utility>
#include <vector> #include <vector>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment