LCOV - code coverage report
Current view: top level - src/postprocessors - OpenMCParticles.C (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: be601f Lines: 17 19 89.5 %
Date: 2025-07-15 20:50:38 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /********************************************************************/
       2             : /*                  SOFTWARE COPYRIGHT NOTIFICATION                 */
       3             : /*                             Cardinal                             */
       4             : /*                                                                  */
       5             : /*                  (c) 2021 UChicago Argonne, LLC                  */
       6             : /*                        ALL RIGHTS RESERVED                       */
       7             : /*                                                                  */
       8             : /*                 Prepared by UChicago Argonne, LLC                */
       9             : /*               Under Contract No. DE-AC02-06CH11357               */
      10             : /*                With the U. S. Department of Energy               */
      11             : /*                                                                  */
      12             : /*             Prepared by Battelle Energy Alliance, LLC            */
      13             : /*               Under Contract No. DE-AC07-05ID14517               */
      14             : /*                With the U. S. Department of Energy               */
      15             : /*                                                                  */
      16             : /*                 See LICENSE for full restrictions                */
      17             : /********************************************************************/
      18             : 
      19             : #ifdef ENABLE_OPENMC_COUPLING
      20             : 
      21             : #include "OpenMCParticles.h"
      22             : 
      23             : registerMooseObject("CardinalApp", OpenMCParticles);
      24             : 
      25             : InputParameters
      26          48 : OpenMCParticles::validParams()
      27             : {
      28          48 :   InputParameters params = GeneralPostprocessor::validParams();
      29          48 :   params += OpenMCBase::validParams();
      30          96 :   MooseEnum type("instantaneous total", "total");
      31          96 :   params.addParam<MooseEnum>("value_type", type,
      32             :       "How to report the number of particles; either instantaneous (the value used "
      33             :       "in the most recent solve) or total (accumulated over all previous Picard "
      34             :       "iterations");
      35             : 
      36          48 :   params.addClassDescription("Number of particles transported by OpenMC");
      37          48 :   return params;
      38          48 : }
      39             : 
      40          16 : OpenMCParticles::OpenMCParticles(const InputParameters & parameters)
      41             :   : GeneralPostprocessor(parameters),
      42             :     OpenMCBase(this, parameters),
      43          32 :     _type(getParam<MooseEnum>("value_type"))
      44             : {
      45          16 : }
      46             : 
      47             : Real
      48          48 : OpenMCParticles::getValue() const
      49             : {
      50          48 :   switch (_type)
      51             :   {
      52          24 :     case 0:
      53          24 :       return openmc::settings::n_batches * openmc::settings::n_particles;
      54          24 :     case 1:
      55          24 :       return openmc::settings::n_batches * _openmc_problem->nTotalParticles();
      56           0 :     default:
      57           0 :       mooseError("Unhandled type enum in OpenMCParticles!");
      58             :   }
      59             : }
      60             : 
      61             : #endif

Generated by: LCOV version 1.14