Quinoa regression test code coverage report
Current view: top level - DiffEq/OrnsteinUhlenbeck - ConfigureDiagOrnsteinUhlenbeck.cpp (source / functions) Hit Total Coverage
Commit: Quinoa_v0.3-957-gb4f0efae0 Lines: 32 32 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/OrnsteinUhlenbeck/ConfigureDiagOrnsteinUhlenbeck.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 diagonal
       9                 :            :              Ornstein-Uhlenbeck SDE
      10                 :            :   \details   Register and compile configuration on the diagonal
      11                 :            :              Ornstein-Uhlenbeck SDE.
      12                 :            : */
      13                 :            : // *****************************************************************************
      14                 :            : 
      15                 :            : #include <set>
      16                 :            : #include <map>
      17                 :            : #include <vector>
      18                 :            : #include <string>
      19                 :            : #include <utility>
      20                 :            : 
      21                 :            : #include <brigand/algorithms/for_each.hpp>
      22                 :            : 
      23                 :            : #include "Tags.hpp"
      24                 :            : #include "CartesianProduct.hpp"
      25                 :            : #include "DiffEqFactory.hpp"
      26                 :            : #include "Walker/Options/DiffEq.hpp"
      27                 :            : #include "Walker/Options/InitPolicy.hpp"
      28                 :            : 
      29                 :            : #include "ConfigureDiagOrnsteinUhlenbeck.hpp"
      30                 :            : #include "DiagOrnsteinUhlenbeck.hpp"
      31                 :            : #include "DiagOrnsteinUhlenbeckCoeffPolicy.hpp"
      32                 :            : 
      33                 :            : namespace walker {
      34                 :            : 
      35                 :            : void
      36                 :        323 : registerDiagOrnsteinUhlenbeck( DiffEqFactory& f,
      37                 :            :                                std::set< ctr::DiffEqType >& t )
      38                 :            : // *****************************************************************************
      39                 :            : // Register diagonal Ornstein-Uhlenbeck SDE into DiffEq factory
      40                 :            : //! \param[in,out] f Differential equation factory to register to
      41                 :            : //! \param[in,out] t Counters for equation types registered
      42                 :            : // *****************************************************************************
      43                 :            : {
      44                 :            :   // Construct vector of vectors for all possible policies for SDE
      45                 :            :   using DiagOrnsteinUhlenbeckPolicies =
      46                 :            :     tk::cartesian_product< InitPolicies, DiagOrnsteinUhlenbeckCoeffPolicies >;
      47                 :            :   // Register SDE for all combinations of policies
      48                 :            :   brigand::for_each< DiagOrnsteinUhlenbeckPolicies >(
      49         [ +  - ]:        323 :     registerDiffEq< DiagOrnsteinUhlenbeck >( f, ctr::DiffEqType::DIAG_OU, t ) );
      50                 :        323 : }
      51                 :            : 
      52                 :            : std::vector< std::pair< std::string, std::string > >
      53                 :         10 : infoDiagOrnsteinUhlenbeck( std::map< ctr::DiffEqType, tk::ctr::ncomp_t >& cnt )
      54                 :            : // *****************************************************************************
      55                 :            : //  Return information on the diagonal Ornstein-Uhlenbeck SDE
      56                 :            : //! \param[inout] cnt std::map of counters for all differential equation types
      57                 :            : //! \return vector of string pairs describing the SDE configuration
      58                 :            : // *****************************************************************************
      59                 :            : {
      60         [ +  - ]:         10 :   auto c = ++cnt[ ctr::DiffEqType::DIAG_OU ];       // count eqs
      61                 :         10 :   --c;  // used to index vectors starting with 0
      62                 :            : 
      63                 :         10 :   std::vector< std::pair< std::string, std::string > > nfo;
      64                 :            : 
      65 [ +  - ][ +  - ]:         10 :   nfo.emplace_back( ctr::DiffEq().name( ctr::DiffEqType::DIAG_OU ), "" );
                 [ +  - ]
      66                 :            : 
      67         [ +  - ]:         20 :   nfo.emplace_back( "start offset in particle array", std::to_string(
      68         [ +  - ]:         20 :     g_inputdeck.get< tag::component >().offset< tag::diagou >(c) ) );
      69                 :         10 :   auto ncomp = g_inputdeck.get< tag::component >().get< tag::diagou >()[c];
      70 [ +  - ][ +  - ]:         10 :   nfo.emplace_back( "number of components", std::to_string( ncomp ) );
      71                 :            : 
      72         [ +  - ]:         10 :   nfo.emplace_back( "kind", "stochastic" );
      73         [ +  - ]:         30 :   nfo.emplace_back( "dependent variable", std::string( 1,
      74         [ +  - ]:         20 :     g_inputdeck.get< tag::param, tag::diagou, tag::depvar >()[c] ) );
      75         [ +  - ]:         20 :   nfo.emplace_back( "initialization policy", ctr::InitPolicy().name(
      76 [ +  - ][ +  - ]:         10 :     g_inputdeck.get< tag::param, tag::diagou, tag::initpolicy >()[c] ) );
      77         [ +  - ]:         20 :   nfo.emplace_back( "coefficients policy", ctr::CoeffPolicy().name(
      78 [ +  - ][ +  - ]:         10 :     g_inputdeck.get< tag::param, tag::diagou, tag::coeffpolicy >()[c] ) );
      79         [ +  - ]:         20 :   nfo.emplace_back( "random number generator", tk::ctr::RNG().name(
      80 [ +  - ][ +  - ]:         10 :     g_inputdeck.get< tag::param, tag::diagou, tag::rng >()[c] ) );
      81                 :            :   nfo.emplace_back(
      82 [ +  - ][ +  - ]:         20 :     "coeff sigmasq [" + std::to_string( ncomp ) + "]",
                 [ +  - ]
      83 [ +  - ][ +  - ]:         30 :     parameters( g_inputdeck.get< tag::param, tag::diagou, tag::mu >().at(c) ) );
                 [ +  - ]
      84 [ +  - ][ +  - ]:         20 :   nfo.emplace_back( "coeff theta [" + std::to_string( ncomp ) + "]",
                 [ +  - ]
      85 [ +  - ][ +  - ]:         20 :     parameters( g_inputdeck.get< tag::param, tag::diagou, tag::theta >().at(c) )
      86         [ +  - ]:         10 :   );
      87 [ +  - ][ +  - ]:         20 :   nfo.emplace_back( "coeff mu [" + std::to_string( ncomp ) + "]",
                 [ +  - ]
      88 [ +  - ][ +  - ]:         30 :     parameters( g_inputdeck.get< tag::param, tag::diagou, tag::mu >().at(c) ) );
                 [ +  - ]
      89                 :            : 
      90                 :         10 :   const auto& init = g_inputdeck.get< tag::param, tag::diagou, tag::init >();
      91 [ +  - ][ +  - ]:         10 :   spikes( nfo, init.get< tag::spike >().at(c) );
      92 [ +  - ][ +  - ]:         10 :   betapdfs( nfo, init.get< tag::betapdf >().at(c) );
      93                 :            : 
      94                 :         10 :   return nfo;
      95                 :            : }
      96                 :            : 
      97                 :            : }  // walker::

Generated by: LCOV version 1.14