https://mooseframework.inl.gov
NodalFunctionsL2NormPD.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "NodalFunctionsL2NormPD.h"
11 #include "Function.h"
12 
14 
17 {
19  params.addClassDescription("Class for computing the L2 norm of functions");
20 
21  params.addRequiredParam<std::vector<FunctionName>>("functions", "The known functions");
22 
23  return params;
24 }
25 
28 {
29  const std::vector<FunctionName> & func_names(getParam<std::vector<FunctionName>>("functions"));
30 
31  _n_funcs = func_names.size();
32 
33  for (unsigned int i = 0; i < _n_funcs; ++i)
34  _funcs.push_back(&getFunctionByName(func_names[i]));
35 }
36 
37 Real
39 {
41 }
42 
43 Real
45 {
46  Real func_val = 0;
47 
48  for (unsigned int i = 0; i < _n_funcs; ++i)
49  func_val += _funcs[i]->value(_t, *_current_node) * _funcs[i]->value(_t, *_current_node);
50 
51  return func_val;
52 }
Postprocessor class to compute a volume integral of the specified variable Note that specializations ...
std::vector< const Function * > _funcs
NodalFunctionsL2NormPD(const InputParameters &parameters)
const Node *const & _current_node
Postprocessor class to compute L2 norm of a given function for peridynamic discretization.
void addRequiredParam(const std::string &name, const std::string &doc_string)
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
virtual Real computeNodalValue() override
Function to evaluate the given function at each material point.
registerMooseObject("PeridynamicsApp", NodalFunctionsL2NormPD)
const T & getParam(const std::string &name) const
virtual Real getValue() const override
unsigned int _n_funcs
Known functions.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Function & getFunctionByName(const FunctionName &name) const
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)