Quinoa all test code coverage report
Current view: top level - Control/MeshConv/CmdLine - CmdLine.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 13 14 92.9 %
Date: 2024-04-22 13:03:21 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 7 14 50.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/Control/MeshConv/CmdLine/CmdLine.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     MeshConv's command line definition
       9                 :            :   \details   This file defines the heterogeneous stack that is used for storing
      10                 :            :      the data from user input during the command-line parsing of the mesh
      11                 :            :      converter, MeshConv.
      12                 :            : */
      13                 :            : // *****************************************************************************
      14                 :            : #ifndef MeshConvCmdLine_h
      15                 :            : #define MeshConvCmdLine_h
      16                 :            : 
      17                 :            : #include <string>
      18                 :            : 
      19                 :            : #include <brigand/algorithms/for_each.hpp>
      20                 :            : 
      21                 :            : #include "QuinoaConfig.hpp"
      22                 :            : #include "Macro.hpp"
      23                 :            : #include "Keywords.hpp"
      24                 :            : #include "HelpFactory.hpp"
      25                 :            : #include "MeshConv/Types.hpp"
      26                 :            : 
      27                 :            : namespace meshconv {
      28                 :            : //! Mesh converter control facilitating user input to internal data transfer
      29                 :            : namespace ctr {
      30                 :            : 
      31                 :            : //! Member data for tagged tuple
      32                 :            : using CmdLineMembers = brigand::list<
      33                 :            :     tag::io,         ios
      34                 :            :   , tag::verbose,    bool
      35                 :            :   , tag::chare,      bool
      36                 :            :   , tag::reorder,    bool
      37                 :            :   , tag::help,       bool
      38                 :            :   , tag::quiescence, bool
      39                 :            :   , tag::trace,      bool
      40                 :            :   , tag::version,    bool
      41                 :            :   , tag::license,    bool
      42                 :            :   , tag::cmdinfo,    tk::ctr::HelpFactory
      43                 :            :   , tag::ctrinfo,    tk::ctr::HelpFactory
      44                 :            :   , tag::helpkw,     tk::ctr::HelpKw
      45                 :            :   , tag::error,      std::vector< std::string >
      46                 :            : >;
      47                 :            : 
      48                 :            : //! \brief CmdLine is a TaggedTuple specialized to MeshConv
      49                 :            : //! \details The stack is a tagged tuple, a hierarchical heterogeneous data
      50                 :            : //!    structure where all parsed information is stored.
      51                 :            : //! \see Base/TaggedTuple.h
      52                 :            : //! \see Control/MeshConv/Types.h
      53                 :          0 : class CmdLine : public tk::TaggedTuple< CmdLineMembers > {
      54                 :            : 
      55                 :            :   public:
      56                 :            :     //! \brief MeshConv command-line keywords
      57                 :            :     //! \see tk::grm::use and its documentation
      58                 :            :     using keywords = tk::cmd_keywords< kw::verbose
      59                 :            :                                      , kw::charestate
      60                 :            :                                      , kw::help
      61                 :            :                                      , kw::helpkw
      62                 :            :                                      , kw::input
      63                 :            :                                      , kw::output
      64                 :            :                                      , kw::screen
      65                 :            :                                      , kw::reorder_cmd
      66                 :            :                                      , kw::quiescence
      67                 :            :                                      , kw::trace
      68                 :            :                                      , kw::version
      69                 :            :                                      , kw::license
      70                 :            :                                      >;
      71                 :            : 
      72                 :            :     //! Set of tags to ignore when printing this CmdLine
      73                 :            :     using ignore =
      74                 :            :       brigand::set< tag::cmdinfo
      75                 :            :                   , tag::ctrinfo
      76                 :            :                   , tag::helpkw >;
      77                 :            : 
      78                 :            :     //! \brief Constructor: set defaults.
      79                 :            :     //! \details Anything not set here is initialized by the compiler using the
      80                 :            :     //!   default constructor for the corresponding type. While there is a
      81                 :            :     //!   ctrinfo parameter, it is unused here, since meshconv does not have a
      82                 :            :     //!   control file parser.
      83                 :            :     //! \see walker::ctr::CmdLine
      84                 :         36 :     CmdLine() {
      85                 :            :       get< tag::io, tag::screen >() =
      86 [ +  - ][ +  - ]:         72 :         tk::baselogname( tk::meshconv_executable() );
                 [ -  + ]
      87                 :         36 :       get< tag::verbose >() = false; // Use quiet output by default
      88                 :         36 :       get< tag::chare >() = false; // No chare state output by default
      89                 :         36 :       get< tag::reorder >() = false; // Do not reorder by default
      90                 :         36 :       get< tag::trace >() = true; // Output call and stack trace by default
      91                 :         36 :       get< tag::version >() = false; // Do not display version info by default
      92         [ +  - ]:         36 :       get< tag::license >() = false; // Do not display license info by default
      93                 :            :       // Initialize help: fill from own keywords
      94                 :         36 :       brigand::for_each< keywords::set >( tk::ctr::Info(get<tag::cmdinfo>()) );
      95                 :         36 :     }
      96                 :            : 
      97                 :            :     /** @name Pack/Unpack: Serialize CmdLine object for Charm++ */
      98                 :            :     ///@{
      99                 :            :     //! \brief Pack/Unpack serialize member function
     100                 :            :     //! \param[in,out] p Charm++'s PUP::er serializer object reference
     101                 :            :     void pup( PUP::er& p ) { tk::TaggedTuple< CmdLineMembers >::pup(p); }
     102                 :            :     //! \brief Pack/Unpack serialize operator|
     103                 :            :     //! \param[in,out] p Charm++'s PUP::er serializer object reference
     104                 :            :     //! \param[in,out] c CmdLine object reference
     105                 :            :     friend void operator|( PUP::er& p, CmdLine& c ) { c.pup(p); }
     106                 :            :     //@}
     107                 :            : 
     108                 :            :     //! Compute and return log file name
     109                 :            :     //! \param[in] def Default log file name (so we don't mess with user's)
     110                 :            :     //! \param[in] nrestart Number of times restarted
     111                 :            :     //! \return Log file name
     112         [ -  + ]:         72 :     std::string logname( const std::string& def, int nrestart ) const {
     113         [ -  + ]:         72 :       if (get< tag::io, tag::screen >() != def)
     114                 :            :         return get< tag::io, tag::screen >();
     115                 :            :       else
     116         [ +  - ]:        144 :         return tk::logname( tk::meshconv_executable(), nrestart );
     117                 :            :     }
     118                 :            : };
     119                 :            : 
     120                 :            : } // ctr::
     121                 :            : } // meshconv::
     122                 :            : 
     123                 :            : #endif // MeshConvCmdLine_h

Generated by: LCOV version 1.14