Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #pragma once 11 : 12 : #include "MooseObject.h" 13 : 14 : /** 15 : * 16 : */ 17 0 : class THMObject : public MooseObject 18 : { 19 : public: 20 : THMObject(const InputParameters & parameters); 21 : 22 : protected: 23 : /** 24 : * Passes a parameter from this object's input parameters to another set of input parameters. 25 : * 26 : * @tparam T the type of the parameter to be passed 27 : * @param name[in] name the name of this object's parameter 28 : * @param new_name[in] new_name the name of the corresponding parameters in \c params 29 : * @param params[in,out] params the parameters to which the parameter will be passed 30 : */ 31 : template <typename T> 32 : void passParameter(const std::string & name, 33 : const std::string & new_name, 34 : InputParameters & params) const; 35 : 36 : /** 37 : * Passes a parameter from this object's input parameters to another set of input parameters. 38 : * 39 : * This version overloads the other by assuming that the parameter has the same name. 40 : * 41 : * @tparam T the type of the parameter to be passed 42 : * @param name[in] name the name of the parameter 43 : * @param params[in,out] params the parameters to which the parameter will be passed 44 : */ 45 : template <typename T> 46 : void passParameter(const std::string & name, InputParameters & params) const; 47 : 48 : public: 49 : static InputParameters validParams(); 50 : }; 51 : 52 : template <typename T> 53 : void 54 : THMObject::passParameter(const std::string & name, 55 : const std::string & new_name, 56 : InputParameters & params) const 57 : { 58 : if (isParamValid(name)) 59 : params.set<T>(new_name) = _pars.get<T>(name); 60 : } 61 : 62 : template <typename T> 63 : void 64 : THMObject::passParameter(const std::string & name, InputParameters & params) const 65 : { 66 : passParameter<T>(name, name, params); 67 : }