LCOV - code coverage report
Current view: top level - src/geomsearch - XFEMElementPairLocator.C (source / functions) Hit Total Coverage
Test: idaholab/moose xfem: #31405 (292dce) with base fef103 Lines: 38 38 100.0 %
Date: 2025-09-04 07:58:55 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 "XFEMElementPairLocator.h"
      11             : 
      12         706 : XFEMElementPairLocator::XFEMElementPairLocator(std::shared_ptr<XFEM> xfem,
      13             :                                                unsigned int interface_id,
      14         706 :                                                bool use_displaced_mesh)
      15         706 :   : ElementPairLocator(interface_id), _xfem(xfem), _use_displaced_mesh(use_displaced_mesh)
      16             : {
      17         706 :   if (_use_displaced_mesh)
      18         225 :     _elem_pairs = _xfem->getXFEMDisplacedCutElemPairs(interface_id);
      19             :   else
      20         481 :     _elem_pairs = _xfem->getXFEMCutElemPairs(interface_id);
      21         706 : }
      22             : 
      23             : void
      24       36812 : XFEMElementPairLocator::reinit()
      25             : {
      26             :   // Does not support secondary cut yet.
      27       36812 :   if (_xfem->has_secondary_cut())
      28             :     return;
      29             : 
      30             :   _element_pair_info.clear();
      31             : 
      32       32356 :   for (std::list<std::pair<const Elem *, const Elem *>>::const_iterator it = _elem_pairs->begin();
      33      425771 :        it != _elem_pairs->end();
      34             :        ++it)
      35             :   {
      36      393415 :     const Elem * elem1 = it->first;
      37      393415 :     const Elem * elem2 = it->second;
      38             : 
      39             :     std::vector<Point> intersectionPoints1;
      40             :     Point normal1;
      41             :     std::vector<Point> q_points1;
      42             :     std::vector<Real> weights1;
      43             : 
      44             :     unsigned int plane_id = 0; // Only support one cut plane for the time being
      45             : 
      46      393415 :     _xfem->getXFEMIntersectionInfo(
      47      393415 :         elem1, plane_id, normal1, intersectionPoints1, _use_displaced_mesh);
      48             : 
      49      393415 :     if (intersectionPoints1.size() == 2)
      50      318574 :       _xfem->getXFEMqRuleOnLine(intersectionPoints1, q_points1, weights1);
      51       74841 :     else if (intersectionPoints1.size() > 2)
      52       74841 :       _xfem->getXFEMqRuleOnSurface(intersectionPoints1, q_points1, weights1);
      53             : 
      54      393415 :     if (!_use_displaced_mesh)
      55             :     {
      56             :       ElementPairInfo new_elem_info(
      57       13674 :           elem1, elem2, q_points1, q_points1, weights1, weights1, normal1, -normal1);
      58       27348 :       _element_pair_info.insert(
      59       13674 :           std::pair<std::pair<const Elem *, const Elem *>, ElementPairInfo>(*it, new_elem_info));
      60       13674 :     }
      61             :     else
      62             :     {
      63             :       std::vector<Point> intersectionPoints2;
      64             :       Point normal2;
      65             :       std::vector<Point> q_points2;
      66             :       std::vector<Real> weights2;
      67             : 
      68      379741 :       _xfem->getXFEMIntersectionInfo(
      69             :           elem2, plane_id, normal2, intersectionPoints2, _use_displaced_mesh);
      70             : 
      71             :       // reverse the order of intersectionPoints2
      72      379741 :       std::reverse(std::begin(intersectionPoints2), std::end(intersectionPoints2));
      73             : 
      74      379741 :       if (intersectionPoints2.size() == 2)
      75      308128 :         _xfem->getXFEMqRuleOnLine(intersectionPoints2, q_points2, weights2);
      76       71613 :       else if (intersectionPoints2.size() > 2)
      77       71613 :         _xfem->getXFEMqRuleOnSurface(intersectionPoints2, q_points2, weights2);
      78             : 
      79             :       ElementPairInfo new_elem_info(
      80      379741 :           elem1, elem2, q_points1, q_points2, weights1, weights2, normal1, normal2);
      81      759482 :       _element_pair_info.insert(
      82      379741 :           std::pair<std::pair<const Elem *, const Elem *>, ElementPairInfo>(*it, new_elem_info));
      83      379741 :     }
      84      393415 :   }
      85             : }
      86             : 
      87             : void
      88       34104 : XFEMElementPairLocator::update()
      89             : {
      90       34104 :   reinit();
      91       34104 : }

Generated by: LCOV version 1.14