Quinoa all test code coverage report
Current view: top level - DiffEq/Dirichlet - ConfigureMixDirichlet.cpp (source / functions) Hit Total Coverage
Commit: Quinoa_v0.3-957-gb4f0efae0 Lines: 40 40 100.0 %
Date: 2021-11-09 15:14:18 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 64 160 40.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/DiffEq/Dirichlet/ConfigureMixDirichlet.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 MixDirichlet SDE
       9                 :            :   \details   Register and compile configuration on the MixDirichlet 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                 :            : #include "Walker/Options/Normalization.hpp"
      27                 :            : 
      28                 :            : #include "ConfigureMixDirichlet.hpp"
      29                 :            : #include "MixDirichlet.hpp"
      30                 :            : #include "MixDirichletCoeffPolicy.hpp"
      31                 :            : 
      32                 :            : namespace walker {
      33                 :            : 
      34                 :            : void
      35                 :        323 : registerMixDirichlet( DiffEqFactory& f, std::set< ctr::DiffEqType >& t )
      36                 :            : // *****************************************************************************
      37                 :            : // Register MixDirichlet SDE into DiffEq factory
      38                 :            : //! \param[in,out] f Differential equation factory to register to
      39                 :            : //! \param[in,out] t Counters for equation types registered
      40                 :            : // *****************************************************************************
      41                 :            : {
      42                 :            :   // Construct vector of vectors for all possible policies for SDE
      43                 :            :   using MixDirPolicies =
      44                 :            :     tk::cartesian_product< InitPolicies, MixDirichletCoeffPolicies >;
      45                 :            :   // Register SDE for all combinations of policies
      46                 :            :   brigand::for_each< MixDirPolicies >(
      47                 :        323 :     registerDiffEq< MixDirichlet >( f, ctr::DiffEqType::MIXDIRICHLET, t ) );
      48                 :        323 : }
      49                 :            : 
      50                 :            : std::vector< std::pair< std::string, std::string > >
      51                 :          8 : infoMixDirichlet( std::map< ctr::DiffEqType, tk::ctr::ncomp_t >& cnt )
      52                 :            : // *****************************************************************************
      53                 :            : //  Return information on the MixDirichlet 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                 :            :   using eq = tag::mixdirichlet;
      59                 :            : 
      60         [ +  - ]:          8 :   auto c = ++cnt[ ctr::DiffEqType::MIXDIRICHLET ];       // count eqs
      61                 :            :   --c;  // used to index vectors starting with 0
      62                 :            : 
      63                 :            :   std::vector< std::pair< std::string, std::string > > nfo;
      64                 :            : 
      65 [ +  - ][ +  - ]:         24 :   nfo.emplace_back( ctr::DiffEq().name( ctr::DiffEqType::MIXDIRICHLET ), "" );
      66                 :            : 
      67                 :          8 :   nfo.emplace_back( "start offset in particle array", std::to_string(
      68         [ +  - ]:          8 :     g_inputdeck.get< tag::component >().offset< eq >(c) ) );
      69         [ +  - ]:          8 :   const auto ncomp = g_inputdeck.get< tag::component >().get< eq >()[c];
      70         [ +  - ]:          8 :   nfo.emplace_back( "number of components", std::to_string( ncomp ) );
      71                 :            : 
      72         [ +  - ]:          8 :   nfo.emplace_back( "kind", "stochastic" );
      73         [ +  - ]:          8 :   nfo.emplace_back( "dependent variable", std::string( 1,
      74 [ +  - ][ +  - ]:          8 :     g_inputdeck.get< tag::param, eq, tag::depvar >()[c] ) );
      75         [ +  - ]:          8 :   nfo.emplace_back( "initialization policy", ctr::InitPolicy().name(
      76         [ +  - ]:         16 :     g_inputdeck.get< tag::param, eq, tag::initpolicy >()[c] ) );
      77         [ +  - ]:          8 :   nfo.emplace_back( "coefficients policy", ctr::CoeffPolicy().name(
      78         [ +  - ]:         16 :     g_inputdeck.get< tag::param, eq, tag::coeffpolicy >()[c] ) );
      79         [ +  - ]:         16 :   nfo.emplace_back( "random number generator", tk::ctr::RNG().name(
      80         [ +  - ]:         16 :     g_inputdeck.get< tag::param, eq, tag::rng >()[c] ) );
      81         [ +  - ]:          8 :   nfo.emplace_back( "initialization policy", ctr::InitPolicy().name(
      82         [ +  - ]:         16 :     g_inputdeck.get< tag::param, eq, tag::initpolicy >()[c] ) );
      83                 :            : 
      84         [ +  - ]:          8 :   auto norm = g_inputdeck.get< tag::param, eq, tag::normalization >()[c];
      85 [ +  - ][ +  - ]:         24 :   nfo.emplace_back( "normalization", ctr::Normalization().name(norm)+"-fluid" );
                 [ +  - ]
      86                 :            : 
      87                 :            :   auto numderived = MixDirichlet<InitZero,MixDirichletCoeffConst>::NUMDERIVED;
      88                 :          8 :   auto K = ncomp - numderived;
      89         [ -  + ]:          8 :   auto N = K + 1;
      90                 :            : 
      91 [ +  - ][ +  - ]:         16 :   nfo.emplace_back( "coeff b [" + std::to_string(K) + "]",
         [ -  + ][ -  + ]
         [ -  + ][ -  - ]
         [ -  - ][ -  - ]
      92 [ +  - ][ -  + ]:         16 :     parameters( g_inputdeck.get< tag::param, eq, tag::b >().at(c) )
      93         [ +  - ]:          8 :   );
      94 [ +  - ][ +  - ]:         16 :   nfo.emplace_back( "coeff S [" + std::to_string(K) + "]",
         [ -  + ][ -  + ]
         [ -  + ][ -  - ]
         [ -  - ][ -  - ]
      95 [ +  - ][ -  + ]:         16 :     parameters( g_inputdeck.get< tag::param, eq, tag::S >().at(c) )
      96         [ +  - ]:          8 :   );
      97 [ +  - ][ +  - ]:         16 :   nfo.emplace_back( "coeff kappaprime [" + std::to_string(K) + "]",
         [ -  + ][ -  + ]
         [ -  + ][ -  - ]
         [ -  - ][ -  - ]
      98 [ +  - ][ +  - ]:         16 :     parameters( g_inputdeck.get< tag::param, eq, tag::kappaprime >().at(c) )
      99         [ +  - ]:          8 :   );
     100                 :            : 
     101                 :            :   const auto& rho = g_inputdeck.get< tag::param, eq, tag::rho >();
     102         [ +  - ]:          8 :   if (!rho.empty()) {
     103 [ +  - ][ +  - ]:         16 :     nfo.emplace_back( "coeff rho [" + std::to_string(N) + "]",
         [ -  + ][ -  + ]
         [ -  + ][ -  - ]
         [ -  - ][ -  - ]
     104 [ +  - ][ +  - ]:         16 :                       parameters( rho.at(c) ) );
     105 [ +  - ][ +  - ]:         16 :     nfo.emplace_back( "coeff r [" + std::to_string(K) + "]",
         [ -  + ][ -  + ]
         [ -  + ][ -  - ]
         [ -  - ][ -  - ]
     106 [ +  - ][ +  - ]:         32 :                       parameters( MixDir_r( rho[c], norm ) ) );
         [ +  - ][ +  - ]
                 [ -  - ]
     107                 :            :   }
     108                 :            : 
     109                 :          8 :   return nfo;
     110                 :            : }
     111                 :            : 
     112                 :            : }  // walker::

Generated by: LCOV version 1.14