Line data Source code
1 : /**********************************************************************/ 2 : /* DO NOT MODIFY THIS HEADER */ 3 : /* Swift, a Fourier spectral solver for MOOSE */ 4 : /* */ 5 : /* Copyright 2024 Battelle Energy Alliance, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /**********************************************************************/ 8 : 9 : #include "TensorAveragePostprocessor.h" 10 : 11 : registerMooseObject("SwiftApp", TensorAveragePostprocessor); 12 : 13 : InputParameters 14 8 : TensorAveragePostprocessor::validParams() 15 : { 16 8 : InputParameters params = TensorPostprocessor::validParams(); 17 8 : params.addClassDescription("Compute the average value over a buffer."); 18 8 : return params; 19 0 : } 20 : 21 4 : TensorAveragePostprocessor::TensorAveragePostprocessor(const InputParameters & parameters) 22 4 : : TensorPostprocessor(parameters) 23 : { 24 4 : } 25 : 26 : void 27 4 : TensorAveragePostprocessor::execute() 28 : { 29 4 : _average = _u.sum().cpu().item<double>() / torch::numel(_u); 30 4 : } 31 : 32 : PostprocessorValue 33 4 : TensorAveragePostprocessor::getValue() const 34 : { 35 4 : return _average; 36 : }