Quinoa all test code coverage report
Current view: top level - Control/Walker/Options - HydroProductions.hpp (source / functions) Hit Total Coverage
Commit: Quinoa_v0.3-957-gb4f0efae0 Lines: 33 41 80.5 %
Date: 2021-11-11 18:25:50 Functions: 3 3 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 36 78 46.2 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/Control/Walker/Options/HydroProductions.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     Hydrodynamics production divided by dissipation rate options
       9                 :            :   \details   Hydrodynamics production divided by dissipation rate options
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : #ifndef HydroProductionsOptions_h
      13                 :            : #define HydroProductionsOptions_h
      14                 :            : 
      15                 :            : #include <brigand/sequences/list.hpp>
      16                 :            : 
      17                 :            : #include "Toggle.hpp"
      18                 :            : #include "Keywords.hpp"
      19                 :            : #include "PUPUtil.hpp"
      20                 :            : #include "DiffEq/HydroProductions.hpp"
      21                 :            : 
      22                 :            : namespace walker {
      23                 :            : namespace ctr {
      24                 :            : 
      25                 :            : //! Hydrodynamics production divided by dissipation rate types
      26                 :            : enum class HydroProductionsType : uint8_t { PROD_A005H=0
      27                 :            :                                           , PROD_A005S
      28                 :            :                                           , PROD_A005L
      29                 :            :                                           , PROD_A05H
      30                 :            :                                           , PROD_A05S
      31                 :            :                                           , PROD_A05L
      32                 :            :                                           , PROD_A075H
      33                 :            :                                           , PROD_A075S
      34                 :            :                                           , PROD_A075L
      35                 :            :                                           };
      36                 :            : 
      37                 :            : //! \brief Pack/Unpack HydroProductionsType: forward overload to generic enum
      38                 :            : //!   class packer
      39                 :        100 : inline void operator|( PUP::er& p, HydroProductionsType& e )
      40                 :        100 : { PUP::pup( p, e ); }
      41                 :            : 
      42                 :            : //! HydroProductions options: outsource searches to base templated on enum type
      43                 :            : class HydroProductions : public tk::Toggle< HydroProductionsType > {
      44                 :            : 
      45                 :            :   public:
      46                 :            :     //! Valid expected choices to make them also available at compile-time
      47                 :            :     using keywords = brigand::list< kw::prod_A005H
      48                 :            :                                   , kw::prod_A005S
      49                 :            :                                   , kw::prod_A005L
      50                 :            :                                   , kw::prod_A05H
      51                 :            :                                   , kw::prod_A05S
      52                 :            :                                   , kw::prod_A05L
      53                 :            :                                   , kw::prod_A075H
      54                 :            :                                   , kw::prod_A075S
      55                 :            :                                   , kw::prod_A075L
      56                 :            :                                   >;
      57                 :            : 
      58                 :            :     //! \brief Options constructor
      59                 :            :     //! \details Simply initialize in-line and pass associations to base, which
      60                 :            :     //!    will handle client interactions
      61                 :         31 :     explicit HydroProductions() :
      62                 :            :       tk::Toggle< HydroProductionsType >(
      63                 :            :         //! Group, i.e., options, name
      64                 :            :         "Hydrodynamics production divided by dissipation rate",
      65                 :            :         //! Enums -> names
      66         [ +  - ]:         31 :         { { HydroProductionsType::PROD_A005H, kw::prod_A005H::name() },
      67         [ +  - ]:         62 :           { HydroProductionsType::PROD_A005S, kw::prod_A005S::name() },
      68         [ +  - ]:         62 :           { HydroProductionsType::PROD_A005L, kw::prod_A005L::name() },
      69         [ +  - ]:         62 :           { HydroProductionsType::PROD_A05H, kw::prod_A05H::name() },
      70         [ +  - ]:         62 :           { HydroProductionsType::PROD_A05S, kw::prod_A05S::name() },
      71         [ +  - ]:         62 :           { HydroProductionsType::PROD_A05L, kw::prod_A05L::name() },
      72         [ +  - ]:         62 :           { HydroProductionsType::PROD_A075H, kw::prod_A075H::name() },
      73         [ +  - ]:         62 :           { HydroProductionsType::PROD_A075S, kw::prod_A075S::name() },
      74         [ +  - ]:         62 :           { HydroProductionsType::PROD_A075L, kw::prod_A075L::name() } },
      75                 :            :         //! keywords -> Enums
      76                 :          0 :         {  { kw::prod_A005H::string(), HydroProductionsType::PROD_A005H },
      77         [ +  - ]:         62 :            { kw::prod_A005S::string(), HydroProductionsType::PROD_A005S },
      78         [ +  - ]:         62 :            { kw::prod_A005L::string(), HydroProductionsType::PROD_A005L },
      79         [ +  - ]:         62 :            { kw::prod_A05H::string(), HydroProductionsType::PROD_A05H },
      80         [ +  - ]:         62 :            { kw::prod_A05S::string(), HydroProductionsType::PROD_A05S },
      81         [ +  - ]:         62 :            { kw::prod_A05L::string(), HydroProductionsType::PROD_A05L },
      82         [ +  - ]:         62 :            { kw::prod_A075H::string(), HydroProductionsType::PROD_A075H },
      83         [ +  - ]:         62 :            { kw::prod_A075S::string(), HydroProductionsType::PROD_A075S },
      84 [ +  - ][ +  - ]:       1147 :            { kw::prod_A075L::string(), HydroProductionsType::PROD_A075L } } ) {}
         [ +  - ][ +  - ]
         [ +  - ][ +  + ]
         [ +  + ][ -  - ]
                 [ -  - ]
      85                 :            : 
      86                 :            :     //! \brief Return table based on Enum
      87                 :            :     //! \param[in] t Enum value of the option requested
      88                 :            :     //! \return tk::Table associated to the option
      89                 :         25 :     tk::Table<1> table( HydroProductionsType t ) const {
      90         [ -  + ]:         25 :       if (t == HydroProductionsType::PROD_A005H)
      91                 :          0 :         return prod_A005H;
      92         [ -  + ]:         25 :       else if (t == HydroProductionsType::PROD_A005S)
      93                 :          0 :         return prod_A005S;
      94         [ -  + ]:         25 :       else if (t == HydroProductionsType::PROD_A005L)
      95                 :          0 :         return prod_A005L;
      96         [ -  + ]:         25 :       else if (t == HydroProductionsType::PROD_A05H)
      97                 :          0 :         return prod_A05H;
      98         [ -  + ]:         25 :       else if (t == HydroProductionsType::PROD_A05S)
      99                 :          0 :         return prod_A05S;
     100         [ -  + ]:         25 :       else if (t == HydroProductionsType::PROD_A05L)
     101                 :          0 :         return prod_A05L;
     102         [ +  + ]:         25 :       else if (t == HydroProductionsType::PROD_A075H)
     103                 :          5 :         return prod_A075H;
     104         [ +  + ]:         20 :       else if (t == HydroProductionsType::PROD_A075S)
     105                 :         15 :         return prod_A075S;
     106         [ +  - ]:          5 :       else if (t == HydroProductionsType::PROD_A075L)
     107                 :          5 :         return prod_A075L;
     108 [ -  - ][ -  - ]:          0 :       else Throw( "Hydrodynamics P/e associated to " +
         [ -  - ][ -  - ]
                 [ -  - ]
     109                 :            :                   std::to_string( static_cast<uint8_t>(t) ) + " not found" );
     110                 :            :     }
     111                 :            : 
     112                 :            : };
     113                 :            : 
     114                 :            : } // ctr::
     115                 :            : } // walker::
     116                 :            : 
     117                 :            : #endif // HydroProductionsOptions_h

Generated by: LCOV version 1.14