Quinoa regression test code coverage report
Current view: top level - Inciter - FieldOutput.hpp (source / functions) Hit Total Coverage
Commit: Quinoa_v0.3-957-gb4f0efae0 Lines: 14 14 100.0 %
Date: 2021-11-11 13:17:06 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 26 32 81.2 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/Inciter/FieldOutput.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     Extract field output for inciter
       9                 :            :   \details   Extract field output for inciter.
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : #ifndef FieldOutput_h
      13                 :            : #define FieldOutput_h
      14                 :            : 
      15                 :            : #include "Types.hpp"
      16                 :            : #include "Fields.hpp"
      17                 :            : #include "Centering.hpp"
      18                 :            : #include "ContainerUtil.hpp"
      19                 :            : #include "Inciter/InputDeck/InputDeck.hpp"
      20                 :            : 
      21                 :            : namespace inciter {
      22                 :            : 
      23                 :            : extern ctr::InputDeck g_inputdeck;
      24                 :            : 
      25                 :            : //! Collect field output names from numerical solution based on user input
      26                 :            : std::vector< std::string >
      27                 :            : numericFieldNames( tk::Centering c );
      28                 :            : 
      29                 :            : //! Collect field output from numerical solution based on user input
      30                 :            : std::vector< std::vector< tk::real > >
      31                 :            : numericFieldOutput( const tk::Fields& U, tk::Centering c,
      32                 :            :                     const tk::Fields& P = tk::Fields() );
      33                 :            : 
      34                 :            : //! Collect field output names from analytic solutions based on user input
      35                 :            : //! \tparam PDE Partial differential equation type
      36                 :            : //! \param[in] eq PDE whose analytic solution field names to query
      37                 :            : //! \param[in] c Extract variables only with this centering
      38                 :            : //! \param[in,out] f Output field names augmented
      39                 :            : template< class PDE >
      40                 :            : void
      41                 :       9147 : analyticFieldNames( const PDE& eq,
      42                 :            :                     tk::Centering c,
      43                 :            :                     std::vector< std::string >& f )
      44                 :            : {
      45         [ +  + ]:      49008 :   for (const auto& v : g_inputdeck.get< tag::cmd, tag::io, tag::outvar >())
      46 [ +  + ][ +  + ]:      39861 :     if (v.centering == c && v.analytic())
                 [ +  + ]
      47 [ +  - ][ +  - ]:       5533 :       tk::concat( eq.analyticFieldNames(), f );
      48                 :       9147 : }
      49                 :            : 
      50                 :            : //! Collect field output from analytic solutions based on user input
      51                 :            : //! \tparam PDE Partial differential equation type
      52                 :            : //! \param[in] eq PDE whose analytic solution to output
      53                 :            : //! \param[in] c Extract variables only with this centering
      54                 :            : //! \param[in] x x coordinates at which to evaluate the analytic solution
      55                 :            : //! \param[in] y y coordinates at which to evaluate the analytic solution
      56                 :            : //! \param[in] z z coordinates at which to evaluate the analytic solution
      57                 :            : //! \param[in] t Physical time at which to evaluate the analytic solution
      58                 :            : //! \param[in,out] f Output fields augmented by analytic solutions requested
      59                 :            : template< class PDE >
      60                 :            : void
      61                 :       9147 : analyticFieldOutput( const PDE& eq,
      62                 :            :                      tk::Centering c,
      63                 :            :                      const std::vector< tk::real >& x,
      64                 :            :                      const std::vector< tk::real >& y,
      65                 :            :                      const std::vector< tk::real >& z,
      66                 :            :                      tk::real t,
      67                 :            :                      std::vector< std::vector< tk::real > >& f )
      68                 :            : {
      69         [ +  + ]:      49008 :   for (const auto& v : g_inputdeck.get< tag::cmd, tag::io, tag::outvar >()) {
      70 [ +  + ][ +  + ]:      39861 :     if (v.centering == c && v.analytic()) {
                 [ +  + ]
      71         [ +  - ]:       5533 :       auto ncomp = eq.analyticSolution( x[0], y[0], z[0], t ).size();
      72 [ +  - ][ +  - ]:       5533 :       f.resize( f.size() + ncomp, std::vector< tk::real >( x.size() ) );
      73         [ +  + ]:    1873292 :       for (std::size_t i=0; i<x.size(); ++i) {
      74         [ +  - ]:    3735518 :         auto s = eq.analyticSolution( x[i], y[i], z[i], t );
      75         [ +  + ]:    6312022 :         for (std::size_t j=0; j<ncomp; ++j) f[f.size()-ncomp+j][i] = s[j];
      76                 :            :       }
      77                 :            :     }
      78                 :            :   }
      79                 :       9147 : }
      80                 :            : 
      81                 :            : } // inciter::
      82                 :            : 
      83                 :            : #endif // FieldOutput_h

Generated by: LCOV version 1.14