Quinoa regression test code coverage report
Current view: top level - DiffEq/SkewNormal - ConfigureSkewNormal.cpp (source / functions) Hit Total Coverage
Commit: Quinoa_v0.3-957-gb4f0efae0 Lines: 36 36 100.0 %
Date: 2021-11-11 13:17:06 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 43 86 50.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/DiffEq/SkewNormal/ConfigureSkewNormal.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 skew-normal SDE
       9                 :            :   \details   Register and compile configuration on the skew-normal 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 "ConfigureSkewNormal.hpp"
      28                 :            : #include "SkewNormal.hpp"
      29                 :            : #include "SkewNormalCoeffPolicy.hpp"
      30                 :            : 
      31                 :            : namespace walker {
      32                 :            : 
      33                 :            : void
      34                 :        323 : registerSkewNormal( DiffEqFactory& f, std::set< ctr::DiffEqType >& t )
      35                 :            : // *****************************************************************************
      36                 :            : // Register skew-normal 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 SkewNormalPolicies =
      43                 :            :     tk::cartesian_product< InitPolicies, SkewNormalCoeffPolicies >;
      44                 :            :   // Register SDE for all combinations of policies
      45                 :            :   brigand::for_each< SkewNormalPolicies >(
      46         [ +  - ]:        323 :     registerDiffEq< SkewNormal >( f, ctr::DiffEqType::SKEWNORMAL, t ) );
      47                 :        323 : }
      48                 :            : 
      49                 :            : std::vector< std::pair< std::string, std::string > >
      50                 :         10 : infoSkewNormal( std::map< ctr::DiffEqType, tk::ctr::ncomp_t >& cnt )
      51                 :            : // *****************************************************************************
      52                 :            : //  Return information on the skew-normal SDE
      53                 :            : //! \param[inout] cnt std::map of counters for all differential equation types
      54                 :            : //! \return vector of string pairs describing the SDE configuration
      55                 :            : // *****************************************************************************
      56                 :            : {
      57         [ +  - ]:         10 :   auto c = ++cnt[ ctr::DiffEqType::SKEWNORMAL ];       // count eqs
      58                 :         10 :   --c;  // used to index vectors starting with 0
      59                 :            : 
      60                 :         10 :   std::vector< std::pair< std::string, std::string > > nfo;
      61                 :            : 
      62 [ +  - ][ +  - ]:         10 :   nfo.emplace_back( ctr::DiffEq().name( ctr::DiffEqType::SKEWNORMAL ), "" );
                 [ +  - ]
      63                 :            : 
      64         [ +  - ]:         20 :   nfo.emplace_back( "start offset in particle array", std::to_string(
      65         [ +  - ]:         20 :     g_inputdeck.get< tag::component >().offset< tag::skewnormal >(c) ) );
      66                 :         10 :   auto ncomp = g_inputdeck.get< tag::component >().get< tag::skewnormal >()[c];
      67 [ +  - ][ +  - ]:         10 :   nfo.emplace_back( "number of components", std::to_string( ncomp ) );
      68                 :            : 
      69         [ +  - ]:         10 :   nfo.emplace_back( "kind", "stochastic" );
      70         [ +  - ]:         30 :   nfo.emplace_back( "dependent variable", std::string( 1,
      71         [ +  - ]:         20 :     g_inputdeck.get< tag::param, tag::skewnormal, tag::depvar >()[c] ) );
      72         [ +  - ]:         20 :   nfo.emplace_back( "initialization policy", ctr::InitPolicy().name(
      73 [ +  - ][ +  - ]:         10 :     g_inputdeck.get< tag::param, tag::skewnormal, tag::initpolicy >()[c] ) );
      74         [ +  - ]:         20 :   nfo.emplace_back( "coefficients policy", ctr::CoeffPolicy().name(
      75 [ +  - ][ +  - ]:         10 :     g_inputdeck.get< tag::param, tag::skewnormal, tag::coeffpolicy >()[c] ) );
      76         [ +  - ]:         20 :   nfo.emplace_back( "random number generator", tk::ctr::RNG().name(
      77 [ +  - ][ +  - ]:         10 :     g_inputdeck.get< tag::param, tag::skewnormal, tag::rng >()[c] ) );
      78                 :            :   nfo.emplace_back(
      79 [ +  - ][ +  - ]:         20 :     "coeff T [" + std::to_string( ncomp ) + "]",
                 [ +  - ]
      80                 :         10 :     parameters(
      81 [ +  - ][ +  - ]:         10 :       g_inputdeck.get< tag::param, tag::skewnormal, tag::timescale >().at(c) )
      82         [ +  - ]:         10 :   );
      83                 :            :   nfo.emplace_back(
      84 [ +  - ][ +  - ]:         20 :     "coeff sigmasq [" + std::to_string( ncomp ) + "]",
                 [ +  - ]
      85                 :         10 :     parameters(
      86 [ +  - ][ +  - ]:         20 :       g_inputdeck.get< tag::param, tag::skewnormal, tag::sigmasq >().at(c) ) );
                 [ +  - ]
      87                 :            :   nfo.emplace_back(
      88 [ +  - ][ +  - ]:         20 :     "coeff lambda [" + std::to_string( ncomp ) + "]",
                 [ +  - ]
      89                 :         10 :     parameters(
      90 [ +  - ][ +  - ]:         20 :       g_inputdeck.get< tag::param, tag::skewnormal, tag::lambda >().at(c) ) );
                 [ +  - ]
      91                 :         10 :   spikes( nfo, g_inputdeck.get< tag::param, tag::skewnormal, tag::init,
      92 [ +  - ][ +  - ]:         10 :                                 tag::spike >().at(c) );
      93                 :         10 :   betapdfs( nfo, g_inputdeck.get< tag::param, tag::skewnormal, tag::init,
      94 [ +  - ][ +  - ]:         10 :                                   tag::betapdf >().at(c) );
      95                 :            : 
      96                 :         10 :   return nfo;
      97                 :            : }
      98                 :            : 
      99                 :            : }  // walker::

Generated by: LCOV version 1.14