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