https://mooseframework.inl.gov
ElementSubdomainModifier.C
Go to the documentation of this file.
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 
12 
15 {
17  return params;
18 }
19 
21  : ElementSubdomainModifierBase(parameters)
22 {
23 }
24 
25 void
27 {
28  // Clear moved elements from last execution
29  _moved_elems.clear();
30 }
31 
32 void
34 {
35  // Compute the desired subdomain ID for the current element.
36  SubdomainID subdomain_id = computeSubdomainID();
37 
38  // Don't do anything if subdomain ID is invalid
39  if (subdomain_id == Moose::INVALID_BLOCK_ID)
40  return;
41 
42  // If the current element's subdomain ID isn't what we want
43  if (_current_elem->subdomain_id() != subdomain_id)
44  _moved_elems[_current_elem->id()] = {_current_elem->subdomain_id(), subdomain_id};
45 }
46 
47 void
49 {
50  // Join the data from uo into _this_ object:
51  const auto & uo = static_cast<const ElementSubdomainModifier &>(in_uo);
52 
53  _moved_elems.insert(uo._moved_elems.begin(), uo._moved_elems.end());
54 }
55 
56 void
58 {
60 }
void finalize() override
Finalize.
void initialize() override
Called before execute() is ever called so that data can be cleared.
std::unordered_map< dof_id_type, std::pair< SubdomainID, SubdomainID > > _moved_elems
Element subdomain assignments.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
const SubdomainID INVALID_BLOCK_ID
Definition: MooseTypes.C:20
virtual void modify(const std::unordered_map< dof_id_type, std::pair< SubdomainID, SubdomainID >> &moved_elems)
Modify the element subdomains.
virtual SubdomainID computeSubdomainID()=0
Compute the subdomain ID of the current element.
void execute() override
Execute method.
ElementSubdomainModifier(const InputParameters &parameters)
void threadJoin(const UserObject &) override
Must override.
const Elem *const & _current_elem
The current element pointer (available during execute())
Base class for mesh modifiers modifying element subdomains.
Base class for user-specific data.
Definition: UserObject.h:40