Line data Source code
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 "ElementOptimizationFunctionInnerProduct.h" 11 : 12 : InputParameters 13 627 : ElementOptimizationFunctionInnerProduct::validParams() 14 : { 15 627 : InputParameters params = ElementVariableVectorPostprocessor::validParams(); 16 627 : params += OptimizationFunctionInnerProductHelper::validParams(); 17 627 : params.addClassDescription("Computes the inner product of variable with parameterized source " 18 : "function for optimization gradient computation."); 19 627 : return params; 20 0 : } 21 : 22 318 : ElementOptimizationFunctionInnerProduct::ElementOptimizationFunctionInnerProduct( 23 318 : const InputParameters & parameters) 24 : : ElementVariableVectorPostprocessor(parameters), 25 : OptimizationFunctionInnerProductHelper(parameters), 26 318 : _var(coupledValue("variable")), 27 636 : _vec(declareVector("inner_product")) 28 : { 29 318 : } 30 : 31 : void 32 9045 : ElementOptimizationFunctionInnerProduct::initialize() 33 : { 34 9045 : setCurrentTime(_t, _dt); 35 9045 : } 36 : 37 : void 38 796250 : ElementOptimizationFunctionInnerProduct::execute() 39 : { 40 3718708 : for (_qp = 0; _qp < _qrule->n_points(); ++_qp) 41 : { 42 2922458 : const Real q_inner_product = _JxW[_qp] * _coord[_qp] * computeQpInnerProduct(); 43 2922458 : update(_q_point[_qp], q_inner_product); 44 : } 45 796250 : } 46 : 47 : void 48 66 : ElementOptimizationFunctionInnerProduct::threadJoin(const UserObject & y) 49 : { 50 : const auto & vpp = static_cast<const ElementOptimizationFunctionInnerProduct &>(y); 51 66 : add(vpp); 52 66 : } 53 : 54 : void 55 8979 : ElementOptimizationFunctionInnerProduct::finalize() 56 : { 57 8979 : getVector(_vec); 58 8979 : }