Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 09:03:18

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file orange/transform/TransformHasher.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <cstdlib>
0010 
0011 #include "VariantTransform.hh"
0012 
0013 namespace celeritas
0014 {
0015 //---------------------------------------------------------------------------//
0016 /*!
0017  * Calculate a hash value of a transform for deduplication.
0018  */
0019 class TransformHasher
0020 {
0021   public:
0022     //!@{
0023     //! \name Type aliases
0024     using result_type = std::size_t;
0025     //!@}
0026 
0027   public:
0028     // By default, calculate a hash based on the stored data
0029     template<class T>
0030     result_type operator()(T const&) const;
0031 
0032     // Special hash for "no transformation"
0033     result_type operator()(NoTransformation const&) const;
0034 
0035     // Special hash for "signed permutation"
0036     result_type operator()(SignedPermutation const&) const;
0037 };
0038 
0039 //---------------------------------------------------------------------------//
0040 // FREE FUNCTIONS
0041 //---------------------------------------------------------------------------//
0042 // Calculate a hash for a variant transform
0043 TransformHasher::result_type
0044 visit(TransformHasher const&, VariantTransform const& transform);
0045 
0046 //---------------------------------------------------------------------------//
0047 }  // namespace celeritas