www.mooseframework.org
AssignSubdomainID.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "AssignSubdomainID.h"
16 #include "MooseMesh.h"
17 
18 template <>
21 {
23  params.addRequiredParam<SubdomainID>("subdomain_id", "New subdomain IDs of all elements");
24  return params;
25 }
26 
28  : MeshModifier(parameters), _subdomain_id(getParam<SubdomainID>("subdomain_id"))
29 {
30 }
31 
32 void
34 {
35  for (auto & elem : _mesh_ptr->getMesh().element_ptr_range())
36  elem->subdomain_id() = _subdomain_id;
37 }
AssignSubdomainID(const InputParameters &parameters)
subdomain_id_type SubdomainID
Definition: MooseTypes.h:77
MeshModifiers are objects that can modify or add to an existing mesh.
Definition: MeshModifier.h:31
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
MooseMesh * _mesh_ptr
Pointer to the mesh.
Definition: MeshModifier.h:74
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:2355
virtual void modify() override
Pure virtual modify function MUST be overridden by children classes.
SubdomainID _subdomain_id
The subdomain ID to assign to every elemennt.
InputParameters validParams< AssignSubdomainID >()
InputParameters validParams< MeshModifier >()
Definition: MeshModifier.C:20