https://mooseframework.inl.gov
Loading...
Searching...
No Matches
GeometricalComponent.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#include "ConstantFunction.h"
12#include "THMMesh.h"
13
20
22 : Component(parameters)
23{
24}
25
26Elem *
28 const std::vector<dof_id_type> & node_ids)
29{
30 auto elem = mesh().addElement(elem_type, node_ids);
31 _elem_ids.push_back(elem->id());
32 return elem;
33}
34
35Elem *
36GeometricalComponent::addElementEdge2(dof_id_type node0, dof_id_type node1)
37{
38 auto elem = mesh().addElementEdge2(node0, node1);
39 _elem_ids.push_back(elem->id());
40 return elem;
41}
42
43Elem *
44GeometricalComponent::addElementEdge3(dof_id_type node0, dof_id_type node1, dof_id_type node2)
45{
46 auto elem = mesh().addElementEdge3(node0, node1, node2);
47 _elem_ids.push_back(elem->id());
48 return elem;
49}
50
51Elem *
53 dof_id_type node1,
54 dof_id_type node2,
55 dof_id_type node3)
56{
57 auto elem = mesh().addElementQuad4(node0, node1, node2, node3);
58 _elem_ids.push_back(elem->id());
59 return elem;
60}
61
62Elem *
64 dof_id_type node1,
65 dof_id_type node2,
66 dof_id_type node3,
67 dof_id_type node4,
68 dof_id_type node5,
69 dof_id_type node6,
70 dof_id_type node7,
71 dof_id_type node8)
72{
73 auto elem = mesh().addElementQuad9(node0, node1, node2, node3, node4, node5, node6, node7, node8);
74 _elem_ids.push_back(elem->id());
75 return elem;
76}
77
78const FunctionName &
79GeometricalComponent::getVariableFn(const FunctionName & fn_param_name)
80{
81 const FunctionName & fn_name = getParam<FunctionName>(fn_param_name);
82 const Function & fn = getTHMProblem().getFunction(fn_name);
83
84 if (dynamic_cast<const ConstantFunction *>(&fn) != nullptr)
85 {
86 connectObject(fn.parameters(), fn_name, fn_param_name, "value");
87 }
88
89 return fn_name;
90}
Base class for THM components.
Definition Component.h:32
THMProblem & getTHMProblem() const
Gets the THM problem.
Definition Component.C:135
std::vector< dof_id_type > _elem_ids
Element IDs of this component.
Definition Component.h:508
void connectObject(const InputParameters &obj_params, const std::string &obj_name, const std::string &param) const
Connects a controllable parameter of the component to a controllable parameter of a constituent objec...
Definition Component.C:98
THMMesh & mesh()
Non-const reference to THM mesh, which can only be called before the end of mesh setup.
Definition Component.C:60
static InputParameters validParams()
Definition Component.C:18
virtual Function & getFunction(const std::string &name, const THREAD_ID tid=0)
GeometricalComponent(const InputParameters &parameters)
Elem * addElementEdge3(dof_id_type node0, dof_id_type node1, dof_id_type node2)
static InputParameters validParams()
Elem * addElementQuad4(dof_id_type node0, dof_id_type node1, dof_id_type node2, dof_id_type node3)
Elem * addElementEdge2(dof_id_type node0, dof_id_type node1)
const FunctionName & getVariableFn(const FunctionName &fn_param_name)
Makes a constant function parameter controllable and returns its name.
Elem * addElementQuad9(dof_id_type node0, dof_id_type node1, dof_id_type node2, dof_id_type node3, dof_id_type node4, dof_id_type node5, dof_id_type node6, dof_id_type node7, dof_id_type node8)
Elem * addElement(libMesh::ElemType elem_type, const std::vector< dof_id_type > &node_ids)
const InputParameters & parameters() const
Elem * addElementQuad4(dof_id_type node0, dof_id_type node1, dof_id_type node2, dof_id_type node3)
Definition THMMesh.C:155
Elem * addElement(libMesh::ElemType elem_type, const std::vector< dof_id_type > &node_ids)
Add a new element into the mesh.
Definition THMMesh.C:103
Elem * addElementEdge2(dof_id_type node0, dof_id_type node1)
Definition THMMesh.C:128
Elem * addElementEdge3(dof_id_type node0, dof_id_type node1, dof_id_type node2)
Definition THMMesh.C:141
Elem * addElementQuad9(dof_id_type node0, dof_id_type node1, dof_id_type node2, dof_id_type node3, dof_id_type node4, dof_id_type node5, dof_id_type node6, dof_id_type node7, dof_id_type node8)
Definition THMMesh.C:170