Walker test code coverage report
Current view: top level - RNG - RNGStack.hpp (source / functions) Hit Total Coverage
Commit: test_coverage.info Lines: 1 1 100.0 %
Date: 2022-09-21 13:52:12 Functions: 0 0 -
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/RNG/RNGStack.hpp
       4                 :            :   \copyright 2012-2015 J. Bakosi,
       5                 :            :              2016-2018 Los Alamos National Security, LLC.,
       6                 :            :              2019-2021 Triad National Security, LLC.
       7                 :            :              All rights reserved. See the LICENSE file for details.
       8                 :            :   \brief     Stack of random number generators
       9                 :            :   \details   This file declares class RNGStack, which implements various
      10                 :            :     functionality related to registering and instantiating random number
      11                 :            :     generators interfacing to multiple RNG libraries. Registration and
      12                 :            :     instantiation use a random number generator factory, which is a std::map (an
      13                 :            :     associative container), associating unique RNG keys to their constructor
      14                 :            :     calls. For more details, see the in-code documentation of the constructor.
      15                 :            : */
      16                 :            : // *****************************************************************************
      17                 :            : #ifndef RNGStack_h
      18                 :            : #define RNGStack_h
      19                 :            : 
      20                 :            : #include <map>
      21                 :            : #include <vector>
      22                 :            : #include <functional>
      23                 :            : #include <type_traits>
      24                 :            : 
      25                 :            : #include "RNG.hpp"
      26                 :            : #include "RNGParam.hpp"
      27                 :            : #include "Options/RNG.hpp"
      28                 :            : #include "WalkerBuildConfig.hpp"
      29                 :            : 
      30                 :            : namespace tk {
      31                 :            : 
      32                 :            : //! Random number generator factory: keys associated to their constructors
      33                 :            : using RNGFactory = std::map< ctr::RNGType, std::function< RNG() > >;
      34                 :            : 
      35                 :            : //! \brief Random number generator stack
      36                 :        297 : class RNGStack {
      37                 :            : 
      38                 :            :   public:
      39                 :            :     //! Constructor: register random number generators into factory
      40                 :            :     explicit RNGStack(
      41                 :            :                        #ifdef HAS_MKL
      42                 :            :                        const ctr::RNGMKLParameters& mklparam,
      43                 :            :                        #endif
      44                 :            :                        #ifdef HAS_RNGSSE2
      45                 :            :                        const ctr::RNGSSEParameters& rngsseparam,
      46                 :            :                        #endif
      47                 :            :                        const ctr::RNGRandom123Parameters& r123param );
      48                 :            : 
      49                 :            :     //! Instantiate selected RNGs
      50                 :            :     std::map< std::underlying_type_t< tk::ctr::RNGType >, tk::RNG >
      51                 :            :     selected( const std::vector< ctr::RNGType >& sel ) const;
      52                 :            : 
      53                 :            :     //! Instantiate a RNG
      54                 :            :     tk::RNG create( tk::ctr::RNGType r ) const;
      55                 :            : 
      56                 :            :   private:
      57                 :            :    #ifdef HAS_MKL
      58                 :            :    //! Register MKL RNGs into factory
      59                 :            :    void regMKL( int nstream, const ctr::RNGMKLParameters& param );
      60                 :            :    #endif
      61                 :            : 
      62                 :            :    #ifdef HAS_RNGSSE2
      63                 :            :    //! Register RNGSSE RNGs into factory
      64                 :            :    void regRNGSSE( int nstream, const ctr::RNGSSEParameters& param );
      65                 :            :    #endif
      66                 :            : 
      67                 :            :    //! Register Random123 RNGs into factory
      68                 :            :    void regRandom123( int nstream, const ctr::RNGRandom123Parameters& param );
      69                 :            : 
      70                 :            :    RNGFactory m_factory;        //!< Random nunmber generator factory
      71                 :            : };
      72                 :            : 
      73                 :            : } // namespace tk
      74                 :            : 
      75                 :            : #endif // RNGStack_h

Generated by: LCOV version 1.14