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 "Moose.h" 13 : #include "MooseFunctorArguments.h" 14 : 15 : #define usingTransientInterfaceMembers \ 16 : using TransientInterface::_t; \ 17 : using TransientInterface::_t_step; \ 18 : using TransientInterface::_dt; \ 19 : using TransientInterface::_dt_old 20 : 21 : // Forward declarations 22 : class FEProblemBase; 23 : class InputParameters; 24 : class MooseObject; 25 : template <typename T> 26 : InputParameters validParams(); 27 : 28 : /** 29 : * Interface for objects that needs transient capabilities 30 : */ 31 : class TransientInterface 32 : { 33 : public: 34 : TransientInterface(const MooseObject * moose_object); 35 : static InputParameters validParams(); 36 : virtual ~TransientInterface(); 37 : 38 136884868 : bool isImplicit() { return _is_implicit; } 39 : 40 : /** 41 : * Create a functor state argument that corresponds to the implicit state of this object. If we 42 : * are implicit then we will return the current state. If we are not, then we will return the old 43 : * state 44 : */ 45 : Moose::StateArg determineState() const; 46 : 47 : protected: 48 : const InputParameters & _ti_params; 49 : 50 : FEProblemBase & _ti_feproblem; 51 : 52 : /** 53 : * If the object is using implicit or explicit form. This does NOT mean time scheme, 54 : * but which values are going to be used in the object - either from current time or old time. 55 : * Note that 56 : * even explicit schemes have implicit form (it is the time derivative "kernel") 57 : */ 58 : bool _is_implicit; 59 : 60 : /// Time 61 : Real & _t; 62 : 63 : /// Old time 64 : const Real & _t_old; 65 : 66 : /// The number of the time step 67 : int & _t_step; 68 : 69 : /// Time step size 70 : Real & _dt; 71 : 72 : /// Size of the old time step 73 : Real & _dt_old; 74 : 75 : // NOTE: dunno if it is set properly in time of instantiation (might be a source of bugs) 76 : bool _is_transient; 77 : 78 : private: 79 : const std::string _ti_name; 80 : }; 81 : 82 : inline Moose::StateArg 83 43047267 : TransientInterface::determineState() const 84 : { 85 43047267 : return _is_implicit ? Moose::currentState() : Moose::oldState(); 86 : }