LCOV - code coverage report
Current view: top level - include/filters - FilterBase.h (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: be601f Lines: 2 3 66.7 %
Date: 2025-07-15 20:50:38 Functions: 1 1 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             : #pragma once
      20             : 
      21             : #include "MooseObject.h"
      22             : 
      23             : #include "openmc/tallies/filter.h"
      24             : 
      25             : /// Forward declarations.
      26             : class OpenMCCellAverageProblem;
      27             : 
      28             : /**
      29             :  * A class which provides a thin wrapper around an OpenMC Filter for
      30             :  * the purposes of adding a tally via the MOOSE input syntax. This
      31             :  * class does not need init / reset functions as non-spatial tallies
      32             :  * don't change during simulation execution (at the moment).
      33             :  *
      34             :  * The filter system should NOT wrap spatial filters as the problem
      35             :  * geometry (through the MoabSkinner) will change during execution.
      36             :  * The OpenMC -> MOOSE mesh data transfer also prevents the use of
      37             :  * spatial filters in this system. Create a new tally object if a
      38             :  * different spatial filter is required.
      39             :  */
      40           0 : class FilterBase : public MooseObject
      41             : {
      42             : public:
      43             :   static InputParameters validParams();
      44             : 
      45             :   FilterBase(const InputParameters & parameters);
      46             : 
      47             :   /**
      48             :    * Whether a specific bin should be skipped when computing sums and means for normalization.
      49             :    * This is useful for functional expansion filters, where not all bins represent an average.
      50             :    * @param[in] bin the filter bin
      51             :    * @return whether the bin should be skipped.
      52             :    */
      53        2272 :   virtual bool skipBin(const unsigned int bin) const { return false; };
      54             : 
      55             :   /**
      56             :    * A function which returns the short-form name for each bin of
      57             :    * this filter. Used to label auxvariables a TallyBase scores in.
      58             :    * Each derived filter must override this function.
      59             :    * @param[in] bin_index the bin index
      60             :    * @return a short name for the bin represented by bin_index
      61             :    */
      62             :   virtual std::string binName(unsigned int bin_index) const = 0;
      63             : 
      64             :   /**
      65             :    * A function which gets the number of bins in the wrapped filter.
      66             :    * @return the number of bins in the filter
      67             :    */
      68       11456 :   int numBins() const { return _filter->n_bins(); }
      69             : 
      70             :   /**
      71             :    * Get the OpenMC filter that this object wraps.
      72             :    * @return the OpenMC filter object
      73             :    */
      74             :   openmc::Filter * getWrappedFilter();
      75             : 
      76             : protected:
      77             :   /// The OpenMCCellAverageProblem using the tally system.
      78             :   OpenMCCellAverageProblem & _openmc_problem;
      79             : 
      80             :   /// The OpenMC filter this class wraps.
      81             :   openmc::Filter * _filter = nullptr;
      82             : 
      83             :   /// The index of the OpenMC filter this class wraps.
      84             :   unsigned int _filter_index;
      85             : };

Generated by: LCOV version 1.14