<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 "AuxKernel.h"

// local includes
#include "FEProblem.h"
#include "SubProblem.h"
#include "AuxiliarySystem.h"
#include "MooseTypes.h"
#include "Assembly.h"

#include "libmesh/numeric_vector.h"
#include "libmesh/dof_map.h"
#include "libmesh/quadrature.h"

template <>
InputParameters
validParams<AuxKernel>()
{
  InputParameters params = validParams<MooseObject>();
  params += validParams<BlockRestrictable>();
  params += validParams<BoundaryRestrictable>();
  params += validParams<RandomInterface>();
  params += validParams<MeshChangedInterface>();
  params += validParams<MaterialPropertyInterface>();

  // Add the SetupInterface parameter, 'execute_on', the default is 'linear'
  params += validParams<SetupInterface>();

  params.addRequiredParam<AuxVariableName>("variable",
                                           "The name of the variable that this object applies to");

  params.addParam<bool>("use_displaced_mesh",
                        false,
                        "Whether or not this object should use the "
                        "displaced mesh for computation.  Note that "
                        "in the case this is true but no "
                        "displacements are provided in the Mesh block "
                        "the undisplaced mesh will still be used.");
  params.addParamNamesToGroup("use_displaced_mesh", "Advanced");

  // This flag is set to true if the AuxKernel is being used on a boundary
  params.addPrivateParam<bool>("_on_boundary", false);

  params.declareControllable("enable"); // allows Control to enable/disable this type of object
  params.registerBase("AuxKernel");

  return params;
}

