Quinoa all test code coverage report
Current view: top level - PDE - ConfigureTransport.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 30 30 100.0 %
Date: 2024-04-29 14:42:33 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 56 130 43.1 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/ConfigureTransport.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 transport PDE
       9                 :            :   \details   Register and compile configuration on the transport PDE.
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : 
      13                 :            : #include <set>
      14                 :            : #include <map>
      15                 :            : #include <vector>
      16                 :            : #include <string>
      17                 :            : 
      18                 :            : #include <brigand/algorithms/for_each.hpp>
      19                 :            : 
      20                 :            : #include "Tags.hpp"
      21                 :            : #include "CartesianProduct.hpp"
      22                 :            : #include "PDEFactory.hpp"
      23                 :            : #include "Inciter/Options/PDE.hpp"
      24                 :            : #include "ContainerUtil.hpp"
      25                 :            : #include "ConfigureTransport.hpp"
      26                 :            : #include "Transport/Physics/CG.hpp"
      27                 :            : #include "Transport/Physics/DG.hpp"
      28                 :            : #include "Transport/CGTransport.hpp"
      29                 :            : #include "Transport/DGTransport.hpp"
      30                 :            : #include "Transport/Problem.hpp"
      31                 :            : 
      32                 :            : namespace inciter {
      33                 :            : 
      34                 :            : void
      35                 :       2340 : registerTransport( CGFactory& cf,
      36                 :            :                    DGFactory& df,
      37                 :            :                    std::set< ctr::PDEType >& cgt,
      38                 :            :                    std::set< ctr::PDEType >& dgt )
      39                 :            : // *****************************************************************************
      40                 :            : // Register transport PDE into PDE factory
      41                 :            : //! \param[in,out] cf Continuous Galerkin PDE factory to register to
      42                 :            : //! \param[in,out] df Discontinuous Galerkin PDE factory to register to
      43                 :            : //! \param[in,out] cgt Counters for equation types registered into CG factory
      44                 :            : //! \param[in,out] dgt Counters for equation types registered into DG factory
      45                 :            : // *****************************************************************************
      46                 :            : {
      47                 :            :   // Construct vector of vectors for all possible policies
      48                 :            :   using CGTransportPolicies =
      49                 :            :     tk::cartesian_product< cg::TransportPhysics, TransportProblems >;
      50                 :            :   // Register PDEs for all combinations of policies
      51                 :            :   brigand::for_each< CGTransportPolicies >(
      52                 :       2340 :     registerCG< cg::Transport >( cf, cgt, ctr::PDEType::TRANSPORT ) );
      53                 :            : 
      54                 :            :   // Construct vector of vectors for all possible policies
      55                 :            :   using DGTransportPolicies =
      56                 :            :     tk::cartesian_product< dg::TransportPhysics, TransportProblems >;
      57                 :            :   // Register PDEs for all combinations of policies
      58                 :            :   brigand::for_each< DGTransportPolicies >(
      59                 :       2340 :     registerDG< dg::Transport >( df, dgt, ctr::PDEType::TRANSPORT ) );
      60                 :       2340 : }
      61                 :            : 
      62                 :            : std::vector< std::pair< std::string, std::string > >
      63                 :         95 : infoTransport( std::map< ctr::PDEType, tk::ncomp_t >& cnt )
      64                 :            : // *****************************************************************************
      65                 :            : //  Return information on the transport PDE
      66                 :            : //! \param[inout] cnt std::map of counters for all PDE types
      67                 :            : //! \return vector of string pairs describing the PDE configuration
      68                 :            : // *****************************************************************************
      69                 :            : {
      70                 :            :   using tk::parameters;
      71                 :            :   using eq = tag::transport;
      72                 :            : 
      73         [ +  - ]:         95 :   auto c = ++cnt[ ctr::PDEType::TRANSPORT ];       // count eqs
      74                 :            :   --c;  // used to index vectors starting with 0
      75                 :            : 
      76                 :            :   std::vector< std::pair< std::string, std::string > > nfo;
      77                 :            : 
      78 [ +  - ][ +  - ]:        190 :   nfo.emplace_back( ctr::PDE().name( ctr::PDEType::TRANSPORT ), "" );
      79                 :            : 
      80         [ +  - ]:         95 :   nfo.emplace_back( "problem", ctr::Problem().name(
      81         [ +  - ]:        190 :     g_inputdeck.get< eq, tag::problem >() ) );
      82                 :            : 
      83         [ +  - ]:         95 :   auto intsharp = g_inputdeck.get< eq, tag::intsharp >();
      84         [ +  - ]:         95 :   nfo.emplace_back( "interface sharpening", std::to_string( intsharp ) );
      85                 :            : 
      86         [ +  - ]:         95 :   auto ncomp = g_inputdeck.get< tag::ncomp >();
      87         [ +  - ]:         95 :   nfo.emplace_back( "number of components", std::to_string( ncomp ) );
      88                 :            : 
      89                 :            :   const auto& bc = g_inputdeck.get< tag::bc >();
      90         [ +  + ]:        190 :   for (const auto& ib : bc) {
      91                 :            :     const auto& bcdir = ib.get< tag::dirichlet >();
      92         [ +  + ]:         95 :     if (!bcdir.empty())
      93 [ +  - ][ +  - ]:         58 :       nfo.emplace_back( "Dirichlet boundary [" + std::to_string( ncomp ) + "]",
         [ -  + ][ -  + ]
         [ -  + ][ -  - ]
         [ -  - ][ -  - ]
      94 [ +  - ][ +  - ]:         87 :         parameters( bcdir ) );
      95                 :            : 
      96                 :            :     const auto& bcsym = ib.get< tag::symmetry >();
      97         [ +  + ]:         95 :     if (!bcsym.empty())
      98 [ +  - ][ +  - ]:          8 :       nfo.emplace_back( "Symmetry boundary [" + std::to_string( ncomp ) + "]",
         [ -  + ][ -  + ]
         [ -  + ][ -  - ]
         [ -  - ][ -  - ]
      99 [ +  - ][ +  - ]:         12 :         parameters( bcsym ) );
     100                 :            : 
     101                 :            :     const auto& bcinlet =
     102                 :            :       ib.get< tag::inlet >();
     103         [ +  + ]:         95 :     if (!bcinlet.empty())
     104 [ +  - ][ +  - ]:         24 :       nfo.emplace_back( "Inlet boundary [" + std::to_string( ncomp ) + "]",
         [ -  + ][ -  + ]
         [ -  + ][ -  - ]
         [ -  - ][ -  - ]
     105 [ +  - ][ +  - ]:         36 :         parameters( bcinlet ) );
     106                 :            : 
     107                 :            :     const auto& bcoutlet =
     108                 :            :       ib.get< tag::outlet >();
     109         [ +  + ]:         95 :     if (!bcoutlet.empty())
     110 [ +  - ][ +  - ]:         40 :       nfo.emplace_back( "Outlet boundary [" + std::to_string( ncomp ) + "]",
         [ -  + ][ -  + ]
         [ -  + ][ -  - ]
         [ -  - ][ -  - ]
     111 [ +  - ][ +  - ]:         60 :         parameters( bcoutlet ) );
     112                 :            : 
     113                 :            :     const auto& bcextrapolate =
     114                 :            :       ib.get< tag::extrapolate >();
     115         [ +  + ]:         95 :     if (!bcextrapolate.empty())
     116 [ +  - ][ +  - ]:         40 :       nfo.emplace_back( "Symmetry boundary [" + std::to_string( ncomp ) + "]",
         [ -  + ][ -  + ]
         [ -  + ][ -  - ]
         [ -  - ][ -  - ]
     117 [ +  - ][ +  - ]:         60 :         parameters( bcextrapolate ) );
     118                 :            :   }
     119                 :            : 
     120                 :         95 :   return nfo;
     121                 :            : }
     122                 :            : 
     123                 :            : }  // inciter::

Generated by: LCOV version 1.14