Quinoa all test code coverage report
Current view: top level - PDE - ConfigureMultiMat.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 49 49 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: 68 144 47.2 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/ConfigureMultiMat.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 multi-material compressible
       9                 :            :      flow PDE
      10                 :            :   \details   Register and compile configuration for compressible multi-material
      11                 :            :      flow PDE.
      12                 :            : */
      13                 :            : // *****************************************************************************
      14                 :            : 
      15                 :            : #include <set>
      16                 :            : #include <map>
      17                 :            : #include <vector>
      18                 :            : #include <string>
      19                 :            : 
      20                 :            : #include <brigand/algorithms/for_each.hpp>
      21                 :            : 
      22                 :            : #include "Tags.hpp"
      23                 :            : #include "CartesianProduct.hpp"
      24                 :            : #include "PDEFactory.hpp"
      25                 :            : #include "Inciter/Options/PDE.hpp"
      26                 :            : #include "ContainerUtil.hpp"
      27                 :            : #include "ConfigureMultiMat.hpp"
      28                 :            : #include "MultiMat/Physics/DG.hpp"
      29                 :            : #include "MultiMat/Physics/FV.hpp"
      30                 :            : #include "MultiMat/DGMultiMat.hpp"
      31                 :            : #include "MultiMat/FVMultiMat.hpp"
      32                 :            : #include "MultiMat/Problem.hpp"
      33                 :            : #include "Inciter/Options/Material.hpp"
      34                 :            : 
      35                 :            : namespace inciter {
      36                 :            : 
      37                 :            : void
      38                 :       2340 : registerMultiMat( DGFactory& df, FVFactory& ff,
      39                 :            :   std::set< ctr::PDEType >& fvt, std::set< ctr::PDEType >& dgt )
      40                 :            : // *****************************************************************************
      41                 :            : // Register multi-material compressible flow PDE into PDE factory
      42                 :            : //! \param[in,out] df Discontinuous Galerkin PDE factory to register to
      43                 :            : //! \param[in,out] ff Finite volume PDE factory to register to
      44                 :            : //! \param[in,out] dgt Counters for equation types registered into DG factory
      45                 :            : //! \param[in,out] fvt Counters for equation types registered into FV factory
      46                 :            : // *****************************************************************************
      47                 :            : {
      48                 :            :   // Construct vector of vectors for all possible policies
      49                 :            :   using DGMultiMatPolicies =
      50                 :            :     tk::cartesian_product< dg::MultiMatPhysics, MultiMatProblems >;
      51                 :            :   // Register PDEs for all combinations of policies
      52                 :            :   brigand::for_each< DGMultiMatPolicies >(
      53                 :       2340 :     registerDG< dg::MultiMat >( df, dgt, ctr::PDEType::MULTIMAT ) );
      54                 :            : 
      55                 :            :   // Construct vector of vectors for all possible policies
      56                 :            :   using FVMultiMatPolicies =
      57                 :            :     tk::cartesian_product< fv::MultiMatPhysics, MultiMatProblems >;
      58                 :            :   // Register PDEs for all combinations of policies
      59                 :            :   brigand::for_each< FVMultiMatPolicies >(
      60                 :       2340 :     registerFV< fv::MultiMat >( ff, fvt, ctr::PDEType::MULTIMAT ) );
      61                 :       2340 : }
      62                 :            : 
      63                 :            : std::vector< std::pair< std::string, std::string > >
      64                 :         35 : infoMultiMat( 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::multimat;
      72                 :            :   using tk::parameter;
      73                 :            :   using tk::parameters;
      74                 :            : 
      75         [ +  - ]:         35 :   auto c = ++cnt[ ctr::PDEType::MULTIMAT ];       // count eqs
      76                 :            :   --c;  // used to index vectors starting with 0
      77                 :            : 
      78                 :            :   std::vector< std::pair< std::string, std::string > > nfo;
      79                 :            : 
      80 [ +  - ][ +  - ]:         70 :   nfo.emplace_back( ctr::PDE().name( ctr::PDEType::MULTIMAT ), "" );
      81                 :            : 
      82         [ +  - ]:         35 :   nfo.emplace_back( "physics", ctr::Physics().name(
      83         [ +  - ]:         70 :     g_inputdeck.get< eq, tag::physics >() ) );
      84                 :            : 
      85         [ +  - ]:         35 :   nfo.emplace_back( "problem", ctr::Problem().name(
      86         [ +  - ]:         70 :     g_inputdeck.get< eq, tag::problem >() ) );
      87                 :            : 
      88         [ +  - ]:         35 :   nfo.emplace_back( "flux", ctr::Flux().name(
      89         [ +  - ]:         70 :     g_inputdeck.get< tag::flux >() ) );
      90                 :            : 
      91         [ +  - ]:         35 :   auto nmat = g_inputdeck.get< eq, tag::nmat >();
      92         [ +  - ]:         35 :   nfo.emplace_back( "number of materials", std::to_string( nmat ) );
      93                 :            : 
      94         [ +  - ]:         35 :   auto prelax = g_inputdeck.get< eq, tag::prelax >();
      95         [ +  - ]:         35 :   nfo.emplace_back( "finite pressure relaxation", std::to_string( prelax ) );
      96                 :            : 
      97         [ +  - ]:         35 :   auto intsharp = g_inputdeck.get< eq, tag::intsharp >();
      98         [ +  - ]:         35 :   nfo.emplace_back( "interface sharpening", std::to_string( intsharp ) );
      99                 :            : 
     100         [ +  - ]:         35 :   auto ncomp = g_inputdeck.get< tag::ncomp >();
     101         [ +  - ]:         35 :   nfo.emplace_back( "number of components", std::to_string( ncomp ) );
     102                 :            : 
     103                 :            :   // Material eos output
     104                 :            :   const auto& matprop = g_inputdeck.get< tag::material >();
     105         [ +  + ]:         71 :   for (const auto& mtype : matprop) {
     106                 :            :     const auto& m_id = mtype.get< tag::id >();
     107         [ +  - ]:         36 :     ctr::Material opt;
     108                 :         36 :     nfo.emplace_back( opt.name( mtype.get< tag::eos >() ),
     109 [ +  - ][ +  - ]:        108 :       std::to_string(m_id.size())+" materials" );
         [ +  - ][ -  + ]
                 [ -  - ]
     110 [ +  - ][ +  - ]:         72 :     nfo.emplace_back( "material id", parameters( m_id ) );
     111                 :            :   }
     112                 :            : 
     113                 :            :   // ICs and IC-boxes
     114                 :            : 
     115                 :            :   const auto& ic = g_inputdeck.get< tag::ic >();
     116                 :            : 
     117                 :            :   const auto& bgmatidic = ic.get< tag::materialid >();
     118 [ +  - ][ +  - ]:         70 :   nfo.emplace_back( "IC background material id", parameter( bgmatidic ) );
                 [ +  + ]
     119                 :            : 
     120                 :            :   const auto& icbox = ic.get< tag::box >();
     121         [ +  + ]:         35 :   if (!icbox.empty()) {
     122                 :          2 :     std::size_t bcnt = 0;
     123         [ +  + ]:          4 :     for (const auto& b : icbox) {   // for all boxes configured for this eq
     124                 :            :       std::vector< tk::real > box
     125                 :          2 :         { b.get< tag::xmin >(), b.get< tag::xmax >(),
     126                 :          2 :           b.get< tag::ymin >(), b.get< tag::ymax >(),
     127         [ +  - ]:          2 :           b.get< tag::zmin >(), b.get< tag::zmax >() };
     128                 :            : 
     129 [ +  - ][ +  - ]:          2 :       std::string boxname = "IC box " + parameter(bcnt);
                 [ -  - ]
     130 [ +  - ][ +  - ]:          4 :       nfo.emplace_back( boxname, parameters( box ) );
                 [ +  - ]
     131                 :            : 
     132 [ +  - ][ -  + ]:          4 :       nfo.emplace_back( boxname + " orientation",
                 [ -  - ]
     133 [ +  - ][ +  - ]:          6 :         parameters(b.get< tag::orientation >()) );
                 [ +  - ]
     134                 :            : 
     135 [ +  - ][ -  + ]:          4 :       nfo.emplace_back( boxname + " material id",
                 [ -  - ]
     136 [ +  - ][ +  - ]:          4 :                         parameter( b.get< tag::materialid >() ) );
                 [ -  - ]
     137                 :            : 
     138                 :            :       const auto& initiate = b.get< tag::initiate >();
     139         [ +  - ]:          2 :       auto opt = ctr::Initiate();
     140 [ +  - ][ +  - ]:          6 :       nfo.emplace_back( boxname + ' ' + opt.group(), opt.name(initiate) );
         [ +  - ][ -  + ]
                 [ -  - ]
     141                 :            : 
     142                 :          2 :       ++bcnt;
     143                 :            :     }
     144                 :            :   }
     145                 :            : 
     146                 :            :   const auto& icblock = ic.get< tag::meshblock >();
     147         [ +  + ]:         36 :   for (const auto& b : icblock) {   // for all blocks configured for eq
     148                 :            :     std::string blockname = "IC mesh block " +
     149 [ +  - ][ +  - ]:          2 :       parameter(b.get< tag::blockid >());
                 [ +  - ]
     150                 :            : 
     151 [ +  - ][ -  + ]:          2 :     nfo.emplace_back( blockname + " material id",
                 [ -  - ]
     152 [ +  - ][ +  - ]:          2 :                       parameter( b.get< tag::materialid >() ) );
                 [ -  - ]
     153                 :            :     const auto& initiate = b.get< tag::initiate >();
     154         [ +  - ]:          1 :     auto opt = ctr::Initiate();
     155 [ +  - ][ +  - ]:          3 :     nfo.emplace_back( blockname + ' ' + opt.group(), opt.name(initiate) );
         [ +  - ][ -  + ]
                 [ -  - ]
     156                 :            :   }
     157                 :            : 
     158                 :         35 :   return nfo;
     159                 :            : }
     160                 :            : 
     161                 :            : }  // inciter::

Generated by: LCOV version 1.14