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 : 12 : InputParameters 13 43678 : ElementSubdomainModifier::validParams() 14 : { 15 43678 : InputParameters params = ElementSubdomainModifierBase::validParams(); 16 43678 : return params; 17 : } 18 : 19 460 : ElementSubdomainModifier::ElementSubdomainModifier(const InputParameters & parameters) 20 460 : : ElementSubdomainModifierBase(parameters) 21 : { 22 460 : } 23 : 24 : void 25 2910 : ElementSubdomainModifier::initialize() 26 : { 27 : // Clear moved elements from last execution 28 2910 : _moved_elems.clear(); 29 2910 : } 30 : 31 : void 32 869938 : ElementSubdomainModifier::execute() 33 : { 34 : // Compute the desired subdomain ID for the current element. 35 869938 : SubdomainID subdomain_id = computeSubdomainID(); 36 : 37 : // Don't do anything if subdomain ID is invalid 38 869938 : if (subdomain_id == Moose::INVALID_BLOCK_ID) 39 281821 : return; 40 : 41 : // If the current element's subdomain ID isn't what we want 42 588117 : if (_current_elem->subdomain_id() != subdomain_id) 43 26189 : _moved_elems[_current_elem->id()] = {_current_elem->subdomain_id(), subdomain_id}; 44 : } 45 : 46 : void 47 247 : ElementSubdomainModifier::threadJoin(const UserObject & in_uo) 48 : { 49 : // Join the data from uo into _this_ object: 50 247 : const auto & uo = static_cast<const ElementSubdomainModifier &>(in_uo); 51 : 52 247 : _moved_elems.insert(uo._moved_elems.begin(), uo._moved_elems.end()); 53 247 : } 54 : 55 : void 56 2663 : ElementSubdomainModifier::finalize() 57 : { 58 2663 : ElementSubdomainModifierBase::modify(_moved_elems); 59 2663 : }