Quinoa all test code coverage report
Current view: top level - Control/Inciter/InputDeck - LuaParser.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 524 588 89.1 %
Date: 2024-04-29 14:59:56 Functions: 5 5 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1077 2426 44.4 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/Control/Inciter/InputDeck/LuaParser.cpp
       4                 :            :   \copyright 2019-2021 Triad National Security, LLC.
       5                 :            :              All rights reserved. See the LICENSE file for details.
       6                 :            :   \brief     Inciter's lua input deck file parser
       7                 :            :   \details   This file defines the input deck, i.e., control file, parser for
       8                 :            :     the computational shock hydrodynamics tool, Inciter.
       9                 :            : */
      10                 :            : // *****************************************************************************
      11                 :            : 
      12                 :            : #include <ostream>
      13                 :            : #include <type_traits>
      14                 :            : 
      15                 :            : #include "QuinoaConfig.hpp"
      16                 :            : 
      17                 :            : #include "NoWarning/pegtl.hpp"
      18                 :            : 
      19                 :            : #include "Print.hpp"
      20                 :            : #include "Exception.hpp"
      21                 :            : #include "Inciter/InputDeck/InputDeck.hpp"
      22                 :            : #include "Inciter/InputDeck/LuaParser.hpp"
      23                 :            : #include "PDE/MultiMat/MultiMatIndexing.hpp"
      24                 :            : 
      25                 :            : namespace tk {
      26                 :            : namespace grm {
      27                 :            : 
      28                 :            :   //! \brief Case-insensitive character comparison functor
      29                 :            :   struct CaseInsensitiveCharLess {
      30                 :            :     //! Function call operator
      31                 :            :     //! \param[in] lhs Left character of the comparitor operand
      32                 :            :     //! \param[in] rhs Right character of the comparitor operand
      33                 :            :     //! \return Boolean indicating the result of the comparison
      34                 :          6 :     bool operator() ( char lhs, char rhs ) const {
      35                 :          6 :       return std::tolower( lhs ) < std::tolower( rhs );
      36                 :            :     }
      37                 :            :   };
      38                 :            : 
      39                 :            :   //! \brief Parser-lifetime storage for dependent variables selected.
      40                 :            :   //! \details Used to track the dependent variable of differential equations
      41                 :            :   //!   (i.e., models) assigned during parsing. It needs to be case insensitive
      42                 :            :   //!   since we only care about whether the variable is selected or not and not
      43                 :            :   //!   whether it denotes a full variable (upper case) or a fluctuation (lower
      44                 :            :   //!   case). This is true for both inserting variables into the set as well as
      45                 :            :   //!   at matching terms of products in parsing requested statistics.
      46                 :            :   static std::set< char, CaseInsensitiveCharLess > depvars;
      47                 :            : 
      48                 :            : } // grm::
      49                 :            : } // tk::
      50                 :            : 
      51                 :            : using inciter::LuaParser;
      52                 :            : 
      53                 :        195 : LuaParser::LuaParser( const tk::Print& /*print*/,
      54                 :            :                       const ctr::CmdLine& cmdline,
      55                 :        195 :                       ctr::InputDeck& inputdeck ) :
      56                 :        195 :   m_filename( cmdline.get< tag::io, tag::control >() )
      57                 :            : // *****************************************************************************
      58                 :            : //  Constructor
      59                 :            : // //! \param[in] print Pretty printer
      60                 :            : //! \param[in] cmdline Command line stack
      61                 :            : //! \param[in,out] inputdeck Input deck stack where data is stored during
      62                 :            : //!    parsing
      63                 :            : // *****************************************************************************
      64                 :            : {
      65                 :            :   // Make sure there is a filename
      66 [ -  + ][ -  - ]:        195 :   Assert( !m_filename.empty(), "No filename specified" );
         [ -  - ][ -  - ]
      67                 :            : 
      68                 :            :   // Local file stream handle
      69         [ +  - ]:        390 :   std::ifstream q;
      70                 :            : 
      71                 :            :   // Check if file exists, throw exception if it does not
      72         [ +  - ]:        195 :   q.open( m_filename, std::ifstream::in );
      73 [ +  - ][ -  + ]:        195 :   ErrChk( q.good(), "Failed to open file: " + m_filename );
         [ -  - ][ -  - ]
                 [ -  - ]
      74                 :            : 
      75                 :            :   // Attempt to read a character, throw if it fails
      76                 :            :   // It is curious that on some systems opening a directory instead of a file
      77                 :            :   // with the above ifstream::open() call does not set the failbit. Thus we get
      78                 :            :   // here fine, so we try to read a character from it. If it is a directory or
      79                 :            :   // an empty file the read will fail, so we throw. Read more at: http://
      80                 :            :   // stackoverflow.com/questions/9591036/
      81                 :            :   // ifstream-open-doesnt-set-error-bits-when-argument-is-a-directory.
      82         [ +  - ]:        195 :   q.get();
      83 [ +  - ][ -  + ]:        195 :   ErrChk( q.good(), "Failed to read from file: " + m_filename );
         [ -  - ][ -  - ]
                 [ -  - ]
      84                 :            : 
      85                 :            :   // Close it
      86         [ +  - ]:        195 :   q.close();
      87 [ +  - ][ -  + ]:        195 :   ErrChk( !q.fail(), "Failed to close file: " + m_filename );
         [ -  - ][ -  - ]
                 [ -  - ]
      88                 :            : 
      89                 :            :   // Create InputDeck (a tagged tuple) to store parsed input
      90         [ +  - ]:        390 :   ctr::InputDeck ideck( cmdline );
      91                 :            : 
      92                 :            :   // Read lua file into sol object
      93         [ +  - ]:        390 :   sol::state lua_deck;
      94         [ +  - ]:        195 :   lua_deck.open_libraries(sol::lib::base);
      95         [ +  - ]:        195 :   lua_deck.script_file(m_filename);
      96                 :            : 
      97                 :            :   // Store inputdeck parameters from sol object into tagged tuple
      98 [ +  - ][ +  - ]:        195 :   storeInputDeck(lua_deck["inciter"], ideck);
                 [ +  - ]
      99                 :            : 
     100                 :        195 :   inputdeck = std::move( ideck );
     101                 :        195 : }
     102                 :            : 
     103                 :            : void
     104                 :        195 : LuaParser::storeInputDeck(
     105                 :            :   const sol::table& lua_ideck,
     106                 :            :   ctr::InputDeck& gideck )
     107                 :            : // *****************************************************************************
     108                 :            : //  Store lua inputdeck in custom struct
     109                 :            : //! \param[in] lua_ideck Lua inputdeck parsed by sol2
     110                 :            : //! \param[in,out] gideck Inciter's inputdeck storage
     111                 :            : // *****************************************************************************
     112                 :            : {
     113                 :            :   // TODO: explore replacing storeIfSpecd() and storeOptIfSpecd with sol::get_or()
     114                 :            : 
     115 [ +  - ][ +  - ]:        195 :   storeIfSpecd< std::string >(
                 [ +  - ]
     116                 :            :     lua_ideck, "title", gideck.get< tag::title >(), "No title");
     117                 :            : 
     118                 :            :   // time stepping options
     119                 :            :   // ---------------------------------------------------------------------------
     120 [ +  - ][ +  - ]:        195 :   storeIfSpecd< uint64_t >(
     121                 :            :     lua_ideck, "nstep", gideck.get< tag::nstep >(),
     122                 :            :     std::numeric_limits< uint64_t >::max());
     123 [ +  - ][ +  - ]:        195 :   storeIfSpecd< tk::real >(
     124                 :            :     lua_ideck, "term", gideck.get< tag::term >(),
     125                 :            :     std::numeric_limits< tk::real >::max());
     126 [ +  - ][ +  - ]:        195 :   storeIfSpecd< tk::real >(
     127                 :            :     lua_ideck, "t0", gideck.get< tag::t0 >(), 0.0);
     128 [ +  - ][ +  - ]:        195 :   storeIfSpecd< tk::real >(
     129                 :            :     lua_ideck, "dt", gideck.get< tag::dt >(), 0.0);
     130 [ +  - ][ +  - ]:        195 :   storeIfSpecd< tk::real >(
     131                 :            :     lua_ideck, "cfl", gideck.get< tag::cfl >(), 0.0);
     132 [ +  - ][ +  - ]:        195 :   storeIfSpecd< uint32_t >(
     133                 :            :     lua_ideck, "ttyi", gideck.get< tag::ttyi >(), 1);
     134 [ +  - ][ +  - ]:        195 :   storeIfSpecd< bool >(
     135                 :            :     lua_ideck, "steady_state", gideck.get< tag::steady_state >(), false);
     136 [ +  - ][ +  - ]:        195 :   storeIfSpecd< tk::real >(
     137                 :            :     lua_ideck, "residual", gideck.get< tag::residual >(), 1.0e-8);
     138 [ +  - ][ +  - ]:        195 :   storeIfSpecd< uint32_t >(
     139                 :            :     lua_ideck, "rescomp", gideck.get< tag::rescomp >(), 1);
     140                 :            : 
     141 [ +  + ][ -  + ]:        195 :   if (gideck.get< tag::dt >() < 1e-12 && gideck.get< tag::cfl >() < 1e-12)
                 [ -  + ]
     142 [ -  - ][ -  - ]:          0 :     Throw("No time step calculation policy has been selected in the "
                 [ -  - ]
     143                 :            :       "preceeding block. Use keyword 'dt' to set a constant or 'cfl' to set an "
     144                 :            :       "adaptive time step size calculation policy.");
     145                 :            : 
     146                 :            :   // partitioning/reordering options
     147                 :            :   // ---------------------------------------------------------------------------
     148                 :            :   storeOptIfSpecd< tk::ctr::PartitioningAlgorithmType,
     149 [ +  - ][ +  - ]:        195 :     tk::ctr::PartitioningAlgorithm >(
     150                 :            :     lua_ideck, "partitioning", gideck.get< tag::partitioning >(),
     151                 :            :     tk::ctr::PartitioningAlgorithmType::RCB);
     152 [ +  - ][ +  - ]:        195 :   storeIfSpecd< bool >(
     153                 :            :     lua_ideck, "pelocal_reorder", gideck.get< tag::pelocal_reorder >(),
     154                 :            :     false);
     155 [ +  - ][ +  - ]:        195 :   storeIfSpecd< bool >(
     156                 :            :     lua_ideck, "operator_reorder", gideck.get< tag::operator_reorder >(),
     157                 :            :     false);
     158                 :            : 
     159                 :            :   // discretization scheme options
     160                 :            :   // ---------------------------------------------------------------------------
     161                 :            :   using inciter::ctr::SchemeType;
     162 [ +  - ][ +  - ]:        195 :   storeOptIfSpecd< SchemeType, inciter::ctr::Scheme >(
     163                 :            :     lua_ideck, "scheme", gideck.get< tag::scheme >(), SchemeType::ALECG);
     164 [ +  - ][ +  - ]:        195 :   storeOptIfSpecd< inciter::ctr::LimiterType, inciter::ctr::Limiter >(
     165                 :            :     lua_ideck, "limiter", gideck.get< tag::limiter >(),
     166                 :            :     inciter::ctr::LimiterType::NOLIMITER);
     167 [ +  - ][ +  - ]:        195 :   storeIfSpecd< tk::real >(
     168                 :            :     lua_ideck, "cweight", gideck.get< tag::cweight >(), 1.0);
     169 [ +  - ][ +  - ]:        195 :   storeIfSpecd< tk::real >(
     170                 :            :     lua_ideck, "shock_detector_coeff",
     171                 :            :     gideck.get< tag::shock_detector_coeff >(), 1.0);
     172 [ +  - ][ +  - ]:        195 :   storeIfSpecd< bool >(
     173                 :            :     lua_ideck, "accuracy_test", gideck.get< tag::accuracy_test >(), false);
     174 [ +  - ][ +  - ]:        195 :   storeIfSpecd< bool >(
     175                 :            :     lua_ideck, "limsol_projection", gideck.get< tag::limsol_projection >(),
     176                 :            :     true);
     177                 :            : 
     178                 :            :   // configure solutions DOFs
     179                 :        195 :   auto scheme = gideck.get< tag::scheme >();
     180                 :        195 :   auto& ndof = gideck.get< tag::ndof >();
     181                 :        195 :   auto& rdof = gideck.get< tag::rdof >();
     182                 :        195 :   ndof = rdof = 1;
     183 [ +  + ][ +  + ]:        195 :   if (scheme == SchemeType::P0P1 || scheme == SchemeType::FV) {
     184                 :         30 :     ndof = 1; rdof = 4;
     185         [ +  + ]:        165 :   } else if (scheme == SchemeType::DGP1) {
     186                 :         17 :     ndof = rdof = 4;
     187         [ +  + ]:        148 :   } else if (scheme == SchemeType::DGP2) {
     188                 :          8 :     ndof = rdof = 10;
     189         [ +  + ]:        140 :   } else if (scheme == SchemeType::PDG) {
     190                 :         12 :     ndof = rdof = 10;
     191                 :         12 :     gideck.get< tag::pref, tag::pref >() = true;
     192 [ +  + ][ +  + ]:        128 :   } else if (scheme != SchemeType::DG &&
     193         [ -  + ]:         21 :       scheme != SchemeType::ALECG &&
     194                 :            :       scheme != SchemeType::OversetFE) {
     195 [ -  - ][ -  - ]:          0 :     Throw("Scheme type not configured in configure_scheme");
                 [ -  - ]
     196                 :            :   }
     197                 :            : 
     198                 :            :   // PDE options
     199                 :            :   // ---------------------------------------------------------------------------
     200                 :            : 
     201                 :        195 :   char depvar_cnt = 'a';
     202         [ +  - ]:        195 :   gideck.get< tag::depvar >().resize(1);
     203                 :            : 
     204                 :            :   // check transport
     205 [ +  - ][ +  - ]:        195 :   if (lua_ideck["transport"].valid()) {
                 [ +  + ]
     206                 :            : 
     207 [ +  - ][ +  - ]:         95 :     checkBlock< inciter::ctr::transportList::Keys >(lua_ideck["transport"],
         [ +  - ][ +  - ]
     208                 :            :       "transport");
     209                 :            : 
     210                 :         95 :     gideck.get< tag::pde >() = inciter::ctr::PDEType::TRANSPORT;
     211 [ +  - ][ +  - ]:         95 :     storeIfSpecd< std::size_t >(
         [ +  - ][ +  - ]
     212                 :            :       lua_ideck["transport"], "ncomp",
     213                 :            :       gideck.get< tag::transport, tag::ncomp >(), 1);
     214 [ +  - ][ +  - ]:         95 :     storeIfSpecd< int >(
         [ +  - ][ +  - ]
     215                 :            :       lua_ideck["transport"], "intsharp",
     216                 :            :       gideck.get< tag::transport, tag::intsharp >(), 0);
     217 [ +  - ][ +  - ]:         95 :     storeIfSpecd< tk::real >(
         [ +  - ][ +  - ]
     218                 :            :       lua_ideck["transport"], "intsharp_param",
     219                 :            :       gideck.get< tag::transport, tag::intsharp_param >(), 1.8);
     220 [ +  - ][ +  - ]:         95 :     storeOptIfSpecd< inciter::ctr::ProblemType, inciter::ctr::Problem >(
         [ +  - ][ +  - ]
     221                 :            :       lua_ideck["transport"], "problem",
     222                 :            :       gideck.get< tag::transport, tag::problem >(),
     223                 :            :       inciter::ctr::ProblemType::USER_DEFINED);
     224 [ +  - ][ +  - ]:         95 :     storeVecIfSpecd< tk::real >(
         [ +  - ][ +  - ]
                 [ +  - ]
     225                 :            :       lua_ideck["transport"], "diffusivity",
     226                 :            :       gideck.get< tag::transport, tag::diffusivity >(), {0.0, 0.0, 0.0});
     227 [ +  - ][ +  - ]:         95 :     storeVecIfSpecd< tk::real >(
         [ +  - ][ +  - ]
                 [ +  - ]
     228                 :            :       lua_ideck["transport"], "u0",
     229                 :            :       gideck.get< tag::transport, tag::u0 >(), {0.0, 0.0, 0.0});
     230 [ +  - ][ +  - ]:         95 :     storeVecIfSpecd< tk::real >(
         [ +  - ][ +  - ]
                 [ +  - ]
     231                 :            :       lua_ideck["transport"], "lambda",
     232                 :            :       gideck.get< tag::transport, tag::lambda >(), {0.0, 0.0, 0.0});
     233                 :         95 :     gideck.get< tag::depvar >()[0] = 'c';
     234 [ +  - ][ +  - ]:         95 :     storeOptIfSpecd< inciter::ctr::FluxType, inciter::ctr::Flux >(
     235                 :            :       lua_ideck, "flux", gideck.get< tag::flux >(),
     236                 :            :       inciter::ctr::FluxType::UPWIND);
     237 [ +  - ][ +  - ]:         95 :     storeOptIfSpecd< inciter::ctr::PhysicsType, inciter::ctr::Physics >(
         [ +  - ][ +  - ]
     238                 :            :       lua_ideck["transport"], "physics",
     239                 :            :       gideck.get< tag::transport, tag::physics >(),
     240                 :            :       inciter::ctr::PhysicsType::ADVECTION);
     241                 :            : 
     242                 :            :     // store number of equations in PDE system
     243                 :         95 :     gideck.get< tag::ncomp >() =
     244                 :         95 :       gideck.get< tag::transport, tag::ncomp >();
     245                 :            :   }
     246                 :            : 
     247                 :            :   // check compflow
     248 [ +  - ][ +  - ]:        195 :   if (lua_ideck["compflow"].valid()) {
                 [ +  + ]
     249                 :            : 
     250 [ +  - ][ +  - ]:         65 :     checkBlock< inciter::ctr::compflowList::Keys >(lua_ideck["compflow"],
         [ +  - ][ +  - ]
     251                 :            :       "compflow");
     252                 :            : 
     253                 :         65 :     gideck.get< tag::pde >() = inciter::ctr::PDEType::COMPFLOW;
     254 [ +  - ][ +  - ]:         65 :     storeOptIfSpecd< inciter::ctr::ProblemType, inciter::ctr::Problem >(
         [ +  - ][ +  - ]
     255                 :            :       lua_ideck["compflow"], "problem",
     256                 :            :       gideck.get< tag::compflow, tag::problem >(),
     257                 :            :       inciter::ctr::ProblemType::USER_DEFINED);
     258 [ +  - ][ +  - ]:         65 :     storeOptIfSpecd< inciter::ctr::PhysicsType, inciter::ctr::Physics >(
         [ +  - ][ +  - ]
     259                 :            :       lua_ideck["compflow"], "physics",
     260                 :            :       gideck.get< tag::compflow, tag::physics >(),
     261                 :            :       inciter::ctr::PhysicsType::EULER);
     262                 :            : 
     263                 :            :     // problem parameters for MMS
     264 [ +  - ][ +  - ]:         65 :     storeIfSpecd< tk::real >(lua_ideck["compflow"], "alpha",
         [ +  - ][ +  - ]
     265                 :            :       gideck.get< tag::compflow, tag::alpha >(), 0.0);
     266 [ +  - ][ +  - ]:         65 :     storeIfSpecd< tk::real >(lua_ideck["compflow"], "beta",
         [ +  - ][ +  - ]
     267                 :            :       gideck.get< tag::compflow, tag::beta >(), 0.0);
     268 [ +  - ][ +  - ]:         65 :     storeIfSpecd< tk::real >(lua_ideck["compflow"], "betax",
         [ +  - ][ +  - ]
     269                 :            :       gideck.get< tag::compflow, tag::betax >(), 0.0);
     270 [ +  - ][ +  - ]:         65 :     storeIfSpecd< tk::real >(lua_ideck["compflow"], "betay",
         [ +  - ][ +  - ]
     271                 :            :       gideck.get< tag::compflow, tag::betay >(), 0.0);
     272 [ +  - ][ +  - ]:         65 :     storeIfSpecd< tk::real >(lua_ideck["compflow"], "betaz",
         [ +  - ][ +  - ]
     273                 :            :       gideck.get< tag::compflow, tag::betaz >(), 0.0);
     274 [ +  - ][ +  - ]:         65 :     storeIfSpecd< tk::real >(lua_ideck["compflow"], "r0",
         [ +  - ][ +  - ]
     275                 :            :       gideck.get< tag::compflow, tag::r0 >(), 0.0);
     276 [ +  - ][ +  - ]:         65 :     storeIfSpecd< tk::real >(lua_ideck["compflow"], "p0",
         [ +  - ][ +  - ]
     277                 :            :       gideck.get< tag::compflow, tag::p0 >(), 0.0);
     278 [ +  - ][ +  - ]:         65 :     storeIfSpecd< tk::real >(lua_ideck["compflow"], "ce",
         [ +  - ][ +  - ]
     279                 :            :       gideck.get< tag::compflow, tag::ce >(), 0.0);
     280 [ +  - ][ +  - ]:         65 :     storeIfSpecd< tk::real >(lua_ideck["compflow"], "kappa",
         [ +  - ][ +  - ]
     281                 :            :       gideck.get< tag::compflow, tag::kappa >(), 0.0);
     282                 :            : 
     283                 :         65 :     gideck.get< tag::depvar >()[0] = 'a';
     284 [ +  - ][ +  - ]:         65 :     storeOptIfSpecd< inciter::ctr::FluxType, inciter::ctr::Flux >(
     285                 :            :       lua_ideck, "flux", gideck.get< tag::flux >(),
     286                 :            :       inciter::ctr::FluxType::HLLC);
     287                 :            : 
     288                 :            :     // store number of equations in PDE system
     289                 :         65 :     gideck.get< tag::ncomp >() = 5;
     290                 :            :   }
     291                 :            : 
     292                 :            :   // check multimat
     293 [ +  - ][ +  - ]:        195 :   if (lua_ideck["multimat"].valid()) {
                 [ +  + ]
     294                 :            : 
     295 [ +  - ][ +  - ]:         35 :     checkBlock< inciter::ctr::multimatList::Keys >(lua_ideck["multimat"],
         [ +  - ][ +  - ]
     296                 :            :       "multimat");
     297                 :            : 
     298                 :         35 :     gideck.get< tag::pde >() = inciter::ctr::PDEType::MULTIMAT;
     299 [ +  - ][ +  - ]:         35 :     storeIfSpecd< std::size_t >(
         [ +  - ][ +  - ]
     300                 :            :       lua_ideck["multimat"], "nmat",
     301                 :            :       gideck.get< tag::multimat, tag::nmat >(), 2);
     302 [ +  - ][ +  - ]:         35 :     storeIfSpecd< uint64_t >(
         [ +  - ][ +  - ]
     303                 :            :       lua_ideck["multimat"], "prelax",
     304                 :            :       gideck.get< tag::multimat, tag::prelax >(), 1);
     305 [ +  - ][ +  - ]:         35 :     storeIfSpecd< tk::real >(
         [ +  - ][ +  - ]
     306                 :            :       lua_ideck["multimat"], "prelax_timescale",
     307                 :            :       gideck.get< tag::multimat, tag::prelax_timescale >(), 0.25);
     308 [ +  - ][ +  - ]:         35 :     storeIfSpecd< int >(
         [ +  - ][ +  - ]
     309                 :            :       lua_ideck["multimat"], "intsharp",
     310                 :            :       gideck.get< tag::multimat, tag::intsharp >(), 0);
     311 [ +  - ][ +  - ]:         35 :     storeIfSpecd< tk::real >(
         [ +  - ][ +  - ]
     312                 :            :       lua_ideck["multimat"], "intsharp_param",
     313                 :            :       gideck.get< tag::multimat, tag::intsharp_param >(), 1.8);
     314 [ +  - ][ +  - ]:         35 :     storeOptIfSpecd< inciter::ctr::ProblemType, inciter::ctr::Problem >(
         [ +  - ][ +  - ]
     315                 :            :       lua_ideck["multimat"], "problem",
     316                 :            :       gideck.get< tag::multimat, tag::problem >(),
     317                 :            :       inciter::ctr::ProblemType::USER_DEFINED);
     318 [ +  - ][ +  - ]:         35 :     storeOptIfSpecd< inciter::ctr::PhysicsType, inciter::ctr::Physics >(
         [ +  - ][ +  - ]
     319                 :            :       lua_ideck["multimat"], "physics",
     320                 :            :       gideck.get< tag::multimat, tag::physics >(),
     321                 :            :       inciter::ctr::PhysicsType::EULER);
     322                 :         35 :     gideck.get< tag::depvar >()[0] = 'a';
     323 [ +  - ][ +  - ]:         35 :     storeOptIfSpecd< inciter::ctr::FluxType, inciter::ctr::Flux >(
     324                 :            :       lua_ideck, "flux", gideck.get< tag::flux >(),
     325                 :            :       inciter::ctr::FluxType::AUSM);
     326                 :            : 
     327                 :            :     // number of equations in PDE system are determined based on materials
     328                 :            :   }
     329                 :            : 
     330                 :            :   // add depvar to deck::depvars so it can be selected as outvar later
     331         [ +  - ]:        195 :   tk::grm::depvars.insert( gideck.get< tag::depvar >()[0] );
     332                 :            : 
     333                 :            :   // Assemble material blocks
     334                 :            :   // ---------------------------------------------------------------------------
     335                 :            : 
     336                 :            :   // solid counters
     337                 :        195 :   std::size_t tmat(0), imatcntr(0), mtypei(0), isolcntr(0);
     338                 :        195 :   bool is_solid(false);
     339                 :        390 :   std::set< std::size_t > matidset;
     340                 :            : 
     341                 :            :   // material vector
     342 [ +  - ][ +  - ]:        195 :   if (lua_ideck["material"].valid()) {
                 [ +  + ]
     343                 :            : 
     344                 :            :     // size material map vectors
     345                 :        100 :     std::size_t nmat(1);
     346         [ +  + ]:        100 :     if (gideck.get< tag::pde >() == inciter::ctr::PDEType::MULTIMAT)
     347                 :         35 :       nmat = gideck.get< tag::multimat, tag::nmat >();
     348         [ +  - ]:        100 :     gideck.get< tag::matidxmap, tag::eosidx >().resize(nmat);
     349         [ +  - ]:        100 :     gideck.get< tag::matidxmap, tag::matidx >().resize(nmat);
     350         [ +  - ]:        100 :     gideck.get< tag::matidxmap, tag::solidx >().resize(nmat);
     351                 :            : 
     352                 :            :     // size material vector appropriately
     353                 :            :     // size of the material vector is the number of distinct types of materials
     354 [ +  - ][ +  - ]:        200 :     sol::table sol_mat = lua_ideck["material"];
     355 [ +  - ][ +  - ]:        100 :     gideck.get< tag::material >().resize(sol_mat.size());
     356                 :            : 
     357                 :            :     // store material properties
     358         [ +  + ]:        201 :     for (std::size_t i=0; i<gideck.get< tag::material >().size(); ++i) {
     359                 :            : 
     360 [ +  - ][ +  - ]:        101 :       checkBlock< inciter::ctr::materialList::Keys >(sol_mat[i+1], "material");
         [ +  - ][ +  - ]
     361                 :            : 
     362                 :        101 :       auto& mati_deck = gideck.get< tag::material >()[i];
     363                 :            :       // eos
     364 [ +  - ][ +  - ]:        303 :       storeOptIfSpecd< inciter::ctr::MaterialType, inciter::ctr::Material >(
                 [ +  - ]
     365         [ +  - ]:        202 :         sol_mat[i+1], "eos", mati_deck.get< tag::eos >(),
     366                 :            :         inciter::ctr::MaterialType::STIFFENEDGAS);
     367                 :            : 
     368                 :            :       // material ids in this eos (default is for compflow i.e. single mat)
     369 [ +  - ][ +  - ]:        303 :       storeVecIfSpecd< uint64_t >(
                 [ +  - ]
     370         [ +  - ]:        202 :         sol_mat[i+1], "id", mati_deck.get< tag::id >(),
     371         [ +  - ]:        202 :         std::vector< uint64_t >(1,1));
     372                 :            : 
     373                 :            :       // Track total number of materials in multiple material blocks (eos's)
     374                 :        101 :       tmat += mati_deck.get< tag::id >().size();
     375                 :            : 
     376                 :            :       // Check for repeating user specified material ids
     377         [ +  + ]:        256 :       for (auto midx : mati_deck.get< tag::id >()) {
     378 [ +  - ][ +  - ]:        155 :         if (!matidset.count(midx))
     379         [ +  - ]:        155 :           matidset.insert(midx);
     380                 :            :         else
     381 [ -  - ][ -  - ]:          0 :           Throw("Repeating material id specified");
                 [ -  - ]
     382                 :            :       }
     383                 :            : 
     384                 :        101 :       std::size_t ntype = mati_deck.get< tag::id >().size();
     385                 :            :       // cv
     386 [ +  - ][ +  - ]:        101 :       if (!sol_mat[i+1]["cv"].valid())
         [ +  - ][ +  + ]
     387 [ +  - ][ +  - ]:         71 :         sol_mat[i+1]["cv"] = std::vector< tk::real >(ntype, 717.5);
         [ +  - ][ +  - ]
     388 [ +  - ][ +  - ]:        101 :       checkStoreMatProp(sol_mat[i+1], "cv", ntype, mati_deck.get< tag::cv >());
         [ +  - ][ +  - ]
     389                 :            : 
     390                 :            :       // reset solid-marker
     391                 :        101 :       is_solid = false;
     392                 :            : 
     393                 :            :       // Stiffened-gas materials
     394         [ +  + ]:        101 :       if (mati_deck.get< tag::eos >() ==
     395                 :            :         inciter::ctr::MaterialType::STIFFENEDGAS) {
     396                 :            :         // gamma
     397 [ +  - ][ +  - ]:         99 :         checkStoreMatProp(sol_mat[i+1], "gamma", ntype,
         [ +  - ][ +  - ]
     398                 :            :           mati_deck.get< tag::gamma >());
     399                 :            : 
     400                 :            :         // pstiff
     401 [ +  - ][ +  - ]:         99 :         if (!sol_mat[i+1]["pstiff"].valid())
         [ +  - ][ +  + ]
     402 [ +  - ][ +  - ]:         96 :           sol_mat[i+1]["pstiff"] = std::vector< tk::real >(ntype, 0.0);
         [ +  - ][ +  - ]
     403 [ +  - ][ +  - ]:         99 :         checkStoreMatProp(sol_mat[i+1], "pstiff", ntype,
         [ +  - ][ +  - ]
     404                 :            :           mati_deck.get< tag::pstiff >());
     405                 :            :       }
     406                 :            :       // Small-shear solid materials
     407         [ +  - ]:          2 :       else if (mati_deck.get< tag::eos >() ==
     408                 :            :         inciter::ctr::MaterialType::SMALLSHEARSOLID) {
     409                 :            :         // gamma
     410 [ +  - ][ +  - ]:          2 :         checkStoreMatProp(sol_mat[i+1], "gamma", ntype,
         [ +  - ][ +  - ]
     411                 :            :           mati_deck.get< tag::gamma >());
     412                 :            : 
     413                 :            :         // pstiff
     414 [ +  - ][ +  - ]:          2 :         if (!sol_mat[i+1]["pstiff"].valid())
         [ +  - ][ -  + ]
     415 [ -  - ][ -  - ]:          0 :           sol_mat[i+1]["pstiff"] = std::vector< tk::real >(ntype, 0.0);
         [ -  - ][ -  - ]
     416 [ +  - ][ +  - ]:          2 :         checkStoreMatProp(sol_mat[i+1], "pstiff", ntype,
         [ +  - ][ +  - ]
     417                 :            :           mati_deck.get< tag::pstiff >());
     418                 :            : 
     419                 :            :         // mu
     420 [ +  - ][ +  - ]:          2 :         checkStoreMatProp(sol_mat[i+1], "mu", ntype,
         [ +  - ][ +  - ]
     421                 :            :           mati_deck.get< tag::mu >());
     422                 :            : 
     423                 :            :         // rho0
     424 [ +  - ][ +  - ]:          2 :         checkStoreMatProp(sol_mat[i+1], "rho0", ntype,
         [ +  - ][ +  - ]
     425                 :            :           mati_deck.get< tag::rho0 >());
     426                 :            : 
     427                 :            :         // assign solid
     428                 :          2 :         is_solid = true;
     429                 :            :       }
     430                 :            :       // JWL materials
     431         [ -  - ]:          0 :       else if (mati_deck.get< tag::eos >() == inciter::ctr::MaterialType::JWL) {
     432                 :            :         // w_gru
     433 [ -  - ][ -  - ]:          0 :         checkStoreMatProp(sol_mat[i+1], "w_gru", ntype,
         [ -  - ][ -  - ]
     434                 :            :           mati_deck.get< tag::w_gru >());
     435                 :            : 
     436                 :            :         // a_jwl
     437 [ -  - ][ -  - ]:          0 :         checkStoreMatProp(sol_mat[i+1], "A_jwl", ntype,
         [ -  - ][ -  - ]
     438                 :            :           mati_deck.get< tag::A_jwl >());
     439                 :            : 
     440                 :            :         // b_jwl
     441 [ -  - ][ -  - ]:          0 :         checkStoreMatProp(sol_mat[i+1], "B_jwl", ntype,
         [ -  - ][ -  - ]
     442                 :            :           mati_deck.get< tag::B_jwl >());
     443                 :            : 
     444                 :            :         // R1_jwl
     445 [ -  - ][ -  - ]:          0 :         checkStoreMatProp(sol_mat[i+1], "R1_jwl", ntype,
         [ -  - ][ -  - ]
     446                 :            :           mati_deck.get< tag::R1_jwl >());
     447                 :            : 
     448                 :            :         // R2_jwl
     449 [ -  - ][ -  - ]:          0 :         checkStoreMatProp(sol_mat[i+1], "R2_jwl", ntype,
         [ -  - ][ -  - ]
     450                 :            :           mati_deck.get< tag::R2_jwl >());
     451                 :            : 
     452                 :            :         // rho0_jwl
     453 [ -  - ][ -  - ]:          0 :         checkStoreMatProp(sol_mat[i+1], "rho0_jwl", ntype,
         [ -  - ][ -  - ]
     454                 :            :           mati_deck.get< tag::rho0_jwl >());
     455                 :            : 
     456                 :            :         // de_jwl
     457 [ -  - ][ -  - ]:          0 :         checkStoreMatProp(sol_mat[i+1], "de_jwl", ntype,
         [ -  - ][ -  - ]
     458                 :            :           mati_deck.get< tag::de_jwl >());
     459                 :            : 
     460                 :            :         // Pr_jwl
     461 [ -  - ][ -  - ]:          0 :         checkStoreMatProp(sol_mat[i+1], "Pr_jwl", ntype,
         [ -  - ][ -  - ]
     462                 :            :           mati_deck.get< tag::Pr_jwl >());
     463                 :            : 
     464                 :            :         // rhor_jwl
     465 [ -  - ][ -  - ]:          0 :         if (sol_mat[i+1]["rhor_jwl"].valid()) {
         [ -  - ][ -  - ]
     466 [ -  - ][ -  - ]:          0 :           checkStoreMatProp(sol_mat[i+1], "rhor_jwl", ntype,
         [ -  - ][ -  - ]
     467                 :            :             mati_deck.get< tag::rhor_jwl >());
     468                 :            :         }
     469                 :            :         // Tr_jwl
     470 [ -  - ][ -  - ]:          0 :         else if (sol_mat[i+1]["Tr_jwl"].valid()) {
         [ -  - ][ -  - ]
     471 [ -  - ][ -  - ]:          0 :           checkStoreMatProp(sol_mat[i+1], "Tr_jwl", ntype,
         [ -  - ][ -  - ]
     472                 :            :             mati_deck.get< tag::Tr_jwl >());
     473                 :            :         }
     474                 :            :         else
     475 [ -  - ][ -  - ]:          0 :           Throw("Either reference density or reference temperature must be "
                 [ -  - ]
     476                 :            :             "specified for JWL equation of state (EOS).");
     477                 :            :       }
     478                 :            : 
     479                 :            :       // Generate mapping between material index and eos parameter index
     480                 :        101 :       auto& eosmap = gideck.get< tag::matidxmap, tag::eosidx >();
     481                 :        101 :       auto& idxmap = gideck.get< tag::matidxmap, tag::matidx >();
     482                 :        101 :       auto& solidxmap = gideck.get< tag::matidxmap, tag::solidx >();
     483         [ +  + ]:        256 :       for (auto midx : mati_deck.get< tag::id >()) {
     484                 :        155 :         midx -= 1;
     485                 :        155 :         eosmap[midx] = mtypei;
     486                 :        155 :         idxmap[midx] = imatcntr;
     487         [ +  + ]:        155 :         if (is_solid) {
     488                 :            :           // add to solid-counter
     489                 :          3 :           ++isolcntr;
     490                 :          3 :           solidxmap[midx] = isolcntr;
     491                 :            :         }
     492                 :        155 :         ++imatcntr;
     493                 :            :       }
     494                 :            :       // end of materials for this eos, thus reset index counter
     495                 :        101 :       imatcntr = 0;
     496                 :            :       // increment material-type/eos-type index counter
     497                 :        101 :       ++mtypei;
     498                 :            :     }
     499                 :            : 
     500                 :            :     // Error checking on material ids
     501                 :            :     // -------------------------------------------------------------------------
     502                 :            : 
     503                 :            :     // Total number of materials
     504         [ -  + ]:        100 :     if (tmat != nmat) 
     505 [ -  - ][ -  - ]:          0 :       Throw("The total number of materials in all the material blocks (" +
         [ -  - ][ -  - ]
                 [ -  - ]
     506                 :            :         std::to_string(tmat) +
     507                 :            :         ") is not equal to the number of materials specified 'nmat'.");
     508                 :            : 
     509                 :            :     // Contiguous and 1-based material ids
     510         [ -  + ]:        100 :     if (*matidset.begin() != 1)
     511 [ -  - ][ -  - ]:          0 :       Throw("Material ids specified in material blocks not one-based. "
                 [ -  - ]
     512                 :            :         "Material ids must begin with one.");
     513                 :        100 :     std::size_t icount(1);
     514         [ +  + ]:        255 :     for (auto midx : matidset) {
     515         [ -  + ]:        155 :       if (midx != icount)
     516 [ -  - ][ -  - ]:          0 :         Throw("Material ids specified in material blocks have a gap. "
                 [ -  - ]
     517                 :            :           "Material ids must be contiguous.");
     518                 :        155 :       ++icount;
     519                 :            :     }
     520                 :            : 
     521                 :            :     // Set up number of PDEs for multimat
     522         [ +  + ]:        100 :     if (gideck.get< tag::pde >() == inciter::ctr::PDEType::MULTIMAT) {
     523                 :         35 :       auto ntot = nmat + nmat + 3 + nmat;
     524                 :            :       // if solid EOS, add components
     525                 :         35 :       const auto& solidx = gideck.get< tag::matidxmap, tag::solidx >();
     526         [ +  + ]:        125 :       for (std::size_t i=0; i<solidx.size(); ++i) {
     527         [ +  + ]:         90 :         if (solidx[i] > 0)
     528                 :          3 :           ntot += 9;
     529                 :            :       }
     530                 :         35 :       gideck.get< tag::ncomp >() = ntot;
     531                 :            :     }
     532                 :            :   }
     533                 :            : 
     534                 :            :   // Mesh specification block (for overset)
     535                 :            :   // ---------------------------------------------------------------------------
     536 [ +  - ][ +  - ]:        195 :   if (lua_ideck["mesh"].valid()) {
                 [ +  + ]
     537 [ +  - ][ +  - ]:         24 :     const sol::table& lua_mesh = lua_ideck["mesh"];
     538                 :         12 :     auto& mesh_deck = gideck.get< tag::mesh >();
     539 [ +  - ][ +  - ]:         12 :     mesh_deck.resize(lua_mesh.size());
     540                 :            : 
     541         [ +  + ]:         26 :     for (std::size_t i=0; i<mesh_deck.size(); ++i) {
     542                 :            : 
     543 [ +  - ][ +  - ]:         14 :       checkBlock< inciter::ctr::meshList::Keys >(lua_mesh[i+1], "mesh");
         [ +  - ][ +  - ]
     544                 :            : 
     545                 :            :       // filename
     546 [ +  - ][ +  - ]:         28 :       storeIfSpecd< std::string >(lua_mesh[i+1], "filename",
         [ +  - ][ +  - ]
                 [ +  - ]
     547                 :         14 :         mesh_deck[i].get< tag::filename >(), "");
     548                 :            : 
     549                 :            :       // location
     550 [ +  - ][ +  - ]:         28 :       storeVecIfSpecd< tk::real >(lua_mesh[i+1], "location",
         [ +  - ][ +  - ]
                 [ +  - ]
     551                 :         14 :         mesh_deck[i].get< tag::location >(), {0.0, 0.0, 0.0});
     552         [ -  + ]:         14 :       if (mesh_deck[i].get< tag::location >().size() != 3)
     553 [ -  - ][ -  - ]:          0 :         Throw("Mesh location requires 3 coordinates.");
                 [ -  - ]
     554                 :            : 
     555                 :            :       // orientation
     556 [ +  - ][ +  - ]:         28 :       storeVecIfSpecd< tk::real >(lua_mesh[i+1], "orientation",
         [ +  - ][ +  - ]
                 [ +  - ]
     557                 :         14 :         mesh_deck[i].get< tag::orientation >(), {0.0, 0.0, 0.0});
     558         [ -  + ]:         14 :       if (mesh_deck[i].get< tag::orientation >().size() != 3)
     559 [ -  - ][ -  - ]:          0 :         Throw("Mesh orientation requires 3 rotation angles.");
                 [ -  - ]
     560                 :            : 
     561                 :            :       // velocity
     562 [ +  - ][ +  - ]:         28 :       storeVecIfSpecd< tk::real >(lua_mesh[i+1], "velocity",
         [ +  - ][ +  - ]
                 [ +  - ]
     563                 :         14 :         mesh_deck[i].get< tag::velocity >(), {0.0, 0.0, 0.0});
     564         [ -  + ]:         14 :       if (mesh_deck[i].get< tag::velocity >().size() != 3)
     565 [ -  - ][ -  - ]:          0 :         Throw("Mesh velocity requires 3 components.");
                 [ -  - ]
     566                 :            : 
     567                 :            :       // Transfer object
     568         [ +  + ]:         14 :       if (i > 0) {
     569         [ +  - ]:          2 :         gideck.get< tag::transfer >().emplace_back( 0, i );
     570                 :            : 
     571                 :            :         // assign depvar
     572                 :          2 :         ++depvar_cnt;
     573         [ +  - ]:          2 :         gideck.get< tag::depvar >().push_back(depvar_cnt);
     574                 :            : 
     575                 :            :         // add depvar to deck::depvars so it can be selected as outvar later
     576         [ +  - ]:          2 :         tk::grm::depvars.insert(depvar_cnt);
     577                 :            :       }
     578                 :            :     }
     579                 :            :   }
     580                 :            :   else {
     581                 :            :     // TODO: remove double-specification of defaults
     582                 :        183 :     auto& mesh_deck = gideck.get< tag::mesh >();
     583         [ +  - ]:        183 :     mesh_deck.resize(1);
     584                 :        183 :     mesh_deck[0].get< tag::filename >() =
     585         [ +  - ]:        366 :       gideck.get< tag::cmd, tag::io, tag::input >();
     586         [ +  - ]:        183 :     mesh_deck[0].get< tag::location >() = {0.0, 0.0, 0.0};
     587         [ +  - ]:        183 :     mesh_deck[0].get< tag::orientation >() = {0.0, 0.0, 0.0};
     588         [ +  - ]:        183 :     mesh_deck[0].get< tag::velocity >() = {0.0, 0.0, 0.0};
     589                 :            :   }
     590                 :            : 
     591 [ -  + ][ -  - ]:        195 :   Assert(gideck.get< tag::mesh >().size() == gideck.get< tag::depvar >().size(),
         [ -  - ][ -  - ]
     592                 :            :     "Number of depvar not equal to the number of meshes.");
     593                 :            : 
     594                 :            :   // Field output block
     595                 :            :   // ---------------------------------------------------------------------------
     596 [ +  - ][ +  - ]:        195 :   if (lua_ideck["field_output"].valid()) {
                 [ +  - ]
     597                 :            : 
     598 [ +  - ][ +  - ]:        195 :     checkBlock< inciter::ctr::fieldOutputList::Keys >(lua_ideck["field_output"],
         [ +  - ][ +  - ]
     599                 :            :       "field_output");
     600                 :            : 
     601                 :        195 :     auto& fo_deck = gideck.get< tag::field_output >();
     602                 :            : 
     603                 :            :     // interval iteration
     604 [ +  - ][ +  - ]:        195 :     storeIfSpecd< uint32_t >(
         [ +  - ][ +  - ]
     605                 :            :       lua_ideck["field_output"], "interval",
     606                 :            :       fo_deck.get< tag::interval >(),
     607                 :            :       std::numeric_limits< uint32_t >::max());
     608                 :            : 
     609                 :            :     // interval physical time
     610 [ +  - ][ +  - ]:        195 :     storeIfSpecd< tk::real >(
         [ +  - ][ +  - ]
     611                 :            :       lua_ideck["field_output"], "time_interval",
     612                 :            :       fo_deck.get< tag::time_interval >(),
     613                 :            :       std::numeric_limits< tk::real >::max());
     614                 :            : 
     615                 :            :     // interval time range
     616 [ +  - ][ +  - ]:        195 :     storeVecIfSpecd< tk::real >(
         [ +  - ][ +  - ]
     617                 :            :       lua_ideck["field_output"], "time_range",
     618                 :            :       fo_deck.get< tag::time_range >(), {});
     619                 :            : 
     620                 :            :     // refined mesh field output
     621 [ +  - ][ +  - ]:        195 :     storeIfSpecd< bool >(
         [ +  - ][ +  - ]
     622                 :            :       lua_ideck["field_output"], "refined", fo_deck.get< tag::refined >(),
     623                 :            :       false);
     624                 :        195 :     gideck.get< tag::cmd, tag::io, tag::refined >() = fo_deck.get< tag::refined >();
     625                 :            : 
     626                 :            :     // filetype
     627 [ +  - ][ +  - ]:        195 :     storeOptIfSpecd< tk::ctr::FieldFileType, tk::ctr::FieldFile >(
         [ +  - ][ +  - ]
     628                 :            :       lua_ideck["field_output"], "filetype", fo_deck.get< tag::filetype >(),
     629                 :            :       tk::ctr::FieldFileType::EXODUSII);
     630                 :            : 
     631                 :            :     // sidesets for field output
     632 [ +  - ][ +  - ]:        195 :     storeVecIfSpecd< uint64_t >(
         [ +  - ][ +  - ]
     633                 :            :       lua_ideck["field_output"], "sideset", fo_deck.get< tag::sideset >(), {});
     634                 :            : 
     635                 :            :     // Assign outvar
     636                 :        195 :     auto& foutvar = fo_deck.get< tag::outvar >();
     637                 :        195 :     std::size_t nevar(0), nnvar(0), tensorcompvar(0);
     638                 :        195 :     std::size_t nmat(1);
     639         [ +  + ]:        195 :     if (gideck.get< tag::pde >() == inciter::ctr::PDEType::MULTIMAT)
     640                 :         35 :       nmat = gideck.get< tag::multimat, tag::nmat >();
     641                 :            : 
     642                 :            :     // elem aliases
     643                 :        390 :     std::vector< std::string > elemalias;
     644 [ +  - ][ +  - ]:        195 :     if (lua_ideck["field_output"]["elemvar"].valid())
         [ +  - ][ +  + ]
     645 [ +  - ][ +  - ]:         90 :       nevar = sol::table(lua_ideck["field_output"]["elemvar"]).size();
         [ +  - ][ +  - ]
     646 [ +  - ][ +  - ]:        195 :     storeVecIfSpecd< std::string >(
         [ +  - ][ +  - ]
     647                 :            :       lua_ideck["field_output"], "elemalias", elemalias,
     648 [ +  - ][ +  - ]:        390 :       std::vector< std::string >(nevar, ""));
     649                 :            : 
     650                 :            :     // node aliases
     651                 :        390 :     std::vector< std::string > nodealias;
     652 [ +  - ][ +  - ]:        195 :     if (lua_ideck["field_output"]["nodevar"].valid())
         [ +  - ][ +  + ]
     653 [ +  - ][ +  - ]:         40 :       nnvar = sol::table(lua_ideck["field_output"]["nodevar"]).size();
         [ +  - ][ +  - ]
     654 [ +  - ][ +  - ]:        195 :     storeVecIfSpecd< std::string >(
         [ +  - ][ +  - ]
     655                 :            :       lua_ideck["field_output"], "nodealias", nodealias,
     656 [ +  - ][ +  - ]:        390 :       std::vector< std::string >(nnvar, ""));
     657                 :            : 
     658                 :            :     // error check on aliases
     659         [ -  + ]:        195 :     if (elemalias.size() != nevar)
     660 [ -  - ][ -  - ]:          0 :       Throw("elemalias should have the same size as elemvar.");
                 [ -  - ]
     661         [ -  + ]:        195 :     if (nodealias.size() != nnvar)
     662 [ -  - ][ -  - ]:          0 :       Throw("nodealias should have the same size as nodevar.");
                 [ -  - ]
     663                 :            : 
     664                 :            :     // element variables
     665 [ +  - ][ +  - ]:        195 :     if (lua_ideck["field_output"]["elemvar"].valid()) {
         [ +  - ][ +  + ]
     666         [ +  + ]:        503 :       for (std::size_t i=0; i<nevar; ++i) {
     667 [ +  - ][ +  - ]:        826 :         std::string varname(lua_ideck["field_output"]["elemvar"][i+1]);
         [ +  - ][ +  - ]
     668         [ +  - ]:        826 :         std::string alias(elemalias[i]);
     669                 :            :         // add extra outvars for tensor components
     670         [ +  + ]:        413 :         if (varname.find("_tensor") != std::string::npos) tensorcompvar += 8;
     671         [ +  - ]:        413 :         addOutVar(varname, alias, gideck.get< tag::depvar >(), nmat,
     672                 :        413 :           gideck.get< tag::pde >(), tk::Centering::ELEM, foutvar);
     673                 :            :       }
     674                 :            :     }
     675                 :            : 
     676                 :            :     // node variables
     677 [ +  - ][ +  - ]:        195 :     if (lua_ideck["field_output"]["nodevar"].valid()) {
         [ +  - ][ +  + ]
     678         [ +  + ]:        263 :       for (std::size_t i=0; i<nnvar; ++i) {
     679 [ +  - ][ +  - ]:        446 :         std::string varname(lua_ideck["field_output"]["nodevar"][i+1]);
         [ +  - ][ +  - ]
     680         [ +  - ]:        446 :         std::string alias(nodealias[i]);
     681                 :            :         // add extra outvars for tensor components
     682         [ -  + ]:        223 :         if (varname.find("_tensor") != std::string::npos) tensorcompvar += 8;
     683         [ +  - ]:        223 :         addOutVar(varname, alias, gideck.get< tag::depvar >(), nmat,
     684                 :        223 :           gideck.get< tag::pde >(), tk::Centering::NODE, foutvar);
     685                 :            :       }
     686                 :            :     }
     687                 :            : 
     688 [ -  + ][ -  - ]:        195 :     Assert(foutvar.size() == (nevar + nnvar + tensorcompvar),
         [ -  - ][ -  - ]
     689                 :            :       "Incorrectly sized outvar vector.");
     690                 :            :   }
     691                 :            :   else {
     692                 :            :     // TODO: remove double-specification of defaults
     693                 :          0 :     auto& fo_deck = gideck.get< tag::field_output >();
     694                 :          0 :     fo_deck.get< tag::interval >() =
     695                 :          0 :       std::numeric_limits< uint32_t >::max();
     696                 :          0 :     fo_deck.get< tag::time_interval >() =
     697                 :          0 :       std::numeric_limits< tk::real >::max();
     698         [ -  - ]:          0 :     fo_deck.get< tag::time_range >() = {};
     699                 :          0 :     fo_deck.get< tag::refined >() = false;
     700                 :          0 :     fo_deck.get< tag::filetype >() = tk::ctr::FieldFileType::EXODUSII;
     701         [ -  - ]:          0 :     fo_deck.get< tag::sideset >() = {};
     702                 :            :   }
     703                 :            : 
     704                 :            :   // Diagnostics output block
     705                 :            :   // ---------------------------------------------------------------------------
     706 [ +  - ][ +  - ]:        195 :   if (lua_ideck["diagnostics"].valid()) {
                 [ +  + ]
     707                 :            : 
     708 [ +  - ][ +  - ]:        106 :     checkBlock< inciter::ctr::diagnosticsList::Keys >(lua_ideck["diagnostics"],
         [ +  - ][ +  - ]
     709                 :            :       "diagnostics");
     710                 :            : 
     711                 :        106 :     auto& diag_deck = gideck.get< tag::diagnostics >();
     712                 :            : 
     713                 :            :     // interval iteration
     714 [ +  - ][ +  - ]:        106 :     storeIfSpecd< uint32_t >(
         [ +  - ][ +  - ]
     715                 :            :       lua_ideck["diagnostics"], "interval",
     716                 :            :       diag_deck.get< tag::interval >(), 1);
     717                 :            : 
     718                 :            :     // error norm
     719 [ +  - ][ +  - ]:        106 :     storeOptIfSpecd< tk::ctr::ErrorType, tk::ctr::Error >(
         [ +  - ][ +  - ]
     720                 :            :       lua_ideck["diagnostics"], "error", diag_deck.get< tag::error >(),
     721                 :            :       tk::ctr::ErrorType::L2);
     722                 :            : 
     723                 :            :     // float format
     724 [ +  - ][ +  - ]:        106 :     storeOptIfSpecd< tk::ctr::TxtFloatFormatType, tk::ctr::TxtFloatFormat >(
         [ +  - ][ +  - ]
     725                 :            :       lua_ideck["diagnostics"], "format", diag_deck.get< tag::format >(),
     726                 :            :       tk::ctr::TxtFloatFormatType::DEFAULT);
     727                 :            : 
     728                 :            :     // precision
     729 [ +  - ][ +  - ]:        106 :     storeIfSpecd< std::streamsize >(
         [ +  - ][ +  - ]
     730                 :            :       lua_ideck["diagnostics"], "precision",
     731                 :            :       diag_deck.get< tag::precision >(), std::cout.precision());
     732                 :            :   }
     733                 :            :   else {
     734                 :            :     // TODO: remove double-specification of defaults
     735                 :         89 :     auto& diag_deck = gideck.get< tag::diagnostics >();
     736                 :         89 :     diag_deck.get< tag::interval >() = 1;
     737                 :         89 :     diag_deck.get< tag::error >() = tk::ctr::ErrorType::L2;
     738                 :         89 :     diag_deck.get< tag::format >() = tk::ctr::TxtFloatFormatType::DEFAULT;
     739                 :         89 :     diag_deck.get< tag::precision >() = std::cout.precision();
     740                 :            :   }
     741                 :            : 
     742                 :            :   // History output block
     743                 :            :   // ---------------------------------------------------------------------------
     744 [ +  - ][ +  - ]:        195 :   if (lua_ideck["history_output"].valid()) {
                 [ +  + ]
     745                 :            : 
     746 [ +  - ][ +  - ]:          5 :     checkBlock< inciter::ctr::historyOutputList::Keys >(
         [ +  - ][ +  - ]
     747                 :            :       lua_ideck["history_output"], "history_output");
     748                 :            : 
     749                 :          5 :     auto& hist_deck = gideck.get< tag::history_output >();
     750                 :            : 
     751                 :            :     // interval iteration
     752 [ +  - ][ +  - ]:          5 :     storeIfSpecd< uint32_t >(
         [ +  - ][ +  - ]
     753                 :            :       lua_ideck["history_output"], "interval",
     754                 :            :       hist_deck.get< tag::interval >(),
     755                 :            :       std::numeric_limits< uint32_t >::max());
     756                 :            : 
     757                 :            :     // interval time
     758 [ +  - ][ +  - ]:          5 :     storeIfSpecd< tk::real >(
         [ +  - ][ +  - ]
     759                 :            :       lua_ideck["history_output"], "time_interval",
     760                 :            :       hist_deck.get< tag::time_interval >(),
     761                 :            :       std::numeric_limits< tk::real >::max());
     762                 :            : 
     763                 :            :     // interval time range
     764 [ +  - ][ +  - ]:          5 :     storeVecIfSpecd< tk::real >(
         [ +  - ][ +  - ]
     765                 :            :       lua_ideck["history_output"], "time_range",
     766                 :            :       hist_deck.get< tag::time_range >(), {});
     767                 :            : 
     768                 :            :     // point probes
     769 [ +  - ][ +  - ]:          5 :     if (lua_ideck["history_output"]["point"].valid()) {
         [ +  - ][ +  - ]
     770 [ +  - ][ +  - ]:         10 :       const sol::table& sol_pt = lua_ideck["history_output"]["point"];
                 [ +  - ]
     771 [ +  - ][ +  - ]:          5 :       hist_deck.get< tag::point >().resize(sol_pt.size());
     772                 :            : 
     773         [ +  + ]:         14 :       for (std::size_t i=0; i<hist_deck.get< tag::point >().size(); ++i) {
     774                 :          9 :         auto& pti = hist_deck.get< tag::point >()[i];
     775 [ +  - ][ +  - ]:         27 :         storeIfSpecd< std::string >(
         [ +  - ][ +  - ]
     776         [ +  - ]:         18 :           sol_pt[i+1], "id", pti.get< tag::id >(), "p");
     777 [ +  - ][ +  - ]:         27 :         storeVecIfSpecd< tk::real >(
                 [ +  - ]
     778         [ +  - ]:         18 :           sol_pt[i+1], "coord", pti.get< tag::coord >(), {});
     779                 :            :       }
     780                 :            :     }
     781                 :            : 
     782                 :            :     // float format
     783 [ +  - ][ +  - ]:          5 :     storeOptIfSpecd< tk::ctr::TxtFloatFormatType, tk::ctr::TxtFloatFormat >(
         [ +  - ][ +  - ]
     784                 :            :       lua_ideck["history_output"], "format", hist_deck.get< tag::format >(),
     785                 :            :       tk::ctr::TxtFloatFormatType::DEFAULT);
     786                 :            : 
     787                 :            :     // precision
     788 [ +  - ][ +  - ]:          5 :     storeIfSpecd< std::streamsize >(
         [ +  - ][ +  - ]
     789                 :            :       lua_ideck["history_output"], "precision",
     790                 :            :       hist_deck.get< tag::precision >(), std::cout.precision());
     791                 :            : 
     792                 :            :     // error check point
     793         [ +  + ]:         14 :     for (std::size_t i=0; i<hist_deck.get< tag::point >().size(); ++i) {
     794         [ -  + ]:          9 :       if (hist_deck.get< tag::point >()[i].get< tag::coord >().size() != 3)
     795 [ -  - ][ -  - ]:          0 :       Throw("Three reals required for point coordinates in history_output.");
                 [ -  - ]
     796                 :            :     }
     797                 :            :   }
     798                 :            :   else {
     799                 :            :     // TODO: remove double-specification of defaults
     800                 :        190 :     auto& hist_deck = gideck.get< tag::history_output >();
     801                 :        190 :     hist_deck.get< tag::interval >() =
     802                 :        190 :       std::numeric_limits< uint32_t >::max();
     803                 :        190 :     hist_deck.get< tag::time_interval >() =
     804                 :        190 :       std::numeric_limits< tk::real >::max();
     805         [ +  - ]:        190 :     hist_deck.get< tag::time_range >() = {};
     806                 :        190 :     hist_deck.get< tag::precision >() = std::cout.precision();
     807         [ +  - ]:        190 :     hist_deck.get< tag::point >().resize(0);
     808                 :            :   }
     809                 :            : 
     810                 :            :   // ALE block
     811                 :            :   // ---------------------------------------------------------------------------
     812                 :        195 :   gideck.get< tag::ale, tag::ale >() = false;
     813 [ +  - ][ +  - ]:        195 :   if (lua_ideck["ale"].valid()) {
                 [ +  + ]
     814                 :         10 :     auto& ale_deck = gideck.get< tag::ale >();
     815                 :         10 :     ale_deck.get< tag::ale >() = true;
     816                 :            : 
     817                 :            :     // Mesh velocity smoother
     818                 :            :     storeOptIfSpecd< inciter::ctr::MeshVelocitySmootherType,
     819 [ +  - ][ +  - ]:         10 :       inciter::ctr::MeshVelocitySmoother >(lua_ideck["ale"], "smoother",
         [ +  - ][ +  - ]
     820                 :            :       ale_deck.get< tag::smoother >(), inciter::ctr::MeshVelocitySmootherType::NONE);
     821                 :            : 
     822                 :            :     // Mesh velocity
     823                 :            :     storeOptIfSpecd< inciter::ctr::MeshVelocityType,
     824 [ +  - ][ +  - ]:         10 :       inciter::ctr::MeshVelocity >(lua_ideck["ale"], "mesh_velocity",
         [ +  - ][ +  - ]
     825                 :            :       ale_deck.get< tag::mesh_velocity >(), inciter::ctr::MeshVelocityType::SINE);
     826                 :            : 
     827                 :            :     // Mesh motion direction
     828 [ +  - ][ +  - ]:         10 :     storeVecIfSpecd< std::size_t >(lua_ideck["ale"], "mesh_motion",
         [ +  - ][ +  - ]
                 [ +  - ]
     829                 :            :       ale_deck.get< tag::mesh_motion >(), { 0, 1, 2 });
     830                 :            : 
     831                 :            :     // Mesh force
     832 [ +  - ][ +  - ]:         10 :     storeVecIfSpecd< tk::real >(lua_ideck["ale"], "meshforce",
         [ +  - ][ +  - ]
                 [ +  - ]
     833                 :            :       ale_deck.get< tag::meshforce >(), { 0, 0, 0, 0 });
     834                 :            : 
     835                 :            :     // Dirichlet
     836 [ +  - ][ +  - ]:         10 :     storeVecIfSpecd< std::size_t >(lua_ideck["ale"], "dirichlet",
         [ +  - ][ +  - ]
     837                 :            :       ale_deck.get< tag::dirichlet >(), {});
     838                 :            : 
     839                 :            :     // Symmetry
     840 [ +  - ][ +  - ]:         10 :     storeVecIfSpecd< std::size_t >(lua_ideck["ale"], "symmetry",
         [ +  - ][ +  - ]
     841                 :            :       ale_deck.get< tag::symmetry >(), {});
     842                 :            : 
     843                 :            :     // Move sidesets with user defined function
     844 [ +  - ][ +  - ]:         10 :     if (lua_ideck["ale"]["move"].valid()) {
         [ +  - ][ +  + ]
     845 [ +  - ][ +  - ]:          4 :       const sol::table& sol_mv = lua_ideck["ale"]["move"];
                 [ +  - ]
     846 [ +  - ][ +  - ]:          2 :       ale_deck.get< tag::move >().resize(sol_mv.size());
     847                 :            : 
     848         [ +  + ]:          4 :       for (std::size_t i=0; i<ale_deck.get< tag::move >().size(); ++i) {
     849                 :          2 :         auto& mvi = ale_deck.get< tag::move >()[i];
     850 [ +  - ][ +  - ]:          6 :         storeOptIfSpecd< tk::ctr::UserTableType, tk::ctr::UserTable >(
                 [ +  - ]
     851         [ +  - ]:          4 :           sol_mv[i+1], "fntype", mvi.get< tag::fntype >(),
     852                 :            :           tk::ctr::UserTableType::POSITION);
     853 [ +  - ][ +  - ]:          6 :         storeVecIfSpecd< uint64_t >(
                 [ +  - ]
     854         [ +  - ]:          4 :           sol_mv[i+1], "sideset", mvi.get< tag::sideset >(), {});
     855 [ +  - ][ +  - ]:          6 :         storeVecIfSpecd< tk::real >(
                 [ +  - ]
     856         [ +  - ]:          4 :           sol_mv[i+1], "fn", mvi.get< tag::fn >(), {});
     857                 :            : 
     858                 :            :         // error checking on user-def function
     859         [ -  + ]:          2 :         if (mvi.get< tag::fn >().size() % 4 != 0)
     860 [ -  - ][ -  - ]:          0 :           Throw("Incomplete user-defined function for ALE sideset movement. An "
                 [ -  - ]
     861                 :            :           "R->R^3 function is expected, the number of descrete entries must be "
     862                 :            :           "divisible by 4: one 'column' for the abscissa, and 3 for the "
     863                 :            :           "ordinate.");
     864                 :            :       }
     865                 :            :     }
     866                 :            : 
     867                 :            :     // dv-CFL
     868 [ +  - ][ +  - ]:         10 :     storeIfSpecd< tk::real >(lua_ideck["ale"], "dvcfl", ale_deck.get< tag::dvcfl >(),
         [ +  - ][ +  - ]
     869                 :            :       0.01);
     870                 :            : 
     871                 :            :     // Vorticity multiplier
     872 [ +  - ][ +  - ]:         10 :     storeIfSpecd< tk::real >(lua_ideck["ale"], "vortmult",
         [ +  - ][ +  - ]
     873                 :            :       ale_deck.get< tag::vortmult >(), 0.0);
     874                 :            : 
     875                 :            :     // Mesh velocity max iterations
     876 [ +  - ][ +  - ]:         10 :     storeIfSpecd< std::size_t >(lua_ideck["ale"], "maxit",
         [ +  - ][ +  - ]
     877                 :            :       ale_deck.get< tag::maxit >(), 5);
     878                 :            : 
     879                 :            :     // Mesh velocity max iterations
     880 [ +  - ][ +  - ]:         10 :     storeIfSpecd< tk::real >(lua_ideck["ale"], "tolerance",
         [ +  - ][ +  - ]
     881                 :            :       ale_deck.get< tag::tolerance >(), 1e-2);
     882                 :            :   }
     883                 :            : 
     884                 :            :   // AMR block
     885                 :            :   // ---------------------------------------------------------------------------
     886                 :        195 :   gideck.get< tag::amr, tag::amr >() = false;
     887                 :        195 :   gideck.get< tag::amr, tag::maxlevels >() = 2; // this is needed for outref
     888 [ +  - ][ +  - ]:        195 :   if (lua_ideck["amr"].valid()) {
                 [ +  + ]
     889                 :         20 :     auto& amr_deck = gideck.get< tag::amr >();
     890                 :         20 :     amr_deck.get< tag::amr >() = true;
     891                 :            : 
     892                 :            :     // Initial refinement toggle
     893 [ +  - ][ +  - ]:         20 :     storeIfSpecd< bool >(lua_ideck["amr"], "t0ref", amr_deck.get< tag::t0ref >(),
         [ +  - ][ +  - ]
     894                 :            :       false);
     895                 :            : 
     896                 :            :     // Mesh refinement during time-stepping toggle
     897 [ +  - ][ +  - ]:         20 :     storeIfSpecd< bool >(lua_ideck["amr"], "dtref", amr_deck.get< tag::dtref >(),
         [ +  - ][ +  - ]
     898                 :            :       false);
     899                 :            : 
     900                 :            :     // Uniform mesh refinement during time-stepping toggle
     901 [ +  - ][ +  - ]:         20 :     storeIfSpecd< bool >(lua_ideck["amr"], "dtref_uniform",
         [ +  - ][ +  - ]
     902                 :            :       amr_deck.get< tag::dtref_uniform >(), false);
     903                 :            : 
     904                 :            :     // Mesh refinement frequency during time-stepping toggle
     905 [ +  - ][ +  - ]:         20 :     storeIfSpecd< std::size_t >(lua_ideck["amr"], "dtfreq",
         [ +  - ][ +  - ]
     906                 :            :       amr_deck.get< tag::dtfreq >(), 3);
     907                 :            : 
     908                 :            :     // Maximum AMR levels
     909 [ +  - ][ +  - ]:         20 :     storeIfSpecd< std::size_t >(lua_ideck["amr"], "maxlevels",
         [ +  - ][ +  - ]
     910                 :            :       amr_deck.get< tag::maxlevels >(), 2);
     911                 :            : 
     912                 :            :     // Initial AMR steps
     913 [ +  - ][ +  - ]:         20 :     storeOptVecIfSpecd< inciter::ctr::AMRInitialType, inciter::ctr::AMRInitial >(
         [ +  - ][ +  - ]
     914                 :            :       lua_ideck["amr"], "initial", amr_deck.get< tag::initial >(), {});
     915                 :            : 
     916                 :            :     // Initial AMR coordinate based
     917 [ +  - ][ +  - ]:         20 :     if (lua_ideck["amr"]["coords"].valid()) {
         [ +  - ][ +  + ]
     918                 :          1 :       auto rmax = std::numeric_limits< tk::real >::max() / 100;
     919                 :            : 
     920 [ +  - ][ +  - ]:          1 :       storeIfSpecd< tk::real >(lua_ideck["amr"]["coords"], "xminus",
         [ +  - ][ +  - ]
                 [ +  - ]
     921                 :            :         amr_deck.get< tag::coords, tag::xminus >(), rmax);
     922 [ +  - ][ +  - ]:          1 :       storeIfSpecd< tk::real >(lua_ideck["amr"]["coords"], "xplus",
         [ +  - ][ +  - ]
                 [ +  - ]
     923                 :            :         amr_deck.get< tag::coords, tag::xplus >(), -rmax);
     924                 :            : 
     925 [ +  - ][ +  - ]:          1 :       storeIfSpecd< tk::real >(lua_ideck["amr"]["coords"], "yminus",
         [ +  - ][ +  - ]
                 [ +  - ]
     926                 :            :         amr_deck.get< tag::coords, tag::yminus >(), rmax);
     927 [ +  - ][ +  - ]:          1 :       storeIfSpecd< tk::real >(lua_ideck["amr"]["coords"], "yplus",
         [ +  - ][ +  - ]
                 [ +  - ]
     928                 :            :         amr_deck.get< tag::coords, tag::yplus >(), -rmax);
     929                 :            : 
     930 [ +  - ][ +  - ]:          1 :       storeIfSpecd< tk::real >(lua_ideck["amr"]["coords"], "zminus",
         [ +  - ][ +  - ]
                 [ +  - ]
     931                 :            :         amr_deck.get< tag::coords, tag::zminus >(), rmax);
     932 [ +  - ][ +  - ]:          1 :       storeIfSpecd< tk::real >(lua_ideck["amr"]["coords"], "zplus",
         [ +  - ][ +  - ]
                 [ +  - ]
     933                 :            :         amr_deck.get< tag::coords, tag::zplus >(), -rmax);
     934                 :            :     }
     935                 :            : 
     936                 :            :     // Initial AMR edgelist based
     937 [ +  - ][ +  - ]:         20 :     storeVecIfSpecd< std::size_t >(lua_ideck["amr"], "edgelist",
         [ +  - ][ +  - ]
     938                 :            :       amr_deck.get< tag::edgelist >(), {});
     939         [ -  + ]:         20 :     if (amr_deck.get< tag::edgelist >().size() % 2 != 0)
     940 [ -  - ][ -  - ]:          0 :       Throw("The number of edge-nodes, marking edges as pairs of nodes, used "
                 [ -  - ]
     941                 :            :         "for explicit tagging of edges for initial mesh refineoment, is odd "
     942                 :            :         "(it must be even).");
     943                 :            : 
     944                 :            :     // Error type for AMR
     945 [ +  - ][ +  - ]:         20 :     storeOptIfSpecd< inciter::ctr::AMRErrorType, inciter::ctr::AMRError >(
         [ +  - ][ +  - ]
     946                 :            :       lua_ideck["amr"], "error", amr_deck.get< tag::error >(),
     947                 :            :       inciter::ctr::AMRErrorType::JUMP);
     948                 :            : 
     949                 :            :     // Tolerances for refine/de-refine
     950 [ +  - ][ +  - ]:         20 :     storeIfSpecd< tk::real >(lua_ideck["amr"], "tol_refine",
         [ +  - ][ +  - ]
     951                 :            :       amr_deck.get< tag::tol_refine >(), 0.2);
     952 [ +  - ][ +  - ]:         20 :     storeIfSpecd< tk::real >(lua_ideck["amr"], "tol_derefine",
         [ +  - ][ +  - ]
     953                 :            :       amr_deck.get< tag::tol_derefine >(), 0.05);
     954                 :            :   }
     955                 :            : 
     956                 :            :   // p-refinement block
     957                 :            :   // ---------------------------------------------------------------------------
     958                 :        195 :   gideck.get< tag::pref, tag::pref >() = false;
     959 [ +  - ][ +  - ]:        195 :   if (lua_ideck["pref"].valid()) {
                 [ +  + ]
     960                 :         12 :     auto& pref_deck = gideck.get< tag::pref >();
     961                 :         12 :     pref_deck.get< tag::pref >() = true;
     962                 :            : 
     963                 :            :     // p-ref indicator type
     964                 :            :     storeOptIfSpecd< inciter::ctr::PrefIndicatorType,
     965 [ +  - ][ +  - ]:         12 :       inciter::ctr::PrefIndicator >(lua_ideck["pref"], "indicator",
         [ +  - ][ +  - ]
     966                 :            :       pref_deck.get< tag::indicator >(),
     967                 :            :       inciter::ctr::PrefIndicatorType::SPECTRAL_DECAY);
     968                 :            : 
     969                 :            :     // p-ref max degrees-of-freedom per cell
     970 [ +  - ][ +  - ]:         12 :     storeIfSpecd< std::size_t >(lua_ideck["pref"], "ndofmax",
         [ +  - ][ +  - ]
     971                 :            :       pref_deck.get< tag::ndofmax >(), 10);
     972                 :            : 
     973                 :            :     // p-ref tolerance
     974 [ +  - ][ +  - ]:         12 :     storeIfSpecd< tk::real >(lua_ideck["pref"], "tolref",
         [ +  - ][ +  - ]
     975                 :            :       pref_deck.get< tag::tolref >(), 0.5);
     976                 :            : 
     977                 :            :     // error checking on the tolerance
     978 [ +  - ][ -  + ]:         12 :     if (pref_deck.get< tag::tolref >() < 0.0 || pref_deck.get< tag::tolref >() > 1.0)
                 [ -  + ]
     979 [ -  - ][ -  - ]:          0 :       Throw("The p-refinement tolerance must be a real number "
                 [ -  - ]
     980                 :            :         "between 0.0 and 1.0, both inclusive.");
     981                 :            :   }
     982                 :            : 
     983                 :            :   // Boundary conditions block
     984                 :            :   // ---------------------------------------------------------------------------
     985 [ +  - ][ +  - ]:        195 :   if (lua_ideck["bc"].valid()) {
                 [ +  + ]
     986                 :        290 :     std::set< std::size_t > totalmesh;
     987 [ +  - ][ +  - ]:        290 :     const sol::table& sol_bc = lua_ideck["bc"];
     988                 :        145 :     auto& bc_deck = gideck.get< tag::bc >();
     989 [ +  - ][ +  - ]:        145 :     bc_deck.resize(sol_bc.size());
     990                 :            : 
     991         [ +  + ]:        292 :     for (std::size_t i=0; i<bc_deck.size(); ++i) {
     992                 :            : 
     993 [ +  - ][ +  - ]:        147 :       checkBlock< inciter::ctr::bcList::Keys >(sol_bc[i+1], "bc");
         [ +  - ][ +  - ]
     994                 :            : 
     995 [ +  - ][ +  - ]:        294 :       storeVecIfSpecd< std::size_t >(sol_bc[i+1], "mesh",
         [ +  - ][ +  - ]
                 [ +  - ]
     996                 :        147 :         bc_deck[i].get< tag::mesh >(), {1});
     997                 :            :       // collect meshes for error checking
     998         [ +  - ]:        147 :       totalmesh.insert(bc_deck[i].get< tag::mesh >().begin(),
     999                 :        147 :         bc_deck[i].get< tag::mesh >().end());
    1000                 :            : 
    1001 [ +  - ][ +  - ]:        294 :       storeVecIfSpecd< uint64_t >(sol_bc[i+1], "dirichlet",
         [ +  - ][ +  - ]
    1002                 :        147 :         bc_deck[i].get< tag::dirichlet >(), {});
    1003                 :            : 
    1004 [ +  - ][ +  - ]:        294 :       storeVecIfSpecd< uint64_t >(sol_bc[i+1], "symmetry",
         [ +  - ][ +  - ]
    1005                 :        147 :         bc_deck[i].get< tag::symmetry >(), {});
    1006                 :            : 
    1007 [ +  - ][ +  - ]:        294 :       storeVecIfSpecd< uint64_t >(sol_bc[i+1], "inlet",
         [ +  - ][ +  - ]
    1008                 :        147 :         bc_deck[i].get< tag::inlet >(), {});
    1009                 :            : 
    1010 [ +  - ][ +  - ]:        294 :       storeVecIfSpecd< uint64_t >(sol_bc[i+1], "outlet",
         [ +  - ][ +  - ]
    1011                 :        147 :         bc_deck[i].get< tag::outlet >(), {});
    1012                 :            : 
    1013 [ +  - ][ +  - ]:        294 :       storeVecIfSpecd< uint64_t >(sol_bc[i+1], "farfield",
         [ +  - ][ +  - ]
    1014                 :        147 :         bc_deck[i].get< tag::farfield >(), {});
    1015                 :            : 
    1016 [ +  - ][ +  - ]:        294 :       storeVecIfSpecd< uint64_t >(sol_bc[i+1], "extrapolate",
         [ +  - ][ +  - ]
    1017                 :        147 :         bc_deck[i].get< tag::extrapolate >(), {});
    1018                 :            : 
    1019                 :            :       // Time-dependent BC
    1020 [ +  - ][ +  - ]:        147 :       if (sol_bc[i+1]["timedep"].valid()) {
         [ +  - ][ +  + ]
    1021 [ +  - ][ +  - ]:          4 :         const sol::table& sol_tdbc = sol_bc[i+1]["timedep"];
                 [ +  - ]
    1022                 :          2 :         auto& tdbc_deck = bc_deck[i].get< tag::timedep >();
    1023 [ +  - ][ +  - ]:          2 :         tdbc_deck.resize(sol_tdbc.size());
    1024                 :            : 
    1025         [ +  + ]:          4 :         for (std::size_t j=0; j<tdbc_deck.size(); ++j) {
    1026 [ +  - ][ +  - ]:          4 :           storeVecIfSpecd< uint64_t >(sol_tdbc[j+1], "sideset",
         [ +  - ][ +  - ]
    1027                 :          2 :             tdbc_deck[j].get< tag::sideset >(), {});
    1028 [ +  - ][ +  - ]:          4 :           storeVecIfSpecd< tk::real >(sol_tdbc[j+1], "fn",
         [ +  - ][ +  - ]
    1029                 :          2 :             tdbc_deck[j].get< tag::fn >(), {});
    1030                 :            : 
    1031                 :            :           // error checking on user-def function
    1032         [ -  + ]:          2 :           if (tdbc_deck[j].get< tag::fn >().size() % 6 != 0)
    1033 [ -  - ][ -  - ]:          0 :             Throw("Incomplete user-defined function for time-dependent BC. An "
                 [ -  - ]
    1034                 :            :             "R->R^5 function is expected, the number of descrete entries must "
    1035                 :            :             "be divisible by 6: one 'column' for the abscissa, and 5 for the "
    1036                 :            :             "ordinate.");
    1037                 :            :         }
    1038                 :            :       }
    1039                 :            : 
    1040                 :            :       // Stagnation point
    1041 [ +  - ][ +  - ]:        294 :       storeVecIfSpecd< tk::real >(sol_bc[i+1], "stag_point",
         [ +  - ][ +  - ]
    1042                 :        147 :         bc_deck[i].get< tag::stag_point >(), {});
    1043 [ +  + ][ -  + ]:        148 :       if (!bc_deck[i].get< tag::stag_point >().empty() &&
    1044         [ -  + ]:          1 :         bc_deck[i].get< tag::stag_point >().size() % 3 != 0)
    1045 [ -  - ][ -  - ]:          0 :         Throw("BC stagnation point requires 3 coordinate values for each "
                 [ -  - ]
    1046                 :            :           "point. Thus, this vector must be divisible by 3.");
    1047                 :            : 
    1048                 :            :       // Stagnation radius
    1049 [ +  - ][ +  - ]:        147 :       storeIfSpecd< tk::real >(sol_bc[i+1], "radius",
         [ +  - ][ +  - ]
    1050                 :        147 :         bc_deck[i].get< tag::radius >(), 0.0);
    1051                 :            : 
    1052                 :            :       // Velocity for inlet/farfield
    1053 [ +  - ][ +  - ]:        294 :       storeVecIfSpecd< tk::real >(sol_bc[i+1], "velocity",
         [ +  - ][ +  - ]
                 [ +  - ]
    1054                 :        147 :         bc_deck[i].get< tag::velocity >(), {0.0, 0.0, 0.0});
    1055         [ -  + ]:        147 :       if (bc_deck[i].get< tag::velocity >().size() != 3)
    1056 [ -  - ][ -  - ]:          0 :         Throw("BC velocity requires 3 components.");
                 [ -  - ]
    1057                 :            : 
    1058                 :            :       // Pressure for inlet/outlet/farfield
    1059 [ +  - ][ +  - ]:        147 :       storeIfSpecd< tk::real >(sol_bc[i+1], "pressure",
         [ +  - ][ +  - ]
    1060                 :        147 :         bc_deck[i].get< tag::pressure >(), 0.0);
    1061                 :            : 
    1062                 :            :       // Density for inlet/outlet/farfield
    1063 [ +  - ][ +  - ]:        147 :       storeIfSpecd< tk::real >(sol_bc[i+1], "density",
         [ +  - ][ +  - ]
    1064                 :        147 :         bc_deck[i].get< tag::density >(), 0.0);
    1065                 :            :     }
    1066                 :            : 
    1067                 :            :     // error checking on number of meshes
    1068         [ -  + ]:        145 :     if (totalmesh.size() != gideck.get< tag::mesh >().size())
    1069 [ -  - ][ -  - ]:          0 :       Throw("Total meshes (" + std::to_string(gideck.get< tag::mesh >().size()) +
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
                 [ -  - ]
    1070                 :            :         ") not equal to the meshes on which BC's are specified (" +
    1071                 :            :         std::to_string(totalmesh.size()));
    1072                 :            : 
    1073                 :            :     // error checking on mesh ids
    1074                 :        145 :     std::size_t ic(1);
    1075         [ +  + ]:        292 :     for (const auto& im : totalmesh) {
    1076 [ -  + ][ -  - ]:        147 :       if (im != ic) Throw("Non-contiguous mesh ids in BC-mesh");
         [ -  - ][ -  - ]
    1077                 :        147 :       ++ic;
    1078                 :            :     }
    1079                 :            :   }
    1080 [ +  + ][ +  - ]:         68 :   else if (gideck.get< tag::scheme >() == inciter::ctr::SchemeType::ALECG ||
    1081         [ +  - ]:         18 :            gideck.get< tag::scheme >() == inciter::ctr::SchemeType::OversetFE)
    1082         [ +  - ]:         50 :     gideck.get< tag::bc >().resize(1);
    1083                 :            :   // error checking for unspecified BC's
    1084                 :            :   else
    1085 [ -  - ][ -  - ]:          0 :     Throw("No boundary conditions specified in input file.");
                 [ -  - ]
    1086                 :            : 
    1087                 :            :   // Initial condition block
    1088                 :            :   // ---------------------------------------------------------------------------
    1089 [ +  - ][ +  - ]:        195 :   if (lua_ideck["ic"].valid()) {
                 [ +  + ]
    1090                 :         13 :     auto& ic_deck = gideck.get< tag::ic >();
    1091                 :            : 
    1092 [ +  - ][ +  - ]:         13 :     checkBlock< inciter::ctr::icList::Keys >(lua_ideck["ic"], "ic");
         [ +  - ][ +  - ]
    1093                 :            : 
    1094                 :            :     // background IC values
    1095 [ +  - ][ +  - ]:         13 :     storeIfSpecd< std::size_t >(lua_ideck["ic"], "materialid",
         [ +  - ][ +  - ]
    1096                 :            :       ic_deck.get< tag::materialid >(), 1);
    1097                 :            : 
    1098 [ +  - ][ +  - ]:         13 :     storeIfSpecd< tk::real >(lua_ideck["ic"], "pressure",
         [ +  - ][ +  - ]
    1099                 :            :       ic_deck.get< tag::pressure >(), 0.0);
    1100                 :            : 
    1101 [ +  - ][ +  - ]:         13 :     storeIfSpecd< tk::real >(lua_ideck["ic"], "temperature",
         [ +  - ][ +  - ]
    1102                 :            :       ic_deck.get< tag::temperature >(), 0.0);
    1103                 :            : 
    1104 [ +  - ][ +  - ]:         13 :     storeIfSpecd< tk::real >(lua_ideck["ic"], "density",
         [ +  - ][ +  - ]
    1105                 :            :       ic_deck.get< tag::density >(), 0.0);
    1106                 :            : 
    1107 [ +  - ][ +  - ]:         13 :     storeIfSpecd< tk::real >(lua_ideck["ic"], "energy",
         [ +  - ][ +  - ]
    1108                 :            :       ic_deck.get< tag::energy >(), 0.0);
    1109                 :            : 
    1110 [ +  - ][ +  - ]:         13 :     storeVecIfSpecd< tk::real >(lua_ideck["ic"], "velocity",
         [ +  - ][ +  - ]
                 [ +  - ]
    1111                 :            :       ic_deck.get< tag::velocity >(), {0.0, 0.0, 0.0});
    1112         [ -  + ]:         13 :     if (ic_deck.get< tag::velocity >().size() != 3)
    1113 [ -  - ][ -  - ]:          0 :       Throw("Velocity in IC requires 3 components.");
                 [ -  - ]
    1114                 :            : 
    1115                 :            :     // IC box
    1116 [ +  - ][ +  - ]:         13 :     if (lua_ideck["ic"]["box"].valid()) {
         [ +  - ][ +  + ]
    1117 [ +  - ][ +  - ]:         10 :       const sol::table& lua_box = lua_ideck["ic"]["box"];
                 [ +  - ]
    1118                 :          5 :       auto& box_deck = ic_deck.get< tag::box >();
    1119 [ +  - ][ +  - ]:          5 :       box_deck.resize(lua_box.size());
    1120                 :            : 
    1121         [ +  + ]:         11 :       for (std::size_t i=0; i<box_deck.size(); ++i) {
    1122                 :            : 
    1123 [ +  - ][ +  - ]:          6 :         checkBlock< inciter::ctr::boxList::Keys >(lua_box[i+1], "box");
         [ +  - ][ +  - ]
    1124                 :            : 
    1125 [ +  - ][ +  - ]:          6 :         storeIfSpecd< std::size_t >(lua_box[i+1], "materialid",
         [ +  - ][ +  - ]
    1126                 :          6 :           box_deck[i].get< tag::materialid >(), 1);
    1127                 :            : 
    1128 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "volume",
         [ +  - ][ +  - ]
    1129                 :          6 :           box_deck[i].get< tag::volume >(), 0.0);
    1130                 :            : 
    1131 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "mass",
         [ +  - ][ +  - ]
    1132                 :          6 :           box_deck[i].get< tag::mass >(), 0.0);
    1133                 :            : 
    1134 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "density",
         [ +  - ][ +  - ]
    1135                 :          6 :           box_deck[i].get< tag::density >(), 0.0);
    1136                 :            : 
    1137 [ +  - ][ +  - ]:         12 :         storeVecIfSpecd< tk::real >(lua_box[i+1], "velocity",
         [ +  - ][ +  - ]
                 [ +  - ]
    1138                 :          6 :           box_deck[i].get< tag::velocity >(), {0.0, 0.0, 0.0});
    1139         [ -  + ]:          6 :         if (box_deck[i].get< tag::velocity >().size() != 3)
    1140 [ -  - ][ -  - ]:          0 :           Throw("Velocity in IC box requires 3 components.");
                 [ -  - ]
    1141                 :            : 
    1142 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "pressure",
         [ +  - ][ +  - ]
    1143                 :          6 :           box_deck[i].get< tag::pressure >(), 0.0);
    1144                 :            : 
    1145 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "energy",
         [ +  - ][ +  - ]
    1146                 :          6 :           box_deck[i].get< tag::energy >(), 0.0);
    1147                 :            : 
    1148 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "energy_content",
         [ +  - ][ +  - ]
    1149                 :          6 :           box_deck[i].get< tag::energy_content >(), 0.0);
    1150                 :            : 
    1151 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "temperature",
         [ +  - ][ +  - ]
    1152                 :          6 :           box_deck[i].get< tag::temperature >(), 0.0);
    1153                 :            : 
    1154 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "xmin",
         [ +  - ][ +  - ]
    1155                 :          6 :           box_deck[i].get< tag::xmin >(), 0.0);
    1156                 :            : 
    1157 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "xmax",
         [ +  - ][ +  - ]
    1158                 :          6 :           box_deck[i].get< tag::xmax >(), 0.0);
    1159                 :            : 
    1160 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "ymin",
         [ +  - ][ +  - ]
    1161                 :          6 :           box_deck[i].get< tag::ymin >(), 0.0);
    1162                 :            : 
    1163 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "ymax",
         [ +  - ][ +  - ]
    1164                 :          6 :           box_deck[i].get< tag::ymax >(), 0.0);
    1165                 :            : 
    1166 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "zmin",
         [ +  - ][ +  - ]
    1167                 :          6 :           box_deck[i].get< tag::zmin >(), 0.0);
    1168                 :            : 
    1169 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "zmax",
         [ +  - ][ +  - ]
    1170                 :          6 :           box_deck[i].get< tag::zmax >(), 0.0);
    1171                 :            : 
    1172 [ +  - ][ +  - ]:         12 :         storeVecIfSpecd< tk::real >(lua_box[i+1], "orientation",
         [ +  - ][ +  - ]
                 [ +  - ]
    1173                 :          6 :           box_deck[i].get< tag::orientation >(), {0.0, 0.0, 0.0});
    1174         [ -  + ]:          6 :         if (box_deck[i].get< tag::orientation >().size() != 3)
    1175 [ -  - ][ -  - ]:          0 :           Throw("Orientation in IC box requires 3 rotation angles.");
                 [ -  - ]
    1176                 :            : 
    1177 [ +  - ][ +  - ]:         18 :         storeOptIfSpecd< inciter::ctr::InitiateType, inciter::ctr::Initiate >(
                 [ +  - ]
    1178         [ +  - ]:         18 :           lua_box[i+1], "initiate", box_deck[i].get< tag::initiate >(),
    1179                 :            :           inciter::ctr::InitiateType::IMPULSE);
    1180                 :            : 
    1181 [ +  - ][ +  - ]:         12 :         storeVecIfSpecd< tk::real >(lua_box[i+1], "point",
         [ +  - ][ +  - ]
                 [ +  - ]
    1182                 :          6 :           box_deck[i].get< tag::point >(), {0.0, 0.0, 0.0});
    1183         [ -  + ]:          6 :         if (box_deck[i].get< tag::point >().size() != 3)
    1184 [ -  - ][ -  - ]:          0 :           Throw("Point in IC box requires 3 coordinates.");
                 [ -  - ]
    1185                 :            : 
    1186 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "init_time",
         [ +  - ][ +  - ]
    1187                 :          6 :           box_deck[i].get< tag::init_time >(), 0.0);
    1188                 :            : 
    1189 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "front_width",
         [ +  - ][ +  - ]
    1190                 :          6 :           box_deck[i].get< tag::front_width >(), 0.0);
    1191                 :            : 
    1192 [ +  - ][ +  - ]:          6 :         storeIfSpecd< tk::real >(lua_box[i+1], "front_speed",
         [ +  - ][ +  - ]
    1193                 :          6 :           box_deck[i].get< tag::front_speed >(), 0.0);
    1194                 :            :       }
    1195                 :            :     }
    1196                 :            : 
    1197                 :            :     // IC mesh-block
    1198 [ +  - ][ +  - ]:         13 :     if (lua_ideck["ic"]["meshblock"].valid()) {
         [ +  - ][ +  + ]
    1199 [ +  - ][ +  - ]:          2 :       const sol::table& lua_meshblock = lua_ideck["ic"]["meshblock"];
                 [ +  - ]
    1200                 :          1 :       auto& mblk_deck = ic_deck.get< tag::meshblock >();
    1201 [ +  - ][ +  - ]:          1 :       mblk_deck.resize(lua_meshblock.size());
    1202                 :            : 
    1203         [ +  + ]:          2 :       for (std::size_t i=0; i<mblk_deck.size(); ++i) {
    1204                 :            : 
    1205 [ +  - ][ +  - ]:          1 :         checkBlock< inciter::ctr::meshblockList::Keys >(lua_meshblock[i+1],
         [ +  - ][ +  - ]
    1206                 :            :           "meshblock");
    1207                 :            : 
    1208 [ +  - ][ +  - ]:          1 :         storeIfSpecd< std::size_t >(lua_meshblock[i+1], "blockid",
         [ +  - ][ +  - ]
    1209                 :          1 :           mblk_deck[i].get< tag::blockid >(), 0);
    1210         [ -  + ]:          1 :         if (mblk_deck[i].get< tag::blockid >() == 0)
    1211 [ -  - ][ -  - ]:          0 :           Throw("Each IC mesh block must specify the mesh block id.");
                 [ -  - ]
    1212                 :            : 
    1213 [ +  - ][ +  - ]:          1 :         storeIfSpecd< std::size_t >(lua_meshblock[i+1], "materialid",
         [ +  - ][ +  - ]
    1214                 :          1 :           mblk_deck[i].get< tag::materialid >(), 1);
    1215                 :            : 
    1216 [ +  - ][ +  - ]:          1 :         storeIfSpecd< tk::real >(lua_meshblock[i+1], "energy_content",
         [ +  - ][ +  - ]
    1217                 :          1 :           mblk_deck[i].get< tag::energy_content >(), 0.0);
    1218                 :            : 
    1219 [ +  - ][ +  - ]:          1 :         storeIfSpecd< tk::real >(lua_meshblock[i+1], "volume",
         [ +  - ][ +  - ]
    1220                 :          1 :           mblk_deck[i].get< tag::volume >(), 0.0);
    1221 [ +  - ][ -  + ]:          2 :         if (mblk_deck[i].get< tag::energy_content >() > 0.0 &&
    1222         [ -  + ]:          1 :           mblk_deck[i].get< tag::volume >() < 1e-12)
    1223 [ -  - ][ -  - ]:          0 :           Throw("Mesh block volume must be specified, if energy content is "
                 [ -  - ]
    1224                 :            :             "used to initialize block");
    1225                 :            : 
    1226 [ +  - ][ +  - ]:          1 :         storeIfSpecd< tk::real >(lua_meshblock[i+1], "mass",
         [ +  - ][ +  - ]
    1227                 :          1 :           mblk_deck[i].get< tag::mass >(), 0.0);
    1228                 :            : 
    1229 [ +  - ][ +  - ]:          1 :         storeIfSpecd< tk::real >(lua_meshblock[i+1], "density",
         [ +  - ][ +  - ]
    1230                 :          1 :           mblk_deck[i].get< tag::density >(), 0.0);
    1231                 :            : 
    1232 [ +  - ][ +  - ]:          2 :         storeVecIfSpecd< tk::real >(lua_meshblock[i+1], "velocity",
         [ +  - ][ +  - ]
                 [ +  - ]
    1233                 :          1 :           mblk_deck[i].get< tag::velocity >(), {0.0, 0.0, 0.0});
    1234         [ -  + ]:          1 :         if (mblk_deck[i].get< tag::velocity >().size() != 3)
    1235 [ -  - ][ -  - ]:          0 :           Throw("Velocity in IC meshblock requires 3 components.");
                 [ -  - ]
    1236                 :            : 
    1237 [ +  - ][ +  - ]:          1 :         storeIfSpecd< tk::real >(lua_meshblock[i+1], "pressure",
         [ +  - ][ +  - ]
    1238                 :          1 :           mblk_deck[i].get< tag::pressure >(), 0.0);
    1239                 :            : 
    1240 [ +  - ][ +  - ]:          1 :         storeIfSpecd< tk::real >(lua_meshblock[i+1], "energy",
         [ +  - ][ +  - ]
    1241                 :          1 :           mblk_deck[i].get< tag::energy >(), 0.0);
    1242                 :            : 
    1243 [ +  - ][ +  - ]:          1 :         storeIfSpecd< tk::real >(lua_meshblock[i+1], "temperature",
         [ +  - ][ +  - ]
    1244                 :          1 :           mblk_deck[i].get< tag::temperature >(), 0.0);
    1245                 :            : 
    1246 [ +  - ][ +  - ]:          3 :         storeOptIfSpecd< inciter::ctr::InitiateType, inciter::ctr::Initiate >(
                 [ +  - ]
    1247         [ +  - ]:          3 :           lua_meshblock[i+1], "initiate", mblk_deck[i].get< tag::initiate >(),
    1248                 :            :           inciter::ctr::InitiateType::IMPULSE);
    1249                 :            : 
    1250 [ +  - ][ +  - ]:          2 :         storeVecIfSpecd< tk::real >(lua_meshblock[i+1], "point",
         [ +  - ][ +  - ]
                 [ +  - ]
    1251                 :          1 :           mblk_deck[i].get< tag::point >(), {0.0, 0.0, 0.0});
    1252         [ -  + ]:          1 :         if (mblk_deck[i].get< tag::point >().size() != 3)
    1253 [ -  - ][ -  - ]:          0 :           Throw("Point in IC meshblock requires 3 coordinates.");
                 [ -  - ]
    1254                 :            : 
    1255 [ +  - ][ +  - ]:          1 :         storeIfSpecd< tk::real >(lua_meshblock[i+1], "init_time",
         [ +  - ][ +  - ]
    1256                 :          1 :           mblk_deck[i].get< tag::init_time >(), 0.0);
    1257                 :            : 
    1258 [ +  - ][ +  - ]:          1 :         storeIfSpecd< tk::real >(lua_meshblock[i+1], "front_width",
         [ +  - ][ +  - ]
    1259                 :          1 :           mblk_deck[i].get< tag::front_width >(), 0.0);
    1260                 :            : 
    1261 [ +  - ][ +  - ]:          1 :         storeIfSpecd< tk::real >(lua_meshblock[i+1], "front_speed",
         [ +  - ][ +  - ]
    1262                 :          1 :           mblk_deck[i].get< tag::front_speed >(), 0.0);
    1263                 :            :       }
    1264                 :            :     }
    1265                 :            :   }
    1266                 :        195 : }
    1267                 :            : 
    1268                 :            : void
    1269                 :        307 : LuaParser::checkStoreMatProp(
    1270                 :            :   const sol::table table,
    1271                 :            :   const std::string key,
    1272                 :            :   std::size_t vecsize,
    1273                 :            :   std::vector< tk::real >& storage )
    1274                 :            : // *****************************************************************************
    1275                 :            : //  Check and store material property into inpudeck storage
    1276                 :            : //! \param[in] table Sol-table which contains said property
    1277                 :            : //! \param[in] key Key for said property in Sol-table
    1278                 :            : //! \param[in] vecsize Number of said property in Sol-table (based on number of
    1279                 :            : //!   materials that are of the same eos type
    1280                 :            : //! \param[in,out] storage Storage space in inputdeck where said property is
    1281                 :            : //!   to be stored
    1282                 :            : // *****************************************************************************
    1283                 :            : {
    1284                 :            :   // check validity of table
    1285 [ +  - ][ -  + ]:        307 :   if (!table[key].valid())
    1286 [ -  - ][ -  - ]:          0 :     Throw("Material property '" + key + "' not specified");
         [ -  - ][ -  - ]
    1287 [ +  - ][ +  - ]:        307 :   if (sol::table(table[key]).size() != vecsize)
                 [ -  + ]
    1288 [ -  - ][ -  - ]:          0 :     Throw("Incorrect number of '" + key + "'s specified. Expected " +
         [ -  - ][ -  - ]
         [ -  - ][ -  - ]
    1289                 :            :       std::to_string(vecsize));
    1290                 :            : 
    1291                 :            :   // store values from table to inputdeck
    1292 [ +  - ][ +  - ]:        307 :   storeVecIfSpecd< tk::real >(table, key, storage,
    1293         [ +  - ]:        614 :     std::vector< tk::real >(vecsize, 0.0));
    1294                 :        307 : }
    1295                 :            : 
    1296                 :            : void
    1297                 :        636 : LuaParser::addOutVar(
    1298                 :            :   const std::string& varname,
    1299                 :            :   const std::string& alias,
    1300                 :            :   std::vector< char >& depv,
    1301                 :            :   std::size_t nmat,
    1302                 :            :   inciter::ctr::PDEType pde,
    1303                 :            :   tk::Centering c,
    1304                 :            :   std::vector< inciter::ctr::OutVar >& foutvar )
    1305                 :            : // *****************************************************************************
    1306                 :            : //  Check and store field output variables
    1307                 :            : //! \param[in] varname Name of variable requested
    1308                 :            : //! \param[in] alias User specified alias for output
    1309                 :            : //! \param[in] depv List of depvars
    1310                 :            : //! \param[in] nmat Number of materials configured
    1311                 :            : //! \param[in] pde Type of PDE configured
    1312                 :            : //! \param[in] c Variable centering requested
    1313                 :            : //! \param[in,out] foutvar Input deck storage where output vars are stored
    1314                 :            : // *****************************************************************************
    1315                 :            : {
    1316                 :            :   // index-based quantity specification
    1317                 :            :   // ----------------------------------
    1318         [ +  + ]:        636 :   if (varname.length() == 2) {
    1319                 :         80 :     auto qty = varname.at(0);
    1320 [ +  - ][ +  - ]:         80 :     auto j = std::stoul(std::string{varname.at(1)}) - 1;
    1321                 :            : 
    1322         [ +  + ]:         80 :     if (pde == inciter::ctr::PDEType::MULTIMAT) {
    1323                 :            :     // multimat/matvar quantities
    1324         [ -  + ]:         30 :       if (qty == 'D') {  // density
    1325                 :            :         foutvar.emplace_back(
    1326 [ -  - ][ -  - ]:          0 :           inciter::ctr::OutVar(c, varname, alias, inciter::densityIdx(nmat,j)) );
                 [ -  - ]
    1327                 :            :       }
    1328         [ +  - ]:         30 :       else if (qty == 'F') {  // volume fraction
    1329                 :            :         foutvar.emplace_back(
    1330 [ +  - ][ +  - ]:         30 :           inciter::ctr::OutVar(c, varname, alias, inciter::volfracIdx(nmat,j)) );
                 [ +  - ]
    1331                 :            :       }
    1332         [ -  - ]:          0 :       else if (qty == 'M') {  // momentum
    1333                 :            :         foutvar.emplace_back(
    1334 [ -  - ][ -  - ]:          0 :           inciter::ctr::OutVar(c, varname, alias, inciter::momentumIdx(nmat,j)) );
                 [ -  - ]
    1335                 :            :       }
    1336         [ -  - ]:          0 :       else if (qty == 'E') {  // specific total energy
    1337                 :            :         foutvar.emplace_back(
    1338 [ -  - ][ -  - ]:          0 :           inciter::ctr::OutVar(c, varname, alias, inciter::energyIdx(nmat,j)) );
                 [ -  - ]
    1339                 :            :       }
    1340         [ -  - ]:          0 :       else if (qty == 'U') {  // velocity (primitive)
    1341                 :            :         foutvar.emplace_back(
    1342 [ -  - ][ -  - ]:          0 :           inciter::ctr::OutVar(c, varname, alias, inciter::velocityIdx(nmat,j)) );
                 [ -  - ]
    1343                 :            :       }
    1344         [ -  - ]:          0 :       else if (qty == 'P') {  // material pressure (primitive)
    1345                 :            :         foutvar.emplace_back(
    1346 [ -  - ][ -  - ]:          0 :           inciter::ctr::OutVar(c, varname, alias, inciter::pressureIdx(nmat,j)) );
                 [ -  - ]
    1347                 :            :       }
    1348                 :            :       else {
    1349                 :            :         // error out if incorrect matvar used
    1350 [ -  - ][ -  - ]:          0 :         Throw("field_output: matvar " + varname + " not found");
         [ -  - ][ -  - ]
    1351                 :            :       }
    1352                 :            :     }
    1353                 :            :     else {
    1354                 :            :     // quantities specified by depvar
    1355         [ +  + ]:        120 :       for (const auto& id : depv)
    1356         [ +  + ]:         70 :         if (std::tolower(qty) == id) {
    1357 [ +  - ][ +  - ]:         50 :           foutvar.emplace_back( inciter::ctr::OutVar(c, varname, alias, j) );
                 [ +  - ]
    1358                 :            :         }
    1359                 :            :     }
    1360                 :            :   }
    1361                 :            :   // analytic quantity specification
    1362                 :            :   // -------------------------------
    1363         [ +  + ]:        556 :   else if (varname.find("analytic") != std::string::npos) {
    1364 [ +  - ][ +  - ]:         61 :     foutvar.emplace_back( inciter::ctr::OutVar(c, varname, alias, 0) );
                 [ +  - ]
    1365                 :            :   }
    1366                 :            :   // name-based tensor quantity specification
    1367                 :            :   // ----------------------------------------
    1368         [ +  + ]:        495 :   else if (varname.find("_tensor") != std::string::npos) {
    1369         [ +  - ]:          4 :     std::string namet(varname);
    1370                 :            :     // remove the "_tensor" from the varname
    1371         [ +  + ]:         16 :     for (std::size_t i=0; i<7; ++i) namet.pop_back();
    1372                 :            : 
    1373         [ +  + ]:          8 :     for (std::size_t i=1; i<=3; ++i) {
    1374         [ +  + ]:         24 :       for (std::size_t j=1; j<=3; ++j) {
    1375 [ +  - ][ +  - ]:         36 :         std::string tij(namet + std::to_string(i) + std::to_string(j));
         [ +  - ][ +  - ]
    1376 [ +  - ][ +  - ]:         18 :         foutvar.emplace_back( inciter::ctr::OutVar(c, tij, alias, 0, tij) );
    1377                 :            :       }
    1378                 :            :     }
    1379                 :            :   }
    1380                 :            :   // name-based quantity specification
    1381                 :            :   // ---------------------------------
    1382                 :            :   else {
    1383         [ +  - ]:        493 :     foutvar.emplace_back( inciter::ctr::OutVar(c, varname, alias, 0, varname) );
    1384                 :            :   }
    1385                 :        636 : }

Generated by: LCOV version 1.14