www.mooseframework.org
BndsCalcAux.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 #include "BndsCalcAux.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<AuxKernel>();
14  params.addClassDescription("Calculate location of grain boundaries in a polycrystalline sample");
15  params.addRequiredCoupledVarWithAutoBuild(
16  "v", "var_name_base", "op_num", "Array of coupled variables");
17  return params;
18 }
19 
20 BndsCalcAux::BndsCalcAux(const InputParameters & parameters)
21  : AuxKernel(parameters), _op_num(coupledComponents("v")), _vals(_op_num)
22 {
23  for (unsigned int i = 0; i < _op_num; ++i)
24  _vals[i] = &coupledValue("v", i);
25 }
26 
27 Real
29 {
30  Real value = 0.0;
31 
32  for (unsigned int i = 0; i < _op_num; ++i)
33  value += (*_vals[i])[_qp] * (*_vals[i])[_qp];
34 
35  return value;
36 }
const unsigned int _op_num
Definition: BndsCalcAux.h:29
BndsCalcAux(const InputParameters &parameters)
Definition: BndsCalcAux.C:20
std::vector< const VariableValue * > _vals
Definition: BndsCalcAux.h:30
virtual Real computeValue()
Definition: BndsCalcAux.C:28
InputParameters validParams< BndsCalcAux >()
Definition: BndsCalcAux.C:11