Walker test code coverage report
Current view: top level - DiffEq/Dissipation - ConfigureDissipation.cpp (source / functions) Hit Total Coverage
Commit: test_coverage.info Lines: 31 31 100.0 %
Date: 2022-09-21 18:57:21 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 36 72 50.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/DiffEq/Dissipation/ConfigureDissipation.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 dissipation SDE
       9                 :            :   \details   Register and compile configuration on the dissipation 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 "ConfigureDissipation.hpp"
      28                 :            : #include "Dissipation.hpp"
      29                 :            : #include "DissipationCoeffPolicy.hpp"
      30                 :            : 
      31                 :            : #include "CoupledEq.hpp"
      32                 :            : 
      33                 :            : namespace walker {
      34                 :            : 
      35                 :            : void
      36                 :        374 : registerDissipation( DiffEqFactory& f, std::set< ctr::DiffEqType >& t )
      37                 :            : // *****************************************************************************
      38                 :            : // Register dissipation SDE into DiffEq factory
      39                 :            : //! \param[in,out] f Differential equation factory to register to
      40                 :            : //! \param[in,out] t Counters for equation types registered
      41                 :            : // *****************************************************************************
      42                 :            : {
      43                 :            :   // Construct vector of vectors for all possible policies for equation
      44                 :            :   using DissipationPolicies =
      45                 :            :     tk::cartesian_product< InitPolicies, DissipationCoeffPolicies >;
      46                 :            :   // Register SDE for all combinations of policies
      47                 :            :   brigand::for_each< DissipationPolicies >(
      48         [ +  - ]:        374 :     registerDiffEq< Dissipation >( f, ctr::DiffEqType::DISSIPATION, t ) );
      49                 :        374 : }
      50                 :            : 
      51                 :            : std::vector< std::pair< std::string, std::string > >
      52                 :          6 : infoDissipation( std::map< ctr::DiffEqType, tk::ctr::ncomp_t >& cnt )
      53                 :            : // *****************************************************************************
      54                 :            : //  Return information on the dissipation SDE
      55                 :            : //! \param[inout] cnt std::map of counters for all differential equation types
      56                 :            : //! \return vector of string pairs describing the SDE configuration
      57                 :            : // *****************************************************************************
      58                 :            : {
      59                 :            :   using eq = tag::dissipation;
      60                 :            : 
      61         [ +  - ]:          6 :   auto c = ++cnt[ ctr::DiffEqType::DISSIPATION ];       // count eqs
      62                 :          6 :   --c;  // used to index vectors starting with 0
      63                 :            : 
      64                 :          6 :   std::vector< std::pair< std::string, std::string > > nfo;
      65                 :            : 
      66 [ +  - ][ +  - ]:          6 :   nfo.emplace_back( ctr::DiffEq().name( ctr::DiffEqType::DISSIPATION ), "" );
                 [ +  - ]
      67                 :            : 
      68         [ +  - ]:          6 :   nfo.emplace_back( "kind", "stochastic" );
      69                 :          6 :   nfo.emplace_back( "dependent variable", std::string( 1,
      70 [ +  - ][ +  - ]:          6 :     g_inputdeck.get< tag::param, eq, tag::depvar >()[c] ) );
      71                 :          6 :   nfo.emplace_back( "start offset in particle array", std::to_string(
      72 [ +  - ][ +  - ]:          6 :     g_inputdeck.get< tag::component >().offset< eq >(c) ) );
      73                 :          6 :   nfo.emplace_back( "number of components", std::to_string(
      74 [ +  - ][ +  - ]:          6 :     g_inputdeck.get< tag::component, eq >()[c] ) );
      75                 :            : 
      76                 :            :   coupledInfo< eq, tag::velocity, tag::velocity_id >
      77 [ +  - ][ +  - ]:          6 :              ( c, "velocity", nfo );
                 [ +  - ]
      78                 :            : 
      79         [ +  - ]:         12 :   nfo.emplace_back( "initialization policy", ctr::InitPolicy().name(
      80 [ +  - ][ +  - ]:          6 :     g_inputdeck.get< tag::param, eq, tag::initpolicy >()[c] ) );
      81         [ +  - ]:         12 :   nfo.emplace_back( "coefficients policy", ctr::CoeffPolicy().name(
      82 [ +  - ][ +  - ]:          6 :     g_inputdeck.get< tag::param, eq, tag::coeffpolicy >()[c] ) );
      83                 :            : 
      84         [ +  - ]:         12 :   nfo.emplace_back( "random number generator", tk::ctr::RNG().name(
      85 [ +  - ][ +  - ]:          6 :     g_inputdeck.get< tag::param, eq, tag::rng >()[c] ) );
      86                 :          6 :   nfo.emplace_back( "coeff C3", std::to_string(
      87 [ +  - ][ +  - ]:          6 :     g_inputdeck.get< tag::param, eq, tag::c3 >().at(c) ) );
                 [ +  - ]
      88                 :          6 :   nfo.emplace_back( "coeff C4", std::to_string(
      89 [ +  - ][ +  - ]:          6 :     g_inputdeck.get< tag::param, eq, tag::c4 >().at(c) ) );
                 [ +  - ]
      90                 :          6 :   nfo.emplace_back( "coeff COM1", std::to_string(
      91 [ +  - ][ +  - ]:          6 :     g_inputdeck.get< tag::param, eq, tag::com1 >().at(c) ) );
                 [ +  - ]
      92                 :          6 :   nfo.emplace_back( "coeff COM2", std::to_string(
      93 [ +  - ][ +  - ]:          6 :     g_inputdeck.get< tag::param, eq, tag::com2 >().at(c) ) );
                 [ +  - ]
      94                 :            : 
      95                 :          6 :   return nfo;
      96                 :            : }
      97                 :            : 
      98                 :            : }  // walker::

Generated by: LCOV version 1.14