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