https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
37Real
42
43Real
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}
registerMooseObject("PeridynamicsApp", NodalFunctionsL2NormPD)
const Function & getFunctionByName(const FunctionName &name) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
const T & getParam(const std::string &name) const
Postprocessor class to compute L2 norm of a given function for peridynamic discretization.
NodalFunctionsL2NormPD(const InputParameters &parameters)
std::vector< const Function * > _funcs
static InputParameters validParams()
virtual Real getValue() const override
virtual Real computeNodalValue() override
Function to evaluate the given function at each material point.
unsigned int _n_funcs
Known functions.
Postprocessor class to compute a volume integral of the specified variable Note that specializations ...
const Node *const & _current_node