Walker test code coverage report
Current view: top level - DiffEq/Dirichlet - ConfigureDirichlet.cpp (source / functions) Hit Total Coverage
Commit: test_coverage.info Lines: 31 40 77.5 %
Date: 2022-09-21 13:52:12 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 46 184 25.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/DiffEq/Dirichlet/ConfigureDirichlet.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 Dirichlet SDE
       9                 :            :   \details   Register and compile configuration on the Dirichlet 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 "ConfigureDirichlet.hpp"
      28                 :            : #include "Dirichlet.hpp"
      29                 :            : #include "DirichletCoeffPolicy.hpp"
      30                 :            : 
      31                 :            : namespace walker {
      32                 :            : 
      33                 :            : void
      34                 :        374 : registerDirichlet( DiffEqFactory& f, std::set< ctr::DiffEqType >& t )
      35                 :            : // *****************************************************************************
      36                 :            : // Register Dirichlet 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 DirPolicies =
      43                 :            :     tk::cartesian_product< InitPolicies, DirichletCoeffPolicies >;
      44                 :            :   // Register SDE for all combinations of policies
      45                 :            :   brigand::for_each< DirPolicies >(
      46                 :        374 :     registerDiffEq< Dirichlet >( f, ctr::DiffEqType::DIRICHLET, t ) );
      47                 :        374 : }
      48                 :            : 
      49                 :            : std::vector< std::pair< std::string, std::string > >
      50                 :         12 : infoDirichlet( std::map< ctr::DiffEqType, tk::ctr::ncomp_t >& cnt )
      51                 :            : // *****************************************************************************
      52                 :            : //  Return information on the Dirichlet 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         [ +  - ]:         12 :   auto c = ++cnt[ ctr::DiffEqType::DIRICHLET ];       // count eqs
      58                 :            :   --c;  // used to index vectors starting with 0
      59                 :            : 
      60                 :            :   std::vector< std::pair< std::string, std::string > > nfo;
      61                 :            : 
      62 [ +  - ][ +  - ]:         36 :   nfo.emplace_back( ctr::DiffEq().name( ctr::DiffEqType::DIRICHLET ), "" );
      63                 :            : 
      64         [ +  - ]:         12 :   nfo.emplace_back( "start offset in particle array", std::to_string(
      65 [ +  - ][ +  - ]:         12 :     g_inputdeck.get< tag::component >().offset< tag::dirichlet >(c) ) );
      66                 :         12 :   auto ncomp = g_inputdeck.get< tag::component >().get< tag::dirichlet >()[c];
      67 [ +  - ][ +  - ]:         12 :   nfo.emplace_back( "number of components", std::to_string( ncomp ) );
      68                 :            : 
      69         [ +  - ]:         12 :   nfo.emplace_back( "kind", "stochastic" );
      70         [ +  - ]:         12 :   nfo.emplace_back( "dependent variable", std::string( 1,
      71 [ +  - ][ +  - ]:         12 :     g_inputdeck.get< tag::param, tag::dirichlet, tag::depvar >()[c] ) );
      72                 :            : 
      73                 :            :   auto init =
      74                 :         12 :     g_inputdeck.get< tag::param, tag::dirichlet, tag::initpolicy >()[c];
      75 [ +  - ][ +  - ]:         24 :   nfo.emplace_back( "initialization policy", ctr::InitPolicy().name( init ) );
      76                 :            : 
      77         [ +  - ]:         12 :   nfo.emplace_back( "coefficients policy", ctr::CoeffPolicy().name(
      78         [ +  - ]:         24 :     g_inputdeck.get< tag::param, tag::dirichlet, tag::coeffpolicy >()[c] ) );
      79 [ +  - ][ -  + ]:         24 :   nfo.emplace_back( "random number generator", tk::ctr::RNG().name(
      80         [ +  - ]:         24 :     g_inputdeck.get< tag::param, tag::dirichlet, tag::rng >()[c] ) );
      81                 :            :   nfo.emplace_back(
      82 [ +  - ][ +  - ]:         24 :     "coeff b [" + std::to_string( ncomp ) + "]",
         [ +  - ][ -  + ]
         [ -  + ][ -  + ]
         [ -  - ][ -  - ]
                 [ -  - ]
      83 [ +  - ][ -  + ]:         24 :     parameters( g_inputdeck.get< tag::param, tag::dirichlet, tag::b >().at(c) )
      84         [ +  - ]:         12 :   );
      85                 :            :   nfo.emplace_back(
      86 [ +  - ][ +  - ]:         24 :     "coeff S [" + std::to_string( ncomp ) + "]",
         [ +  - ][ -  + ]
         [ -  + ][ -  + ]
         [ -  - ][ -  - ]
                 [ -  - ]
      87 [ +  - ][ -  + ]:         24 :     parameters( g_inputdeck.get< tag::param, tag::dirichlet, tag::S >().at(c) )
      88         [ +  - ]:         12 :   );
      89                 :            :   nfo.emplace_back(
      90 [ +  - ][ +  - ]:         24 :     "coeff kappa [" + std::to_string( ncomp ) + "]",
         [ +  - ][ -  + ]
         [ -  + ][ -  + ]
         [ -  - ][ -  - ]
                 [ -  - ]
      91                 :         12 :     parameters(
      92         [ +  - ]:         12 :       g_inputdeck.get< tag::param, tag::dirichlet, tag::kappa >().at(c) )
      93         [ +  - ]:         12 :   );
      94                 :            : 
      95         [ -  + ]:         12 :   if (init == ctr::InitPolicyType::JOINTCORRGAUSSIAN) {
      96                 :            :     nfo.emplace_back(
      97 [ -  - ][ -  - ]:          0 :       "coeff mean [" + std::to_string( ncomp ) + "]",
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
                 [ -  - ]
      98                 :          0 :       parameters( g_inputdeck.get< tag::param, tag::dirichlet, tag::init,
      99 [ -  - ][ -  - ]:          0 :                   tag::mean >().at(c) ) );
     100         [ -  - ]:          0 :     auto n = std::to_string( ncomp );
     101                 :            :     nfo.emplace_back(
     102 [ -  - ][ -  - ]:          0 :       "coeff cov [" + n + '(' + n + "+1)/2="
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
     103 [ -  - ][ -  - ]:          0 :                     + std::to_string( ncomp*(ncomp+1)/2 ) + "]",
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
                 [ -  - ]
     104 [ -  - ][ -  - ]:          0 :       parameters( g_inputdeck.get< tag::param, tag::dirichlet, tag::init,
     105         [ -  - ]:          0 :                   tag::cov >().at(c) )
     106         [ -  - ]:          0 :     );
     107                 :            :   }
     108                 :            : 
     109                 :         12 :   return nfo;
     110                 :            : }
     111                 :            : 
     112                 :            : }  // walker::

Generated by: LCOV version 1.14