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 "ResidualObject.h" 13 : #include "ScalarCoupleable.h" 14 : #include "MooseVariableScalar.h" 15 : 16 : /** 17 : * Base class shared by AD and non-AD scalar kernels 18 : */ 19 : class ScalarKernelBase : public ResidualObject, public ScalarCoupleable 20 : { 21 : public: 22 : static InputParameters validParams(); 23 : 24 : ScalarKernelBase(const InputParameters & parameters); 25 : 26 : /** 27 : * Reinitialization method called before each call to computeResidual() 28 : */ 29 : virtual void reinit() = 0; 30 : 31 : /** 32 : * The variable that this kernel operates on. 33 : */ 34 475306 : virtual const MooseVariableScalar & variable() const override { return _var; } 35 : 36 : /** 37 : * Use this to enable/disable the scalar kernel 38 : * @return true if the scalar kernel is active 39 : */ 40 0 : virtual bool isActive() { return true; } 41 : 42 : /** 43 : * Retrieves the old value of the variable that this ScalarKernelBase operates on. 44 : * 45 : * Store this as a _reference_ in the constructor. 46 : */ 47 : const VariableValue & uOld() const; 48 : 49 : protected: 50 : /// Scalar variable 51 : MooseVariableScalar & _var; 52 : 53 : unsigned int _i, _j; 54 : };