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 : 36 : #ifdef MOOSE_KOKKOS_ENABLED 37 : /** 38 : * Special constructor used for Kokkos functor copy during parallel dispatch 39 : */ 40 : TransientInterface(const TransientInterface & object, const Moose::Kokkos::FunctorCopy & key); 41 : #endif 42 : 43 : virtual ~TransientInterface(); 44 : 45 : static InputParameters validParams(); 46 : 47 153273396 : bool isImplicit() { return _is_implicit; } 48 : 49 : /** 50 : * Create a functor state argument that corresponds to the implicit state of this object. If we 51 : * are implicit then we will return the current state. If we are not, then we will return the old 52 : * state 53 : */ 54 : Moose::StateArg determineState() const; 55 : 56 : protected: 57 : const InputParameters & _ti_params; 58 : 59 : FEProblemBase & _ti_feproblem; 60 : 61 : /** 62 : * If the object is using implicit or explicit form. This does NOT mean time scheme, 63 : * but which values are going to be used in the object - either from current time or old time. 64 : * Note that 65 : * even explicit schemes have implicit form (it is the time derivative "kernel") 66 : */ 67 : bool _is_implicit; 68 : 69 : /// Time 70 : Real & _t; 71 : 72 : /// Old time 73 : const Real & _t_old; 74 : 75 : /// The number of the time step 76 : int & _t_step; 77 : 78 : /// Time step size 79 : Real & _dt; 80 : 81 : /// Size of the old time step 82 : Real & _dt_old; 83 : 84 : // NOTE: dunno if it is set properly in time of instantiation (might be a source of bugs) 85 : bool _is_transient; 86 : 87 : private: 88 : const std::string _ti_name; 89 : }; 90 : 91 : inline Moose::StateArg 92 46772119 : TransientInterface::determineState() const 93 : { 94 46772119 : return _is_implicit ? Moose::currentState() : Moose::oldState(); 95 : }