19 params.
addClassDescription(
"Perform a point reduction of the tabulated data upon initialization, "
20 "then evaluate using a linear interpolation.");
23 "Significant distance in the function below which points are considered removable noise");
26 "Scaling factor to apply to the function nodes for the purpose of "
27 "computing distances in the Douglas-Peucker point reduction algorithm. "
28 "This permits shifting the weight between x and y-direction distances.");
31 "Scaling factor to apply to the function nodes for the purpose of "
32 "computing distances in the Douglas-Peucker point reduction algorithm. "
33 "This permits shifting the weight between x and y-direction distances.");
54 mooseError(
"Data has still not been loaded at setup time. Something has gone wrong during "
55 "Function initialization, contact a developer");
61 const Real x_scale = getParam<Real>(
"x_scale");
62 const Real y_scale = getParam<Real>(
"y_scale");
63 const Real epsilon = getParam<Real>(
"epsilon");
67 list.reserve(
_raw_x.size());
69 list.emplace_back(
_raw_x[i] * x_scale,
_raw_y[i] * y_scale);
72 _console <<
"Reduced size for function '" <<
name() <<
"' from " << list.size();
74 _console <<
" to " << list.size() <<
" points." << std::endl;
77 _raw_x.resize(list.size());
78 _raw_y.resize(list.size());
79 for (MooseIndex(list) i = 0; i < list.size(); ++i)
81 _raw_x[i] = list[i].first / x_scale;
82 _raw_y[i] = list[i].second / y_scale;
registerMooseObject("MooseApp", CoarsenedPiecewiseLinear)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Function class that reads in a list of (x,y) value pairs representing a point-wise defined function s...
void buildCoarsenedGrid()
Builds the coarse linear interpolation from the fine raw data.
void initialSetup() override
Needed to process data loaded from user objects that are not available at construction.
CoarsenedPiecewiseLinear(const InputParameters ¶meters)
static InputParameters validParams()
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
const std::string & name() const
Get the name of the class.
std::vector< Real > _raw_x
raw function data as read
std::vector< Real > _raw_y
Base class for functions which provides a piecewise continuous linear interpolation of an (x,...
void buildInterpolation(const bool extrap=false)
Builds the linear interpolation object from the x/y data.
static InputParameters validParams()
bool _interpolation_created
Whether the interpolation has been created.
void initialSetup() override
Needed to load data from user objects that are not available at construction.
bool isRawDataLoaded() const
Returns whether the raw data has been loaded already.
std::vector< FunctionNode > FunctionNodeList
FunctionNodeList douglasPeucker(const FunctionNodeList &, libMesh::Real epsilon)
Generate a pruned function node list using the Ramer-Douglas-Peucker algorithm.