Cardinal
SpatialBinUserObject.h
Go to the documentation of this file.
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 "ThreadedGeneralUserObject.h"
22 
26 class SpatialBinUserObject : public ThreadedGeneralUserObject
27 {
28 public:
29  static InputParameters validParams();
30 
31  SpatialBinUserObject(const InputParameters & parameters);
32 
33  virtual void execute() final {}
34  virtual void initialize() final {}
35  virtual void finalize() final {}
36 
37  virtual Real spatialValue(const Point & p) const override;
38 
44  virtual unsigned int bin(const Point & p) const = 0;
45 
50  virtual unsigned int num_bins() const = 0;
51 
58  unsigned int binFromBounds(const Real & pt, const std::vector<Real> & bounds) const;
59 
64  virtual const std::vector<Point> & getBinCenters() const { return _bin_centers; }
65 
71  virtual const std::vector<unsigned int> directions() const { return _directions; }
72 
73 protected:
75  std::vector<Point> _bin_centers;
76 
78  std::vector<unsigned int> _directions;
79 };
unsigned int binFromBounds(const Real &pt, const std::vector< Real > &bounds) const
Definition: SpatialBinUserObject.C:41
Definition: SpatialBinUserObject.h:26
static InputParameters validParams()
Definition: SpatialBinUserObject.C:23
virtual const std::vector< Point > & getBinCenters() const
Definition: SpatialBinUserObject.h:64
virtual Real spatialValue(const Point &p) const override
Definition: SpatialBinUserObject.C:35
std::vector< Point > _bin_centers
Center coordinates of the bins.
Definition: SpatialBinUserObject.h:75
SpatialBinUserObject(const InputParameters &parameters)
Definition: SpatialBinUserObject.C:29
std::vector< unsigned int > _directions
Directions along which the bin defines points.
Definition: SpatialBinUserObject.h:78
virtual const std::vector< unsigned int > directions() const
Definition: SpatialBinUserObject.h:71
virtual void finalize() final
Definition: SpatialBinUserObject.h:35
virtual unsigned int bin(const Point &p) const =0
virtual void execute() final
Definition: SpatialBinUserObject.h:33
virtual void initialize() final
Definition: SpatialBinUserObject.h:34
virtual unsigned int num_bins() const =0