LCOV - code coverage report
Current view: top level - src/postprocessors - RMSDistance.C (source / functions) Hit Total Coverage
Test: idaholab/magpie: 5710af Lines: 27 28 96.4 %
Date: 2025-07-21 23:34:39 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /**********************************************************************/
       2             : /*                     DO NOT MODIFY THIS HEADER                      */
       3             : /* MAGPIE - Mesoscale Atomistic Glue Program for Integrated Execution */
       4             : /*                                                                    */
       5             : /*            Copyright 2017 Battelle Energy Alliance, LLC            */
       6             : /*                        ALL RIGHTS RESERVED                         */
       7             : /**********************************************************************/
       8             : 
       9             : #include "RMSDistance.h"
      10             : 
      11             : registerMooseObject("MooseApp", RMSDistance);
      12             : 
      13             : InputParameters
      14           9 : RMSDistance::validParams()
      15             : {
      16           9 :   InputParameters params = ElementIntegralVariablePostprocessor::validParams();
      17          18 :   params.addRequiredParam<Point>("point", "Point to which the RMS distance is computed");
      18           9 :   params.addClassDescription(
      19             :       "Computes the RMS distance of a distribution with respect to a fixed point.");
      20           9 :   return params;
      21           0 : }
      22             : 
      23           5 : RMSDistance::RMSDistance(const InputParameters & parameters)
      24             :   : ElementIntegralVariablePostprocessor(parameters),
      25           5 :     _var(_fe_problem.getStandardVariable(_tid, getParam<std::vector<VariableName>>("variable")[0])),
      26          15 :     _point(getParam<Point>("point"))
      27             : {
      28           5 : }
      29             : 
      30             : Real
      31      375000 : RMSDistance::computeQpIntegral()
      32             : {
      33      375000 :   _normalization += _JxW[_qp] * _coord[_qp] * _u[_qp];
      34      375000 :   return _mesh.minPeriodicVector(_var.number(), _point, _q_point[_qp]).norm_sq() * _u[_qp];
      35             : }
      36             : 
      37             : void
      38           5 : RMSDistance::initialize()
      39             : {
      40           5 :   ElementIntegralVariablePostprocessor::initialize();
      41           5 :   _normalization = 0;
      42           5 : }
      43             : 
      44             : void
      45           4 : RMSDistance::finalize()
      46             : {
      47           4 :   ElementIntegralVariablePostprocessor::finalize();
      48           4 :   gatherSum(_normalization);
      49           4 : }
      50             : 
      51             : Real
      52           4 : RMSDistance::getValue() const
      53             : {
      54           4 :   Real integral = ElementIntegralVariablePostprocessor::getValue();
      55           4 :   return std::sqrt(integral / _normalization);
      56             : }
      57             : 
      58             : void
      59           1 : RMSDistance::threadJoin(const UserObject & y)
      60             : {
      61           1 :   ElementIntegralVariablePostprocessor::threadJoin(y);
      62             :   const RMSDistance & pps = static_cast<const RMSDistance &>(y);
      63           1 :   _normalization += pps._normalization;
      64           1 : }

Generated by: LCOV version 1.14