AuxKernel::AuxKernel(const InputParameters & parameters)
  : MooseObject(parameters),
    MooseVariableInterface<Real>(this,
                                 parameters.getCheckedPointerParam<AuxiliarySystem *>("_aux_sys")
                                     ->getVariable(parameters.get<THREAD_ID>("_tid"),
                                                   parameters.get<AuxVariableName>("variable"))
                                     .isNodal()),
    BlockRestrictable(this),
    BoundaryRestrictable(this, mooseVariable()->isNodal()),
    SetupInterface(this),
    CoupleableMooseVariableDependencyIntermediateInterface(this, mooseVariable()->isNodal()),
    FunctionInterface(this),
    UserObjectInterface(this),
    TransientInterface(this),
    MaterialPropertyInterface(this, blockIDs(), boundaryIDs()),
    PostprocessorInterface(this),
    DependencyResolverInterface(),
    RandomInterface(parameters,
                    *parameters.getCheckedPointerParam<FEProblemBase *>("_fe_problem_base"),
                    parameters.get<THREAD_ID>("_tid"),
                    mooseVariable()->isNodal()),
    GeometricSearchInterface(this),
    Restartable(this, "AuxKernels"),
    MeshChangedInterface(parameters),
    VectorPostprocessorInterface(this),
    _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
    _sys(*getCheckedPointerParam<SystemBase *>("_sys")),
    _nl_sys(*getCheckedPointerParam<SystemBase *>("_nl_sys")),
    _aux_sys(*getCheckedPointerParam<AuxiliarySystem *>("_aux_sys")),
    _tid(parameters.get<THREAD_ID>("_tid")),
    _assembly(_subproblem.assembly(_tid)),

    _var(_aux_sys.getFieldVariable<Real>(_tid, parameters.get<AuxVariableName>("variable"))),
    _nodal(_var.isNodal()),
    _bnd(boundaryRestricted()),

    _mesh(_subproblem.mesh()),

    _q_point(_bnd ? _assembly.qPointsFace() : _assembly.qPoints()),
    _qrule(_bnd ? _assembly.qRuleFace() : _assembly.qRule()),
    _JxW(_bnd ? _assembly.JxWFace() : _assembly.JxW()),
    _coord(_assembly.coordTransformation()),

    _u(_nodal ? _var.nodalValue() : _var.sln()),
    _u_old(_nodal ? _var.nodalValueOld() : _var.slnOld()),
    _u_older(_nodal ? _var.nodalValueOlder() : _var.slnOlder()),
    _test(_var.phi()),

    _current_elem(_var.currentElem()),
    _current_side(_var.currentSide()),
    _current_elem_volume(_assembly.elemVolume()),
    _current_side_volume(_assembly.sideElemVolume()),

    _current_node(_assembly.node()),

    _solution(_aux_sys.solution())
{
  addMooseVariableDependency(mooseVariable());
  _supplied_vars.insert(parameters.get<AuxVariableName>("variable"));

  std::map<std::string, std::vector<MooseVariableFE *>> coupled_vars = getCoupledVars();<commit_msg>Current element and side not comes form the right problem<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 "AuxKernel.h"

// local includes
#include "FEProblem.h"
#include "SubProblem.h"
#include "AuxiliarySystem.h"
#include "MooseTypes.h"
#include "Assembly.h"

#include "libmesh/numeric_vector.h"
#include "libmesh/dof_map.h"
#include "libmesh/quadrature.h"

template <>
InputParameters
validParams<AuxKernel>()
{
  InputParameters params = validParams<MooseObject>();
  params += validParams<BlockRestrictable>();
  params += validParams<BoundaryRestrictable>();
  params += validParams<RandomInterface>();
  params += validParams<MeshChangedInterface>();
  params += validParams<MaterialPropertyInterface>();

  // Add the SetupInterface parameter, 'execute_on', the default is 'linear'
  params += validParams<SetupInterface>();

  params.addRequiredParam<AuxVariableName>("variable",
                                           "The name of the variable that this object applies to");

  params.addParam<bool>("use_displaced_mesh",
                        false,
                        "Whether or not this object should use the "
                        "displaced mesh for computation.  Note that "
                        "in the case this is true but no "
                        "displacements are provided in the Mesh block "
                        "the undisplaced mesh will still be used.");
  params.addParamNamesToGroup("use_displaced_mesh", "Advanced");

  // This flag is set to true if the AuxKernel is being used on a boundary
  params.addPrivateParam<bool>("_on_boundary", false);

  params.declareControllable("enable"); // allows Control to enable/disable this type of object
  params.registerBase("AuxKernel");

  return params;
}

AuxKernel::AuxKernel(const InputParameters & parameters)
  : MooseObject(parameters),
    MooseVariableInterface<Real>(this,
                                 parameters.getCheckedPointerParam<AuxiliarySystem *>("_aux_sys")
                                     ->getVariable(parameters.get<THREAD_ID>("_tid"),
                                                   parameters.get<AuxVariableName>("variable"))
                                     .isNodal()),
    BlockRestrictable(this),
    BoundaryRestrictable(this, mooseVariable()->isNodal()),
    SetupInterface(this),
    CoupleableMooseVariableDependencyIntermediateInterface(this, mooseVariable()->isNodal()),
    FunctionInterface(this),
    UserObjectInterface(this),
    TransientInterface(this),
    MaterialPropertyInterface(this, blockIDs(), boundaryIDs()),
    PostprocessorInterface(this),
    DependencyResolverInterface(),
    RandomInterface(parameters,
                    *parameters.getCheckedPointerParam<FEProblemBase *>("_fe_problem_base"),
                    parameters.get<THREAD_ID>("_tid"),
                    mooseVariable()->isNodal()),
    GeometricSearchInterface(this),
    Restartable(this, "AuxKernels"),
    MeshChangedInterface(parameters),
    VectorPostprocessorInterface(this),
    _subproblem(*getCheckedPointerParam<SubProblem *>("_subproblem")),
    _sys(*getCheckedPointerParam<SystemBase *>("_sys")),
    _nl_sys(*getCheckedPointerParam<SystemBase *>("_nl_sys")),
    _aux_sys(*getCheckedPointerParam<AuxiliarySystem *>("_aux_sys")),
    _tid(parameters.get<THREAD_ID>("_tid")),
    _assembly(_subproblem.assembly(_tid)),

    _var(_aux_sys.getFieldVariable<Real>(_tid, parameters.get<AuxVariableName>("variable"))),
    _nodal(_var.isNodal()),
    _bnd(boundaryRestricted()),

    _mesh(_subproblem.mesh()),

    _q_point(_bnd ? _assembly.qPointsFace() : _assembly.qPoints()),
    _qrule(_bnd ? _assembly.qRuleFace() : _assembly.qRule()),
    _JxW(_bnd ? _assembly.JxWFace() : _assembly.JxW()),
    _coord(_assembly.coordTransformation()),

    _u(_nodal ? _var.nodalValue() : _var.sln()),
    _u_old(_nodal ? _var.nodalValueOld() : _var.slnOld()),
    _u_older(_nodal ? _var.nodalValueOlder() : _var.slnOlder()),
    _test(_var.phi()),

    _current_elem(_assembly.elem()),
    _current_side(_assembly.side()),
    _current_elem_volume(_assembly.elemVolume()),
    _current_side_volume(_assembly.sideElemVolume()),

    _current_node(_assembly.node()),

    _solution(_aux_sys.solution())
{
  addMooseVariableDependency(mooseVariable());
  _supplied_vars.insert(parameters.get<AuxVariableName>("variable"));

  std::map<std::string, std::vector<MooseVariableFE *>> coupled_vars = getCoupledVars();
{'fraction_non_alphanumeric': 0.1281779661016949, 'fraction_numerical': 0.000847457627118644, 'mean_word_length': 3.6599210266535045, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 67, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1064286', 'n_tokens_mistral': 2764, 'n_tokens_neox': 2679, 'n_words': 482}