LCOV - code coverage report
Current view: top level - include/userobjects - SpatialBinUserObject.h (source / functions) Hit Total Coverage
Test: neams-th-coe/cardinal: be601f Lines: 5 5 100.0 %
Date: 2025-07-15 20:50:38 Functions: 5 5 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 "GeneralUserObject.h"
      22             : 
      23             : /**
      24             :  * Class that provides a bin index given a spatial coordinate
      25             :  */
      26             : class SpatialBinUserObject : public GeneralUserObject
      27             : {
      28             : public:
      29             :   static InputParameters validParams();
      30             : 
      31             :   SpatialBinUserObject(const InputParameters & parameters);
      32             : 
      33        1168 :   virtual void execute() final {}
      34        1168 :   virtual void initialize() final {}
      35        1168 :   virtual void finalize() final {}
      36             : 
      37             :   virtual Real spatialValue(const Point & p) const override;
      38             : 
      39             :   /**
      40             :    * Get the bin index from a spatial point
      41             :    * @param[in] p point
      42             :    * @return bin index
      43             :    */
      44             :   virtual unsigned int bin(const Point & p) const = 0;
      45             : 
      46             :   /**
      47             :    * Get the total number of bins
      48             :    * @return total number of bins
      49             :    */
      50             :   virtual unsigned int num_bins() const = 0;
      51             : 
      52             :   /**
      53             :    * Get the bin given a point in an array of bounding points between layers
      54             :    * @param[in] pt point along axis of the bounding points
      55             :    * @param[in] bounds vector of bounding points
      56             :    * @return layer
      57             :    */
      58             :   unsigned int binFromBounds(const Real & pt, const std::vector<Real> & bounds) const;
      59             : 
      60             :   /**
      61             :    * Get the bin centers
      62             :    * @return bin centers
      63             :    */
      64      109810 :   virtual const std::vector<Point> & getBinCenters() const { return _bin_centers; }
      65             : 
      66             :   /**
      67             :    * Get the coordinate directions (x, y, z) along which the bin distribution specifies
      68             :    * the bins. For 1-D distributions, this will be just one of x, y, and z. For 2-D
      69             :    * distributions, this will be a combination of x-y, y-z, or x-z.
      70             :    */
      71      110215 :   virtual const std::vector<unsigned int> directions() const { return _directions; }
      72             : 
      73             : protected:
      74             :   /// Center coordinates of the bins
      75             :   std::vector<Point> _bin_centers;
      76             : 
      77             :   /// Directions along which the bin defines points
      78             :   std::vector<unsigned int> _directions;
      79             : };

Generated by: LCOV version 1.14