www.mooseframework.org
GeometryBase.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 "GeometryBase.h"
16 #include "MooseMesh.h"
17 #include "libmesh/mesh_base.h"
18 
19 template <>
22 {
24  params.addClassDescription("Snap refined nodes on a given boundary to a given geometry");
25  params.addParam<std::vector<BoundaryName>>(
26  "boundary", "List of boundaries whose nodes are snapped to a given geometry");
27  return params;
28 }
29 
31  : GeneralUserObject(parameters),
32  _mesh(_subproblem.mesh()),
33  _boundary_ids(_mesh.getBoundaryIDs(getParam<std::vector<BoundaryName>>("boundary")))
34 {
35 }
36 
37 void
39 {
40 }
41 
42 void
44 {
45 }
46 
47 void
49 {
50 }
51 
52 void
54 {
55  auto & mesh = _mesh.getMesh();
56 
57  for (auto & boundary_id : _boundary_ids)
58  {
59  auto node_ids = _mesh.getNodeList(boundary_id);
60  for (auto & node_id : node_ids)
61  {
62  auto & node = mesh.node_ref(node_id);
63 
64  snapNode(node);
65  }
66  }
67 }
GeometryBase(const InputParameters &parameters)
Definition: GeometryBase.C:30
virtual void initialize() final
Called before execute() is ever called so that data can be cleared.
Definition: GeometryBase.C:38
virtual void execute() final
Execute method.
Definition: GeometryBase.C:43
const std::vector< BoundaryID > _boundary_ids
List of boundaries (or node sets) that will be snapped to a geometry.
Definition: GeometryBase.h:52
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters validParams< GeneralUserObject >()
InputParameters validParams< GeometryBase >()
Definition: GeometryBase.C:21
MeshBase & getMesh()
Accessor for the underlying libMesh Mesh object.
Definition: MooseMesh.C:2408
virtual void finalize() final
Finalize.
Definition: GeometryBase.C:48
virtual void meshChanged() final
Called on this object when the mesh changes.
Definition: GeometryBase.C:53
MooseMesh & _mesh
Reference to teh current simulation mesh.
Definition: GeometryBase.h:49
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an option parameter and a documentation string to the InputParameters object...
const std::vector< dof_id_type > & getNodeList(boundary_id_type nodeset_id) const
Return a writable reference to a vector of node IDs that belong to nodeset_id.
Definition: MooseMesh.C:2435
virtual void snapNode(Node &node)=0
Override this method in derived classes to implement a specific geometry.