Quinoa all test code coverage report
Current view: top level - Main - InciterDriver.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 26 28 92.9 %
Date: 2024-11-22 09:12:55 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 37 110 33.6 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/Main/InciterDriver.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 driver
       9                 :            :   \details   Inciter driver.
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : 
      13                 :            : #include "InciterPrint.hpp"
      14                 :            : #include "InciterDriver.hpp"
      15                 :            : #include "Inciter/InputDeck/LuaParser.hpp"
      16                 :            : #include "Inciter/CmdLine/CmdLine.hpp"
      17                 :            : #include "Inciter/InputDeck/InputDeck.hpp"
      18                 :            : #include "TaggedTupleDeepPrint.hpp"
      19                 :            : #include "Writer.hpp"
      20                 :            : 
      21                 :            : #include "NoWarning/transporter.decl.h"
      22                 :            : 
      23                 :            : namespace inciter {
      24                 :            : 
      25                 :            : extern ctr::InputDeck g_inputdeck;
      26                 :            : extern ctr::InputDeck g_inputdeck_defaults;
      27                 :            : 
      28                 :            : } // inciter::
      29                 :            : 
      30                 :            : using inciter::InciterDriver;
      31                 :            : 
      32                 :        189 : InciterDriver::InciterDriver( const ctr::CmdLine& cmdline, int nrestart )
      33                 :            : // *****************************************************************************
      34                 :            : //  Constructor
      35                 :            : //! \param[in] cmdline Command line object storing data parsed from the command
      36                 :            : //!   line arguments
      37                 :            : //! \param[in] nrestart Number of times restarted
      38                 :            : // *****************************************************************************
      39                 :            : {
      40                 :            :   // All global-scope data to be migrated to all PEs initialized here (if any)
      41                 :            : 
      42                 :            :   // Create pretty printer
      43                 :            :   const auto& def =
      44                 :            :     g_inputdeck_defaults.get< tag::cmd, tag::io, tag::screen >();
      45                 :        189 :   InciterPrint print( cmdline.logname( def, nrestart ),
      46                 :        189 :                       cmdline.get< tag::verbose >() ? std::cout : std::clog,
      47         [ -  + ]:        189 :                       std::ios_base::app );
      48                 :            : 
      49 [ +  - ][ +  - ]:        378 :   print.item( "Non-blocking migration, -" + *kw::nonblocking::alias(),
         [ +  - ][ -  - ]
      50 [ +  - ][ +  - ]:        378 :                cmdline.get< tag::nonblocking >() ? "on" : "off" );
      51 [ +  - ][ +  - ]:        378 :   print.item( "Benchmark mode, -" + *kw::benchmark::alias(),
         [ +  - ][ -  - ]
      52 [ +  + ][ +  - ]:        306 :                cmdline.get< tag::benchmark >() ? "on" : "off" );
      53                 :            : 
      54                 :        189 :   auto lbfreq = cmdline.get< tag::lbfreq >();
      55         [ -  + ]:        189 :   if ( lbfreq < kw::lbfreq::info::expect::lower ||
      56                 :            :        lbfreq > kw::lbfreq::info::expect::upper ) {
      57 [ -  - ][ -  - ]:          0 :     Throw( "Load-balancing frequency should be greater than 0." );
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
      58                 :            :   }
      59 [ +  - ][ +  - ]:        567 :   print.item( "Load-balancing frequency, -" + *kw::lbfreq::alias(),
         [ +  - ][ +  - ]
         [ -  + ][ -  - ]
                 [ -  - ]
      60                 :        189 :                std::to_string(cmdline.get< tag::lbfreq >()) );
      61                 :            : 
      62                 :        189 :   auto rsfreq = cmdline.get< tag::rsfreq >();
      63         [ -  + ]:        189 :   if ( rsfreq < kw::rsfreq::info::expect::lower ||
      64                 :            :        rsfreq > kw::rsfreq::info::expect::upper ) {
      65 [ -  - ][ -  - ]:          0 :     Throw( "Checkpoint/restart frequency should be greater than 0." );
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
      66                 :            :   }
      67 [ +  - ][ +  - ]:        567 :   print.item( "Checkpoint/restart frequency, -" + *kw::rsfreq::alias(),
         [ +  - ][ +  - ]
         [ -  + ][ -  - ]
                 [ -  - ]
      68         [ +  - ]:        189 :                std::to_string(cmdline.get< tag::rsfreq >()) );
      69                 :            : 
      70                 :            :   // Parse input deck into g_inputdeck
      71 [ +  - ][ +  - ]:        378 :   print.item( "Control file", cmdline.get< tag::io, tag::control >() );
                 [ +  - ]
      72                 :            :   g_inputdeck = g_inputdeck_defaults;   // overwrite with defaults if restarted
      73                 :            : 
      74         [ +  - ]:        189 :   LuaParser luaparser( print, cmdline, g_inputdeck );
      75 [ +  - ][ +  - ]:        378 :   print.item( "Parsed lua file", "success" );
                 [ +  - ]
      76                 :            : 
      77                 :            :   print.endpart();
      78                 :            : 
      79                 :            :   // Output command line object to file
      80 [ +  - ][ +  - ]:        189 :   auto logfilename = tk::inciter_executable() + "_input.log";
                 [ -  - ]
      81         [ +  - ]:        189 :   tk::Writer log( logfilename );
      82 [ +  - ][ +  - ]:        378 :   tk::print( log.stream(), "inputdeck", g_inputdeck );
      83                 :        189 : }
      84                 :            : 
      85                 :            : void
      86                 :        187 : InciterDriver::execute() const
      87                 :            : // *****************************************************************************
      88                 :            : //  Run inciter
      89                 :            : // *****************************************************************************
      90                 :            : {
      91                 :            :   // Instantiate Transporter chare on PE 0 which drives time-integration
      92                 :        187 :   CProxy_Transporter::ckNew( 0 );
      93                 :        187 : }

Generated by: LCOV version 1.14