Walker test code coverage report
Current view: top level - DiffEq/Beta - ConfigureNumberFractionBeta.cpp (source / functions) Hit Total Coverage
Commit: test_coverage.info Lines: 38 38 100.0 %
Date: 2022-09-21 13:52:12 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 65 160 40.6 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/DiffEq/Beta/ConfigureNumberFractionBeta.cpp
       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     Register and compile configuration on the number fraction beta SDE
       9                 :            :   \details   Register and compile configuration on the number fraction beta SDE.
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : 
      13                 :            : #include <set>
      14                 :            : #include <map>
      15                 :            : #include <vector>
      16                 :            : #include <string>
      17                 :            : #include <utility>
      18                 :            : 
      19                 :            : #include <brigand/algorithms/for_each.hpp>
      20                 :            : 
      21                 :            : #include "Tags.hpp"
      22                 :            : #include "CartesianProduct.hpp"
      23                 :            : #include "DiffEqFactory.hpp"
      24                 :            : #include "Walker/Options/DiffEq.hpp"
      25                 :            : #include "Walker/Options/InitPolicy.hpp"
      26                 :            : 
      27                 :            : #include "ConfigureNumberFractionBeta.hpp"
      28                 :            : #include "NumberFractionBeta.hpp"
      29                 :            : #include "NumberFractionBetaCoeffPolicy.hpp"
      30                 :            : 
      31                 :            : namespace walker {
      32                 :            : 
      33                 :            : void
      34                 :        374 : registerNumberFractionBeta( DiffEqFactory& f, std::set< ctr::DiffEqType >& t )
      35                 :            : // *****************************************************************************
      36                 :            : // Register number fraction beta SDE into DiffEq factory
      37                 :            : //! \param[in,out] f Differential equation factory to register to
      38                 :            : //! \param[in,out] t Counters for equation types registered
      39                 :            : // *****************************************************************************
      40                 :            : {
      41                 :            :   // Construct vector of vectors for all possible policies for SDE
      42                 :            :   using NumberFractionBetaPolicies =
      43                 :            :     tk::cartesian_product< InitPolicies, NumberFractionBetaCoeffPolicies >;
      44                 :            :   // Register SDE for all combinations of policies
      45                 :            :   brigand::for_each< NumberFractionBetaPolicies >(
      46                 :            :     registerDiffEq< NumberFractionBeta >
      47                 :        374 :                   ( f, ctr::DiffEqType::NUMFRACBETA, t ) );
      48                 :        374 : }
      49                 :            : 
      50                 :            : std::vector< std::pair< std::string, std::string > >
      51                 :          4 : infoNumberFractionBeta( std::map< ctr::DiffEqType, tk::ctr::ncomp_t >& cnt )
      52                 :            : // *****************************************************************************
      53                 :            : //  Return information on the number fraction beta SDE
      54                 :            : //! \param[inout] cnt std::map of counters for all differential equation types
      55                 :            : //! \return vector of string pairs describing the SDE configuration
      56                 :            : // *****************************************************************************
      57                 :            : {
      58         [ +  - ]:          4 :   auto c = ++cnt[ ctr::DiffEqType::NUMFRACBETA ];       // count eqs
      59                 :            :   --c;  // used to index vectors starting with 0
      60                 :            : 
      61                 :            :   std::vector< std::pair< std::string, std::string > > nfo;
      62                 :            : 
      63 [ +  - ][ +  - ]:          8 :   nfo.emplace_back( ctr::DiffEq().name( ctr::DiffEqType::NUMFRACBETA ), "" );
      64                 :            : 
      65         [ +  - ]:          4 :   nfo.emplace_back( "start offset in particle array", std::to_string(
      66 [ +  - ][ +  - ]:          4 :     g_inputdeck.get< tag::component >().offset< tag::numfracbeta >(c) ) );
      67                 :            :   auto ncomp =
      68                 :          4 :     g_inputdeck.get< tag::component >().get< tag::numfracbeta >()[c] / 3;
      69 [ +  - ][ +  - ]:          4 :   nfo.emplace_back( "number of components", std::to_string( ncomp ) );
      70                 :            : 
      71         [ +  - ]:          4 :   nfo.emplace_back( "kind", "stochastic" );
      72                 :          4 :   nfo.emplace_back( "dependent variable", std::string( 1,
      73 [ +  - ][ +  - ]:          4 :     g_inputdeck.get< tag::param, tag::numfracbeta, tag::depvar >()[c] ) );
      74         [ +  - ]:          4 :   nfo.emplace_back( "initialization policy", ctr::InitPolicy().name(
      75         [ +  - ]:          8 :     g_inputdeck.get< tag::param, tag::numfracbeta, tag::initpolicy >()[c] ) );
      76         [ +  - ]:          4 :   nfo.emplace_back( "coefficients policy", ctr::CoeffPolicy().name(
      77         [ +  - ]:          8 :     g_inputdeck.get< tag::param, tag::numfracbeta, tag::coeffpolicy >()[c] ) );
      78                 :            : 
      79 [ +  - ][ -  + ]:          8 :   nfo.emplace_back( "random number generator", tk::ctr::RNG().name(
      80         [ +  - ]:          8 :     g_inputdeck.get< tag::param, tag::numfracbeta, tag::rng >()[c] ) );
      81                 :            :   nfo.emplace_back(
      82 [ +  - ][ +  - ]:          8 :     "coeff b [" + std::to_string( ncomp ) + "]",
         [ +  - ][ -  + ]
         [ -  + ][ -  + ]
         [ -  - ][ -  - ]
                 [ -  - ]
      83         [ -  + ]:          4 :     parameters(
      84         [ +  - ]:          4 :       g_inputdeck.get< tag::param, tag::numfracbeta, tag::b >().at(c) )
      85         [ +  - ]:          4 :   );
      86                 :            :   nfo.emplace_back(
      87 [ +  - ][ +  - ]:          8 :     "coeff S [" + std::to_string( ncomp ) + "]",
         [ +  - ][ -  + ]
         [ -  + ][ -  + ]
         [ -  - ][ -  - ]
                 [ -  - ]
      88 [ +  - ][ -  + ]:          8 :     parameters( g_inputdeck.get< tag::param, tag::numfracbeta, tag::S >().at(c) )
      89         [ +  - ]:          4 :   );
      90                 :            :   nfo.emplace_back(
      91 [ +  - ][ +  - ]:          8 :     "coeff kappa [" + std::to_string( ncomp ) + "]",
         [ +  - ][ -  + ]
         [ -  + ][ -  + ]
         [ -  - ][ -  - ]
                 [ -  - ]
      92         [ -  + ]:          4 :     parameters(
      93 [ +  - ][ +  - ]:          8 :       g_inputdeck.get< tag::param, tag::numfracbeta, tag::kappa >().at(c) ) );
      94                 :            :   nfo.emplace_back(
      95 [ +  - ][ +  - ]:          8 :     "coeff rho2 [" + std::to_string( ncomp ) + "]",
         [ +  - ][ -  + ]
         [ -  + ][ -  + ]
         [ -  - ][ -  - ]
                 [ -  - ]
      96         [ -  + ]:          4 :     parameters(
      97 [ +  - ][ +  - ]:          8 :       g_inputdeck.get< tag::param, tag::numfracbeta, tag::rho2 >().at(c) ) );
      98                 :            :   nfo.emplace_back(
      99 [ +  - ][ +  - ]:          8 :     "coeff rcomma [" + std::to_string( ncomp ) + "]",
         [ +  - ][ -  + ]
         [ -  + ][ -  + ]
         [ -  - ][ -  - ]
                 [ -  - ]
     100         [ -  + ]:          4 :     parameters(
     101 [ +  - ][ +  - ]:          8 :       g_inputdeck.get< tag::param, tag::numfracbeta, tag::rcomma >().at(c) ) );
     102         [ +  - ]:          4 :   spikes( nfo, g_inputdeck.get< tag::param, tag::numfracbeta, tag::init,
     103                 :            :     tag::spike >().at(c) );
     104         [ +  - ]:          4 :   betapdfs( nfo, g_inputdeck.get< tag::param, tag::numfracbeta, tag::init,
     105                 :            :     tag::betapdf >().at(c) );
     106                 :            : 
     107                 :          4 :   return nfo;
     108                 :            : }
     109                 :            : 
     110                 :            : }  // walker::

Generated by: LCOV version 1.14