Go to the documentation of this file.
12 #include "libmesh/utility.h"
27 "The number of points to sample along the line");
36 _start_point(getParam<Point>(
"start_point")),
37 _end_point(getParam<Point>(
"end_point")),
39 declareRestartableData<unsigned int>(
"num_points", getParam<unsigned int>(
"num_points"))),
40 _line_vector(_end_point - _start_point),
41 _line_vector_norm(_line_vector.norm())
44 mooseError(
"LineValueSampler: `start_point` and `end_point` must be different.");
51 const Point & end_point,
52 unsigned int num_points,
53 std::vector<Point> & points,
54 std::vector<Real> & ids)
57 Point difference = end_point - start_point;
59 Point delta = difference / Real(num_points - 1);
61 points.resize(num_points);
62 ids.resize(num_points);
64 for (
unsigned int i = 0; i < num_points - 1;
67 Point p = start_point + (i * delta);
70 ids[i] = (p - start_point).norm();
74 points[num_points - 1] = end_point;
75 ids[num_points - 1] = (end_point - start_point).norm();
82 mooseError(
"LineValueSampler: When calling getValue() on LineValueSampler, "
83 "only one variable can be provided as input to LineValueSampler.");
87 mooseError(
"LineValueSampler: When calling getValue() on LineValueSampler, "
88 "`sort_by` should be set to `id`.");
90 Real
value = std::numeric_limits<Real>::infinity();
96 if (position >= 0.0 and position <= 1.0)
98 unsigned int vec_pos =
105 value = value_vector[vec_pos];
107 value = (value_vector[vec_pos - 1] + value_vector[vec_pos]) * 0.5;
virtual const OutputTools< Real >::VariableValue & value()
The value of the variable this object is operating on.
static InputParameters validParams()
void mooseError(Args &&... args) const
std::vector< VectorPostprocessorValue * > _values
LineValueSampler(const InputParameters ¶meters)
unsigned int & _num_points
static InputParameters validParams()
registerMooseObject("MooseApp", LineValueSampler)
std::vector< std::string > _variable_names
The variable names.
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.
std::vector< Real > _ids
The ID to use for each point (yes, this is Real on purpose)
const unsigned int _sort_by
What to sort by.
VectorPostprocessorValue & getVectorPostprocessorValue(const VectorPostprocessorName &name, const std::string &vector_name)
DEPRECATED: Use the new version where you need to specify whether or not the vector must be broadcast...
std::vector< Real > VectorPostprocessorValue
std::vector< Point > _points
The points to evaluate at.
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.
Real getValue(Point p) const
Gets the value of the variable at a point p.
const Real _line_vector_norm
Length of line segment.
FEProblemBase * _vpp_fe_problem
Pointer to FEProblemBase.
VectorPostprocessorValue & _id
The node ID of each point.
std::string _vpp_name
The name of the VectorPostprocessor.
defineLegacyParams(LineValueSampler)