www.mooseframework.org
SideValueSampler.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #include "SideValueSampler.h"
16 
17 // MOOSE includes
18 #include "MooseVariable.h"
19 
20 #include "libmesh/quadrature.h"
21 
22 template <>
25 {
27 
28  params += validParams<SamplerBase>();
29 
30  params.addRequiredCoupledVar(
31  "variable", "The names of the variables that this VectorPostprocessor operates on");
32 
33  return params;
34 }
35 
37  : SideVectorPostprocessor(parameters), SamplerBase(parameters, this, _communicator)
38 {
39  std::vector<std::string> var_names(_coupled_moose_vars.size());
40  _values.resize(_coupled_moose_vars.size());
41 
42  for (unsigned int i = 0; i < _coupled_moose_vars.size(); i++)
43  var_names[i] = _coupled_moose_vars[i]->name();
44 
45  // Initialize the datastructions in SamplerBase
46  SamplerBase::setupVariables(var_names);
47 }
48 
49 void
51 {
53 }
54 
55 void
57 {
58  for (unsigned int _qp = 0; _qp < _qrule->n_points(); _qp++)
59  {
60  for (unsigned int i = 0; i < _coupled_moose_vars.size(); i++)
61  _values[i] = _coupled_moose_vars[i]->sln()[_qp];
62 
64  }
65 }
66 
67 void
69 {
71 }
72 
73 void
75 {
76  const SideValueSampler & vpp = static_cast<const SideValueSampler &>(y);
77 
79 }
const std::string & name() const
Get the name of the object.
Definition: MooseObject.h:47
Base class for VectorPostprocessors that need to do "sampling" of values in the domain.
Definition: SamplerBase.h:46
virtual void initialize()
Initialize the datastructures.
Definition: SamplerBase.C:75
std::vector< MooseVariable * > _coupled_moose_vars
Vector of coupled variables.
Definition: Coupleable.h:324
SideValueSampler(const InputParameters &parameters)
std::vector< Real > _values
So we don&#39;t have to create and destroy this vector over and over again.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const MooseArray< Point > & _q_point
virtual void finalize() override
Finalize the values.
void setupVariables(const std::vector< std::string > &variable_names)
You MUST call this in the constructor of the child class and pass down the name of the variables...
Definition: SamplerBase.C:51
unsigned int _qp
virtual void threadJoin(const SamplerBase &y)
Join the values.
Definition: SamplerBase.C:141
InputParameters validParams< SideValueSampler >()
InputParameters validParams< SideVectorPostprocessor >()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
This method adds a coupled variable name pair.
virtual void finalize()
Finalize the values.
Definition: SamplerBase.C:87
virtual void addSample(const Point &p, const Real &id, const std::vector< Real > &values)
Call this with the value of every variable at each point you want to sample at.
Definition: SamplerBase.C:61
InputParameters validParams< SamplerBase >()
Definition: SamplerBase.C:26
virtual void threadJoin(const UserObject &y) override
Must override.
virtual void execute() override
Execute method.
const Elem *& _current_elem
virtual void initialize() override
Initialize the datastructures.
Base class for user-specific data.
Definition: UserObject.h:42