Quinoa all test code coverage report
Current view: top level - Main - InciterPrint.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 17 38 44.7 %
Date: 2024-04-29 14:42:33 Functions: 2 3 66.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 23 128 18.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/Main/InciterPrint.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     Inciter-specific pretty printer functionality
       9                 :            :   \details   Inciter-specific pretty printer functionality.
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : 
      13                 :            : #include <regex>
      14                 :            : 
      15                 :            : #include <brigand/algorithms/for_each.hpp>
      16                 :            : 
      17                 :            : #include "CGPDE.hpp"
      18                 :            : #include "InciterPrint.hpp"
      19                 :            : #include "Transfer.hpp"
      20                 :            : 
      21                 :            : using inciter::InciterPrint;
      22                 :            : 
      23                 :            : namespace inciter {
      24                 :            : 
      25                 :            : extern std::vector< CGPDE > g_cgpde;
      26                 :            : 
      27                 :            : } // inciter::
      28                 :            : 
      29                 :            : void
      30                 :        195 : InciterPrint::inthead( const std::string& t,
      31                 :            :                        const std::string& name,
      32                 :            :                        const std::string& legend,
      33                 :            :                        const std::string& head ) const
      34                 :            : // *****************************************************************************
      35                 :            : //  Print time integration header
      36                 :            : //! \param[in] t Section title
      37                 :            : //! \param[in] name Section name
      38                 :            : //! \param[in] legend Legend to print
      39                 :            : //! \param[in] head Head to append
      40                 :            : // *****************************************************************************
      41                 :            : {
      42                 :        195 :   section( t, name );
      43                 :            :   std::string l( legend );
      44 [ +  - ][ +  - ]:        390 :   l = std::regex_replace( l, std::regex("\n"), "\n" + m_item_indent );
         [ +  - ][ -  + ]
                 [ -  - ]
      45 [ +  - ][ +  - ]:        390 :   raw( m_item_indent + l + head );
         [ -  + ][ +  - ]
         [ -  - ][ -  - ]
      46                 :        195 : }
      47                 :            : 
      48                 :            : void
      49         [ +  - ]:        195 : InciterPrint::pdes( const std::string& t, const std::vector< std::vector<
      50                 :            :   std::pair< std::string, std::string > > >& info ) const
      51                 :            : // *****************************************************************************
      52                 :            : //  Print configuration of a stack of partial differential equations
      53                 :            : //! \param[in] t Title to use
      54                 :            : //! \param[in] info Info vector to use
      55                 :            : // *****************************************************************************
      56                 :            : {
      57         [ +  - ]:        195 :   if ( !info.empty() ) {
      58                 :        390 :     std::stringstream ss;
      59 [ +  - ][ +  - ]:        195 :     ss << t << " (" << g_cgpde.size() << ")";
      60 [ +  - ][ +  - ]:        390 :     section( ss.str() );
      61         [ +  + ]:        390 :     for (std::size_t e=0; e<info.size(); ++e) {
      62         [ +  - ]:        195 :       subsection( info[e][0].first );
      63         [ +  + ]:       1250 :       for (std::size_t l=1; l<info[e].size(); ++l)
      64         [ +  - ]:       1055 :         m_stream << m_item_name_value_fmt % m_item_indent
      65 [ +  - ][ +  - ]:       2110 :                     % info[e][l].first % info[e][l].second;
      66         [ -  + ]:        195 :       if (e < info.size()-1) endsubsection();
      67                 :            :     }
      68                 :            :   }
      69                 :        195 : }
      70                 :            : 
      71                 :            : void
      72         [ -  - ]:          0 : InciterPrint::couple( const std::vector< Transfer >& transfer,
      73                 :            :                       const std::vector< char >& depvar ) const
      74                 :            : // *****************************************************************************
      75                 :            : //  Print out info on solver coupling
      76                 :            : //! \param[in] transfer List of solution transfer steps, describing coupling
      77                 :            : //! \param[in] depvar List of dependent variables assigned to solvers
      78                 :            : // *****************************************************************************
      79                 :            : {
      80         [ -  - ]:          0 :   if (!transfer.empty()) {
      81                 :            : 
      82                 :            :     endsubsection();
      83 [ -  - ][ -  - ]:          0 :     subsection( "Solver coupling" );
      84                 :          0 :     std::stringstream steps;
      85                 :            :     std::map< char, std::vector< char > > src, dst;
      86                 :            : 
      87         [ -  - ]:          0 :     for (const auto& t : transfer) {
      88         [ -  - ]:          0 :       auto sd = depvar[t.src];
      89         [ -  - ]:          0 :       auto dd = depvar[t.dst];
      90 [ -  - ][ -  - ]:          0 :       steps << sd << '>' << dd << ' ';
                 [ -  - ]
      91 [ -  - ][ -  - ]:          0 :       src[ sd ].push_back( dd );
      92 [ -  - ][ -  - ]:          0 :       dst[ dd ].push_back( sd );
      93                 :            :     }
      94                 :            : 
      95 [ -  - ][ -  - ]:          0 :     item( "Transfer steps (" + std::to_string(transfer.size()) + ')',
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
      96                 :          0 :           steps.str() );
      97                 :            : 
      98         [ -  - ]:          0 :     for (const auto& [s,m] : src) {
      99         [ -  - ]:          0 :       std::stringstream name;
     100 [ -  - ][ -  - ]:          0 :       name << "Solver " << s << " is source to";
     101 [ -  - ][ -  - ]:          0 :       item( name.str(), tk::parameters(m) );
         [ -  - ][ -  - ]
     102                 :            :     }
     103                 :            : 
     104         [ -  - ]:          0 :     for (const auto& [d,m] : dst) {
     105         [ -  - ]:          0 :       std::stringstream name;
     106 [ -  - ][ -  - ]:          0 :       name << "Solver " << d << " is destination to";
     107 [ -  - ][ -  - ]:          0 :       item( name.str(), tk::parameters(m) );
         [ -  - ][ -  - ]
     108                 :            :     }
     109                 :            : 
     110                 :            :   }
     111                 :          0 : }

Generated by: LCOV version 1.14