12 #include "libmesh/utility.h" 25 "The number of points to sample along the line");
34 _start_point(getParam<Point>(
"start_point")),
35 _end_point(getParam<Point>(
"end_point")),
37 declareRestartableData<unsigned
int>(
"num_points", getParam<unsigned
int>(
"num_points"))),
38 _line_vector(_end_point - _start_point),
39 _line_vector_norm(_line_vector.
norm()),
40 _vpp_value(getVectorPostprocessorValueByName(_vpp_name, _variable_names[0]))
43 mooseError(
"LineValueSampler: `start_point` and `end_point` must be different.");
50 const Point & end_point,
51 unsigned int num_points,
52 std::vector<Point> & points,
53 std::vector<Real> & ids)
56 Point difference = end_point - start_point;
58 Point delta = difference /
Real(num_points - 1);
60 points.resize(num_points);
61 ids.resize(num_points);
63 for (
unsigned int i = 0; i < num_points - 1;
66 Point p = start_point + (i * delta);
69 ids[i] = (p - start_point).
norm();
73 points[num_points - 1] = end_point;
74 ids[num_points - 1] = (end_point - start_point).
norm();
81 mooseError(
"LineValueSampler: When calling getValue() on LineValueSampler, " 82 "only one variable can be provided as input to LineValueSampler.");
86 mooseError(
"LineValueSampler: When calling getValue() on LineValueSampler, " 87 "`sort_by` should be set to `id`.");
89 Real value = std::numeric_limits<Real>::infinity();
95 if (position >= 0.0 and position <= 1.0)
97 unsigned int vec_pos =
104 mooseWarning(
"Value requested outside of sampled points");
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Function to check whether two variables are equal within an absolute tolerance.
std::vector< Real > _ids
The ID to use for each point (yes, this is Real on purpose)
std::vector< Point > _points
The points to evaluate at.
static InputParameters validParams()
Real getValue(const Point &p) const
Gets the value of the variable at a point p.
void mooseWarning(Args &&... args) const
Emits a warning prefixed with object name and type.
Base class for sampling variable(s) at points.
const unsigned int _sort_by
What to sort by.
std::vector< VectorPostprocessorValue * > _values
const Real _line_vector_norm
Length of line segment.
static InputParameters validParams()
LineValueSampler(const InputParameters ¶meters)
virtual const OutputTools< Real >::VariableValue & value()
The value of the variable this object is operating on.
unsigned int & _num_points
const VectorPostprocessorValue & _vpp_value
VectorPostprocessorValue & _id
The node ID of each point.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static void generatePointsAndIDs(const Point &start_point, const Point &end_point, unsigned int num_points, std::vector< Point > &points, std::vector< Real > &ids)
Helper function to generate the list of points along a line and a unique ID for each point...
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
registerMooseObject("MooseApp", LineValueSampler)
void ErrorVector unsigned int
CTSub CT_OPERATOR_BINARY CTMul CTCompareLess CTCompareGreater CTCompareEqual _arg template pow< 2 >(tan(_arg))+1.0) *_arg.template D< dtag >()) CT_SIMPLE_UNARY_FUNCTION(sqrt