Branch data Line data Source code
1 : : // ***************************************************************************** 2 : : /*! 3 : : \file src/PDE/ConfigureOutVar.cpp 4 : : \copyright 2012-2015 J. Bakosi, 5 : : 2016-2018 Los Alamos National Security, LLC., 6 : : 2019-2021 Triad National Security, LLC. 7 : : All rights reserved. See the LICENSE file for details. 8 : : \brief Assign functions to compute output variables from the numerical 9 : : solution 10 : : \details Assign functions to compute output variables from the numerical 11 : : solution. 12 : : */ 13 : : // ***************************************************************************** 14 : : 15 : : #include "ConfigureOutVar.hpp" 16 : : #include "ConfigureCompFlow.hpp" 17 : : #include "ConfigureMultiMat.hpp" 18 : : #include "ConfigureTransport.hpp" 19 : : 20 : : namespace inciter { 21 : : 22 : : extern ctr::InputDeck g_inputdeck; 23 : : 24 : : } // inciter:: 25 : : 26 : : //! Function object for counting the total number of eq systems configured 27 : : struct Neq { 28 : : std::size_t& neq; 29 : : explicit Neq( std::size_t& n ) : neq(n) {} 30 : : template< typename U > void operator()( brigand::type_<U> ) { 31 [ + + ]: 5099 : neq += inciter::g_inputdeck.get< tag::param, U, tag::depvar >().size(); 32 : : } 33 : : }; 34 : : 35 : : tk::GetVarFn 36 [ + + ]: 5099 : inciter::assignGetVars( const std::string& name ) 37 : : // ***************************************************************************** 38 : : // Assign all functions that compute output variables from numerical solutions 39 : : //! \param[in] name Name of variable whose OutVar::GetVarFn is to be assigned 40 : : //! \return Function assigned to output variable 41 : : //! \note This is used to configure human-readable output variables only. 42 : : // ***************************************************************************** 43 : : { 44 : : tk::GetVarFn f; 45 : : 46 : : // Query total number of eq sytems configured by user 47 : : std::size_t neq = 0; 48 : : brigand::for_each< ctr::parameters::Keys >( Neq(neq) ); 49 : : 50 : : // Only attempt to configure getvars if we are called after the inputdeck has 51 : : // been populated. This guard is here because OutVars, stored in the 52 : : // inputdeck, may also be called by the runtime system on an empty inputdeck, 53 : : // in which case we do nothing, but wait for when we are called with the 54 : : // inputdeck populated. 55 [ + + ]: 5099 : if (neq) { 56 [ + + ]: 4262 : if (!g_inputdeck.get< tag::param, tag::transport, tag::depvar >().empty()) 57 [ + - ]: 602 : assignTransportGetVars( name, f ); 58 [ + + ]: 4262 : if (!g_inputdeck.get< tag::param, tag::compflow, tag::depvar >().empty()) 59 [ + - ]: 3170 : assignCompFlowGetVars( name, f ); 60 [ + + ]: 4262 : if (!g_inputdeck.get< tag::param, tag::multimat, tag::depvar >().empty()) 61 [ + - ]: 490 : assignMultiMatGetVars( name, f ); 62 : : // At this point all non-analytic human-readable outvars must have a getvar 63 : : // function assigned 64 [ + + ][ + + ]: 6929 : if (!name.empty() && name.find("analytic") == std::string::npos) 65 [ - + ][ - - ]: 2253 : ErrChk( f, "OutVar::getvar() not assigned for output variable: " + name ); [ - - ][ - - ] [ - - ][ - - ] 66 : : } 67 : : 68 : 5099 : return f; 69 : : }