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 "ActionComponent.h" 13 : #include "InputParameters.h" 14 : #include "MooseTypes.h" 15 : 16 : /** 17 : * Helper class to help Components define the initial conditions the Physics may need 18 : * from the parameters specified by the user 19 : * Note: Trying out virtual inheritance. It makes things 20 : * a little easier to define as we can use the attributes 21 : * of the underlying ActionComponent 22 : */ 23 : class ComponentInitialConditionInterface : public virtual ActionComponent 24 : { 25 : public: 26 : static InputParameters validParams(); 27 : 28 : ComponentInitialConditionInterface(const InputParameters & params); 29 : 30 : /// Whether the component has an initial condition parameter set for the requested variable 31 : bool hasInitialCondition(const VariableName & variable) const; 32 : /// Get the name of the functor providing the initial condition for the requested variable 33 : const MooseFunctorName & getInitialCondition(const VariableName & variable, 34 : const std::string & requestor_name) const; 35 : 36 : protected: 37 152 : virtual void checkIntegrity() override { checkInitialConditionsAllRequested(); } 38 : 39 : /// Names of the variables to set an initial condition on 40 : const std::vector<VariableName> _initial_condition_variables; 41 : /// Functor values for the initial conditions of the variables 42 : const std::vector<MooseFunctorName> _variable_ic_functors; 43 : /// Requested variables. If the IC for a variable was never requested, error 44 : mutable std::set<VariableName> _requested_ic_variables; 45 : 46 : private: 47 : /// Checks that all initial conditions were requested. 48 : /// An unrequested property necessarily means an unused value 49 : void checkInitialConditionsAllRequested() const; 50 : };