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 43744 : ElementSubdomainModifier::validParams() 14 : { 15 43744 : InputParameters params = ElementSubdomainModifierBase::validParams(); 16 43744 : return params; 17 : } 18 : 19 493 : ElementSubdomainModifier::ElementSubdomainModifier(const InputParameters & parameters) 20 493 : : ElementSubdomainModifierBase(parameters) 21 : { 22 493 : } 23 : 24 : void 25 3153 : ElementSubdomainModifier::initialize() 26 : { 27 : // Clear moved elements from last execution 28 3153 : _moved_elems.clear(); 29 3153 : } 30 : 31 : void 32 982646 : ElementSubdomainModifier::execute() 33 : { 34 : // Compute the desired subdomain ID for the current element. 35 982646 : SubdomainID subdomain_id = computeSubdomainID(); 36 : 37 : // Don't do anything if subdomain ID is invalid 38 982646 : if (subdomain_id == Moose::INVALID_BLOCK_ID) 39 320329 : return; 40 : 41 : // If the current element's subdomain ID isn't what we want 42 662317 : if (_current_elem->subdomain_id() != subdomain_id) 43 29465 : _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 2906 : ElementSubdomainModifier::finalize() 57 : { 58 2906 : ElementSubdomainModifierBase::modify(_moved_elems); 59 2906 : }