Quinoa all test code coverage report
Current view: top level - Main - InciterPrint.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 15 15 100.0 %
Date: 2024-04-29 14:42:33 Functions: 10 10 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 10 20 50.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/Main/InciterPrint.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     Inciter-specific pretty printer functionality
       9                 :            :   \details   Inciter-specific pretty printer functionality.
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : #ifndef InciterPrint_h
      13                 :            : #define InciterPrint_h
      14                 :            : 
      15                 :            : #include <iostream>
      16                 :            : #include <string>
      17                 :            : 
      18                 :            : #include "NoWarning/format.hpp"
      19                 :            : 
      20                 :            : #include "Print.hpp"
      21                 :            : #include "ContainerUtil.hpp"
      22                 :            : #include "Inciter/InputDeck/InputDeck.hpp"
      23                 :            : #include "Inciter/Options/Physics.hpp"
      24                 :            : #include "Inciter/Options/Problem.hpp"
      25                 :            : 
      26                 :            : namespace inciter {
      27                 :            : 
      28                 :            : extern ctr::InputDeck g_inputdeck_defaults;
      29                 :            : extern ctr::InputDeck g_inputdeck;
      30                 :            : 
      31                 :            : //! InciterPrint : tk::Print
      32                 :       1661 : class InciterPrint : public tk::Print {
      33                 :            : 
      34                 :            :   public:
      35                 :            :     //! Constructor
      36                 :            :     //! \param[in] screen Screen output filename
      37                 :            :     //! \param[in,out] str Verbose stream
      38                 :            :     //! \param[in] mode Open mode for screen output file, see
      39                 :            :     //!   http://en.cppreference.com/w/cpp/io/ios_base/openmode
      40                 :            :     //! \param[in,out] qstr Quiet stream
      41                 :            :     //! \see tk::RNGPrint::RNGPrint and tk::Print::Print
      42                 :            :     explicit InciterPrint( const std::string& screen,
      43                 :            :                            std::ostream& str = std::clog,
      44                 :            :                            std::ios_base::openmode mode = std::ios_base::out,
      45                 :        195 :                            std::ostream& qstr = std::cout ) :
      46         [ +  - ]:       1661 :       Print( screen, str, mode, qstr ) {}
      47                 :            : 
      48                 :            :     //! Print control option: 'group : option'
      49                 :            :     template< typename Option, typename... tags >
      50                 :        549 :     void Item() const {
      51                 :        549 :       Option opt;
      52         [ +  - ]:        549 :       m_stream << m_item_name_value_fmt
      53         [ +  - ]:        549 :                   % m_item_indent % opt.group()
      54                 :        549 :                   % opt.name( g_inputdeck.get< tags... >() );
      55                 :        549 :     }
      56                 :            : 
      57                 :            :     // Helper class for compact output of PDE policies
      58                 :            :     class Policies {
      59                 :            :       public:
      60                 :            :         // Default constructor
      61                 :            :         explicit Policies() : phys(), prob() {}
      62                 :            :         // Initializer constructor
      63                 :            :         explicit Policies( const std::string& p, const std::string& t ) :
      64                 :            :           phys(p), prob(t) {}
      65                 :            :         // Operator += for adding up two Policies structs
      66                 :            :         Policies& operator+= ( const Policies& p ) {
      67                 :            :           phys += p.phys;
      68                 :            :           prob += p.prob;
      69                 :            :           return *this;
      70                 :            :         }
      71                 :            : 
      72                 :            :       private:
      73                 :            :         // Make all policies unique
      74                 :            :         void unique() { tk::unique( phys ); tk::unique( prob ); }
      75                 :            : 
      76                 :            :         std::string phys;
      77                 :            :         std::string prob;
      78                 :            :     };
      79                 :            : 
      80                 :            :     //! Print equation list with policies
      81                 :            :     //! \param[in] t Section title
      82                 :            :     //! \param[in] factory Factory to get equation data from
      83                 :            :     //! \param[in] ntypes Unique equation types
      84                 :            :     template< class Factory >
      85         [ +  - ]:        585 :     void eqlist( const std::string& t,
      86                 :            :                  const Factory& factory,
      87                 :            :                  std::size_t ntypes ) const
      88                 :            :     {
      89         [ +  - ]:        585 :       if (!factory.empty()) {
      90                 :        585 :         section( t );
      91 [ +  - ][ +  - ]:       1170 :         item( "Unique equation types", ntypes );
                 [ +  - ]
      92 [ +  - ][ +  - ]:       1170 :         item( "With all policy combinations", factory.size() );
      93                 :            :       }
      94                 :        585 :     }
      95                 :            : 
      96                 :            :     //! Print configuration of a stack of partial differential equations
      97                 :            :     void pdes( const std::string& t,
      98                 :            :       const std::vector< std::vector< std::pair< std::string, std::string > > >&
      99                 :            :         info ) const;
     100                 :            : 
     101                 :            :     //! Print out info on solver coupling
     102                 :            :     void couple( const std::vector< Transfer >& transfer,
     103                 :            :                  const std::vector< char >& depvar ) const;
     104                 :            : 
     105                 :            :     //! Print time integration header
     106                 :            :     void inthead( const std::string& t, const std::string& name,
     107                 :            :                   const std::string& legend, const std::string& head ) const;
     108                 :            : 
     109                 :            :   private:
     110                 :            :     //! Return partial differential equation name
     111                 :            :     //! \param[in] key Equation key
     112                 :            :     //! \return Partial differential equation name based on key
     113                 :            :     template< class Key >
     114                 :            :     std::string PDEName ( const Key& key ) const
     115                 :            :     { return ctr::PDE().name( key.template get< tag::pde >() ); }
     116                 :            : };
     117                 :            : 
     118                 :            : } // inciter::
     119                 :            : 
     120                 :            : #endif // InciterPrint_h

Generated by: LCOV version 1.14