https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
19
24
25void
27{
28 // Clear moved elements from last execution
29 _moved_elems.clear();
30}
31
32void
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
47void
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
56void
Base class for mesh modifiers modifying element subdomains.
virtual void modify(const std::unordered_map< dof_id_type, std::pair< SubdomainID, SubdomainID > > &moved_elems)
Modify the element subdomains.
std::unordered_map< dof_id_type, std::pair< SubdomainID, SubdomainID > > _moved_elems
Element subdomain assignments.
void threadJoin(const UserObject &) override
Must override.
static InputParameters validParams()
void finalize() override
Finalize.
virtual SubdomainID computeSubdomainID()=0
Compute the subdomain ID of the current element.
void execute() override
Execute method.
ElementSubdomainModifier(const InputParameters &parameters)
void initialize() override
Called before execute() is ever called so that data can be cleared.
const Elem *const & _current_elem
The current element pointer (available during execute())
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Base class for user-specific data.
Definition UserObject.h:20
const SubdomainID INVALID_BLOCK_ID
Definition MooseTypes.C:20