Xyst test code coverage report
Current view: top level - Control - InciterConfig.hpp (source / functions) Hit Total Coverage
Commit: 7512f2d92be539d3e2bf801c81cb357720d8ffd7 Lines: 136 136 100.0 %
Date: 2025-04-27 10:04:21 Functions: 136 136 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/Control/InciterConfig.hpp
       4                 :            :   \copyright 2012-2015 J. Bakosi,
       5                 :            :              2016-2018 Los Alamos National Security, LLC.,
       6                 :            :              2019-2021 Triad National Security, LLC.,
       7                 :            :              2022-2025 J. Bakosi
       8                 :            :              All rights reserved. See the LICENSE file for details.
       9                 :            :   \brief     Inciter confguration (parsed from cmdline and control file)
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : #pragma once
      13                 :            : 
      14                 :            : #include <getopt.h>
      15                 :            : 
      16                 :            : #include "TaggedTuple.hpp"
      17                 :            : 
      18                 :            : namespace tag {
      19                 :        268 : DEFTAG( commit );
      20                 :        268 : DEFTAG( input );
      21                 :        268 : DEFTAG( control );
      22                 :        268 : DEFTAG( output );
      23                 :        268 : DEFTAG( diag );
      24                 :        268 : DEFTAG( diag_iter );
      25                 :        268 : DEFTAG( diag_precision );
      26                 :        268 : DEFTAG( diag_format );
      27                 :        268 : DEFTAG( checkpoint );
      28                 :        268 : DEFTAG( quiescence );
      29                 :        268 : DEFTAG( virt );
      30                 :        268 : DEFTAG( nonblocking );
      31                 :        268 : DEFTAG( benchmark );
      32                 :        268 : DEFTAG( feedback );
      33                 :        268 : DEFTAG( lbfreq );
      34                 :        268 : DEFTAG( lbtime );
      35                 :        268 : DEFTAG( rsfreq );
      36                 :        268 : DEFTAG( nstep );
      37                 :        268 : DEFTAG( ttyi );
      38                 :        268 : DEFTAG( term );
      39                 :        268 : DEFTAG( cfl );
      40                 :        268 : DEFTAG( rk );
      41                 :        268 : DEFTAG( theta );
      42                 :        536 : DEFTAG( t0 );
      43                 :        536 : DEFTAG( dt );
      44                 :        268 : DEFTAG( turkel );
      45                 :        268 : DEFTAG( soundspeed );
      46                 :        268 : DEFTAG( velinf );
      47                 :            : DEFTAG( presure );
      48                 :        268 : DEFTAG( tol );
      49                 :        268 : DEFTAG( verbose );
      50                 :        268 : DEFTAG( hydrostat );
      51                 :        268 : DEFTAG( pc );
      52                 :        268 : DEFTAG( mom_iter );
      53                 :        268 : DEFTAG( mom_tol );
      54                 :        268 : DEFTAG( mom_verbose );
      55                 :        268 : DEFTAG( mom_pc );
      56                 :        268 : DEFTAG( reorder );
      57                 :        268 : DEFTAG( part );
      58                 :        268 : DEFTAG( part_ );
      59                 :        268 : DEFTAG( zoltan_params );
      60                 :        268 : DEFTAG( zoltan_params_ );
      61                 :        268 : DEFTAG( solver );
      62                 :        268 : DEFTAG( stab );
      63                 :        268 : DEFTAG( stab2 );
      64                 :        268 : DEFTAG( stab2coef );
      65                 :        268 : DEFTAG( fct );
      66                 :        268 : DEFTAG( fctdif );
      67                 :        268 : DEFTAG( fctclip );
      68                 :        268 : DEFTAG( fctsys );
      69                 :        268 : DEFTAG( fctfreeze );
      70                 :        268 : DEFTAG( deactivate );
      71                 :        268 : DEFTAG( deatol );
      72                 :        268 : DEFTAG( deadif );
      73                 :        268 : DEFTAG( deafreq );
      74                 :        268 : DEFTAG( deasys );
      75                 :        268 : DEFTAG( deatime );
      76                 :        268 : DEFTAG( flux );
      77                 :        268 : DEFTAG( steady );
      78                 :        268 : DEFTAG( residual );
      79                 :        268 : DEFTAG( rescomp );
      80                 :        268 : DEFTAG( problem );
      81                 :        268 : DEFTAG( problem_ncomp );
      82                 :        268 : DEFTAG( problem_alpha );
      83                 :        268 : DEFTAG( problem_kappa );
      84                 :        268 : DEFTAG( problem_beta );
      85                 :        268 : DEFTAG( problem_r0 );
      86                 :        268 : DEFTAG( problem_p0 );
      87                 :        268 : DEFTAG( problem_ce );
      88                 :        268 : DEFTAG( problem_src );
      89                 :        268 : DEFTAG( location );
      90                 :        268 : DEFTAG( radius );
      91                 :        268 : DEFTAG( release_time );
      92                 :        268 : DEFTAG( freezeflow );
      93                 :        268 : DEFTAG( freezetime );
      94                 :        268 : DEFTAG( overset );
      95                 :        268 : DEFTAG( intergrid_ );
      96                 :        268 : DEFTAG( layers_ );
      97                 :        268 : DEFTAG( sym_ );
      98                 :        268 : DEFTAG( fieldout );
      99                 :        268 : DEFTAG( fieldout_ );
     100                 :        268 : DEFTAG( histout );
     101                 :        268 : DEFTAG( histout_ );
     102                 :        268 : DEFTAG( integout );
     103                 :        268 : DEFTAG( integout_ );
     104                 :       1072 : DEFTAG( iter );
     105                 :        804 : DEFTAG( time );
     106                 :        804 : DEFTAG( range );
     107                 :       1072 : DEFTAG( sidesets );
     108                 :        268 : DEFTAG( points );
     109                 :        268 : DEFTAG( integrals );
     110                 :        536 : DEFTAG( precision );
     111                 :        536 : DEFTAG( format );
     112                 :        268 : DEFTAG( ic );
     113                 :        268 : DEFTAG( ic_ );
     114                 :        804 : DEFTAG( density );
     115                 :       1072 : DEFTAG( pressure );
     116                 :        268 : DEFTAG( pressure_ );
     117                 :        268 : DEFTAG( energy );
     118                 :        268 : DEFTAG( temperature );
     119                 :        536 : DEFTAG( velocity );
     120                 :        268 : DEFTAG( boxes );
     121                 :          6 : DEFTAG( box_x );
     122                 :          6 : DEFTAG( box_y );
     123                 :          6 : DEFTAG( box_z );
     124                 :          6 : DEFTAG( box_density );
     125                 :          6 : DEFTAG( box_pressure );
     126                 :          6 : DEFTAG( box_energy );
     127                 :          6 : DEFTAG( box_temperature );
     128                 :          6 : DEFTAG( box_velocity );
     129                 :        536 : DEFTAG( bc_dir );
     130                 :        536 : DEFTAG( bc_dirval );
     131                 :        268 : DEFTAG( bc_dir_ );
     132                 :        268 : DEFTAG( bc_dirval_ );
     133                 :        536 : DEFTAG( bc_sym );
     134                 :        268 : DEFTAG( bc_sym_ );
     135                 :        268 : DEFTAG( bc_noslip );
     136                 :        268 : DEFTAG( bc_noslip_ );
     137                 :        268 : DEFTAG( bc_far );
     138                 :        268 : DEFTAG( bc_far_ );
     139                 :        268 : DEFTAG( bc_pre );
     140                 :        268 : DEFTAG( bc_pre_ );
     141                 :        268 : DEFTAG( mat_spec_heat_ratio );
     142                 :        268 : DEFTAG( mat_spec_heat_const_vol );
     143                 :        268 : DEFTAG( mat_spec_gas_const );
     144                 :        268 : DEFTAG( mat_heat_conductivity );
     145                 :        268 : DEFTAG( mat_dyn_viscosity );
     146                 :        268 : DEFTAG( mat_dyn_diffusivity );
     147                 :        268 : DEFTAG( href );
     148                 :        268 : DEFTAG( href_ );
     149                 :        268 : DEFTAG( dtfreq );
     150                 :        268 : DEFTAG( maxlevels );
     151                 :        268 : DEFTAG( error );
     152                 :        268 : DEFTAG( init );
     153                 :        268 : DEFTAG( refvar );
     154                 :            : } // tag::
     155                 :            : 
     156                 :            : namespace inciter {
     157                 :            : //! Inciter control facilitating user input to internal data transfer
     158                 :            : namespace ctr {
     159                 :            : 
     160                 :            : //! Member data for tagged tuple
     161                 :            : using ConfigMembers = brigand::list<
     162                 :            :     tag::commit, std::string
     163                 :            :   , tag::input, std::vector< std::string >
     164                 :            :   , tag::control, std::string
     165                 :            :   , tag::output, std::string
     166                 :            :   , tag::diag, std::string
     167                 :            :   , tag::diag_iter, uint64_t
     168                 :            :   , tag::diag_precision, std::streamsize
     169                 :            :   , tag::diag_format, std::string
     170                 :            :   , tag::checkpoint, std::string
     171                 :            :   , tag::quiescence, bool
     172                 :            :   , tag::virt, std::vector< double >
     173                 :            :   , tag::nonblocking, bool
     174                 :            :   , tag::benchmark, bool
     175                 :            :   , tag::feedback, bool
     176                 :            :   , tag::lbfreq, uint64_t
     177                 :            :   , tag::lbtime, double
     178                 :            :   , tag::rsfreq, uint64_t
     179                 :            :   , tag::nstep, uint64_t
     180                 :            :   , tag::ttyi, uint64_t
     181                 :            :   , tag::term, double
     182                 :            :   , tag::cfl, double
     183                 :            :   , tag::rk, uint64_t
     184                 :            :   , tag::theta, double
     185                 :            :   , tag::t0, double
     186                 :            :   , tag::dt, double
     187                 :            :   , tag::turkel, double
     188                 :            :   , tag::soundspeed, double
     189                 :            :   , tag::velinf, std::vector< double >
     190                 :            :   , tag::pressure, tk::TaggedTuple< brigand::list<
     191                 :            :                      tag::iter,      uint64_t
     192                 :            :                    , tag::tol,       double
     193                 :            :                    , tag::verbose,   uint64_t
     194                 :            :                    , tag::hydrostat, uint64_t
     195                 :            :                    , tag::pc,        std::string
     196                 :            :                    , tag::bc_dir,    std::vector< std::vector< int > >
     197                 :            :                    , tag::bc_dirval, std::vector< std::vector< double > >
     198                 :            :                    , tag::bc_sym,    std::vector< int >
     199                 :            :                    > >
     200                 :            :   , tag::pressure_, std::vector<
     201                 :            :                       tk::TaggedTuple< brigand::list<
     202                 :            :                         tag::iter,      uint64_t
     203                 :            :                       , tag::tol,       double
     204                 :            :                       , tag::verbose,   uint64_t
     205                 :            :                       , tag::hydrostat, uint64_t
     206                 :            :                       , tag::pc,        std::string
     207                 :            :                       , tag::bc_dir,    std::vector< std::vector< int > >
     208                 :            :                       , tag::bc_dirval, std::vector< std::vector< double > >
     209                 :            :                       , tag::bc_sym,    std::vector< int >
     210                 :            :                       > >
     211                 :            :                     >
     212                 :            :   , tag::mom_iter, uint64_t
     213                 :            :   , tag::mom_tol, double
     214                 :            :   , tag::mom_verbose, uint64_t
     215                 :            :   , tag::mom_pc, std::string
     216                 :            :   , tag::reorder, bool
     217                 :            :   , tag::part, std::string
     218                 :            :   , tag::part_, std::vector< std::string >
     219                 :            :   , tag::zoltan_params, std::vector< std::string >
     220                 :            :   , tag::zoltan_params_, std::vector< std::vector< std::string > >
     221                 :            :   , tag::solver, std::string
     222                 :            :   , tag::stab, bool
     223                 :            :   , tag::stab2, bool
     224                 :            :   , tag::stab2coef, double
     225                 :            :   , tag::fct, bool
     226                 :            :   , tag::fctdif, double
     227                 :            :   , tag::fctclip, bool
     228                 :            :   , tag::fctsys, std::vector< uint64_t >
     229                 :            :   , tag::fctfreeze, double
     230                 :            :   , tag::deactivate, bool
     231                 :            :   , tag::deatol, double
     232                 :            :   , tag::deadif, double
     233                 :            :   , tag::deafreq, uint64_t
     234                 :            :   , tag::deasys, std::vector< uint64_t >
     235                 :            :   , tag::deatime, double
     236                 :            :   , tag::flux, std::string
     237                 :            :   , tag::steady, bool
     238                 :            :   , tag::residual, double
     239                 :            :   , tag::rescomp, uint64_t
     240                 :            :   , tag::problem, std::string
     241                 :            :   , tag::problem_ncomp, uint64_t
     242                 :            :   , tag::problem_alpha, double
     243                 :            :   , tag::problem_kappa, double
     244                 :            :   , tag::problem_beta, std::vector< double >
     245                 :            :   , tag::problem_r0, double
     246                 :            :   , tag::problem_p0, double
     247                 :            :   , tag::problem_ce, double
     248                 :            :   , tag::problem_src, tk::TaggedTuple< brigand::list<
     249                 :            :                         tag::location, std::vector< double >
     250                 :            :                       , tag::radius, double
     251                 :            :                       , tag::release_time, double
     252                 :            :                       > >
     253                 :            :   , tag::freezeflow, double
     254                 :            :   , tag::freezetime, double
     255                 :            :   , tag::overset, tk::TaggedTuple< brigand::list<
     256                 :            :                     tag::intergrid_, std::vector< std::vector< int > >
     257                 :            :                   , tag::layers_, std::vector< std::vector< uint64_t > >
     258                 :            :                   , tag::sym_, std::vector< std::string >
     259                 :            :                   > >
     260                 :            :   , tag::fieldout, tk::TaggedTuple< brigand::list<
     261                 :            :                      tag::sidesets, std::vector< int >
     262                 :            :                    , tag::iter,     uint64_t
     263                 :            :                    , tag::time,     double
     264                 :            :                    , tag::range,    std::vector< std::vector< double > >
     265                 :            :                    > >
     266                 :            :   , tag::fieldout_, std::vector<
     267                 :            :                       tk::TaggedTuple< brigand::list<
     268                 :            :                         tag::sidesets, std::vector< int >
     269                 :            :                       , tag::iter,     uint64_t
     270                 :            :                       , tag::time,     double
     271                 :            :                       , tag::range,    std::vector< std::vector< double > >
     272                 :            :                       > >
     273                 :            :                     >
     274                 :            :   , tag::histout, tk::TaggedTuple< brigand::list<
     275                 :            :                     tag::points,    std::vector< std::vector< double > >
     276                 :            :                   , tag::iter,      uint64_t
     277                 :            :                   , tag::time,      double
     278                 :            :                   , tag::range,     std::vector< std::vector< double > >
     279                 :            :                   , tag::precision, std::streamsize
     280                 :            :                   , tag::format,    std::string
     281                 :            :                   > >
     282                 :            :   , tag::histout_, std::vector<
     283                 :            :                      tk::TaggedTuple< brigand::list<
     284                 :            :                        tag::points,    std::vector< std::vector< double > >
     285                 :            :                      , tag::iter,      uint64_t
     286                 :            :                      , tag::time,      double
     287                 :            :                      , tag::range,     std::vector< std::vector< double > >
     288                 :            :                      , tag::precision, std::streamsize
     289                 :            :                      , tag::format,    std::string
     290                 :            :                      > >
     291                 :            :                    >
     292                 :            :   , tag::integout, tk::TaggedTuple< brigand::list<
     293                 :            :                     tag::sidesets, std::vector< int >
     294                 :            :                   , tag::integrals, std::vector< std::string >
     295                 :            :                   , tag::iter, uint64_t
     296                 :            :                   , tag::time, double
     297                 :            :                   , tag::range, std::vector< std::vector< double > >
     298                 :            :                   , tag::precision, std::streamsize
     299                 :            :                   , tag::format, std::string
     300                 :            :                   > >
     301                 :            :   , tag::integout_, std::vector<
     302                 :            :                       tk::TaggedTuple< brigand::list<
     303                 :            :                         tag::sidesets, std::vector< int >
     304                 :            :                       , tag::integrals, std::vector< std::string >
     305                 :            :                       , tag::iter, uint64_t
     306                 :            :                       , tag::time, double
     307                 :            :                       , tag::range, std::vector< std::vector< double > >
     308                 :            :                       , tag::precision, std::streamsize
     309                 :            :                       , tag::format, std::string
     310                 :            :                       > >
     311                 :            :                    >
     312                 :            :   , tag::ic, tk::TaggedTuple< brigand::list<
     313                 :            :                tag::density,     double
     314                 :            :              , tag::pressure,    double
     315                 :            :              , tag::energy,      double
     316                 :            :              , tag::temperature, double
     317                 :            :              , tag::velocity,    std::vector< double >
     318                 :            :              , tag::boxes, std::vector<
     319                 :            :                  tk::TaggedTuple< brigand::list<
     320                 :            :                      tag::box_x,           std::vector< double >
     321                 :            :                    , tag::box_y,           std::vector< double >
     322                 :            :                    , tag::box_z,           std::vector< double >
     323                 :            :                    , tag::box_density,     double
     324                 :            :                    , tag::box_pressure,    double
     325                 :            :                    , tag::box_energy,      double
     326                 :            :                    , tag::box_temperature, double
     327                 :            :                    , tag::box_velocity,    std::vector< double >
     328                 :            :                  > >
     329                 :            :                >
     330                 :            :              > >
     331                 :            :   , tag::ic_, std::vector<
     332                 :            :                 tk::TaggedTuple< brigand::list<
     333                 :            :                   tag::density,     double
     334                 :            :                 , tag::pressure,    double
     335                 :            :                 , tag::energy,      double
     336                 :            :                 , tag::temperature, double
     337                 :            :                 , tag::velocity,    std::vector< double >
     338                 :            :                 , tag::boxes, std::vector<
     339                 :            :                     tk::TaggedTuple< brigand::list<
     340                 :            :                         tag::box_x,           std::vector< double >
     341                 :            :                       , tag::box_y,           std::vector< double >
     342                 :            :                       , tag::box_z,           std::vector< double >
     343                 :            :                       , tag::box_density,     double
     344                 :            :                       , tag::box_pressure,    double
     345                 :            :                       , tag::box_energy,      double
     346                 :            :                       , tag::box_temperature, double
     347                 :            :                       , tag::box_velocity,    std::vector< double >
     348                 :            :                     > >
     349                 :            :                   >
     350                 :            :                 > >
     351                 :            :               >
     352                 :            :   , tag::bc_dir, std::vector< std::vector< int > >
     353                 :            :   , tag::bc_dirval, std::vector< std::vector< double > >
     354                 :            :   , tag::bc_dir_, std::vector< std::vector< std::vector< int > > >
     355                 :            :   , tag::bc_dirval_, std::vector< std::vector< std::vector< double > > >
     356                 :            :   , tag::bc_sym, std::vector< int >
     357                 :            :   , tag::bc_sym_, std::vector< std::vector< int > >
     358                 :            :   , tag::bc_noslip, std::vector< int >
     359                 :            :   , tag::bc_noslip_, std::vector< std::vector< int > >
     360                 :            :   , tag::bc_far, tk::TaggedTuple< brigand::list<
     361                 :            :                      tag::sidesets, std::vector< int >
     362                 :            :                    , tag::density,  double
     363                 :            :                    , tag::pressure, double
     364                 :            :                    , tag::velocity, std::vector< double >
     365                 :            :                  > >
     366                 :            :   , tag::bc_far_, std::vector<
     367                 :            :                     tk::TaggedTuple< brigand::list<
     368                 :            :                       tag::sidesets, std::vector< int >
     369                 :            :                     , tag::density,  double
     370                 :            :                     , tag::pressure, double
     371                 :            :                     , tag::velocity, std::vector< double >
     372                 :            :                     > >
     373                 :            :                   >
     374                 :            :   , tag::bc_pre, tk::TaggedTuple< brigand::list<
     375                 :            :                    tag::sidesets, std::vector< std::vector< int > >
     376                 :            :                  , tag::density,  std::vector< double >
     377                 :            :                  , tag::pressure, std::vector< double >
     378                 :            :                  > >
     379                 :            :   , tag::bc_pre_, std::vector<
     380                 :            :                     tk::TaggedTuple< brigand::list<
     381                 :            :                       tag::sidesets, std::vector< std::vector< int > >
     382                 :            :                     , tag::density,  std::vector< double >
     383                 :            :                     , tag::pressure, std::vector< double >
     384                 :            :                     > >
     385                 :            :                   >
     386                 :            :   , tag::mat_spec_heat_ratio, double
     387                 :            :   , tag::mat_spec_heat_const_vol, double
     388                 :            :   , tag::mat_spec_gas_const, double
     389                 :            :   , tag::mat_heat_conductivity, double
     390                 :            :   , tag::mat_dyn_viscosity, double
     391                 :            :   , tag::mat_dyn_diffusivity, double
     392                 :            :   , tag::href, tk::TaggedTuple< brigand::list<
     393                 :            :                    tag::t0, bool
     394                 :            :                  , tag::dt, bool
     395                 :            :                  , tag::dtfreq, uint64_t
     396                 :            :                  , tag::maxlevels, uint64_t
     397                 :            :                  , tag::refvar, std::vector< uint64_t >
     398                 :            :                  , tag::error, std::string
     399                 :            :                  , tag::init, std::vector< std::string >
     400                 :            :               > >
     401                 :            :   , tag::href_, std::vector<
     402                 :            :                   tk::TaggedTuple< brigand::list<
     403                 :            :                     tag::t0, bool
     404                 :            :                   , tag::dt, bool
     405                 :            :                   , tag::dtfreq, uint64_t
     406                 :            :                   , tag::maxlevels, uint64_t
     407                 :            :                   , tag::refvar, std::vector< uint64_t >
     408                 :            :                   , tag::error, std::string
     409                 :            :                   , tag::init, std::vector< std::string >
     410                 :            :                   > >
     411                 :            :                 >
     412                 :            : 
     413                 :            : >;
     414                 :            : 
     415                 :            : //! Config is a TaggedTuple specialized to Inciter
     416                 :            : class Config : public tk::TaggedTuple< ConfigMembers > {
     417                 :            : 
     418                 :            :   public:
     419                 :            :     //! Contructor: parse inciter command line
     420                 :            :     void cmdline( int argc, char** argv );
     421                 :            : 
     422                 :            :     //! Parse control file
     423                 :            :     void control();
     424                 :            : 
     425                 :            :     /** @name Pack/Unpack: Serialize Config object for Charm++ */
     426                 :            :     ///@{
     427                 :            :     //! \brief Pack/Unpack serialize member function
     428                 :            :     //! \param[in,out] p Charm++'s PUP::er serializer object reference
     429                 :       1258 :     void pup( PUP::er& p ) { tk::TaggedTuple< ConfigMembers >::pup(p); }
     430                 :            :     //! \brief Pack/Unpack serialize operator|
     431                 :            :     //! \param[in,out] p Charm++'s PUP::er serializer object reference
     432                 :            :     //! \param[in,out] c Config object reference
     433                 :       1258 :     friend void operator|( PUP::er& p, Config& c ) { c.pup(p); }
     434                 :            :     //@}
     435                 :            : 
     436                 :            :   private:
     437                 :            :     //! Echo help on command line arguments
     438                 :            :     void help( char** argv );
     439                 :            : };
     440                 :            : 
     441                 :            : } // ctr::
     442                 :            : } // inciter::

Generated by: LCOV version 1.16