LCOV - code coverage report
Current view: top level - src/loops - MortarUserObjectThread.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 35 35 100.0 %
Date: 2025-08-08 20:01:16 Functions: 3 3 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 "MortarUserObjectThread.h"
      11             : #include "FEProblemBase.h"
      12             : #include "SubProblem.h"
      13             : #include "Assembly.h"
      14             : #include "AutomaticMortarGeneration.h"
      15             : #include "MooseMesh.h"
      16             : #include "Assembly.h"
      17             : #include "MortarUtils.h"
      18             : #include "MaterialBase.h"
      19             : #include "MortarUserObject.h"
      20             : 
      21             : #include "libmesh/fe_base.h"
      22             : #include "libmesh/quadrature.h"
      23             : #include "libmesh/elem.h"
      24             : #include "libmesh/point.h"
      25             : #include "libmesh/mesh_base.h"
      26             : 
      27          24 : MortarUserObjectThread::MortarUserObjectThread(
      28             :     std::vector<MortarUserObject *> & mortar_user_objects,
      29             :     const AutomaticMortarGeneration & amg,
      30             :     SubProblem & subproblem,
      31             :     FEProblemBase & fe_problem,
      32             :     bool displaced,
      33          24 :     Assembly & assembly)
      34          24 :   : _mortar_user_objects(mortar_user_objects),
      35          24 :     _amg(amg),
      36          24 :     _subproblem(subproblem),
      37          24 :     _fe_problem(fe_problem),
      38          24 :     _displaced(displaced),
      39          24 :     _assembly(assembly)
      40             : {
      41          24 :   Moose::Mortar::setupMortarMaterials(_mortar_user_objects,
      42             :                                       _fe_problem,
      43             :                                       _amg,
      44             :                                       0,
      45          24 :                                       _secondary_ip_sub_to_mats,
      46          24 :                                       _primary_ip_sub_to_mats,
      47          24 :                                       _secondary_boundary_mats);
      48          24 : }
      49             : 
      50             : void
      51          24 : MortarUserObjectThread::operator()()
      52             : {
      53          24 :   const auto & secondary_elems_to_mortar_segments = _amg.secondariesToMortarSegments();
      54             :   typedef decltype(secondary_elems_to_mortar_segments.begin()) it_type;
      55             : 
      56          24 :   std::vector<it_type> iterators;
      57          24 :   for (auto it = secondary_elems_to_mortar_segments.begin();
      58          96 :        it != secondary_elems_to_mortar_segments.end();
      59          72 :        ++it)
      60             :   {
      61          72 :     auto * const secondary_elem = _subproblem.mesh().getMesh().query_elem_ptr(it->first);
      62             : 
      63         126 :     if (secondary_elem && secondary_elem->processor_id() == _subproblem.processor_id() &&
      64          54 :         !it->second.empty())
      65             :     {
      66             :       // This is local and the mortar segment set isn't empty, so include
      67          54 :       iterators.push_back(it);
      68             :       mooseAssert(secondary_elem->active(),
      69             :                   "We loop over active elements when building the mortar segment mesh, so we golly "
      70             :                   "well hope this is active.");
      71             :     }
      72             :   }
      73             : 
      74          72 :   auto act_functor = [this]()
      75             :   {
      76         144 :     for (auto * const mc : _mortar_user_objects)
      77             :     {
      78          72 :       mc->setNormals();
      79          72 :       mc->execute();
      80             :     }
      81          72 :   };
      82             : 
      83          24 :   Moose::Mortar::loopOverMortarSegments(iterators,
      84             :                                         _assembly,
      85             :                                         _subproblem,
      86             :                                         _fe_problem,
      87             :                                         _amg,
      88          24 :                                         _displaced,
      89          24 :                                         _mortar_user_objects,
      90             :                                         0,
      91          24 :                                         _secondary_ip_sub_to_mats,
      92          24 :                                         _primary_ip_sub_to_mats,
      93          24 :                                         _secondary_boundary_mats,
      94             :                                         act_functor,
      95             :                                         /*reinit_mortar_user_objects=*/false);
      96          24 : }

Generated by: LCOV version 1.14