<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

#pragma once

#include "MortarConstraintBase.h"

#include "libmesh/quadrature_gauss.h"

// Forward Declarations
template <ComputeStage>
class MortarConstraint;
class FEProblemBase;

declareADValidParams(MortarConstraint);

template <ComputeStage compute_stage>
class MortarConstraint : public MortarConstraintBase
{
public:
  MortarConstraint(const InputParameters & parameters);

  void computeResidual(bool has_master) final;

  void computeJacobian(bool has_master) final;

  SubdomainID masterSubdomain() const final { return _master_subdomain_id; }

  const MooseVariable * variable() const final { return _var; }

protected:
  /**
   * compute the residual at the quadrature points
   */
  virtual ADResidual computeQpResidual(Moose::MortarType mortar_type) = 0;

private:
  /**
   * compute the residual for the specified element type
   */
  void computeResidual(Moose::MortarType mortar_type);

  /**
   * compute the residual for the specified element type
   */
  void computeJacobian(Moose::MortarType mortar_type);

  /// Reference to the finite element problem
  FEProblemBase & _fe_problem;

  /// Boundary ID for the slave surface
  const BoundaryID _slave_id;

  /// Boundary ID for the master surface
  const BoundaryID _master_id;

  /// Subdomain ID for the slave surface
  const SubdomainID _slave_subdomain_id;

  /// Subdomain ID for the master surface
  const SubdomainID _master_subdomain_id;

  /// Pointer to the lagrange multipler variable. nullptr if none
  const MooseVariable * _var;

  /// Reference to the slave variable
  const MooseVariable & _slave_var;

  /// Reference to the master variable
  const MooseVariable & _master_var;

  /// Whether to compute primal residuals
  const bool _compute_primal_residuals;

  /// Whether to compute lagrange multiplier residuals
  const bool _compute_lm_residuals;

  /// A dummy object useful for constructing _test when not using Lagrange multipliers
  const VariableTestValue _test_dummy;

  /// A dummy object useful for constructing _lambda when not using Lagrange multipliers
  const ADVariableValue _lambda_dummy;

protected:
  /// Whether the current mortar segment projects onto a face on the master side
  bool _has_master;<commit_msg>Loosen up the MortarConstraint interface<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

#pragma once

#include "MortarConstraintBase.h"

#include "libmesh/quadrature_gauss.h"

// Forward Declarations
template <ComputeStage>
class MortarConstraint;
class FEProblemBase;

declareADValidParams(MortarConstraint);

template <ComputeStage compute_stage>
class MortarConstraint : public MortarConstraintBase
{
public:
  MortarConstraint(const InputParameters & parameters);

  void computeResidual(bool has_master) final;

  void computeJacobian(bool has_master) final;

  SubdomainID masterSubdomain() const final { return _master_subdomain_id; }

  const MooseVariable * variable() const final { return _var; }

protected:
  /**
   * compute the residual at the quadrature points
   */
  virtual ADResidual computeQpResidual(Moose::MortarType mortar_type) = 0;

  /**
   * compute the residual for the specified element type
   */
  virtual void computeResidual(Moose::MortarType mortar_type);

  /**
   * compute the residual for the specified element type
   */
  virtual void computeJacobian(Moose::MortarType mortar_type);

private:
  /// Reference to the finite element problem
  FEProblemBase & _fe_problem;

  /// Boundary ID for the slave surface
  const BoundaryID _slave_id;

  /// Boundary ID for the master surface
  const BoundaryID _master_id;

  /// Subdomain ID for the slave surface
  const SubdomainID _slave_subdomain_id;

  /// Subdomain ID for the master surface
  const SubdomainID _master_subdomain_id;

protected:
  /// Pointer to the lagrange multipler variable. nullptr if none
  const MooseVariable * _var;

  /// Reference to the slave variable
  const MooseVariable & _slave_var;

  /// Reference to the master variable
  const MooseVariable & _master_var;

private:
  /// Whether to compute primal residuals
  const bool _compute_primal_residuals;

  /// Whether to compute lagrange multiplier residuals
  const bool _compute_lm_residuals;

  /// A dummy object useful for constructing _test when not using Lagrange multipliers
  const VariableTestValue _test_dummy;

  /// A dummy object useful for constructing _lambda when not using Lagrange multipliers
  const ADVariableValue _lambda_dummy;

protected:
  /// Whether the current mortar segment projects onto a face on the master side
  bool _has_master;
{'fraction_non_alphanumeric': 0.07503384258363953, 'fraction_numerical': 0.0019338619222587507, 'mean_word_length': 4.166833166833166, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4773057', 'n_tokens_mistral': 1546, 'n_tokens_neox': 1464, 'n_words': 501}