Quinoa all test code coverage report
Current view: top level - PDE/EoS - GetMatProp.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 9 10 90.0 %
Date: 2024-05-15 17:17:09 Functions: 4 15 26.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 4 50.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/PDE/EoS/GetMatProp.hpp
       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     Equation of state class
       9                 :            :   \details   This file defines functions for equations of state for the
      10                 :            :     compressible flow equations.
      11                 :            : */
      12                 :            : // *****************************************************************************
      13                 :            : #ifndef GetMatProp_h
      14                 :            : #define GetMatProp_h
      15                 :            : 
      16                 :            : #include <cmath>
      17                 :            : #include "Inciter/InputDeck/InputDeck.hpp"
      18                 :            : 
      19                 :            : namespace inciter {
      20                 :            : 
      21                 :            : extern ctr::InputDeck g_inputdeck;
      22                 :            : 
      23                 :            : using ncomp_t = tk::ncomp_t;
      24                 :            : 
      25                 :            : //! Get a property for a material
      26                 :            : //! \tparam Prop Tag of property required
      27                 :            : //! \param[in] imat Material-id who's property is required. Default is 0, so
      28                 :            : //!   that for the single-material system, this argument can be left unspecified
      29                 :            : //!   by the calling code
      30                 :            : //! \return Material property Prop
      31                 :            : //! \note This function returns a zero if the vector for the property required
      32                 :            : //!   is empty. This will happen if the user has not specified that property
      33                 :            : //!   in the control file, hence the inputdeck has not allocated that property
      34                 :            : //!   vector.
      35                 :            : template< class Prop >
      36                 :            : tk::real
      37                 :   25987170 : getmatprop( std::size_t imat=0 ) {
      38                 :   25987170 :   const auto& matprop = g_inputdeck.get< tag::material >();
      39                 :   25987170 :   const auto& map = g_inputdeck.get< tag::matidxmap >();
      40                 :   25987170 :   auto meos = map.template get< tag::eosidx >()[ imat ];
      41                 :   25987170 :   auto midx = map.template get< tag::matidx >()[ imat ];
      42         [ +  - ]:   25987170 :   auto pvec = matprop[ meos ].template get< Prop >();
      43                 :            : 
      44                 :            :   tk::real mp;
      45         [ +  - ]:   25987170 :   if (!pvec.empty())
      46                 :   25987170 :     mp = pvec[ midx ];
      47                 :            :   else
      48                 :          0 :     mp = 0.0;
      49                 :   51974340 :   return mp;
      50                 :            : }
      51                 :            : 
      52                 :            : } //inciter::
      53                 :            : 
      54                 :            : #endif // GetMatProp_h

Generated by: LCOV version 1.14