LCOV - code coverage report
Current view: top level - src/postprocessors - TensorExtremeValuePostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/swift: #92 (25e020) with base b3cd84 Lines: 16 16 100.0 %
Date: 2025-09-10 17:10:32 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          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 "TensorExtremeValuePostprocessor.h"
      10             : 
      11             : registerMooseObject("SwiftApp", TensorExtremeValuePostprocessor);
      12             : 
      13             : InputParameters
      14         240 : TensorExtremeValuePostprocessor::validParams()
      15             : {
      16         240 :   InputParameters params = TensorPostprocessor::validParams();
      17         240 :   params.addClassDescription("Find extreme values in the Tensor buffer");
      18         480 :   MooseEnum valueType("MIN MAX");
      19         480 :   params.addParam<MooseEnum>("value_type", valueType, "Extreme value type");
      20         240 :   return params;
      21         240 : }
      22             : 
      23         120 : TensorExtremeValuePostprocessor::TensorExtremeValuePostprocessor(const InputParameters & parameters)
      24             :   : TensorPostprocessor(parameters),
      25         240 :     _value_type(getParam<MooseEnum>("value_type").getEnum<ValueType>())
      26             : {
      27         120 : }
      28             : 
      29             : void
      30        2808 : TensorExtremeValuePostprocessor::execute()
      31             : {
      32        5616 :   _value = _value_type == ValueType::MIN ? torch::min(_u).cpu().item<double>()
      33        5616 :                                          : torch::max(_u).cpu().item<double>();
      34        2808 : }
      35             : 
      36             : PostprocessorValue
      37        2808 : TensorExtremeValuePostprocessor::getValue() const
      38             : {
      39        2808 :   return _value;
      40             : }

Generated by: LCOV version 1.14