<commit_before>//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

#include "BodyForce.h"

// MOOSE
#include "Function.h"

registerMooseObject("MooseApp", BodyForce);
registerMooseObject("MooseApp", ADBodyForce);

template <bool is_ad>
InputParameters
BodyForceTempl<is_ad>::validParams()
{
  InputParameters params = Kernel::validParams();
  params.addClassDescription("Demonstrates the multiple ways that scalar values can be introduced "
                             "into kernels, e.g. (controllable) constants, functions, and "
                             "postprocessors. Implements the weak form $(\\psi_i, -f)$.");
  params.addParam<Real>("value", 1.0, "Coefficient to multiply by the body force term");
  params.addParam<FunctionName>("function", "1", "A function that describes the body force");
  params.addParam<PostprocessorName>(
      "postprocessor", 1, "A postprocessor whose value is multiplied by the body force");
  params.declareControllable("value");
  return params;
}

template <bool is_ad>
BodyForceTempl<is_ad>::BodyForceTempl(const InputParameters & parameters)
  : GenericKernel<is_ad>(parameters),
    _scale(getParam<Real>("value")),
    _function(getFunction("function")),
    _postprocessor(getPostprocessorValue("postprocessor"))
{
}

template <bool is_ad>
GenericReal<is_ad>
BodyForceTempl<is_ad>::computeQpResidual()
{
  Real factor = _scale * _postprocessor * _function.value(_t, _q_point[_qp]);
  return _test[_i][_qp] * -factor;
}<commit_msg>fix templating<commit_after>//* This file is part of the MOOSE framework
//* https://www.mooseframework.org
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html

#include "BodyForce.h"

// MOOSE
#include "Function.h"

registerMooseObject("MooseApp", BodyForce);
registerMooseObject("MooseApp", ADBodyForce);

template <bool is_ad>
InputParameters
BodyForceTempl<is_ad>::validParams()
{
  InputParameters params = Kernel::validParams();
  params.addClassDescription("Demonstrates the multiple ways that scalar values can be introduced "
                             "into kernels, e.g. (controllable) constants, functions, and "
                             "postprocessors. Implements the weak form $(\\psi_i, -f)$.");
  params.addParam<Real>("value", 1.0, "Coefficient to multiply by the body force term");
  params.addParam<FunctionName>("function", "1", "A function that describes the body force");
  params.addParam<PostprocessorName>(
      "postprocessor", 1, "A postprocessor whose value is multiplied by the body force");
  params.declareControllable("value");
  return params;
}

template <bool is_ad>
BodyForceTempl<is_ad>::BodyForceTempl(const InputParameters & parameters)
  : GenericKernel<is_ad>(parameters),
    _scale(this->template getParam<Real>("value")),
    _function(getFunction("function")),
    _postprocessor(getPostprocessorValue("postprocessor"))
{
}

template <bool is_ad>
GenericReal<is_ad>
BodyForceTempl<is_ad>::computeQpResidual()
{
  Real factor = _scale * _postprocessor * _function.value(_t, _q_point[_qp]);
  return _test[_i][_qp] * -factor;
}

template class BodyForceTempl<false>;
template class BodyForceTempl<true>;
{'fraction_non_alphanumeric': 0.13225446428571427, 'fraction_numerical': 0.004464285714285714, 'mean_word_length': 4.681458003169572, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 30, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4718351', 'n_tokens_mistral': 1111, 'n_tokens_neox': 1090, 'n_words': 266}