Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #pragma once 11 : 12 : // MOOSE includes 13 : #include "SpatialUserObjectFunctor.h" 14 : #include "PointVariableSamplerBase.h" 15 : 16 : class LineValueSampler : public SpatialUserObjectFunctor<PointVariableSamplerBase> 17 : { 18 : public: 19 : static InputParameters validParams(); 20 : 21 : LineValueSampler(const InputParameters & parameters); 22 : 23 : /** 24 : * Helper function to generate the list of points along a line and a unique ID for each point. 25 : * @param start_point The beginning of the line 26 : * @param end_point The end of the line 27 : * @param num_points The number of points along the line 28 : * @param points The vector of points to fill in 29 : * @param ids The vector of ids to fill in 30 : */ 31 : static void generatePointsAndIDs(const Point & start_point, 32 : const Point & end_point, 33 : unsigned int num_points, 34 : std::vector<Point> & points, 35 : std::vector<Real> & ids); 36 : 37 : /** 38 : * Gets the value of the variable at a point p. 39 : * Used with MultiAppUserObjectTransfer to transfer 40 : * variable information from one domain to another. 41 : **/ 42 0 : virtual Real spatialValue(const Point & p) const override { return getValue(p); } 43 : 44 : /** 45 : * Gets the value of the variable at a point p. 46 : * Returns zero if p does not lie along the line segment. 47 : **/ 48 : Real getValue(const Point & p) const; 49 : 50 : protected: 51 : const Point _start_point; 52 : const Point _end_point; 53 : 54 : unsigned int & _num_points; 55 : 56 : /// Vector connecting the start and end points of the line segment 57 : const RealVectorValue _line_vector; 58 : 59 : /// Zero vector 60 : const RealVectorValue _zero; 61 : 62 : /// Length of line segment 63 : const Real _line_vector_norm; 64 : 65 : private: 66 : const VectorPostprocessorValue & _vpp_value; 67 : };