NuTo
Numerics Tool
Equation.h
Go to the documentation of this file.
1 #pragma once
2 #include <vector>
4 
5 namespace NuTo
6 {
7 namespace Constraint
8 {
9 typedef std::function<double(double)> RhsFunction;
10 
12 class Equation
13 {
14 public:
19  Equation(const NodeSimple& dependentNode, int dependentComponent, RhsFunction rhs)
20  : mRhs(rhs)
21  , mDependentTerm(dependentNode, dependentComponent, 1)
22  {
23  }
24 
28  {
29  mIndependentTerms.push_back(term);
30  }
31 
35  double GetRhs(double time) const
36  {
37  return mRhs(time);
38  }
39 
41  const Term& GetDependentTerm() const
42  {
43  return mDependentTerm;
44  }
45 
47  const std::vector<Term>& GetIndependentTerms() const
48  {
49  return mIndependentTerms;
50  }
51 
53  {
54  return mDependentTerm.GetConstrainedDofNumber();
55  }
56 
57 private:
59  RhsFunction mRhs;
60 
62  Term mDependentTerm;
63 
65  std::vector<Term> mIndependentTerms;
66 };
67 
68 } /* Constaint */
69 } /* NuTo */
const std::vector< Term > & GetIndependentTerms() const
getter for mTerms
Definition: Equation.h:47
Store node values and its dof.
Definition: NodeSimple.h:11
stores a constraint equation
Definition: Equation.h:12
Equation(const NodeSimple &dependentNode, int dependentComponent, RhsFunction rhs)
ctor with constant rhs, defaults to 0
Definition: Equation.h:19
int GetDependentDofNumber() const
Definition: Equation.h:52
void AddIndependentTerm(Term term)
adds a term to the equation
Definition: Equation.h:27
const Term & GetDependentTerm() const
getter for mTerms
Definition: Equation.h:41
Definition: Exception.h:6
rhs
Definition: SparseDirectSolverMKLDSS.py:46
std::function< double(double)> RhsFunction
Definition: Equation.h:9
int GetConstrainedDofNumber() const
Definition: Term.h:48
double GetRhs(double time) const
evaluates the rhs function at a given time
Definition: Equation.h:35
stores constraint equation terms
Definition: Term.h:10