Cardinal
NearestPointReceiver.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 "GeneralUserObject.h"
22 
23 #include "libmesh/point.h"
24 
29 class NearestPointReceiver : public GeneralUserObject
30 {
31 public:
32  NearestPointReceiver(const InputParameters & parameters);
33  static InputParameters validParams();
34 
35  virtual ~NearestPointReceiver();
36 
37  virtual void initialize() override {}
38  virtual void execute() override;
39  virtual void finalize() override {}
40 
41  virtual Real spatialValue(const Point & p) const override;
42 
43  const std::vector<Point> & positions() { return _positions; }
44 
45  void setValues(const std::vector<Real> & values);
46 
47 protected:
51  unsigned int nearestPosition(const Point & p) const;
52 
53  const std::vector<Point> & _positions;
54 
55  std::vector<Real> _data;
56 };
NearestPointReceiver(const InputParameters &parameters)
Definition: NearestPointReceiver.C:39
virtual void initialize() override
Definition: NearestPointReceiver.h:37
virtual ~NearestPointReceiver()
Definition: NearestPointReceiver.C:54
unsigned int nearestPosition(const Point &p) const
Definition: NearestPointReceiver.C:79
void setValues(const std::vector< Real > &values)
Definition: NearestPointReceiver.C:70
static InputParameters validParams()
Definition: NearestPointReceiver.C:24
virtual void finalize() override
Definition: NearestPointReceiver.h:39
const std::vector< Point > & positions()
Definition: NearestPointReceiver.h:43
virtual Real spatialValue(const Point &p) const override
Definition: NearestPointReceiver.C:62
const std::vector< Point > & _positions
Definition: NearestPointReceiver.h:53
virtual void execute() override
Definition: NearestPointReceiver.C:57
std::vector< Real > _data
Definition: NearestPointReceiver.h:55
Definition: NearestPointReceiver.h:29