https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ElementOptimizationFunctionInnerProduct.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
14{
17 params.addClassDescription("Computes the inner product of variable with parameterized source "
18 "function for optimization gradient computation.");
19 return params;
20}
21
23 const InputParameters & parameters)
26 _var(coupledValue("variable")),
27 _vec(declareVector("inner_product"))
28{
29}
30
31void
36
37void
39{
40 for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
41 {
42 const Real q_inner_product = _JxW[_qp] * _coord[_qp] * computeQpInnerProduct();
43 update(_q_point[_qp], q_inner_product);
44 }
45}
46
47void
49{
50 const auto & vpp = static_cast<const ElementOptimizationFunctionInnerProduct &>(y);
51 add(vpp);
52}
53
54void
const std::vector< double > y
virtual Real computeQpInnerProduct()=0
Used to compute the inner product at a certain quadrature point.
VectorPostprocessorValue & _vec
Vector holding inner product.
ElementOptimizationFunctionInnerProduct(const InputParameters &parameters)
virtual void threadJoin(const UserObject &uo) override
const MooseArray< Real > & _coord
const MooseArray< Real > & _JxW
const MooseArray< Point > & _q_point
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
void setCurrentTime(Real time, Real dt)
This function sets up member variables for the inner product accumulation at certain time.
void add(const OptimizationFunctionInnerProductHelper &other)
Accumulates inner product integration in _curr_time_ip vector from another object.
void update(const Point &q_point, Real q_inner_product)
Accumulates integration for inner product by multiplying the given value by the function's parameterG...
void getVector(std::vector< Real > &result)
Gathers _curr_time_ip from other processors and performs time integration.