LCOV - code coverage report
Current view: top level - src/meshmodifiers - ElementSubdomainModifier.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 22 22 100.0 %
Date: 2026-05-29 20:35:17 Functions: 6 6 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 "ElementSubdomainModifier.h"
      11             : #include "ElementSubdomainModifierBase.h"
      12             : 
      13             : InputParameters
      14       10594 : ElementSubdomainModifier::validParams()
      15             : {
      16       10594 :   InputParameters params = ElementSubdomainModifierBase::validParams();
      17       10594 :   return params;
      18             : }
      19             : 
      20         735 : ElementSubdomainModifier::ElementSubdomainModifier(const InputParameters & parameters)
      21         735 :   : ElementSubdomainModifierBase(parameters)
      22             : {
      23         735 : }
      24             : 
      25             : void
      26        3857 : ElementSubdomainModifier::initialize()
      27             : {
      28             :   // Clear moved elements from last execution
      29        3857 :   _moved_elems.clear();
      30        3857 : }
      31             : 
      32             : void
      33      911271 : ElementSubdomainModifier::execute()
      34             : {
      35             :   // Compute the desired subdomain ID for the current element.
      36      911271 :   SubdomainID subdomain_id = computeSubdomainID();
      37             : 
      38             :   // Don't do anything if subdomain ID is invalid
      39      911271 :   if (subdomain_id == Moose::INVALID_BLOCK_ID)
      40      313457 :     return;
      41             : 
      42             :   // If the current element's subdomain ID isn't what we want
      43      597814 :   if (_current_elem->subdomain_id() != subdomain_id)
      44       29676 :     _moved_elems[_current_elem->id()] = {_current_elem->subdomain_id(), subdomain_id};
      45             : }
      46             : 
      47             : void
      48         325 : ElementSubdomainModifier::threadJoin(const UserObject & in_uo)
      49             : {
      50             :   // Join the data from uo into _this_ object:
      51         325 :   const auto & uo = static_cast<const ElementSubdomainModifier &>(in_uo);
      52             : 
      53         325 :   _moved_elems.insert(uo._moved_elems.begin(), uo._moved_elems.end());
      54         325 : }
      55             : 
      56             : void
      57        3532 : ElementSubdomainModifier::finalize()
      58             : {
      59        3532 :   ElementSubdomainModifierBase::modify(_moved_elems);
      60        3532 : }

Generated by: LCOV version 1.14