www.mooseframework.org
AccumulateAux.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
8 #include "AccumulateAux.h"
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<AuxKernel>();
15  params.addRequiredCoupledVar(
16  "accumulate_from_variable",
17  "Variable whose values are to be accumulated into the current variable");
18  return params;
19 }
20 
21 AccumulateAux::AccumulateAux(const InputParameters & parameters)
22  : AuxKernel(parameters), _values(coupledComponents("accumulate_from_variable"))
23 {
24  for (auto i = beginIndex(_values); i < _values.size(); ++i)
25  _values[i] = &coupledValue("accumulate_from_variable", i);
26 }
27 
28 Real
30 {
31  Real ret = _u_old[_qp];
32  for (const auto & value : _values)
33  ret += (*value)[_qp];
34  return ret;
35 }
InputParameters validParams< AccumulateAux >()
Definition: AccumulateAux.C:12
virtual Real computeValue()
Definition: AccumulateAux.C:29
AccumulateAux(const InputParameters &parameters)
Definition: AccumulateAux.C:21
std::vector< const VariableValue * > _values
Definition: AccumulateAux.h:30