LCOV - code coverage report
Current view: top level - src/loops - MortarUserObjectThread.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 35 35 100.0 %
Date: 2025-07-17 01:28:37 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          22 : MortarUserObjectThread::MortarUserObjectThread(
      28             :     std::vector<MortarUserObject *> & mortar_user_objects,
      29             :     const AutomaticMortarGeneration & amg,
      30             :     SubProblem & subproblem,
      31             :     FEProblemBase & fe_problem,
      32             :     bool displaced,
      33          22 :     Assembly & assembly)
      34          22 :   : _mortar_user_objects(mortar_user_objects),
      35          22 :     _amg(amg),
      36          22 :     _subproblem(subproblem),
      37          22 :     _fe_problem(fe_problem),
      38          22 :     _displaced(displaced),
      39          22 :     _assembly(assembly)
      40             : {
      41          22 :   Moose::Mortar::setupMortarMaterials(_mortar_user_objects,
      42             :                                       _fe_problem,
      43             :                                       _amg,
      44             :                                       0,
      45          22 :                                       _secondary_ip_sub_to_mats,
      46          22 :                                       _primary_ip_sub_to_mats,
      47          22 :                                       _secondary_boundary_mats);
      48          22 : }
      49             : 
      50             : void
      51          22 : MortarUserObjectThread::operator()()
      52             : {
      53          22 :   const auto & secondary_elems_to_mortar_segments = _amg.secondariesToMortarSegments();
      54             :   typedef decltype(secondary_elems_to_mortar_segments.begin()) it_type;
      55             : 
      56          22 :   std::vector<it_type> iterators;
      57          22 :   for (auto it = secondary_elems_to_mortar_segments.begin();
      58          88 :        it != secondary_elems_to_mortar_segments.end();
      59          66 :        ++it)
      60             :   {
      61          66 :     auto * const secondary_elem = _subproblem.mesh().getMesh().query_elem_ptr(it->first);
      62             : 
      63         114 :     if (secondary_elem && secondary_elem->processor_id() == _subproblem.processor_id() &&
      64          48 :         !it->second.empty())
      65             :     {
      66             :       // This is local and the mortar segment set isn't empty, so include
      67          48 :       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          64 :   auto act_functor = [this]()
      75             :   {
      76         128 :     for (auto * const mc : _mortar_user_objects)
      77             :     {
      78          64 :       mc->setNormals();
      79          64 :       mc->execute();
      80             :     }
      81          64 :   };
      82             : 
      83          22 :   Moose::Mortar::loopOverMortarSegments(iterators,
      84             :                                         _assembly,
      85             :                                         _subproblem,
      86             :                                         _fe_problem,
      87             :                                         _amg,
      88          22 :                                         _displaced,
      89          22 :                                         _mortar_user_objects,
      90             :                                         0,
      91          22 :                                         _secondary_ip_sub_to_mats,
      92          22 :                                         _primary_ip_sub_to_mats,
      93          22 :                                         _secondary_boundary_mats,
      94             :                                         act_functor,
      95             :                                         /*reinit_mortar_user_objects=*/false);
      96          22 : }

Generated by: LCOV version 1.14