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 "Action.h" 13 : 14 : class GlobalParamsAction : public Action 15 : { 16 : public: 17 : static InputParameters validParams(); 18 : 19 : GlobalParamsAction(const InputParameters & params); 20 : 21 : virtual void act() override; 22 : 23 : /** 24 : * This function is here to remove parameters of a type so that global parameters 25 : * can potentially use the same named variable as a different type depending on the 26 : * application. 27 : */ 28 : void remove(const std::string & name); 29 : 30 : /** 31 : * Obtain a non-const reference of the action parameters in the InputParameterWarehouse. 32 : */ 33 : InputParameters & parameters(); 34 : 35 : template <typename T> 36 0 : T & setParam(const std::string & name) 37 : { 38 0 : return parameters().set<T>(name); 39 : } 40 : 41 : template <typename T> 42 52866 : inline T & setScalarParam(const std::string & name) 43 : { 44 52866 : return parameters().set<T>(name); 45 : } 46 : 47 : template <typename T> 48 3962 : inline std::vector<T> & setVectorParam(const std::string & name) 49 : { 50 3962 : return parameters().set<std::vector<T>>(name); 51 : } 52 : 53 : template <typename T> 54 456 : inline std::vector<std::vector<T>> & setDoubleIndexParam(const std::string & name) 55 : { 56 456 : return parameters().set<std::vector<std::vector<T>>>(name); 57 : } 58 : 59 : template <typename T> 60 300 : inline std::vector<std::vector<std::vector<T>>> & setTripleIndexParam(const std::string & name) 61 : { 62 300 : return parameters().set<std::vector<std::vector<std::vector<T>>>>(name); 63 : } 64 : };