NuTo
Numerics Tool
Term.h
Go to the documentation of this file.
1 #pragma once
2 #include "nuto/base/Exception.h"
4 
5 namespace NuTo
6 {
7 namespace Constraint
8 {
10 class Term
11 {
12 public:
18  Term(const NodeSimple& node, int component, double coefficient)
19  : mNode(node)
20  , mComponent(component)
21  , mCoefficient(coefficient)
22  {
23  if (component >= node.GetNumValues())
24  throw Exception(__PRETTY_FUNCTION__, "Term construction failed. Node has " +
25  std::to_string(node.GetNumValues()) +
26  " components and you tried to constrain component " +
27  std::to_string(component) + ".");
28  }
29 
31  const NodeSimple& GetNode() const
32  {
33  return mNode;
34  }
35 
37  int GetComponent() const
38  {
39  return mComponent;
40  }
41 
43  double GetCoefficient() const
44  {
45  return mCoefficient;
46  }
47 
49  {
50  return mNode.get().GetDofNumber(mComponent);
51  }
52 
53 private:
57  std::reference_wrapper<const NodeSimple> mNode;
58 
60  int mComponent;
61 
63  double mCoefficient;
64 };
65 
66 } /* Constaint */
67 } /* NuTo */
double GetCoefficient() const
getter for mCoefficient
Definition: Term.h:43
Store node values and its dof.
Definition: NodeSimple.h:11
Base class for all exceptions thrown in NuTo.
Definition: Exception.h:9
int GetComponent() const
getter for mComponent
Definition: Term.h:37
int GetNumValues() const
Definition: NodeSimple.h:82
Term(const NodeSimple &node, int component, double coefficient)
ctor that sets all members so that the term consists of ...
Definition: Term.h:18
node
Definition: Brick8NCoupling.py:104
Definition: Exception.h:6
int GetConstrainedDofNumber() const
Definition: Term.h:48
const NodeSimple & GetNode() const
getter for mNode
Definition: Term.h:31
stores constraint equation terms
Definition: Term.h:10