Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://www.mooseframework.org 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 "KokkosLinearSystemContributionObject.h" 13 : 14 : #include "BlockRestrictable.h" 15 : 16 : namespace Moose::Kokkos 17 : { 18 : 19 : class FVDatum; 20 : 21 : /** 22 : * Base class for Kokkos linear finite volume kernels that contribute to the linear system 23 : */ 24 : class LinearFVKernel : public LinearSystemContributionObject, public BlockRestrictable 25 : { 26 : public: 27 : static InputParameters validParams(); 28 : 29 : LinearFVKernel(const InputParameters & parameters); 30 : LinearFVKernel(const LinearFVKernel & object); 31 : 32 : /** 33 : * Default methods to prevent compile errors when matrix contributions are not defined in the 34 : * derived class. Kernels using these defaults skip matrix dispatch. 35 : */ 36 : ///@{ 37 : template <typename Derived> 38 0 : KOKKOS_FUNCTION Real computeMatrixContribution(const FVDatum &) const 39 : { 40 0 : ::Kokkos::abort("Default computeMatrixContribution() should never be called. Make sure you " 41 : "properly redefined this method in your class without typos."); 42 : 43 : return 0; 44 : } 45 : 46 : template <typename Derived> 47 0 : KOKKOS_FUNCTION Real computeNeighborMatrixContribution(const FVDatum &) const 48 : { 49 0 : ::Kokkos::abort("Default computeNeighborMatrixContribution() should never be called. Make sure " 50 : "you properly redefined this method in your class without typos."); 51 : 52 : return 0; 53 : } 54 : ///@} 55 : 56 : /** 57 : * Functions used to check if users have overriden the hook methods, whose calculations can be 58 : * skipped when not overriden 59 : * @returns The function pointer of the default hook method 60 : */ 61 : ///@{ 62 : template <typename Derived> 63 41104 : static auto defaultMatrixContribution() 64 : { 65 41104 : return &LinearFVKernel::computeMatrixContribution<Derived>; 66 : } 67 : 68 : template <typename Derived> 69 41104 : static auto defaultNeighborMatrixContribution() 70 : { 71 41104 : return &LinearFVKernel::computeNeighborMatrixContribution<Derived>; 72 : } 73 : ///@} 74 : }; 75 : 76 : } // namespace Moose::Kokkos