Quinoa all test code coverage report
Current view: top level - PDE - ConfigureCompFlow.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 45 48 93.8 %
Date: 2024-04-29 14:42:33 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 59 122 48.4 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/ConfigureCompFlow.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 for compressible flow PDE
       9                 :            :   \details   Register and compile configuration for compressible flow PDE.
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : 
      13                 :            : #include <set>
      14                 :            : #include <map>
      15                 :            : #include <vector>
      16                 :            : #include <string>
      17                 :            : #include <limits>
      18                 :            : 
      19                 :            : #include <brigand/algorithms/for_each.hpp>
      20                 :            : 
      21                 :            : #include "Tags.hpp"
      22                 :            : #include "CartesianProduct.hpp"
      23                 :            : #include "PDEFactory.hpp"
      24                 :            : #include "Inciter/Options/PDE.hpp"
      25                 :            : #include "ContainerUtil.hpp"
      26                 :            : #include "ConfigureCompFlow.hpp"
      27                 :            : #include "CompFlow/Physics/CG.hpp"
      28                 :            : #include "CompFlow/Physics/DG.hpp"
      29                 :            : #include "CompFlow/CGCompFlow.hpp"
      30                 :            : #include "CompFlow/DGCompFlow.hpp"
      31                 :            : #include "CompFlow/Problem.hpp"
      32                 :            : 
      33                 :            : namespace inciter {
      34                 :            : 
      35                 :            : void
      36                 :       2340 : registerCompFlow( CGFactory& cf,
      37                 :            :                   DGFactory& df,
      38                 :            :                   std::set< ctr::PDEType >& cgt,
      39                 :            :                   std::set< ctr::PDEType >& dgt )
      40                 :            : // *****************************************************************************
      41                 :            : // Register compressible flow PDE into PDE factory
      42                 :            : //! \param[in,out] cf Continuous Galerkin PDE factory to register to
      43                 :            : //! \param[in,out] df Discontinuous Galerkin PDE factory to register to
      44                 :            : //! \param[in,out] cgt Counters for equation types registered into CG factory
      45                 :            : //! \param[in,out] dgt Counters for equation types registered into DG factory
      46                 :            : // *****************************************************************************
      47                 :            : {
      48                 :            :   // Construct vector of vectors for all possible policies
      49                 :            :   using CGCompFlowPolicies =
      50                 :            :     tk::cartesian_product< cg::CompFlowPhysics, CompFlowProblems >;
      51                 :            :   // Register PDEs for all combinations of policies
      52                 :            :   brigand::for_each< CGCompFlowPolicies >(
      53                 :       2340 :     registerCG< cg::CompFlow >( cf, cgt, ctr::PDEType::COMPFLOW ) );
      54                 :            : 
      55                 :            :   // Construct vector of vectors for all possible policies
      56                 :            :   using DGCompFlowPolicies =
      57                 :            :     tk::cartesian_product< dg::CompFlowPhysics, CompFlowProblems >;
      58                 :            :   // Register PDEs for all combinations of policies
      59                 :            :   brigand::for_each< DGCompFlowPolicies >(
      60                 :       2340 :     registerDG< dg::CompFlow >( df, dgt, ctr::PDEType::COMPFLOW ) );
      61                 :       2340 : }
      62                 :            : 
      63                 :            : std::vector< std::pair< std::string, std::string > >
      64                 :         65 : infoCompFlow( std::map< ctr::PDEType, tk::ncomp_t >& cnt )
      65                 :            : // *****************************************************************************
      66                 :            : //  Return information on the compressible flow system of PDEs
      67                 :            : //! \param[inout] cnt std::map of counters for all PDE types
      68                 :            : //! \return vector of string pairs describing the PDE configuration
      69                 :            : // *****************************************************************************
      70                 :            : {
      71                 :            :   using eq = tag::compflow;
      72                 :            :   using tk::parameter;
      73                 :            :   using tk::parameters;
      74                 :            : 
      75         [ +  - ]:         65 :   auto c = ++cnt[ ctr::PDEType::COMPFLOW ];       // count eqs
      76                 :            :   --c;  // used to index vectors starting with 0
      77                 :            : 
      78                 :            :   std::vector< std::pair< std::string, std::string > > nfo;
      79                 :            : 
      80 [ +  - ][ +  - ]:        130 :   nfo.emplace_back( ctr::PDE().name( ctr::PDEType::COMPFLOW ), "" );
      81                 :            : 
      82         [ +  - ]:         65 :   nfo.emplace_back( "physics", ctr::Physics().name(
      83         [ +  - ]:        130 :     g_inputdeck.get< eq, tag::physics >() ) );
      84                 :            : 
      85         [ +  - ]:         65 :   nfo.emplace_back( "problem", ctr::Problem().name(
      86         [ +  - ]:        130 :     g_inputdeck.get< eq, tag::problem >() ) );
      87                 :            : 
      88                 :         65 :   auto ncomp = g_inputdeck.get< tag::ncomp >();
      89 [ +  - ][ +  - ]:         65 :   nfo.emplace_back( "number of components", parameter( ncomp ) );
      90                 :            : 
      91                 :         65 :   const auto scheme = g_inputdeck.get< tag::scheme >();
      92         [ +  + ]:         65 :   if (scheme != ctr::SchemeType::ALECG && scheme != ctr::SchemeType::OversetFE)
      93         [ +  - ]:         66 :     nfo.emplace_back( "flux", ctr::Flux().name(
      94         [ +  - ]:         66 :       g_inputdeck.get< tag::flux >() ) );
      95                 :            : 
      96                 :            :   // ICs
      97                 :            : 
      98                 :            :   const auto& ic = g_inputdeck.get< tag::ic >();
      99                 :            : 
     100                 :            :   const auto& icbox = ic.get< tag::box >();
     101         [ +  + ]:         65 :   if (!icbox.empty()) {
     102                 :          3 :     std::size_t bcnt = 0;
     103         [ +  + ]:          7 :     for (const auto& b : icbox) {   // for all boxes configured for this eq
     104                 :            :       std::vector< tk::real > box
     105                 :          4 :         { b.get< tag::xmin >(), b.get< tag::xmax >(),
     106                 :          4 :           b.get< tag::ymin >(), b.get< tag::ymax >(),
     107         [ +  - ]:          4 :           b.get< tag::zmin >(), b.get< tag::zmax >() };
     108                 :            : 
     109 [ +  - ][ +  - ]:          4 :       std::string boxname = "IC box " + parameter(bcnt);
                 [ -  - ]
     110 [ +  - ][ +  - ]:          8 :       nfo.emplace_back( boxname, parameters( box ) );
                 [ +  - ]
     111                 :            : 
     112 [ +  - ][ -  + ]:          8 :       nfo.emplace_back( boxname + " orientation",
                 [ -  - ]
     113 [ +  - ][ +  - ]:          8 :         parameters(b.get< tag::orientation >()) );
                 [ -  - ]
     114                 :            : 
     115                 :            :       const auto& initiate = b.get< tag::initiate >();
     116         [ +  - ]:          4 :       auto opt = ctr::Initiate();
     117 [ +  - ][ +  - ]:         12 :       nfo.emplace_back( boxname + ' ' + opt.group(), opt.name(initiate) );
         [ +  - ][ -  + ]
                 [ -  - ]
     118                 :            : 
     119                 :          4 :       ++bcnt;
     120                 :            :     }
     121                 :            :   }
     122                 :            : 
     123                 :            :   const auto& icblock = ic.get< tag::meshblock >();
     124         [ -  + ]:         65 :   for (const auto& b : icblock) {   // for all blocks configured for eq
     125                 :            :     std::string blockname = "IC mesh block " +
     126 [ -  - ][ -  - ]:          0 :       parameter(b.get< tag::blockid >());
     127                 :            : 
     128                 :            :     const auto& initiate = b.get< tag::initiate >();
     129         [ -  - ]:          0 :     auto opt = ctr::Initiate();
     130 [ -  - ][ -  - ]:          0 :     nfo.emplace_back( blockname + ' ' + opt.group(), opt.name(initiate) );
         [ -  - ][ -  - ]
                 [ -  - ]
     131                 :            :   }
     132                 :            : 
     133                 :            :   // BCs
     134                 :            : 
     135                 :            :   const auto& bc = g_inputdeck.get< tag::bc >();
     136         [ +  + ]:        132 :   for (const auto& ib : bc) {
     137                 :            :     const auto& stag = ib.get< tag::stag_point >();
     138                 :            :     const auto& radius = ib.get< tag::radius >();
     139         [ +  + ]:         67 :     if (!stag.empty()) {
     140 [ +  - ][ +  - ]:          1 :       nfo.emplace_back( "Stagnation point(s)", parameters( stag ) );
     141 [ +  - ][ +  - ]:          2 :       nfo.emplace_back( "Stagnation point(s) radii", parameter( radius ) );
     142                 :            :     }
     143                 :            : 
     144                 :            :     const auto& fs = ib.get< tag::farfield >();
     145         [ +  + ]:         67 :     if (!fs.empty())
     146 [ +  - ][ +  - ]:         18 :       nfo.emplace_back( "Farfield BC sideset(s)", parameters( fs ) );
     147                 :            : 
     148                 :            :     const auto& sym = ib.get< tag::symmetry >();
     149         [ +  + ]:         67 :     if (!sym.empty())
     150 [ +  - ][ +  - ]:         68 :       nfo.emplace_back( "Symmetry BC sideset(s)", parameters( sym ) );
     151                 :            : 
     152                 :            :     const auto& dir = ib.get< tag::dirichlet >();
     153         [ +  + ]:         67 :     if (!dir.empty())
     154 [ +  - ][ +  - ]:         72 :       nfo.emplace_back( "Dirichlet BC sideset(s)", parameters( dir ) );
     155                 :            : 
     156                 :            :     const auto& timedep = ib.get< tag::timedep >();
     157         [ +  + ]:         67 :     if (!timedep.empty()) {
     158         [ +  + ]:          4 :       for (const auto& bndry : timedep) {
     159                 :            :         nfo.emplace_back( "Time dependent BC sideset(s)",
     160 [ +  - ][ +  - ]:          4 :           parameters(bndry.get< tag::sideset >()) );
     161                 :            :       }
     162                 :            :     }
     163                 :            :   }
     164                 :            : 
     165                 :         65 :   return nfo;
     166                 :            : }
     167                 :            : 
     168                 :            : }  // inciter::

Generated by: LCOV version 1.14