LCOV - code coverage report
Current view: top level - src/linesearches - ContactLineSearchBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose contact: #31405 (292dce) with base fef103 Lines: 24 26 92.3 %
Date: 2025-09-04 07:52:48 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          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             : #include "ContactLineSearchBase.h"
      11             : #include "PetscSupport.h"
      12             : #include "InputParameters.h"
      13             : #include "MooseEnum.h"
      14             : #include "FEProblem.h"
      15             : #include "MooseError.h"
      16             : 
      17             : registerMooseObjectAliased("ContactApp", ContactLineSearchBase, "ContactLineSearch");
      18             : 
      19             : InputParameters
      20         174 : ContactLineSearchBase::validParams()
      21             : {
      22         174 :   InputParameters params = LineSearch::validParams();
      23         348 :   params.addRequiredParam<unsigned>("allowed_lambda_cuts",
      24             :                                     "The number of times lambda is allowed to get cut");
      25         348 :   params.addRequiredParam<Real>("contact_ltol",
      26             :                                 "The linear tolerance to use when the contact set is changing.");
      27         348 :   params.addRequiredParam<bool>("affect_ltol",
      28             :                                 "Whether to change the linear tolerance from the default value "
      29             :                                 "when the contact set is changing");
      30         348 :   MooseEnum line_search_package("petsc moose");
      31         174 :   return params;
      32         174 : }
      33             : 
      34          87 : ContactLineSearchBase::ContactLineSearchBase(const InputParameters & parameters)
      35             :   : LineSearch(parameters),
      36          87 :     _user_ksp_rtol_set(false),
      37         174 :     _allowed_lambda_cuts(getParam<unsigned>("allowed_lambda_cuts")),
      38         174 :     _contact_ltol(getParam<Real>("contact_ltol")),
      39         261 :     _affect_ltol(getParam<bool>("affect_ltol"))
      40             : {
      41          87 : }
      42             : 
      43             : void
      44        3459 : ContactLineSearchBase::printContactInfo(const std::set<dof_id_type> & contact_set)
      45             : {
      46        3459 :   if (!contact_set.empty())
      47          51 :     _console << contact_set.size() << " nodes in contact" << std::endl;
      48             :   else
      49        3408 :     _console << "No nodes in contact" << std::endl;
      50        3459 : }
      51             : 
      52             : void
      53          86 : ContactLineSearchBase::insertSet(const std::set<dof_id_type> & mech_set)
      54             : {
      55          86 :   if (_current_contact_state.empty())
      56             :     _current_contact_state = mech_set;
      57             :   else
      58           0 :     for (auto & node : mech_set)
      59           0 :       _current_contact_state.insert(node);
      60          86 : }
      61             : 
      62             : void
      63          17 : ContactLineSearchBase::reset()
      64             : {
      65             :   _current_contact_state.clear();
      66             :   zeroIts();
      67          17 : }

Generated by: LCOV version 1.14